:root {
  color-scheme: dark;
  --panel: rgba(14, 16, 22, 0.72);
  --text: #efe6d6;
  --muted: #a79f92;
  --accent: #ffb347;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120d0a;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

canvas { display: block; touch-action: none; }

.board {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 6px 14px;
  background: #0b0b0b;
  border: 1px solid #2b2b2b;
  border-radius: 6px;
  color: var(--accent);
  font: 13px/1.2 Consolas, ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 160, 40, 0.6);
  white-space: nowrap;
}

.board .sep { opacity: 0.5; }
.board.no-station .station-part { display: none; }

@media (max-width: 560px) {
  .board .station-part { display: none; }
}

.panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  width: min(260px, calc(100vw - 32px));
  padding: 14px 16px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 13px;
  transition: opacity 0.3s, transform 0.3s;
  max-height: calc(100vh - 32px); /* the panel grew: scroll instead of running off the top */
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.panel h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field { display: grid; gap: 4px; }
.field span { display: flex; justify-content: space-between; color: var(--muted); }

output { color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

select {
  width: 100%;
  padding: 5px 8px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}
select option { color: #1a1a1a; }

.check { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }

button {
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.12); }
button[aria-pressed="true"] { border-color: var(--accent); }

.hint { margin: 0; color: var(--muted); font-size: 11px; }

.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.buttons button { padding: 6px 8px; }
.buttons .wide { grid-column: span 2; }

/* Relax mode: nothing but the view. */
body.relax .board { opacity: 0; }
body.relax { cursor: none; }
.board { transition: opacity 0.6s; }

.pill {
  position: fixed;
  bottom: 16px;
  left: 16px;
  padding: 6px 12px;
  background: rgba(14, 16, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font: 13px/1.2 Consolas, ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  backdrop-filter: blur(6px);
}
.pill[data-phase="rest"] { color: #9fe3b0; }
.pill.hidden, .line-map.hidden { display: none; }
.pill.pulse { animation: pulse 1.2s ease-out 3; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.8); }
  100% { box-shadow: 0 0 0 16px rgba(255, 179, 71, 0); }
}

.line-map {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 32px));
  padding: 10px 14px;
  background: rgba(14, 16, 22, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  font-size: 12px;
}
.line-map header, .line-map footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.line-map header strong { color: var(--text); font-weight: 600; }
.line-map footer { justify-content: flex-start; flex-wrap: wrap; margin-top: 4px; font-size: 11px; }
.line-map svg { display: block; width: 100%; height: auto; }
.line-map .track { stroke: #d9d2c3; stroke-width: 3; }
.line-map .tunnel { fill: #111; stroke: #666; }
.line-map .bridge { fill: none; stroke: #5aa8e6; stroke-width: 2.5; }
.line-map .crossing { stroke: #e05a4f; stroke-width: 2; }
.line-map .station { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.line-map .station-name { fill: var(--text); font-size: 13px; text-anchor: middle; }
.line-map .biome { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.line-map .marker rect { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }
.key.station::before { background: #fff; border: 2px solid var(--accent); border-radius: 50%; width: 6px; height: 6px; }
.key.tunnel::before { background: #111; border: 1px solid #666; }
.key.bridge::before { background: #5aa8e6; }
.key.crossing::before { background: #e05a4f; }

.journal-btn { border-color: rgba(255, 179, 71, 0.5); }

.arrival {
  position: fixed;
  left: 50%;
  bottom: 8vh;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 18px 22px;
  text-align: center;
  background: #f3ead8;
  color: #3a2c20;
  border: 2px solid #e0c48a;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: rise 0.5s ease-out;
}
.arrival.hidden { display: none; }
.arrival-kicker { margin: 0; color: #9a6a3a; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.arrival h2 { margin: 4px 0 8px; font: 600 24px/1.2 Georgia, "Times New Roman", serif; }
.arrival p { margin: 0 0 14px; color: #6a5440; }
.arrival-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.arrival-actions button { color: #3a2c20; background: #fffaf0; border-color: #e0c48a; }
.arrival-actions button:first-child { background: #e8a33d; border-color: #c9842a; color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.line-map .station.dest { stroke: #e05a4f; stroke-width: 4; r: 7; }

.radio-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; align-items: end; }

.journal {
  position: fixed;
  inset: 5vh 50% auto auto;
  transform: translateX(50%);
  width: min(760px, calc(100vw - 24px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #f3ead8;
  color: #3a2c20;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  overflow: hidden;
}
.journal.hidden { display: none; }
.journal header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 8px;
  border-bottom: 1px dashed rgba(58, 44, 32, 0.3);
}
.journal h2 { margin: 0; font: 600 20px/1.2 Georgia, "Times New Roman", serif; }
.journal header p { margin: 4px 0 0; color: #7a6650; }
.journal header button, .journal-reset {
  color: #3a2c20;
  background: rgba(58, 44, 32, 0.08);
  border-color: rgba(58, 44, 32, 0.2);
}
.journal-grid { overflow-y: auto; padding: 4px 20px 12px; }
.journal-grid h3 { margin: 14px 0 6px; font: 600 14px Georgia, serif; color: #7a4a2a; }
.journal-grid ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sticker {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 6px;
  text-align: center;
  border: 2px dashed rgba(58, 44, 32, 0.25);
  border-radius: 10px;
  color: #9a8a74;
}
.sticker.found {
  color: #3a2c20;
  background: #fffaf0;
  border: 2px solid #e0c48a;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  transform: rotate(-1deg);
}
.sticker.found:nth-child(even) { transform: rotate(1.2deg); }
.sticker-icon { font-size: 28px; line-height: 1.2; }
.sticker small { font-size: 10.5px; opacity: 0.85; }
.journal footer { padding: 8px 20px 14px; text-align: right; border-top: 1px dashed rgba(58, 44, 32, 0.3); }

/* Discoveries pop up near the bottom, so they never cover what people say in the scene. */
.toast {
  position: fixed;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: #fff6e2;
  color: #3a2c20;
  border: 2px solid #e0c48a;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  white-space: nowrap;
  z-index: 10;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
body.relax .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

.car-fade { position: fixed; inset: 0; background: #0b0806; opacity: 0; pointer-events: none; transition: opacity 0.45s; }
.car-fade.on { opacity: 1; }

.photo-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.photo-flash.flashing { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.8; } 100% { opacity: 0; } }

@media (max-width: 560px) {
  .line-map { top: 40px; }
  .line-map .station-name { font-size: 18px; }
  .line-map .biome { display: none; }
}

@media (max-width: 520px) {
  .board { top: 8px; gap: 6px; padding: 5px 10px; font-size: 11px; }
  .panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); }
}

/* ---------- Phones and touch screens ---------- */
.menu-btn {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 5;
  display: none;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 22px;
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(8px);
}
.hint-touch { display: none; }
button, select, .check { touch-action: manipulation; }

@media (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: block; }
  button { min-height: 42px; }
  select { min-height: 38px; }
  input[type="range"] { height: 28px; }
  .check input { width: 20px; height: 20px; }
}

@media (max-width: 560px), (pointer: coarse) and (max-height: 560px) {
  .menu-btn { display: block; }
  body.relax .menu-btn { opacity: 0.25; }
  .panel {
    right: calc(8px + env(safe-area-inset-right));
    left: calc(8px + env(safe-area-inset-left));
    bottom: calc(68px + env(safe-area-inset-bottom));
    width: auto;
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .board { top: calc(8px + env(safe-area-inset-top)); }
  .pill { left: calc(12px + env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom)); }
  .journal { inset: env(safe-area-inset-top) 0 0 0; transform: none; width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  .journal-grid ul { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .toast { white-space: normal; width: max-content; max-width: calc(100vw - 32px); text-align: center; border-radius: 16px; font-size: 14px; }
  .arrival { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Phone held sideways: little height, so the panel becomes a right-hand drawer. */
@media (pointer: coarse) and (max-height: 560px) and (orientation: landscape) {
  .panel { left: auto; width: min(320px, 50vw); top: calc(8px + env(safe-area-inset-top)); bottom: calc(8px + env(safe-area-inset-bottom)); right: calc(68px + env(safe-area-inset-right)); max-height: none; }
}

/* ---------- Opening card (Fractal Nexus · NexionAI Systems) ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 42%, #1c1638 0%, #0a0814 70%);
  color: #e9e4ff;
  cursor: pointer;
  animation: splash-in 0.9s ease-out;
  transition: opacity 0.9s ease;
}
.splash.leaving { opacity: 0; pointer-events: none; }
.splash canvas { margin-bottom: 14px; animation: splash-spin 24s linear infinite; }
.splash-kicker { margin: 0; font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: #b9a8ff; }
.splash-presents { margin: 0; font-size: 13px; color: #8f86b8; font-style: italic; }
.splash-title { margin: 6px 0 4px; font: 600 clamp(30px, 7vw, 48px)/1.1 Georgia, "Times New Roman", serif; letter-spacing: 0.02em; }
.splash-tagline { margin: 0; color: #c9c0ec; font-size: 15px; }
@keyframes splash-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes splash-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .splash canvas { animation: none; } }

/* ---------- Intention journal ---------- */
.intention {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(460px, calc(100vw - 32px));
  padding: 20px 22px;
  text-align: center;
  background: #f3ead8;
  color: #3a2c20;
  border: 2px solid #c9b4f0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.intention.hidden { display: none; }
.intention h2 { margin: 4px 0 8px; font: 600 22px/1.25 Georgia, "Times New Roman", serif; }
.intention-help { margin: 0 0 12px; color: #6a5440; font-size: 13px; }
.intention textarea {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  font: 18px/1.4 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  color: #3a2c20;
  background: #fffaf0;
  border: 1px solid #e0c48a;
  border-radius: 10px;
  resize: none;
}
.intention blockquote { margin: 8px 0 6px; font: 22px/1.4 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; color: #3b2a6e; }
.intention p#intention-meta { margin: 0 0 14px; color: #7a6650; font-size: 12px; }
.intention .arrival-actions button { color: #3a2c20; background: #fffaf0; border-color: #e0c48a; }
.intention .arrival-actions button:first-child { background: #5b43a8; border-color: #3b2a6e; color: #fff; }

/* ---------- Change trains at Nexus ---------- */
.transfer-btn {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 6;
  padding: 12px 20px;
  font-weight: 600;
  color: #fff;
  background: #5b43a8;
  border: 2px solid #b99bff;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(91, 67, 168, 0.55);
  animation: transfer-glow 1.8s ease-in-out infinite;
}
.transfer-btn:hover { background: #6b52bd; }
.transfer-btn.hidden { display: none; }
@keyframes transfer-glow { 50% { box-shadow: 0 8px 40px rgba(185, 155, 255, 0.85); } }

/* ---------- Breathing with the rails ---------- */
.breath {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(10, 8, 20, 0.15), rgba(10, 8, 20, 0.55));
  color: #f4efff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.breath.hidden { display: none; }
.breath-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(64vmin, 400px);
  height: min(64vmin, 400px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 180, 255, 0.35) 0%, rgba(143, 211, 255, 0.18) 60%, rgba(143, 211, 255, 0) 72%);
  border: 2px solid rgba(233, 228, 255, 0.55);
  transform: translate(-50%, -50%) scale(0.45);
  will-change: transform;
}
.breath-label { position: relative; margin: 0; font: 600 clamp(22px, 5vw, 32px)/1.2 Georgia, "Times New Roman", serif; }
.breath-count { position: relative; margin: 0; min-height: 1.2em; font: 600 clamp(28px, 7vw, 44px)/1 Georgia, serif; opacity: 0.85; }
.breath-hint { margin: 0; position: absolute; bottom: 22vh; font-size: 13px; opacity: 0.8; }
.breath-stop { pointer-events: auto; position: absolute; bottom: calc(12vh + env(safe-area-inset-bottom)); background: rgba(20, 16, 36, 0.6); }
@media (prefers-reduced-motion: reduce) { .breath-circle { transition: none; } }

/* ---------- Her notebook (lined paper) ---------- */
.notebook {
  position: fixed;
  left: 50%;
  top: 5vh;
  transform: translateX(-50%);
  z-index: 12;
  width: min(620px, calc(100vw - 24px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fbf7ec;
  color: #2f3a5a;
  border-radius: 6px 14px 14px 6px;
  border-left: 10px solid #5b43a8;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.notebook.hidden { display: none; }
.notebook header, .notebook footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; }
.notebook h2 { margin: 0; font: 600 20px Georgia, "Times New Roman", serif; color: #3b2a6e; }
.notebook header button, .notebook footer button { color: #3b2a6e; background: rgba(91, 67, 168, 0.08); border-color: rgba(91, 67, 168, 0.3); }
.notebook-list {
  margin: 0;
  padding: 0 22px 0 44px;
  overflow-y: auto;
  list-style: none;
  font: 17px/32px "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  background: repeating-linear-gradient(#fbf7ec 0 31px, #c9d6ea 31px 32px);
  border-left: 1px solid #e8a0a0;
}
.notebook-list li { min-height: 32px; }
.notebook-list:empty::after { content: "…"; }

#install-btn.hidden { display: none; }
#install-btn { border-color: rgba(185, 155, 255, 0.6); }

input[type="time"] {
  width: 100%;
  padding: 5px 8px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color-scheme: dark;
}

/* ---------- Panel sections ---------- */
.section { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 8px; display: grid; gap: 10px; }
.section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: "▸"; color: var(--muted); transition: transform 0.2s; }
.section[open] > summary::after { transform: rotate(90deg); }
.section[open] > summary { margin-bottom: 2px; }

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.large-text .panel { font-size: 16px; }
body.large-text .panel h1 { font-size: 18px; }
body.large-text .board { font-size: 16px; }
body.large-text .toast { font-size: 18px; }
body.large-text .journal, body.large-text .notebook-list { font-size: 16px; }
body.large-text .hint { font-size: 13px; }
body.large-text .pill { font-size: 16px; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation: none !important;
  transition-duration: 0.01ms !important;
}

/* ---------- Letters between travelers ---------- */
.letter-name {
  width: 100%;
  margin: -4px 0 12px;
  padding: 8px 12px;
  font: 15px/1.3 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  color: #3a2c20;
  background: #fffaf0;
  border: 1px solid #e0c48a;
  border-radius: 10px;
}
.letter-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-1deg);
  z-index: 21;
  width: min(480px, calc(100vw - 32px));
  padding: 22px 24px 18px;
  text-align: center;
  color: #3a2c20;
  background: repeating-linear-gradient(-45deg, #fbf3e2 0 14px, #f6ead2 14px 28px);
  border: 2px solid #c9a96a;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 6px rgba(201, 169, 106, 0.25);
  animation: rise 0.6s ease-out;
}
.letter-card.hidden { display: none; }
.letter-card blockquote { margin: 10px 0 8px; font: 22px/1.45 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; color: #2f3a5a; overflow-wrap: anywhere; }
.letter-card #letter-from { margin: 0 0 14px; color: #7a6650; font-size: 13px; font-style: italic; }
.letter-card .arrival-actions button { color: #3a2c20; background: #fffaf0; border-color: #e0c48a; }
.letter-card .arrival-actions button:first-child { background: #5b43a8; border-color: #3b2a6e; color: #fff; }

/* ---------- Sleep timer ---------- */
.sleep-veil {
  position: fixed;
  inset: 0;
  z-index: 40; /* over toasts and dialogs: nothing lights up the screen while asleep */
  background: #04060c;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s linear;
  display: grid;
  place-items: center;
}
.sleep-veil.hidden { display: none; }
.sleep-veil.asleep { pointer-events: auto; cursor: pointer; }
.sleep-veil p {
  margin: 0;
  font: italic 500 22px/1.3 Georgia, "Times New Roman", serif;
  color: rgba(200, 210, 255, 0.35);
  opacity: 0;
  transition: opacity 4s ease;
}
.sleep-veil.asleep p { opacity: 1; }
.sleep-choices button { min-width: 72px; }

/* ---------- Passport ---------- */
.passport {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 16px 18px 14px;
  text-align: center;
  color: #f3ead8;
  background: rgba(20, 24, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.passport.hidden { display: none; }
.passport h2 { margin: 0 0 10px; font: 600 20px/1.25 Georgia, "Times New Roman", serif; }
.passport canvas { display: block; width: 100%; height: auto; margin: 10px 0 12px; border-radius: 14px; }
.passport-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.passport-tabs button {
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  color: #f3ead8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
}
.passport-tabs button[aria-pressed="true"] { background: #5b43a8; border-color: #3b2a6e; }

/* ---------- Mission of the day ---------- */
.mission {
  display: grid;
  gap: 2px;
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(240, 180, 80, 0.45);
  border-radius: 12px;
}
.mission-kicker { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #f0b450; }
.mission strong { font-size: 14px; font-weight: 600; }
.mission #mission-meta { font-size: 12px; opacity: 0.7; }
.mission.done { border-style: solid; border-color: rgba(120, 210, 140, 0.6); background: rgba(120, 210, 140, 0.08); }
.mission.done #mission-meta { color: #8fe0a0; opacity: 1; }

/* ---------- Real time and weather ---------- */
.panel input:disabled,
.panel select:disabled { opacity: 0.4; cursor: not-allowed; }
#real-world-status:empty { display: none; }

/* ---------- Recording ---------- */
.rec-badge {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 25;
  padding: 6px 12px;
  font: 700 13px/1 system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(200, 30, 40, 0.85);
  border-radius: 999px;
  animation: rec-pulse 1.2s ease-in-out infinite;
}
.rec-badge.hidden { display: none; }
@keyframes rec-pulse { 50% { opacity: 0.55; } }
#record-btn[aria-pressed="true"] { color: #fff; background: #b8242e; border-color: #7a1820; }

/* ---------- Appearance ---------- */
.field-title { margin: 10px 0 2px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }

/* ---------- Trip album ---------- */
.album {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  background: rgba(20, 18, 16, 0.92);
}
.album.hidden { display: none; }
.album-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: #f3ead8;
  background: rgba(20, 18, 16, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.album-actions { display: flex; gap: 8px; }
.album-actions button { padding: 8px 14px; font: inherit; border-radius: 999px; border: 1px solid #e0c48a; background: #fffaf0; color: #3a2c20; cursor: pointer; }
.album-pages { display: grid; gap: 22px; max-width: 860px; margin: 22px auto 40px; padding: 0 16px; }
.album-page {
  padding: 28px 30px;
  color: #3a2c20;
  background: #f8f1e1;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  font-family: Georgia, "Times New Roman", serif;
}
.album-page h3 { margin: 0 0 14px; font-size: 24px; }
.album-page h4 { margin: 18px 0 8px; font-size: 16px; color: #7a5a30; }
.album-cover { text-align: center; }
.album-cover h2 { margin: 4px 0 16px; font-size: 34px; }
.album-kicker { margin: 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #7a6650; }
.album-photo { width: 100%; border-radius: 4px; border: 8px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); transform: rotate(-0.6deg); }
.album-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin: 18px 0 6px; padding: 0; list-style: none; }
.album-stats li { display: grid; }
.album-stats strong { font-size: 22px; }
.album-stats span { font-size: 12px; color: #7a6650; }
.album-date { margin: 10px 0 0; font-style: italic; color: #7a6650; }
.album-spread { display: block; width: 100%; height: auto; margin: 0 0 12px; border-radius: 10px; }
.album-stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.album-stickers li { display: grid; gap: 2px; padding: 8px 10px; background: #fffaf0; border: 1px solid #e6d6b4; border-radius: 8px; font-size: 13px; }
.album-icon { font-size: 22px; }
.album-stickers small { color: #8a7660; font-size: 11px; }
.album-quote { margin: 6px 0; font: 18px/1.45 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; color: #2f3a5a; overflow-wrap: anywhere; }
.album-sign { margin: 0 0 10px; font-size: 13px; font-style: italic; color: #7a6650; }
.album-notebook { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.album-empty { font-style: italic; color: #7a6650; }

@media print {
  body.album-open > :not(#album) { display: none !important; }
  body.album-open { background: #fff; }
  .album { position: static; overflow: visible; background: none; }
  .album-bar { display: none; }
  .album-pages { display: block; margin: 0; max-width: none; padding: 0; }
  .album-page { box-shadow: none; border-radius: 0; break-after: page; background: #fff; }
  .album-stickers li { break-inside: avoid; }
}
