/* ═══════════════════════════════════════════════════════════════
   THE FIVE LAMPS — Museum-Quality Cinematic Stylesheet
   Physicians of the Inner Ward, Convened via the COMPANION Protocol
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Void & atmosphere */
  --void:           #04060a;
  --void-deep:      #000000;
  --void-warm:      #060a0e;

  /* Lamp light (warm amber) */
  --gold:           #d4a843;
  --gold-bright:    #ecc86a;
  --gold-dim:       #8b7c55;
  --gold-faint:     rgba(212, 168, 67, 0.06);
  --gold-glow:      rgba(212, 168, 67, 0.25);

  /* Parchment & ink */
  --bone:           #e4e0d6;
  --bone-dim:       rgba(228, 224, 214, 0.55);
  --parchment:      #f0ece2;
  --ink:            #1a1712;
  --ash:            #1a1a1a;
  --smoke:          #666;

  /* Lamp colors — each physician */
  --hippocrates:    #e8dcc8;
  --snow:           #4a8eb8;
  --marmot:         #5a9a6a;
  --jung:           #9b5a8a;
  --farmer:         #c9a227;

  /* Ward tones (inner ward) */
  --wood-dark:      #0e1218;
  --wood-medium:    #161c24;
  --wood-light:     #1e2832;
  --wood-accent:    #28343e;
  --leather:        #1c2228;

  /* Typography */
  --font-display:   'Playfair Display', Georgia, serif;
  --font-voice:     'Cormorant Garamond', Georgia, serif;
  --font-colonial:  'IM Fell English', Georgia, serif;
  --font-body:      'IM Fell DW Pica', Georgia, serif;
  --font-terminal:  'IBM Plex Mono', 'Courier New', monospace;

  /* Spacing (golden ratio) */
  --space-xs:       0.382rem;
  --space-sm:       0.618rem;
  --space-md:       1rem;
  --space-lg:       1.618rem;
  --space-xl:       2.618rem;
  --space-2xl:      4.236rem;
  --space-3xl:      6.854rem;
}


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

html {
  scroll-behavior: smooth;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--font-voice);
  font-weight: 300;
  line-height: 1.8;
  min-height: 100%;
  overflow-x: hidden;
}

::selection {
  background: var(--gold);
  color: var(--void);
}

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }


/* ═══════════════════════════════════════════════════════════════
   I.  CINEMATIC INTRO
   ═══════════════════════════════════════════════════════════════ */

#cinematic-intro {
  position: relative;
  z-index: 20;
}

#cinematic-intro.hidden {
  display: none;
}


/* ── Act Sections (full viewport) ── */
.act {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.act-dark {
  background: var(--void);
}

.act-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.act-content-center {
  text-align: center;
}


/* ── ACT 1: THE VOID ── */

#act-void {
  background: var(--void-deep);
}

.void-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(212, 168, 67, 0.012) 0%, transparent 60%);
  animation: breathe 10s ease-in-out infinite;
  pointer-events: none;
}

.ember-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.ember {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  animation: ember-float linear infinite;
  will-change: transform, opacity;
}

/* Typewriter */
.typewriter-block {
  max-width: 700px;
  margin: 0 auto;
  padding-top: 6vh;
}

.typewriter-line {
  font-family: var(--font-voice);
  font-size: clamp(1.3rem, 3.5vw, 2.2rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--bone);
  min-height: 1.4em;
  letter-spacing: 0.01em;
  opacity: 0;
}

.typewriter-line.typing,
.typewriter-line.typed {
  opacity: 1;
}

.typewriter-line-emphasis {
  font-weight: 400;
  color: var(--gold-bright);
  font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  margin-top: 0.4em;
}

.typewriter-pause {
  height: 1.2em;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 0.85em;
  background: var(--gold);
  margin-left: 3px;
  animation: cursor-blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}

