:root {
  --bg: #1a1210;
  --card: rgba(22, 18, 20, 0.88);
  --text: #f4ece4;
  --muted: #c3b3a6;
  --accent: #e0772f;
  --accent-2: #ffb45c;
  --line: rgba(255, 255, 255, 0.14);
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

#app, #app canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* --- Start page --------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(26, 18, 16, 0.35), rgba(26, 18, 16, 0.8));
  overflow-y: auto;
}

.overlay[hidden] { display: none; }

.card {
  width: min(900px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 28px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  margin: auto;
}

.title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}

.title canvas {
  width: 84px;
  height: 84px;
  flex: none;
}

h1 {
  margin: 0;
  font-size: 2.3rem;
  letter-spacing: 0.01em;
}

.lead {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 600;
}

.columns {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(260px, 1.1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 680px) {
  .columns { grid-template-columns: 1fr; }
}

.bus-plan {
  background: #efe9e1;
  border-radius: 90px 90px 22px 22px;
  padding: 14px 18px 18px;
  width: 250px;
  margin: 0 auto;
  box-shadow: inset 0 0 0 5px #d8cfc3;
}

.bus-front {
  text-align: center;
  color: #6b5a4c;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 0 12px;
  border-bottom: 4px solid #2c3137;
  margin: 0 18px 14px;
}

.seats {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  gap: 10px 0;
}

.seat {
  height: 50px;
  border-radius: 12px;
  border: 3px solid transparent;
  background: #3b4c63;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s, border-color 0.08s;
}

.seat .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.seat:hover { transform: translateY(-1px); }

.seat[aria-pressed="true"] {
  border-color: var(--accent);
  background: #2a3a50;
  box-shadow: 0 0 0 3px rgba(224, 119, 47, 0.35);
}

.seat.right { grid-column: 3; }
.seat.left { grid-column: 1; }

.seat-label {
  text-align: center;
  margin: 12px 0 0;
  color: var(--muted);
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle .switch {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #574b45;
  position: relative;
  margin-top: 2px;
  transition: background 0.15s;
}

.toggle .switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(20px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.toggle .text { display: grid; gap: 2px; }
.toggle small { color: var(--muted); line-height: 1.35; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.actions button {
  flex: 1 1 160px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.15rem;
  font-weight: 700;
}

.actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 12px 0 0;
}

/* --- Desktop HUD ------------------------------------------------------------ */

#hud[hidden] { display: none; }

.hud-status {
  position: fixed;
  top: 14px;
  left: 14px;
  background: rgba(13, 21, 32, 0.72);
  padding: 8px 18px;
  border-radius: 12px;
  pointer-events: none;
  max-width: 40vw;
}

#hud-title { font-weight: 700; font-size: 1.1rem; }
#hud-subtitle { color: #ffc36b; font-size: 0.95rem; }
#hud-subtitle:empty { display: none; }

.hud-help {
  position: fixed;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(13, 21, 32, 0.72);
  padding: 10px 14px;
  border-radius: 12px;
  pointer-events: none;
}

.hud-help strong { color: var(--text); }
.hud-help[hidden] { display: none; }

.hud-bar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 21, 32, 0.8);
  padding: 8px 10px;
  border-radius: 14px;
}

.hud-bar button {
  min-width: 42px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.hud-bar .time {
  font-variant-numeric: tabular-nums;
  min-width: 96px;
  text-align: center;
}

.scrub {
  flex: 1;
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
}

.scrub input {
  width: 100%;
  accent-color: var(--accent);
}

.ticks {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 2px;
  height: 8px;
  pointer-events: none;
}

.ticks span {
  position: absolute;
  width: 3px;
  height: 8px;
  margin-left: -1px;
  background: #ffc36b;
  border-radius: 2px;
}

.fps {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 54px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.error {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: #7a1f1f;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  white-space: pre-wrap;
}
