@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #191923;
  --panel: #22222e;
  --panel-hover: #292838;
  --border: #383543;
  --border-light: #49404d;
  --ink: #f7e5d3;
  --muted: #aaa4b5;
  --muted-dim: #777085;
  --accent: #edb08f;
  --accent-glow: #ecc3a755;
  --accent-active: #4a393d;
  --accent-text: #ffd6b8;
  --shadow-window: 0 10px 40px rgba(7, 7, 16, 0.45);
  --radius-sm: 4px;
  --radius-md: 7px;
  --radius-lg: 12px;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Mono', Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: transparent;
  transition: all 0.15s ease;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header {
  height: 90px;
  padding: 0 5%;
  border-bottom: 1px solid #2c2b36;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
  font: bold 21px var(--font-mono);
  letter-spacing: 2px;
}

.brand-icon {
  background: var(--accent);
  color: #282334;
  padding: 1px 8px;
  font-size: 26px;
  border-radius: var(--radius-sm);
}

.edition {
  font: 13px var(--font-sans);
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 9px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.lang-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.lang-btn.selected {
  background: var(--accent-active);
  color: var(--accent-text);
}

.quiet {
  border: 1px solid var(--border);
  background: transparent;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: #d2c9d5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiet:hover {
  background: var(--panel);
  border-color: var(--border-light);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
main {
  max-width: 1320px;
  width: 100%;
  margin: auto;
  padding: 36px 40px 24px;
  flex: 1;
}

.scene-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 23px;
}

.eyebrow {
  font: 12px var(--font-mono);
  letter-spacing: 1.8px;
  color: var(--muted);
  margin: 0 0 10px;
}

.eyebrow span {
  color: #d7cfd9;
  margin-left: 10px;
}

h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.5px;
  margin: 0;
}

.journey {
  font: 12px var(--font-mono);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
  color: #cfc4d0;
}

.live {
  width: 7px;
  height: 7px;
  background: #ecc3a7;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.divider {
  color: #696274;
  margin: 0 4px;
}

/* ==========================================================================
   Window & Pixel Art Canvas
   ========================================================================== */
.window {
  position: relative;
  overflow: hidden;
  border: 1px solid #776072;
  border-radius: var(--radius-lg);
  background: #302d49;
  aspect-ratio: 2.65;
  box-shadow: var(--shadow-window);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  object-fit: cover;
}

.scene-label {
  position: absolute;
  top: 21px;
  left: 23px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.scene-label span {
  font: 11px var(--font-mono);
  letter-spacing: 1.5px;
  color: #fff0e4;
  background: rgba(41, 38, 53, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}

.scene-bottom {
  position: absolute;
  bottom: 16px;
  right: 18px;
  left: 23px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 10px var(--font-mono);
  letter-spacing: 2px;
  color: #dfd2d3;
  z-index: 2;
}

.scene-bottom button {
  background: rgba(34, 35, 51, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 34px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.scene-bottom button:hover {
  background: rgba(55, 56, 75, 0.9);
}

#art-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #29263c;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  z-index: 5;
}

#transition-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  font-size: 32px;
  letter-spacing: 2px;
  color: #f7ddbd;
  text-align: center;
  z-index: 4;
  transition: opacity 0.2s ease;
}

#transition-title small {
  font-size: 12px;
  letter-spacing: 3px;
  color: #cabccd;
  margin-bottom: 12px;
}

/* ==========================================================================
   Controls Section
   ========================================================================== */
.controls {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 35px;
  padding: 28px 0;
}

.setting + .setting {
  border-left: 1px solid var(--border);
  padding-left: 35px;
}

.destination-picker {
  display: flex;
  gap: 10px;
}

.destination-picker select {
  max-width: none;
  flex: 1;
  font-size: 15px;
  padding: 12px 14px;
  background: #332c36;
  color: var(--ink);
  border: 1px solid #9b7567;
  border-radius: var(--radius-md);
}

.nav-city {
  width: 44px;
  border: 1px solid var(--border);
  background: #292734;
  border-radius: var(--radius-md);
  font-size: 20px;
  display: grid;
  place-items: center;
}

.nav-city:hover {
  background: #363445;
  border-color: var(--accent);
}

.tour-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}

.tour-options label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.tour-options select {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
}

.tour-progress {
  height: 4px;
  background: #3a3441;
  margin-top: 15px;
  border-radius: 4px;
  overflow: hidden;
}

#tour-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.1s linear;
}

#tour-status {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
  font-family: var(--font-mono);
}

/* Atmosphere / Weather & Time Buttons */
.row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
}

.row label {
  color: var(--muted);
  min-width: 74px;
  font-size: 13px;
}

.segments {
  display: flex;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  background: #1d1d28;
}

.segments button {
  flex: 1;
  white-space: nowrap;
  border: 0;
  background: none;
  color: #b4aabd;
  font-size: 13px;
  padding: 9px 5px;
  border-radius: var(--radius-sm);
}

.segments button span {
  font-size: 12px;
  margin-left: 6px;
}

.segments .selected {
  background: var(--accent-active);
  color: var(--accent-text);
  font-weight: 500;
}