/* Scroll cue */
.scroll-cue {
  margin-top: 4rem;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.scroll-cue.visible {
  opacity: 1;
}

.scroll-cue.hidden {
  opacity: 0;
}

.scroll-cue-text {
  display: block;
  font-family: var(--font-terminal);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.scroll-cue-arrow {
  display: block;
  font-size: 1.4rem;
  color: var(--gold-dim);
  animation: scroll-pulse 2.5s ease-in-out infinite;
  margin-top: 0.3rem;
}


/* ── ACT 2–6: Reveal System ── */

.reveal-group {
  margin-bottom: var(--space-xl);
}

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

.reveal-group-delay .reveal-line { --reveal-base-delay: 0.3s; }
.reveal-group-delay-2 .reveal-line { --reveal-base-delay: 0.6s; }
.reveal-group-delay-3 .reveal-line { --reveal-base-delay: 0.9s; }

.reveal-line {
  font-family: var(--font-voice);
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  font-weight: 300;
  line-height: 1.9;
  color: var(--bone);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-delay: var(--reveal-base-delay, 0s);
}

.reveal-line.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger siblings within groups */
.reveal-group .reveal-line:nth-child(2) { transition-delay: calc(var(--reveal-base-delay, 0s) + 0.12s); }
.reveal-group .reveal-line:nth-child(3) { transition-delay: calc(var(--reveal-base-delay, 0s) + 0.24s); }
.reveal-group .reveal-line:nth-child(4) { transition-delay: calc(var(--reveal-base-delay, 0s) + 0.36s); }

/* Reveal line variants */
.reveal-line-large {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 400;
  line-height: 1.65;
}

.reveal-line-dim {
  color: var(--bone-dim);
}

.reveal-line-accent {
  color: var(--gold-bright);
  font-weight: 400;
  font-style: italic;
}

.reveal-line-emphasis-sm {
  color: var(--bone-dim);
  font-style: italic;
  margin-top: var(--space-md);
}

.reveal-line-question {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 600;
  font-style: italic;
  color: var(--gold-bright);
  margin-top: var(--space-sm);
  letter-spacing: 0.01em;
  text-shadow: 0 0 40px var(--gold-glow);
}


/* ── ACT 6: LAMP PORTRAITS ── */

.committee-reveal-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.ornament-cinematic {
  font-size: 1.4rem;
  color: var(--gold-dim);
  letter-spacing: 0.6em;
  margin-bottom: var(--space-sm);
}

.committee-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--bone);
  line-height: 1.1;
}

.committee-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--gold);
  margin-top: 0.1em;
}

.title-of {
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.1em;
  font-size: 0.8em;
  color: var(--gold-dim);
}

.ornament-line-cinematic {
  margin-top: var(--space-lg);
  font-size: 0.9rem;
  color: var(--gold-dim);
  letter-spacing: 0.8em;
}

/* Portrait Grid — 5 columns for 5 lamps */
.committee-portraits {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-lg);
  max-width: 1100px;
  margin: 0 auto;
}

.portrait-reveal {
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.portrait-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.portrait-reveal[data-delay="1"] { transition-delay: 0.2s; }
.portrait-reveal[data-delay="2"] { transition-delay: 0.4s; }
.portrait-reveal[data-delay="3"] { transition-delay: 0.6s; }
.portrait-reveal[data-delay="4"] { transition-delay: 0.8s; }

/* Museum Portrait Frame */
.portrait-frame-cinematic {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 3px solid var(--gold-dim);
  border-radius: 2px;
  overflow: hidden;
  background: var(--void-warm);
  box-shadow:
    0 0 0 1px rgba(212, 168, 67, 0.08),
    0 4px 20px rgba(0, 0, 0, 0.6),
    0 8px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Varnish glaze */
.portrait-frame-cinematic::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(255, 245, 220, 0.06) 0%,
    transparent 35%,
    transparent 65%,
    rgba(0, 0, 0, 0.12) 100%
  );
  pointer-events: none;
  z-index: 3;
}

/* Film grain overlay */
.portrait-frame-cinematic::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: overlay;
}

.portrait-frame-cinematic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  opacity: 0;
  transition: opacity 1.4s ease;
  filter: contrast(1.08) brightness(0.95) saturate(0.85);
}

.portrait-frame-cinematic img.loaded {
  opacity: 1;
}

.portrait-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(170deg, var(--void-warm) 0%, #0a0d12 100%);
}

