/*
 * Winterplan – "Etappenplakat"
 * Layout: dunkles Kopfband wie ein Rennplakat; darunter die Saison als Etappenprofil,
 * die Woche als Startnummer, dann Pool und Wochenboard.
 */
@font-face { font-family: "Big Shoulders Display"; font-weight: 700; font-display: swap; src: url(/fonts/big-shoulders-display-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 800; font-display: swap; src: url(/fonts/big-shoulders-display-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 900; font-display: swap; src: url(/fonts/big-shoulders-display-latin-900-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url(/fonts/archivo-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-display: swap; src: url(/fonts/archivo-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 600; font-display: swap; src: url(/fonts/archivo-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700; font-display: swap; src: url(/fonts/archivo-latin-700-normal.woff2) format("woff2"); }

:root {
  /* palette: race-poster navy, maillot yellow, phase colours */
  --bg: #EEF1F7; --surface: #FFFFFF; --surface-2: #E3E8F1; --ink: #101733; --muted: #56607A; --line: #CFD6E4;
  --mast: #101733; --mast-ink: #FFFFFF; --mast-muted: #A9B2CC; --mast-line: #2A3358;
  --signal: #FFD400; --on-signal: #101733; --accent: #2F5BFF; --on-accent: #FFFFFF;
  --k-a: #E0183C; --k-b: #FF6A1A; --k-t: #F2B600; --k-l: #2F5BFF; --k-g: #00A48A; --k-k: #7B3FE4; --k-r: #101733; --on-kind: #FFFFFF;
  --p1: #00A48A; --p2: #2F5BFF; --p3: #FF6A1A; --p4: #E0183C; --p5: #101733;
  --good: #11875A; --warn: #C46A00; --warn-bg: #FFF1D6; --good-bg: #DDF3E8; --danger: #D1122F;
  --f-display: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", Impact, sans-serif;
  --f-body: "Archivo", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --f-mono: var(--f-body);
  --r: 8px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0A0F22; --surface: #131A33; --surface-2: #1B2444; --ink: #F1F4FB; --muted: #98A2BE; --line: #29335A;
  --mast: #060A18; --mast-ink: #FFFFFF; --mast-muted: #8E98B6; --mast-line: #222B4D;
  --signal: #FFD400; --on-signal: #101733; --accent: #7B97FF; --on-accent: #0A0F22;
  --k-a: #FF4D66; --k-b: #FF8A45; --k-t: #FFC933; --k-l: #6F8FFF; --k-g: #25C9AB; --k-k: #A479FF; --k-r: #F1F4FB; --on-kind: #0A0F22;
  --p1: #25C9AB; --p2: #6F8FFF; --p3: #FF8A45; --p4: #FF4D66; --p5: #F1F4FB;
  --good: #4FD69A; --warn: #FFB547; --warn-bg: #3A2A10; --good-bg: #10301F; --danger: #FF6B7F;
  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(--f-body); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 20px; padding-block: 24px 48px; display: flex; flex-direction: column; gap: 22px; }
.loading { color: var(--muted); }

/* ---------- masthead ---------- */
.masthead { background: var(--mast); color: var(--mast-ink); padding-top: env(safe-area-inset-top, 0px); position: relative; }
.masthead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--p1) 0 25%, var(--p2) 25% 50%, var(--p3) 50% 75%, var(--p4) 75%); }
.mast-inner { max-width: 1320px; margin: 0 auto; padding: 14px 20px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 24px; flex: none; }
.brand-mark path { fill: var(--signal); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--f-display); font-weight: 900; font-size: 30px; line-height: .95; letter-spacing: .01em; }
.brand-sub { font-size: 13px; color: var(--mast-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ftp { display: flex; align-items: center; gap: 6px; background: var(--signal); color: var(--on-signal); border-radius: 6px; padding: 5px 10px 5px 12px; }
.ftp label { font-family: var(--f-display); font-weight: 900; font-size: 18px; line-height: 1; }
.ftp input { width: 56px; border: 0; background: transparent; color: var(--on-signal); font-weight: 700; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.ftp input { -moz-appearance: textfield; appearance: textfield; }
.ftp input::-webkit-inner-spin-button, .ftp input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ftp span { font-weight: 700; font-size: 14px; }
.save { font-size: 12px; color: var(--mast-muted); min-width: 8ch; }
.menu { position: relative; }
.menubtn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--mast-line); background: transparent; color: var(--mast-ink); border-radius: 6px; padding: 7px 12px; font-weight: 600; font-size: 14px; }
.menubtn svg { width: 11px; height: 8px; }
.menubtn svg path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menulist { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(6, 10, 24, .22); display: flex; flex-direction: column; min-width: 230px; padding: 6px; transform-origin: top right; animation: menu-in .18s var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menulist button { text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: 6px; font-size: 14px; }

/* ---------- buttons & forms ---------- */
.primary { background: var(--signal); color: var(--on-signal); border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 700; font-size: 15px; letter-spacing: .005em; transition: transform .12s var(--ease-out), box-shadow .12s; box-shadow: 0 2px 0 rgba(16, 23, 51, .9); }
.primary:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(16, 23, 51, .9); }
.primary.big { padding: 13px 22px; font-size: 16px; }
.primary:disabled { opacity: .55; cursor: default; }
.ghost { background: transparent; border: 1.5px solid var(--line); border-radius: 6px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
.warnbtn { color: var(--danger); border-color: var(--danger); }
.linkbtn { display: inline-block; text-decoration: none; text-align: center; }
@media (hover: hover) {
  .primary:hover { filter: brightness(1.04); }
  .ghost:hover { border-color: var(--ink); }
  .menubtn:hover { border-color: var(--mast-ink); }
  .menulist button:hover { background: var(--surface-2); }
}
.panel { background: var(--surface); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 1px 0 var(--line); }
.narrow { max-width: 520px; width: 100%; margin-inline: auto; }
.vtitle { font-family: var(--f-display); font-size: 44px; font-weight: 900; line-height: .95; margin: 0; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }
.sub { font-family: var(--f-display); font-size: 26px; font-weight: 800; line-height: 1; margin: 0; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form.sep { border-top: 1px solid var(--line); padding-top: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, legend { font-size: 13px; font-weight: 700; color: var(--ink); }
.field label em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input { border: 1.5px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--bg); width: 100%; min-width: 0; font-size: 16px; }
.field input:focus { border-color: var(--ink); outline: none; }
.field small, .hint { font-size: 13px; color: var(--muted); margin: 0; }
.err { color: var(--danger); font-size: 14px; margin: 0; font-weight: 600; }
.err:empty { display: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 8px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }

/* ---------- auth poster ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; min-height: calc(100vh - 160px); }
.auth-poster { position: relative; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.auth-title { font-family: var(--f-display); font-weight: 900; font-size: clamp(64px, 9vw, 132px); line-height: .86; margin: 0; letter-spacing: -.005em; display: flex; flex-direction: column; }
.auth-title span:last-child { color: var(--accent); }
.auth-lead { margin: 0; font-size: 17px; max-width: 44ch; color: var(--muted); }
.auth-profile { width: 100%; height: clamp(90px, 14vw, 150px); overflow: visible; }
.ap-fill { fill: var(--signal); opacity: .9; }
.ap-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.ap-flag path { stroke: var(--ink); stroke-width: 2.5; }
.ap-flag rect { fill: var(--k-a); }
.auth-panel { width: 100%; max-width: 440px; justify-self: end; }
@media (prefers-reduced-motion: no-preference) {
  .auth-title span { animation: rise .7s var(--ease-out) both; }
  .auth-title span:last-child { animation-delay: .12s; }
  .auth-lead { animation: rise .7s var(--ease-out) .24s both; }
  .ap-line { stroke-dashoffset: 1; animation: draw 1.6s cubic-bezier(.65, 0, .35, 1) .3s forwards; }
  .ap-fill { animation: fade 1s ease 1.2s both; }
  .ap-flag { animation: flag .5s var(--ease-out) 1.8s both; transform-origin: 596px 104px; }
  .auth-panel { animation: rise .7s var(--ease-out) .35s both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes flag { from { opacity: 0; transform: scale(.4); } }

/* ---------- setup ---------- */
.goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.goals legend { grid-column: 1 / -1; }
.goal { position: relative; display: block; cursor: pointer; }
.goal input { position: absolute; opacity: 0; pointer-events: none; }
.goal span { display: flex; flex-direction: column; gap: 6px; height: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 16px 14px 14px; background: var(--bg); position: relative; overflow: hidden; transition: border-color .15s, transform .15s var(--ease-out); }
.goal span::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--gc); }
.g-ultra { --gc: var(--k-a); } .g-road { --gc: var(--k-l); } .g-mtb { --gc: var(--k-b); } .g-fit { --gc: var(--k-g); }
.goal b { font-family: var(--f-display); font-size: 28px; font-weight: 900; line-height: .95; }
.goal small { color: var(--muted); font-size: 13px; }
.goal input:checked + span { border-color: var(--ink); background: var(--surface); transform: translateY(-2px); box-shadow: 0 8px 0 -4px var(--gc); }
.goal input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips legend { width: 100%; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--bg); transition: background .15s, color .15s, border-color .15s; }
.chips input:checked + span { background: var(--ink); color: var(--signal); border-color: var(--ink); }
.chips input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.preview { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; font-size: 14px; }
.preview:empty { display: none; }
.preview b { font-weight: 700; }
.preview .phases { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin-top: 10px; gap: 2px; }
.preview .phases i { display: block; height: 100%; }
.preview .warnline { color: var(--warn); margin-top: 8px; font-weight: 600; }

/* ---------- season profile ---------- */
.planwrap { display: flex; flex-direction: column; gap: 22px; }
.season { background: var(--surface); border-radius: 12px; padding: 18px 18px 14px; box-shadow: 0 1px 0 var(--line); }
.prof-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.prof { display: grid; grid-template-columns: repeat(var(--n), minmax(20px, 1fr)); gap: 3px; height: 150px; align-items: end; min-width: calc(var(--n) * 22px); }
.wk { position: relative; height: 100%; border: 0; padding: 0; background: transparent; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 5px; }
.wk-bar { position: relative; display: block; height: calc(var(--h) * (100% - 44px)); min-height: 10px; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--ph) 52%, var(--surface)); overflow: hidden; transform-origin: bottom; transition: filter .15s, transform .2s var(--ease-out); }
.wk.deload .wk-bar { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ph) 52%, var(--surface)) 0 4px, color-mix(in srgb, var(--ph) 20%, var(--surface)) 4px 8px); }
.wk-done { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--done) * 100%); background: var(--ph); transition: height .5s var(--ease-out); }
.wk-n { font-weight: 700; font-size: 11px; color: var(--muted); text-align: center; line-height: 16px; height: 18px; border-radius: 3px; }
.wk-t { position: absolute; top: 0; left: 50%; transform: translateX(-50%); font-family: var(--f-display); font-weight: 900; font-size: 13px; line-height: 1; color: var(--k-t); }
.wk.race .wk-t { display: none; }
.wk-flag { position: absolute; top: 0; left: 50%; width: 16px; height: 14px; transform: translateX(-30%); }
.wk.sel .wk-bar { outline: 3px solid var(--ink); outline-offset: 1px; }
.wk.sel .wk-n { background: var(--signal); color: var(--on-signal); }
.wk.now::after { content: ""; position: absolute; left: 50%; top: 18px; bottom: 24px; width: 0; border-left: 2px dotted var(--ink); opacity: .35; z-index: -1; }
.wk.now .wk-n { color: var(--ink); }
.months { display: grid; grid-template-columns: repeat(var(--n), minmax(20px, 1fr)); gap: 3px; min-width: calc(var(--n) * 22px); margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.months span { white-space: nowrap; overflow: visible; border-left: 1.5px solid var(--line); padding-left: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.lg.p1 { background: var(--p1); } .lg.p2 { background: var(--p2); } .lg.p3 { background: var(--p3); } .lg.p4 { background: var(--p4); }
.lg.dl { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); }
.tmark { font-family: var(--f-display); font-weight: 900; color: var(--k-t); font-size: 14px; }
.lg-note { margin-left: auto; }
@media (hover: hover) { .wk:hover .wk-bar { filter: brightness(1.08) saturate(1.1); transform: scaleY(1.03); } }
@media (prefers-reduced-motion: no-preference) {
  .prof.intro .wk-bar { animation: grow .8s var(--ease-out) both; animation-delay: calc(var(--i) * 16ms); }
}
@keyframes grow { from { transform: scaleY(0); } }

/* ---------- week head (race bib) ---------- */
.weekbody { display: flex; flex-direction: column; gap: 20px; view-transition-name: week; }
.weekhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.bib { position: relative; background: var(--surface); border: 3px solid var(--ink); border-radius: 8px; padding: 10px 22px 6px; text-align: center; min-width: 124px; box-shadow: 6px 6px 0 var(--ph); }
.bib::before, .bib::after, .bib i::before, .bib i::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--line); }
.bib::before { top: 6px; left: 6px; } .bib::after { top: 6px; right: 6px; }
.bib i::before { bottom: 6px; left: 6px; } .bib i::after { bottom: 6px; right: 6px; }
.bib small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.bib b { display: block; font-family: var(--f-display); font-weight: 900; font-size: 76px; line-height: .9; letter-spacing: -.01em; }
.wh-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wh-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); }
.tag.ph { background: var(--ph); color: var(--on-kind); }
.tag.togo { background: transparent; border: 1.5px solid var(--line); }
.wh-info h2 { font-family: var(--f-display); font-weight: 900; font-size: 44px; line-height: .92; margin: 2px 0 0; text-wrap: balance; }
.wh-info .focus { margin: 0; color: var(--muted); font-size: 15px; }
.wh-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; min-width: 260px; }
.meter { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.meter-bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.meter-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; transition: width .5s var(--ease-out); }
.meter-bar .m-plan { background: color-mix(in srgb, var(--ink) 25%, transparent); }
.meter-bar .m-done { background: var(--good); }
.meter-nums { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.meter-nums b { color: var(--ink); font-size: 17px; font-weight: 700; }
.nav { display: flex; gap: 6px; }
.nav button { background: var(--surface); border: 1.5px solid var(--line); border-radius: 6px; padding: 7px 12px; font-size: 14px; font-weight: 600; }
.nav .today { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.nav button:disabled { opacity: .4; cursor: default; }
@media (hover: hover) { .nav button:hover:not(:disabled) { border-color: var(--ink); } }
.why { margin: -6px 0 0; font-size: 15px; max-width: 78ch; color: var(--ink); }

.checks { display: flex; flex-direction: column; gap: 6px; }
.checks:empty { display: none; }
.chk { font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); display: flex; gap: 10px; align-items: flex-start; }
.chk::before { content: "!"; flex: none; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; background: var(--warn); color: var(--bg); font-weight: 800; font-size: 12px; }
.chk.ok { background: var(--good-bg); }
.chk.ok::before { content: "✓"; background: var(--good); }

/* ---------- pool + board ---------- */
.section-label { font-family: var(--f-display); font-size: 26px; font-weight: 900; line-height: 1; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.section-label small { font-family: var(--f-body); font-size: 13px; font-weight: 500; color: var(--muted); }
.pool { background: var(--surface-2); border-radius: 12px; padding: 10px; min-height: 70px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.pool.over, .day.over { outline: 3px dashed var(--accent); outline-offset: -3px; }
.pool-empty { color: var(--muted); font-size: 14px; padding: 12px; grid-column: 1 / -1; }
.board { display: grid; grid-template-columns: 1fr; gap: 8px; }
.day { background: var(--surface); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; min-height: 60px; position: relative; overflow: hidden; box-shadow: 0 1px 0 var(--line); }
.day.today { box-shadow: inset 0 4px 0 var(--signal), 0 1px 0 var(--line); }
.dlabel { display: flex; flex-direction: column; }
.dlabel b { font-family: var(--f-display); font-size: 28px; font-weight: 900; line-height: .9; }
.dlabel small { font-size: 12px; color: var(--muted); font-weight: 600; }
.dlabel .now-tag { align-self: flex-start; margin-top: 4px; font-size: 11px; font-weight: 800; background: var(--signal); color: var(--on-signal); padding: 1px 6px; border-radius: 3px; }
.dlabel .rest { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; align-content: start; min-width: 0; }
@media (min-width: 1040px) {
  .board { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .day { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 300px; align-content: start; }
  .dcards { grid-template-columns: 1fr; }
  /* narrow day columns: badge and tick on top, title full width below */
  .day .card-top { flex-wrap: wrap; justify-content: space-between; row-gap: 6px; }
  .day .card-top .ct { order: 3; flex-basis: 100%; }
}

.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; transition: border-color .15s, opacity .2s; }
.day .card { background: var(--bg); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .4; }
.card.done { opacity: .6; }
.card.done .title { text-decoration: line-through; text-decoration-thickness: 1.5px; }
@media (hover: hover) { .card:hover { border-color: color-mix(in srgb, var(--kc) 55%, var(--line)); } }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.badge { flex: none; width: 30px; height: 30px; border-radius: 6px; background: var(--kc); color: var(--on-kind); font-family: var(--f-display); font-weight: 900; font-size: 20px; display: grid; place-items: center; line-height: 1; }
.ct { min-width: 0; flex: 1; }
.title { font-weight: 700; font-size: 14.5px; line-height: 1.25; overflow-wrap: break-word; }
.meta { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.meta span { white-space: nowrap; }
.tick { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: transparent; display: grid; place-items: center; font-size: 14px; font-weight: 800; color: transparent; transition: background .15s, border-color .15s, color .15s; }
.tick[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--bg); }
@media (hover: hover) { .tick:hover { border-color: var(--good); color: var(--good); } .tick[aria-pressed="true"]:hover { color: var(--bg); } }
@media (prefers-reduced-motion: no-preference) { .tick[aria-pressed="true"] { animation: pop .3s var(--ease-out); } }
@keyframes pop { 40% { transform: scale(1.25); } }
details summary { font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; }
details[open] summary::before { content: "− "; }
details p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; overflow-wrap: break-word; }
.w { font-weight: 700; background: color-mix(in srgb, var(--signal) 55%, transparent); color: var(--ink); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.daypick { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.daypick button { flex: 1 0 auto; min-width: 30px; font-size: 12px; font-weight: 700; padding: 5px 2px; border: 1.5px solid var(--line); border-radius: 5px; background: var(--surface); }
.daypick button:active:not(:disabled) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (hover: hover) { .daypick button:hover:not(:disabled) { background: var(--ink); color: var(--signal); border-color: var(--ink); } }
.daypick button:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.daypick .back { flex-basis: 100%; }
.foot { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; }
.reset.armed { border-color: var(--danger); color: var(--danger); }

/* ---------- transitions (View Transitions API) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(week) { animation: vt-out .26s cubic-bezier(.4, 0, 1, 1) both; }
  ::view-transition-new(week) { animation: vt-in .42s var(--ease-out) both; }
  html.vt-place ::view-transition-old(week), html.vt-place ::view-transition-new(week) { animation: none; }
  html.vt-place .card { view-transition-name: var(--vtn); }
  ::view-transition-group(*) { animation-duration: .45s; animation-timing-function: var(--ease-out); }
}
@keyframes vt-out { to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -48px)); filter: blur(8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 72px)); filter: blur(8px); } }
@media (prefers-reduced-motion: reduce) { *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; } }

/* ---------- phone ---------- */
.mnav { display: none; }
@media (max-width: 720px) {
  .auth { grid-template-columns: 1fr; min-height: 0; gap: 20px; }
  .auth-panel { justify-self: stretch; max-width: none; }
  .weekhead { grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; }
  .wh-side { grid-column: 1 / -1; align-items: stretch; min-width: 0; }
  .wh-side .nav { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 14px; padding-block: 16px 28px; gap: 16px; }
  body.in-plan .wrap { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .mast-inner { padding: 10px 14px 14px; }
  .brand-name { font-size: 26px; }
  .brand-sub { max-width: 60vw; }
  .controls { width: 100%; justify-content: space-between; gap: 8px; }
  .save { order: 3; flex-basis: 100%; min-width: 0; font-size: 11px; }
  .save:empty { display: none; }
  .panel { padding: 18px; }
  .vtitle { font-size: 38px; }
  .season { padding: 14px 10px 10px; }
  .prof { height: 116px; gap: 2px; min-width: 0; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .months { gap: 2px; min-width: 0; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); font-size: 10px; }
  .wk-n { font-size: 10px; opacity: 0; }
  .wk.sel .wk-n, .wk.now .wk-n { opacity: 1; }
  .wk.sel .wk-n { min-width: 22px; margin-inline: -6px; }
  .wk-t { font-size: 11px; }
  .lg-note { margin-left: 0; flex-basis: 100%; }
  .legend { font-size: 11px; gap: 4px 12px; }
  .bib { min-width: 96px; padding: 8px 14px 4px; box-shadow: 4px 4px 0 var(--ph); }
  .bib b { font-size: 58px; }
  .wh-info h2 { font-size: 32px; }
  .section-label { font-size: 22px; }
  .pool { grid-template-columns: 1fr; padding: 8px; }
  .day { grid-template-columns: 50px minmax(0, 1fr); padding: 10px; }
  .dlabel b { font-size: 24px; }
  .dcards { grid-template-columns: 1fr; }
  .title { font-size: 15px; }
  .daypick { gap: 4px; }
  .daypick button { min-height: 38px; font-size: 13px; border-radius: 6px; }
  .tick { width: 34px; height: 34px; font-size: 15px; }
  details summary { font-size: 13.5px; padding: 4px 0; }
  details p { font-size: 14px; }
  .mnav { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--mast); box-shadow: 0 -6px 20px rgba(6, 10, 24, .18); }
  .mnav button { flex: 1; min-height: 46px; border: 1px solid var(--mast-line); background: transparent; color: var(--mast-ink); border-radius: 8px; font-size: 14px; font-weight: 700; }
  .mnav button:disabled { opacity: .35; }
  .mnav .mnav-today { flex: 0 0 auto; padding-inline: 18px; background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
  body.touring .mnav { display: none; }
}

/* ---------- guided tour ---------- */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-shade { position: absolute; inset: 0; background: rgba(6, 10, 24, .66); }
.tour-spot { position: absolute; border-radius: 10px; box-shadow: 0 0 0 3px var(--signal), 0 0 0 9999px rgba(6, 10, 24, .66); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .tour-spot { transition: left .3s var(--ease-out), top .3s var(--ease-out), width .3s var(--ease-out), height .3s var(--ease-out); }
  .tour-card { transition: left .3s var(--ease-out), top .3s var(--ease-out); }
  .tour:not([hidden]) .tour-card { animation: rise .4s var(--ease-out) both; }
}
.tour-card { position: absolute; width: min(430px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4); display: flex; flex-direction: column; outline: none; border-top: 6px solid var(--signal); }
.tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 24px)); }
.tour-card.center { animation: none !important; }
.tour-card.sheet, .tour-card.sheet.center { left: 0 !important; right: 0; top: auto !important; bottom: 0; transform: none; width: 100%; max-height: 64vh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.tour-card.sheet.center { max-height: 86vh; }
.tour-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 0; }
.tour-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.tour-skip { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 0 6px 12px; }
@media (hover: hover) { .tour-skip:hover { color: var(--ink); } }
.tour-scroll { overflow-y: auto; padding: 8px 20px 4px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.tour-card h2 { font-family: var(--f-display); font-size: 34px; font-weight: 900; line-height: .95; margin: 0; text-wrap: balance; }
.tour-body { font-size: 15px; line-height: 1.5; display: flex; flex-direction: column; gap: 8px; }
.tour-body p { margin: 0; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 16px; border-top: 1px solid var(--line); margin-top: 8px; }
.tour-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.tour-dots button { width: 8px; height: 8px; border-radius: 4px; border: 0; padding: 0; background: var(--line); transition: width .25s var(--ease-out), background .2s; }
.tour-dots button[aria-current] { background: var(--ink); width: 22px; }
.tour-nav { display: flex; gap: 8px; flex: none; }
.tour-nav .ghost:disabled { opacity: .4; cursor: default; }
@media (max-width: 640px) {
  .tour-dots button { width: 6px; height: 6px; }
  .tour-dots button[aria-current] { width: 16px; }
  .tour-nav button { min-height: 44px; }
  .tour-card h2 { font-size: 30px; }
}
.ti-phases { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.ti-phases i { display: block; height: 100%; }
.ti-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ti-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ti-legend i { width: 12px; height: 7px; border-radius: 2px; display: inline-block; }
.ti-badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.ti-badge { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-width: 0; }
.ti-badge .badge { width: 26px; height: 26px; font-size: 17px; }
.ti-checks { display: flex; flex-direction: column; gap: 6px; }
.ti-checks .chk { font-size: 13px; }
.ti-steps { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 7px; }
.ti-steps li::marker { font-family: var(--f-display); font-weight: 900; font-size: 17px; color: var(--ink); }
.ti-note { font-size: 13px; color: var(--muted); margin: 0; }
.ti-ico { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent); }
.ti-rules { margin: 0; display: grid; gap: 2px; }
.ti-rules dt { font-weight: 800; margin-top: 8px; }
.ti-rules dd { margin: 0; color: var(--muted); font-size: 14px; }
.ti-cal { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.seg-pane { display: flex; flex-direction: column; gap: 8px; }
