:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel2: #1d2237;
  --text: #e8eaf6;
  --muted: #8d93ab;
  --accent: #ff9f43;
  --accent2: #45d48d;
  --danger: #ff5c7c;
  --chip: #232a45;
  --chip-active: #ff9f43;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 700px at 70% -10%, #23284a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.screen { display: none; padding: 24px 12px 48px; }
.screen.active { display: block; }
.wrap { max-width: 760px; margin: 0 auto; }

.title {
  font-size: 44px; font-weight: 800; letter-spacing: 2px;
  margin: 18px 0 4px;
  background: linear-gradient(90deg, #ff9f43, #ff5c7c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title.small { font-size: 30px; margin-bottom: 8px; }
.subtitle { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }

.panel { background: var(--panel); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; color: var(--muted); font-weight: 600; }
.hint { font-weight: 400; font-size: 13px; }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid #3a4160; background: var(--chip); color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-size: 15px; cursor: pointer;
  transition: transform .12s, background .12s;
}
.chip:hover { transform: translateY(-1px); }
.chip.active {
  background: var(--chip-active); border-color: var(--chip-active);
  color: #1b1300; font-weight: 700;
}

.setup-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.poolcount { color: var(--muted); }
.poolcount.warn { color: var(--danger); }

.rules { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 20px; }

.btn {
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 15px;
  cursor: pointer; font-family: inherit;
}
.btn.primary { background: var(--accent); color: #1b1300; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid #3a4160; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.cost { color: var(--muted); font-size: 12px; }

/* ---------- HUD ---------- */
.hud {
  display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center;
  background: var(--panel); border-radius: 14px; padding: 12px 18px; margin-bottom: 16px;
}
.hud-item { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.hud-value { font-size: 22px; font-weight: 700; }
.hud-timer { flex: 1 1 120px; height: 10px; background: #232a45; border-radius: 999px; overflow: hidden; }
.timerbar { height: 100%; width: 100%; background: linear-gradient(90deg, #45d48d, #ff9f43); border-radius: 999px; transition: width .2s linear; }
.timerbar.low { background: linear-gradient(90deg, #ff5c7c, #ff9f43); }

/* ---------- Card ---------- */
.card { background: var(--panel); border-radius: 16px; padding: 22px; }
.card-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag {
  background: var(--chip); color: var(--muted); border-radius: 999px;
  padding: 5px 12px; font-size: 13px;
}
.masked {
  font-family: "Consolas", "Menlo", monospace;
  font-size: 30px; font-weight: 700; letter-spacing: 2px;
  line-height: 1.25; word-break: break-all;
  margin: 8px 0 16px;
  color: #fff;
  background: #101322; border-radius: 10px; padding: 18px 16px;
  border: 1px solid #2a3050;
}
.masked .letter { display: inline-block; }
.masked .letter.num { color: var(--accent2); }
.hintletters { margin: -8px 0 12px; color: var(--accent); font-size: 20px; letter-spacing: 12px; font-family: monospace; }
.hintletters.hidden, .reveal.hidden, #btn-next.hidden, #action-area.hidden, #answer-area.hidden { display: none !important; }

#answer-area { display: flex; gap: 10px; }
#answer {
  flex: 1; background: #101322; border: 1px solid #2a3050; color: var(--text);
  border-radius: 10px; padding: 12px 14px; font-size: 17px; font-family: inherit;
}
#answer:focus { outline: none; border-color: var(--accent); }
#action-area { display: flex; gap: 10px; margin-top: 12px; }

.reveal {
  margin: 14px 0; padding: 14px 16px; border-radius: 12px; font-size: 16px;
}
.reveal.good { background: #123122; border: 1px solid #45d48d; }
.reveal.bad  { background: #2b1522; border: 1px solid #ff5c7c; }
.reveal .solution { font-weight: 700; font-size: 18px; margin-top: 4px; }
.reveal .meta { color: var(--muted); font-weight: 400; font-size: 15px; }
.reveal .pts { color: var(--accent2); font-weight: 700; }
.reveal .pts.zero { color: var(--muted); }
#btn-next { margin-top: 6px; }
#btn-next, #reveal { display: block; }

/* ---------- Result ---------- */
.stats { display: flex; gap: 12px; margin-bottom: 18px; }
.stat { flex: 1; background: var(--panel); border-radius: 14px; padding: 16px; text-align: center; }
.stat-value { display: block; font-size: 26px; font-weight: 800; }
.stat-value.bigstat { font-size: 34px; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; }

.resultlist { list-style: none; margin: 0 0 20px; padding: 0; }
.resultlist li {
  background: var(--panel); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
  display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
}
.resultlist li .mask { font-family: monospace; color: var(--muted); }
.resultlist li .sol { font-weight: 600; }
.resultlist li .pts { font-weight: 700; color: var(--accent2); white-space: nowrap; }
.resultlist li.miss .pts { color: var(--danger); }
.result-actions { display: flex; gap: 12px; justify-content: center; }

/* ---------- Feineinstellungen / Hilfe (Phase 1) ---------- */
.settings { display: flex; flex-direction: column; gap: 12px; }
.setting-row { display: flex; flex-direction: column; gap: 6px; }
.setting-label { font-size: 13px; color: var(--muted); }
.settings .chip { padding: 5px 12px; font-size: 14px; }
.helpline { margin: -4px 0 12px; color: var(--accent2); font-size: 16px; }
.helpline.hidden { display: none !important; }
.helpline .note { color: var(--muted); font-size: 13px; }
.hintletters .lbl { letter-spacing: normal; font-family: inherit; font-size: 14px; color: var(--muted); margin-right: 8px; }
.tag.hidden { display: none; }
.reveal .note { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- Phase 2: Modi, Ansichten, Effekte ---------- */
.hidden { display: none !important; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.navrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.sound-toggle.on { border-color: var(--accent2); color: var(--accent2); }
.hint.desc { margin: 10px 0 0; color: var(--muted); }

.hud-item.low .hud-value { color: var(--danger); }
.hud-value.lives { letter-spacing: 2px; font-size: 18px; }
.hud-item.streak-1 .hud-value { color: var(--accent); text-shadow: 0 0 10px rgba(255,159,67,.6); }
.hud-item.streak-2 .hud-value { color: #ffd166; text-shadow: 0 0 16px rgba(255,209,102,.8); }
.hud-item.streak-3 .hud-value { color: #ff5c7c; text-shadow: 0 0 22px rgba(255,92,124,.95); }
.hud-item.pop .hud-value { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.streakbanner { color: var(--accent); font-weight: 800; font-size: 18px; margin-top: 4px; animation: pop .6s ease-out; }

.result-reason { color: var(--muted); margin: 0 0 14px; }
.subhead { font-size: 15px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.rankline { font-weight: 700; color: var(--accent2); margin: 0 0 10px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.empty { color: var(--muted); }
.warn { color: var(--danger); }
.namerow { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.namerow input {
  background: #101322; border: 1px solid #2a3050; color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 16px; font-family: inherit; max-width: 280px;
}
.namerow input:focus { outline: none; border-color: var(--accent); }

table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 8px; }
.board td { padding: 7px 8px; border-top: 1px solid #232a45; }
.board td.rank, .board th.rank { width: 56px; }
.board td.score { font-weight: 700; color: var(--accent2); }
.board tr.me td { background: #2b2412; }
.board tr.me td.name { font-weight: 700; color: var(--accent); }
.badge { background: var(--accent); color: #1b1300; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 8px; margin-left: 8px; }
.boardlabel { margin: 0 0 8px; color: var(--text); font-weight: 600; }
.tabs { margin-bottom: 14px; }
.viewbody { background: var(--panel); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }

.barrow { display: grid; grid-template-columns: 110px 1fr 120px; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.bartrack { height: 12px; background: #232a45; border-radius: 999px; overflow: hidden; }
.barfill { height: 100%; background: linear-gradient(90deg, #45d48d, #ff9f43); border-radius: 999px; }
.barvalue { color: var(--muted); text-align: right; }
.resetbox { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.achlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ach { display: flex; gap: 12px; align-items: center; background: #101322; border-radius: 10px; padding: 10px 14px; border: 1px solid #232a45; }
.ach.on { border-color: var(--accent2); }
.ach.off { opacity: .55; }
.achicon { font-size: 26px; width: 34px; text-align: center; }
.achtext { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.achdesc, .achstate { color: var(--muted); font-size: 13px; }

.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast {
  background: #1d2237; border: 1px solid var(--accent2); color: var(--text); border-radius: 12px;
  padding: 12px 16px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.45);
  animation: slidein .35s ease-out;
}
.toast.out { opacity: 0; transition: opacity .35s; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 30; display: none; }
.confetti.on { display: block; }

@media (max-width: 560px) {
  .barrow { grid-template-columns: 80px 1fr 90px; }
  .stats { flex-wrap: wrap; }
}

/* Weniger Bewegung: keine Animationen, Hervorhebungen bleiben als Farbe sichtbar (Konfetti: effects.js) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Phase 3: Kategorien und eigene Listen ---- */
.import-panel .filepick { max-width: 100%; margin: 6px 0; color: inherit; }
.importstatus { margin: 6px 0; font-size: 0.95rem; }
.importstatus.warn { color: var(--danger); }
.importerrors { margin: 4px 0 10px; padding-left: 1.2em; font-size: 0.9rem; max-height: 14em; overflow: auto; }
.customlists { list-style: none; margin: 0; padding: 0; }
.customlists li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.customlists .listname { font-weight: 600; overflow-wrap: anywhere; }
.customlists .listcount { opacity: .7; margin-right: auto; }
.customlists li.empty { opacity: .7; border-bottom: 0; }
