/* ==========================================================================
   ARCHI GROUP - Assignment Submission Portal
   Visual Identity & System Stylesheet (Revised Edition)
   ========================================================================== */

/* --- Custom Brand Fonts --- */
@font-face {
  font-family: 'Ara Hamah 1964';
  src: url('../assets/fonts/AraHamah1964.woff2') format('woff2'),
       url('../assets/fonts/AraHamah1964.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Color System & Design Variables --- */
:root {
  /* Surface & Base Ink */
  --paper: #F3F1EA;
  --paper-2: #E9E6DC;
  --paper-3: #DEDAD0;
  --ink: #333333;
  --ink-muted: #555855;
  --ink-light: #707370;
  --white: #FFFFFF;
  --border-color: #D4CFC2;

  /* Primary Brand Palette */
  --maroon: #8E3B46;
  --maroon-dark: #742D37;
  --maroon-light: #F7EAEB;
  --green: #3E6B5E;
  --green-dark: #2D5046;
  --mustard: #C8962E;
  --mustard-dark: #A87B1F;
  --charcoal: #2B2D42;

  /* Major Colors (College Departments) */
  --major-arch: #8E3B46;
  --major-urban: #3E6B5E;
  --major-anim: #C8962E;
  --major-film: #A87B1F;

  /* Form Validation & State */
  --error-bg: #FDF2F2;
  --error-border: #D32F2F;
  --error-text: #8A1818;
  --success-bg: #EDF7ED;
  --success-border: #3E6B5E;
  --warning-bg: #FFF8E1;
  --warning-border: #C8962E;
  --danger: #B3261E;
  --danger-tint: #FBEAE8;

  /* Typography */
  --font-display: 'Ara Hamah 1964', 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Layout & Sizing */
  --max-width: 1100px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --touch-target: 48px;
}

/* --- Global Reset & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  box-shadow: none;
  scrollbar-gutter: auto;
  background-color: var(--paper);
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* Scattered square pixel blocks ONLY in brand colors: maroon, green, mustard (24-56px, 5-8% opacity) */
  background-image: url("data:image/svg+xml,%3Csvg width='480' height='480' viewBox='0 0 480 480' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='34' y='42' width='36' height='36' fill='%238E3B46' opacity='0.07'/%3E%3Crect x='70' y='78' width='24' height='24' fill='%238E3B46' opacity='0.05'/%3E%3Crect x='360' y='64' width='54' height='54' fill='%233E6B5E' opacity='0.08'/%3E%3Crect x='414' y='118' width='32' height='32' fill='%233E6B5E' opacity='0.06'/%3E%3Crect x='180' y='210' width='44' height='44' fill='%23C8962E' opacity='0.08'/%3E%3Crect x='224' y='254' width='28' height='28' fill='%23C8962E' opacity='0.06'/%3E%3Crect x='52' y='360' width='56' height='56' fill='%238E3B46' opacity='0.06'/%3E%3Crect x='380' y='340' width='48' height='48' fill='%233E6B5E' opacity='0.07'/%3E%3Crect x='348' y='388' width='32' height='32' fill='%23C8962E' opacity='0.06'/%3E%3C/svg%3E");
  background-repeat: repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  box-shadow: none;
  overflow-x: clip;
  width: 100%;
}

/* Accessibility: Focus outlines */
:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
}

/* Typography Defaults */
h1, h2, h3, .heading-display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

p, span, label, input, textarea, button {
  font-family: var(--font-body);
}

a {
  color: var(--maroon);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--maroon-dark);
}

/* --- Header & 3-Color Line --- */
.site-header {
  background-color: var(--paper);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  height: 64px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

@media (max-width: 699px) {
  .site-logo {
    height: 52px;
  }
  .header-inner {
    padding: 12px 16px;
  }
}

.header-wordmark {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--maroon);
  line-height: 1;
}

.header-support {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-muted);
}

/* Signature Committee 3-Color Horizontal Line */
.brand-divider-line {
  display: flex;
  width: 100%;
  height: 4px;
}

