@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Inconsolata:wght@300;400;500&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --void:          #010b16;
  --deep:          #021422;
  --abyss:         #03192c;
  --glass-bg:      rgba(5, 28, 50, 0.50);
  --glass-border:  rgba(70, 150, 195, 0.14);
  --glass-shine:   rgba(110, 200, 240, 0.09);
  --glow-blue:     rgba(55, 155, 220, 0.75);
  --glow-teal:     rgba(35, 195, 175, 0.65);
  --text-primary:  rgba(188, 228, 245, 0.93);
  --text-dim:      rgba(100, 165, 205, 0.58);
  --text-eerie:    rgba(205, 242, 255, 0.88);
  --prompt-col:    rgba(55, 205, 200, 0.92);
  --col-blue:      rgba(55, 135, 225, 0.90);
  --col-green:     rgba(55, 200, 115, 0.90);
  --col-red:       rgba(220, 75, 60,  0.90);
  --modal-bg:      rgba(1, 7, 16, 0.88);
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; min-height: 100vh;
  background: var(--void);
  color: var(--text-primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
  overflow-x: hidden;
}

/* ─── BACKGROUND ─────────────────────────────────────────────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% 10%,  rgba(3, 28, 58, 0.95) 0%, transparent 70%),
    radial-gradient(ellipse 55% 75% at 15% 85%,  rgba(2, 18, 38, 0.95) 0%, transparent 60%),
    radial-gradient(ellipse 45% 55% at 85% 55%,  rgba(3, 22, 46, 0.85) 0%, transparent 60%),
    linear-gradient(180deg, #010810 0%, #011220 35%, #011828 65%, #010c1a 100%);
}

/* Caustic light bands */
.bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(-45deg,
      transparent 0px, transparent 90px,
      rgba(25, 90, 155, 0.016) 90px, rgba(25, 90, 155, 0.016) 92px),
    repeating-linear-gradient( 45deg,
      transparent 0px, transparent 130px,
      rgba(18, 70, 125, 0.013) 130px, rgba(18, 70, 125, 0.013) 132px);
  animation: caustic 22s ease-in-out infinite alternate;
}

@keyframes caustic {
  from { transform: translateX(0)    translateY(0);    opacity: .55; }
  50%  { transform: translateX(-18px) translateY(10px); opacity: 1;   }
  to   { transform: translateX(12px) translateY(-6px); opacity: .65; }
}

/* ─── OVERLAYS ───────────────────────────────────────────────────────────── */
.scanlines {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(
    0deg, transparent 0px, transparent 3px,
    rgba(0,0,0,.042) 3px, rgba(0,0,0,.042) 4px);
  opacity: .45;
}

.vignette {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 100% 100% at 50% 50%,
    transparent 35%, rgba(0, 4, 10, .72) 100%);
}

/* ─── PARTICLES ──────────────────────────────────────────────────────────── */
#particles {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none; overflow: hidden;
}

.particle {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(95, 195, 238, .48) 0%,
    rgba(55, 155, 200, .10) 60%,
    transparent 100%);
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(105vh) translateX(0)                       scale(1);              opacity: 0; }
  8%   { opacity: 1; }
  50%  { transform: translateY(50vh)  translateX(var(--drift))            scale(var(--smid));    }
  92%  { opacity: .55; }
  100% { transform: translateY(-8vh)  translateX(calc(var(--drift) * 1.8)) scale(.28);           opacity: 0; }
}

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
.page {
  position: relative; z-index: 10;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1.25rem;
}

/* ─── GLASS PANEL ─────────────────────────────────────────────────────────── */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 3px;
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow:
    0 0 50px rgba(0,0,0,.65),
    inset 0 1px 0 var(--glass-shine),
    inset 0 -1px 0 rgba(0,0,0,.28),
    0 0 100px rgba(15, 70, 135, .12);
  position: relative; overflow: hidden;
}

.glass-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(130, 205, 240, .28), transparent);
}

