/* Stundensatz — one narrow column like a scoreboard on a phone: the due set first, the day's bar, then the team. */
:root {
  --bg: #EDF0F2;
  --surface: #FFFFFF;
  --ink: #14212B;
  --muted: #5B6B78;
  --line: #D3DAE0;
  --track: #D9412A;
  --track-ink: #FFFFFF;
  --done: #17806A;
  --due-bg: #FBE6E1;
  --future: #DCE2E7;
  --p1: #17806A; --p2: #D9412A; --p3: #2F6BB3; --p4: #B7791F; --p5: #7A4DB0; --p6: #3F8F3A;
  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F161C; --surface: #172129; --ink: #E8EEF2; --muted: #93A4B1; --line: #2A3843;
    --track: #FF6A4D; --track-ink: #1A0A06; --done: #3CB596; --due-bg: #3A1F19; --future: #24313B;
    --p1: #3CB596; --p2: #FF6A4D; --p3: #6FA3E6; --p4: #E0A847; --p5: #A985DB; --p6: #78C26F;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.wrap {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 56px;
  display: flex; flex-direction: column; gap: 28px;
}
h1, h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; margin: 0; line-height: 1.05; }
h2 { font-size: 26px; }
h3 { margin: 0; font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--track); outline-offset: 2px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 32px; text-transform: uppercase; letter-spacing: .01em; text-decoration: none; line-height: 1; }
.brand span { color: var(--track); }
.top-r { display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.top-r b { color: var(--ink); font-weight: 600; }
.top-r > span { white-space: nowrap; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.due-hours { font-family: var(--display); font-weight: 700; font-size: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.due-big { display: flex; align-items: baseline; gap: 10px; }
.due-big .num { font-family: var(--display); font-weight: 700; font-size: 104px; line-height: .9; color: var(--track); font-variant-numeric: tabular-nums; }
.due-big.clear .num { color: var(--done); }
.due-big .unit { font-family: var(--display); font-weight: 700; font-size: 24px; text-transform: uppercase; }
.sets { color: var(--muted); font-size: 14px; }
.sets b { color: var(--ink); font-variant-numeric: tabular-nums; }
.primary { background: var(--track); color: var(--track-ink); border: 0; border-radius: 10px; padding: 16px 18px; font-weight: 700; font-size: 17px; }
.primary:disabled { background: var(--future); color: var(--muted); cursor: default; }
.secondary { background: var(--ink); color: var(--bg); border: 0; border-radius: 8px; padding: 11px 14px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--track); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; align-self: flex-start; font-size: 14px; }

.section { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.total { font-variant-numeric: tabular-nums; color: var(--muted); }
.total b { font-family: var(--display); font-size: 30px; color: var(--ink); font-weight: 700; }
.bar { display: flex; gap: 2px; height: 46px; }
.seg { flex-basis: 0; flex-shrink: 1; min-width: 3px; border-radius: 3px; background: var(--future); }
.seg.done { background: var(--done); }
.seg.due { background: var(--track); }
.axis { position: relative; height: 18px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.axis span { position: absolute; transform: translateX(-100%); white-space: nowrap; }

.factor { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.factor button { border: 0; background: none; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.factor button + button { border-left: 1px solid var(--line); }
.factor button b { font-family: var(--display); font-size: 22px; font-weight: 700; }
.factor button small { color: var(--muted); font-size: 12px; }
.factor button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.factor button[aria-pressed="true"] small { color: var(--bg); opacity: .75; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.week .col { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week .stick { width: 100%; height: 72px; background: var(--future); border-radius: 4px; display: flex; align-items: flex-end; overflow: hidden; }
.week .stick i { display: block; width: 100%; background: var(--done); }
.week .col.today { color: var(--ink); font-weight: 600; }
.week .col.today .stick i { background: var(--track); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.buddy { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; grid-row: span 2; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.buddy .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buddy .name em { font-style: normal; color: var(--muted); font-weight: 400; }
.buddy .score { font-family: var(--display); font-weight: 700; font-size: 26px; text-align: right; font-variant-numeric: tabular-nums; line-height: 1; }
.buddy .meta { font-size: 13px; color: var(--muted); }
.buddy .meta-r { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.mini { grid-column: 2 / 4; height: 6px; background: var(--future); border-radius: 3px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--done); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; color: var(--muted); vertical-align: 2px; }

.invite { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.invite code { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-width: 0; overflow-wrap: anywhere; user-select: all; }

.ch { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; height: 14px; background: var(--future); border-radius: 7px; overflow: hidden; }
.stack i { display: block; height: 100%; }
.ch .nums { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; font-size: 14px; flex-wrap: wrap; }
.ch .nums b { font-family: var(--display); font-size: 22px; font-weight: 700; }
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 8px; background: var(--due-bg); color: var(--track); white-space: nowrap; }
.pill.ok { background: var(--done); color: var(--surface); }
.pill.over { background: var(--future); color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }

form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
form.grid .full { grid-column: 1 / -1; }
form.boxed { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: 100%; font-size: 16px; color: var(--ink); }
form.grid button { grid-column: 1 / -1; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tabs button { border: 0; background: var(--surface); padding: 10px; font-weight: 600; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pitch { font-size: 17px; max-width: 46ch; }
.pitch b { font-variant-numeric: tabular-nums; }
.error { color: var(--track); font-size: 14px; }
.notice { background: var(--due-bg); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

details.rules { border-top: 1px solid var(--line); padding-top: 14px; }
details.rules summary { font-weight: 600; cursor: pointer; }
details.rules li { color: var(--muted); font-size: 14px; max-width: 62ch; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }

@media (prefers-reduced-motion: no-preference) {
  .seg, .mini i, .stack i, .week .stick i { transition: background-color .3s, width .4s, height .4s; }
}
@media (max-width: 400px) {
  .due-big .num { font-size: 84px; }
  form.grid { grid-template-columns: 1fr; }
}
