/* ───────────────────────── Fonts (lokal, keine Google-Requests) */
@font-face {
  font-family: 'Archivo';
  src: url(fonts/archivo.woff2) format('woff2');
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Big Shoulders';
  src: url(fonts/bigshoulders.woff2) format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* ───────────────────────── Tokens */
:root {
  --paper: #F1ECE1;
  --paper-2: #E6DFCF;
  --card: #FBF8F1;
  --ink: #17150F;
  --ink-2: #4B463C;
  --ink-3: #8A8373;
  --line: rgba(23, 21, 15, .13);
  --track: #C9442A;
  --track-deep: #A63520;
  --lane-white: #FBF8F1;
  --hi: #FFE04A;
  --hi-ink: #17150F;
  --good: #1F7A4B;
  --shadow: 0 1px 0 rgba(23,21,15,.06), 0 10px 24px -14px rgba(23,21,15,.35);

  --display: 'Big Shoulders', 'Archivo', Impact, sans-serif;
  --body: 'Archivo', ui-sans-serif, sans-serif;

  --r: 14px;
  --gutter: 16px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13110D;
    --paper-2: #221F19;
    --card: #1C1915;
    --ink: #F1ECE1;
    --ink-2: #CBC3B2;
    --ink-3: #8D8575;
    --line: rgba(241, 236, 225, .11);
    --track: #C9442A;
    --track-deep: #9E321E;
    --good: #4FBF83;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 30px -18px rgba(0,0,0,.9);
    color-scheme: dark;
  }
}

/* ───────────────────────── Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
  overflow-x: hidden;
}
/* Papierkorn */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; opacity: .35; } }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }

/* ───────────────────────── Hero: die Tartanbahn */
.hero {
  position: relative;
  overflow: hidden;
  color: var(--lane-white);
  background-color: var(--track);
  background-image:
    radial-gradient(rgba(0,0,0,.16) 1px, transparent 1.4px),
    radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.4px),
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,.18));
  background-size: 5px 5px, 7px 7px, 100% 100%;
  background-position: 0 0, 2px 3px, 0 0;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 0 70px;
}
.hero-lanes {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  pointer-events: none;
}
.hero-lanes span {
  border-bottom: 2px solid rgba(251, 248, 241, .22);
  font: 700 64px/1 var(--display);
  color: rgba(251, 248, 241, .07);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 14px;
  transform: skewX(-8deg);
}
.hero-lanes span:first-child { border-top: 2px solid rgba(251, 248, 241, .22); }

.hero-inner {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  font-stretch: 80%;
  text-transform: uppercase;
  letter-spacing: .14em;
  opacity: .85;
}
.hero h1 {
  font: 700 clamp(40px, 12vw, 58px)/.9 var(--display);
  text-transform: uppercase;
  letter-spacing: .005em;
  margin-top: 6px;
  text-wrap: balance;
}
.hero-tools { display: flex; align-items: center; gap: 8px; padding-top: 2px; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 6px 9px;
  border-radius: 99px;
  background: rgba(0,0,0,.2);
  white-space: nowrap;
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--hi); }
.live[data-state="live"] i { animation: pulse 2s ease-in-out infinite; }
.live[data-state="connecting"] i { background: rgba(255,255,255,.5); }
.live[data-state="offline"] i { background: #1a1a1a; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 224, 74, .7); } 50% { box-shadow: 0 0 0 5px rgba(255, 224, 74, 0); } }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.2);
  display: grid; place-items: center;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.score { display: flex; align-items: flex-end; gap: 14px; margin-top: 14px; }
.score-pct {
  font: 700 clamp(96px, 30vw, 132px)/.78 var(--display);
  letter-spacing: -.02em;
  display: flex;
  align-items: flex-start;
}
.score-pct small { font-size: .38em; margin: .06em 0 0 .04em; font-weight: 700; }
.score-meta { padding-bottom: 4px; font-size: 14px; line-height: 1.25; }
.score-meta b { font-weight: 700; }
.countdown {
  margin-top: 8px;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  font-stretch: 80%;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 4px 8px;
  border-radius: 4px;
}
@media (prefers-color-scheme: dark) { .countdown { background: var(--paper); color: var(--ink); } }

/* Die Bahn = Gesamtfortschritt */
.lane {
  position: relative;
  margin-top: 18px;
  height: 30px;
  border-top: 2px solid var(--lane-white);
  border-bottom: 2px solid var(--lane-white);
  background: rgba(0,0,0,.14);
}
.lane-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--lane-white) 0 26px, rgba(251,248,241,.86) 26px 28px);
  transition: width .9s cubic-bezier(.2, .8, .2, 1);
}
.lane-runner {
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--hi);
  box-shadow: 0 0 0 3px var(--ink);
}
.lane-finish {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 14px;
  background:
    conic-gradient(var(--ink) 25%, var(--lane-white) 0 50%, var(--ink) 0 75%, var(--lane-white) 0) 0 0 / 7px 6.5px;
  opacity: .9;
}

