/* Shutdown Recovery OS — Quiet Reentry Room (extends board.css).
 * Low-demand architecture: choices collapse, chrome sheds, space stays.
 * Ported from the Shrinking Room / Quiet Apartment skeleton. */



.app-header {
  justify-content: space-between;
}

.app-header--in-room {
  padding-top: 10px;
  padding-bottom: 10px;
}

.app-header__brand {
  flex: 1;
  min-width: 0;
}

.app-header__context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  margin: 4px 0 0;
  min-width: 0;
}

.app-header__sep {
  color: var(--whisper);
  opacity: 0.5;
  user-select: none;
}

.app-header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.app-header__progress {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* Header on narrow screens: brand row on top, actions below — prevents crowding */
@media (max-width: 640px) {
  .app-header .app-header__brand {
    flex: 1 1 100%;
  }
  .app-header .app-header__actions {
    width: 100%;
    justify-content: space-between;
  }
}

body.header-in-room .screen__room.type-meta {
  display: none;
}

.validate-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-lg);
  max-width: 36ch;
  margin: 0 auto 12px;
  line-height: 1.45;
}

.screen__badge {
  display: inline-block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lavender);
  border: 1px solid rgba(111, 159, 155, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}

.deck-card--router {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
}

.deck-card--router .deck-card__felt {
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 6px;
}

.deck-card--router .deck-card__room {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  opacity: 0.75;
  margin-bottom: 4px;
}

.deck-card__no-ai {
  display: block;
  margin-top: 8px;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sr-dusty-mauve);
  opacity: 0.85;
}

.deck-card__icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.deck-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.deck-card__body > * {
  display: block;
}

.deck-card__hint,
.deck-card__route {
  font-size: var(--text-sm);
  opacity: 0.85;
  margin-top: 4px;
  line-height: 1.4;
  font-style: normal;
}

.deck-card__capacity {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-top: 6px;
}

.deck-card__meters {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.deck-card__meter {
  display: inline-flex;
  gap: 3px;
}

.room-capacity-slot {
  margin: 12px auto 4px;
  max-width: 420px;
}

.room-capacity {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(111, 159, 155, 0.15);
  background: rgba(23, 33, 43, 0.55);
  text-align: left;
}

.room-capacity__no-ai {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sr-dusty-mauve);
}

.receipt-no-ai {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--whisper);
  margin: 12px 0 0;
  letter-spacing: 0.04em;
}