/* ─── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
.site-label {
  font-family: 'Inconsolata', monospace;
  font-size: .62rem; letter-spacing: .38em;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: 2.5rem;
}

h1.title {
  font-size: 3rem; font-weight: 300; font-style: italic;
  letter-spacing: .1em; color: var(--text-eerie);
  line-height: 1.1; margin-bottom: .4rem;
  text-shadow: 0 0 35px rgba(75, 175, 220, .42);
}

.subtitle {
  font-family: 'Inconsolata', monospace;
  font-size: .68rem; letter-spacing: .22em;
  color: var(--text-dim); margin-bottom: 2.5rem;
  text-transform: uppercase;
}

/* ─── LANDING ─────────────────────────────────────────────────────────────── */
.landing-container {
  width: min(480px, 92vw);
  padding: 3.5rem 3rem;
  text-align: center;
}

.group-display {
  margin: 1.5rem 0;
  padding: 1.5rem 2rem;
  border: 1px solid rgba(70, 150, 195, .2);
  border-radius: 2px;
  background: rgba(8, 35, 62, .42);
}

.group-label {
  font-family: 'Inconsolata', monospace;
  font-size: .62rem; letter-spacing: .3em;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: .6rem;
}

.group-number {
  font-size: 4rem; font-weight: 300;
  color: var(--text-eerie); line-height: 1;
  text-shadow: 0 0 25px var(--glow-blue);
}

.sequence-display {
  font-family: 'Inconsolata', monospace;
  font-size: .72rem; letter-spacing: .14em;
  color: rgba(95, 175, 218, .6); margin-top: .55rem;
}

.landing-note {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .18em;
  color: rgba(75, 135, 178, .42);
  text-transform: uppercase; line-height: 2;
  margin-top: 1.5rem;
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Inconsolata', monospace;
  font-size: .72rem; letter-spacing: .38em; text-transform: uppercase;
  color: var(--text-primary); background: transparent;
  border: 1px solid rgba(75, 155, 200, .38);
  padding: .9rem 2.6rem; cursor: pointer;
  transition: all .35s ease;
  position: relative; overflow: hidden;
  margin-top: 1.75rem;
}

.btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(38, 115, 178, .16), rgba(18, 76, 138, .10));
  opacity: 0; transition: opacity .35s ease;
}

.btn:hover::before { opacity: 1; }
.btn:hover {
  border-color: rgba(95, 198, 240, .65);
  box-shadow: 0 0 22px rgba(55, 155, 220, .18), inset 0 0 22px rgba(55, 155, 220, .05);
  color: rgba(205, 242, 255, 1);
}
.btn:active { transform: scale(.979); }

.btn-reset {
  display: block; margin: 1.2rem auto 0;
  font-family: 'Inconsolata', monospace;
  font-size: .55rem; letter-spacing: .25em; text-transform: lowercase;
  color: rgba(60, 100, 135, .35); background: transparent;
  border: none; cursor: pointer;
  transition: color .3s ease;
}
.btn-reset:hover { color: rgba(80, 140, 180, .65); }

/* ─── CHAMBER LAYOUT ─────────────────────────────────────────────────────── */
.chamber-wrapper { width: min(720px, 96vw); }

.chamber-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 1.75rem;
  padding: 0 .25rem;
}

.chamber-header-left {}

.chamber-id {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .36em;
  color: var(--text-dim); text-transform: uppercase;
}

.chamber-letter {
  font-size: 4.5rem; font-weight: 300; font-style: italic;
  color: var(--text-eerie); line-height: 1;
  text-shadow: 0 0 45px rgba(75, 178, 220, .52);
}

.chamber-sublabel {
  font-family: 'Inconsolata', monospace;
  font-size: .58rem; letter-spacing: .32em;
  color: rgba(80, 145, 188, .45); text-transform: uppercase;
  margin-top: .2rem;
}

.timer-display { text-align: right; }