.portrait-initial {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 600;
  color: var(--gold-dim);
  opacity: 0.4;
}

.portrait-info {
  margin-top: var(--space-md);
}

.portrait-title {
  display: block;
  font-family: var(--font-terminal);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.2em;
}

.portrait-name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 1.8vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--bone);
}

.portrait-epithet {
  display: block;
  font-family: var(--font-voice);
  font-size: clamp(0.65rem, 1.1vw, 0.8rem);
  font-style: italic;
  font-weight: 300;
  color: var(--gold-dim);
  margin-top: 0.35em;
  line-height: 1.5;
}


/* ── ACT 7: THE DOCTRINE ── */

.doctrine-block {
  max-width: 650px;
  margin: 0 auto;
}

.doctrine-ornament {
  font-size: 1rem;
  color: var(--gold-dim);
  letter-spacing: 0.6em;
  margin-bottom: var(--space-xl);
}

.doctrine-quote {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.8vw, 2.4rem);
  font-weight: 500;
  font-style: italic;
  color: var(--gold-bright);
  line-height: 1.5;
  margin-bottom: var(--space-lg);
  text-shadow: 0 0 50px var(--gold-glow);
  letter-spacing: 0.01em;
}

.doctrine-text {
  font-family: var(--font-voice);
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  font-weight: 300;
  color: var(--bone-dim);
  line-height: 2;
}

.doctrine-pause {
  height: var(--space-lg);
}

.doctrine-text-gold {
  color: var(--gold);
  font-weight: 400;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
}

.doctrine-link {
  color: var(--gold-bright);
  border-bottom: 1px solid var(--gold-dim);
  transition: border-color 0.3s ease, color 0.3s ease;
}

.doctrine-link:hover {
  border-color: var(--gold-bright);
}


/* ── ACT 9: THE SUMMONS ── */

.summons-block {
  max-width: 600px;
  margin: 0 auto;
}

.summons-ornament {
  font-size: 1.4rem;
  color: var(--gold-dim);
  letter-spacing: 0.6em;
  margin-bottom: var(--space-xl);
}

.summons-text {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 500;
  color: var(--bone);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.02em;
}

.summons-subtext {
  font-family: var(--font-voice);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 300;
  color: var(--bone-dim);
  margin-bottom: var(--space-2xl);
}

.summons-btn-wrapper {
  margin-bottom: var(--space-2xl);
}

/* The Summon Button */
.summon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
  padding: 1.4em 3em;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-voice);
  transition: all 0.5s ease;
  position: relative;
}

.summon-btn::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  transition: border-color 0.5s ease;
}

.summon-btn:hover {
  background: rgba(212, 168, 67, 0.06);
  border-color: var(--gold-bright);
  box-shadow:
    0 0 30px rgba(212, 168, 67, 0.15),
    0 0 60px rgba(212, 168, 67, 0.05);
  transform: translateY(-2px);
}

.summon-btn:hover::before {
  border-color: var(--gold-dim);
}

.summon-btn:active {
  transform: translateY(0);
}

.summon-btn-prefix {
  font-size: clamp(0.7rem, 1.3vw, 0.85rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

.summon-btn-main {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.summons-motto {
  font-family: var(--font-terminal);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: var(--space-3xl);
}

.providence-quote {
  font-family: var(--font-voice);
  font-size: 1rem;
  font-style: italic;
  color: var(--bone-dim);
  border-left: 2px solid rgba(212, 168, 67, 0.2);
  padding-left: 1.2em;
  margin: 2rem auto;
  max-width: 520px;
  text-align: left;
  line-height: 1.7;
}

/* ── Action Nudge (cinematic scroll) ── */
.action-nudge {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.action-nudge-link {
  display: inline-block;
  font-family: var(--font-colonial);
  font-size: 0.95rem;
  color: var(--gold);
  border: 1px solid rgba(212, 168, 67, 0.3);
  padding: 0.6em 1.5em;
  transition: all 0.4s ease;
  letter-spacing: 0.04em;
}

.action-nudge-link:hover {
  background: rgba(212, 168, 67, 0.08);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.1);
}

.summons-footer {
  font-family: var(--font-terminal);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--smoke);
  line-height: 2;
}

.summons-footer a,
.footer-link {
  color: var(--gold-dim);
  transition: color 0.3s ease;
}

.summons-footer a:hover,
.footer-link:hover {
  color: var(--gold);
}

.summons-divider {
  margin: 0 0.8em;
  color: var(--gold-dim);
  opacity: 0.4;
}


/* ═══════════════════════════════════════════════════════════════
   II.  THE BINDING (Config Screen)
   ═══════════════════════════════════════════════════════════════ */

.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--void);
}

