/* =========================================================
   《這班車不趕時間 / The Slow Bus》v2.0 Director's Cut
   Studio Ghibli Coastal Gouache + Vintage Walnut/Brass UI
   ========================================================= */

:root {
  --ink: #352922;
  --ink-soft: #645447;
  --cream: #faf4e6;
  --cream-deep: #efe2c8;
  --paper: #fffaf0;
  --wood-dark: #4c3020;
  --wood-mid: #734a31;
  --wood-light: #9e6c4b;
  --brass: #c99a49;
  --brass-dark: #8c6525;
  --teal-sea: #358082;
  --teal-light: #7cc2be;
  --sunset-coral: #de6645;
  --sunset-gold: #f0b14d;
  --kpi-bg: #1b2229;
  --kpi-red: #e24e42;
  --kpi-amber: #eb9d34;
  --kpi-green: #4ab684;
  --shadow-soft: 0 8px 24px rgba(53, 41, 34, 0.16);
  --font-serif: 'Songti TC', 'Noto Serif TC', 'PMingLiU', Georgia, serif;
  --font-sans: 'PingFang TC', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

/* Warm hand-painted paper grain across viewport */
.paper-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 950;
  background-image:
    radial-gradient(rgba(115, 82, 50, 0.045) 1px, transparent 0),
    radial-gradient(rgba(255, 248, 232, 0.08) 1px, transparent 0);
  background-size: 14px 14px, 22px 22px;
  background-position: 0 0, 7px 7px;
  mix-blend-mode: multiply;
  opacity: 0.72;
}

/* ==================== TITLE SCREEN ==================== */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #6ec1d8 0%, #c6e8f0 55%, #f6dec0 100%);
}

.title-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.title-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 248, 232, 0.08) 0%, rgba(44, 34, 28, 0.28) 100%);
  pointer-events: none;
}

.title-card {
  position: relative;
  z-index: 10;
  width: min(670px, 92vw);
  background: rgba(255, 250, 240, 0.93);
  backdrop-filter: blur(10px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 36px 40px 30px;
  text-align: center;
  box-shadow:
    0 22px 54px rgba(42, 32, 24, 0.28),
    7px 7px 0 rgba(53, 41, 34, 0.16),
    inset 0 0 0 4px rgba(255, 250, 240, 0.8),
    inset 0 0 0 5.5px rgba(53, 41, 34, 0.12);
}

.title-stamp-corner {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 11px;
  font-weight: 700;
  color: #b5452a;
  border: 2px solid #b5452a;
  padding: 2px 9px;
  border-radius: 6px;
  transform: rotate(4deg);
  background: rgba(222, 102, 69, 0.08);
}

.title-route-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cream-deep);
  border: 1.8px solid var(--ink);
  border-radius: 999px;
  padding: 5px 15px 5px 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.route-num {
  background: var(--teal-sea);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.game-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 50px);
  font-weight: 900;
  letter-spacing: 0.09em;
  color: var(--ink);
  line-height: 1.18;
}

.game-subtitle {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.38em;
  color: var(--teal-sea);
  margin-top: 6px;
  font-weight: 700;
}

.title-tagline {
  margin: 16px auto 18px;
  max-width: 500px;
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink-soft);
  font-family: var(--font-serif);
}

.title-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-bottom: 22px;
}

.meta-pill {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f5ebd7;
  border: 1.2px solid rgba(53, 41, 34, 0.22);
  color: var(--ink);
  font-weight: 500;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.btn-primary-warm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #e77453 0%, #d45836 100%);
  color: #fffdf8;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 13px 30px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.18s ease;
}

.btn-primary-warm:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink);
}

.btn-primary-warm:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

.btn-secondary-warm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-secondary-warm:hover {
  background: var(--cream-deep);
  transform: translateY(-1px);
}

.title-secondary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pace-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f4ead6;
  border: 1.6px solid rgba(53, 41, 34, 0.35);
  border-radius: 12px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
}