.timer-label {
  font-family: 'Inconsolata', monospace;
  font-size: .58rem; letter-spacing: .30em;
  color: var(--text-dim); text-transform: uppercase; margin-bottom: .22rem;
}

.timer-value {
  font-family: 'Inconsolata', monospace;
  font-size: 2.1rem; font-weight: 300;
  color: var(--text-primary); letter-spacing: .12em;
  text-shadow: 0 0 18px rgba(55, 178, 220, .50);
}

.chamber-panel { /* outer glass wrapper */ }

.chamber-content {
  padding: 2.5rem 2.75rem;
  min-height: 300px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}

/* ─── PROGRESS BAR ───────────────────────────────────────────────────────── */
.progress-bar-wrap {
  width: 100%; height: 1px;
  background: rgba(35, 72, 112, .32);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(35, 115, 178, .55), rgba(75, 198, 222, .82));
  box-shadow: 0 0 7px rgba(75, 198, 222, .55);
  transition: width 1s linear; width: 0%;
}

/* ─── STEP DOTS ──────────────────────────────────────────────────────────── */
.step-row {
  display: flex; gap: .85rem; margin-top: 1.4rem; justify-content: center;
}

.step-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(35, 72, 112, .48);
  border: 1px solid rgba(55, 115, 158, .28);
  transition: all .45s ease;
}

.step-dot.active {
  background: rgba(75, 178, 222, .82);
  box-shadow: 0 0 10px rgba(75, 178, 222, .52);
  border-color: rgba(100, 200, 240, .65);
}

.step-dot.done {
  background: rgba(55, 155, 198, .38);
  border-color: rgba(75, 155, 198, .28);
}

/* ─── CHAMBER A — VIDEO ──────────────────────────────────────────────────── */
.video-tank {
  width: 100%; aspect-ratio: 16/9;
  position: relative; overflow: hidden;
  border: 1px solid rgba(35, 90, 145, .22);
  border-radius: 2px;
  background: rgba(1, 12, 25, .75);
}

.video-tank iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Shimmer overlay on top of video */
.video-tank::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(ellipse 65% 45% at 50% 50%,
      rgba(8, 55, 98, .22) 0%, transparent 75%);
  animation: tankShimmer 9s ease-in-out infinite alternate;
}

@keyframes tankShimmer {
  from { opacity: .45; transform: scale(1);    }
  to   { opacity: .85; transform: scale(1.04); }
}

.video-fallback {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inconsolata', monospace;
  font-size: .68rem; letter-spacing: .28em;
  color: rgba(75, 135, 178, .45); text-transform: uppercase;
}

/* ─── CHAMBER B — MATCHING ───────────────────────────────────────────────── */
.matching-phase {
  display: flex; flex-direction: column;
  align-items: center; gap: 1.5rem;
  animation: fadeIn .9s ease forwards;
}

.matching-phase.hidden {
  animation: fadeOut .8s ease forwards;
  pointer-events: none;
}

.matching-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(65, 145, 195, .3);
  border-top-color: rgba(65, 145, 195, .8);
  animation: spin 1.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.matching-label {
  font-family: 'Inconsolata', monospace;
  font-size: .65rem; letter-spacing: .35em;
  color: var(--text-dim); text-transform: uppercase;
}

.color-badge-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: .9rem;
}

.color-orb {
  width: 68px; height: 68px; border-radius: 50%;
  position: relative;
  animation: orb-pulse 2.8s ease-in-out infinite;
}

.color-orb.blue  { background: radial-gradient(circle, rgba(75, 155, 245, .95) 0%, rgba(45, 105, 210, .5) 60%, transparent 100%); box-shadow: 0 0 35px rgba(75, 155, 245, .55), 0 0 70px rgba(55, 125, 220, .25); }
.color-orb.green { background: radial-gradient(circle, rgba(65, 210, 125, .95) 0%, rgba(40, 165, 95, .50) 60%, transparent 100%); box-shadow: 0 0 35px rgba(65, 210, 125, .55), 0 0 70px rgba(45, 175, 100, .25); }
.color-orb.red   { background: radial-gradient(circle, rgba(230, 85, 68, .95) 0%, rgba(185, 55, 45, .50) 60%, transparent 100%); box-shadow: 0 0 35px rgba(230, 85, 68, .55), 0 0 70px rgba(195, 60, 50, .25); }

