/* =========================================================
   Midnight Grand Tour — Interface-Styles
   Dunkles Glas, Schweizer Rot, Racing-HUD-Typografie.
   ========================================================= */

:root {
  --red: #ff4b4b;
  --red-deep: #d92332;
  --ink: #06090f;
  --panel: rgba(10, 14, 22, 0.82);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #eef2f7;
  --text-dim: #8b96a5;
  --glow: 0 0 24px rgba(255, 75, 75, 0.35);
  --font-display: 'Unbounded', 'Archivo', sans-serif;
  --font-body: 'Archivo', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- Gemeinsame Glas-Optik ---------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; opacity: 0; transition: opacity 0.8s ease; }
#hud.on { opacity: 1; }
#hud > * { pointer-events: auto; }

.hud-brand {
  position: fixed; top: 18px; left: 18px;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.hud-brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
  box-shadow: var(--glow);
  animation: pulse 2.4s ease-in-out infinite;
}
.hud-brand b {
  font-family: var(--font-display);
  font-weight: 700; font-size: 12px; letter-spacing: 0.14em;
}
.hud-brand span {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.1em;
}

.hud-progress {
  position: fixed; top: 18px; right: 18px;
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px;
}
.pill {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  transition: transform 0.18s ease, color 0.3s, border-color 0.3s;
  white-space: nowrap;
}
.pill b { color: var(--text); font-weight: 500; }
.pill.bump { transform: scale(1.14); border-color: var(--red); color: var(--text); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text); font-size: 15px;
  cursor: pointer; display: grid; place-items: center;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

.hud-speed {
  position: fixed; bottom: 18px; left: 18px;
  padding: 12px 18px 10px;
  text-align: left; min-width: 140px;
}
.hud-speed .num {
  font-family: var(--font-mono); font-size: 34px; font-weight: 500;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.hud-speed .unit {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.22em; margin-top: 3px;
}
.hud-speed .drift {
  margin-top: 6px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.hud-speed .drift i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red), #ffb03a);
  border-radius: 2px; transition: width 0.08s linear;
}
.hud-speed .turbo-tag {
  display: none; margin-top: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em;
  color: #ffb03a;
}
.hud-speed.turbo .turbo-tag { display: block; }

#minimap-wrap { position: fixed; bottom: 18px; right: 18px; padding: 8px; }
#minimap { display: block; border-radius: 8px; }

#prompt {
  position: fixed; bottom: 108px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  padding: 11px 20px;
  display: flex; align-items: center; gap: 12px;
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
  border-color: rgba(255, 255, 255, 0.16);
}
#prompt.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#prompt kbd {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--red); color: #fff;
  border-radius: 6px; padding: 3px 9px;
  box-shadow: 0 3px 0 var(--red-deep);
}
#prompt span { font-size: 14px; letter-spacing: 0.02em; }
#prompt b { font-weight: 600; }

#toasts {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  z-index: 30; pointer-events: none;
}
.toast {
  padding: 10px 18px; font-size: 13.5px; letter-spacing: 0.02em;
  display: flex; gap: 10px; align-items: center;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.out { animation: toast-out 0.4s ease forwards; }
.toast .t-icon { font-size: 16px; }
.toast b { color: var(--red); font-weight: 600; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.94); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- Intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 700px at 70% 115%, rgba(214, 40, 57, 0.16), transparent 60%),
    radial-gradient(900px 600px at 15% -10%, rgba(45, 90, 160, 0.18), transparent 55%),
    var(--ink);
  transition: opacity 0.9s ease;
}
#intro.hide { opacity: 0; pointer-events: none; }
.intro-inner { text-align: center; max-width: 760px; padding: 32px 24px; }

.intro-kicker {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.42em; color: var(--text-dim);
  text-transform: uppercase; margin-bottom: 22px;
  animation: rise 0.8s ease both;
}
.intro-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 7.2vw, 74px);
  line-height: 1.02;
  letter-spacing: 0.01em;
}
.intro-title .line { display: block; overflow: hidden; }
.intro-title .line span {
  display: inline-block;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.intro-title .line:nth-child(2) span { animation-delay: 0.12s; color: var(--red); text-shadow: 0 0 44px rgba(255, 75, 75, 0.45); }
.intro-sub {
  margin-top: 18px; color: var(--text-dim); font-size: 16px;
  animation: rise 0.9s 0.28s ease both;
}
.intro-sub b { color: var(--text); font-weight: 500; }

.intro-controls {
  margin: 34px auto 0; display: flex; flex-wrap: wrap;
  justify-content: center; gap: 10px;
  animation: rise 0.9s 0.4s ease both;
}
.ctrl {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px; color: var(--text-dim);
}
.ctrl kbd {
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 7px; color: var(--text);
}

#start-btn {
  margin-top: 36px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 15px; letter-spacing: 0.12em;
  color: #fff; background: linear-gradient(180deg, #ff5c5c, var(--red-deep));
  border: none; border-radius: 14px;
  padding: 18px 44px; cursor: pointer;
  box-shadow: 0 12px 40px rgba(217, 35, 50, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: rise 0.9s 0.52s ease both;
}
#start-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 52px rgba(217, 35, 50, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
#start-btn:active { transform: translateY(1px); }

.intro-alt {
  margin-top: 20px; font-size: 12.5px; color: var(--text-dim);
  animation: rise 0.9s 0.62s ease both;
}
.intro-alt a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.intro-alt a:hover { color: var(--text); }

@keyframes rise { from { opacity: 0; transform: translateY(26px); } }

/* ---------- Modal (Stations-Karten) ---------- */
#modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 6, 10, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
}
#modal-backdrop.show { opacity: 1; pointer-events: auto; }

