/* ============================================================
   Palestra Tracker — tema "ghisa & gesso"
   Grafite, gomma da pavimento, gesso da presa, rosso da pettorale
   di gara, giallo bilanciere per i record personali.
   ============================================================ */

:root {
  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --surface-alt: #EAE7DF;
  --text: #1B1D1F;
  --text-secondary: #6B6F70;
  --border: #DEDBD2;
  --accent: #D93A2B;
  --accent-text: #FFFFFF;
  --accent-2: #C98A00;
  --danger: #C7362A;
  --radius: 16px;
  --font-display: "Oswald", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #14171A;
  --surface: #1E2226;
  --surface-alt: #262B30;
  --text: #F2F0EA;
  --text-secondary: #989D9D;
  --border: #33383D;
  --accent: #FF4A3D;
  --accent-text: #14171A;
  --accent-2: #FFC94D;
  --danger: #FF5C4D;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  backdrop-filter: saturate(160%) blur(8px);
}

.brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.topbar-actions { display: flex; align-items: center; gap: 2px; }
.topbar-actions .icon-btn { text-decoration: none; }

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 8px;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  transition: transform 0.05s ease, background 0.05s ease;
}
.icon-btn:active { transform: scale(0.88); background: var(--surface-alt); }

.container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 18px 100px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.flash {
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login ---------- */

.login-box { text-align: center; margin-top: 22vh; animation: fadeUp 0.5s ease both; }
.login-box h1 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.subtitle { color: var(--text-secondary); margin-bottom: 28px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Form elements ---------- */

input, select, textarea {
  font-size: 16px; /* evita zoom automatico su iOS */
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 90px;
  line-height: 1.4;
}

label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

/* Numeri (peso, round, rep, date) in monospace tabellare: leggibilità da
   quadrante, coerente in tutta l'app */
input[type="number"], input[type="date"], .history-values, .history-date,
.trim-labels span, .label-duration {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
}
input[type="date"]::-webkit-date-and-time-value {
  text-align: center;
  width: 100%;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:active { filter: brightness(0.92); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-full { width: 100%; margin-top: 8px; }

/* ---------- Floating Action Button ---------- */

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgba(0,0,0,0.25);
  z-index: 20;
  transition: transform 0.05s ease;
}
.fab:active { transform: scale(0.9); }

/* ---------- Search ---------- */

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-bar input { flex: 1; }
.clear-btn { color: var(--text-secondary); text-decoration: none; font-size: 18px; padding: 0 6px; }

.action-row { display: flex; gap: 10px; margin-bottom: 4px; }
.action-row .btn { flex: 1; }

/* ---------- Exercise list ---------- */

.exercise-list { list-style: none; padding: 0; margin: 0; }
.exercise-list li {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.exercise-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.05s ease, border-color 0.08s ease;
}
.exercise-card:active { transform: scale(0.98); border-color: var(--accent); }

.exercise-info { display: flex; flex-direction: column; gap: 3px; }
.exercise-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.exercise-meta { font-size: 13px; color: var(--text-secondary); font-family: var(--font-mono); }
.video-badge { font-size: 16px; color: var(--accent); }

.exercise-thumb-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  margin-left: 10px;
}
.exercise-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  background: rgba(0,0,0,0.25);
}

.empty-state { color: var(--text-secondary); text-align: center; margin-top: 40px; }

/* ---------- Home (selezione sezione) ---------- */

.home-menu {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 16px);
  flex: 1;
  min-height: 0;
}
.container:has(> .home-menu) { padding-bottom: clamp(10px, 1.6vh, 18px); }
/* Ogni pulsante si divide equamente lo spazio verticale disponibile e
   può rimpicciolirsi (min-height:0) se lo schermo è basso: così restano
   sempre tutti visibili senza dover scorrere. */
.home-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(8px, 1.4vh, 20px);
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.05s ease, border-color 0.08s ease;
}
.home-card:nth-child(2) { animation-delay: 80ms; }
.home-card:nth-child(3) { animation-delay: 160ms; }
.home-card:nth-child(4) { animation-delay: 240ms; }
.home-card:nth-child(5) { animation-delay: 320ms; }
.home-card:nth-child(6) { animation-delay: 400ms; }
.home-card:active { transform: scale(0.97); border-color: var(--accent); }
.home-card-icon { font-size: 40px; line-height: 1; }
.home-card-stack {
  flex-direction: column;
  gap: 6px;
  padding: 28px 20px;
  min-height: auto;
}
.home-card-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 22px;
  font-weight: 600;
}
.home-card-desc { color: var(--text-secondary); font-size: 13px; }
.home-card-logo-frame {
  background: #ffffff;
  border-radius: clamp(8px, 1.4vh, 14px);
  padding: clamp(6px, 1.1vh, 16px) clamp(10px, 1.8vh, 22px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-height: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.home-card-logo {
  width: auto;
  height: clamp(42px, 8.2vh, 108px);
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.home-card-logo-frame-wide { padding: clamp(7px, 1.3vh, 18px) clamp(12px, 2.1vh, 26px); }
.home-card-logo-wide {
  width: auto;
  height: clamp(34px, 6.5vh, 85px);
  max-width: 100%;
}
.home-card-emoji { font-size: clamp(34px, 6.5vh, 76px); line-height: 1; display: block; }

/* ---------- Exercise detail ---------- */

.back-link { color: var(--accent); text-decoration: none; font-size: 15px; display: inline-block; margin-bottom: 10px; font-weight: 600; }

.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; animation: fadeUp 0.4s ease both; }
.title-row .exercise-title { margin: 4px 0 2px; }
.exercise-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 28px;
}
.title-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pdf-btn { flex-shrink: 0; padding: 9px 14px; font-size: 14px; }
.exercise-desc { color: var(--text-secondary); margin-top: 0; animation: fadeUp 0.45s ease both; }

.exercise-video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  margin: 14px 0;
  max-height: 50vh;
  animation: fadeUp 0.5s ease both;
}