.screen.active {
  display: flex;
}

.binding-parchment {
  max-width: 520px;
  width: 90%;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  background: linear-gradient(170deg, #0e1218 0%, #060a0e 100%);
  border: 1px solid rgba(212, 168, 67, 0.15);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
}

.ornament-head, .ornament-foot {
  font-size: 1.2rem;
  color: var(--gold-dim);
  letter-spacing: 0.5em;
  opacity: 0.6;
}

.ornament-head { margin-bottom: var(--space-lg); }
.ornament-foot { margin-top: var(--space-xl); }

.binding-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--bone);
  margin-bottom: var(--space-sm);
}

.ornament-line-binding {
  font-size: 0.8rem;
  color: var(--gold-dim);
  letter-spacing: 0.8em;
  margin-bottom: var(--space-lg);
}

.binding-preamble {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--bone-dim);
  line-height: 1.9;
  margin-bottom: var(--space-xl);
  text-align: left;
}

.drop-cap {
  font-family: var(--font-display);
  font-size: 2.4em;
  float: left;
  line-height: 0.85;
  margin-right: 0.08em;
  margin-top: 0.06em;
  color: var(--gold);
}

.binding-form {
  text-align: left;
  margin-bottom: var(--space-lg);
}

.binding-label {
  display: block;
  font-family: var(--font-terminal);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: var(--space-xs);
}

.binding-input,
.binding-select {
  width: 100%;
  padding: 0.75em 1em;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 168, 67, 0.2);
  color: var(--bone);
  font-family: var(--font-terminal);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
  transition: border-color 0.3s ease;
  border-radius: 0;
  outline: none;
  -webkit-appearance: none;
}

.binding-input:focus,
.binding-select:focus {
  border-color: var(--gold);
}

.binding-input::placeholder {
  color: var(--smoke);
  opacity: 0.5;
}

.binding-select option {
  background: var(--void);
  color: var(--bone);
}

.colonial-btn {
  display: block;
  width: 100%;
  padding: 0.9em;
  margin-top: var(--space-lg);
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-colonial);
  font-size: 1rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.4s ease;
}

.colonial-btn:hover {
  background: rgba(212, 168, 67, 0.08);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.1);
}

.binding-note {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--smoke);
  font-style: italic;
}

.binding-help {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--bone-dim);
  line-height: 1.5;
  margin: var(--space-xs) 0 var(--space-md) 0;
}

.binding-help a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.binding-help a:hover {
  color: var(--gold-bright);
}

.binding-preamble-note {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--bone-dim);
  line-height: 1.6;
  margin-top: 0;
}


/* ── Dialog Card Interstitials ── */

.dialog-card {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  border: 1px solid rgba(212, 168, 67, 0.12);
  border-radius: 2px;
  background: rgba(6, 10, 14, 0.7);
  backdrop-filter: blur(4px);
  text-align: left;
}

.dialog-card-ornament {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gold-dim);
  letter-spacing: 0.3em;
  margin-bottom: var(--space-md);
  opacity: 0.6;
}

.dialog-card-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  font-weight: 500;
}

.dialog-card-text {
  font-family: var(--font-voice);
  font-size: 1.05rem;
  color: var(--bone);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

.dialog-card-text em {
  color: var(--gold-bright);
  font-style: italic;
}

.dialog-card-text strong {
  color: var(--bone);
  font-weight: 600;
}

.dialog-card-text-dim {
  color: var(--bone-dim);
  font-style: italic;
  margin-top: var(--space-md);
}

.dialog-card-text-gold {
  color: var(--gold);
  font-weight: 500;
  margin-top: var(--space-md);
}


/* ═══════════════════════════════════════════════════════════════
   III.  THE INNER WARD (Chamber)
   ═══════════════════════════════════════════════════════════════ */

#chamber-screen {
  display: none;
  flex-direction: column;
  background: var(--wood-dark);
}

