* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1117; color: #f2f2f2;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none;
  touch-action: none; -webkit-user-select: none; user-select: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* Start-/Pause-Overlay */
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(20,24,32,.72), rgba(8,10,14,.92)); z-index: 20; padding: 16px; }
.card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: rgba(22,26,34,.92);
  border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 22px 22px 18px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.logo { font-size: 44px; line-height: 1; }
h1 { margin: 8px 0 2px; font-size: 26px; letter-spacing: .3px; }
.sub { margin: 0 0 16px; color: #ffb4ab; font-size: 14px; }
#loading { margin: 10px 0 16px; }
.bar { height: 8px; background: rgba(255,255,255,.1); border-radius: 8px; overflow: hidden; }
#barFill { height: 100%; width: 0; background: linear-gradient(90deg, #d32f2f, #ff8a65); transition: width .2s; }
#loadText { font-size: 13px; color: #b9c0cc; margin-top: 8px; }
#btnStart { font-size: 20px; font-weight: 700; padding: 14px 34px; border: 0; border-radius: 14px; cursor: pointer;
  color: #fff; background: linear-gradient(180deg, #e53935, #b71c1c); box-shadow: 0 6px 18px rgba(183,28,28,.45);
  margin: 4px 0 14px; }
#btnStart:active { transform: translateY(1px); }
.help { font-size: 13.5px; line-height: 1.55; color: #cfd6e2; text-align: left; background: rgba(255,255,255,.04);
  border-radius: 12px; padding: 10px 12px; }
.help .mob { display: none; }
body.touch .help .mob { display: block; }
body.touch .help .desk { display: none; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; background: #2d3340;
  border: 1px solid #454d5c; font-size: 12px; text-align: center; }
.opts { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-top: 12px; font-size: 13px; color: #b9c0cc; }
.opts input[type=range] { vertical-align: middle; width: 110px; }
.link { background: none; border: 0; color: #ff8a65; margin-top: 10px; font-size: 14px; cursor: pointer; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
#room { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 20px; font-size: 14px; font-weight: 600;
  letter-spacing: .2px; white-space: nowrap; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
#prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: rgba(0,0,0,.6);
  padding: 8px 14px; border-radius: 10px; font-size: 15px; }
body.touch #prompt { display: none; }
.hudbtn { pointer-events: auto; position: absolute; top: calc(8px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right));
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 22px; }

/* Touch */
#touch { position: fixed; inset: 0; z-index: 6; }
#stickZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 70%; }
#lookZone { position: absolute; right: 0; top: 0; width: 55%; height: 100%; }
#stickBase { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%;
  background: rgba(255,255,255,.10); border: 2px solid rgba(255,255,255,.25); left: 110px; bottom: 40px; top: auto;
  opacity: .55; transition: opacity .15s; }
#stickBase.active { opacity: 1; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: rgba(255,255,255,.55); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.tbtn { position: absolute; border: 0; color: #fff; font-weight: 700; border-radius: 50%; z-index: 7;
  background: rgba(211,47,47,.85); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#btnAction { right: calc(28px + env(safe-area-inset-right)); bottom: calc(40px + env(safe-area-inset-bottom));
  width: 96px; height: 96px; font-size: 16px; }
#btnRun { right: calc(140px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; font-size: 24px; background: rgba(40,44,52,.7); }
#btnRun.on { background: rgba(255,138,101,.9); }

.opts select { font: inherit; color: #f2f2f2; background: #2d3340; border: 1px solid #454d5c; border-radius: 8px;
  padding: 4px 6px; margin-left: 4px; }
#qInfo { margin-top: 8px; font-size: 12px; color: #8f98a8; }
#btnView { right: calc(140px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; font-size: 24px; background: rgba(40,44,52,.7); }
#btnNight { right: calc(62px + env(safe-area-inset-right)); font-size: 20px; }
#btnBlau { right: calc(206px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; font-size: 24px; background: rgba(40,44,52,.7); }
#btnBlau.on { background: rgba(40,90,255,.9); }

.credits { font-size: 11px; opacity: 0.7; margin: 6px 0 2px; }
.credits a { color: inherit; }

/* ---------------- Gerätesuche */
#btnUebungen { display: block; margin: 10px auto 0; font-size: 16px; font-weight: 700; padding: 10px 22px; border: 0;
  border-radius: 12px; cursor: pointer; color: #1b1b1b; background: #ffd94a; }
#btnUebungen.hidden { display: none; }
#uebAktiv { margin-top: 10px; font-size: 14px; color: #ffd94a; }
#uebHud { position: absolute; top: calc(48px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left));
  background: rgba(10, 14, 22, .72); color: #f2f2f2; border-radius: 12px; padding: 10px 14px; min-width: 200px;
  font-size: 14px; pointer-events: none; }
#uebTitel { font-weight: 700; color: #ffd94a; }
#uebZeit { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
#uebListe { list-style: none; margin: 0; padding: 0; line-height: 1.6; }
#uebListe li.ok { color: #7dff9b; }
#uebListe li span { color: #b9c0cc; font-size: 12px; margin-left: 4px; }
#countdown { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 110px; font-weight: 900;
  color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.7); pointer-events: none; }
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 16, .78); padding: 16px; overflow-y: auto; }
.modal.hidden { display: none; }
.modal .card { max-height: calc(100vh - 32px); overflow-y: auto; }
.modal .card.wide { max-width: 720px; width: 100%; }
.modal h2 { margin: 0 0 6px; }
#uebAuswahl { display: grid; gap: 10px; margin: 12px 0; text-align: left; }
.uebKarte { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; }
.uebKopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 17px; }
.uebKopf button { font-weight: 700; padding: 6px 18px; border: 0; border-radius: 10px; cursor: pointer; background: #c8202a; color: #fff; }
.uebStich { font-size: 13px; color: #ffd94a; margin-top: 2px; }
.uebItems { font-size: 13px; color: #cfd6e2; margin-top: 4px; }
.uebRek { font-size: 13px; color: #b9c0cc; margin-top: 6px; }
.uebTop, #ergListe { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 14px; }
.uebTop li, #ergListe li { display: flex; gap: 6px; padding: 2px 0; }
.uebTop li span, #ergListe li span { margin-left: auto; font-variant-numeric: tabular-nums; }
.uebTop li.ich, #ergListe li.ich { color: #7dff9b; }
li.leer { color: #8a93a3; }
#ergZeit { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 4px 0; }
#ergInfo { color: #ffd94a; font-size: 14px; min-height: 18px; }
#ergForm { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
#ergForm.hidden { display: none; }
#ergForm input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid #454d5c; background: #2d3340; color: #fff; }
#ergForm button, .ergBtns button { font: inherit; font-weight: 700; padding: 8px 14px; border: 0; border-radius: 10px;
  cursor: pointer; background: #ffd94a; color: #1b1b1b; }
.ergBtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.ergBtns button { background: #2d3340; color: #f2f2f2; }