#modal {
  width: min(560px, 100%);
  max-height: min(78vh, 640px);
  overflow-y: auto;
  border-radius: 20px;
  padding: 30px 32px 26px;
  position: relative;
  transform: translateY(26px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.15);
  border-top: 3px solid var(--accent, var(--red));
}
#modal-backdrop.show #modal { transform: none; }

#modal .m-head { display: flex; align-items: flex-start; gap: 16px; padding-right: 34px; }
#modal .m-icon {
  width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 14px; display: grid; place-items: center;
  font-size: 26px;
  background: color-mix(in srgb, var(--accent, var(--red)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, var(--red)) 38%, transparent);
}
#modal .m-kicker {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--accent, var(--red)); margin-bottom: 5px;
}
#modal h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 24px; letter-spacing: 0.01em;
}
#modal .m-status {
  margin-left: auto; flex: none;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--panel-border); color: var(--text-dim);
  white-space: nowrap;
}
#modal .m-body { margin-top: 18px; display: grid; gap: 12px; }
#modal .m-body p { font-size: 14.5px; line-height: 1.65; color: #c6cdd6; }
#modal .m-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 7px; }
#modal .m-tags span {
  font-family: var(--font-mono); font-size: 11px;
  padding: 5px 11px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}
#modal .m-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
#modal .m-links a {
  font-size: 13px; font-weight: 500; color: var(--text);
  text-decoration: none;
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--accent, var(--red)) 45%, transparent);
  background: color-mix(in srgb, var(--accent, var(--red)) 12%, transparent);
  transition: background 0.2s;
}
#modal .m-links a:hover { background: color-mix(in srgb, var(--accent, var(--red)) 24%, transparent); }
#modal .m-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04); color: var(--text-dim);
  font-size: 15px; cursor: pointer;
}
#modal .m-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
#modal .m-foot {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.12em; color: var(--text-dim);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

/* ---------- Listenansicht (klassisch, barrierefrei) ---------- */
#list-view {
  position: fixed; inset: 0; z-index: 60;
  overflow-y: auto;
  background: var(--ink);
  display: none;
  padding: 60px 20px 80px;
}
#list-view.show { display: block; }
#list-view .lv-inner { max-width: 680px; margin: 0 auto; }
#list-view h1 { font-family: var(--font-display); font-size: 28px; margin-bottom: 4px; }
#list-view .lv-sub { color: var(--text-dim); margin-bottom: 30px; font-size: 14px; }
#list-view .lv-card { padding: 22px 24px; margin-bottom: 14px; border-left: 3px solid var(--accent, var(--red)); }
#list-view .lv-card .m-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent, var(--red)); }
#list-view .lv-card h3 { font-family: var(--font-display); font-size: 18px; margin: 6px 0 10px; }
#list-view .lv-card p { font-size: 14px; line-height: 1.6; color: #c6cdd6; margin-bottom: 8px; }
#list-view .lv-card .m-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#list-view .lv-card .m-tags span { font-family: var(--font-mono); font-size: 10.5px; padding: 4px 9px; border-radius: 6px; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); color: var(--text-dim); }
#list-view .lv-card a { color: var(--text); }
#list-view .lv-back {
  position: fixed; top: 18px; left: 18px;
  padding: 10px 18px; cursor: pointer;
  font-size: 13px; color: var(--text);
  border: 1px solid var(--panel-border);
}

/* ---------- Touch-Steuerung ---------- */
#touch-ui { display: none; }
body.touch #touch-ui { display: block; }
#joystick {
  position: fixed; bottom: 92px; left: 26px; z-index: 20;
  width: 128px; height: 128px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 14, 22, 0.4);
  backdrop-filter: blur(6px);
}
#joystick .stick {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255, 75, 75, 0.85);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}
.touch-btn {
  position: fixed; z-index: 20;
  width: 74px; height: 74px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 14, 22, 0.5);
  color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
  display: grid; place-items: center;
  user-select: none; -webkit-user-select: none;
}
#btn-drift { right: 26px; bottom: 100px; }
#btn-action { right: 116px; bottom: 170px; background: rgba(217, 35, 50, 0.75); display: none; }
#btn-action.show { display: grid; }
.touch-btn:active { background: rgba(255, 255, 255, 0.18); }

body.touch .hud-speed { left: 50%; transform: translateX(-50%); bottom: 12px; padding: 8px 14px 6px; min-width: 110px; }
body.touch .hud-speed .num { font-size: 24px; }
body.touch #minimap-wrap { display: none; }
body.touch #prompt { bottom: auto; top: 120px; }

/* ---------- Finale ---------- */
#finale .m-icon { font-size: 30px; }

/* ---------- Vignette über allem ---------- */
#vignette {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 4, 8, 0.55) 100%);
}

@media (max-width: 640px) {
  .hud-brand span { display: none; }
  .hud-progress { top: auto; bottom: 210px; right: 12px; flex-direction: column; align-items: flex-end; }
  #modal { padding: 24px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.15s !important; }
}
