/* =========================================================
   WORTLEITER – Styles
   ========================================================= */
:root {
  --bg: #12131f;
  --bg-2: #1a1c2e;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .075);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #f3efe6;
  --muted: #a3a3b8;
  --accent: #ffd166;
  --good: #3ddc97;
  --bad: #ff5d6c;
  --tile: #f6eedd;
  --tile-2: #e7dcc4;
  --tile-edge: #c7b590;
  --tile-ink: #23202d;
  --radius: 18px;
  --display: 'Bricolage Grotesque', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-size: .9em; background: var(--panel-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Hintergrund ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(1200px 700px at 50% -10%, #23264a 0%, transparent 60%), linear-gradient(180deg, #14152a, #0e0f19); }
.bg-glow { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .35; }
.g1 { background: #ff6b5b; left: -25vmax; top: 30vh; opacity: .14; animation: drift 24s ease-in-out infinite alternate; }
.g2 { background: #4cc9f0; right: -25vmax; top: -10vh; opacity: .12; animation: drift 30s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(8vmax, -6vmax) scale(1.1); } }
.bg-grain { position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* ---------- Screens ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; animation: screenIn .45s var(--ease-out); }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--b); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease-out), background .2s, border-color .2s, opacity .2s, box-shadow .2s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffd97f, #ffbf3d); color: #2a1d00; border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 8px 24px -8px rgba(255, 191, 61, .6); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe39c, #ffc857); }
.btn.danger { background: rgba(255, 93, 108, .15); border-color: rgba(255, 93, 108, .4); color: #ffc2c8; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.big { padding: 15px 26px; font-size: 17px; border-radius: 14px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; display: grid; place-items: center; font-size: 17px; transition: background .2s, transform .15s; }
.icon-btn:hover:not(:disabled) { background: var(--panel-2); }
.icon-btn:active:not(:disabled) { transform: scale(.94); }
.icon-btn:disabled { opacity: .25; cursor: not-allowed; }
.icon-btn.small { width: 34px; height: 34px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kacheln ---------- */
.tiles { --gap: 6px; display: flex; gap: var(--gap); justify-content: center;
  --size: clamp(26px, calc((min(100vw, 640px) - 150px) / var(--n, 5) - var(--gap)), 54px); }
.tile {
  width: var(--size, 48px); height: var(--size, 48px);
  display: grid; place-items: center; border-radius: calc(var(--size, 48px) * .2);
  background: linear-gradient(180deg, var(--tile), var(--tile-2));
  color: var(--tile-ink); font: 800 calc(var(--size, 48px) * .52)/1 var(--display);
  box-shadow: 0 1px 0 #fff inset, 0 -2px 0 rgba(0,0,0,.08) inset, 0 3px 0 var(--tile-edge), 0 6px 14px rgba(0,0,0,.35);
  position: relative; user-select: none; letter-spacing: 0;
}
.tiles.small { --size: clamp(22px, calc((min(100vw, 640px) - 120px) / (2 * var(--n, 5)) - 4px), 36px); --gap: 4px; }
.tile.match { background: linear-gradient(180deg, #d7f7e8, #b6ecd3); box-shadow: 0 1px 0 #fff inset, 0 3px 0 #79c9a4, 0 6px 14px rgba(0,0,0,.35); }
.tile.changed { background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 35%, #fff), color-mix(in srgb, var(--pc) 60%, #fff));
  box-shadow: 0 1px 0 #fff inset, 0 3px 0 color-mix(in srgb, var(--pc) 75%, #000), 0 6px 16px color-mix(in srgb, var(--pc) 45%, transparent); }
.tiles.target .tile { background: linear-gradient(180deg, #2a2d46, #23263c); color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, .35) inset, 0 3px 0 #15172a, 0 6px 14px rgba(0,0,0,.35); }
.flip-in .tile { animation: flipIn .5s var(--spring) both; }
@keyframes flipIn { from { transform: rotateX(90deg) translateY(-8px); opacity: 0; } }

/* ---------- Setup ---------- */
#screen-setup { padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) 40px; max-width: 1200px; margin: 0 auto; }
.setup-hero { text-align: center; margin-bottom: 34px; }
.logo { display: flex; justify-content: center; }
.logo-line { display: flex; gap: clamp(3px, 1vw, 8px); flex-wrap: nowrap; }
.logo-tile { --size: clamp(30px, 8vw, 68px); animation: logoIn .7s var(--spring) both; }
.logo-tile:nth-child(odd) { transform: rotate(-3deg); }
.logo-tile:nth-child(even) { transform: rotate(2deg) translateY(4px); }
.logo-tile.alt { background: linear-gradient(180deg, #ffe08a, #ffc54a); box-shadow: 0 1px 0 #fff8 inset, 0 3px 0 #c48b16, 0 8px 18px rgba(0,0,0,.4); }
@keyframes logoIn { from { opacity: 0; transform: translateY(-40px) rotate(-20deg) scale(.6); } }
.tagline { color: var(--muted); font-size: clamp(15px, 2vw, 18px); margin: 22px auto 0; max-width: 520px; }

.setup-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); align-items: start; }
@media (max-width: 1000px) { .setup-grid { grid-template-columns: 1fr 1fr; } .setup-grid .card:last-child { grid-column: 1 / -1; } }
@media (max-width: 680px) { .setup-grid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 50px -30px rgba(0,0,0,.6); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.card h2 { font: 700 20px/1.2 var(--display); margin: 0; letter-spacing: -.01em; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; min-height: 1.5em; }

.player-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.player-row { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 14px; background: rgba(0,0,0,.18);
  border: 1px solid var(--line); animation: screenIn .3s var(--ease-out); }
.swatch { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--pc); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0,0,0,.25) inset, 0 4px 12px color-mix(in srgb, var(--pc) 50%, transparent); flex: none; transition: transform .2s var(--spring); }
.swatch:hover { transform: rotate(-8deg) scale(1.06); }
.name-input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: 600 16px var(--ui); padding: 8px 4px; outline: none; }
.name-input:focus { box-shadow: 0 2px 0 var(--pc); }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.18);
  cursor: pointer; display: grid; gap: 4px; transition: border-color .2s, background .2s, transform .15s; }
.mode-card span:last-child { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.mode-card strong { font: 700 17px var(--display); }
.mode-icon { font-size: 20px; color: var(--accent); }
.mode-card:hover { background: rgba(255,255,255,.05); }
.mode-card.on { border-color: var(--accent); background: rgba(255, 209, 102, .08); box-shadow: 0 0 0 1px var(--accent) inset; }

.seg { display: flex; padding: 4px; gap: 4px; background: rgba(0,0,0,.25); border-radius: 12px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; cursor: pointer; font-weight: 600;
  display: grid; justify-items: center; line-height: 1.15; transition: background .2s, color .2s; color: var(--muted); white-space: nowrap; }
.seg button small { font-size: 11px; font-weight: 500; opacity: .75; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--text); color: var(--bg); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 0 40px; }

.toggle { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle-ui { flex: none; width: 42px; height: 24px; border-radius: 99px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; margin-top: 2px; }
.toggle-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--spring); }
.toggle input:checked + .toggle-ui { background: var(--good); }
.toggle input:checked + .toggle-ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle strong { display: block; font-size: 14.5px; }
.toggle small { color: var(--muted); font-size: 12.5px; }

.setup-actions { display: flex; justify-content: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.footnote { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; opacity: .7; }

/* ---------- Spielscreen ---------- */
#screen-game.active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px clamp(12px, 3vw, 24px); border-bottom: 1px solid var(--line); background: rgba(10, 11, 20, .4); backdrop-filter: blur(10px); }
.chips { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.chip.strong { color: var(--text); }
.chip.accent { color: var(--accent); border-color: rgba(255,209,102,.35); }

.game-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.board { display: flex; flex-direction: column; min-height: 0; padding: 16px clamp(12px, 3vw, 28px) 14px; position: relative; }
.board.covered > * { filter: blur(18px); pointer-events: none; }

.puzzle-head { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 20px); flex-wrap: wrap; }
.ph-col { display: grid; justify-items: center; gap: 6px; }
.ph-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ph-arrow { display: grid; justify-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.ph-arrow svg { width: 60px; height: 12px; color: var(--accent); }

.turn-banner { --pc: var(--accent); align-self: center; margin: 14px 0 6px; padding: 7px 16px 7px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--pc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 50%, transparent);
  display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; min-height: 36px; }
.turn-banner:empty { visibility: hidden; }
.tb-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 30%, transparent); }
.turn-banner.pulse { animation: bannerIn .5s var(--spring); }
@keyframes bannerIn { from { transform: scale(.8); opacity: 0; } }

.ladder-wrap { flex: 1; min-height: 120px; overflow-y: auto; position: relative; padding: 20px 0 10px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 10px), transparent); }
.rail { position: absolute; top: 0; bottom: 0; width: 6px; border-radius: 3px; background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.1)); pointer-events: none; }
.rail.left { left: calc(50% - var(--rail, 190px)); }
.rail.right { right: calc(50% - var(--rail, 190px)); }
.ladder-wrap.collapse .ladder { animation: collapse .9s ease-in; }
@keyframes collapse { 30% { transform: rotate(-2deg) translateY(4px); } 60% { transform: rotate(2.5deg) translateY(10px); } 100% { transform: none; } }

