/* =========================================================================
   Zockbox – Grundgerüst für Startseite, Statistik und Fehlerseite.

   Ruhig und knapp: weiße Fläche, eine Haarlinie, eine Akzentfarbe,
   Inter als Schrift. Keine Schatten, keine Muster, keine Verläufe.
   Spiele laden diese Datei nicht.
   ========================================================================= */

@import url('fonts.css');

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --line: #e9e9e5;
  --line-2: #d8d8d2;
  --ink: #15171a;
  --ink-2: #3a3f45;
  --muted: #6d7378;
  --faint: #9aa0a5;
  --accent: #0f62d6;
  --accent-d: #0b51b3;
  --accent-soft: #eef4fe;
  --accent-line: #cadeff;
  --danger: #b3261e;
  --ok: #1c7a4d;
  --r: 10px;
  --r-sm: 6px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --wrap: 880px;
  --pad: max(18px, env(safe-area-inset-left));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: #d9e7ff; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-left: var(--pad); padding-right: max(18px, env(safe-area-inset-right)); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Kopfzeile ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  height: 62px; padding-left: var(--pad); padding-right: max(18px, env(safe-area-inset-right));
}
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; color: var(--ink); }
.logo-mark {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 7px; background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: 0;
}
.bar-nav { display: flex; align-items: center; gap: 2px; margin-left: 14px; }
.bar-nav a {
  height: 32px; padding: 0 10px; display: inline-flex; align-items: center;
  border-radius: var(--r-sm); color: var(--muted); font-size: 14px;
}
.bar-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.bar-nav a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }

/* Sprachumschalter (i18n.js setzt .zb-lang überall ein) */
.zb-lang { display: inline-flex; gap: 1px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.zb-lang button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 10.5px/1 var(--font); letter-spacing: .06em; padding: 5px 7px; border-radius: 999px; }
.zb-lang button:hover { color: var(--ink); }
.zb-lang button[aria-pressed="true"] { background: #fff; color: var(--accent); box-shadow: 0 0 0 1px var(--line); }

/* Profilknopf */
.me {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 11px 0 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 13.5px; max-width: 190px;
}
.me:hover { border-color: var(--line-2); background: var(--surface-2); }
.me-av { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 16px; line-height: 1; }
.me-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Seite ---------- */
.page { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 44px max(18px, env(safe-area-inset-right)) 40px var(--pad); }
.h1 { font-size: clamp(27px, 3.4vw, 34px); }
.lead { margin-top: 8px; color: var(--muted); font-size: 15.5px; max-width: 44em; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 12px; }
.sec h2 { font-size: 17px; }
.sec-note { color: var(--muted); font-size: 12.5px; }

/* Karte */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h2 { font-size: 15px; }
.card-h .card-note { color: var(--muted); font-size: 12.5px; text-align: right; }
.card-b { padding: 16px 18px; }
.card-b > * + * { margin-top: 14px; }

/* ---------- Formulare ---------- */
.lbl { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.inp {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
.inp::placeholder { color: var(--faint); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp-sm { height: 34px; font-size: 13.5px; padding: 0 9px; }
textarea.inp { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
select.inp { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.6 6 7.8l3-3.2' fill='none' stroke='%236d7378' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2b3036; border-color: #2b3036; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 0 9px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 5px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: progress; }
.btn-icon { width: 44px; padding: 0; font-size: 17px; }
.btn-danger { color: var(--danger); border-color: #e7cdca; }
.btn-danger:hover { background: #fdf4f3; color: var(--danger); }
.btn svg { width: 16px; height: 16px; flex: none; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-tight { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 0; min-width: 0; }

/* Zeile: Text links, Bedienelement rechts */
.opt { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.opt:last-child { border-bottom: 0; }
.opt-tx { min-width: 0; }
.opt-tx b { display: block; font-weight: 500; font-size: 14px; }
.opt-tx span { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.opt-side { flex: none; display: flex; align-items: center; gap: 8px; }
.card-b > .opt:first-child { padding-top: 0; }

/* Schalter */
.sw { flex: none; position: relative; width: 40px; height: 23px; padding: 0; border: 0; border-radius: 999px; background: #d9dbde; transition: background .15s; }
.sw i { position: absolute; left: 2px; top: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); transition: transform .16s; }
.sw[aria-checked="true"] { background: var(--ink); }
.sw[aria-checked="true"] i { transform: translateX(17px); }
.sw[disabled], .sw[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 32px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500;
}
.chip:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip img { width: 15px; height: 15px; border-radius: 3px; }

/* Auswahl-Kacheln (Looks) */
.picks { display: grid; gap: 8px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: inherit;
}
.pick:hover { border-color: var(--line-2); }
.pick.on { border-color: var(--ink); }
.pick-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.pick-ic img { width: 22px; height: 22px; }
.pick-tx { min-width: 0; padding-right: 16px; }
.pick-tx b { display: block; font-weight: 500; font-size: 13.5px; }
.pick-tx small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.pick-tick { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink); font-size: 13px; opacity: 0; }
.pick.on .pick-tick { opacity: 1; }

/* Hinweise */
.note { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.note b { font-weight: 600; color: var(--ink-2); }
.note-warn { background: #fdf8ea; border-color: #ecdfb8; color: #6a5518; }
.note-ok { background: #eef7f1; border-color: #cce3d6; color: #1d5c3c; }
.note-err { background: #fdf2f1; border-color: #eccbc7; color: #8c2a22; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); font: 500 11.5px/1 var(--font); color: var(--ink); }

/* Zahlen */
.stat-cell b { display: block; font-size: 25px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-cell b small { font-size: 13px; font-weight: 400; color: var(--faint); letter-spacing: 0; }
.stat-cell span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.stats-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-strip .stat-cell { padding: 12px 0; }
.stats-strip .stat-cell + .stat-cell { padding-left: 16px; border-left: 1px solid var(--line); }
.meter { height: 5px; border-radius: 99px; background: #eeece8; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--ink); }

/* Tabelle */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .me-row td { background: var(--surface-2); }
.tbl .sub { color: var(--muted); font-size: 12px; }

/* Leerzustand */
.empty { padding: 32px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .empty-ic { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--line-2); }
.empty b { display: block; color: var(--ink); font-weight: 500; font-size: 14.5px; margin-bottom: 3px; }

/* Fuß */
.foot { margin-top: 40px; padding: 18px max(18px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) var(--pad); border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; width: 100%; max-width: var(--wrap); margin: 0 auto; }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.foot-links a { color: var(--ink-2); }
.foot-small { color: var(--faint); font-size: 11.5px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 120; max-width: min(420px, calc(100vw - 24px));
  padding: 10px 15px; border-radius: var(--r-sm);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500;
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Dialog */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(20, 22, 26, .3); animation: fadeIn .14s ease-out; }
@keyframes fadeIn { from { opacity: 0; } }
.dialog {
  position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 18, 22, .18);
}
.dialog-h { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.dialog-h h2 { font-size: 18px; }
.dialog-h p { margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.dialog-b { padding: 18px 22px; }
.dialog-b > * + * { margin-top: 12px; }
.dialog-wide { width: min(760px, 100%); }
.x { flex: none; margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.x:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Einstellungen: breites Fenster, zwei Spalten ---------- */
.dialog.settings { width: min(940px, 100%); }
.settings-body { display: grid; gap: 26px; padding: 20px 22px 24px; grid-template-columns: 1fr; }
.col-h {
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 10px;
}
.col-h:not(:first-child) { margin-top: 26px; }
.settings-col { min-width: 0; }
@media (min-width: 820px) {
  .settings-body { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 34px; }
  .settings-col-tarn { border-left: 1px solid var(--line); padding-left: 30px; }
  .col-h:first-child { margin-top: 0; }
}

@media (min-width: 700px) {
  .stats-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .bar-in { height: 56px; }
  .bar-nav { display: none; }
  .me-tx { display: none; }
  .me { padding: 0 5px; height: 34px; }
  .page { padding-top: 28px; }
  .foot { margin-top: 28px; }
  .opt { gap: 12px; }
  .tbl th, .tbl td { padding-left: 0; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .bar, .foot, .no-print { display: none !important; }
  body { background: #fff; }
}