h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 15px;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin: 28px 0 10px;
}

.video-upload-form { margin-bottom: 20px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}

.log-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  animation: fadeUp 0.4s ease both;
}
.form-row { margin-bottom: 12px; }
.form-row:last-child { margin-bottom: 0; }
.two-cols { display: flex; gap: 10px; }
.two-cols label { flex: 1; }
.three-cols { display: flex; gap: 8px; }
.three-cols label { flex: 1; }
.four-cols { display: flex; gap: 6px; }
.four-cols label { flex: 1; min-width: 0; }
.four-cols input { padding: 13px 8px; font-size: 14px; }

/* ---------- History ---------- */

.history-list { list-style: none; padding: 0; margin: 0; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 8px;
  animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  position: relative;
  overflow: hidden;
}
.history-item.is-pr {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 50%, transparent);
}
.history-main { display: flex; flex-direction: column; gap: 2px; }
.history-date { font-size: 13px; color: var(--text-secondary); }
.history-values { font-size: 16px; font-weight: 600; }
.history-note { font-size: 13px; color: var(--text-secondary); font-style: italic; margin-left: 8px; flex: 1; }
.history-actions { display: flex; align-items: center; gap: 4px; }
.history-actions form { margin: 0; }
.delete-btn { color: var(--danger); }

.history-link-wrap { text-decoration: none; color: inherit; display: block; }

.video-salvato-item { flex-wrap: wrap; }
.video-check-inline { width: 20px; height: 20px; flex-shrink: 0; margin-right: 10px; accent-color: var(--accent); }
.video-salvato-item .history-main { flex: 1; min-width: 0; }
.video-salvato-item .video-player {
  display: none;
  width: 100%;
  margin-top: 12px;
  border-radius: 10px;
}
.video-salvato-item .video-player.aperto { display: block; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  animation: fadeUp 0.4s ease both;
}

.tipo-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 6px;
  vertical-align: middle;
}
.tipo-wod { background: var(--surface-alt); color: var(--text-secondary); }
.tipo-massimale { background: var(--accent); color: var(--accent-text); }

.pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-2);
  color: #1B1D1F;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 8px;
  animation: prPulse 1.4s ease-in-out infinite;
}

@keyframes prPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 55%, transparent); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-2) 0%, transparent); }
}

.hint { font-size: 14px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }

.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; animation: fadeUp 0.4s ease both; }
.settings-section h2 { margin-top: 0; }

.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Video trim widget ---------- */

.video-trim-widget { display: none; margin-top: 12px; }
.video-trim-widget.visible { display: block; animation: fadeUp 0.3s ease both; }

.trim-preview {
  width: 100%;
  max-height: 220px;
  border-radius: 12px;
  background: #000;
  margin-bottom: 8px;
}

.trim-slider { position: relative; height: 44px; margin: 8px 2px 4px; touch-action: none; }
.trim-track { position: absolute; top: 20px; left: 13px; right: 13px; height: 4px; background: var(--border); border-radius: 2px; }
.trim-range-fill { position: absolute; top: 20px; height: 4px; background: var(--accent); border-radius: 2px; }
.trim-handle {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: grab;
  touch-action: none;
  z-index: 2;
  transition: transform 0.12s ease;
}
.trim-handle.dragging { cursor: grabbing; transform: scale(1.15); box-shadow: 0 2px 8px rgba(0,0,0,0.45); }

.trim-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.trim-labels .label-duration { flex: 1; text-align: center; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text);
}
.checkbox-row input[type="checkbox"] {
  width: 20px; height: 20px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.share-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--text);
}
.share-check-row:last-of-type { border-bottom: none; }
.share-check-row input[type="checkbox"] {
  width: 22px; height: 22px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.story-check-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px;
  margin-bottom: 18px;
}
.story-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}
.story-canvas-preview {
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}

/* ---------- Overlay caricamento/elaborazione video ---------- */

.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.upload-overlay.visible { display: flex; }

