/* Brawl Rally: Menüs im Stil der späten 90er, nur Systemschriften */
:root {
  --panel: rgba(18, 16, 28, 0.88);
  --panel-solid: #16141f;
  --frame-hi: #b9bcc4;
  --frame-lo: #4a4d56;
  --btn-top: #8d9099;
  --btn-bot: #5b5e67;
  --btn-hover-top: #a9acb5;
  --btn-hover-bot: #6d7079;
  --value: #0c0c10;
  --text: #f1efe8;
  --muted: #a5a3ad;
  --yellow: #ffd21f;
  --green: #3be05a;
  --red: #e8322a;
  --orange: #f29a1d;
  --font-display: "Arial Black", "Arial Bold", Impact, sans-serif; /* Zeitgemäß zum Original von 1999 */
  --font-ui: Tahoma, Verdana, "Segoe UI", sans-serif;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #111;
  color: var(--text);
  font-family: var(--font-ui);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  font-size: 15px;
}
#ui > * { pointer-events: auto; }
#ui.dim { background: rgba(8, 8, 14, 0.35); pointer-events: auto; }

/* ---------- Bausteine ---------- */
.panel {
  background: var(--panel);
  border: 3px solid;
  border-color: var(--frame-hi) var(--frame-lo) var(--frame-lo) var(--frame-hi);
  box-shadow: 0 0 0 1px #000, 6px 8px 0 rgba(0, 0, 0, 0.45);
  padding: 18px;
}

.btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 8px 14px;
  font: bold 15px var(--font-ui);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #222;
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  border: 2px solid;
  border-color: #d6d8de #2c2e34 #2c2e34 #d6d8de;
  cursor: pointer;
  text-align: center;
}
.btn:hover, .btn:focus-visible { background: linear-gradient(var(--btn-hover-top), var(--btn-hover-bot)); outline: none; }
.btn:focus-visible { box-shadow: 0 0 0 2px var(--yellow); }
.btn:active { border-color: #2c2e34 #d6d8de #d6d8de #2c2e34; }
.btn[disabled] { color: #8a8a90; text-shadow: none; cursor: default; background: linear-gradient(#6a6c73, #4c4e55); }
.btn.primary { background: linear-gradient(#d8a61a, #9a6c0a); }
.btn.primary:hover, .btn.primary:focus-visible { background: linear-gradient(#ecbd2c, #b07e10); }
.btn.small { display: inline-block; width: auto; margin: 0; padding: 4px 10px; font-size: 13px; }
.btn.inline { display: inline-block; width: auto; margin: 0 8px 0 0; }

.label {
  display: inline-block;
  padding: 4px 10px;
  font-weight: bold;
  font-size: 13px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  border: 2px solid;
  border-color: #d6d8de #2c2e34 #2c2e34 #d6d8de;
}
.value {
  display: inline-block;
  padding: 4px 10px;
  background: var(--value);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 #000, inset -1px -1px 0 #333;
  font-weight: bold;
}

.logo {
  font: italic 900 clamp(38px, 7vw, 86px) / 0.95 var(--font-display);
  color: var(--yellow);
  letter-spacing: 1px;
  transform: rotate(-8deg) skewX(-6deg);
  text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 6px 8px 0 rgba(0, 0, 0, 0.45);
  user-select: none;
}

h1, h2, h3 { margin: 0 0 12px; font-family: var(--font-display); font-style: italic; color: var(--yellow); text-shadow: 2px 2px 0 #000; letter-spacing: 0.5px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; color: var(--text); }
p { margin: 0 0 10px; line-height: 1.45; }
.muted { color: var(--muted); }
.money { color: var(--yellow); font-weight: bold; }
.good { color: var(--green); }
.bad { color: var(--red); }

/* ---------- Layouts ---------- */
.screen { position: absolute; inset: 0; display: flex; padding: 24px; box-sizing: border-box; overflow: auto; }
.screen.center { align-items: center; justify-content: center; }

.title-screen { align-items: stretch; }
.title-menu { width: 240px; align-self: center; display: flex; flex-direction: column; }
.title-menu .btn:last-child { margin-top: 24px; margin-bottom: 0; }
.title-logo { position: absolute; right: 6vw; top: 8vh; text-align: right; }
.title-foot { position: absolute; right: 24px; bottom: 16px; font-size: 12px; color: rgba(255, 255, 255, 0.7); text-shadow: 1px 1px 0 #000; }
.title-foot a { color: inherit; }

.wide { width: min(980px, 100%); margin: auto; }
.narrow { width: min(460px, 100%); margin: auto; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .grow { flex: 1 1 300px; min-width: 0; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.actions .btn { width: auto; margin: 0; min-width: 150px; }

/* Formulare */
.field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.field > .label { width: 130px; flex: none; text-align: left; }
.field input[type=text], .field select {
  flex: 1;
  min-width: 0;
  font: bold 14px var(--font-ui);
  color: var(--text);
  background: var(--value);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 #000, inset -1px -1px 0 #333;
  padding: 6px 8px;
}
.field input[type=text]:focus, .field select:focus { outline: 2px solid var(--yellow); }
.field input[type=range] { flex: 1; accent-color: var(--yellow); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border: 2px solid #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); cursor: pointer; padding: 0; }
.swatch.on { outline: 3px solid var(--yellow); outline-offset: 1px; }
.choice { display: flex; gap: 6px; flex-wrap: wrap; }
.choice .btn { width: auto; margin: 0; padding: 5px 12px; font-size: 13px; }
.choice .btn.on { background: linear-gradient(#d8a61a, #9a6c0a); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .value { min-width: 34px; text-align: center; }

/* Tabellen */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 4px 8px; border-bottom: 2px solid var(--frame-lo); }
.tbl td { padding: 5px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.tbl tr.me td { color: var(--yellow); font-weight: bold; }
.tbl tr.cut td { border-bottom: 2px dashed var(--green); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 11px; height: 11px; border: 1px solid #000; margin-right: 7px; vertical-align: -1px; }

/* Liga */
.track-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.track-card > div { min-width: 0; flex: 1 1 140px; }
.thumb-slot { margin: 0 0 12px 142px; }
.thumb-slot canvas, .track-card canvas { max-width: 100%; height: auto; }
@media (max-width: 900px) { .thumb-slot { margin-left: 0; } }
.track-card canvas { background: #0c0c10; border: 1px solid #000; flex: none; }
.league-steps { display: flex; gap: 6px; margin: 4px 0 14px; }
.league-steps span { flex: 1; text-align: center; font-size: 12px; padding: 4px 2px; background: #22212c; border: 1px solid #000; color: var(--muted); }
.league-steps span.done { background: #2b4a2f; color: #cfe8d2; }
.league-steps span.now { background: #7a5c0c; color: #fff; font-weight: bold; }

/* Garage */
.garage { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
@media (max-width: 760px) { .garage { grid-template-columns: 1fr; } }
.preview { max-width: 360px; margin: 0 auto; background: radial-gradient(ellipse at 50% 60%, #3a3d47, #101014 75%); border: 2px solid #000; box-shadow: inset 0 0 0 1px #555; display: block; width: 100%; height: auto; }
.stat { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.stat > .val { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat > .val b { color: #ffd23a; font-weight: bold; }
.stat > .wide { grid-column: 2 / span 2; }
.car-stats { margin: -2px 0 10px; }
.bar { height: 13px; background: var(--value); border: 1px solid #000; box-shadow: inset 1px 1px 0 #000; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#ff5a3a, #c41e0e); }
.bar > i.gain { background: linear-gradient(#ffd23a, #c48a0e); }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.tabs .btn { width: auto; margin: 0; flex: 1; }
.tabs .btn.on { background: linear-gradient(#d8a61a, #9a6c0a); }
.shop { max-height: 52vh; overflow: auto; padding-right: 4px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 10px; margin-bottom: 6px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(0, 0, 0, 0.6); cursor: pointer; }
.item:hover, .item.sel { background: rgba(255, 210, 31, 0.1); border-color: rgba(255, 210, 31, 0.5); }
.item .name { font-weight: bold; }
.item .desc { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.item .tag { font-size: 12px; font-weight: bold; }
.pips { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.pips i { width: 12px; height: 8px; background: #26252e; border: 1px solid #000; }
.pips i.on { background: var(--orange); }
.slot-head { margin: 12px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.statusline { margin-top: 12px; padding: 6px 10px; background: var(--value); border: 1px solid #000; text-align: center; font-weight: bold; min-height: 1.4em; }

/* Ergebnis */
.bill { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; max-width: 360px; margin-left: auto; }
.bill .sum { border-top: 2px solid var(--frame-lo); padding-top: 4px; font-weight: bold; }
.big-msg { font: italic 900 34px var(--font-display); text-align: center; margin: 6px 0 14px; text-shadow: 2px 2px 0 #000; }

/* Steuerung */
.btn.key { min-width: 120px; font-family: var(--font-ui); }
.btn.key.empty { color: var(--muted); }
.btn.key.listen { background: linear-gradient(#d8a61a, #9a6c0a); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { color: #3a2a00; text-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .btn.key.listen { animation: none; } }
.keys td:first-child { color: var(--muted); }
kbd { display: inline-block; min-width: 18px; padding: 1px 6px; margin: 1px 2px; font: bold 12px var(--font-ui); text-align: center; color: #111; background: linear-gradient(#f0f0f0, #c8c8c8); border: 1px solid #555; border-bottom-width: 3px; border-radius: 3px; }

@media (max-width: 600px) {
  .screen { padding: 12px; }
  .title-logo { position: static; text-align: center; margin: 24px 0 36px; }
  .title-foot { position: static; text-align: center; padding-bottom: 8px; }
  .title-screen { flex-direction: column; }
  .field { flex-wrap: wrap; }
  .field > .label { width: 100%; }
}

/* ---------- Ladeanzeige vor dem Rennen ---------- */
.loading { width: min(420px, 100%); margin: auto; text-align: center; }
.loading h2 { font-size: 28px; margin-bottom: 4px; }
.loading .sub { margin: 0 0 16px; font-size: 13px; }
/* Eingelassenes Feld wie die Wertefelder, Füllung in Blöcken */
.load-bar { height: 22px; padding: 3px; background: var(--value); border: 2px solid; border-color: var(--frame-lo) var(--frame-hi) var(--frame-hi) var(--frame-lo); }
.load-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); transition: width 0.12s linear;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 12px, transparent 12px 15px); }
.loading .load-step { margin: 10px 0 0; font-size: 13px; min-height: 1.3em; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .load-bar i { transition: none; } }

/* ---------- Online: Warteraum ---------- */
.room-code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Code groß und gesperrt, damit man ihn am Telefon vorlesen kann */
.room-code { font: italic 900 34px var(--font-display); letter-spacing: 6px; color: var(--yellow); text-shadow: 2px 2px 0 #000; font-variant-numeric: tabular-nums; }
.room-link { font-size: 12px; margin: -6px 0 12px; word-break: break-all; }
.crown { margin-left: 6px; color: var(--yellow); text-shadow: 1px 1px 0 #000; }
.actions .btn.on { background: linear-gradient(#3aa64e, #1d6b2c); }
/* Drei Spalten im Warteraum: kürzere Beschriftung, damit „Maschinengewehr“ ganz in die Auswahl passt */
.lobby-car .field > .label { width: 84px; }
