:root {
  --paper: #f5f6f8;
  --sheet: #ffffff;
  --ink: #1b2330;
  --ink-2: #4a5568;
  --rule: #d6dbe2;
  --signal: #c8102e;
  --sicher: #2e7d4f;
  --abruf: #c27a00;
  --verstanden: #2f6db5;
  --offen: #c9cfd8;
  --focus: #2f6db5;
  --radius: 6px;
  --font: "Barlow", system-ui, sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161c;
    --sheet: #1a2029;
    --ink: #e6e9ee;
    --ink-2: #a3adbb;
    --rule: #2e3744;
    --signal: #ff5a6e;
    --sicher: #4fbf80;
    --abruf: #f0a530;
    --verstanden: #6ea4ea;
    --offen: #3a4452;
    --focus: #6ea4ea;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  padding-bottom: 76px; /* bottom nav on phones */
}
@media (min-width: 760px) { body { padding-bottom: 0; } }

a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-cond); font-weight: 600; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }

/* --- frame ------------------------------------------------------------- */
.top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: .9rem 16px; border-bottom: 1px solid var(--rule); background: var(--sheet);
}
.brand { font-family: var(--font-cond); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.countdown { font-family: var(--font-cond); font-size: 1.05rem; color: var(--ink-2); white-space: nowrap; }
.countdown b { font-size: 1.6rem; color: var(--ink); font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 1.25rem 16px 2rem; }

.nav { display: flex; gap: .25rem; }
.nav a {
  text-decoration: none; font-family: var(--font-cond); font-weight: 600; font-size: 1.05rem;
  padding: .35rem .7rem; border-radius: var(--radius); color: var(--ink-2);
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper); }
.nav .badge { margin-left: .25rem; }
.nav-top { display: none; }
@media (min-width: 760px) { .nav-top { display: flex; } }
.nav-bottom {
  position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--sheet); border-top: 1px solid var(--rule);
  justify-content: space-around; padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom));
}
.nav-bottom a { flex: 1; text-align: center; padding: .55rem .2rem; }
@media (min-width: 760px) { .nav-bottom { display: none; } }

.badge {
  display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px;
  background: var(--signal); color: #fff; font: 600 .8rem/1.5 var(--font); text-align: center;
}

/* --- progress strip: the one loud element -------------------------------- */
.strip { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--offen); }
.strip span { display: block; height: 100%; }
.strip .s { background: var(--sicher); }
.strip .a { background: var(--abruf); }
.strip .v { background: var(--verstanden); }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--ink-2); margin-top: .35rem; }
.legend i { display: inline-block; width: .7em; height: .7em; border-radius: 2px; margin-right: .3em; vertical-align: baseline; }

.stations { display: grid; gap: 1.1rem; margin: 1rem 0 0; }
.station-row a { text-decoration: none; }
.station-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .3rem; }
.station-head .name { font-family: var(--font-cond); font-weight: 600; font-size: 1.15rem; }
.station-head .pct { font-family: var(--font-cond); font-size: 1.05rem; color: var(--ink-2); }
.station-head .pct b { color: var(--ink); font-size: 1.3rem; }

/* --- blocks -------------------------------------------------------------- */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; }
.sheet + .sheet { margin-top: 1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin: 1rem 0; }
.fact { border-left: 3px solid var(--rule); padding-left: .7rem; }
.fact b { display: block; font-family: var(--font-cond); font-size: 1.9rem; line-height: 1.1; }
.fact.alert { border-left-color: var(--signal); }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.list > li { border-bottom: 1px solid var(--rule); }
.row {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .25rem; min-height: 48px;
}
.row .title { flex: 1; min-width: 0; text-decoration: none; }
.row .title:hover { text-decoration: underline; }
.row .meta { font-size: .85rem; color: var(--ink-2); }