.pace-label { color: var(--ink-soft); margin-right: 2px; }

.pace-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}

.pace-btn.active {
  background: var(--teal-sea);
  color: #fff;
}

.title-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #827060;
}

/* ==================== MAIN GAME SHELL ==================== */
.game-app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #e4d5ba;
}

/* TOP CORPORATE KPI MONITOR BAR */
.kpi-bar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 16px;
  background: var(--kpi-bg);
  color: #e9eef2;
  border-bottom: 3px solid var(--ink);
  z-index: 40;
  overflow: hidden;
  transition: background 0.7s ease, border-color 0.7s ease;
}

.kpi-bar[data-alert="warn"] {
  background: #2c221d;
  border-bottom-color: var(--kpi-amber);
}

.kpi-bar[data-alert="critical"] {
  background: #351818;
  border-bottom-color: var(--kpi-red);
}

.kpi-bar[data-alert="warm-rebel"] {
  background: linear-gradient(90deg, #3c2623 0%, #523828 52%, #684b2c 100%);
  border-bottom-color: var(--sunset-gold);
}

/* Rebellious warm hand-drawn stickers floating on the KPI bar! */
.kpi-stickers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.kpi-sticker {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  background: #fff6dc;
  color: #7d3e1e;
  border: 1.5px solid #352922;
  border-radius: 6px;
  padding: 1px 7px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  opacity: 0.92;
  animation: stickerSlap 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes stickerSlap {
  from { transform: scale(1.7) rotate(-14deg); opacity: 0; }
  to { opacity: 0.92; }
}

.kpi-left, .kpi-metrics, .kpi-tools {
  position: relative;
  z-index: 3;
}

.kpi-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 320px;
}

.kpi-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: #9bb0c1;
  font-weight: 700;
}

.kpi-slogan {
  color: #6f8496;
  font-weight: 500;
  font-size: 10.5px;
}

.kpi-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kpi-green);
  box-shadow: 0 0 8px var(--kpi-green);
  flex-shrink: 0;
}

.kpi-bar[data-alert="warn"] .kpi-led {
  background: var(--kpi-amber);
  box-shadow: 0 0 8px var(--kpi-amber);
  animation: blink 1.1s infinite;
}

.kpi-bar[data-alert="critical"] .kpi-led,
.kpi-bar[data-alert="warm-rebel"] .kpi-led {
  background: var(--kpi-red);
  box-shadow: 0 0 10px var(--kpi-red);
  animation: blink 0.55s infinite;
}

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

.kpi-dispatch-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dispatch-tag {
  background: rgba(255, 255, 255, 0.14);
  color: #ffd599;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.dispatch-text {
  color: #f4f7fa;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.kpi-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 10px;
  color: #8fa1b0;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}

.kpi-sep { color: #6b7d8c; margin: 0 2px; }

.delay-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  font-family: var(--font-mono);
}

.delay-badge.on-time { background: rgba(74, 182, 132, 0.22); color: #79e5b0; }
.delay-badge.late { background: rgba(235, 157, 52, 0.25); color: #ffc56b; }
.delay-badge.very-late { background: rgba(226, 78, 66, 0.3); color: #ff8a80; }

.kpi-meter-wrap { display: flex; align-items: center; gap: 7px; }
.kpi-meter-track {
  width: 68px;
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  overflow: hidden;
}
.kpi-meter-fill {
  height: 100%;
  background: var(--kpi-green);
  transition: width 0.5s ease, background 0.5s ease;
}

.warmth-cell {
  background: rgba(240, 177, 77, 0.16);
  border: 1px solid rgba(240, 177, 77, 0.45);
  border-radius: 8px;
  padding: 3px 10px;
}
.warmth-cell .kpi-label { color: #f6cf8a; }
.warmth-hearts {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ffd57e;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-mono);
}

.kpi-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tool-chip {
  background: rgba(255, 255, 255, 0.1);
  color: #eef3f7;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
}
.tool-chip:hover { background: rgba(255, 255, 255, 0.22); }

/* ==================== MAIN SPLIT STAGE ==================== */
.main-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.24fr 0.96fr;
  gap: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #e7d9bf 0%, #dccbb0 100%);
}

/* LEFT PANEL */
.left-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 9px;
}

.window-frame {
  position: relative;
  flex: 1 1 64%;
  min-height: 0;
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  background: #87cfe0;
  box-shadow: inset 0 0 0 3px rgba(255, 250, 240, 0.28), var(--shadow-soft);
}

#scenery-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.window-hud-top {
  position: absolute;
  top: 11px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.stop-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 250, 240, 0.92);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 5px 12px;
  box-shadow: 0 3px 0 rgba(53, 41, 34, 0.22);
}