.upload-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 22px;
  width: 100%;
  max-width: 320px;
  max-height: 82vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.upload-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 16px;
}
.upload-progress-track {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}
.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 4px;
  transition: width 0.15s ease;
}
.upload-progress-fill.indeterminate {
  width: 40% !important;
  position: absolute;
  top: 0;
  animation: uploadIndeterminate 1.1s ease-in-out infinite;
}
@keyframes uploadIndeterminate {
  0% { left: -40%; }
  100% { left: 100%; }
}
.upload-status-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.upload-error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

.upload-checklist {
  text-align: left;
  margin: 4px 0 16px;
}
.upload-checklist-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.upload-checklist-item:first-child { padding-top: 0; }
.upload-checklist-item:last-child { border-bottom: none; padding-bottom: 0; }
.upload-checklist-nome {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-all;
}
.upload-checklist-passi { display: flex; flex-direction: column; gap: 4px; }
.passo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.passo-icona { width: 16px; text-align: center; flex-shrink: 0; }
.passo.attesa { opacity: 0.55; }
.passo.attivo { color: var(--accent); }
.passo.attivo .passo-icona { animation: passoPulsa 1s ease-in-out infinite; }
.passo.fatto .passo-icona { color: #2ecc71; }
.passo.errore { color: var(--danger); }
@keyframes passoPulsa { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Bottom sheet (pannello aggiungi esecuzione) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 30;
}
.sheet-backdrop.open { opacity: 1; pointer-events: all; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 0.14s ease-out;
  z-index: 31;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 6px auto 14px;
}

.sheet .log-form {
  border: none;
  padding: 0;
  margin-bottom: 0;
  animation: none;
}

/* ---------- Timer (cronometro / countdown) ---------- */

.mode-switch {
  display: flex;
  gap: 8px;
  background: var(--surface-alt);
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 16px;
}
.mode-btn {
  flex: 1;
  padding: 11px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.08s ease, color 0.08s ease;
}
.mode-btn.attiva {
  background: var(--accent);
  color: var(--accent-text);
}

.timer-stage {
  text-align: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}
.stage-lavoro { color: var(--accent); }
.stage-recupero { color: var(--accent-2); }
.stage-prestart { color: var(--accent-2); }

.timer-display {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  /* Numeri molto grandi: leggibili anche col telefono appoggiato a terra */
  font-size: clamp(84px, 30vw, 190px);
  letter-spacing: -0.02em;
  line-height: 1.0;
  color: var(--text);
  margin: 10px 0 6px;
}

.timer-stage {
  font-size: clamp(16px, 4.6vw, 24px);
}

.timer-rounds {
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 26px;
  min-height: 22px;
}

/* ---------- Laboratorio video ---------- */

.clip-box { padding: 14px; }
.clip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.clip-nome {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-azioni { display: flex; gap: 2px; flex-shrink: 0; }
.clip-azioni .icon-btn:disabled { opacity: 0.3; }
.clip-video {
  width: 100%;
  max-height: 200px;
  border-radius: 12px;
  background: #000;
  display: block;
  margin-bottom: 6px;
}
.badge-velocita {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 34px;
  padding: 0;
}

/* ---------- Calendario WOD ---------- */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 14px;
}
.cal-titolo {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 22px;
  margin: 0;
  text-align: center;
  flex: 1;
}
.cal-header .icon-btn { font-size: 28px; line-height: 1; padding: 4px 14px; }

.cal-griglia {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.cal-nomi, .cal-settimana {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-nomi span {
  text-align: center;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding-bottom: 6px;
}
.cal-settimana { margin-bottom: 4px; }

.cal-giorno {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--surface-alt);
  transition: transform 0.05s ease, background 0.08s ease;
}
.cal-giorno:active { transform: scale(0.92); }
.cal-giorno.fuori { opacity: 0.32; }
.cal-giorno.oggi {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  font-weight: 700;
}
.cal-giorno.con-wod { background: color-mix(in srgb, var(--accent) 22%, var(--surface-alt)); }
.cal-pallino {
  position: absolute;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Sezioni Strength / WOD ---------- */

.sezione-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 26px 0 10px;
}
.sezione-titolo {
  margin: 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 17px;
}
.col-strength { color: var(--accent-2); }
.col-wod { color: var(--accent); }

.riga-valori {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: block;
}
.riga-valori.fatto { color: var(--accent-2); margin-top: 4px; }

.etichetta-val {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 6px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  vertical-align: middle;
}
.etichetta-val.fatto {
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
  color: var(--accent-2);
}

.history-item.riga-fatta {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
}

/* ---------- Gruppi a round dentro Strength / WOD ---------- */

.blocco {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-bottom: 16px;
}
.blocco-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.blocco-round {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 15px;
  color: var(--text);
}
.blocco-azioni { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.blocco-azioni form { margin: 0; }

.promemoria-massimale {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
  color: var(--text);
}

.timer-totale {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(14px, 3.8vw, 19px);
  color: var(--text-secondary);
  margin: -18px 0 24px;
  min-height: 20px;
}