#chamber-screen.active {
  display: flex;
}


/* ── Portrait Stage ── */

#portrait-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-md);
  min-height: 200px;
  background: linear-gradient(180deg, #060a0e 0%, var(--wood-dark) 100%);
  border-bottom: 1px solid rgba(212, 168, 67, 0.1);
  overflow-x: auto;
  flex-shrink: 0;
}

.portrait-gallery {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-md);
  width: 100%;
  max-width: 900px;
}

/* Individual lamp card in chamber */
.patriot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  max-width: 140px;
  flex: 1;
  opacity: 0;
  transform: translateY(15px) scale(0.95);
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.4s ease;
}

.patriot-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.patriot-card.idle {
  opacity: 0.2;
  transform: translateY(5px) scale(0.92);
  filter: grayscale(0.6);
}

.patriot-card.speaking {
  filter: brightness(1.12);
}

/* Arrival animation */
.patriot-card.arriving {
  animation: patriot-arrive 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes patriot-arrive {
  0% { opacity: 0; transform: translateY(20px) scale(0.9); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.patriot-frame {
  position: relative;
  width: 100px;
  height: 130px;
  border: 2px solid var(--gold-dim);
  border-radius: 2px;
  overflow: hidden;
  background: var(--void-warm);
  box-shadow:
    0 0 0 1px rgba(212, 168, 67, 0.06),
    0 4px 20px rgba(0, 0, 0, 0.5);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.patriot-card.speaking .patriot-frame {
  border-color: var(--patriot-color, var(--gold));
  box-shadow:
    0 0 0 1px rgba(212, 168, 67, 0.1),
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 0 30px var(--gold-glow);
}

/* Arrival flash */
.patriot-card.arriving .patriot-frame {
  animation: arrival-frame-glow 1.5s ease forwards;
}

@keyframes arrival-frame-glow {
  0% { box-shadow: 0 0 0 rgba(212, 168, 67, 0); border-color: transparent; }
  40% { box-shadow: 0 0 40px rgba(212, 168, 67, 0.4), 0 0 80px rgba(212, 168, 67, 0.15); border-color: var(--gold-bright); }
  100% { box-shadow: 0 0 0 1px rgba(212, 168, 67, 0.06), 0 4px 20px rgba(0, 0, 0, 0.5); border-color: var(--gold-dim); }
}

.patriot-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(255, 245, 220, 0.04) 0%,
    transparent 35%,
    transparent 65%,
    rgba(0, 0, 0, 0.08) 100%
  );
  pointer-events: none;
  z-index: 2;
}

.patriot-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  filter: contrast(1.06) brightness(0.94) saturate(0.9);
  transition: filter 0.4s ease, opacity 0.8s ease;
}

.patriot-card.speaking .patriot-portrait {
  filter: contrast(1.08) brightness(1) saturate(0.95);
}

.patriot-frame:not(.loaded) .patriot-portrait {
  opacity: 0;
}

.patriot-frame.loaded .patriot-portrait {
  opacity: 1;
}

.patriot-nameplate {
  margin-top: var(--space-xs);
  font-family: var(--font-terminal);
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-align: center;
  transition: color 0.4s ease;
}

.patriot-card.speaking .patriot-nameplate {
  color: var(--gold);
}

.patriot-glow {
  position: absolute;
  inset: -10px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(ellipse at center, var(--gold-glow) 0%, transparent 70%);
}

.patriot-card.speaking .patriot-glow {
  opacity: 0.5;
}


/* ── Committee Bar ── */

#committee-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--wood-medium);
  border-bottom: 1px solid rgba(212, 168, 67, 0.08);
  flex-shrink: 0;
  min-height: 40px;
}

#persona-badges {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.persona-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.25em 0.7em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--font-terminal);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.persona-badge.speaking {
  opacity: 1;
  box-shadow: 0 0 12px currentColor;
}