/* ───────────────────────── Startnummer */
.bib {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "label label" "no name" "no hint";
  align-items: end;
  column-gap: 14px;
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(560px - 2 * var(--gutter));
  margin: -48px auto 0;
  padding: 12px 18px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--lane-white);
  color: #17150F;
  text-align: left;
  transform: rotate(-1.4deg);
  box-shadow: 0 2px 0 rgba(0,0,0,.08), 0 18px 30px -16px rgba(0,0,0,.55);
  z-index: 2;
  transition: transform .2s ease;
}
.bib:active { transform: rotate(-1.4deg) scale(.98); }
.bib-holes::before, .bib-holes::after,
.bib::before, .bib::after {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.bib::before { top: 9px; left: 9px; }
.bib::after { top: 9px; right: 9px; }
.bib-holes::before { bottom: 9px; left: 9px; }
.bib-holes::after { bottom: 9px; right: 9px; }
.bib-label {
  grid-area: label;
  font-size: 10px;
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--track);
  padding-left: 10px;
}
.bib-no {
  grid-area: no;
  font: 700 64px/.8 var(--display);
  letter-spacing: -.02em;
  padding-left: 4px;
  min-width: 1.1em;
}
.bib-name {
  grid-area: name;
  font: 600 26px/1 var(--display);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bib-hint { grid-area: hint; font-size: 12px; color: #6E685B; }
.bib[data-empty] .bib-no { color: var(--track); }
.bib[data-empty] { animation: nudge 2.6s ease-in-out 1s infinite; }
@keyframes nudge { 0%, 88%, 100% { transform: rotate(-1.4deg); } 92% { transform: rotate(-.2deg) translateY(-2px); } 96% { transform: rotate(-2.4deg); } }

.offline {
  max-width: calc(560px - 2 * var(--gutter));
  margin: 18px auto 0;
  width: calc(100% - 2 * var(--gutter));
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
}

/* ───────────────────────── Layout */
main { max-width: 560px; margin: 0 auto; padding: 22px var(--gutter) 0; }
.view { animation: viewIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.view-head { margin: 4px 0 18px; }
.view-head h2 { font: 700 44px/.9 var(--display); text-transform: uppercase; }
.view-head p { font-size: 14px; color: var(--ink-3); margin-top: 6px; }

/* Filter */
.filters { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none;
  border: 1.5px solid var(--ink);
  background: transparent;
  border-radius: 99px;
  padding: 7px 13px 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-stretch: 85%;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.filters button span { font-weight: 600; opacity: .55; }
.filters button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.filters button[aria-selected="true"] span { opacity: .7; }

/* ───────────────────────── Disziplin-Karten */
.tasks { display: grid; gap: 12px; }
.task {
  position: relative;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: cardIn .45s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }

.task-head {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 14px 14px 10px 12px;
  border: 0;
  background: none;
  text-align: left;
}
.task-no {
  font: 600 15px/1 var(--display);
  color: var(--ink-3);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.task-kind {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 80%;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.task-name {
  font: 600 24px/1 var(--display);
  text-transform: uppercase;
  margin-top: 3px;
  letter-spacing: .005em;
  display: block;
}
.task-name .chev { display: inline-block; vertical-align: .12em; margin-left: 5px; width: 14px; height: 14px; fill: none; stroke: var(--ink-3); stroke-width: 2.5; transition: transform .25s; }
.task[data-open] .chev { transform: rotate(180deg); }
.task-count { text-align: right; white-space: nowrap; }
.task-count b { font: 700 30px/.9 var(--display); }
.task-count span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

/* Fortschrittsbalken: eigener Anteil gelb, Rest rot */
.bar {
  position: relative;
  margin: 0 14px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background:
    repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6.5px),
    var(--paper-2);
  display: flex;
}
.bar i { display: block; height: 100%; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar .b-me { background: var(--hi); box-shadow: inset -1.5px 0 0 var(--ink); }
.bar .b-rest { background: var(--track); }
.bar-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 18px;
  margin: 6px 14px 0;
  font-size: 12px;
  color: var(--ink-3);
}
.bar-legend .me-dot::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--hi);
  margin-right: 5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}

/* Aktionen */
.actions { display: flex; gap: 8px; padding: 12px 14px 14px; }
.btn {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font: 600 24px/1 var(--display);
  letter-spacing: .01em;
  transition: transform .1s ease, opacity .2s;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.95); }
.btn small { font: 600 13px var(--body); font-stretch: 85%; margin-left: 3px; opacity: .7; }
.btn.alt { flex: 0 0 56px; background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); font-size: 22px; }
.btn.wide { font-size: 20px; text-transform: uppercase; }
.btn.hi { background: var(--hi); color: var(--hi-ink); }
.btn:disabled { opacity: .35; }

/* Cooldown: Doppelklick-Schutz sichtbar machen */
.task[data-cooling] .btn,
.task[data-cooling] .chip { pointer-events: none; }
.task[data-cooling] .btn:not(.alt) { opacity: .55; }
.task[data-cooling] .actions::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--hi);
  transform-origin: left;
  animation: cooldown var(--cd, 900ms) linear forwards;
  animation-delay: var(--cd-delay, 0ms);
}
.actions { position: relative; }
@keyframes cooldown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Pro Athlet: Bahnen */
.slots { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 6px; padding: 12px 14px 0; }
.slot {
  aspect-ratio: 1;
  max-height: 46px;
  border-radius: 8px;
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  font: 600 18px/1 var(--display);
  color: var(--ink-3);
  position: relative;
}
.slot[data-taken] { border-style: solid; border-color: var(--ink-3); color: var(--ink-2); }
.slot[data-done] { background: var(--track); border-color: var(--track); color: var(--lane-white); }
.slot[data-me] { box-shadow: 0 0 0 2.5px var(--hi); }
.slot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.slot-names { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 6px; padding: 4px 14px 0; }
.slot-names span { font-size: 10px; text-align: center; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-stretch: 80%; font-weight: 600; }