@keyframes orb-pulse {
  0%, 100% { transform: scale(1);    }
  50%       { transform: scale(1.06); }
}

.color-name {
  font-size: 2.2rem; font-weight: 300; font-style: italic;
  letter-spacing: .10em;
}

.color-name.blue  { color: rgba(110, 185, 255, .92); text-shadow: 0 0 28px rgba(75, 155, 245, .55); }
.color-name.green { color: rgba(85, 225, 145, .92);  text-shadow: 0 0 28px rgba(65, 210, 125, .55); }
.color-name.red   { color: rgba(245, 110, 95, .92);  text-shadow: 0 0 28px rgba(230, 85, 68,  .55); }

.match-instruction {
  font-family: 'Inconsolata', monospace;
  font-size: .70rem; letter-spacing: .18em; line-height: 1.9;
  color: rgba(155, 210, 235, .68); text-transform: uppercase;
  border: 1px solid rgba(65, 125, 168, .2);
  padding: .9rem 1.4rem;
  background: rgba(5, 28, 52, .35);
  border-radius: 1px;
  max-width: 340px;
}

.phase-tag {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .32em;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: 1.8rem;
}

/* ─── PROMPTS ─────────────────────────────────────────────────────────────── */
.prompt-area {
  width: 100%; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
}

.prompt-text {
  font-size: 1.72rem; font-weight: 300; font-style: italic;
  color: var(--prompt-col); letter-spacing: .06em;
  line-height: 1.42; max-width: 520px;
  text-shadow: 0 0 22px rgba(55, 205, 200, .48), 0 0 65px rgba(38, 162, 180, .18);
  animation: promptIn 1.1s ease forwards;
}

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

/* ─── CHAMBER C — MEMORY ─────────────────────────────────────────────────── */
.memory-bg-image {
  position: absolute; inset: 0; z-index: 0;
  object-fit: cover; width: 100%; height: 100%;
  opacity: .12; filter: blur(2px) saturate(.65);
  pointer-events: none;
}

/* ─── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--modal-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .5s ease;
}

.modal-overlay.active {
  opacity: 1; pointer-events: all;
}

.modal-box {
  width: min(440px, 90vw); padding: 3.2rem 2.8rem;
  text-align: center;
  transform: translateY(12px) scale(.975);
  transition: transform .5s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-eyebrow {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .42em;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.modal-text {
  font-size: 1.85rem; font-weight: 300; font-style: italic;
  color: var(--text-eerie); line-height: 1.38;
  text-shadow: 0 0 22px rgba(75, 178, 220, .38);
  margin-bottom: 1rem;
}

/* The "wait for command" instruction */
.modal-wait {
  font-family: 'Inconsolata', monospace;
  font-size: .65rem; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(135, 195, 225, .50);
  margin-bottom: 2rem; line-height: 1.7;
}

.modal-close {
  font-family: 'Inconsolata', monospace;
  font-size: .65rem; letter-spacing: .38em; text-transform: uppercase;
  color: var(--text-dim); background: transparent;
  border: 1px solid rgba(55, 115, 158, .30);
  padding: .72rem 2.1rem; cursor: pointer;
  transition: all .3s ease;
}

.modal-close:hover {
  border-color: rgba(100, 198, 240, .52);
  color: var(--text-primary);
  box-shadow: 0 0 16px rgba(55, 158, 220, .14);
}

/* Memory modal image */
.memory-modal-img {
  width: 100%; max-height: 260px;
  object-fit: cover; border-radius: 1px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(70, 140, 185, .20);
  opacity: .88;
}

