:root {
  --ink: #102f42;
  --ink-deep: #0e2a3a;
  --ink-soft: #1c4459;
  --paper: #faf8f3;
  --cream: #f3efe7;
  --card: #ffffff;
  --orange: #ff6b3d;
  --orange-dark: #d94e21;
  --orange-ink: #b8430f;
  --peach: #ffe6dc;
  --peach-soft: #fff3ee;
  --teal: #16a394;
  --mint: #e7f7f0;
  --green: #12a06f;
  --line: #d9e0e3;
  --line-soft: #e9eef0;
  --muted: #667780;
  --danger: #c2401f;

  --radius-lg: 24px;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 47, 66, 0.04), 0 2px 8px rgba(16, 47, 66, 0.04);
  --shadow: 0 2px 6px rgba(16, 47, 66, 0.05), 0 12px 28px rgba(16, 47, 66, 0.07);
  --shadow-lg: 0 8px 20px rgba(16, 47, 66, 0.08), 0 28px 60px rgba(16, 47, 66, 0.12);
  --shadow-cta: 0 6px 16px rgba(255, 107, 61, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -0.025em; margin: 0; line-height: 1.12; }
[hidden] { display: none !important; }

.wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 11.5px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ------------------------------ controlli ------------------------------ */

.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  background: var(--cream);
  color: var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
  min-height: 46px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn-primary { background: var(--orange); color: #fff; box-shadow: var(--shadow-cta); }
.btn-primary:hover { background: #ff7b51; box-shadow: 0 10px 22px rgba(255, 107, 61, 0.34); }
.btn-dark { background: var(--ink); color: #fff; box-shadow: 0 4px 14px rgba(16, 47, 66, 0.2); }
.btn-dark:hover { background: var(--ink-soft); }
.btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #c3ced2; background: #fcfdfd; }
/* Pulsanti secondari sopra l'immagine scura dell'intestazione. */
.btn-on-dark {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  color: #fff;
  backdrop-filter: blur(6px);
}
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.5); }
.btn-danger { background: #fff; border: 1.5px solid rgba(194, 64, 31, 0.32); color: var(--danger); }
.btn-danger:hover { background: #fdf3f0; }
.btn-sm { padding: 8px 15px; font-size: 12.5px; min-height: 38px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.field { display: grid; gap: 6px; }
.field > label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
}
.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
  min-height: 46px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #a9b6bb; }
.input:focus {
  outline: 0;
  border-color: var(--orange);
  box-shadow: 0 0 0 3.5px rgba(255, 107, 61, 0.15);
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--cream); color: var(--muted);
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.chip-read { background: var(--mint); color: #0b7a55; }
.chip-guess { background: var(--peach); color: var(--orange-ink); }

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-title { font-size: 15.5px; font-weight: 800; letter-spacing: -0.015em; }

/* ------------------------------- landing ------------------------------- */

.hero { background: var(--ink-deep); color: #fff; border-radius: 0 0 36px 36px; overflow: hidden; position: relative; }
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, #0e2a3a 0%, rgba(14, 42, 58, 0.97) 38%, rgba(14, 42, 58, 0.55) 72%, rgba(14, 42, 58, 0.25) 100%),
    url("hero-training.png") center / cover;
}
.hero > .wrap { position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  display: block; object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(255, 107, 61, 0.32));
}
.hero-copy { padding: 56px 0 76px; max-width: 640px; }
.hero h1 { font-size: clamp(38px, 6.4vw, 66px); margin-bottom: 18px; letter-spacing: -0.035em; }
.hero h1 em { font-style: normal; color: #ffb499; }
.hero p { color: #cfdce0; font-size: 17.5px; max-width: 540px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(22, 163, 148, 0.25); }

.section { padding: 84px 0; }
.section > h2 { font-size: clamp(28px, 3.6vw, 40px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { display: flex; flex-direction: column; }
.feature h3 { font-size: 20px; margin: 14px 0 8px; }
.feature p { color: var(--muted); font-size: 14.5px; margin: 0; }
.feature-icon {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  background: var(--peach); color: var(--orange-ink);
  display: grid; place-items: center; font-size: 21px;
}
/* I tre mockup hanno la stessa tela bianca e il telefono nella stessa
   posizione: nessuna ombra aggiunta, altrimenti si vedrebbe il rettangolo. */
.feature-shot {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 22px auto 0;
}
.site-footer { padding: 40px 0 56px; color: var(--muted); font-size: 13px; }

/* --------------------------------- app --------------------------------- */

.app { min-height: 100vh; background: var(--paper); }
.app-nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.app-nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 68px; }
.back-btn { flex-shrink: 0; font-weight: 800; }
.sync-state { flex-shrink: 0; white-space: nowrap; font-weight: 700; }
@media (max-width: 760px) { .sync-state { display: none; } }
.tabs { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent;
  padding: 9px 15px; border-radius: 999px;
  font-size: 13.5px; font-weight: 800; color: var(--muted); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="true"] { background: var(--peach); color: var(--orange-ink); }

.view { padding: 32px 0 110px; }
.view-head { margin-bottom: 24px; }
.view-head h1 { font-size: clamp(27px, 4.2vw, 36px); }
.view-head p { margin-top: 7px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; }
.metric {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}
.metric b { display: block; font-size: 27px; font-weight: 800; letter-spacing: -0.03em; }
.metric span { font-size: 11.5px; color: var(--muted); line-height: 1.35; display: block; margin-top: 3px; }

.week-picker { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.week-picker::-webkit-scrollbar { display: none; }
.week-picker button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 10px 18px; font-weight: 800; font-size: 13.5px; white-space: nowrap; min-height: 44px;
  color: var(--ink); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.week-picker button:hover { border-color: #c3ced2; }
.week-picker button[aria-pressed="true"] {
  background: var(--ink); color: #fff; border-color: var(--ink);
  box-shadow: 0 4px 12px rgba(16, 47, 66, 0.18);
}

.day-card { display: grid; gap: 14px; }
.day-card h3 { font-size: 19px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-line {
  display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px;
  width: 100%; text-align: left; background: transparent; border-inline: 0; border-top: 0;
  color: inherit; font-family: inherit;
}
button.ex-line { cursor: pointer; transition: background 0.14s; border-radius: 10px; }
button.ex-line:hover { background: var(--peach-soft); }
button.ex-line b::after { content: " ›"; color: var(--muted); font-weight: 700; }
.ex-line:last-child { border-bottom: 0; padding-bottom: 0; }
.ex-line b { font-weight: 700; }
.ex-line span { color: var(--muted); font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ----------------------------- allenamento ----------------------------- */

.workout-layout { display: grid; grid-template-columns: 1fr 330px; gap: 20px; align-items: start; }
.workout-side { position: sticky; top: 84px; display: grid; gap: 16px; }

.exercise {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.exercise.done { border-color: rgba(18, 160, 111, 0.35); background: #fbfefc; }
.exercise header { display: grid; gap: 9px; margin-bottom: 16px; }
.exercise h3 { font-size: 17.5px; letter-spacing: -0.02em; }
.exercise .meta { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.exercise .meta > b { color: var(--ink); font-variant-numeric: tabular-nums; }

.set-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 48px;
  gap: 10px; align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.set-row:first-of-type { border-top: 0; }
.set-index { font-size: 12px; font-weight: 800; color: var(--muted); }
.set-row .input {
  padding: 11px 10px; text-align: center; font-weight: 800; font-size: 16px;
  border-radius: 12px; background: #fcfdfd; font-variant-numeric: tabular-nums;
}
.set-row .input:focus { background: #fff; }
.set-target { font-size: 10.5px; color: var(--muted); text-align: center; display: block; margin-bottom: 3px; }
.set-done {
  width: 46px; height: 46px; border-radius: 13px;
  border: 1.5px solid var(--line); background: #fff;
  display: grid; place-items: center; font-size: 19px; font-weight: 800; color: #c6d1d4;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.set-done:hover { border-color: var(--green); color: var(--green); }
.set-done[aria-pressed="true"] {
  background: var(--mint); border-color: rgba(18, 160, 111, 0.45); color: var(--green);
}

.timer {
  background: var(--ink); color: #fff;
  border-radius: var(--radius); padding: 26px 22px; text-align: center;
  box-shadow: var(--shadow);
}
.timer .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fa8b1; font-weight: 800; }
.timer .clock {
  font-size: 54px; font-weight: 800; font-variant-numeric: tabular-nums;
  margin: 8px 0 6px; letter-spacing: -0.03em;
}
.timer .for { font-size: 12.5px; color: #b6c9ce; min-height: 19px; line-height: 1.4; }
.timer .controls { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.timer .btn { background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; }
.timer .btn:hover { background: rgba(255, 255, 255, 0.2); }
.timer .btn-primary { background: var(--orange); box-shadow: var(--shadow-cta); }
.timer .btn-primary:hover { background: #ff7b51; }
.timer.ringing { animation: pulse 0.75s ease-in-out infinite; }
@keyframes pulse { 50% { background: var(--orange); } }

.cadence {
  background: var(--ink-soft); color: #fff;
  border-radius: var(--radius); padding: 22px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.cadence .label { color: #9fb8c0; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.cadence .phase { font-size: 25px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -0.02em; }
.cadence .count { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }

/* -------------------------------- editor -------------------------------- */

.editor-exercise {
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 18px; background: #fff; display: grid; gap: 14px;
}
.editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.week-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: 10px; }
.week-input label { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.week-input .input { padding: 9px 11px; font-size: 13.5px; min-height: 40px; }
.prescription-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(66px, .55fr); gap: 7px; align-items: end; }
.prescription-edit .field { gap: 4px; min-width: 0; }
.prescription-edit .field > span, .raw-only > span { font-size: 9px; line-height: 1.3; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prescription-edit .input, .raw-only .input { min-width: 0; padding: 8px; font-size: 13px; }
.raw-prescription { grid-column: 1 / -1; }
.raw-prescription summary { color: var(--muted); font-size: 10px; cursor: pointer; padding: 2px 0; }
.raw-prescription .input { margin-top: 6px; }
.plan-actions { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.parse-hint { font-size: 11.5px; color: var(--green); font-weight: 800; display: block; margin-top: 3px; }
.parse-hint.empty { color: var(--muted); font-weight: 500; }

/* ------------------------------ caricamento ------------------------------ */

.dropzone {
  border: 2px dashed #c7d4d6; border-radius: var(--radius);
  padding: 34px 20px; text-align: center; background: var(--peach-soft);
  transition: border-color 0.18s, background 0.18s;
}
.dropzone.drag { border-color: var(--orange); background: var(--peach); }
.dropzone b { display: block; margin: 10px 0 0; font-size: 15.5px; }
.dropzone input[type="file"] { display: none; }

.progress { display: grid; gap: 8px; }
.bar { height: 8px; background: var(--cream); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; transition: width 0.35s ease; }

.history-chart { display: flex; align-items: flex-end; gap: 9px; height: 150px; }
.history-chart div {
  flex: 1; background: linear-gradient(180deg, #ff8a63, var(--orange));
  border-radius: 8px 8px 3px 3px; min-height: 6px; position: relative;
}
.history-chart span { position: absolute; inset-inline: 0; bottom: -21px; text-align: center; font-size: 10.5px; color: var(--muted); }

.progress-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); }
.progress-metrics { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.progress-metrics button { border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 9px 15px; min-height: 40px; font-size: 13px; font-weight: 800; transition: background .16s ease, color .16s ease; }
.progress-metrics button.selected { background: var(--peach); color: var(--orange-ink); }
.progress-period { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 800; }
.progress-period .input { width: auto; min-width: 160px; min-height: 42px; padding: 8px 34px 8px 12px; background: #fff; }
.progress-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.progress-summary .metric { min-width: 0; }
.progress-summary .metric b { overflow-wrap: anywhere; }
.progress-summary .metric:nth-child(1) { border-top: 3px solid var(--orange); }
.progress-summary .metric:nth-child(2) { border-top: 3px solid var(--teal); }
.progress-summary .metric:nth-child(3) { border-top: 3px solid #5476a4; }
.progress-layout { display: grid; grid-template-columns: minmax(230px, .72fr) minmax(0, 1.8fr); gap: 14px; align-items: start; }
.exercise-picker { min-width: 0; position: sticky; top: 82px; }
.exercise-list { display: grid; gap: 6px; max-height: 440px; overflow-y: auto; }
.exercise-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 11px; border: 1px solid transparent; border-radius: 12px; background: var(--paper); color: var(--ink); }
.exercise-choice:hover { border-color: var(--line); }
.exercise-choice.selected { border-color: rgba(255, 107, 61, .38); background: var(--peach-soft); color: var(--orange-ink); box-shadow: inset 3px 0 var(--orange); }
.exercise-choice span { font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.exercise-choice small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.progress-detail { min-width: 0; }
.exercise-chart { display: flex; align-items: stretch; gap: 10px; min-height: 220px; overflow-x: auto; padding: 10px 2px 26px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line-soft) 48px, transparent 49px); }
.exercise-bar-wrap { display: flex; flex: 0 0 52px; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; min-height: 180px; }
.exercise-bar-value { color: var(--muted); font-size: 9px; font-weight: 800; white-space: nowrap; }
.exercise-bar { width: min(30px, 70%); min-height: 3px; max-height: 145px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #ff9a72, var(--orange)); transition: height .24s ease; }
.exercise-chart[data-metric="load"] .exercise-bar { background: linear-gradient(180deg, #65c9b0, var(--teal)); }
.exercise-chart[data-metric="frequency"] .exercise-bar { background: linear-gradient(180deg, #7c9bc2, #5476a4); }
.exercise-bar.latest { box-shadow: 0 0 0 3px rgba(255, 107, 61, .13); }
.exercise-chart[data-metric="load"] .exercise-bar.latest { box-shadow: 0 0 0 3px rgba(22, 163, 148, .15); }
.exercise-chart[data-metric="frequency"] .exercise-bar.latest { box-shadow: 0 0 0 3px rgba(84, 118, 164, .16); }
.exercise-bar-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.exercise-history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.exercise-history-row:last-child { border-bottom: 0; }
.exercise-history-row:hover { background: linear-gradient(90deg, var(--peach-soft), transparent 70%); }
.exercise-history-stats { display: grid; gap: 3px; text-align: right; color: var(--muted); font-size: 11px; white-space: nowrap; }
.progress-session-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.progress-session-row:last-child { border-bottom: 0; }

/* Rifinitura visiva coerente per tutte le schermate, senza cambiare i flussi. */
h1, h2, h3, .panel-title, .btn, .metric b, .timer .clock, .cadence .count { letter-spacing: 0; }
body { background: linear-gradient(180deg, #fff 0, var(--paper) 560px); }
.btn { box-shadow: 0 1px 2px rgba(16, 47, 66, .04); }
.btn-primary { box-shadow: 0 5px 14px rgba(255, 107, 61, .24); }
.btn-primary:hover, .btn-dark:hover { transform: translateY(-2px); }
.btn-ghost:hover, .btn-danger:hover { box-shadow: var(--shadow-sm); }
.input { border-color: #d5dfe2; }
.input:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid rgba(22, 163, 148, .32); outline-offset: 2px; }
.card { border-color: rgba(16, 47, 66, .08); box-shadow: 0 3px 8px rgba(16, 47, 66, .035), 0 12px 28px rgba(16, 47, 66, .035); }
.hero { box-shadow: 0 18px 44px rgba(16, 47, 66, .14); }
.topbar { border-bottom: 1px solid rgba(255, 255, 255, .12); }
.hero-copy { animation: view-enter .55s cubic-bezier(.2, .75, .25, 1) both; }
.feature { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.feature:hover { transform: translateY(-4px); border-color: rgba(255, 107, 61, .25); box-shadow: var(--shadow); }
.feature-icon { transition: transform .22s ease, background .22s ease; }
.feature:hover .feature-icon { transform: rotate(-5deg) scale(1.04); background: var(--mint); color: #087d70; }
.app-nav { box-shadow: 0 3px 16px rgba(16, 47, 66, .04); }
.app-nav .brand-mark { filter: drop-shadow(0 3px 7px rgba(255, 107, 61, .2)); }
.tabs button[aria-current="true"] { box-shadow: inset 0 -2px var(--orange); }
.view-head { padding-bottom: 4px; }
.view-head h1 { display: inline-block; }
.view-head h1::after { content: ""; display: block; width: 38px; height: 4px; margin-top: 9px; border-radius: 4px; background: linear-gradient(90deg, var(--orange), #ffb07e); }
.view:not([hidden]) { animation: view-enter .22s ease-out both; }
@keyframes view-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.week-picker button[aria-pressed="true"] { background: var(--ink); box-shadow: 0 5px 14px rgba(16, 47, 66, .18); }
.day-card { border-top: 3px solid var(--teal); }
.exercise { border-color: rgba(16, 47, 66, .09); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.exercise:hover { border-color: rgba(22, 163, 148, .28); box-shadow: var(--shadow); }
.exercise.done { border-left: 4px solid var(--green); }
.set-done[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(18, 160, 111, .12); }
.timer { background: linear-gradient(145deg, #173e51, var(--ink-deep)); border: 1px solid rgba(255, 255, 255, .08); }
.cadence { background: linear-gradient(145deg, #17695f, #124e53); }
.editor-exercise { transition: border-color .18s ease, box-shadow .18s ease; }
.editor-exercise:focus-within { border-color: rgba(22, 163, 148, .4); box-shadow: 0 0 0 3px rgba(22, 163, 148, .07); }
.plan-actions { border-radius: 12px 12px 0 0; }
.dropzone { background: linear-gradient(145deg, #fff5f0, #eef9f6); border-color: #cbdcdb; }
.dropzone:hover { border-color: var(--teal); }
.modal { background: rgba(10, 31, 43, .58); backdrop-filter: blur(8px); }
.modal-card { border: 1px solid rgba(255, 255, 255, .72); animation: modal-enter .2s ease-out both; }
@keyframes modal-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.lock { background: linear-gradient(145deg, #0e2a3a, #163d50 70%, #17695f); }
.lock-card { border: 1px solid rgba(255, 255, 255, .8); }
.toast { backdrop-filter: blur(10px); }
.site-footer { border-top: 1px solid var(--line-soft); }
.exercise-picker, .progress-detail > .card { box-shadow: 0 4px 14px rgba(16, 47, 66, .045); }
.progress-toolbar { border-color: rgba(16, 47, 66, .1); }
.progress-metrics button.selected { box-shadow: 0 1px 3px rgba(184, 67, 15, .12); }
.exercise-chart { border-radius: 12px; }
.exercise-bar-wrap:last-child .exercise-bar-label { color: var(--ink); font-weight: 800; }
.exercise-history-row { border-radius: 8px; padding-inline: 8px; transition: background .16s ease; }
.exercise-history-row:hover { background: linear-gradient(90deg, var(--peach-soft), rgba(231, 247, 240, .28)); }
.exercise-choice { transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.exercise-choice:hover { transform: translateX(2px); }
.progress-session-row { transition: background .16s ease; }
.progress-session-row:hover { background: rgba(255, 255, 255, .68); }

@media (max-width: 760px) {
  .app-nav { box-shadow: 0 2px 12px rgba(16, 47, 66, .05); }
  .tabs button[aria-current="true"] { box-shadow: inset 0 0 0 1px rgba(255, 107, 61, .14); }
  .view:not([hidden]) { animation-duration: .18s; }
}

@media (max-width: 480px) {
  .topbar { padding: 16px 0; }
  .hero-copy { padding: 42px 0 54px; }
  .hero p { font-size: 15.5px; }
  .feature:hover, .exercise-choice:hover { transform: none; }
  .progress-toolbar { padding: 8px; }
}

/* -------------------------------- overlay -------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 40; padding: 16px;
  background: rgba(14, 42, 58, 0.5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.modal-card {
  width: min(540px, 100%); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow-lg);
}
.modal-card h2 { font-size: 26px; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 9px; margin-top: 20px; flex-wrap: wrap; }

.lock { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink-deep); color: #fff; }
.lock-card {
  width: min(400px, 100%); background: #fff; color: var(--ink);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg);
}
.lock-card h2 { font-size: 26px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%);
  background: var(--ink); color: #fff; padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; box-shadow: var(--shadow-lg); z-index: 60;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 8px; font-size: 19px; }
.empty p { margin: 0 auto 18px; max-width: 42ch; }

@media (max-width: 900px) {
  .workout-layout { grid-template-columns: 1fr; }
  .workout-side { position: static; }
  .progress-layout { grid-template-columns: 1fr; }
  .exercise-picker { position: static; }
  .exercise-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); max-height: 300px; }
  .grid-3 { grid-template-columns: 1fr; }
  .feature-shot { max-width: 420px; margin-inline: auto; }
  .hero-copy { padding: 36px 0 52px; }
  .hero { border-radius: 0 0 28px 28px; }
  .section { padding: 56px 0; }
}

/* ------------------------- telefono: uso in palestra ------------------------- */

@media (max-width: 760px) {
  /* Un backdrop-filter sull'intestazione ancorerebbe a sé la barra in basso
     invece che allo schermo: qui serve uno sfondo pieno. */
  .app-nav { backdrop-filter: none; background: #fff; }

  /* Le sezioni vanno in basso, dove arriva il pollice. */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line-soft);
    box-shadow: 0 -4px 20px rgba(16, 47, 66, 0.07);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    gap: 2px; overflow: visible;
  }
  .tabs button { flex: 1; padding: 9px 3px; font-size: 11px; border-radius: 12px; text-align: center; }
  .app-nav .wrap { height: 60px; }
  .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* Sotto l'allenamento passano barra e timer flottante: serve più spazio. */
  [data-view-panel="workout"] { padding-bottom: calc(178px + env(safe-area-inset-bottom)); }

  /* 16px esatti: sotto questa soglia iOS ingrandisce la pagina al tocco. */
  .input, .set-row .input { font-size: 16px; }

  /* Il recupero in corso si stacca e resta sopra la barra, sempre leggibile. */
  .timer.running {
    position: fixed; z-index: 28;
    left: 10px; right: 10px; bottom: calc(68px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 14px; text-align: left;
    padding: 12px 16px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
  }
  .timer.running .label { display: none; }
  .timer.running .clock { font-size: 34px; margin: 0; flex-shrink: 0; }
  .timer.running .for { flex: 1; min-width: 0; font-size: 11.5px; min-height: 0; }
  .timer.running .controls { margin: 0; flex-shrink: 0; gap: 6px; }
  .timer.running .controls .btn { min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .timer.running .controls .btn:not(.btn-primary) { display: none; }

  .workout-side { gap: 12px; }
  .view-head { margin-bottom: 18px; }
  .section { padding: 44px 0; }
}

@media (max-width: 480px) {
  .set-row { grid-template-columns: 28px 1fr 1fr 46px; gap: 8px; }
  .metric { padding: 15px 12px; }
  .metric b { font-size: 24px; }
  .metric span { font-size: 10.5px; }
  .progress-summary { gap: 7px; }
  .progress-summary .metric { padding: 12px 9px; }
  .progress-summary .metric b { font-size: 17px; }
  .progress-summary .metric span { font-size: 9px; }
  .progress-toolbar { align-items: stretch; }
  .progress-metrics { display: grid; grid-template-columns: repeat(3, 1fr); }
  .progress-metrics button { padding: 8px; }
  .progress-period { justify-content: space-between; }
  .progress-period .input { flex: 1; }
  .exercise-history-row { align-items: flex-start; }
  .exercise-history-stats { font-size: 10px; }
  .view { padding: 24px 0 84px; }
  .card { padding: 18px; }
  .modal-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