.badge-dismiss {
  cursor: pointer;
  font-size: 0.9em;
  opacity: 0.5;
  transition: opacity 0.2s;
  margin-left: 0.2em;
}

.badge-dismiss:hover {
  opacity: 1;
}

#chamber-controls {
  display: flex;
  gap: var(--space-sm);
}

.control-btn {
  background: transparent;
  border: 1px solid rgba(212, 168, 67, 0.2);
  color: var(--gold-dim);
  padding: 0.3em 0.7em;
  font-family: var(--font-terminal);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 0;
}

.control-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.control-btn-danger:hover {
  border-color: var(--jung);
  color: var(--jung);
}

.control-icon { margin-right: 0.3em; }


/* ── Settings Panel ── */

#settings-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 40;
  width: 300px;
  max-height: 100vh;
  overflow-y: auto;
  background: rgba(6, 10, 14, 0.97);
  border-left: 1px solid rgba(212, 168, 67, 0.1);
  padding: var(--space-lg);
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
}

#settings-panel.hidden {
  display: none;
}

.settings-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--bone);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-lg);
}

.setting-row {
  margin-bottom: var(--space-md);
}

.setting-row-btns {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}


/* ── Dialogue Area ── */

#dialogue-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

#dialogue-scroll {
  height: 100%;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

#dialogue-messages {
  max-width: 800px;
  margin: 0 auto;
}

/* Messages */
.message {
  margin-bottom: var(--space-lg);
  animation: fadeUp 0.4s ease;
}

.message-seeker {
  display: flex;
  justify-content: flex-end;
}

.message-bubble {
  background: rgba(212, 168, 67, 0.08);
  border: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: 2px;
  padding: 0.7em 1.1em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--bone);
  max-width: 75%;
  line-height: 1.7;
}

.message-persona {
  max-width: 85%;
}

.message-header {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4em;
}

.message-body {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--bone);
  border-left: 2px solid var(--gold-dim);
  padding-left: var(--space-md);
}

.message-body p { margin-bottom: 0.7em; }
.message-body p:last-child { margin-bottom: 0; }
.message-body strong { color: var(--gold); font-weight: 600; }
.message-body em { font-style: italic; color: var(--bone); }
.message-body code {
  font-family: var(--font-terminal);
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}
.message-body blockquote {
  border-left: 2px solid var(--gold-dim);
  padding-left: var(--space-md);
  margin: 0.7em 0;
  color: var(--bone-dim);
  font-style: italic;
}

.speaker-header {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-left: 2px;
  animation: cursor-blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}

.message-system {
  text-align: center;
}

.message-system .message-body {
  border-left: none;
  padding-left: 0;
  font-family: var(--font-terminal);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
}


/* ── Jump to Latest Button ── */

.jump-to-latest {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 10;
  background: rgba(6, 10, 14, 0.92);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-terminal);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.5em 1.2em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
  border-radius: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.jump-to-latest.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.jump-to-latest:hover {
  background: rgba(212, 168, 67, 0.12);
  border-color: var(--gold);
}


/* ── Input Area ── */

#input-area {
  padding: var(--space-md);
  background: var(--wood-medium);
  border-top: 1px solid rgba(212, 168, 67, 0.08);
  flex-shrink: 0;
}

#input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  max-width: 800px;
  margin: 0 auto;
}

#user-input {
  flex: 1;
  padding: 0.7em 1em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 168, 67, 0.15);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  border-radius: 0;
  outline: none;
  min-height: 42px;
  max-height: 150px;
  transition: border-color 0.3s ease;
}

#user-input:focus {
  border-color: var(--gold-dim);
}

#user-input::placeholder {
  color: var(--smoke);
  opacity: 0.5;
  font-style: italic;
}

#send-btn {
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid rgba(212, 168, 67, 0.2);
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

#send-btn:hover {
  background: rgba(212, 168, 67, 0.08);
  border-color: var(--gold);
}

#send-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

#input-hint {
  text-align: center;
  margin-top: var(--space-xs);
}

.hint-text {
  font-family: var(--font-terminal);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--smoke);
}