.brand-divider-line .segment-maroon {
  flex: 4;
  background-color: var(--maroon);
}

.brand-divider-line .segment-green {
  flex: 3;
  background-color: var(--green);
}

.brand-divider-line .segment-mustard {
  flex: 3;
  background-color: var(--mustard);
}

/* --- Main Layout Container --- */
.main-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 48px;
  width: 100%;
  flex: 1;
}

/* Honeypot hidden input (safe offscreen without causing horizontal scroll) */
.hp-field {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0) !important;
  overflow: hidden !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
}

/* --- Views Layout --- */
.view-section {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   VIEW 1: REDESIGNED HOME PAGE (TILES & ACCENT BARS)
   ========================================================================== */
.home-heading-group {
  margin-bottom: 28px;
}

.home-title {
  font-size: 2.2rem;
  color: var(--ink);
}

/* Workshop Group Block */
.workshop-block {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  overflow: hidden;
}

/* Thin 4px Accent Bar Cycling Colors */
.workshop-accent-bar {
  height: 4px;
  width: 100%;
}

.workshop-accent-bar.accent-maroon {
  background-color: var(--maroon);
}

.workshop-accent-bar.accent-green {
  background-color: var(--green);
}

.workshop-accent-bar.accent-mustard {
  background-color: var(--mustard);
}

.workshop-accent-bar.accent-muted {
  background-color: rgba(51, 51, 51, 0.3);
}

.workshop-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--paper-2);
}

.workshop-title {
  font-size: 1.65rem;
  color: var(--ink); /* Title text stays ink color */
}

/* Optional Workshop Description (rendered ONLY if non-empty) */
.workshop-desc {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Grid of Compact Assignment Tiles: 2 columns at >=700px, 1 column on mobile */
.assignment-tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
}

