/* tibbing — WM-2026-Tipprunde. Klar, kompakt, gut lesbar. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16202a;
  --muted: #6b7a89;
  --line: #e2e8ee;
  --primary: #0a7d4f;        /* Rasen-Grün */
  --primary-ink: #ffffff;
  --accent: #1769d6;
  --tipped: #eafaf2;
  --tipped-line: #9bd9bd;
  --w: #15a05a; --d: #c9a227; --l: #d7493a;
  --shadow: 0 1px 3px rgba(20,32,42,.08), 0 1px 2px rgba(20,32,42,.04);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 24px; }
.err { color: var(--l); }

/* --- Buttons / Inputs --- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 8px 12px; font: inherit; cursor: pointer;
}
.btn:hover { border-color: #c7d2dc; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.btn.danger { color: var(--l); }
.btn.danger:hover { background: #fdecea; border-color: #f2b6ae; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.inp {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink);
}
.inp:focus, .score-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }

/* --- Panels (Fehler/Level/Admin) --- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 14px; }
.loading { padding: 20vh 0; text-align: center; color: var(--muted); }

/* --- Level-Auswahl --- */
.level-pick { max-width: 640px; margin: 6vh auto; }
.level-cards { display: grid; gap: 12px; margin-top: 14px; }
.level-card { text-align: left; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; cursor: pointer; transition: .12s; }
.level-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.level-num { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); font-weight: 700; }
.level-title { font-size: 17px; font-weight: 650; margin: 2px 0; }
.level-desc { color: var(--muted); font-size: 14px; }

