/* Sternenduell: Menüs, Anzeige und Steuerknöpfe. Die Arena selbst zeichnet zeichnen.js. */
:root {
  --display: 'Baloo 2', 'Trebuchet MS', sans-serif; --text: 'Nunito', system-ui, sans-serif;
  --grund: #0b0624; --karte1: #24185a; --karte2: #120b33; --rand: #4b3bb0; --ink: #f6f2ff; --ink2: #bdb3ea;
  --gruen: #2ee6d6; --pink: #ff4fa3; --gelb: #ffd84a; --blau: #4fa8ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grund); color: var(--ink); font-family: var(--text); overflow: hidden; position: fixed; inset: 0;
  overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
canvas#feld { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; }
.versteckt { display: none !important; }

.schicht {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(30, 20, 70, .55), rgba(8, 5, 22, .88)); touch-action: pan-y;
}
#menue { background: radial-gradient(ellipse at 50% 20%, rgba(80, 60, 180, .35), rgba(8, 5, 22, .8)); }
.karte {
  width: min(440px, 100%); background: linear-gradient(170deg, var(--karte1), var(--karte2)); border: 2px solid var(--rand); border-radius: 26px;
  padding: 20px 18px 16px; text-align: center; box-shadow: 0 18px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: auf .45s cubic-bezier(.2, .8, .2, 1);
}
.karte.breit { width: min(620px, 100%); }
@keyframes auf { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
h1, h2 { font-family: var(--display); font-weight: 800; margin: 0 0 6px; line-height: 1.05; }
h1 { font-size: clamp(2.2rem, 10vw, 3rem); color: var(--gruen); text-shadow: 0 3px 0 #0b4f5c, 0 0 22px rgba(46, 230, 214, .4); }
h2 { font-size: 1.8rem; color: var(--gelb); }
.unter { margin: 0 0 12px; color: var(--ink2); line-height: 1.4; font-size: .95rem; }
.klein { margin: 6px 0 8px; font-size: .86rem; color: var(--ink2); }
.fehler { color: #ff8fa3; min-height: 0; margin: 4px 0; font-weight: 700; }
.knopf {
  border: none; border-radius: 16px; background: linear-gradient(135deg, #2ee6d6, #8ff0ff); color: #062f36; font-family: var(--display); font-weight: 800;
  font-size: 1.15rem; padding: 12px 18px; box-shadow: 0 6px 0 #11818a, 0 10px 20px rgba(0, 0, 0, .3); cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.knopf:active { transform: translateY(4px); box-shadow: 0 2px 0 #11818a; }
.knopf:disabled { opacity: .5; }
.knopf.gross { display: block; width: 100%; font-size: 1.3rem; padding: 13px; margin-top: 12px; }
.knopf.zweit { background: linear-gradient(135deg, #ff5fb7, #ff9fd4); color: #4a0b2c; box-shadow: 0 6px 0 #a82a70, 0 10px 20px rgba(0, 0, 0, .3); }
.link { background: none; border: none; color: var(--ink2); font: inherit; text-decoration: underline; cursor: pointer; margin-top: 10px; }
.zurueck { display: inline-block; margin-top: 12px; color: var(--ink2); }

.modi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 10px; }
.modi button { border: 2px solid var(--rand); background: rgba(0, 0, 0, .22); color: var(--ink); border-radius: 18px; padding: 10px 4px 8px; cursor: pointer; display: grid; gap: 2px; font-family: var(--display); }
.modi button b { font-size: 1.6rem; }
.modi button span { font-weight: 800; font-size: 1rem; }
.modi button small { font-family: var(--text); font-size: .72rem; color: var(--ink2); }
.modi button.aktiv { background: linear-gradient(160deg, rgba(46, 230, 214, .3), rgba(46, 230, 214, .08)); border-color: var(--gruen); box-shadow: 0 0 0 2px rgba(46, 230, 214, .25); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; text-align: left; }
.opt > span { font-weight: 800; font-size: .92rem; color: var(--ink2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chips button { border: 2px solid var(--rand); background: rgba(0, 0, 0, .2); color: var(--ink); border-radius: 999px; padding: 6px 11px; font-family: var(--display); font-weight: 800; font-size: .92rem; cursor: pointer; }
.chips button.aktiv { background: var(--gelb); color: #2b2000; border-color: var(--gelb); }
.chips button:disabled { opacity: .45; }
.chips.gross { justify-content: center; margin: 4px 0 8px; }
.chips.gross button { padding: 9px 12px; }
.namen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.namen label { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 4px 8px; border: 2px solid currentColor; }
.namen input, .name-feld input { flex: 1; min-width: 0; background: none; border: none; color: var(--ink); font: 700 1rem var(--text); outline: none; padding: 4px 0; }
.punkt { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.name-feld { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 800; font-size: .9rem; color: var(--ink2); background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 4px 10px; }
.lobby { background: rgba(0, 0, 0, .2); border-radius: 14px; padding: 8px 10px; text-align: left; }
.lobby ul { list-style: none; margin: 4px 0; padding: 0; }
.lobby li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-weight: 700; }
.regeln { text-align: left; margin-top: 12px; font-size: .86rem; color: var(--ink2); }
.regeln summary { cursor: pointer; font-weight: 800; color: var(--ink); }
.regeln ul { padding-left: 18px; line-height: 1.45; }
.schalter { display: flex; gap: 10px; justify-content: center; margin: 12px 0 4px; }
.rund { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--rand); background: rgba(0, 0, 0, .35); color: var(--ink); font-size: 1.2rem; display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.rund.aus { opacity: .4; }
.pause { position: fixed; z-index: 6; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); width: 38px; height: 38px; font-size: 1rem; opacity: .8; }


/* Ende */
.pokal { font-size: 3rem; animation: schweben 2.4s ease-in-out infinite; }
.stand { color: var(--ink2); margin: 2px 0 8px; }
@keyframes plopp { from { transform: scale(0); } to { transform: scale(1); } }
.rangliste { list-style: none; margin: 6px 0; padding: 0; text-align: left; }
.rangliste li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 5px 0; border-radius: 12px; background: rgba(0, 0, 0, .25); border-left: 6px solid var(--f, #fff); font-weight: 800; animation: auf .4s both; }
.rangliste li span:nth-child(2) { flex: 1; }
.rangliste li small { display: block; font-weight: 400; color: var(--ink2); font-size: .78rem; }
.sterne-ergebnis { text-align: left; margin: 8px 0; }
.sterne-zeile { background: rgba(255, 210, 63, .1); border: 1px solid rgba(255, 210, 63, .3); border-radius: 12px; padding: 6px 10px; margin: 5px 0; font-size: .9rem; }
.sterne-zeile small { display: block; color: var(--ink2); }
.sterne-plus { color: var(--gelb); font-weight: 900; }
.sterne-auf { background: var(--gruen); color: #062f36; border-radius: 999px; padding: 1px 8px; font-weight: 900; font-size: .78rem; }
.sterne-abz { background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 1px 8px; font-size: .8rem; }
.sterne-hinweis { color: var(--ink2); font-size: .85rem; }

/* Anzeige oben */
.hud { position: fixed; z-index: 5; left: 0; right: 0; top: 0; padding: max(4px, env(safe-area-inset-top)) 52px 4px max(6px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.hud-reihe { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.hud-chip { display: flex; align-items: center; gap: 5px; background: rgba(0, 0, 0, .45); border-radius: 999px; padding: 3px 9px 3px 4px; font-weight: 800; font-size: .86rem; border: 2px solid var(--f); }
.hud-chip .punkt { width: 14px; height: 14px; background: var(--f); }
.hud-chip.raus { opacity: .4; text-decoration: line-through; }
.hud-chip b { font-family: var(--display); font-size: 1rem; }
.hud-chip .eff { font-size: .8rem; }
.hud-mitte { background: rgba(0, 0, 0, .45); border-radius: 999px; padding: 3px 12px; font-family: var(--display); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.hud-mitte.knapp { color: #ff8fa3; animation: puls 1s infinite; }
@keyframes puls { 50% { transform: scale(1.08); } }

/* Steuerknöpfe: allein/online unten, zu mehreren je Platz am Rand */
.steuer { position: fixed; z-index: 5; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: center; padding: 0 14px; pointer-events: none; }
.steuer button, .pad button { pointer-events: auto; width: 72px; height: 72px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .5); background: rgba(0, 0, 0, .35); color: #fff; font-size: 2rem; font-weight: 900; touch-action: none; }
.steuer button:active, .pad button.gedrueckt { transform: scale(.92); background: rgba(255, 255, 255, .25); }
.steuer button, .pad button { display: grid; place-items: center; padding: 0; }
.steuer button svg, .pad button svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.steuer-tipp { color: rgba(255, 255, 255, .5); font-size: .8rem; font-weight: 700; }
.pads { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.pad { position: absolute; display: flex; align-items: center; gap: clamp(4px, 1.6vw, 10px); padding: 6px clamp(4px, 1.6vw, 10px); pointer-events: none; }
.pad button { flex: none; width: clamp(46px, 14vw, 64px); height: clamp(46px, 14vw, 64px); font-size: clamp(1.5rem, 6.5vw, 2rem); border-color: var(--f); background: color-mix(in srgb, var(--f) 30%, rgba(0, 0, 0, .4)); }
.pad .pad-name { font-family: var(--display); font-weight: 800; color: var(--f); font-size: clamp(.75rem, 3.2vw, .95rem); line-height: 1.15; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad.unten { bottom: max(6px, env(safe-area-inset-bottom)); }
.pad.oben { top: max(6px, env(safe-area-inset-top)); transform: rotate(180deg); }
.pad.links { left: max(6px, env(safe-area-inset-left)); }
.pad.rechts { right: max(6px, env(safe-area-inset-right)); }
/* Zwei Plätze an einem Rand teilen sich die Breite */
.pad.links, .pad.rechts { max-width: calc(50% - 10px); }
/* translate wirkt im Bildschirm, nicht in der Drehung: auch oben nach links verschieben */
.pad.mitte { left: 50%; translate: -50% 0; }
.pause.seitlich { top: calc(50% - 16px); width: 32px; height: 32px; font-size: .85rem; opacity: .6; }

.ansage { position: fixed; z-index: 7; inset: 0; display: grid; place-items: center; pointer-events: none; font-family: var(--display); font-weight: 800; text-align: center; }
.ansage div { font-size: clamp(2rem, 9vw, 4rem); color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 0 30px rgba(255, 255, 255, .25); animation: plopp .35s cubic-bezier(.2, 1.6, .4, 1); }
.ansage small { display: block; font-size: clamp(1rem, 4vw, 1.4rem); color: var(--gelb); }
.hud.seitlich { top: 50%; bottom: auto; right: auto; left: max(4px, env(safe-area-inset-left)); transform: translateY(-50%); padding: 0; }
.hud.seitlich .hud-reihe { display: none; }
/* Schmale Handys: nichts darf die Karte breiter als den Bildschirm machen, und seitlich scrollt nie etwas */
.schicht { grid-template-columns: minmax(0, 1fr); justify-items: center; overflow-x: hidden; overflow-x: clip; overscroll-behavior: none; }
.namen label { min-width: 0; }
.namen input, .name-feld input { width: 100%; }
.karte { max-width: 100%; min-width: 0; }
.opt { flex-wrap: wrap; }
.opt .chips { flex: 1 1 auto; min-width: 0; }
.modi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modi button small { overflow-wrap: anywhere; }
.chips.gross button { flex: 1 1 140px; }
.namen { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ───────── Sternenduell ───────── */
.logo { display: inline-block; animation: schweben 2.4s ease-in-out infinite; }
@keyframes schweben { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-4px) rotate(6deg); } }
#menue { background: radial-gradient(ellipse at 50% 15%, rgba(120, 70, 220, .35), rgba(5, 3, 18, .85)); }
/* Knöpfe: links drehen (halten), rechts feuern */
.steuer button.dreh, .pad button.dreh { border-color: rgba(255, 255, 255, .7); }
.steuer button.feuer { background: radial-gradient(circle at 35% 30%, #ff8ac4, #ff4fa3 60%, #b3206e); border-color: #fff; }
.pad button.feuer { background: color-mix(in srgb, var(--f) 75%, #000); border-color: #fff; }
.steuer button.feuer svg, .pad button.feuer svg { stroke-width: 2.8; }
.steuer button.gedrueckt, .pad button.gedrueckt, .steuer button.halten, .pad button.halten { transform: scale(.92); background-color: rgba(255, 255, 255, .25); }
.steuer button { width: 84px; height: 84px; }
.steuer-tipp { text-align: center; line-height: 1.3; }
.pad .pad-name b { display: block; letter-spacing: 1px; font-size: .9em; }
/* Rundensiege als Punkte */
.siege { letter-spacing: 1px; white-space: nowrap; }
.siege i { font-style: normal; opacity: .3; }
.hud-chip .siege { font-size: .8rem; }
.hud.seitlich { flex-direction: column; align-items: flex-start; gap: 4px; }
.hud.seitlich .hud-mitte { font-size: .8rem; padding: 2px 8px; }
.hud-liste { display: grid; gap: 3px; }
.hud-liste span { display: flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .45); border-radius: 999px; padding: 2px 7px 2px 3px; font: 800 .75rem var(--display); }
.hud-liste .punkt { width: 11px; height: 11px; }
.ansage div.runde { font-size: clamp(1.6rem, 7vw, 3rem); }
.ansage div.zahl { font-size: clamp(3.5rem, 18vw, 7rem); color: var(--gruen); text-shadow: 0 0 30px rgba(46, 230, 214, .6), 0 5px 0 rgba(0, 0, 0, .5); }
.ansage .punkte-reihe { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; font-size: clamp(.9rem, 3.6vw, 1.2rem); }
.ansage .punkte-reihe span { background: rgba(0, 0, 0, .5); border-radius: 999px; padding: 4px 12px; border: 2px solid var(--f); color: #fff; }
.ansage .gedreht-auch { rotate: 180deg; opacity: .85; margin-bottom: 12px; }
.hud:not(.seitlich) .hud-chip { font-size: .8rem; padding: 2px 8px 2px 4px; }
.hud:not(.seitlich) .hud-mitte { font-size: .85rem; padding: 2px 9px; align-self: flex-start; }
/* Lenkknüppel: Finger zeigt die Richtung, der Knauf folgt ihm */
.knueppel { position: relative; flex: none; pointer-events: auto; touch-action: none; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .7); background: radial-gradient(circle, rgba(255, 255, 255, .08) 0 38%, rgba(0, 0, 0, .38) 39%); display: grid; place-items: center; cursor: grab; -webkit-user-select: none; user-select: none; }
.knueppel::before { content: ''; position: absolute; inset: 10%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .22); pointer-events: none; }
.knueppel .knauf { width: 44%; height: 44%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c9d6ff 55%, #7d8fd6); box-shadow: 0 3px 10px rgba(0, 0, 0, .45); pointer-events: none; transition: translate .12s ease-out; }
.knueppel.halten .knauf { transition: none; }
.knueppel.halten { border-color: #fff; background: radial-gradient(circle, rgba(255, 255, 255, .16) 0 38%, rgba(0, 0, 0, .38) 39%); }
.steuer .knueppel { width: 104px; height: 104px; }
.pad .knueppel { width: clamp(56px, 17vw, 76px); height: clamp(56px, 17vw, 76px); border-color: var(--f); background: radial-gradient(circle, color-mix(in srgb, var(--f) 25%, transparent) 0 38%, color-mix(in srgb, var(--f) 22%, rgba(0, 0, 0, .45)) 39%); }
.pad .knueppel .knauf { background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--f) 60%, #fff) 60%, var(--f)); }
