/* Hallmark · redesign · tone: exaggerated minimalism (austere) · anchor hue: red 27°
 * Regole dello stile: nero, bianco e un solo rosso; numeri e titoli enormi (peso 900, spaziatura
 * stretta); niente riquadri, ombre o angoli tondi: le sezioni sono separate da righe spesse e da spazio.
 * Adattato a un'app da palestra: le caselle restano grandi e i testi di servizio leggibili.
 * Carattere di sistema (nessun file da scaricare: funziona senza rete). */
:root {
  --color-paper: oklch(1 0 0);
  --color-paper-2: oklch(0.95 0 0);
  --color-ink: oklch(0.15 0 0);
  --color-ink-2: oklch(0.42 0 0);
  --color-rule: oklch(0.8 0 0);
  --color-accent: oklch(0.56 0.24 27);
  --color-accent-ink: oklch(1 0 0);
  --color-focus: oklch(0.56 0.24 27);
  --color-scrim: oklch(0 0 0 / 0.6);

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;

  --text-xs: 0.7rem;
  --text-sm: 0.9rem;
  --text-md: 1rem;
  --text-num: 1.45rem;
  --text-title: clamp(1.6rem, 7.6vw, 2.4rem);
  --text-figure: clamp(2rem, 9.4vw, 3rem);
  --text-display: clamp(2.7rem, 13.5vw, 5.5rem);
  --text-clock: clamp(3.2rem, 16vw, 5rem);

  --track-display: -0.05em;
  --track-title: -0.035em;
  --track-caps: 0.09em;

  --rule-thick: 3px;
  --rule-thin: 2px;
  --dur-press: 120ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-paper: oklch(0.13 0 0);
    --color-paper-2: oklch(0.2 0 0);
    --color-ink: oklch(0.98 0 0);
    --color-ink-2: oklch(0.74 0 0);
    --color-rule: oklch(0.46 0 0);
    --color-accent: oklch(0.66 0.24 27);
    --color-accent-ink: oklch(0.13 0 0);
    --color-focus: oklch(0.66 0.24 27);
    --color-scrim: oklch(0 0 0 / 0.72);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font: 500 17px/1.4 var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
}
body.has-timer { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: normal;
  overflow-wrap: anywhere;
  min-width: 0;
  text-wrap: balance;
}
h1 { font-size: var(--text-display); letter-spacing: var(--track-display); line-height: 0.92; margin: var(--space-lg) 0 var(--space-xl); }
h2 { font-size: var(--text-title); letter-spacing: var(--track-title); line-height: 1; margin: 0 0 var(--space-sm); }
p { margin: var(--space-2xs) 0; }
.eyebrow {
  margin: var(--space-lg) 0 var(--space-xs);
  font-size: var(--text-sm); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--color-accent);
}
.eyebrow + h1 { margin-top: 0; }
.muted { color: var(--color-ink-2); font-size: var(--text-sm); }
.loading, .error { padding: var(--space-lg) var(--space-md); }
.error { color: var(--color-accent); font-weight: 800; min-height: 1.4em; }