/* --- Topbar / Progress --- */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 14px 12px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 980px; margin: 0 auto; }
.brand { font-weight: 700; font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.save-ind { font-size: 12.5px; color: var(--muted); min-width: 78px; text-align: right; }
.save-ind.saved { color: var(--primary); }
.save-ind.error { color: var(--l); }

.progress-wrap { max-width: 980px; margin: 10px auto 0; display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 9px; background: #e7edf2; border-radius: 999px; overflow: hidden; }
.progress-bar.sm { height: 7px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #18a86a); transition: width .25s; }
.progress-text { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 92px; text-align: right; }

/* --- Toolbar --- */
.toolbar { max-width: 980px; margin: 12px auto 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .inp { padding: 7px 9px; font-size: 14px; }
.toolbar .btn { padding: 7px 11px; font-size: 14px; }

/* --- Liste / Match-Karten --- */
.list { max-width: 980px; margin: 12px auto 40px; display: grid; gap: 10px; padding: 0 14px; }
.match {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "home score away" "meta meta meta";
  align-items: center; gap: 6px 12px; padding: 12px 14px;
}
.match.tipped { background: var(--tipped); border-color: var(--tipped-line); }
.match.knew-on { box-shadow: inset 3px 0 0 var(--d), var(--shadow); }

.team { display: flex; align-items: center; gap: 9px; min-width: 0; }
.team.home { grid-area: home; justify-content: flex-end; text-align: right; }
.team.away { grid-area: away; justify-content: flex-start; }
.team.home .rank { order: -1; }
.flag { width: 28px; height: 20px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: none; }
.flag.sm { width: 20px; height: 14px; }
.flag.ph { display: inline-flex; align-items: center; justify-content: center; background: #e7edf2; color: var(--muted); font-size: 12px; }
.tname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 7px; flex: none; }

.score { grid-area: score; display: flex; align-items: center; gap: 6px; }
.score-input {
  width: 42px; height: 40px; text-align: center; font-size: 19px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); padding: 0;
}
.colon { font-weight: 700; color: var(--muted); }

.match-meta { grid-area: meta; display: flex; align-items: center; gap: 12px; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }
.grp { font-size: 12px; font-weight: 700; color: var(--muted); background: #eef3f7; border-radius: 6px; padding: 2px 7px; }
.info-btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 26px; height: 26px; cursor: pointer; color: var(--accent); font-weight: 700; }
.knew { margin-left: auto; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* --- Detail-Panel --- */
.detail { grid-area: meta; grid-row: auto; margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match.open .match-meta { margin-bottom: 2px; }
.tdetail { border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fbfdfe; }
.tdetail-h { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.drow { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 2px 0; }
.dk { color: var(--muted); }
.dv { text-align: right; font-weight: 600; }
.form-dots { display: inline-flex; gap: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.w { background: var(--w); }
.dot.d { background: var(--d); }
.dot.l { background: var(--l); }

.foot { padding: 16px; font-size: 13px; }

/* ============ ADMIN ============ */
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 6px 6px 60px; }
.admin .panel { margin: 14px 8px; }
.row-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-inline.between { justify-content: space-between; }
.link-out { margin-top: 10px; }
.link-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--tipped); border: 1px solid var(--tipped-line); border-radius: 9px; padding: 8px 10px; }
.link-card code { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 13px; word-break: break-all; }

.level-block { margin-top: 12px; }
.level-block-h { font-weight: 700; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.lvl-1 .level-block-h { border-color: #b9d8ff; }
.lvl-2 .level-block-h { border-color: #ffe0a6; }
.lvl-3 .level-block-h { border-color: #b6e7cd; }

.user-row { display: grid; grid-template-columns: 1.4fr 1.6fr 1.4fr auto; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.user-row.done { background: var(--tipped); border-radius: 8px; }
.u-name { font-weight: 600; }
.knew-badge { font-size: 12px; color: var(--d); font-weight: 700; }
.u-prog { display: flex; align-items: center; gap: 8px; }
.u-prog-txt { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.u-saved { font-size: 12.5px; }
.u-actions { display: flex; gap: 5px; justify-content: flex-end; }

.atable { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; }
.atable th, .atable td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.atable th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.atable tbody tr:last-child { font-weight: 700; background: #f7fafb; }

.an-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.an-cols h4 { margin: 0 0 6px; }
.mline { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ml-grp { font-size: 11px; font-weight: 700; color: var(--muted); }
.ml-ag { color: var(--muted); white-space: nowrap; font-size: 12.5px; }

/* --- Modal (Tipp-Editor) --- */
.overlay { position: fixed; inset: 0; background: rgba(20,32,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: min(720px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-h, .modal-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-f { border-top: 1px solid var(--line); border-bottom: none; }
.edit-list { overflow: auto; padding: 6px 14px; }
.edit-row { display: grid; grid-template-columns: 48px 1fr auto 1fr 90px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.er-grp { font-size: 11px; font-weight: 700; color: var(--muted); }
.er-team { text-align: right; font-weight: 600; }
.er-team.away { text-align: left; }
.er-score { display: flex; align-items: center; gap: 5px; }
.edit-row .score-input { width: 36px; height: 32px; font-size: 16px; }
.er-knew { font-size: 12px; color: var(--muted); }

/* --- Toast --- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: .25s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Responsive --- */
@media (max-width: 620px) {
  .tname { font-size: 14px; }
  .team { gap: 6px; }
  .flag { width: 24px; height: 17px; }
  .detail { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr auto; grid-template-areas: "name actions" "prog prog" "saved saved"; }
  .u-name { grid-area: name; } .u-actions { grid-area: actions; } .u-prog { grid-area: prog; } .u-saved { grid-area: saved; }
  .an-cols { grid-template-columns: 1fr; }
  .edit-row { grid-template-columns: 40px 1fr auto 1fr; }
  .er-knew { grid-column: 2 / -1; text-align: right; }
}

/* ============ MOBILE-FIRST TIPPER (EINZELSPIEL-STEPPER) ============ */
.tip-app { height: 100dvh; display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; background: var(--card); }
@media (min-width: 620px) { .tip-app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.tip-head { flex: none; padding: 10px 14px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.tip-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand.sm { font-weight: 700; font-size: 15px; }
.tip-head-right { display: flex; align-items: center; gap: 8px; }
.progress-wrap.tip { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.inp.slim { width: 100%; padding: 7px 9px; font-size: 13.5px; }

.tip-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }

/* Score-Header mit Live-Tipp */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 4px 0 16px; }
.vs-team { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.vs-flag { width: 56px; height: 40px; object-fit: cover; border-radius: 5px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.vs-flag.ph { display: inline-flex; align-items: center; justify-content: center; background: #e7edf2; color: var(--muted); font-size: 20px; }
.vs-name { font-weight: 700; font-size: 14px; text-align: center; line-height: 1.15; }
.vs-score { font-size: 36px; font-weight: 800; display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.vs-colon { color: var(--muted); }

/* Touch-Nummernpads */
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.pad-label { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pad-btn { min-height: 48px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 19px; font-weight: 700; color: var(--ink); cursor: pointer; transition: transform .05s; -webkit-tap-highlight-color: transparent; }
.pad-btn:active { transform: scale(.95); }
.pad-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pad-btn.pad-range { background: #eef3f7; color: var(--accent); font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.pad-btn.pad-range:active { transform: scale(.95); }

.knew-row { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px; border: 1px dashed var(--line); border-radius: 10px; font-size: 14px; color: var(--muted); margin-bottom: 14px; cursor: pointer; }
.knew-row input { width: 18px; height: 18px; }

.infos { display: grid; gap: 10px; }

/* Sticky Fuß mit Navigation */
.tip-foot { flex: none; display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--card); }
.btn.nav { padding: 12px 8px; font-size: 15px; font-weight: 600; }
.btn.nav:disabled { opacity: .4; cursor: default; }
.btn.nav.mid { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.nav-sub { font-size: 11px; color: var(--muted); font-weight: 500; }

/* Übersichts-Sheet (72 Felder) */
.sheet { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: 84vh; display: flex; flex-direction: column; overflow: hidden; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sheet-legend { padding: 8px 14px 0; }
.dot-grid { overflow: auto; padding: 12px 14px 16px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.nav-dot { aspect-ratio: 1; border: 1px solid var(--line); background: #f1f5f8; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.nav-dot.tipped { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav-dot.knew { box-shadow: inset 0 0 0 2px var(--d); }
.nav-dot.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