.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; justify-content: center; }
.rung { display: grid; grid-template-columns: 70px auto 54px; align-items: center; gap: 12px; position: relative; }
.rung::before { content: ''; position: absolute; left: 70px; right: 54px; top: 50%; height: 4px; background: rgba(255,255,255,.05); z-index: -1; border-radius: 2px; }
.rung-who { font-size: 12px; font-weight: 700; color: var(--pc); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rung.start .rung-who { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; }
.rung-pts { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rung-pts.pos { color: var(--good); }
.rung-pts.neg { color: var(--bad); }
.rung.goal .tile { animation: goalGlow 1.2s ease-in-out 2; }
@keyframes goalGlow { 50% { transform: translateY(-6px); box-shadow: 0 1px 0 #fff inset, 0 3px 0 #79c9a4, 0 12px 30px rgba(61, 220, 151, .6); } }

.input-zone { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; justify-items: center; }
.timer { width: min(100%, 520px); height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.timer.off { visibility: hidden; }
.timer-fill { height: 100%; background: linear-gradient(90deg, var(--good), #9be15d); transform-origin: left; border-radius: 3px; transition: background .3s; }
.timer-fill.warn { background: linear-gradient(90deg, #ffb703, #ffd166); }
.timer-fill.crit { background: linear-gradient(90deg, var(--bad), #ff8a5b); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }

.input-row { display: flex; gap: 7px; justify-content: center; --size: clamp(32px, calc((min(100vw, 640px) - 60px) / var(--n, 5) - 7px), 64px); }
@media (min-width: 901px) { .input-row { --size: clamp(32px, calc((min(100vw - 360px, 640px) - 60px) / var(--n, 5) - 7px), 64px); } }
.input-tile { border: 0; cursor: pointer; transition: transform .18s var(--spring), box-shadow .2s, background .2s; }
.input-tile:hover { transform: translateY(-3px); }
.input-tile.sel { transform: translateY(-8px); background: linear-gradient(180deg, #fff, #f1e7d2);
  box-shadow: 0 0 0 3px var(--accent), 0 3px 0 var(--tile-edge), 0 14px 26px rgba(0,0,0,.45); }
.input-tile.new { background: linear-gradient(180deg, #ffe7a3, #ffd166); animation: pop .35s var(--spring); }
.input-tile.hinted:not(.sel) { animation: hintPulse 1s ease-in-out infinite; }
@keyframes pop { from { transform: translateY(-8px) scale(.7); } }
@keyframes hintPulse { 50% { box-shadow: 0 0 0 4px var(--accent), 0 3px 0 var(--tile-edge); } }

.msg { min-height: 22px; font-size: 14px; font-weight: 600; text-align: center; color: var(--muted); }
.msg.good { color: var(--good); }
.msg.bad { color: var(--bad); }
.msg.info { color: var(--accent); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.keyboard { display: grid; gap: 6px; width: min(100%, 600px); user-select: none; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1; max-width: 50px; height: 46px; border-radius: 9px; border: 0; background: rgba(255,255,255,.1); font: 700 16px var(--ui); cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.35); transition: background .15s, transform .1s; padding: 0; }
.key:hover { background: rgba(255,255,255,.17); }
.key:active { transform: translateY(2px); box-shadow: none; }
.key.wide { max-width: 72px; flex: 1.5; }
.key.enter { background: rgba(255, 209, 102, .2); color: var(--accent); }
.key.dim { opacity: .3; }
.key.picked { background: var(--accent); color: #2a1d00; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.actions [hidden] { display: none; }

/* ---------- Sidebar ---------- */
.sidebar { border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; background: rgba(10, 11, 20, .25); }
.steps-card { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.big-num { font: 800 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.scoreboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.score-row { --t: 1; position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); transition: transform .35s var(--ease-out), background .3s, border-color .3s; }
.score-row.active { background: color-mix(in srgb, var(--pc) 14%, transparent); border-color: color-mix(in srgb, var(--pc) 55%, transparent); transform: translateX(-4px); }
.avatar { --pc: inherit; width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 800 17px var(--display);
  background: var(--pc); color: #15131f; position: relative; }
.score-row.active .avatar::after { content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--pc) calc(var(--t) * 360deg), rgba(255,255,255,.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 21px, #000 22px); mask: radial-gradient(circle, transparent 21px, #000 22px); }
.avatar.big { width: 64px; height: 64px; font-size: 28px; }
.score-info { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.score-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { font: 800 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.score-row.leader .score::before { content: '👑'; font-size: 14px; margin-right: 6px; vertical-align: 4px; }
.score-pop { position: absolute; right: 14px; top: -6px; font-weight: 800; font-size: 16px; animation: popUp 1.1s var(--ease-out) forwards; pointer-events: none; }
.score-pop.pos { color: var(--good); }
.score-pop.neg { color: var(--bad); }
@keyframes popUp { from { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: translateY(-6px) scale(1.1); } to { opacity: 0; transform: translateY(-28px); } }
.delta { font-size: 12px; font-weight: 700; }
.delta.pos { color: var(--good); } .delta.neg { color: var(--bad); }

.log-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 0 8px; }
.log { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 6px; font-size: 13px; color: #d4d2df; align-content: start; scrollbar-width: thin; }
.log li { animation: screenIn .3s var(--ease-out); }
.log b { color: var(--text); }
.log .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); margin-right: 4px; }
.log .lname { font-weight: 700; color: var(--pc); }
.log-round { display: block; font-weight: 700; color: var(--accent); margin-top: 6px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(6, 7, 14, .6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.overlay[hidden] { display: none; }
.modal { width: min(100%, 520px); max-height: calc(100dvh - 32px); overflow-y: auto; background: linear-gradient(180deg, #23253b, #1b1d2f);
  border: 1px solid var(--line-2); border-radius: 22px; padding: 26px; box-shadow: 0 40px 80px -20px rgba(0,0,0,.7);
  transform: translateY(14px) scale(.97); transition: transform .35s var(--spring); }
.overlay.show .modal { transform: none; }
.modal.wide { width: min(100%, 760px); }
.modal h2 { font: 800 26px/1.15 var(--display); margin: 4px 0 12px; letter-spacing: -.01em; }
.modal h3 { font: 700 17px var(--display); margin: 18px 0 6px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.modal.intro { text-align: center; }
.modal.intro .modal-actions { justify-content: center; }
.intro-title .w { color: var(--accent); }
.intro-tiles { display: grid; gap: 10px; justify-items: center; margin: 18px 0; }
.intro-tiles .tiles { --size: clamp(28px, calc((min(100vw, 520px) - 90px) / var(--n) - 6px), 52px); }
.intro-tiles .tile { animation: flipIn .55s var(--spring) both; }
.intro-arrow { color: var(--muted); font-size: 22px; }
.handoff { display: flex; align-items: center; gap: 14px; }
.handoff .avatar { background: var(--pc); }
.rules ul { padding-left: 20px; margin: 6px 0; } .rules li { margin: 4px 0; color: #d9d7e3; }
.rule-example { font: 700 16px var(--display); letter-spacing: .04em; color: var(--accent); background: rgba(0,0,0,.25); padding: 10px 14px; border-radius: 12px; margin: 10px 0; text-align: center; }
.menu-list { display: grid; gap: 10px; }

.vote-title { font-size: 21px !important; }
.vote-word { margin: 16px 0; }
.vote-word .tiles { --size: clamp(28px, calc((min(100vw, 520px) - 90px) / var(--n) - 6px), 52px); --pc: var(--accent); }
.vote-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.vote-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(0,0,0,.2); flex-wrap: wrap; }
.vote-row .avatar { background: var(--pc); width: 32px; height: 32px; font-size: 14px; }
.vote-name { flex: 1; font-weight: 700; min-width: 80px; }
.vote-btn { border: 1px solid var(--line-2); background: transparent; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s; }
.vote-btn.yes.on { background: rgba(61, 220, 151, .2); border-color: var(--good); }
.vote-btn.no.on { background: rgba(255, 93, 108, .2); border-color: var(--bad); }

.round-body { display: grid; gap: 14px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare.compact { margin-top: 8px; }
@media (max-width: 560px) { .compare { grid-template-columns: 1fr; } }
.cmp-col { background: rgba(0,0,0,.2); border-radius: 14px; padding: 12px; }
.cmp-col h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.chain { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.chain-word { font: 700 14px var(--display); letter-spacing: .05em; background: var(--tile); color: var(--tile-ink); padding: 3px 8px; border-radius: 6px; box-shadow: 0 2px 0 var(--tile-edge); }
.chain-arrow { color: var(--muted); font-size: 12px; }
.sprint-res { border-left: 3px solid var(--pc); padding-left: 12px; }
.sr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sr-head .avatar { background: var(--pc); width: 30px; height: 30px; font-size: 13px; }
.sr-pts { margin-left: auto; font: 800 18px var(--display); }
.sr-pts.pos { color: var(--good); } .sr-pts.neg { color: var(--bad); }
.round-sums { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.rs { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: rgba(0,0,0,.25); }
.rs .avatar { background: var(--pc); width: 26px; height: 26px; font-size: 12px; }
.rs b { color: var(--pc); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 12px; background: #2a2c44; border: 1px solid var(--line-2); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: toastIn .35s var(--spring); transition: opacity .4s, transform .4s; }
.toast.good { border-color: rgba(61,220,151,.5); } .toast.bad { border-color: rgba(255,93,108,.5); }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.95); } }

/* ---------- Final ---------- */
#screen-final { padding: 40px 16px; max-width: 900px; margin: 0 auto; text-align: center; }
.final-title { font: 800 clamp(34px, 6vw, 56px)/1 var(--display); margin: 10px 0 34px; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff, #ffd166); -webkit-background-clip: text; background-clip: text; color: transparent; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: clamp(8px, 3vw, 22px); margin-bottom: 30px; }
.pod { display: grid; justify-items: center; gap: 6px; width: clamp(90px, 22vw, 170px); animation: podIn .8s var(--spring) both; }
.pod-2 { animation-delay: .25s; } .pod-3 { animation-delay: .45s; } .pod-1 { animation-delay: .7s; }
@keyframes podIn { from { opacity: 0; transform: translateY(60px); } }
.pod .avatar { background: var(--pc); box-shadow: 0 0 0 4px rgba(255,255,255,.1), 0 10px 30px color-mix(in srgb, var(--pc) 50%, transparent); }
.pod-crown { font-size: 30px; height: 36px; animation: float 2s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-6deg); } }
.pod-name { font: 700 18px var(--display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pod-score { color: var(--muted); font-weight: 600; }
.pod-block { width: 100%; border-radius: 14px 14px 4px 4px; display: grid; place-items: center; font: 800 36px var(--display); color: rgba(0,0,0,.35);
  background: linear-gradient(180deg, var(--pc), color-mix(in srgb, var(--pc) 60%, #000)); box-shadow: 0 1px 0 rgba(255,255,255,.4) inset; }
.pod-1 .pod-block { height: 150px; } .pod-2 .pod-block { height: 105px; } .pod-3 .pod-block { height: 75px; }
.final-table { overflow-x: auto; padding: 8px; }
.final-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.final-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 10px 8px; }
.final-table td { padding: 11px 8px; border-top: 1px solid var(--line); }
.final-table td.name { font-weight: 700; color: var(--pc); text-align: left; }
.final-table th:nth-child(2) { text-align: left; }
.final-table td:last-child { font: 800 18px var(--display); }

/* ---------- Responsive Spiel ---------- */
@media (max-width: 900px) {
  #screen-game.active { height: auto; min-height: 100dvh; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .board, .sidebar { min-width: 0; }
  .chip { font-size: 11.5px; padding: 4px 9px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .puzzle-head { gap: 6px 12px; }
  .ph-arrow svg { width: 40px; }
  .sidebar { order: -1; border-left: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .steps-card, .log-card { display: none; }
  .scoreboard { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .score-row { flex: 1 0 auto; padding: 6px 10px 6px 6px; gap: 8px; }
  .score-row.active { transform: translateY(-2px); }
  .score-row .avatar { width: 30px; height: 30px; font-size: 14px; }
  .score-row.active .avatar::after { inset: -4px; -webkit-mask: radial-gradient(circle, transparent 16px, #000 17px); mask: radial-gradient(circle, transparent 16px, #000 17px); }
  .score-info .muted { display: none; }
  .score { font-size: 18px; }
  .ladder-wrap { max-height: 38vh; }
  .rung { grid-template-columns: 52px auto 40px; gap: 8px; }
  .rung::before { left: 52px; right: 40px; }
  .key { height: 42px; font-size: 15px; }
  .rail { display: none; }
}
@media (max-width: 420px) { .kb-row { gap: 3px; } .key { height: 40px; border-radius: 7px; } .btn { padding: 10px 13px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.modal:focus { outline: none; }