.chip {
  flex: none; font: 600 .78rem/1 var(--font); padding: .3rem .5rem; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap;
}
.chip.offen { color: var(--ink-2); border-color: var(--rule); }
.chip.verstanden { color: var(--verstanden); }
.chip.abruf { color: var(--abruf); }
.chip.sicher { color: #fff; background: var(--sicher); border-color: var(--sicher); }
.chip.due { color: #fff; background: var(--signal); border-color: var(--signal); }
.lvl {
  flex: none; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 4px;
  font: 700 .8rem/1 var(--font-cond); color: var(--ink-2); border: 1px solid var(--rule);
}

/* --- forms & buttons ----------------------------------------------------- */
button, .button {
  font: 600 1rem/1.2 var(--font); border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--sheet); color: var(--ink); padding: .65rem 1rem; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px;
}
button:hover, .button:hover { border-color: var(--ink-2); }
.button.primary, button.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.button.small, button.small { min-height: 34px; padding: .35rem .7rem; font-size: .9rem; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--ink-2); text-decoration: underline; font-weight: 400; }

.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.rate button { flex-direction: column; min-height: 72px; font-size: .95rem; }
.rate button .sym { font-size: 1.5rem; line-height: 1; }
.rate .wrong { border-color: var(--signal); color: var(--signal); }
.rate .unsure { border-color: var(--abruf); color: var(--abruf); }
.rate .right { border-color: var(--sicher); color: var(--sicher); }
.rate.compact button { min-height: 44px; flex-direction: row; padding: .3rem; }
.rate.compact button .sym { font-size: 1.15rem; }

label { display: block; font-weight: 600; margin: .9rem 0 .3rem; }
input, select, textarea {
  width: 100%; font: 400 1rem/1.4 var(--font); color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .7rem; min-height: 44px;
}
textarea { min-height: 7rem; resize: vertical; }
.preparation-form { flex: none; }
.preparation-form label { display: flex; align-items: center; gap: .5rem; margin: 0; min-height: 44px; cursor: pointer; }
.preparation-form input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--verstanden); cursor: pointer; }
.preparation-form input:disabled { opacity: .5; }
.row .preparation-form label { min-width: 36px; justify-content: center; }
fieldset { border: 0; padding: 0; margin: .9rem 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .3rem; }
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.choices label { margin: 0; font-weight: 400; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices span {
  display: inline-block; padding: .5rem .8rem; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer;
  background: var(--sheet);
}
.choices input:checked + span { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.choices input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.tabs { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; margin: 0 -16px 1rem; padding-left: 16px; padding-right: 16px; }
.tabs a {
  flex: none; text-decoration: none; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--rule);
  font-weight: 600; font-size: .95rem; background: var(--sheet);
}
.tabs a[aria-current="page"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input { flex: 1 1 12rem; width: auto; }
.filters select { width: auto; }

.notice { border-left: 3px solid var(--sicher); background: var(--sheet); padding: .7rem 1rem; margin-bottom: 1rem; }
.notice.error { border-left-color: var(--signal); }

/* --- item page ----------------------------------------------------------- */
.item-head { margin-bottom: 1rem; }
.item-head .crumbs { font-size: .9rem; color: var(--ink-2); margin-bottom: .3rem; }
.item-head h1 { font-size: 2.1rem; }
.flags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.steps { margin: 0; padding-left: 1.4rem; }
.steps li { padding: .15rem 0; }
.pager { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1.5rem; }
.history { font-size: .9rem; color: var(--ink-2); }
.sym-wrong { color: var(--signal); } .sym-unsure { color: var(--abruf); } .sym-right { color: var(--sicher); }

/* --- compare ------------------------------------------------------------- */
.versus { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .versus { grid-template-columns: 1fr 1fr; } }
.versus .who { font-family: var(--font-cond); font-size: 1.5rem; font-weight: 700; margin-bottom: .2rem; }
.bar { height: 8px; background: var(--offen); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ink); }
.counter { margin: .6rem 0; }
.counter .line { display: flex; justify-content: space-between; font-size: .95rem; margin-bottom: .2rem; }

.login { max-width: 360px; margin: 12vh auto 0; }

@media (prefers-reduced-motion: no-preference) {
  .rated { animation: settle .35s ease-out; }
  @keyframes settle { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
