:root {
  --bg: #06060a;
  --panel: #0e0e16;
  --panel2: #16161f;
  --red: #ff1744;
  --red-dim: #b3123255;
  --text: #eceaf1;
  --muted: #8a8798;
  --gold: #ffd54a;
  --green: #37e08a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 800px at 70% -10%, #1a0b12 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

.logo { font-weight: 900; letter-spacing: 2px; font-size: 42px; }
.logo span { color: var(--red); }
.logo.small { font-size: 18px; }
.tagline { color: var(--muted); margin: 8px 0 28px; }

.panel {
  background: var(--panel);
  border: 1px solid #23232f;
  border-radius: 14px;
  padding: 22px;
}
.center-panel {
  margin: auto; width: min(420px, 92vw); text-align: center;
  display: flex; flex-direction: column; gap: 12px; padding: 40px 32px;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px; border-bottom: 1px solid #1d1d28; background: #0a0a11;
}
.topbar .me { flex: 1; color: var(--muted); }
.code {
  font-family: monospace; font-size: 18px; letter-spacing: 3px;
  background: var(--panel2); border: 1px dashed var(--red); border-radius: 8px; padding: 4px 12px;
}

.btn {
  background: var(--panel2); color: var(--text); border: 1px solid #2b2b3a;
  border-radius: 10px; padding: 11px 18px; font-size: 15px; cursor: pointer;
  transition: transform .06s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--red); transform: translateY(-1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #ff3d63; }
.btn.big { font-size: 17px; padding: 14px; }
.btn.slim { padding: 7px 14px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

input[type=text], select {
  background: #0a0a12; color: var(--text); border: 1px solid #2b2b3a;
  border-radius: 10px; padding: 11px 14px; font-size: 15px; width: 100%;
}
.row { display: flex; gap: 10px; }
.row input { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 10px 0; font-size: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #26263200; border-top: 1px solid #26232f; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.hidden { display: none !important; }

.menu-grid {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px;
  padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%;
}
@media (max-width: 800px) { .menu-grid { grid-template-columns: 1fr; } }
.menu-grid h2 { font-size: 16px; margin-bottom: 12px; color: #cfcbdd; }
.menu-grid .panel > * + * { margin-top: 8px; }

.lobby-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.lobby-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid #262635; border-radius: 10px; padding: 12px 14px;
}
.lobby-row .name { flex: 1; font-weight: 600; }
.lobby-row .badge {
  background: var(--red-dim); color: var(--red); border: 1px solid var(--red);
  font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700;
}
.lobby-row .count { color: var(--muted); font-size: 13px; }

.player-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel2); border-radius: 10px; margin-bottom: 8px;
}
.player-row .emoji { font-size: 22px; }
.player-row .pname { flex: 1; }
.player-row .tag { font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.tag.host { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.tag.ready { background: #12351f; color: var(--green); border: 1px solid var(--green); }
.tag.offline { background: #333; color: #999; }
.player-row .kick { cursor: pointer; color: var(--muted); }
.player-row .kick:hover { color: var(--red); }

.skin-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.skin-btn {
  font-size: 24px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); border: 2px solid transparent;
}
.skin-btn.sel { border-color: var(--red); }
.skin-btn.locked { opacity: .3; cursor: not-allowed; }

.countdown { margin-top: 12px; color: var(--gold); font-weight: 700; }

/* ── Game ── */
.game-layout { display: flex; flex: 1; min-height: 100vh; }
.hud {
  width: 240px; background: #0a0a11; border-right: 1px solid #1d1d28;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.hud-player {
  background: var(--panel2); border-radius: 10px; padding: 10px 12px;
  border: 1px solid #262635;
}
.hud-player.turn { border-color: var(--gold); box-shadow: 0 0 12px #ffd54a33; }
.hud-player .top { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.hud-player .res { display: flex; gap: 14px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.hud-player .items { font-size: 12px; color: var(--muted); margin-top: 2px; }

.board-wrap { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; }
#board { max-width: 100%; max-height: 92vh; }
.game-log {
  position: absolute; left: 16px; bottom: 12px; width: 320px; max-height: 140px;
  overflow-y: auto; font-size: 12.5px; color: var(--muted);
  background: #0a0a11cc; border: 1px solid #1d1d28; border-radius: 10px; padding: 8px 12px;
}
.game-log .me-line { color: var(--text); }

.prompt {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--red); border-radius: 14px;
  padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; align-items: center;
  min-width: 300px; box-shadow: 0 12px 40px #000a; z-index: 20;
}
.prompt .row { flex-wrap: wrap; justify-content: center; }

.mg-overlay {
  position: fixed; inset: 0; background: #06060add; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.mg-panel { width: min(680px, 94vw); text-align: center; }
#mg-area { margin-top: 16px; }

.reaction-btn {
  width: 220px; height: 220px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 28px; font-weight: 900; color: #fff; background: #444; margin: 12px auto;
  transition: background .1s;
}
.reaction-btn.go { background: var(--green); }
.reaction-btn.wait { background: var(--red); }

#rush-canvas { background: #0a0a12; border: 1px solid #262635; border-radius: 10px; }

.memory-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 260px; margin: 12px auto; }
.memory-pad { height: 80px; border-radius: 12px; border: none; cursor: pointer; opacity: .55; font-size: 24px; }
.memory-pad.lit { opacity: 1; transform: scale(1.05); }
.memory-pad:disabled { cursor: default; }
.m0 { background: #ff1744; } .m1 { background: #2979ff; } .m2 { background: #37e08a; } .m3 { background: #ffd54a; }

.rank-row { display: flex; gap: 10px; padding: 8px 12px; background: var(--panel2); border-radius: 8px; margin: 6px 0; align-items: center; }
.rank-row .pl { font-weight: 800; width: 30px; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 14px; }
.shop-card {
  background: var(--panel2); border: 1px solid #262635; border-radius: 12px;
  padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.shop-card .icon { font-size: 42px; }
.shop-card .price { color: var(--gold); font-weight: 700; }
.shop-card .owned { color: var(--green); font-weight: 700; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--red); color: var(--text);
  padding: 12px 20px; border-radius: 10px; z-index: 100; box-shadow: 0 10px 30px #000a;
}

/* ── v2: Modi, Charakter-Editor, Minigame-UIs ───────── */
.mode-pick { display: flex; gap: 10px; margin: 10px 0; }
.mode-card { flex: 1; display: flex; gap: 8px; align-items: flex-start; background: #14141f;
  border: 2px solid #26263a; border-radius: 12px; padding: 12px; cursor: pointer; }
.mode-card:has(input:checked) { border-color: #ff1744; background: #1c141c; }
.mode-card input { margin-top: 3px; accent-color: #ff1744; }
.mode-card .hint { display: block; font-size: 12px; }

.cosmetic-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.cos-btn { position: relative; min-width: 46px; height: 46px; border-radius: 10px;
  border: 2px solid #26263a; background: #14141f; color: #eceaf1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0 10px; font-size: 13px; }
.cos-btn.active { border-color: #ff1744; box-shadow: 0 0 0 2px #ff174455; }
.cos-btn.locked { opacity: .55; }
.cos-btn .swatch { width: 26px; height: 26px; border-radius: 50%; display: block; }
.cos-btn .lock { position: absolute; top: -6px; right: -6px; font-size: 13px; }
#char-preview { background: #0a0a12; border-radius: 16px; border: 1px solid #26263a; }
.mini-av { vertical-align: middle; }

.hud-player { display: flex; gap: 8px; align-items: center; }
.player-row { display: flex; gap: 10px; align-items: center; }

.mg-word { font-size: 46px; font-weight: 800; text-align: center; margin: 8px 0; letter-spacing: 2px; }
.mg-status { text-align: center; font-size: 17px; margin: 6px 0; color: #cfcfe0; min-height: 22px; }
.mg-log { margin-top: 10px; font-size: 13px; color: #9a9ab0; max-height: 110px; overflow: hidden; }
.mg-grid { background: #0a0a12; border-radius: 12px; display: block; margin: 0 auto; cursor: crosshair; }
.mg-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0; }
.mg-opt { min-width: 90px; }
.mg-opt.big-opt { font-size: 22px; padding: 22px 40px; min-width: 220px; }
.mg-opt.pad-opt { width: 90px; height: 90px; border-radius: 16px; }
.mg-result { text-align: center; font-size: 19px; line-height: 1.9; }

.shop-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.shop-h { width: 100%; margin: 14px 0 2px; color: #ff5f7a; }
.shop-card { background: #14141f; border: 1px solid #26263a; border-radius: 12px;
  padding: 12px; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.shop-preview { height: 100px; }
.shop-card .price { color: #ffd54a; font-weight: 700; }
.shop-card .owned { color: #37e08a; }

#settings-box label { display: block; margin: 10px 0 4px; }
#settings-box select { width: 100%; background: #14141f; color: #eceaf1;
  border: 1px solid #26263a; border-radius: 8px; padding: 8px; }
.over-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 17px; }
.over-row .medal { width: 34px; font-size: 22px; }

/* ── Konfetti-Währung ── */
.konfetti-badge { background: #14141f; border: 1px solid #ffd54a55; color: #ffd54a;
  border-radius: 99px; padding: 5px 14px; font-weight: 700; font-size: 14px; }
.price.konfetti { color: #ff8fb0; }
.konfetti-earn { color: #ffd54a; font-weight: 800; margin-left: auto; }
.mode-pick.wrap2 { flex-wrap: wrap; }
.mode-pick.wrap2 .mode-card { min-width: 46%; }
.swatch-img { width: 30px; height: 30px; object-fit: contain; display: block; }

/* ── Animationen & Polish ─────────────────────────────── */
@keyframes vp-pop { 0% { transform: scale(.4); opacity: 0; } 65% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes vp-slide-up { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes vp-banner { 0% { transform: translate(-50%,-30px) scale(.8); opacity: 0; } 15% { transform: translate(-50%,0) scale(1); opacity: 1; } 85% { transform: translate(-50%,0) scale(1); opacity: 1; } 100% { transform: translate(-50%,-14px) scale(.94); opacity: 0; } }
@keyframes vp-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes vp-glow { 0%,100% { box-shadow: 0 0 0 0 #ffd54a44; } 50% { box-shadow: 0 0 0 6px #ffd54a11; } }

.dice-anim { position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: 64px; line-height: 1; color: #eceaf1; text-shadow: 0 4px 18px #000c;
  pointer-events: none; transition: transform .12s; }
.dice-anim.pop { animation: vp-pop .35s ease-out; }

.turn-banner { position: absolute; top: 46%; left: 50%; transform: translate(-50%, 0);
  background: #0e0e16ee; border: 1px solid #26263a; border-radius: 14px;
  padding: 14px 34px; font-size: 24px; font-weight: 800; pointer-events: none; opacity: 0; }
.turn-banner.mine { border-color: #ff1744; color: #ff5f7a; }
.turn-banner.show { animation: vp-banner 1.4s ease forwards; }

.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

.prompt { animation: vp-slide-up .22s ease-out; }
.mg-word { animation: vp-pop .3s ease-out; }
.mg-panel { animation: vp-slide-up .25s ease-out; }
.mg-opt { transition: transform .08s, filter .12s, background .15s; }
.mg-opt:active { transform: scale(.92); }
.mg-opt:hover { filter: brightness(1.15); }
.mg-opt.big-opt:active { transform: scale(.95); }
.hud-player.turn { animation: vp-glow 1.6s ease-in-out infinite; border-radius: 10px; }
.toast { animation: vp-slide-up .2s ease-out; }
.over-row { animation: vp-slide-up .3s ease-out backwards; }
.over-row:nth-child(1) { animation-delay: .05s; font-size: 21px; }
.over-row:nth-child(2) { animation-delay: .15s; }
.over-row:nth-child(3) { animation-delay: .25s; }
.over-row:nth-child(n+4) { animation-delay: .35s; }
.mg-result div { animation: vp-slide-up .3s ease-out backwards; }
.mg-result div:nth-child(1) { animation-delay: .05s; }
.mg-result div:nth-child(2) { animation-delay: .15s; }
.mg-result div:nth-child(3) { animation-delay: .25s; }
.cos-btn { transition: transform .1s, border-color .15s, box-shadow .15s; }
.cos-btn:hover { transform: translateY(-2px); }
.shop-card { transition: transform .12s, border-color .15s; }
.shop-card:hover { transform: translateY(-3px); border-color: #ff174466; }
.board-wrap { position: relative; }
.board3d { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; }
.board3d canvas { display: block; width: 100% !important; height: 100% !important; }
.btn-3d { position: absolute; top: 10px; right: 10px; z-index: 5; }
.board-wrap { min-height: 640px; }