.held-not-solved {
  text-align: center;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-style: italic;
  line-height: 1.45;
  margin: 0 auto 20px;
  max-width: 24ch;
  animation: fade-up 0.7s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mode-switch {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto 20px;
  padding: 4px;
  background: rgba(23, 33, 43, 0.5);
  border-radius: 999px;
  border: 1px solid rgba(238, 241, 245, 0.08);
}

.mode-switch__btn {
  flex: 1;
  padding: 11px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.mode-switch__btn.is-active {
  background: rgba(111, 159, 155, 0.2);
  color: var(--cream);
  outline: 1px solid rgba(111, 159, 155, 0.35);
}

.deck-grid--rides .deck-card--router {
  background: linear-gradient(160deg, #3a4f5c 0%, #2f3d48 45%, #283540 100%);
}

.load-card--bright {
  box-shadow: 0 0 16px var(--sr-glow);
  border: 1px solid rgba(231, 216, 184, 0.35);
}

.load-card--dimmed {
  opacity: 0.4;
  filter: saturate(0.45);
}

.receipt-card {
  max-width: 480px;
  margin: 0 auto 20px;
  padding: 24px 22px;
  background: linear-gradient(165deg, var(--cream) 0%, #dce4ee 100%);
  color: #1f252b;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: receipt-in 0.7s ease both;
}

@keyframes receipt-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.receipt-card__label {
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 8px;
}

.receipt-card__moved {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-style: italic;
  line-height: 1.35;
  margin: 0 0 20px;
}

.receipt-section {
  padding-top: 14px;
  border-top: 1px solid rgba(31, 37, 43, 0.12);
  margin-top: 14px;
}

.receipt-section__label {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 6px;
}

.receipt-section__text {
  font-size: var(--text-lg);
  line-height: 1.45;
  margin: 0;
}

.receipt-section__text--held {
  opacity: 0.85;
  font-size: var(--text-sm);
}

.receipt-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.card-output {
  max-width: 480px;
  margin: 0 auto 20px;
  padding: 18px 20px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--cream);
  background: rgba(23, 33, 43, 0.65);
  border: 1px solid rgba(111, 159, 155, 0.25);
  border-radius: var(--radius);
}

.ride-bridge {
  max-width: 440px;
  margin: 0 auto;
  text-align: center;
}

.ride-bridge__moved {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--lavender);
  margin: 16px 0;
}

.install-card {
  max-width: 420px;
  margin: 0 auto 24px;
  padding: 20px;
  background: rgba(23, 33, 43, 0.5);
  border: 1px solid rgba(111, 159, 155, 0.25);
  border-radius: var(--radius);
  text-align: center;
}

.install-card__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  margin: 0 0 8px;
}

.install-card__body {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.install-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-footer__alt {
  margin-top: 8px;
  font-size: 0.6875rem;
}

.app-footer__alt a {
  color: var(--whisper);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.visual-stage {
  margin: 16px auto 20px;
  max-width: 420px;
  min-height: 72px;
  border-radius: var(--radius);
  border: 1px solid rgba(111, 159, 155, 0.15);
  background: rgba(23, 33, 43, 0.4);
  position: relative;
  overflow: hidden;
}

.step-phase-label {
  text-align: center;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 auto 10px;
  max-width: 420px;
}

.airlock-build,
.airlock-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto 16px;
}

.airlock-field__label {
  font-size: var(--text-sm);
  color: var(--muted);
}

.mark-sentence {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 500;
  font-style: italic;
  color: var(--lavender);
  margin: 0 0 16px;
  line-height: 1.35;
}

.transform-count--revealing {
  animation: transform-count-in 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes transform-count-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.receipt-card--revealing {
  animation: receipt-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes receipt-rise {
  from { opacity: 0; transform: translateY(16px); filter: brightness(0.7); }
  to { opacity: 1; transform: translateY(0); filter: brightness(1); }
}

.close-hero--ceremony .close-hero__icon {
  animation: close-moon-rise 1.2s ease both;
}

@keyframes close-moon-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.container-zone--pulse {
  animation: container-pulse 0.9s ease both;
}

@keyframes container-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(111, 159, 155, 0); }
  50% { box-shadow: 0 0 24px rgba(111, 159, 155, 0.25); }
}

.card-birth-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  overflow: hidden;
}

.card-birth__flyer {
  position: absolute;
  left: var(--ox);
  top: var(--oy);
  transform: translate(-50%, -50%);
  animation: card-leave-head 1s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes card-leave-head {
  to {
    transform: translate(calc(-50% + var(--dx, 40px)), calc(-50% + var(--dy, -120px)));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-birth__flyer {
    animation: none !important;
  }
}

/* Arrive card readability cleanup */
.screen--arrive .deck-card__capacity,
.screen--arrive .capacity-meters,
.screen--arrive .capacity-meter {
  display: none !important;
}

.screen--arrive .deck-grid--rides .deck-card__body {
  gap: 0.5rem;
}

.screen--arrive .deck-grid--rides .deck-card__route {
  line-height: 1.5;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---- The Shrinking Room: structural shrink ----
 * data-shrink is the step index in the current room flow. Higher means
 * the interface has shed secondary elements — controls, hints, folds —
 * while primary text and actions stay readable and reachable. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body[data-shrink="1"] .screen__signature,
body[data-shrink="2"] .screen__signature,
body[data-shrink="2"] .screen__hint.step-truth,
body[data-shrink="2"] #dump-capacity,
body[data-shrink="2"] #dump-presets,
body[data-shrink="3"] .screen__hint,
body[data-shrink="3"] .screen__signature,
body[data-shrink="3"] .optional-fold,
body[data-shrink="3"] #dump-capacity,
body[data-shrink="4"] .screen__hint,
body[data-shrink="4"] .screen__tagline,
body[data-shrink="4"] .screen__signature,
body[data-shrink="4"] .optional-fold,
body[data-shrink="4"] .step-truth {
  display: none !important;
}

body[data-shrink="3"] .screen__hero,
body[data-shrink="4"] .screen__hero {
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Functional text floor — low-capacity UI never drops required
 * controls or body text below a readable size. */
body.os-shutdown-recovery .guided-chip,
body.os-shutdown-recovery .door-card__label,
body.os-shutdown-recovery .btn-primary,
body.os-shutdown-recovery .btn-secondary,
body.os-shutdown-recovery .btn-ghost,
body.os-shutdown-recovery .dump-input,
body.os-shutdown-recovery .add-card-input,
body.os-shutdown-recovery .quiet-card p,
body.os-shutdown-recovery .screen__hint {
  font-size: max(14px, 1em);
}

/* hidden must win over display rules — density folds rely on it. */
body.os-shutdown-recovery [hidden] {
  display: none !important;
}

/* ===== Quiet Reentry Room — shutdown-specific surfaces ===== */

.screen__inner--quiet {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.screen__title--quiet {
  font-style: normal;
  letter-spacing: 0.02em;
}

.screen__subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--sr-dusty-mauve);
  max-width: 34rem;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.screen__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1.5rem;
}

.screen__actions--quiet {
  margin-top: 3rem;
}

.screen__safety-strip {
  font-size: var(--text-xs);
  color: var(--sr-dusty-mauve);
  text-align: center;
  margin: 0 0 2rem;
  opacity: 0.85;
}

.safety-strip-link {
  background: none;
  border: none;
  border-bottom: 1px dotted var(--sr-mauve-bright);
  color: var(--sr-mauve-bright);
  font: inherit;
  cursor: pointer;
  padding: 0 2px;
}

.screen__quiet-link,
.screen__privacy-line,
.screen__fineprint {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--sr-dusty-mauve);
  opacity: 0.8;
  margin-top: 2rem;
}

/* Buttons */
.btn-quiet {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(143, 163, 200, 0.35);
  background: transparent;
  color: var(--sr-private-linen);
  cursor: pointer;
}
.btn-quiet:hover { border-color: rgba(143, 163, 200, 0.7); }
.btn-quiet--danger { border-color: rgba(201, 154, 142, 0.5); color: #c99a8e; }

.btn-plain {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--sr-mauve-bright);
  cursor: pointer;
  padding: 10px 8px;
  min-height: 44px;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}
.btn-plain:hover { color: var(--sr-private-linen); }

.btn-ghost--sm { min-height: 44px; padding: 8px 12px; font-size: var(--text-xs); }

/* Arrive doors */
.arrive-doors,
.door-stack {
  display: grid;
  gap: 12px;
  margin: 0 auto 1.5rem;
  max-width: 30rem;
}

.door-card {
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(143, 163, 200, 0.22);
  background: linear-gradient(160deg, #202b3c 0%, #1a2433 55%, #141d2b 100%);
  color: var(--sr-private-linen);
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.door-card:hover, .door-card:focus-visible {
  border-color: rgba(143, 163, 200, 0.55);
  box-shadow: 0 0 18px var(--sr-glow);
}
.door-card__label { display: block; font-family: var(--font-serif); font-size: var(--text-lg); }
.door-card__meta { display: block; font-size: var(--text-sm); color: var(--sr-dusty-mauve); margin-top: 4px; }

/* Folds */
.fold-hint { font-size: var(--text-2xs); color: var(--sr-dusty-mauve); opacity: 0.75; }

.capacity-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rooms-grid { display: grid; gap: 12px; margin-top: 1rem; }
.ride-list { display: grid; gap: 12px; margin-top: 1.25rem; }

/* Safety / person panels */
.safety-panel {
  text-align: left;
  max-width: 36rem;
  margin: 0 auto 1rem;
  padding: 18px 20px;
  border: 1px solid rgba(143, 163, 200, 0.25);
  border-radius: var(--radius);
  background: rgba(22, 34, 53, 0.55);
  line-height: 1.6;
  font-size: var(--text-sm);
  color: var(--sr-private-linen);
}
.safety-panel p { margin: 0 0 0.9em; }
.safety-panel p:last-child { margin-bottom: 0; }
.need-person-urgent { border-color: rgba(201, 154, 142, 0.55); }

.person-list {
  text-align: left;
  max-width: 36rem;
  margin: 0 auto;
  line-height: 1.65;
  font-size: var(--text-sm);
  color: var(--sr-private-linen);
  padding-left: 1.2em;
}
.person-list li { margin-bottom: 0.8em; }

/* Local data */
.localdata-list { display: grid; gap: 10px; max-width: 36rem; margin: 0 auto; }
.localdata-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid rgba(143, 163, 200, 0.18);
  border-radius: var(--radius);
  background: rgba(22, 34, 53, 0.4);
}
.localdata-item p { margin: 4px 0 0; font-size: var(--text-xs); color: var(--sr-dusty-mauve); }

/* Step chrome */
.step__roomline {
  font-size: var(--text-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sr-dusty-mauve);
  margin: 0 0 0.75rem;
}
.step__helper { color: var(--sr-dusty-mauve); font-size: var(--text-sm); max-width: 30rem; margin: 0 auto 1.25rem; line-height: 1.6; }
.step__warn { color: var(--sr-soft-gold); font-size: var(--text-sm); margin: 0.5rem auto; max-width: 30rem; }
.step__note { font-size: var(--text-xs); color: var(--sr-dusty-mauve); opacity: 0.8; margin-top: 1rem; }

.signal-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0.5rem 0; }
.signal-visual { min-height: 140px; margin: 0 auto 1rem; max-width: 30rem; }

/* Receipt */
.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dotted rgba(143, 163, 200, 0.2);
  font-size: var(--text-sm);
  text-align: left;
}
.receipt-line span:first-child { color: var(--sr-dusty-mauve); white-space: nowrap; }
.receipts-empty { text-align: center; color: var(--sr-dusty-mauve); font-size: var(--text-sm); }

/* Held line */
.held-not-solved {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--sr-mauve-bright);
  margin: 0 0 1rem;
}
.held-not-solved--revealing { animation: heldReveal 0.8s ease both; }
@keyframes heldReveal { from { opacity: 0; } to { opacity: 1; } }

/* Stagger helper for close ceremony */
.motion-stagger { opacity: 0; transform: translateY(10px); }
.motion-stagger--in { animation: staggerIn 0.9s ease both; }
@keyframes staggerIn { to { opacity: 1; transform: none; } }

.app-header__back { font-size: var(--text-sm); }

/* Noscript */
.noscript-panel {
  max-width: 34rem;
  margin: 15vh auto;
  padding: 2rem;
  text-align: center;
  color: var(--sr-private-linen);
  font-family: var(--font-sans);
  line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
  .held-not-solved--revealing,
  .motion-stagger--in { animation: none !important; opacity: 1; transform: none; }
  .door-card { transition: none; }
  .receipt-card { animation: none !important; }
}

/* Header fixes + skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--sr-private-linen);
  color: var(--sr-after-show-ink);
  z-index: 50;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.app-header__brand,
a.app-header__brand { color: var(--sr-dusty-mauve); text-decoration: none; }
.app-header__brand:hover { color: var(--sr-private-linen); }

.header-exit {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(231, 216, 184, 0.55);
  background: transparent;
  color: var(--sr-gold-bright);
  cursor: pointer;
}
.header-exit:hover { background: rgba(231, 216, 184, 0.12); }