/* ---- testata */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--color-paper); color: var(--color-ink);
  border-bottom: var(--rule-thick) solid var(--color-ink);
  padding: calc(var(--space-sm) + env(safe-area-inset-top)) var(--space-md) 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.top-row strong {
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.program-line {
  margin: var(--space-2xs) 0 0;
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--color-accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.status {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
}
.status::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.status-ok { color: var(--color-ink); }
.status-wait { color: var(--color-accent); }
.banner {
  background: var(--color-accent); color: var(--color-accent-ink);
  font-weight: 800; font-size: var(--text-xs); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 6px var(--space-xs); margin-top: var(--space-xs);
}
.tabs { display: flex; gap: var(--space-md); margin-top: var(--space-2xs); }
.tabs .btn {
  flex: 0 1 auto; min-height: 46px; padding: var(--space-sm) 0 9px;
  background: none; color: var(--color-ink-2);
  border: 0; border-bottom: var(--rule-thick) solid transparent;
  font-size: var(--text-xs); letter-spacing: var(--track-caps); text-transform: uppercase; white-space: nowrap;
}
.tabs .btn-on { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.top-right { flex: none; display: flex; align-items: center; gap: var(--space-xs); }
.top .menu-btn { min-height: 44px; min-width: 44px; padding: 0; border: 0; background: none; font-size: 1.4rem; line-height: 1; }

/* ---- tasti e campi */
.btn {
  font: inherit; font-weight: 800; color: var(--color-ink);
  background: var(--color-paper); border: var(--rule-thin) solid var(--color-ink); border-radius: 0;
  padding: var(--space-sm) var(--space-md); min-height: 48px; cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible, .field:focus-visible, summary:focus-visible, .skip input:focus-visible {
  outline: 3px solid var(--color-focus); outline-offset: 2px;
}
.btn-main {
  width: 100%; min-height: 68px;
  background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper);
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; text-transform: uppercase;
}
.btn[disabled] { opacity: 0.5; }
.field {
  font: inherit; font-size: var(--text-md); color: var(--color-ink);
  background: transparent; border: 0; border-bottom: var(--rule-thick) solid var(--color-ink); border-radius: 0;
  padding: 6px 2px; min-height: 52px; width: 100%;
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--color-ink-2); opacity: 1; font-weight: 600; }
.field:disabled::placeholder { color: var(--color-rule); }
.field:focus { border-bottom-color: var(--color-accent); }
.field:disabled { border-bottom-color: var(--color-rule); opacity: 1; }
select.field { margin-bottom: var(--space-sm); font-weight: 800; -webkit-appearance: menulist; appearance: auto; }

/* ---- seduta */
.session { padding: 0 var(--space-md); max-width: 640px; margin: 0 auto; }
.card {
  border-top: var(--rule-thick) solid var(--color-ink);
  padding: var(--space-md) 0 var(--space-lg);
}
.card.done { border-top-color: var(--color-rule); }
.card.done::before, .card.skipped::before {
  content: "Fatto";
  display: inline-block; margin-bottom: var(--space-sm); padding: 3px var(--space-xs);
  background: var(--color-ink); color: var(--color-paper);
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
}
.card.skipped::before { content: "Saltato"; background: var(--color-paper); color: var(--color-ink); box-shadow: inset 0 0 0 var(--rule-thin) var(--color-ink); }
.card.done h2 { color: var(--color-ink-2); }
.card.skipped h2 { text-decoration: line-through; text-decoration-thickness: 3px; }
.presc { font-size: var(--text-md); }
.presc strong { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.group-label {
  display: flex; align-items: baseline; gap: var(--space-xs); margin-top: var(--space-xs);
  font-size: var(--text-sm); font-weight: 800;
}
.group-label::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--color-accent); }
.tobeat {
  margin: var(--space-md) 0 var(--space-sm);
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--color-ink-2);
}
.tobeat strong {
  display: block; margin-top: var(--space-2xs);
  font-family: var(--font-display); font-size: var(--text-figure); font-weight: 900; line-height: 1;
  letter-spacing: var(--track-title); text-transform: none; color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}
.tobeat .muted { font-size: var(--text-xs); font-weight: 600; }
.row { display: flex; gap: var(--space-sm); align-items: flex-end; margin: var(--space-sm) 0 var(--space-xs); }
.lbl {
  display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto;
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--color-ink-2);
}
.lbl.grow { flex: 1 1 auto; min-width: 0; }
.lbl > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.kg, .rir, .rep, .lbl.grow > .field {
  font-family: var(--font-display); font-size: var(--text-num); font-weight: 900; letter-spacing: -0.02em;
  text-align: center; font-variant-numeric: tabular-nums;
}
.kg { width: 88px; }
.rir { width: 60px; }
.reps { display: flex; gap: var(--space-xs); }
.rep { min-width: 0; flex: 1 1 0; }
.why { margin-top: var(--space-xs); }
details { margin-top: var(--space-xs); }
summary {
  display: inline-block; min-height: 44px; padding: var(--space-sm) 0; cursor: pointer;
  color: var(--color-ink); font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
.instr { font-size: 0.95rem; }
.note { margin: var(--space-sm) 0; resize: vertical; border: var(--rule-thin) solid var(--color-ink); padding: var(--space-xs); }
.note:focus { border-color: var(--color-accent); }
.skip { display: flex; align-items: center; gap: var(--space-sm); font-weight: 800; padding: var(--space-xs) 0; min-height: 44px; }
.skip input { width: 28px; height: 28px; margin: 0; accent-color: var(--color-ink); }
.skip.big { font-family: var(--font-display); font-size: var(--text-title); font-weight: 900; letter-spacing: var(--track-title); }
.saved:empty { display: none; }
.saved { display: block; min-height: 1.2em; font-size: var(--text-xs); letter-spacing: 0.04em; text-transform: uppercase; }
.close { margin: var(--space-sm) 0 var(--space-xl); }
.closed {
  background: var(--color-ink); color: var(--color-paper);
  padding: var(--space-sm) var(--space-md); font-weight: 700; margin: 0 0 var(--space-lg);
}
.closed .btn { margin-left: var(--space-xs); min-height: 44px; padding: 6px var(--space-md); border-color: var(--color-paper); }
.cardio-row { border-top: var(--rule-thick) solid var(--color-ink); padding-top: var(--space-md); margin: 0 0 var(--space-lg); }
.cardio-row h2 { margin-bottom: var(--space-xs); }
.day {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm);
  width: 100%; min-height: 60px; padding: var(--space-sm) 0; text-align: left;
  border-width: 0 0 var(--rule-thin); border-color: var(--color-rule);
}
.day span:first-child { min-width: 0; flex: 1 1 auto; }
.day::after { content: "→"; flex: none; font-weight: 900; }
.day .muted { flex: none; font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase; }