@media (min-width: 700px) {
  .assignment-tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  /* When workshop has exactly 1 tile, it must be full width */
  .assignment-tile:only-child {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Individual Assignment Tile */
.assignment-tile {
  background-color: var(--paper);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.assignment-tile:hover {
  background-color: var(--white);
  border-color: var(--maroon);
  transform: translateY(-2px);
}

.assignment-tile:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
}

/* Left/Start: Big Numeral (01..04) */
.tile-numeral {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  min-width: 44px;
  text-align: center;
}

.tile-numeral.num-color-1 {
  color: var(--maroon);
}

.tile-numeral.num-color-2 {
  color: var(--green);
}

.tile-numeral.num-color-3 {
  color: var(--mustard);
}

.tile-numeral.num-color-4 {
  color: var(--mustard-dark);
}

.tile-numeral.num-ended {
  color: rgba(51, 51, 51, 0.4);
}

.tile-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tile-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
}

/* Solid Maroon Button for Tile */
.tile-btn-submit {
  background-color: var(--maroon);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.assignment-tile:hover .tile-btn-submit {
  background-color: var(--maroon-dark);
}

/* Outlined Danger Button for ENDED Tile (Section D4) */
.tile-btn-ended {
  background-color: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.assignment-tile:hover .tile-btn-ended {
  background-color: var(--danger-tint);
}

/* Chips & Badges */
.countdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background-color: var(--white);
  color: var(--ink);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.countdown-chip.warning {
  background-color: var(--warning-bg);
  border-color: var(--mustard);
  color: var(--mustard-dark);
  font-weight: 600;
}

.countdown-chip.expired,
.countdown-chip.danger {
  background-color: var(--danger-tint);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

/* Empty State */
.empty-state-box {
  text-align: center;
  padding: 64px 20px;
  background-color: var(--white);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin: 32px 0;
}

.empty-state-text {
  font-size: 1.25rem;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ==========================================================================
   VIEW 2: ASSIGNMENT FORM & ROCKET VIEW
   ========================================================================== */
.form-view-layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (min-width: 900px) {
  .form-view-layout {
    display: grid;
    grid-template-columns: 330px 1fr;
    align-items: start;
    gap: 32px;
  }

  /* Desktop sticky: top 24px so rocket stays visible during form scroll */
  .rocket-column {
    position: sticky;
    top: 24px;
    z-index: 20;
  }
}

/* Assignment Header in Form: workshop name small above, assignment title big below */
.assignment-form-header {
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  margin-bottom: 12px;
  cursor: pointer;
}

.back-link svg {
  flex-shrink: 0;
  stroke: currentColor;
}

.back-link:hover {
  color: var(--maroon);
}

.form-workshop-sub {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--maroon);
  margin-bottom: 4px;
}

.form-assignment-main-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.form-assignment-desc {
  font-size: 1rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.form-deadline-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Form Container Card */
.form-card {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}

.form-group {
  margin-bottom: 22px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.field-label .required-indicator {
  color: var(--maroon);
  margin-right: 4px;
}

/* Enhanced Inputs (White background, 1.5px solid ink at ~45% opacity, clear focus ring) */
.field-input, .field-textarea {
  width: 100%;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid rgba(51, 51, 51, 0.45);
  border-radius: var(--radius-md);
  background-color: var(--white);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder, .field-textarea::placeholder {
  color: var(--ink-muted); /* WCAG AA contrast on white */
  opacity: 1;
}

.field-input:focus, .field-textarea:focus {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
  border-color: var(--mustard);
  background-color: var(--white);
}

.field-input.has-error, .field-textarea.has-error {
  border-color: var(--error-border);
  background-color: var(--error-bg);
}

/* Email input alignment: dir="ltr" but aligned right */
#field-email {
  direction: ltr;
  text-align: right;
}

#field-email::placeholder {
  text-align: right;
  direction: rtl;
}

.field-textarea {
  min-height: 85px;
  resize: vertical;
}

.char-counter {
  font-size: 0.85rem;
  color: var(--ink-light);
  text-align: left;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Button Group Selection (Year & Major) */
.button-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-choice {
  flex: 1 1 calc(20% - 8px);
  min-width: 90px;
  min-height: var(--touch-target);
  padding: 8px 12px;
  background-color: var(--white);
  border: 1.5px solid rgba(51, 51, 51, 0.45);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-choice:hover {
  background-color: var(--paper-2);
  border-color: var(--ink);
}

.btn-choice.active {
  background-color: var(--maroon);
  color: var(--white);
  border-color: var(--maroon);
  font-weight: 600;
}

/* Major Specific Button Styles */
.btn-choice-major[data-major="architecture"].active {
  background-color: var(--major-arch);
  border-color: var(--major-arch);
  color: var(--white);
}

.btn-choice-major[data-major="urban"].active {
  background-color: var(--major-urban);
  border-color: var(--major-urban);
  color: var(--white);
}

.btn-choice-major[data-major="animation"].active {
  background-color: var(--major-anim);
  border-color: var(--major-anim);
  color: var(--ink);
}

.btn-choice-major[data-major="film"].active {
  background-color: var(--major-film);
  border-color: var(--major-film);
  color: var(--white);
}

/* Inline Field Error Message */
.field-error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--error-bg);
  border-left: 3px solid var(--error-border);
  color: var(--error-text);
  font-size: 0.88rem;
  font-weight: 500;
}

.field-error-msg.visible {
  display: flex;
}

/* --- File Drop Zone --- */
.file-dropzone {
  border: 2px dashed rgba(51, 51, 51, 0.45);
  border-radius: var(--radius-lg);
  background-color: var(--white);
  padding: 32px 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.file-dropzone:hover, .file-dropzone.dragover {
  border-color: var(--green);
  background-color: var(--paper);
}

.file-dropzone.has-error {
  border-color: var(--error-border);
  background-color: var(--error-bg);
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  stroke: var(--maroon);
}

.dropzone-main-text {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--ink);
}

.dropzone-hints {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Selected File Display */
.file-selected-box {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 10px;
}

.file-selected-box.visible {
  display: flex;
}

.file-info-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: 10px;
}

.file-name-text {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}

.file-size-text {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.btn-change-file {
  background: none;
  border: none;
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Hidden File Input */
.native-file-input {
  display: none;
}

/* --- Submit & General Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  min-height: 52px;
  padding: 10px 24px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

/* Primary Button: Solid Maroon Everywhere */
.btn-primary {
  background-color: var(--maroon);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--maroon-dark);
}

.btn-primary:disabled {
  background-color: var(--paper-3);
  color: var(--ink-light);
  cursor: not-allowed;
  opacity: 0.75;
}

/* Secondary Button: Ink outline on paper */
.btn-secondary {
  background-color: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.btn-secondary:hover {
  background-color: var(--paper-2);
}

.btn-cancel-upload {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--error-text);
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 10px;
}

.btn-cancel-upload:hover {
  background-color: var(--error-bg);
}

/* ==========================================================================
   SECTION 9: THE ROCKET STAGE & ANIMATION
   ========================================================================== */
.rocket-card {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  overflow: visible;
}

.rocket-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 360px;
  overflow: visible;
  max-width: 100%;
}

/* Flight Track */
.rocket-track {
  position: absolute;
  top: 16px;
  bottom: 84px;
  right: 14px;
  width: 34px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.track-line {
  width: 2px;
  background-color: var(--border-color);
  height: 100%;
  margin-right: 4px;
}

/* 0-100% Marks >= 14px per spec */
.track-markers {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-light);
  font-family: var(--font-body);
}

/* Particle Canvas */
.rocket-particle-canvas {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
}

/* Vehicle Assembly */
.rocket-assembly {
  position: relative;
  margin-top: auto;
  margin-bottom: 20px;
  z-index: 10;
}

.rocket-vehicle {
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* Pre-launch vibration when all 4 fields are valid */
.ready-shake {
  animation: prelaunchShake 1.8s infinite ease-in-out;
}

@keyframes prelaunchShake {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-1.5px) rotate(0.4deg); }
  75% { transform: translateY(1.5px) rotate(-0.4deg); }
}

/* Fast subtle vibration during 700ms ignition stage */
.ignition-shake {
  animation: ignitionVibrate 0.07s infinite alternate ease-in-out !important;
}

@keyframes ignitionVibrate {
  0% { transform: translateY(-1px) translateX(-0.8px); }
  100% { transform: translateY(1px) translateX(0.8px); }
}

/* Flame Idle & Behavior */
.rocket-flame-group {
  transform-origin: 0 0;
  transition: transform 0.2s ease-out;
}

.flame-idle {
  animation: flameFlicker 0.6s infinite alternate ease-in-out;
}

.flame-low {
  opacity: 0.45;
  transform: scale(0.4) !important;
}

@keyframes flameFlicker {
  0% { transform: translate(50px, 126px) scale(0.9); }
  100% { transform: translate(50px, 126px) scale(1.15); }
}

/* 4 Indicator Lights Panel */
.rocket-lights-panel {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 14px 0 10px;
  width: 100%;
}

.indicator-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.indicator-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Light labels >= 14px per spec */
.indicator-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* Pop Animation on Valid Field */
.indicator-dot.pop {
  animation: lightPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes lightPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Active Indicator Colors in Order */
.indicator-dot.light-maroon.active {
  background-color: var(--maroon);
  border-color: var(--maroon);
  box-shadow: 0 0 8px rgba(142, 59, 70, 0.4);
}

.indicator-dot.light-green.active {
  background-color: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(62, 107, 94, 0.4);
}

.indicator-dot.light-mustard.active {
  background-color: var(--mustard);
  border-color: var(--mustard);
  box-shadow: 0 0 8px rgba(200, 150, 46, 0.4);
}

.indicator-dot.light-charcoal.active {
  background-color: var(--charcoal);
  border-color: var(--charcoal);
  box-shadow: 0 0 8px rgba(43, 45, 66, 0.4);
}

/* Progress bar container */
.rocket-progress-container {
  width: 100%;
  height: 8px;
  background-color: var(--paper-2);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0 8px;
}

.rocket-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--maroon);
  transition: width 0.15s linear;
}

/* Live status text: >= 16px per spec */
.rocket-status-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  min-height: 26px;
  margin-top: 4px;
  line-height: 1.4;
}

/* Mobile Compact Rocket Panel: max ~220px tall so form is not pushed below first screen */
@media (max-width: 899px) {
  .rocket-card {
    padding: 10px 12px;
  }

  .rocket-stage {
    min-height: unset;
    max-height: 220px;
  }

  .rocket-track {
    display: none; /* Hide vertical track on compact mobile view */
  }

  .rocket-assembly {
    margin-bottom: 2px;
  }

  .rocket-svg {
    width: 56px;
    height: 90px;
  }

  .launch-pad-scaffold svg {
    width: 84px;
    height: 24px;
  }

  .rocket-particle-canvas {
    height: 200px;
  }

  .rocket-lights-panel {
    margin: 4px 0 2px;
    gap: 12px;
  }

  .indicator-dot {
    width: 14px;
    height: 14px;
  }

  .indicator-label {
    font-size: 14px;
  }

  .rocket-status-text {
    font-size: 15px;
    min-height: 22px;
    margin-top: 2px;
  }
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  .ready-shake, .flame-idle, .indicator-dot.pop {
    animation: none !important;
  }

  .rocket-vehicle {
    transform: none !important;
    transition: none !important;
  }

  .rocket-particle-canvas {
    display: none !important;
  }
}

/* ==========================================================================
   VIEW 3: SUCCESS SCREEN
   ========================================================================== */
.success-card {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  max-width: 640px;
  margin: 32px auto;
}

.success-icon-badge {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background-color: var(--success-bg);
  border: 2px solid var(--success-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-icon-badge svg {
  width: 36px;
  height: 36px;
  stroke: var(--green);
}

.success-title {
  font-size: 2.2rem;
  color: var(--green);
  margin-bottom: 12px;
}

.success-confirmation-line {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
  background-color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  display: inline-block;
}

.success-sub {
  font-size: 1rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.success-action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.success-version-note {
  font-size: 0.88rem;
  color: var(--ink-light);
  line-height: 1.6;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* ==========================================================================
   VIEW 4 & 5: CLOSED / ERROR STATES
   ========================================================================== */
.state-feedback-card {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  max-width: 580px;
  margin: 40px auto;
}

.state-feedback-title {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--maroon);
}

.state-feedback-desc {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

/* --- Danger Style ENDED Screen (Section F2) --- */
.state-feedback-card.ended-card {
  background-color: var(--danger-tint);
  border: 1px solid #F5C6CB;
  border-inline-start: 4px solid var(--danger);
  text-align: right;
  max-width: 620px;
  margin: 40px auto;
  padding: 32px 28px;
}

.ended-card .ended-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.ended-card .ended-icon {
  width: 36px;
  height: 36px;
  color: var(--danger);
  flex-shrink: 0;
}

.ended-card .ended-title {
  font-size: 1.85rem;
  color: var(--ink);
  margin: 0;
}

.ended-card .ended-desc {
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.7;
  margin-bottom: 14px;
}

.ended-card .ended-support-note {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.ended-card .ended-support-contact {
  display: block;
  font-weight: 600;
  color: var(--maroon);
  margin-top: 6px;
}

/* Fixed Full-Viewport Overlay for Liftoff Past Top Edge (C3) */
#rocket-launch-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  overflow: hidden;
}

/* Finalize Retry Box (C4) */
.rocket-finalize-error {
  margin-top: 14px;
  padding: 12px 14px;
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  color: var(--error-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-retry-finalize {
  background-color: var(--maroon);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-retry-finalize:hover {
  background-color: var(--maroon-dark);
}

/* ==========================================================================
   RESPONSIVE DESIGN (360px Mobile-first checks)
   ========================================================================== */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .main-wrapper {
    padding: 18px 14px 36px;
  }

  .form-card, .workshop-block, .success-card {
    padding: 20px 16px;
  }

  .btn-choice {
    flex: 1 1 calc(50% - 6px);
  }
}
