/* RunMF. Quiet concrete surroundings, one loud highway sign for today's workout. */

:root {
  --bg: #e6ebed;
  --surface: #ffffff;
  --ink: #0f1c23;
  --muted: #56666e;
  --line: #c9d3d8;
  --focus: #0b5fff;

  --sign: #0d5a3f;
  --sign-ink: #ffffff;
  --sign-line: rgba(255, 255, 255, .3);
  --sign-focus: #ffe08a;

  --easy: #2a8c76;
  --tempo: #b87a00;
  --intervals: #d0432b;
  --long: #4150c4;
  --mp: #8a3fb8;
  --race: #b0245a;
  --rest: #a9b5bb;

  --ok: #0d6b3c;
  --warn: #8a5200;
  --bad: #a32b1a;

  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418;
    --surface: #17222a;
    --ink: #e9eff2;
    --muted: #94a5ad;
    --line: #2b3a43;
    --focus: #7aa7ff;
    --sign: #0f6a49;
    --rest: #4a5a63;
    --easy: #3fb59b;
    --tempo: #e0a31a;
    --intervals: #f06a4f;
    --long: #7f8cf0;
    --mp: #b97ae0;
    --race: #e8628f;
    --ok: #46c27f;
    --warn: #e0a31a;
    --bad: #ff8f7d;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sign :focus-visible { outline-color: var(--sign-focus); }
.noscript { padding: 2rem; text-align: center; }

.shell { max-width: 44rem; margin: 0 auto; padding: 0 1rem calc(4rem + env(safe-area-inset-bottom)); }
.stack > * + * { margin-top: 1rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 0 .5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand img { width: 1.9rem; height: 1.9rem; border-radius: 8px; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.link-btn {
  background: none; border: 0; padding: .45rem .6rem; border-radius: 8px; color: var(--ink);
  font-weight: 600; font-size: .95rem;
}
.link-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.link-btn[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }

.countdown { display: flex; flex-direction: column; gap: .4rem; margin: .25rem 0 .6rem; }
.countdown p { font-size: .95rem; color: var(--muted); }
.countdown strong { color: var(--ink); }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: var(--sign); border-radius: 3px; }

/* ---------- day strip ---------- */
.strip-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .25rem; margin: .25rem 0 .5rem; }
.step {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 1.3rem; line-height: 1; display: grid; place-items: center; padding: 0;
}
.step:disabled { opacity: .35; cursor: default; }
.strip {
  display: flex; gap: .3rem; overflow-x: auto; padding: .35rem .15rem .5rem; scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.month { flex: 0 0 auto; align-self: center; padding: 0 .3rem; font-size: .75rem; font-weight: 700; color: var(--muted); }
.chip {
  flex: 0 0 auto; width: 3.1rem; padding: .4rem 0 .35rem; border-radius: 10px; border: 1px solid transparent;
  background: transparent; text-align: center; scroll-snap-align: center; position: relative;
}
.chip .dow { display: block; font-size: .72rem; color: var(--muted); }
.chip .num { display: block; font-size: 1.15rem; font-weight: 750; line-height: 1.25; }
.chip .mark { display: block; height: 6px; width: 62%; margin: .3rem auto 0; border-radius: 3px; background: var(--rest); }
.chip[aria-current="date"] { background: var(--surface); border-color: var(--ink); }
.chip.is-today .num { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.chip[data-type="easy"] .mark, .chip[data-type="shakeout"] .mark { background: var(--easy); }
.chip[data-type="tempo"] .mark { background: var(--tempo); }
.chip[data-type="intervals"] .mark { background: var(--intervals); }
.chip[data-type="long"] .mark { background: var(--long); }
.chip[data-type="mp"] .mark { background: var(--mp); }
.chip[data-type="race"] .mark, .chip[data-type="tuneup"] .mark { background: var(--race); }
.chip[data-type="rest"] .mark { height: 3px; margin-top: .45rem; opacity: .6; }
.chip.is-missed .mark { background: transparent !important; box-shadow: inset 0 0 0 2px var(--muted); opacity: .8; }
.chip.is-done::after {
  content: ""; position: absolute; top: 4px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
}
.strip-meta { display: flex; justify-content: space-between; align-items: center; min-height: 2rem; font-size: .9rem; color: var(--muted); }

/* ---------- workout sign ---------- */
.sign {
  position: relative; background: var(--sign); color: var(--sign-ink); border-radius: 18px; padding: 1rem;
  touch-action: pan-y;
}
.sign::before {
  content: ""; position: absolute; inset: 7px; border: 2px solid var(--sign-line); border-radius: 12px; pointer-events: none;
}
.sign-in { position: relative; padding: .55rem .65rem .8rem; }
.sign-date { font-weight: 700; font-size: 1.02rem; }
.sign-where { margin-top: .1rem; font-size: .92rem; opacity: .88; }
.sign-title { margin-top: 1rem; font-size: clamp(1.45rem, 5.4vw, 1.9rem); font-weight: 800; line-height: 1.12; letter-spacing: -.015em; }
.sign-numbers { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .5rem 1.6rem; margin-top: .8rem; }
.big { font-size: clamp(3.6rem, 16vw, 5.6rem); font-weight: 850; line-height: .88; letter-spacing: -.045em; }
.big .unit { font-size: 1.3rem; font-weight: 700; letter-spacing: 0; margin-left: .3rem; }
.time { font-size: 1.35rem; font-weight: 750; padding-bottom: .15rem; }
.legs { margin-top: 1.15rem; border-top: 1px solid var(--sign-line); }
.leg {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .1rem .9rem; align-items: baseline;
  padding: .7rem 0; border-bottom: 1px solid var(--sign-line);
}
.leg-name { font-weight: 650; }
.leg-dist { font-weight: 800; text-align: right; }
.leg-pace { text-align: right; min-width: 6.4rem; opacity: .92; }
.leg-sub { grid-column: 1 / -1; font-size: .9rem; opacity: .85; }
.sign-notes { margin-top: .9rem; font-size: .98rem; max-width: 36rem; opacity: .95; }
.btn-done {
  width: 100%; margin-top: 1.1rem; padding: .95rem 1rem; border-radius: 12px; border: 2px solid #fff;
  background: #fff; color: var(--sign); font-weight: 800; font-size: 1.05rem;
}
.sign.is-done .btn-done { background: transparent; color: #fff; }
.btn-done:disabled { opacity: .6; cursor: default; }
.sign-status { margin-top: .5rem; text-align: center; font-size: .9rem; opacity: .9; min-height: 1.3em; }
.sign.is-done .sign-date::after { content: "  Done"; font-weight: 800; padding-left: .5rem; }

.restcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.3rem; }
.restcard h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.015em; margin: .5rem 0; }
.restcard p { color: var(--muted); }
.restcard .btn-quiet { margin-top: 1rem; }

/* ---------- week summary ---------- */
.week { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.week-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.week-head h3 { font-size: 1.05rem; font-weight: 750; }
.phase { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 650; border: 1px solid var(--line); color: var(--muted); }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; margin: .8rem 0 .6rem; }
.wd { text-align: center; font-size: .78rem; color: var(--muted); }
.wd i { display: block; height: 10px; margin: .25rem 0 0; border-radius: 4px; background: var(--rest); font-style: normal; }
.wd[data-type="easy"] i, .wd[data-type="shakeout"] i { background: var(--easy); }
.wd[data-type="tempo"] i { background: var(--tempo); }
.wd[data-type="intervals"] i { background: var(--intervals); }
.wd[data-type="long"] i { background: var(--long); }
.wd[data-type="mp"] i { background: var(--mp); }
.wd[data-type="race"] i, .wd[data-type="tuneup"] i { background: var(--race); }
.wd[data-type="rest"] i { height: 4px; opacity: .55; margin-top: .4rem; }
.wd.is-done i { outline: 2px solid var(--ok); outline-offset: 1px; }
.week p { color: var(--muted); font-size: .95rem; }
.overall { margin-top: 1rem; }

/* ---------- forms and panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; }
.panel h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: .2rem; }
.panel .sub { color: var(--muted); font-size: .95rem; margin-bottom: .9rem; }
.page-title { font-size: 1.7rem; font-weight: 850; letter-spacing: -.02em; margin: 1rem 0 .3rem; }
.lead { color: var(--muted); }
.page-title + .lead { margin: 0 0 1rem; }
.field { display: block; margin-top: 1rem; }
.field > .label { display: block; font-weight: 650; margin-bottom: .3rem; }
.hint { display: block; color: var(--muted); font-size: .88rem; margin-top: .25rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%; padding: .65rem .75rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  min-height: 2.9rem;
}
input:disabled { opacity: .6; }
.timefield { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.timefield label { display: flex; align-items: center; gap: .3rem; }
.timefield input { width: 4.6rem; text-align: center; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 30rem) { .row { grid-template-columns: 1fr; } }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span {
  display: block; min-width: 2.9rem; text-align: center; padding: .6rem .85rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); font-weight: 650;
}
.seg input:checked + span { background: var(--sign); border-color: var(--sign); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-block; padding: .85rem 1.2rem; border-radius: 12px; border: 2px solid var(--sign);
  background: var(--sign); color: #fff; font-weight: 800; font-size: 1.02rem;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-wide { width: 100%; margin-top: 1.25rem; }
.btn-quiet {
  display: inline-block; padding: .65rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650;
}
.error { margin-top: .9rem; padding: .7rem .85rem; border-radius: 10px; border-left: 4px solid var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--ink); }
.error:empty { display: none; }
.tabs { display: flex; gap: .25rem; margin-bottom: .8rem; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; padding: .6rem .9rem; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sign); }
.pw { display: flex; gap: .4rem; }
.pw input { flex: 1; }
.auth-wrap { max-width: 26rem; margin: 0 auto; padding: 2.5rem 1rem 3rem; }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.auth-brand img { width: 3rem; height: 3rem; border-radius: 12px; }
.auth-brand h1 { font-size: 2rem; font-weight: 850; letter-spacing: -.03em; }
.auth-lead { color: var(--muted); margin-bottom: 1.4rem; }

/* ---------- plan summary and overview ---------- */
.verdict { border-left: 5px solid var(--muted); padding: .2rem 0 .2rem .9rem; margin: .4rem 0 1rem; }
.verdict[data-level="ready"], .verdict[data-level="realistic"] { border-color: var(--ok); }
.verdict[data-level="challenging"] { border-color: var(--tempo); }
.verdict[data-level="stretch"] { border-color: var(--intervals); }
.verdict[data-level="unlikely"] { border-color: var(--bad); }
.verdict strong { display: block; font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1rem 1.2rem; margin: 1rem 0; }
.fact b { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.fact span { color: var(--muted); font-size: .88rem; }
.warnings { margin: .8rem 0 0; padding-left: 1.1rem; color: var(--warn); }
table.paces { width: 100%; border-collapse: collapse; margin-top: .6rem; }
.paces th, .paces td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.paces th { font-weight: 650; }
.paces td { text-align: right; }
.paces thead th { color: var(--muted); font-size: .85rem; text-align: right; }
.paces thead th:first-child { text-align: left; }
details.panel summary { cursor: pointer; font-weight: 750; font-size: 1.05rem; }

.weeks { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.wk {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: .1rem .8rem; align-items: center; width: 100%;
  padding: .8rem .2rem; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
}
.wk:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.wk.is-current { background: color-mix(in srgb, var(--sign) 12%, transparent); }
.wk-n { font-size: 1.4rem; font-weight: 800; }
.wk-dates { font-weight: 650; }
.wk-sub { color: var(--muted); font-size: .88rem; }
.wk-km { text-align: right; font-weight: 750; }
.wk-done { text-align: right; color: var(--muted); font-size: .85rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: 10px; max-width: calc(100vw - 2rem); z-index: 10;
}
.loading { padding: 4rem 1rem; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .strip { scroll-behavior: smooth; }
  .btn-done, .btn, .chip { transition: background-color .15s, color .15s; }
}

/* ---------- accounts ---------- */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }   /* honeypot, off-screen */
.fine { color: var(--muted); font-size: .88rem; margin-top: 1rem; }
.fine a, .fine .link-btn { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.notice { margin-top: .9rem; padding: .7rem .85rem; border-radius: 10px; border-left: 4px solid var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: var(--ink); }
.notice:empty { display: none; }
.actions { margin-top: 1.1rem; }
.btn-danger { background: var(--bad); border-color: var(--bad); }
details.panel .sub { margin-top: .8rem; }

/* ---------- privacy page ---------- */
.prose { max-width: 42rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.prose h2 { font-size: 1.2rem; font-weight: 800; margin: 1.6rem 0 .4rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .45rem 0; }
.prose a { text-underline-offset: 3px; }