/* ==========================================================================
   Procedural Ambient Music Section
   ========================================================================== */
.music {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 24px;
  background: #24232f;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 8px;
}

#play {
  background: var(--accent);
  color: #302530;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  font-size: 18px;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

#play:hover {
  transform: scale(1.05);
  background: #f7be9f;
}

#play.pulse-prompt {
  animation: audioPulse 1.9s ease-in-out infinite;
}

@keyframes audioPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(224, 138, 94, 0.6);
  }
  50% {
    transform: scale(1.09);
    box-shadow: 0 0 0 10px rgba(224, 138, 94, 0);
  }
}

.track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
}

.track .eyebrow {
  font-size: 10px;
  margin: 0;
  letter-spacing: 1.4px;
}

.track strong {
  font-size: 15px;
  font-weight: 500;
}

#audio-hint {
  font-size: 11px;
  color: var(--muted);
}

/* Equalizer Bars */
.equalizer {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 28px;
  opacity: 0.35;
}

.equalizer i {
  width: 3px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  display: block;
}

.equalizer i:nth-child(3n) { height: 20px; }
.equalizer i:nth-child(2n) { height: 13px; }

.playing .equalizer {
  opacity: 0.95;
}

.playing .equalizer i {
  animation: beat 1.4s infinite alternate ease-in-out;
}

.playing .equalizer i:nth-child(2n) { animation-delay: -0.6s; }
.playing .equalizer i:nth-child(3n) { animation-delay: -1.1s; }

@keyframes beat {
  to { transform: scaleY(0.25); }
}

.volume {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100px;
  height: 5px;
  cursor: pointer;
}

.music select {
  background: #24232f;
  color: #ded3dc;
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  max-width: 190px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  display: flex;
  justify-content: space-between;
  color: #8e8599;
  font-size: 12px;
  padding: 24px 0 12px;
}

footer span:last-child {
  font: 10px var(--font-mono);
  letter-spacing: 1.7px;
}

/* ==========================================================================
   Immersive Focus Mode
   ========================================================================== */
.focus main {
  max-width: none;
  padding: 16px;
}

.focus .scene-head,
.focus .controls,
.focus .music,
.focus footer {
  display: none;
}

.focus .window {
  height: calc(100dvh - 124px);
  aspect-ratio: auto;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (min-width: 1500px) {
  main {
    padding-top: 48px;
  }
  .window {
    aspect-ratio: 2.4;
  }
}

@media (max-width: 950px) {
  main {
    padding: 28px 22px;
  }
  .controls {
    gap: 24px;
    grid-template-columns: 1fr;
  }
  .setting + .setting {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 20px 0 0;
  }
  .music {
    flex-wrap: wrap;
  }
  .equalizer {
    display: none;
  }
  .volume {
    margin-left: auto;
  }
  .window {
    aspect-ratio: 2;
  }
  .edition {
    display: none;
  }
}

@media (max-width: 600px) {
  header {
    height: 72px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
  }
  .scene-head {
    display: block;
  }
  h1 {
    font-size: 22px;
  }
  .journey {
    margin-top: 14px;
    font-size: 10px;
  }
  .window {
    aspect-ratio: 1.35;
    border-radius: var(--radius-md);
  }
  .scene-label {
    top: 12px;
    left: 12px;
  }
  .scene-label span {
    font-size: 9px;
  }
  .scene-bottom {
    left: 12px;
    font-size: 8px;
  }
  .row {
    gap: 8px;
  }
  .row label {
    min-width: 65px;
  }
  .segments button span {
    font-size: 11px;
    margin-left: 2px;
  }
  .music {
    gap: 14px;
    padding: 16px;
  }
  .track {
    min-width: 160px;
    flex: 1;
  }
  .volume {
    margin-left: 0;
  }
  .volume input {
    width: 80px;
  }
  .music select {
    margin-left: auto;
    max-width: 150px;
  }
  #transition-title {
    font-size: 24px;
  }
  footer span:last-child {
    display: none;
  }
  footer {
    justify-content: center;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .playing .equalizer i,
  .live {
    animation: none;
  }
}

/* =============================================================
   Start Journey Modal Overlay (Autoplay Policy Compliant)
   ============================================================= */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(14, 15, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 20px;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-card {
  background: linear-gradient(150deg, rgba(38, 42, 66, 0.96), rgba(24, 26, 44, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(224, 138, 94, 0.15);
  max-width: 440px;
  width: 100%;
  padding: 38px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: startCardFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes startCardFadeUp {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.start-icon {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(224, 138, 94, 0.35));
  margin-bottom: -4px;
}

.start-card h2 {
  font-size: 23px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
  margin: 0;
}

.start-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.start-btn {
  background: linear-gradient(135deg, #e08a5e, #ca7c67);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 999px;
  padding: 14px 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(224, 138, 94, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  margin-top: 8px;
}

.start-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(224, 138, 94, 0.6);
}

.start-btn:active {
  transform: translateY(0) scale(0.98);
}

.start-tip {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: -4px;
  margin-bottom: 0;
}

