/* Gorinno v2 – Gestaltung */
:root {
  --bg: #0b0e20;
  --bg2: #12173a;
  --panel: rgba(17, 21, 46, 0.94);
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.13);
  --text: #eef1f8;
  --muted: #aab2c8;
  --accent: #ffd23f;
  --accent2: #ffb02e;
  --ink: #1b1505;
  --p0: #ffb02e;
  --p1: #3dd6d0;
  --danger: #ff6b6b;
  --focus: 0 0 0 3px rgba(255, 210, 63, 0.75);
  --r: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  min-height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #1a2150 0%, var(--bg) 60%) fixed;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 1px;
  font: 600 12px/1.5 var(--font); text-align: center; color: #fff;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22); border-bottom-width: 2px; border-radius: 6px;
}

/* ------------------------------------------------------------ Grundgerüst */
.app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; min-height: 360px;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  touch-action: manipulation;
}
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 8px 12px;
}
.tb-left { flex: 1 1 auto; min-width: 0; display: flex; }
.brand {
  flex: none; display: flex; align-items: center; gap: 6px;
  font-weight: 900; font-size: 19px; letter-spacing: 0.02em; color: #fff;
}
.brand sup { font-size: 10px; font-weight: 800; color: var(--ink); background: var(--accent); border-radius: 6px; padding: 1px 5px; margin-left: 2px; vertical-align: 6px; }
.b-ban, .logo-ban, .tb-ban {
  display: inline-block; width: 22px; height: 14px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 20'%3E%3Cpath d='M2 4c6 14 22 14 28 0-8 7-20 7-28 0z' fill='%23ffd23f' stroke='%23a8740f' stroke-width='1.4'/%3E%3Ccircle cx='2.4' cy='4' r='1.8' fill='%236b4a12'/%3E%3Ccircle cx='29.6' cy='4' r='1.6' fill='%236b4a12'/%3E%3C/svg%3E");
}
.tb-actions { flex: none; display: flex; gap: 6px; }
.ib {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  color: var(--text); background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line); border-radius: 12px;
  transition: background 0.15s, transform 0.1s;
}
.ib:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.ib:active:not(:disabled) { transform: scale(0.94); }
.ib:disabled { opacity: 0.35; }
.ib svg { width: 21px; height: 21px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.ib svg [stroke-width] { fill: none; }
.ib .mute { display: none; }
.ib.off { color: var(--muted); }
.ib.off .mute { display: inline; stroke: #ff8c8c; }
.ib.off .wave { display: none; }
.ib.on { background: var(--accent); color: var(--ink); }

.play {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 12px 12px;
}
.stage {
  position: relative; flex: 1 1 auto; min-height: 0; touch-action: none;
  border-radius: var(--r); overflow: hidden;
  background: #14193a;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
body.in-menu #cv { cursor: default; }

/* ------------------------------------------------------------ HUD */
.hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 10px; pointer-events: none;
}
.hud[hidden] { display: none; }
.pcard {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px;
  min-width: 0; max-width: 34%;
  padding: 7px 12px 7px 10px; border-radius: 14px;
  background: rgba(10, 13, 32, 0.66); border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.pcard.p1 { grid-template-columns: auto 1fr auto; }
.pdot { width: 12px; height: 12px; border-radius: 50%; background: var(--p0); box-shadow: 0 0 10px var(--p0); }
.p1 .pdot { background: var(--p1); box-shadow: 0 0 10px var(--p1); }
.pname { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pscore { font-weight: 900; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.ppips { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 4px; }
.ppips:empty { display: none; }
.ppips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.p0 .ppips i.on { background: var(--p0); }
.p1 .ppips i.on { background: var(--p1); }
.pcard.active { border-color: var(--p0); box-shadow: 0 0 0 2px rgba(255, 176, 46, 0.35), 0 4px 18px rgba(255, 176, 46, 0.3); }
.pcard.p1.active { border-color: var(--p1); box-shadow: 0 0 0 2px rgba(61, 214, 208, 0.35), 0 4px 18px rgba(61, 214, 208, 0.3); }
.pcard.bump { animation: bump 0.6s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }
.hud.practice .pcard.p1 .pscore { display: none; }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.hround { font-size: 12px; font-weight: 700; color: #dfe4f3; padding: 3px 10px; border-radius: 99px; background: rgba(10, 13, 32, 0.6); }
.hwind {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px;
  background: rgba(10, 13, 32, 0.66); border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
}
.wlabel { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.warrow { position: relative; display: block; width: 46px; height: 12px; }
.warrow i {
  position: absolute; top: 4px; left: 50%; height: 4px; width: calc(40px * var(--w, 0.5));
  transform: translateX(-50%); border-radius: 2px; background: #9fe7ff;
}
.warrow i::after {
  content: ""; position: absolute; right: -6px; top: -4px;
  border-left: 8px solid #9fe7ff; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.warrow.left i::after { right: auto; left: -6px; border-left: 0; border-right: 8px solid #9fe7ff; }
.warrow.calm i { width: 8px; height: 8px; top: 2px; border-radius: 50%; background: #c8d0e6; }
.warrow.calm i::after { display: none; }
.wval { min-width: 22px; text-align: right; }

/* Banner & Toast */
.banner {
  position: absolute; left: 50%; top: 38%; z-index: 8;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transform: translate(-50%, -50%) scale(0.8); opacity: 0;
  pointer-events: none; text-align: center; white-space: nowrap;
}
.banner b {
  font-size: clamp(30px, 6vw, 64px); font-weight: 900; letter-spacing: 0.01em; color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 30px rgba(0, 0, 0, 0.5);
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.15);
}
.banner span { font-size: clamp(13px, 2vw, 18px); font-weight: 700; color: #f4f6ff; padding: 4px 12px; border-radius: 99px; background: rgba(10, 13, 32, 0.62); max-width: 90vw; white-space: normal; }
.banner.hit b { color: var(--accent); }
.banner.turn.p0 b { color: var(--p0); }
.banner.turn.p1 b { color: var(--p1); }
.banner.turn b { font-size: clamp(22px, 4vw, 40px); }
.banner.show { animation: bannerIn 0.35s cubic-bezier(.2, .9, .3, 1.3) forwards; }
@keyframes bannerIn { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.toast {
  position: absolute; left: 50%; top: 92px; z-index: 9;
  max-width: calc(100% - 24px); padding: 9px 16px; border-radius: 99px;
  font-size: 14px; font-weight: 600; text-align: center;
  color: #fff; background: rgba(10, 13, 32, 0.85); border: 1px solid var(--line);
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* ------------------------------------------------------------ Steuerleiste */
.controls {
  flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px 16px;
  padding: 10px 12px 10px 16px; border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  --pc: var(--p0);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.controls input[type=number] { -webkit-user-select: text; user-select: text; }
.controls[hidden] { display: none; }
.ctl {
  display: grid; grid-template-columns: 58px 36px minmax(60px, 1fr) 36px 70px; align-items: center; gap: 6px;
  grid-template-areas: "lab dec rng inc num";
}
.ctl .cl { grid-area: lab; font-weight: 800; font-size: 14px; color: #dfe4f3; }
.ctl .step:first-of-type { grid-area: dec; }
.ctl input[type=range] { grid-area: rng; }
.ctl .step:last-of-type { grid-area: inc; }
.ctl .num { grid-area: num; position: relative; }
.step {
  width: 36px; height: 36px; padding: 0; border-radius: 10px; font-size: 22px; font-weight: 700; line-height: 1;
  color: #fff; background: rgba(255, 255, 255, 0.09); border: 1px solid var(--line);
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.step:hover:not(:disabled) { background: rgba(255, 255, 255, 0.17); }
.step:active:not(:disabled) { transform: scale(0.93); }
.step:disabled { opacity: 0.35; }
.step.sm { width: 34px; height: 34px; font-size: 20px; }
.num input {
  width: 100%; height: 36px; padding: 0 22px 0 10px; border-radius: 10px;
  font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; text-align: right;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); color: #fff;
  -moz-appearance: textfield; appearance: textfield;
}
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num i { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-weight: 700; pointer-events: none; }
.num input:disabled { opacity: 0.5; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; touch-action: none;
}
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.16); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.16); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px; border-radius: 50%;
  background: var(--pc, var(--accent)); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--pc, var(--accent)); border: 3px solid #fff; }
input[type=range]:disabled { opacity: 0.45; }
input[type=range]:focus-visible { box-shadow: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus); }
.throw {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 150px; height: 52px; padding: 0 22px; border: 0; border-radius: 14px;
  font-size: 19px; font-weight: 900; letter-spacing: 0.02em; color: var(--ink);
  background: linear-gradient(180deg, #ffe066, var(--accent) 55%, #f0b400);
  box-shadow: 0 4px 0 #b88600, 0 8px 20px rgba(255, 196, 0, 0.25);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.throw:hover:not(:disabled) { filter: brightness(1.06); }
.throw:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b88600, 0 4px 10px rgba(255, 196, 0, 0.2); }
.throw:disabled { filter: grayscale(0.85) brightness(0.6); box-shadow: none; }
.throw .tb-ban { width: 24px; height: 16px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2)); }
.ctl-status { grid-column: 1 / -1; margin: -2px 0 0; min-height: 1.3em; font-size: 13px; line-height: 1.3; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls.live { border-color: color-mix(in srgb, var(--pc) 55%, transparent); }
.linkbtn { background: none; border: 0; padding: 0 2px; color: var(--accent); font-weight: 700; text-decoration: underline; }

/* ------------------------------------------------------------ Overlays */
.overlay {
  position: absolute; inset: 0 12px 12px; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; border-radius: var(--r);
  background: linear-gradient(180deg, rgba(6, 8, 22, 0.25), rgba(6, 8, 22, 0.6));
}
.overlay[hidden] { display: none; }
.screen { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; min-height: 0; }
.screen[hidden] { display: none; }
.panel {
  width: min(600px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain;
  padding: 22px 22px 18px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: panelIn 0.28s cubic-bezier(.2, .9, .3, 1.15);
}
.panel.narrow { width: min(440px, 100%); }
.panel.center { text-align: center; }
@keyframes panelIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 0 0 14px; font-size: 24px; font-weight: 900; letter-spacing: 0.01em; }
.panel h3 { margin: 14px 0 6px; font-size: 15px; color: var(--accent); }
.panel p { margin: 0 0 12px; line-height: 1.5; color: #d5dbea; }
.note { font-size: 13px; color: var(--muted) !important; }
.note.strong { color: var(--accent) !important; font-weight: 700; font-size: 14px; }
.note:empty { display: none; }
.pill { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 3px 10px; border-radius: 99px; font-size: 14px; color: var(--ink); background: var(--accent); }

/* Menü */
.panel.menu { background: rgba(14, 18, 42, 0.86); width: min(640px, 100%); text-align: center; padding: 24px 22px 18px; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; }
.logo h1 {
  margin: 0; font-size: clamp(40px, 8vw, 66px); font-weight: 900; line-height: 1; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff6c2 0%, var(--accent) 45%, #ff9f1c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(120, 60, 0, 0.55)) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}
.logo-ban { width: 54px; height: 34px; transform: rotate(-18deg); animation: spinBan 6s ease-in-out infinite; }
@keyframes spinBan { 0%, 70%, 100% { transform: rotate(-18deg); } 80% { transform: rotate(200deg); } 90% { transform: rotate(342deg); } }
.v2 { align-self: flex-start; margin-top: 4px; padding: 3px 8px; border-radius: 8px; font-weight: 900; font-size: 14px; color: var(--ink); background: var(--p1); }
.tagline { margin: 8px 0 16px !important; font-size: 15px; color: #dfe4f3 !important; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.mode svg { grid-row: 1 / 3; width: 48px; height: 48px; }
.mode b { font-size: 17px; font-weight: 800; color: #fff; }
.mode span { font-size: 12.5px; color: var(--muted); }
.mode:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.07)); border-color: rgba(255, 210, 63, 0.5); transform: translateY(-2px); }
.mode:active { transform: translateY(0); }
.resume {
  display: block; width: 100%; margin: 0 0 12px; padding: 12px; border-radius: 14px; border: 2px dashed var(--accent);
  background: rgba(255, 210, 63, 0.1); color: var(--accent); font-weight: 800;
}
.sub-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 13px;
  font-weight: 750; font-size: 15px; color: #fff;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.primary { color: var(--ink); background: linear-gradient(180deg, #ffe066, var(--accent)); border-color: transparent; box-shadow: 0 3px 0 #b88600; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe885, #ffd84f); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.btn.big { min-height: 52px; font-size: 17px; width: 100%; }
.btn.danger { color: #ff9a9a; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.actions.col { flex-direction: column; align-items: stretch; }
.actions.row > .btn { flex: 1 1 140px; }

/* Formular */
.field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.field legend, .lg { display: block; margin: 0 0 7px; padding: 0; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.lg output { color: var(--accent); font-size: 16px; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: grid; gap: 6px; }
.chips.c2 { grid-template-columns: repeat(2, 1fr); }
.chips.c3 { grid-template-columns: repeat(3, 1fr); }
.chips.c4 { grid-template-columns: repeat(4, 1fr); }
.chips.c5 { grid-template-columns: repeat(5, 1fr); }
.chips label { position: relative; display: block; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 42px; padding: 6px 4px;
  border-radius: 12px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.15;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); transition: background 0.15s, border-color 0.15s;
}
.chips small { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.chips label:hover span { background: rgba(255, 255, 255, 0.12); }
.chips input:checked + span { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.chips input:checked + span small { color: rgba(27, 21, 5, 0.75); }
.chips input:focus-visible + span { box-shadow: var(--focus); }
.rangebox { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; }
.tf { display: block; margin: 0 0 14px; }
.tf > span { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tf input[type=text] {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; font-size: 16px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); color: #fff;
}
.tf input.code { font-size: 26px; font-weight: 900; letter-spacing: 0.35em; text-transform: uppercase; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tf input:focus-visible { border-color: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.p0 { background: var(--p0); }
.dot.p1 { background: var(--p1); }
details.more { margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; background: rgba(255, 255, 255, 0.03); }
details.more summary { cursor: pointer; padding: 12px 2px; font-weight: 700; font-size: 14px; color: #dfe4f3; }
details.more[open] summary { margin-bottom: 4px; }
.err { color: #ffb3b3 !important; background: rgba(255, 80, 80, 0.12); border: 1px solid rgba(255, 107, 107, 0.4); border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 14px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); }
.tabs button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 750; color: var(--muted); }
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.14); color: #fff; }
.toggles { display: grid; gap: 4px; margin-bottom: 12px; }
.tg { display: flex; align-items: center; gap: 12px; min-height: 42px; cursor: pointer; font-weight: 600; }
.tg input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 46px; height: 26px; margin: 0; border-radius: 99px;
  background: rgba(255, 255, 255, 0.18); transition: background 0.2s; cursor: pointer;
}
.tg input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.tg input:checked { background: var(--accent); }
.tg input:checked::after { transform: translateX(20px); }

/* Lobby */
.bigcode {
  margin: 4px 0 14px !important; font: 900 clamp(34px, 9vw, 52px)/1.1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.18em;
  color: var(--accent) !important; text-shadow: 0 0 24px rgba(255, 210, 63, 0.35);
  -webkit-user-select: all; user-select: all;
}
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; color: #fff !important; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Übung */
.lvlgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; }
.lvl {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 84px; padding: 8px 4px;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); text-align: center;
}
.lvl b { font-size: 20px; font-weight: 900; }
.lvl span { font-size: 11.5px; font-weight: 600; color: #cdd3e4; line-height: 1.2; }
.lvl em { font-style: normal; color: var(--accent); font-size: 14px; letter-spacing: 1px; }
.lvl em s { text-decoration: none; color: rgba(255, 255, 255, 0.2); }
.lvl:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 210, 63, 0.5); }
.lvl.done { border-color: rgba(255, 210, 63, 0.35); }
.lvl:disabled { opacity: 0.45; }
.stars { display: flex; justify-content: center; gap: 10px; margin: 6px 0 10px !important; }
.star { font-size: 54px; line-height: 1; color: rgba(255, 255, 255, 0.15); transform: scale(0.4); opacity: 0; animation: starIn 0.45s cubic-bezier(.2, .9, .3, 1.5) forwards; }
.star.on { color: var(--accent); text-shadow: 0 0 20px rgba(255, 210, 63, 0.6); }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }

/* Ende */
.end h2 { font-size: 30px; }
.endscore { font-size: 46px; font-weight: 900; margin: -4px 0 6px !important; color: #fff !important; font-variant-numeric: tabular-nums; }
.stattab { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: 14px; }
.stattab th, .stattab td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); text-align: center; }
.stattab tbody th { text-align: left; color: var(--muted); font-weight: 600; }
.stattab thead th { font-weight: 800; }
.stattab td { font-weight: 800; font-variant-numeric: tabular-nums; }
.stattab.wide td { text-align: right; }

/* Hilfe */
.help { width: min(760px, 100%); }
.howgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.help ul { margin: 0 0 10px; padding-left: 18px; }
.help li { margin: 0 0 7px; line-height: 1.5; color: #d5dbea; }

/* Footer-Abstand */
.s05-footer { margin-top: 0; }

/* ------------------------------------------------------------ Responsiv */
@media (max-width: 900px) {
  .brand { display: none; }
}
@media (max-width: 760px) {
  .controls { grid-template-columns: 1fr; gap: 6px; padding: 10px 12px; }
  .ctl { grid-template-columns: 52px 40px minmax(40px, 1fr) 40px 66px; }
  .step { width: 40px; height: 40px; }
  .throw { width: 100%; height: 50px; }
  .ctl-status { display: none; }
  .modes { gap: 8px; }
  .mode { grid-template-columns: 38px 1fr; padding: 10px 12px; }
  .mode svg { width: 38px; height: 38px; }
  .mode b { font-size: 15px; }
  .mode span { font-size: 11.5px; }
  .howgrid { grid-template-columns: 1fr; }
  .lvlgrid { grid-template-columns: repeat(3, 1fr); }
  .chips.c5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 6px 8px; min-height: 48px; }
  .tb-actions { gap: 4px; }
  .ib { width: 36px; height: 36px; border-radius: 10px; }
  .ib svg { width: 19px; height: 19px; }
  .hide-xs { display: none; }
  .tb-actions .ib { width: 34px; height: 34px; }
  .play { padding: 0 8px 8px; gap: 6px; }
  .overlay { inset: 0 8px 8px; padding: 8px; }
  .panel { padding: 18px 14px 14px; border-radius: 18px; }
  .panel h2 { font-size: 21px; }
  .hud { padding: 6px; gap: 4px; }
  .pcard { padding: 5px 8px; column-gap: 5px; border-radius: 11px; max-width: 36%; }
  .pname { font-size: 12px; }
  .pscore { font-size: 18px; }
  .pdot { width: 9px; height: 9px; }
  .ppips i { width: 7px; height: 7px; }
  .hwind { padding: 4px 9px; gap: 5px; font-size: 13px; }
  .wlabel { display: none; }
  .warrow { width: 34px; }
  .warrow i { width: calc(30px * var(--w, 0.5)); }
  .hround { font-size: 11px; padding: 2px 8px; }
  .modes { grid-template-columns: 1fr 1fr; }
  .mode { grid-template-columns: 1fr; grid-template-rows: auto auto auto; justify-items: center; text-align: center; row-gap: 2px; }
  .mode svg { grid-row: auto; width: 36px; height: 36px; }
  .chips.c4 { grid-template-columns: repeat(2, 1fr); }
  .field.two { grid-template-columns: 1fr; }
  .lvlgrid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tagline { font-size: 13.5px; margin-bottom: 12px !important; }
}

@media (max-width: 360px) {
  #btnHelp { display: none; }
}
@media (max-width: 340px) {
  #btnSound { display: none; }
}
@media (max-width: 360px) {
  .topbar { padding: 6px 6px; }
  .ctl { grid-template-columns: 44px 36px minmax(30px, 1fr) 36px 58px; gap: 4px; }
  .step { width: 36px; height: 38px; }
}

/* Hochformat: Spielfeld nicht unnötig hoch, Rest für die Steuerung */
@media (max-aspect-ratio: 4/5) and (max-width: 760px) {
  .play { justify-content: center; }
  .stage { flex: 0 1 auto; height: min(calc(100vw * 1.22), 100%); }
  body.in-menu .stage { flex: 1 1 auto; height: auto; }
  .controls { gap: 8px; padding: 12px; }
  .ctl-status { display: block; font-size: 13.5px; height: 2.6em; white-space: normal; color: #d5dbea; }
  .throw { height: 56px; font-size: 20px; }
}

/* Querformat mit wenig Höhe (Handy quer): Steuerung als Spalte rechts */
@media (max-height: 520px) and (min-width: 600px) {
  .topbar { min-height: 44px; padding: 4px 10px; }
  .ib { width: 34px; height: 34px; }
  .brand { display: none; }
  .play { flex-direction: row; padding: 0 10px 8px; gap: 8px; }
  .controls {
    width: 220px; grid-template-columns: 1fr; align-content: center; gap: 8px; padding: 10px;
  }
  .ctl { grid-template-columns: 36px minmax(20px, 1fr) minmax(20px, 1fr) 36px; grid-template-areas: "lab lab num num" "dec rng rng inc"; gap: 4px 6px; }
  .ctl .num input { height: 30px; font-size: 15px; }
  .ctl .step { width: 36px; height: 34px; }
  .throw { width: 100%; min-width: 0; height: 48px; }
  .ctl-status { display: block; font-size: 12px; height: 3.9em; white-space: normal; }
  .overlay { inset: 0 10px 8px; padding: 8px; }
  .panel { padding: 14px 16px 12px; }
  .panel h2 { font-size: 20px; margin-bottom: 10px; }
  .panel.menu { padding: 14px 16px 12px; }
  .logo h1 { font-size: 40px; }
  .logo-ban { width: 40px; height: 26px; }
  .tagline { margin: 4px 0 10px !important; }
  .modes { grid-template-columns: repeat(4, 1fr); }
  .mode { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 8px; }
  .mode svg { grid-row: auto; width: 32px; height: 32px; }
  .mode span { display: none; }
  .sub-actions { margin-top: 10px; }
  .btn { min-height: 38px; }
  .hud { padding: 6px; }
  .banner b { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .banner.show, .pcard.bump, .star, .logo-ban { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .toast, .ib, .btn, .mode { transition: none; }
}
