:root {
  --bg: #0b1020;
  --bg2: #141a33;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.10);
  --text: #f4f6ff;
  --muted: #a3abc9;
  --primary1: #6366f1;
  --primary2: #06b6d4;
  --ok: #22c55e;
  --bad: #ef4444;
  --gold: #facc15;
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 10% -10%, #1e2a5a 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 10%, #0e4a5a 0%, transparent 55%),
              var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input { font: inherit; }
a { color: #93c5fd; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

#app { max-width: 1100px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Startseite ---------- */
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.profile-btn {
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: .88rem; font-weight: 600;
  transition: background .15s;
}
.profile-btn:hover { background: rgba(255,255,255,.11); }
.brand { text-align: center; padding: 18px 0 18px; }
.logo { font-size: 3rem; line-height: 1; }
.brand h1 {
  margin: 8px 0 4px; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #c7d2fe 40%, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); margin: 0; }

.banner {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, rgba(99,102,241,.25), rgba(6,182,212,.18));
  border: 1px solid rgba(99,102,241,.5); border-radius: var(--radius);
  padding: 14px 18px; margin: 8px 0 18px;
}
.banner p { margin: 4px 0 0; color: #dbe1ff; }
.banner-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.banner-close {
  width: 38px; height: 38px; padding: 0; border-radius: 12px;
  border: 1px solid var(--panel-border); background: rgba(255,255,255,.06);
  color: var(--muted); font-size: 1.25rem; line-height: 1;
}
.banner-close:hover { color: var(--text); background: rgba(255,255,255,.12); }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
  backdrop-filter: blur(6px);
}
.mode-card h2 { margin: 2px 0 0; font-size: 1.6rem; }
.mode-card p { margin: 0; }
.mode-head { display: flex; justify-content: space-between; align-items: center; }
.pill {
  display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 999px; background: rgba(99,102,241,.25); color: #c7d2fe;
}
.pill.alt { background: rgba(6,182,212,.22); color: #a5f3fc; }
.pill.subtle { background: rgba(255,255,255,.07); color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.badge { font-weight: 700; background: rgba(255,255,255,.08); padding: 4px 10px; border-radius: 999px; }

.today-cat {
  display: flex; gap: 12px; align-items: center;
  background: rgba(255,255,255,.05); border-radius: 16px; padding: 12px 14px; margin: 4px 0;
}
.today-cat strong { display: block; font-size: 1.2rem; }
.big-emoji { font-size: 2.2rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.chip {
  border: 1px solid var(--panel-border); background: rgba(255,255,255,.04); color: var(--text);
  padding: 7px 12px; border-radius: 999px; font-size: .9rem; transition: all .15s;
}
.chip:hover { background: rgba(255,255,255,.1); }
.chip.active { background: rgba(6,182,212,.25); border-color: #22d3ee; }

/* ---------- Rangliste ---------- */
.board-card {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 18px 20px;
}
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.board-head h3 { margin: 0; font-size: 1.15rem; }
.board-head p { margin: 2px 0 0; }
.small-btn { width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; }
.board-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.board-row {
  display: grid; grid-template-columns: 38px 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: .95rem;
}
.board-row.me { background: rgba(99,102,241,.22); border: 1px solid rgba(129,140,248,.5); }
.board-rank { font-weight: 800; color: var(--muted); text-align: center; }
.board-row.top1 .board-rank { color: var(--gold); }
.board-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-weight: 800; }
.board-time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.board-empty { color: var(--muted); font-size: .92rem; margin: 4px 0 0; }

.howto { margin-top: 16px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 14px 20px; }
.howto h3 { margin: 0 0 6px; }
.howto p { margin: 0; color: var(--muted); }
kbd { background: rgba(255,255,255,.12); border-radius: 6px; padding: 1px 6px; font-family: inherit; }

.foot { text-align: center; color: #7c85ab; font-size: .8rem; padding: 20px 0 10px; }
.foot-note { margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; }
.foot-links a { color: #a3abc9; text-decoration: none; }
.foot-links a:hover { color: #fff; text-decoration: underline; }
.link-btn {
  background: none; border: 0; padding: 0; color: #a3abc9; font-size: inherit;
  text-decoration: none;
}
.link-btn:hover { color: #fff; text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; color: #fff;
  transition: transform .08s ease, filter .15s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary { background: linear-gradient(90deg, var(--primary1), var(--primary2)); }
.btn.secondary { background: rgba(6,182,212,.22); border: 1px solid rgba(34,211,238,.5); }
.btn.ghost { background: transparent; border: 1px solid var(--panel-border); color: var(--muted); }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.mode-card .btn { margin-top: auto; }

/* ---------- Spiel ---------- */
.game-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: var(--panel); color: var(--text); font-size: 1.2rem;
}
.game-title { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.game-title strong { font-size: 1.15rem; }
.score { font-weight: 800; font-size: 1.15rem; background: var(--panel); padding: 8px 14px; border-radius: 12px; white-space: nowrap; }

.progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.dot { width: 22px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.14); transition: background .2s; }
.dot.now { background: #c7d2fe; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

.arena {
  position: relative; display: flex; gap: 14px;
  height: calc(100vh - 140px); min-height: 440px; max-height: 720px;
}
.card {
  position: relative; flex: 1; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--panel-border); background: var(--bg2);
  transition: box-shadow .25s, opacity .3s, transform .3s;
}
.card-bg {
  position: absolute; inset: -30px; background-size: cover; background-position: center;
  background-color: var(--bg2);
  filter: blur(22px) brightness(.52) saturate(1.3); transform: scale(1.08);
}
.card-bg.photo-bg {
  inset: 0; filter: brightness(.42) saturate(1.1); transform: none;
}
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,16,32,.18), rgba(11,16,32,.72));
}
.card-body {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px;
}
.c-map {
  position: absolute; right: 18px; top: 18px; width: 78px; height: 56px;
  object-fit: contain; opacity: .28; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.c-flag-wrap {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.c-flag {
  width: 150px; max-width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  background: rgba(255,255,255,.08);
}
.c-flag-code {
  display: inline-grid; place-items: center;
  width: 120px; aspect-ratio: 3 / 2; border-radius: 10px;
  font-size: 1.75rem; font-weight: 900; letter-spacing: .08em;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.c-name {
  margin: 0; max-width: 100%; overflow-wrap: break-word;
  font-size: clamp(1.5rem, 3.2vw, 2.4rem); letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.c-pre { margin: 6px 0 2px; color: #d6dcf5; }
.c-value { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; color: var(--gold); text-shadow: 0 2px 16px rgba(0,0,0,.5); font-variant-numeric: tabular-nums; }
.c-unit { margin: 4px 0 0; color: #d6dcf5; }
.c-buttons { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; width: min(260px, 90%); }
.choice { font-size: 1.1rem; padding: 14px; border-radius: 16px; backdrop-filter: blur(4px); }
.choice.hi { background: rgba(34,197,94,.22); border: 2px solid rgba(34,197,94,.8); }
.choice.lo { background: rgba(239,68,68,.20); border: 2px solid rgba(239,68,68,.8); }
.choice:hover { filter: brightness(1.25); }

.card.correct { box-shadow: inset 0 0 0 4px var(--ok), 0 0 40px rgba(34,197,94,.35); }
.card.wrong { box-shadow: inset 0 0 0 4px var(--bad), 0 0 40px rgba(239,68,68,.35); }

.vs {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #0b1020; font-weight: 900; font-size: 1.2rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); transition: background .2s, color .2s, transform .2s;
}
.vs.ok { background: var(--ok); color: #fff; transform: translate(-50%, -50%) scale(1.12); }
.vs.bad { background: var(--bad); color: #fff; transform: translate(-50%, -50%) scale(1.12); }

.arena.advance .card { opacity: 0; transform: translateX(-24px); }

/* ---------- Ergebnis ---------- */
.result-wrap { display: flex; justify-content: center; padding: 24px 0; }
.result-card {
  width: min(580px, 100%); text-align: center;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 26px 22px;
}
.result-card > p { margin: 8px 0; }
.big-score { font-size: 4.2rem; margin: 6px 0 0; line-height: 1; }
.big-score small { font-size: 1.4rem; color: var(--muted); font-weight: 600; }
.verdict { font-size: 1.25rem; font-weight: 700; }
.emoji-row { font-size: 1.6rem; letter-spacing: 2px; margin: 8px 0 14px; }
.stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 18px; }
.stats div { background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 16px; min-width: 105px; }
.stats strong { display: block; font-size: 1.25rem; }
.stats small { color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.duel { font-weight: 700; padding: 10px; border-radius: 12px; }
.duel.win { background: rgba(34,197,94,.18); }
.duel.draw { background: rgba(250,204,21,.15); }
.duel.lose { background: rgba(239,68,68,.15); }
.mistake { background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.35); border-radius: 14px; padding: 10px 14px; margin: 12px 0 16px; }
.mistake p { margin: 4px 0 0; }

.submit-box {
  text-align: left; background: rgba(255,255,255,.05); border: 1px solid var(--panel-border);
  border-radius: 16px; padding: 14px; margin: 12px 0 16px;
}
.submit-box h3 { margin: 0 0 4px; font-size: 1rem; }
.submit-row { display: flex; gap: 8px; margin-top: 10px; }
.submit-row input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--panel-border); background: rgba(0,0,0,.25); color: var(--text);
}
.result-board { text-align: left; margin-top: 14px; }
.result-board h3 { margin: 0 0 8px; font-size: 1rem; text-align: center; }

.recap { text-align: left; margin-top: 10px; }
.recap summary { cursor: pointer; color: #c7d2fe; font-weight: 600; text-align: center; }
.recap-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.recap-list li { display: flex; gap: 10px; background: rgba(255,255,255,.04); border-radius: 10px; padding: 8px 10px; font-size: .92rem; }
.recap-list i { color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,8,18,.72); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1; width: min(440px, 100%);
  background: #131a32; border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 1.3rem; }
.modal-tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab-btn {
  flex: 1; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(255,255,255,.04); color: var(--muted); font-weight: 600; font-size: .9rem;
}
.tab-btn.active { background: rgba(99,102,241,.25); border-color: rgba(129,140,248,.6); color: #fff; }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .9rem; }
.field input {
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(0,0,0,.28); color: var(--text);
}
.check-field { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; color: var(--muted); }
.check-field input { margin-top: 3px; }
.recovery-box {
  background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.45);
  border-radius: 12px; padding: 10px 12px; font-size: .9rem;
}
.recovery-box code { display: block; font-size: 1.15rem; font-weight: 800; color: #fff; margin-top: 4px; letter-spacing: .06em; }
.form-msg { margin: 0; font-size: .88rem; min-height: 1.1em; color: #fca5a5; }
.form-msg.ok { color: #86efac; }

/* ---------- Rechtliche Seiten ---------- */
.legal-wrap { max-width: 780px; margin: 20px auto; }
.legal-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 26px 24px; line-height: 1.6;
}
.legal-card h1 { margin-top: 0; }
.legal-card h2 { margin-top: 24px; font-size: 1.2rem; color: #c7d2fe; }
.legal-card .placeholder {
  background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.35);
  border-radius: 12px; padding: 10px 14px; font-size: .92rem;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px);
  background: #fff; color: #0b1020; font-weight: 700; padding: 12px 18px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: all .25s; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  #app { padding: 10px; }
  .mode-grid { grid-template-columns: 1fr; }
  .banner { flex-direction: column; align-items: stretch; }
  .banner-actions { justify-content: space-between; }
  .banner-actions .btn { flex: 1; }
  .arena { flex-direction: column; gap: 10px; height: calc(100dvh - 120px); min-height: 520px; }
  .card-body { padding: 12px; }
  .c-map { width: 52px; height: 40px; right: 10px; top: 10px; }
  .c-flag-wrap { margin-bottom: 8px; }
  .c-flag { width: 84px; border-radius: 7px; }
  .c-flag-code { width: 84px; font-size: 1.25rem; border-radius: 7px; }
  .c-pre { margin: 2px 0; font-size: .9rem; }
  .c-unit { font-size: .9rem; }
  .c-buttons { flex-direction: row; width: min(340px, 96%); margin: 8px 0 2px; }
  .choice { flex: 1; padding: 12px 8px; font-size: 1rem; }
  .vs { width: 52px; height: 52px; font-size: 1rem; }
  .arena.advance .card { transform: translateY(-20px); }
  .brand { padding: 14px 0 10px; }
  .submit-row { flex-direction: column; }
  .board-row { grid-template-columns: 32px 1fr auto; }
  .board-time { display: none; }
}