.memory-modal-caption {
  font-family: 'Inconsolata', monospace;
  font-size: .62rem; letter-spacing: .25em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 2rem;
}

/* ─── FINAL PAGE ──────────────────────────────────────────────────────────── */
.final-container {
  width: min(600px, 94vw);
  padding: 3.5rem 3rem;
}

.final-header { text-align: center; margin-bottom: 2.5rem; }

.final-title {
  font-size: 2.5rem; font-weight: 300; font-style: italic;
  color: var(--text-eerie);
  text-shadow: 0 0 32px rgba(75, 178, 220, .35);
  margin-bottom: .45rem;
}

.final-meta {
  font-family: 'Inconsolata', monospace;
  font-size: .62rem; letter-spacing: .24em;
  color: var(--text-dim); text-transform: uppercase;
}

.summary-block {
  padding: 1.4rem 1.5rem;
  border: 1px solid rgba(55, 115, 158, .18);
  border-radius: 1px;
  background: rgba(4, 22, 42, .42);
  margin-bottom: 2rem;
}

.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .48rem 0;
  border-bottom: 1px solid rgba(35, 72, 108, .14);
}
.summary-row:last-child { border-bottom: none; }

.summary-key {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .28em;
  color: var(--text-dim); text-transform: uppercase;
}

.summary-val {
  font-family: 'Inconsolata', monospace;
  font-size: .78rem; color: var(--text-primary); letter-spacing: .10em;
}

.response-label {
  font-family: 'Inconsolata', monospace;
  font-size: .60rem; letter-spacing: .30em;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: .72rem;
}

textarea {
  width: 100%; min-height: 155px;
  background: rgba(3, 18, 36, .62);
  border: 1px solid rgba(55, 115, 158, .30);
  border-radius: 1px; color: var(--text-primary);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.12rem; font-weight: 300; font-style: italic;
  padding: 1rem 1.1rem; resize: vertical; outline: none;
  line-height: 1.65;
  transition: border-color .3s ease, box-shadow .3s ease;
}

textarea::placeholder {
  color: rgba(75, 135, 178, .38); font-style: italic;
}

textarea:focus {
  border-color: rgba(75, 155, 200, .50);
  box-shadow: 0 0 22px rgba(38, 115, 178, .10);
}

.btn-row {
  display: flex; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap;
}
.btn-row .btn { margin-top: 0; flex: 1; min-width: 130px; }

/* ─── UTILITY ─────────────────────────────────────────────────────────────── */
.divider {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(55, 115, 158, .28), transparent);
  margin: 1.8rem 0;
}

.fade-in {
  animation: fadeIn .85s ease forwards;
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .landing-container { padding: 2.5rem 1.75rem; }
  h1.title { font-size: 2.4rem; }
  .chamber-content { padding: 1.75rem 1.5rem; }
  .chamber-letter { font-size: 3.2rem; }
  .prompt-text { font-size: 1.38rem; }
  .modal-box { padding: 2.2rem 1.75rem; }
  .final-container { padding: 2.5rem 1.75rem; }
}


/* ─── ADDED: GROUP DISCUSSION INSTRUCTION ────────────────────────────────── */
.prompt-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.discussion-instruction {
  margin-top: 1.2rem;
  font-family: 'Inconsolata', monospace;
  font-size: .65rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(120, 190, 220, .55);
}

/* ─── ADDED: CHAMBER C MEMORY ROULETTE DISPLAY ───────────────────────────── */
.memory-roulette {
  width: min(420px, 86vw);
  margin: 0 auto 1.6rem;
  border: 1px solid rgba(70, 140, 185, .20);
  background: rgba(1, 12, 25, .42);
  box-shadow: 0 0 34px rgba(55, 155, 220, .10);
  overflow: hidden;
}

.memory-display-img {
  display: block;
  width: 100%;
  max-height: 235px;
  object-fit: cover;
  opacity: .88;
  animation: promptIn 1.1s ease forwards;
}