.stop-index {
  background: var(--teal-sea);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.stop-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.stop-next {
  font-size: 11.5px;
  color: var(--ink-soft);
  padding-left: 6px;
  border-left: 1.5px solid rgba(53, 41, 34, 0.2);
}

.time-phase-pill {
  background: rgba(46, 36, 30, 0.8);
  color: #fff7e6;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 250, 240, 0.45);
}

/* Secret Sight / Warmth Toast */
.window-toast {
  position: absolute;
  bottom: 16px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 249, 232, 0.95);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(53, 41, 34, 0.22);
  z-index: 18;
  animation: toastSlide 0.35s ease;
}

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

.road-alert-pill {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff5d6;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(53, 41, 34, 0.22);
  z-index: 15;
  animation: floatPop 0.35s ease;
}

@keyframes floatPop {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.window-progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(53, 41, 34, 0.28);
  z-index: 12;
}

.window-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #56b3a8, #f2b857);
  transition: width 0.2s linear;
}

/* Hanging wooden charm */
.hanging-charm {
  position: absolute;
  top: 0;
  right: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
  z-index: 9;
  pointer-events: none;
  transition: transform 0.25s ease-out;
}

.charm-string { width: 2px; height: 20px; background: #9e4332; }
.charm-body {
  background: linear-gradient(180deg, #f8e5c2 0%, #edd1a0 100%);
  border: 2px solid var(--ink);
  border-radius: 6px 6px 8px 8px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  color: #8c3123;
  box-shadow: 2px 3px 0 rgba(53, 41, 34, 0.22);
}

/* CHOICE OVERLAY */
.choice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 22, 16, 0.36);
  backdrop-filter: blur(2.5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
  z-index: 30;
  animation: fadeIn 0.25s ease;
}

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

.choice-card {
  width: min(580px, 98%);
  background: var(--paper);
  border: 2.8px solid var(--ink);
  border-radius: 16px;
  padding: 15px 18px;
  box-shadow: 0 14px 34px rgba(30, 20, 14, 0.35), 4px 4px 0 rgba(53, 41, 34, 0.22);
  animation: slideUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}

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

.choice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.choice-tag {
  font-size: 11.5px;
  font-weight: 700;
  background: var(--teal-sea);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
}

.choice-kpi-warn { font-size: 11.5px; font-weight: 700; color: #c24234; }
.choice-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.choice-desc {
  font-size: 13.2px;
  line-height: 1.62;
  color: var(--ink-soft);
  margin-bottom: 11px;
}
.choice-buttons { display: flex; flex-direction: column; gap: 7px; }

.choice-opt-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 9px 13px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #fffdf7;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: transform 0.12s ease, background 0.15s ease;
}

.choice-opt-btn:hover { transform: translateX(3px); background: #fdf1d9; }
.choice-opt-btn.slow-choice { background: #fff6e5; border-color: #b55233; }
.choice-opt-btn.slow-choice:hover { background: #ffe6c0; }
.choice-opt-main { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.choice-opt-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.choice-opt-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}
.choice-opt-tag.kpi-good { background: #dff3e8; color: #1f7349; }
.choice-opt-tag.kpi-bad { background: #fde5df; color: #b53b2c; }

.scenic-moment-banner {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: rgba(30, 22, 16, 0.8);
  backdrop-filter: blur(8px);
  color: #fff6e5;
  border: 2px solid rgba(255, 218, 158, 0.65);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 25;
}

.scenic-quote { font-family: var(--font-serif); font-size: 14px; line-height: 1.65; }

.btn-scenic-continue {
  flex-shrink: 0;
  background: var(--sunset-gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
}
.btn-scenic-continue:hover { background: #f8c873; }

/* ==================== VINTAGE WALNUT & BRASS DASHBOARD ==================== */
.dashboard {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #ecdcc1 0%, #d8c19e 100%);
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

/* Keepsake Wooden Shelf Bar */
.dash-shelf-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #6b452d 0%, #533421 100%);
  border-bottom: 2.5px solid var(--ink);
  color: #f7e9d0;
}

.shelf-label {
  font-size: 11px;
  font-weight: 700;
  color: #f2d49b;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.keepsake-shelf {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  min-height: 24px;
}

.shelf-empty-hint {
  font-size: 11px;
  color: rgba(247, 233, 208, 0.58);
  font-style: italic;
}

.keepsake-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff7e3;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease;
  animation: popIn 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.keepsake-chip:hover {
  transform: translateY(-2px);
  background: #ffe8b8;
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.dash-mascot-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff7e6;
  color: var(--ink);
  border: 1.6px solid var(--ink);
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.dash-mascot-wrap:hover { transform: scale(1.06); }

.dash-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.dash-gauges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.speedometer {
  position: relative;
  width: 120px;
  height: 90px;
  background: radial-gradient(circle at 50% 60%, #fffdf6 0%, #f5ead4 100%);
  border: 3px solid var(--brass-dark);
  box-shadow: 0 0 0 2px var(--ink), inset 0 2px 8px rgba(53, 41, 34, 0.16);
  border-radius: 14px;
  padding: 4px;
}

.speedo-svg { width: 100%; height: 100%; }
.speedo-tick {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-soft);
  font-weight: 700;
}

.speedo-readout {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  line-height: 1;
}

.speed-num { font-size: 16px; font-weight: 700; color: var(--ink); }
.speed-unit { font-size: 9.5px; color: var(--ink-soft); margin-left: 2px; }

.dash-status-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 108px;
}

.odometer-box {
  background: #27201b;
  color: #f6e1bc;
  border: 2px solid var(--ink);
  border-radius: 7px;
  padding: 3px 8px;
  display: flex;
  flex-direction: column;
}
.odo-label { font-size: 9px; color: #a9957d; }
.odo-val { font-size: 13px; font-weight: 700; }

.drive-mode-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--wood-dark);
  background: rgba(255, 250, 240, 0.78);
  border: 1.5px solid rgba(53, 41, 34, 0.25);
  border-radius: 6px;
  padding: 2.5px 7px;
  text-align: center;
}

.sight-counter {
  font-size: 10.5px;
  font-weight: 700;
  color: #25686b;
  background: rgba(212, 240, 236, 0.78);
  border: 1.2px solid rgba(53, 128, 130, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  text-align: center;
}

.dash-controls-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.gear-row, .switch-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.dash-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px 6px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 11px;
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.1s ease;
}

.dash-btn:hover { background: #f9eed9; }
.dash-btn.active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.dash-btn.btn-brake.active { background: #f5d6ce; border-color: #a13928; }
.dash-btn.btn-slow.active { background: #d6efe8; border-color: #25716c; }
.dash-btn.btn-cruise.active { background: #f8e7be; border-color: #9e6b1b; }
.dash-btn.btn-rush.active { background: #f7c7be; border-color: #b52d22; }

.key-cap {
  position: absolute;
  top: 4px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(53, 41, 34, 0.08);
  padding: 0 4px;
  border-radius: 3px;
}

.btn-main-txt { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.btn-sub-txt { font-size: 10px; color: var(--ink-soft); font-family: var(--font-mono); }

.switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 6px;
  background: #f4e7cf;
  border: 1.8px solid var(--ink);
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.switch-btn:hover { background: #fff6e4; }
.switch-btn.on { background: #c8e7df; border-color: #246a63; }

/* ==================== RIGHT PANEL: BUS CABIN ==================== */
.right-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 9px;
}

.route-strip-wrap {
  flex: 0 0 auto;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 8px 12px 10px;
  box-shadow: var(--shadow-soft);
}

.route-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.route-strip-title { font-size: 12px; font-weight: 700; color: var(--teal-sea); letter-spacing: 0.05em; }
.route-strip-badges { display: flex; align-items: center; gap: 6px; }

.inspector-alert-pill {
  font-size: 11px;
  font-weight: 700;
  background: #fde4dc;
  color: #b53224;
  border: 1.2px solid #c94e3f;
  padding: 2px 8px;
  border-radius: 999px;
  animation: blink 1.6s infinite;
}

.passenger-count-badge {
  font-size: 11.5px;
  font-weight: 700;
  background: #f3e6ce;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--ink);
}

.route-dots {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 2px 4px;
}

.route-dots::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 3px;
  background: #d8ccb8;
  transform: translateY(-50%);
  z-index: 0;
}

.route-dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2.2px solid #a99b89;
  transition: transform 0.25s ease, background 0.25s ease;
}
.route-dot.passed { background: var(--teal-sea); border-color: var(--ink); }
.route-dot.current {
  background: var(--sunset-coral);
  border-color: var(--ink);
  transform: scale(1.32);
  box-shadow: 0 0 0 3px rgba(222, 102, 69, 0.28);
}
.route-dot.detoured::after {
  content: '★';
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #d98724;
}

/* Cabin Canvas */
.cabin-stage {
  position: relative;
  flex: 1 1 56%;
  min-height: 0;
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: #f5ebd6;
  box-shadow: var(--shadow-soft);
}

#cabin-canvas { display: block; width: 100%; height: 100%; cursor: pointer; }

.speech-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.bubble {
  position: absolute;
  max-width: 230px;
  padding: 7px 11px;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  background: rgba(255, 252, 245, 0.96);
  border: 2px solid var(--ink);
  box-shadow: 0 4px 12px rgba(53, 41, 34, 0.18);
  transform: translate(-50%, -100%);
  animation: bubblePop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.bubble.thought {
  background: rgba(246, 244, 238, 0.94);
  border-style: dashed;
  border-color: #7c6f63;
  color: #554940;
  font-style: italic;
}
.bubble.icebreaker { background: #fff4da; border-color: #c8643c; }
.bubble-speaker { display: block; font-size: 10.5px; font-weight: 700; color: var(--teal-sea); margin-bottom: 2px; }
.bubble.icebreaker .bubble-speaker { color: #c4542f; }

@keyframes bubblePop {
  from { opacity: 0; transform: translate(-50%, -88%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

.cabin-hint {
  position: absolute;
  bottom: 7px;
  right: 10px;
  font-size: 10.5px;
  color: rgba(53, 41, 34, 0.72);
  background: rgba(255, 250, 240, 0.85);
  padding: 2px 9px;
  border-radius: 999px;
  pointer-events: none;
}

/* Cabin Dialogue Feed */
.cabin-feed-panel {
  flex: 0 0 30%;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--cream-deep);
  border-bottom: 1.5px solid rgba(53, 41, 34, 0.2);
}
.feed-title { font-size: 12px; font-weight: 700; }
.icebreaker-counter { font-size: 11px; font-weight: 700; color: #b85330; }

.dialogue-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}

.log-entry {
  padding: 5px 8px;
  border-radius: 8px;
  background: #faf4e8;
  border-left: 3px solid #c2b29b;
}
.log-entry.thought { background: #f4f1ea; border-left-color: #8f8478; color: #5f5348; }
.log-entry.icebreaker { background: #fff4dd; border-left-color: var(--sunset-coral); }
.log-entry.system { background: #e9f4f2; border-left-color: var(--teal-sea); color: #295958; font-size: 12px; }
.log-speaker { font-weight: 700; margin-right: 6px; }

/* ==================== MODALS & ACTIVE REARVIEW CHAT ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 650;
  background: rgba(30, 22, 16, 0.52);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: min(580px, 94vw);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 20px 48px rgba(30, 20, 14, 0.38);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--cream-deep);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.inspector-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.insp-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.insp-name-row { display: flex; align-items: baseline; gap: 8px; }
.insp-name-row h3 { font-family: var(--font-serif); font-size: 20px; }
.insp-role { font-size: 12.5px; color: var(--ink-soft); }
.insp-mood-row { margin-top: 4px; font-size: 12.5px; }
.insp-mood-badge { background: #f5e4c4; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.insp-bio { font-size: 13.2px; line-height: 1.65; color: var(--ink-soft); margin-bottom: 12px; }

.insp-hearts-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; margin-bottom: 14px; }
.insp-progress-track {
  flex: 1;
  height: 10px;
  background: #e8dcc8;
  border-radius: 99px;
  border: 1.5px solid var(--ink);
  overflow: hidden;
}
.insp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sunset-gold), var(--sunset-coral));
  transition: width 0.35s ease;
}

.insp-sec-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-sea);
  margin-bottom: 7px;
}

.insp-chat-box {
  background: #f8f1e2;
  border: 1.8px solid rgba(53, 41, 34, 0.25);
  border-radius: 12px;
  padding: 11px 13px;
}

.insp-chat-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-opt-btn {
  text-align: left;
  background: #fffdf8;
  border: 1.8px solid var(--ink);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease, transform 0.1s ease;
}
.chat-opt-btn:hover { background: #ffefc9; transform: translateX(2px); }
.chat-opt-btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.insp-chat-reply {
  margin-top: 9px;
  padding: 9px 11px;
  background: #fff6e0;
  border-left: 3.5px solid var(--sunset-coral);
  border-radius: 8px;
  font-size: 12.8px;
  line-height: 1.58;
  font-family: var(--font-serif);
}

.insp-memories { display: flex; flex-direction: column; gap: 6px; }
.insp-mem-item {
  font-size: 12.2px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #f8f0df;
  border: 1px dashed rgba(53, 41, 34, 0.3);
}

/* Logbook */
.logbook-card { width: min(700px, 95vw); }
.logbook-title { font-family: var(--font-serif); font-size: 22px; margin-bottom: 4px; }
.logbook-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.logbook-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; border-bottom: 2px solid #e4d7bf; padding-bottom: 8px; }
.log-tab {
  border: 2px solid transparent;
  background: transparent;
  padding: 6px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-sans);
}
.log-tab.active { background: var(--cream-deep); border-color: var(--ink); color: var(--ink); }
.logbook-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 10px; }
.log-card-item {
  background: #fffdf8;
  border: 1.8px solid rgba(53, 41, 34, 0.3);
  border-radius: 12px;
  padding: 11px 13px;
}
.log-card-item h4 { font-size: 14px; margin-bottom: 4px; }
.log-card-item p { font-size: 12px; line-height: 1.55; color: var(--ink-soft); }

/* ==================== VIRAL TICKET SETTLEMENT SCREEN ==================== */
.ticket-screen {
  position: fixed;
  inset: 0;
  z-index: 700;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.ticket-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, #3d4d72 0%, #1a2135 100%);
  z-index: 0;
}

.ticket-wrapper {
  position: relative;
  z-index: 5;
  width: min(780px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.ticket-intro { text-align: center; color: #fff6e5; }
.ticket-arrived-tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.14em;
  background: rgba(255, 214, 138, 0.18);
  border: 1px solid rgba(255, 214, 138, 0.5);
  color: #ffe09e;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.ending-headline { font-family: var(--font-serif); font-size: clamp(22px, 3.6vw, 30px); font-weight: 900; margin-bottom: 6px; }
.ending-subtext { font-size: 14px; color: #d4dce8; max-width: 600px; line-height: 1.62; }

.physical-ticket {
  position: relative;
  width: 100%;
  background: #fbf4e2;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 0 24px 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(251, 244, 226, 0.12);
  animation: ticketPrint 0.65s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes ticketPrint {
  from { opacity: 0; transform: translateY(-28px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ticket-sunset-ribbon {
  margin: 0 -24px 16px;
  padding: 12px 24px;
  background: linear-gradient(90deg, #3c5478 0%, #b5665c 52%, #e8a45c 100%);
  color: #fffaf0;
  border-bottom: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.ticket-serial { font-size: 12px; color: rgba(255, 250, 240, 0.9); }

.ticket-perf-left, .ticket-perf-right {
  position: absolute;
  top: 53%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #27314a;
  border: 3px solid var(--ink);
  transform: translateY(-50%);
}
.ticket-perf-left { left: -14px; }
.ticket-perf-right { right: -14px; }

.ticket-contrast-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.contrast-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(53, 41, 34, 0.2);
}
.corporate-box { background: #f9ebe7; border-color: rgba(194, 58, 43, 0.38); }
.warmth-box { background: #fff4d8; border-color: rgba(217, 138, 36, 0.48); }

.stamp-frame {
  flex-shrink: 0;
  width: 78px;
  height: 78px;
  border-radius: 12px;
  border: 3.5px double;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-6deg);
}
.stamp-red { border-color: #c43628; color: #c43628; background: rgba(196, 54, 40, 0.06); }
.stamp-gold { border-color: #c77614; color: #b86209; background: rgba(240, 177, 77, 0.14); transform: rotate(5deg); }
.stamp-label { font-size: 10px; font-weight: 700; }
.stamp-grade { font-family: var(--font-serif); font-size: 32px; font-weight: 900; line-height: 1.05; }

.delay-line, .happy-line { font-family: var(--font-serif); font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.delay-line { color: #b53224; }
.happy-line { color: #9c5308; }
.kpi-note, .happy-note { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

.contrast-divider {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-soft);
  background: #ede1c9;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
}

.ticket-keepsakes-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ticket-ks-pill {
  font-size: 11.5px;
  background: #f2e6ce;
  border: 1.2px solid rgba(53, 41, 34, 0.25);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.ticket-dashed-line { border-top: 2px dashed rgba(53, 41, 34, 0.35); margin: 12px 0; }

.ticket-middle { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
.ticket-sec-title { font-size: 12px; font-weight: 700; color: var(--teal-sea); letter-spacing: 0.05em; margin-bottom: 8px; }
.ticket-detour-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12.2px; color: var(--ink); }
.ticket-detour-list li { background: #f3ead5; padding: 5px 9px; border-radius: 7px; border-left: 3px solid var(--sunset-gold); }

.ticket-notes-list { display: flex; flex-direction: column; gap: 7px; }
.ticket-note-item {
  background: #fffdf7;
  border: 1.5px solid rgba(53, 41, 34, 0.22);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.5;
  font-family: var(--font-serif);
}
.ticket-note-author { display: block; text-align: right; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

.ticket-footer-strip {
  background: #efe3ca;
  border: 1.5px solid rgba(53, 41, 34, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.earned-label { font-size: 12px; color: var(--ink-soft); }
.earned-value { font-family: var(--font-serif); font-size: 15px; font-weight: 900; color: #a84222; }
.ticket-moral { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.ticket-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

@media (max-width: 1024px) {
  .main-stage { grid-template-columns: 1fr; grid-template-rows: 1.15fr 0.85fr; overflow-y: auto; }
  .kpi-bar { flex-wrap: wrap; }
  .ticket-contrast-grid, .ticket-middle { grid-template-columns: 1fr; }
  .contrast-divider { margin: 0 auto; }
}