.hint-text code {
  color: var(--gold-dim);
  font-family: var(--font-terminal);
  font-size: inherit;
}

.chamber-action-nudge {
  text-align: center;
  margin-top: 0.3rem;
}

.chamber-action-nudge a {
  font-family: var(--font-terminal);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  opacity: 0.6;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.chamber-action-nudge a:hover {
  opacity: 1;
  color: var(--gold);
}


/* ── Summon Flash overlay ── */

.summon-flash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, rgba(212, 168, 67, 0.2) 0%, transparent 70%);
  pointer-events: none;
  animation: flash-fade 0.6s ease forwards;
}

@keyframes flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

#chamber-screen.summoning {
  animation: chamber-shake 0.4s ease;
}

@keyframes chamber-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}


/* ═══════════════════════════════════════════════════════════════
   IV.  KEYFRAMES
   ═══════════════════════════════════════════════════════════════ */

@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes scroll-pulse {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

@keyframes ember-float {
  0% { opacity: 0; transform: translateY(100vh) scale(0.5); }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-20vh) scale(0.1); }
}

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


/* ═══════════════════════════════════════════════════════════════
   V.  RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .committee-portraits {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    max-width: 500px;
  }
}

@media (max-width: 768px) {
  .committee-portraits {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    max-width: 420px;
  }

  .portrait-frame-cinematic {
    max-width: 150px;
    margin: 0 auto;
  }

  #portrait-stage {
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-sm);
    min-height: auto;
  }

  .portrait-gallery {
    gap: var(--space-sm);
  }

  .patriot-frame {
    width: 70px;
    height: 91px;
  }

  .patriot-nameplate {
    font-size: 0.45rem;
    letter-spacing: 0.15em;
  }

  #committee-bar {
    padding: var(--space-xs) var(--space-sm);
    min-height: 32px;
  }

  .persona-badge {
    padding: 0.15em 0.5em;
    font-size: 0.5rem;
  }

  #dialogue-scroll {
    padding: var(--space-md) var(--space-sm);
  }

  .message-body {
    font-size: 0.9rem;
    line-height: 1.75;
  }

  .message-bubble {
    max-width: 88%;
    font-size: 0.9rem;
  }

  .message-persona {
    max-width: 95%;
  }

  #input-area {
    padding: var(--space-sm);
  }

  #user-input {
    font-size: 16px;
    padding: 0.6em 0.8em;
  }

  .summon-btn {
    padding: 1.1em 2em;
  }

  .act-content {
    padding: 3rem 1.5rem;
  }

  .binding-parchment {
    padding: var(--space-xl) var(--space-lg);
  }

  #settings-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(212, 168, 67, 0.1);
  }

  .jump-to-latest {
    bottom: 8px;
    font-size: 0.6rem;
    padding: 0.4em 1em;
  }
}

@media (max-width: 480px) {
  .committee-portraits {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .portrait-name {
    font-size: 0.75rem;
  }

  .portrait-epithet {
    font-size: 0.6rem;
  }

  #portrait-stage {
    flex-wrap: wrap;
    min-height: auto;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-xs);
  }

  .portrait-gallery {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .patriot-frame {
    width: 56px;
    height: 73px;
  }

  .patriot-nameplate {
    font-size: 0.4rem;
  }

  .patriot-card {
    min-width: 60px;
  }

  .message-header {
    font-size: 0.7rem;
    margin-bottom: 0.3em;
  }

  .message-body {
    font-size: 0.88rem;
    padding-left: var(--space-sm);
  }

  #input-wrapper {
    gap: var(--space-xs);
  }

  #send-btn {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  #input-hint {
    margin-top: 2px;
  }

  .hint-text {
    font-size: 0.5rem;
  }

  .summon-btn {
    padding: 1em 1.5em;
  }

  .summon-btn-main {
    font-size: 1rem;
  }
}

/* ── iOS safe areas ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #input-area {
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}


/* ═══════════════════════════════════════════════════════════════
   VI.  PRINT
   ═══════════════════════════════════════════════════════════════ */

@media print {
  body {
    background: white;
    color: black;
  }

  #cinematic-intro,
  .screen {
    display: none !important;
  }
}