/* ---- login */
.login { max-width: 460px; margin: 0 auto; padding: 16vh var(--space-md) var(--space-xl); display: flex; flex-direction: column; gap: var(--space-md); }
.login h1 { font-size: clamp(3rem, 14.5vw, 5.5rem); margin: 0 0 var(--space-lg); }
.login .btn-main { margin-top: var(--space-sm); }

/* ---- finestre */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--color-scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--color-paper); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  border-top: var(--rule-thick) solid var(--color-ink);
  padding: var(--space-md) var(--space-md) calc(var(--space-md) + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); }
.sheet-head strong { font-family: var(--font-display); font-size: var(--text-title); font-weight: 900; letter-spacing: var(--track-title); line-height: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: calc(100vw - 2 * var(--space-md));
  background: var(--color-ink); color: var(--color-paper); padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm); font-weight: 800;
}

/* ---- timer */
.timerbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--color-ink); color: var(--color-paper);
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom));
}
.timerbar[hidden], .flash[hidden] { display: none; }
.timer-text { display: flex; flex-direction: column; min-width: 0; }
.timer-clock {
  font-family: var(--font-display); font-size: var(--text-clock); font-weight: 900; letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums; line-height: 0.9;
}
.timer-label {
  font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: var(--space-2xs);
}
.timer-skip { flex: none; min-width: 96px; background: transparent; color: inherit; border-color: currentColor; text-transform: uppercase; letter-spacing: 0.04em; }
.timer-done { background: var(--color-accent); color: var(--color-accent-ink); }
.flash {
  position: fixed; inset: 0; z-index: 40;
  background: var(--color-accent); color: var(--color-accent-ink);
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: var(--space-lg) var(--space-md) calc(var(--space-xl) + env(safe-area-inset-bottom));
  font-family: var(--font-display); font-size: clamp(3.4rem, 19vw, 8rem); font-weight: 900;
  letter-spacing: var(--track-display); line-height: 0.88; text-transform: uppercase; text-align: left;
}

/* ---- storico */
.hist > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.hist-date { font-size: var(--text-xs); font-weight: 800; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--color-ink-2); }
.hist-title { font-weight: 900; }
.hist .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
.hist > .muted { text-transform: uppercase; letter-spacing: var(--track-caps); font-weight: 800; }
.hist-open { color: var(--color-accent); font-weight: 800; }
.hist > .hist-open { color: var(--color-accent); }
.back { margin-top: var(--space-md); min-height: 44px; padding: 6px var(--space-md); }
.hist-card { padding-bottom: var(--space-md); }
.hist-result { font-family: var(--font-display); font-size: var(--text-num); font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.skipped-row h2 { text-decoration: line-through; text-decoration-thickness: 3px; }

/* ---- progressi */
.chart { width: 100%; height: auto; display: block; margin: var(--space-xs) 0; }
.chart-line { fill: none; stroke: var(--color-ink); stroke-width: 3; stroke-linejoin: miter; stroke-linecap: square; }
.chart-dot { fill: var(--color-accent); }
.chart-text { fill: var(--color-ink-2); font-size: 11px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* ---- telefoni stretti (sotto 360 px) */
@media (max-width: 359px) {
  .session, .top { padding-left: var(--space-sm); padding-right: var(--space-sm); }
  .tabs { gap: var(--space-sm); }
  .tabs .btn { letter-spacing: 0.03em; }
  .row { gap: var(--space-xs); }
  .kg { width: 70px; }
  .rir { width: 48px; }
  .reps { gap: 6px; }
}
