/* Kart Krawall – Oberfläche (Menü, Lobby, Ergebnis, Touch-Knöpfe) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b2a4a; font-family: "Trebuchet MS", system-ui, sans-serif; color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
#welt3d { position: fixed; inset: 0; width: 100%; height: 100%; display: none; }
#boden3d { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.qual { font-weight: normal; font-size: 13px; margin-top: 8px; }
.qual select { font: inherit; background: #0e1430; color: #fff; border: 2px solid #3fb6a8; border-radius: 8px; padding: 3px 6px; }
#spiel { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 94vw); max-height: 94vh; overflow-y: auto;
  background: rgba(20, 24, 54, .92); border: 3px solid #ffd166; border-radius: 18px; padding: 16px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.5); text-align: center; z-index: 5; }
.versteckt { display: none !important; }
h1 { margin: 0; font-size: 44px; letter-spacing: 1px; color: #ffd166; text-shadow: 3px 3px 0 #c2452a; font-style: italic; }
h1 span { color: #3fb6a8; text-shadow: 3px 3px 0 #1a1024; }
h2 { margin: 4px 0 8px; color: #ffd166; }
.unter { margin: 2px 0 10px; opacity: .85; font-size: 14px; }
label { display: block; margin: 6px 0; font-weight: bold; }
input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 2px solid #3fb6a8; background: #0e1430; color: #fff; width: 200px; text-align: center; }
#code { width: 100px; text-transform: uppercase; letter-spacing: 3px; }
.titel { font-weight: bold; margin: 10px 0 4px; }
/* Fahrerauswahl */
.panel.breit { width: min(760px, 96vw); }
.wahlFlex { display: flex; gap: 12px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.raster { display: grid; grid-template-columns: repeat(4, 76px); gap: 6px; justify-content: center; }
.raster button { background: #0e1430; border: 3px solid #445; border-radius: 12px; padding: 2px; color: #fff; font-size: 11px; margin: 0; cursor: pointer; }
.raster button.aktiv { border-color: #ffd166; background: #2a3570; }
.raster button.belegt { opacity: .35; }
.raster canvas { width: 64px; height: 56px; display: block; margin: 0 auto; }
.raster.klein { grid-template-columns: repeat(8, 62px); }
.raster.klein canvas { width: 52px; height: 44px; }
.detail { width: 260px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 6px; }
#wahlBild { width: 240px; height: 165px; }
.wname { font-size: 22px; font-weight: bold; color: #ffd166; }
.wfz { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.wert { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 3px 0; text-align: left; }
.wert span { width: 92px; }
.wert i { flex: 1; height: 9px; background: #0e1430; border-radius: 5px; overflow: hidden; }
.wert i b { display: block; height: 100%; background: linear-gradient(90deg, #3fb6a8, #ffd166); border-radius: 5px; }
#lWerte .wert { max-width: 320px; margin: 3px auto; }
.alt-fahrerWahl { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
#fahrerWahl button { background: #0e1430; border: 3px solid #445; border-radius: 12px; padding: 4px; width: 92px; color: #fff; font-size: 12px; cursor: pointer; }
#fahrerWahl button.aktiv { border-color: #ffd166; background: #2a3570; }
#fahrerWahl canvas { width: 80px; height: 64px; display: block; margin: 0 auto; }
button { font: inherit; font-weight: bold; padding: 9px 16px; border-radius: 12px; border: none; background: #3fb6a8; color: #10142a; cursor: pointer; margin: 4px; }
button.gross { background: #ffd166; font-size: 18px; padding: 11px 20px; }
button.klein { background: #555b80; color: #fff; font-size: 13px; }
button:disabled { opacity: .45; }
.knoepfe { margin-top: 12px; }
.beitreten { margin-top: 4px; }
#fehler, #lInfo, #eInfo { color: #ffb0b0; min-height: 1.2em; margin: 6px 0; }
details { text-align: left; font-size: 13px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 6px 10px; margin-top: 8px; }
summary { cursor: pointer; font-weight: bold; }
.credit { font-size: 12px; opacity: .8; margin-top: 10px; }
.credit a { color: #8ef0d0; }
#lListe, #eListe { text-align: left; list-style-position: inside; padding: 0; margin: 6px auto; max-width: 360px; }
#lListe li, #eListe li { background: rgba(255,255,255,.08); border-radius: 8px; padding: 6px 10px; margin: 4px 0; }
#eListe li.ich { background: rgba(255, 209, 102, .3); }
/* Touch-Knöpfe fürs Handy */
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 4; }
#touch button { position: relative; width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.45); color: #fff; font-size: 20px; margin: 0; }
#touch button.an { background: rgba(255, 209, 102, .55); }
#touch .links { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: 16px; display: flex; gap: 14px; }
#touch .rechts { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: 16px; display: flex; gap: 10px; align-items: flex-end; }
#touch .gas { width: 86px; height: 86px; background: rgba(63, 182, 168, .4); }
#touch .drift { background: rgba(232, 85, 155, .35); }
#touch .item { font-size: 15px; }
#btnTon { position: fixed; top: 8px; right: 8px; z-index: 6; background: rgba(0,0,0,.35); color: #fff; padding: 6px 10px; font-size: 18px; }
@media (max-width: 700px) { .raster.klein { grid-template-columns: repeat(4, 62px); } }
@media (max-height: 460px) { .wahlFlex { flex-wrap: nowrap; } .detail { width: 220px; } #wahlBild { width: 200px; height: 110px; } .raster { grid-template-columns: repeat(4, 64px); } .raster canvas { width: 54px; height: 42px; } .wname { font-size: 18px; } h1 { font-size: 30px; } .panel { padding: 10px 14px; } #fahrerWahl canvas { height: 48px; width: 60px; } #fahrerWahl button { width: 72px; } }

/* Strecken- und Rundenwahl */
.einst { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0 2px; }
.einst label { display: flex; flex-direction: column; font-size: 13px; text-align: left; }
.einst select { font: inherit; font-weight: 700; padding: 6px 8px; border-radius: 10px; border: 2px solid #ffb02a; background: #fff8e8; color: #1a1024; min-width: 90px; }
.einst select:disabled { opacity: .75; border-color: #bbb; }
.ort { margin: 2px 0 8px; font-size: 13px; opacity: .85; }

/* Touch-Tasten (Querformat): Item | Drift | Gas in einer Reihe mit Abstand, Item etwas kleiner, unten in der Reihe,
   damit es weder Pfeile noch Platzanzeige überdeckt */
#touch .rechts { gap: 16px; }
#touch .item { width: 66px; height: 66px; margin-bottom: 0; }
/* Dreh-Hinweis im Hochformat (nur Touch-Geräte) */
#dreh { display: none; position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 40%, #3a2a6a, #120a24); color: #fff; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 30px; }
#dreh b { font-size: 26px; color: #ffd166; text-shadow: 0 3px 0 #b8432e; }
#dreh span { font-size: 16px; opacity: .9; line-height: 1.4; }
#dreh .handy { font-size: 80px; animation: drehen 2.2s ease-in-out infinite; }
@keyframes drehen { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) { html.touchgeraet #dreh { display: flex; } }

/* iPhone: Hinweis, wie man Vollbild bekommt */
#iosHinweis { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 60; background: rgba(18,10,36,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font: 600 14px system-ui, sans-serif; max-width: 90vw; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
/* Mauszeiger im Rennen ausblenden (Klasse setzt game.js) */
html.mausweg, html.mausweg * { cursor: none !important; }
/* Musik-Lautstärke im Menü */
.musikRegler { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 6px 0; }
.musikRegler input { width: 160px; accent-color: #ff9a2a; }

/* Niedrige Bildschirme (Handy quer): Panels passen in die sichtbare Höhe (dvh, safe-area),
   Inhalte schrumpfen mit der Höhe, Haupt-Knöpfe kleben unten und sind immer ganz sichtbar */
.panel { max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
@media (max-height: 500px) {
  .panel { padding: 6px 12px; border-radius: 14px; }
  .panel h2 { margin: 0 0 4px; font-size: 18px; }
  h1 { font-size: clamp(22px, 7vh, 34px); }
  .unter, .ort { margin: 0 0 4px; font-size: 12px; }
  .knoepfe { margin-top: 4px; }
  button { padding: 6px 12px; margin: 2px; }
  button.gross { font-size: 16px; padding: 7px 16px; }
  .raster { grid-template-columns: repeat(4, calc(13vh + 8px)); gap: 4px; }
  .raster canvas { width: 13vh; height: 10vh; }
  .raster button { font-size: 10px; border-width: 2px; }
  .detail { width: 34vh; min-width: 170px; padding: 4px; }
  #wahlBild { width: 100%; height: 22vh; }
  .wname { font-size: 16px; } .wfz { font-size: 11px; margin: 0; } .wert { margin: 1px 0; font-size: 11px; }
  #btnWahlLos, #btnWahlZurueck, #btnStart, #btnRaus { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -4px 10px rgba(20,24,54,.9); }
  details { display: none; } /* Steuerungshilfe auf kleinen Bildschirmen weglassen (Platz) */
  .qual { margin-top: 2px; }
  .beitreten { display: inline-block; }
  .knoepfe { display: inline-block; }
}

/* Pause-Knopf oben mittig rechts neben dem Item-Kasten (nicht über Steuerung, Minimap oder Ton-Knopf) */
#btnPause { position: fixed; top: max(8px, env(safe-area-inset-top)); left: calc(50% + 52px); z-index: 6; width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 20px; background: rgba(0,0,0,.4); color: #fff; border: 2px solid rgba(255,255,255,.5); }
#pause { z-index: 8; }
#pause .knoepfe { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#pause .knoepfe button { min-width: 200px; }
button.beenden { background: #a8344a; color: #fff; }
@media (max-height: 420px) {
  #menue .unter, #streckeOrt { display: none; }
  #menue > label:not(.qual), #menue .einst, #menue .musikRegler { display: inline-flex; vertical-align: middle; margin: 2px 6px; }
  #menue .einst label { flex-direction: row; align-items: center; gap: 4px; }
  #menue .qual, .credit { display: inline-block; margin: 2px 6px; font-size: 11px; }
  #menue .musikRegler input { width: 90px; }
}