/* Checkliste */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 12px 14px 14px; position: relative; }
.chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: transparent;
  text-align: left;
  transition: transform .1s;
}
.chip:active { transform: scale(.96); }
.chip .sw {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--c);
  display: grid; place-items: center;
}
.chip b { display: block; font: 600 18px/1 var(--display); text-transform: uppercase; }
.chip em { display: block; font-style: normal; font-size: 11px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9ch; }
.chip[data-found] { border-color: transparent; background: var(--paper-2); }
.chip[data-found] .sw { background: var(--c); }
.chip[data-found] .sw svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.chip[data-found] b { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--track); }
.chip[data-mine] { box-shadow: inset 0 0 0 2px var(--hi); }
.chip[data-confirm] { background: var(--ink); color: var(--paper); }
.chip[data-confirm] em { color: var(--hi); }

/* Stempel */
.stamp {
  display: inline-block;
  font: 700 15px/1 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--good);
  border: 2.5px solid currentColor;
  border-radius: 5px;
  padding: 4px 7px 3px;
  margin: -3px 0 -4px;
  transform: rotate(-6deg);
  pointer-events: none;
}
.task[data-done] .task-count b { color: var(--good); }
.task[data-just-done] .stamp { animation: stamp .55s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { from { transform: rotate(-20deg) scale(2.6); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }

/* Details */
.detail {
  border-top: 1.5px dashed var(--line);
  margin: 0 14px;
  padding: 12px 0 14px;
  animation: viewIn .3s ease;
}
.detail h4 {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 80%;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.detail h4:not(:first-child) { margin-top: 14px; }
.contrib { display: grid; grid-template-columns: 22px minmax(0, 1fr) 1.2fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 3px 0; }
.contrib .ln { font: 600 15px/1 var(--display); color: var(--ink-3); }
.contrib .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.contrib .mini { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.contrib .mini i { display: block; height: 100%; background: var(--track); }
.contrib[data-me] .mini i { background: var(--hi); }
.contrib .val { font-weight: 600; min-width: 3ch; text-align: right; }
.empty-note { font-size: 14px; color: var(--ink-3); }

.my-entries { list-style: none; margin: 0; padding: 0; }
.my-entries li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.my-entries li:last-child { border-bottom: 0; }
.my-entries time { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.del {
  border: 1.5px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 82px;
}
.del[data-confirm] { background: var(--track); border-color: var(--track); color: #fff; }

.finish-banner {
  margin-top: 18px;
  padding: 22px 18px;
  border-radius: var(--r);
  color: var(--lane-white);
  background:
    conic-gradient(#17150F 25%, #FBF8F1 0 50%, #17150F 0 75%, #FBF8F1 0) 0 0 / 22px 22px;
  position: relative;
  overflow: hidden;
}
.finish-banner > * { position: relative; background: var(--track); display: inline-block; padding: 2px 8px; }
.finish-banner p { font: 700 44px/1 var(--display); text-transform: uppercase; }
.finish-banner span { font-weight: 600; margin-top: 6px; }

/* ───────────────────────── Rangliste */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px 12px 10px;
  box-shadow: var(--shadow);
  animation: cardIn .45s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.row .rank {
  font: 700 52px/.8 var(--display);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  text-align: center;
}
.row:first-child .rank { color: var(--track); -webkit-text-stroke: 0; }
.row .who b { display: block; font: 600 24px/1 var(--display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .who span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .who .mini { height: 5px; background: var(--paper-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.row .who .mini i { display: block; height: 100%; background: var(--track); transition: width .6s; }
.row .pts { text-align: right; }
.row .pts b { display: block; font: 700 32px/.9 var(--display); }
.row .pts span { font-size: 11px; color: var(--ink-3); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-stretch: 80%; }
.row[data-me] { background: var(--hi); color: var(--hi-ink); border-color: transparent; }
.row[data-me] .who span, .row[data-me] .pts span { color: rgba(23,21,15,.65); }
.row[data-me] .rank { -webkit-text-stroke-color: var(--hi-ink); }
.row[data-me] .who .mini { background: rgba(23,21,15,.15); }
.row[data-me] .who .mini i { background: var(--hi-ink); }
.row.ghost { box-shadow: none; background: transparent; border-style: dashed; }
.row.ghost .who b { color: var(--ink-3); }

/* ───────────────────────── Ticker */
.feed-day {
  font-size: 11px;
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 18px 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.feed-day::after { content: ''; flex: 1; height: 1.5px; background: var(--line); }
.feed-day:first-child { margin-top: 0; }
.tick {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.tick time { font: 600 17px/1.2 var(--display); color: var(--ink-3); }
.tick b { font-weight: 700; }
.tick .amt { font: 700 19px/1 var(--display); color: var(--track); margin-right: 2px; }
.tick small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.tick[data-me] b { background: linear-gradient(transparent 55%, var(--hi) 55% 92%, transparent 92%); }
.tick[data-new] { animation: tickIn .6s ease both; }
@keyframes tickIn { from { background: var(--hi); } to { background: transparent; } }
.more-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: transparent;
  font-weight: 600;
}
.feed-empty { text-align: center; padding: 40px 0; color: var(--ink-3); }
.feed-empty b { display: block; font: 700 30px/1 var(--display); text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }

/* ───────────────────────── Tabbar */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--ink);
  color: var(--paper);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -8px 24px -12px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) { .tabbar { background: #0B0A08; color: var(--ink); border-top: 1px solid var(--line); } }
.tabbar button {
  height: var(--tabbar-h);
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .55;
  position: relative;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { opacity: 1; }
.tabbar button[aria-current="page"]::before {
  content: '';
  position: absolute;
  top: 0; left: 28%; right: 28%;
  height: 3px;
  background: var(--hi);
  border-radius: 0 0 3px 3px;
}
.tabbar .badge {
  position: absolute;
  top: 9px;
  left: calc(50% + 8px);
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  background: var(--hi);
  color: #17150F;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
@media (min-width: 600px) {
  .tabbar { left: 50%; right: auto; width: 480px; transform: translateX(-50%); bottom: 14px; border-radius: 18px; padding-bottom: 0; overflow: hidden; }
}

/* ───────────────────────── Bottom Sheet */
.sheet {
  border: 0;
  padding: 0 0 calc(var(--safe-b) + 18px);
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  border-radius: 22px 22px 0 0;
  background: var(--card);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet[open] { animation: sheetUp .32s cubic-bezier(.2,.9,.25,1); }
.sheet::backdrop { background: rgba(15, 12, 8, .55); animation: fade .25s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 22px; padding-bottom: 18px; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 4px; }
.sheet-in { padding: 8px 18px 0; }
.sheet h2 { font: 700 36px/.95 var(--display); text-transform: uppercase; }
.sheet .lead { color: var(--ink-3); font-size: 14px; margin-top: 6px; }
.sheet .section-label {
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 80%;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 20px 0 8px;
}

.pick-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: transparent;
  text-align: left;
  min-height: 58px;
}
.pick .ln { font: 700 30px/.8 var(--display); color: var(--track); min-width: 1ch; }
.pick b { font: 600 19px/1.05 var(--display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick[aria-pressed="true"] { background: var(--hi); color: var(--hi-ink); border-color: var(--hi); }
.pick[aria-pressed="true"] .ln { color: var(--hi-ink); }

.field { display: flex; gap: 8px; }
.input {
  flex: 1;
  min-width: 0;
  height: 54px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px;
  font: 600 17px var(--body);
}
.input:focus { outline: none; box-shadow: 0 0 0 3px var(--hi); }
.btn-text {
  border: 0;
  background: none;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.form-error { color: var(--track); font-size: 14px; font-weight: 600; margin-top: 8px; min-height: 1em; }

/* Zahleneingabe */
.num-wrap { position: relative; margin-top: 18px; }
.num {
  width: 100%;
  height: 96px;
  border-radius: 14px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: 700 64px/1 var(--display);
  text-align: center;
  padding: 0 70px;
}
.num:focus { outline: none; box-shadow: 0 0 0 4px var(--hi); }
.num-unit { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--ink-3); font-stretch: 85%; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick button { flex: 1; min-width: 60px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: transparent; font: 600 19px var(--display); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { min-height: 58px; }

/* ───────────────────────── Toast */
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--gutter));
  max-width: 528px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 16px 34px -14px rgba(0,0,0,.6);
  overflow: hidden;
  animation: toastIn .3s cubic-bezier(.2,.9,.25,1);
}
@media (prefers-color-scheme: dark) { .toast { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); } }
@media (min-width: 600px) { .toast { bottom: calc(var(--tabbar-h) + 30px); } }
.toast[data-kind="error"] { background: var(--track); color: #fff; }
.toast button {
  flex: none;
  border: 0;
  border-radius: 8px;
  background: var(--hi);
  color: #17150F;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-stretch: 85%;
  padding: 10px 12px;
}
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--hi); transform-origin: left; }
.toast[data-kind="error"] .toast-timer { background: rgba(255,255,255,.6); }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } }

.noscript { padding: 20px; text-align: center; }

/* ───────────────────────── Bier-Meter */
.keg {
  display: grid;
  grid-template-columns: 128px 1fr;
  align-items: center;
  gap: 18px;
  padding: 20px 18px 18px;
  border-radius: var(--r);
  color: #FBF8F1;
  background:
    radial-gradient(120% 90% at 20% 100%, rgba(233, 154, 39, .28), transparent 60%),
    #17150F;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.glass { width: 128px; height: auto; overflow: visible; transform-origin: 50% 100%; }
.glass.slosh { animation: slosh .9s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes slosh { 0% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 55% { transform: rotate(4deg); } 80% { transform: rotate(-1.5deg); } 100% { transform: rotate(0); } }
.glass-air { fill: rgba(251, 248, 241, .05); }
.glass-rim { fill: none; stroke: rgba(251, 248, 241, .85); stroke-width: 3; stroke-linejoin: round; }
.glass-shine { stroke: rgba(255, 255, 255, .22); stroke-width: 5; stroke-linecap: round; }
.beer-level { transition: transform 1.4s cubic-bezier(.2, .8, .2, 1); }
.foam rect, .foam circle { fill: #FFF6E2; }
.foam circle { animation: bob 3.2s ease-in-out infinite; }
.foam circle:nth-child(odd) { animation-delay: -1.6s; }
@keyframes bob { 50% { transform: translateY(1.6px); } }
.bub { fill: rgba(255, 246, 226, .75); animation: rise 3.4s linear infinite; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: .9; } 100% { transform: translateY(-150px); opacity: 0; } }

.keg-label { font-size: 11px; font-weight: 600; font-stretch: 80%; letter-spacing: .16em; text-transform: uppercase; color: #F7BD45; }
.keg-num { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.keg-num b { font: 700 76px/.85 var(--display); letter-spacing: -.02em; }
.keg-num span { font: 600 24px/1 var(--display); opacity: .55; }
.keg-num i { font-style: normal; }
.keg-liters { font: 600 24px/1 var(--display); margin-top: 10px; text-transform: uppercase; }
.keg-pct { font-size: 13px; opacity: .65; margin-top: 4px; }

.prost { display: block; width: 100%; margin-top: 12px; min-height: 60px; font-size: 26px; text-transform: uppercase; }
.prost.cooling { opacity: .55; pointer-events: none; }

.beer-card {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
}
.beer-card h3 { font: 700 24px/1 var(--display); text-transform: uppercase; }
.beer-card .sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

/* Hochrechnung im Wahlabend-Stil */
.forecast { border-top: 5px solid var(--track); }
.forecast-head { display: flex; justify-content: space-between; align-items: baseline; }
.forecast-head span { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-stretch: 80%; }
.forecast-big { font: 700 46px/.95 var(--display); text-transform: uppercase; margin-top: 10px; color: var(--track); }
.forecast-text { font-size: 14px; margin-top: 6px; line-height: 1.45; }
.forecast-verdict { display: inline-block; margin-top: 10px; padding: 4px 9px; border-radius: 6px; font-size: 13px; font-weight: 600; background: var(--paper-2); }
.forecast-verdict[data-ok="1"] { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.forecast-verdict[data-ok="0"] { background: color-mix(in srgb, var(--track) 16%, transparent); color: var(--track); }

/* Kronkorken-Kästen */
.crates { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.crate { background: #2E5E37; border-radius: 10px; padding: 8px 8px 10px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 6px 14px -8px rgba(0,0,0,.5); color: #EAF2E6; }
.crate[data-full] { background: #3A7444; }
.crate-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 6px; }
.crate-head b { font: 600 15px/1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.crate-head span { font-size: 11px; font-weight: 600; opacity: .8; }
.crate-grid { display: grid; grid-template-columns: repeat(var(--cols, 6), 1fr); gap: 3px; background: rgba(0,0,0,.28); padding: 4px; border-radius: 6px; }
.crate-grid i { aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #0E1F12 0 45%, #16301B 46%); }
.crate-grid i.cap {
  background:
    radial-gradient(circle at 38% 35%, rgba(255,255,255,.65) 0 12%, transparent 13%),
    radial-gradient(circle, #F2C14E 0 56%, #C98E1B 58% 66%, transparent 67%),
    repeating-conic-gradient(#D9A12A 0 15deg, #A8730F 15deg 30deg);
}
.crate-grid i.cap.new { animation: capIn .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.crate-grid i.off { visibility: hidden; }
@keyframes capIn { from { transform: scale(0) rotate(-90deg); } }

/* Umgerechnet */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.fact { background: var(--paper-2); border-radius: 12px; padding: 12px 12px 11px; }
.fact b { display: block; font: 700 28px/1 var(--display); }
.fact span { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.3; }

/* Durst-Rangliste */
.thirst { list-style: none; margin: 12px 0 0; padding: 0; }
.thirst li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.thirst li:last-child { border-bottom: 0; }
.thirst .ln { font: 600 18px/1 var(--display); color: var(--ink-3); text-align: center; }
.thirst .who { min-width: 0; }
.thirst .who b { font: 600 20px/1 var(--display); text-transform: uppercase; }
.thirst .who em { display: block; font-style: normal; font-size: 12px; color: var(--track); font-weight: 600; margin-top: 3px; }
.thirst .mugs {
  display: block;
  height: 15px;
  margin-top: 5px;
  width: calc(var(--n, 0) * 13px);
  max-width: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 15'%3E%3Crect x='1' y='5' width='7.5' height='9' rx='1.2' fill='%23E99A27'/%3E%3Cpath d='M8.5 7h1.4A1.6 1.6 0 0 1 11.5 8.6v1.8A1.6 1.6 0 0 1 9.9 12H8.5' fill='none' stroke='%23E99A27' stroke-width='1.3'/%3E%3Ccircle cx='2.6' cy='5' r='2' fill='%23FFF6E2' stroke='%23C9B98F' stroke-width='.5'/%3E%3Ccircle cx='5' cy='3.8' r='2.3' fill='%23FFF6E2' stroke='%23C9B98F' stroke-width='.5'/%3E%3Ccircle cx='7.3' cy='5' r='1.9' fill='%23FFF6E2' stroke='%23C9B98F' stroke-width='.5'/%3E%3C/svg%3E") left center / 13px 15px repeat-x;
}
.thirst .cnt { text-align: right; }
.thirst .cnt b { display: block; font: 700 26px/.9 var(--display); }
.thirst .cnt span { font-size: 11px; color: var(--ink-3); }
.thirst li[data-me] .who b { background: linear-gradient(transparent 55%, var(--hi) 55% 92%, transparent 92%); }

.beer-note { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 18px; }

@media (max-width: 360px) {
  .keg { grid-template-columns: 100px 1fr; gap: 12px; }
  .glass { width: 100px; }
  .keg-num b { font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .task[data-cooling] .actions::after { animation-duration: var(--cd, 900ms) !important; }
}
