/* Timer allenamento online — bozza. Si appoggia a ../calcolatore-massimale/styles.css per variabili, font e struttura.
   Colori delle fasi presi dall'app (lib/theme/colors.dart): Preparazione WARNING, Lavoro SUCCESS, Riposo PRIMARY. */

.tm-card {
  --prep: #ffab40; --work: #388e3c; --rest: #1976d2;
  display: flex; flex-direction: column; gap: 16px;
}
.tm-card [hidden] { display: none !important; }
.tm-card [data-phase="prep"] { --phase: var(--prep); }
.tm-card [data-phase="work"] { --phase: var(--work); }
.tm-card [data-phase="rest"] { --phase: var(--rest); }

/* la scheda cambia altezza tra impostazione, allenamento e riepilogo: ancorata in alto, il timer non si sposta */
#timer.hero { align-items: flex-start; }
#timer .hero-grid { align-items: start; }

/* ---------- Titolo: la parola più lunga ("allenamento") deve stare intera nella colonna ---------- */
#timer .hero-copy { container-type: inline-size; }
/* larghezza: margine di sicurezza sulla colonna; altezza: telefono in orizzontale non spinge il timer fuori schermo */
#timer .tm-title { font-size: min(96px, 16.5cqi, 18svh); white-space: nowrap; }
/* lingue con la riga più lunga di "allenamento": coefficiente ridotto in proporzione (misurato sul carattere della pagina) */
html[lang="fr"] #timer .tm-title { font-size: min(96px, 13cqi, 18svh); }
html[lang="es"] #timer .tm-title { font-size: min(96px, 14cqi, 18svh); }
html[lang="de"] #timer .tm-title { font-size: min(96px, 13.5cqi, 18svh); }
/* due colonne: il titolo resta in alto accanto al timer, non a metà della scheda lunga */
@media (min-width: 1051px) {
  #timer .hero-copy { align-self: start; justify-content: flex-start; padding-top: 24px; }
}

/* ---------- Schermo del timer: sempre in cima ---------- */
.tm-stage {
  --phase: #8b8b86;
  width: 100%; position: relative; overflow: hidden; padding: clamp(26px, 3.4vw, 44px) 24px clamp(34px, 3.8vw, 50px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 0; border-radius: 26px; background: var(--night); color: #fff; cursor: pointer; text-align: center;
  box-shadow: 0 26px 50px -24px rgba(0,0,0,.55); transition: transform .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; container-type: inline-size; user-select: none; -webkit-user-select: none;
}
.tm-stage:active { transform: scale(.992); }
.tm-stage:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.tm-phase {
  padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--phase) 26%, transparent); color: color-mix(in srgb, var(--phase) 62%, #fff);
  text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800;
}
/* cifre scalate sulla larghezza dello schermo del timer: "+59:59" misura 3,4 em, a 27 cqi resta sempre su una riga */
.tm-digits { white-space: nowrap; font-size: min(148px, 27cqi); line-height: 1; font-weight: 800; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
/* nel carattere PerformFont6 il "+" ha il centro 0,071 em più in basso dello "0" (misurato): lo si alza della stessa quantità */
.tm-plus { display: inline-block; margin-right: .1em; transform: translateY(-.071em); }
.tm-stage.is-over .tm-digits { color: color-mix(in srgb, var(--phase) 62%, #fff); }
.tm-serie { color: rgba(255,255,255,.72); font-size: 16px; font-weight: 500; }
.tm-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: rgba(255,255,255,.1); }
.tm-bar span { display: block; height: 100%; width: 0; background: var(--phase); transition: width .12s linear; }
.tm-status:empty { display: none; }
.tm-status { min-height: 21px; margin: -6px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.tm-actions { margin-top: -4px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.tm-edit, .tm-end { padding: 12px 24px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; }
.tm-edit:hover, .tm-end:hover { background: #f4f4f2; }
.tm-edit[aria-expanded="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }

/* Pulsante schermo intero, sovrapposto al timer */
.tm-stage-wrap { position: relative; display: flex; }
.tm-fs { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; transition: background .15s ease; }
.tm-fs:hover { background: rgba(255,255,255,.2); }
.tm-fs:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tm-fs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tm-fs-close, .is-full .tm-fs-open { display: none; }
.is-full .tm-fs-close { display: block; }

/* Schermo intero: restano timer, messaggio e popup serie */
/* a schermo intero tutta la pagina diventa scura: se il browser lascia una fascia scoperta ai lati, non si vede */
html.tm-noscroll, html.tm-noscroll body { overflow: hidden; background: var(--night); }
.tm-card.is-full {
  position: fixed; inset: 0; z-index: 2147483000; width: 100vw; height: 100vh; height: 100dvh; max-width: none; margin: 0; padding: 0; gap: 0;
  border: 0; border-radius: 0; background: var(--night); box-shadow: none; animation: none; backdrop-filter: none;
}
.tm-card.is-full .tm-stage-wrap { flex: 1; min-height: 0; }
.tm-card.is-full .tm-stage { height: 100%; justify-content: center; gap: clamp(8px, 2vh, 22px); border-radius: 0; box-shadow: none; }
.tm-card.is-full .tm-stage:active { transform: none; }
.tm-card.is-full .tm-phase { font-size: clamp(13px, 2.2vh, 22px); padding: .5em 1.2em; }
.tm-card.is-full .tm-digits { font-size: min(27cqi, 46vh); }
.tm-card.is-full .tm-serie { font-size: clamp(17px, 3.2vh, 34px); }
.tm-card.is-full .tm-bar { height: clamp(10px, 1.6vh, 18px); }
.tm-card.is-full .tm-fs { top: max(16px, env(safe-area-inset-top)); right: 16px; width: 46px; height: 46px; }
.tm-card.is-full .tm-status { position: absolute; left: 0; right: 0; bottom: clamp(26px, 5vh, 54px); margin: 0; padding: 0 16px; color: rgba(255,255,255,.6); pointer-events: none; }
.tm-card.is-full .tm-actions, .tm-card.is-full .tm-setup, .tm-card.is-full .tm-log, .tm-card.is-full .tm-summary { display: none; }
.tm-card.is-full .tm-form { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); width: min(520px, calc(100% - 32px)); transform: translateX(-50%); animation: tm-sheet .28s cubic-bezier(.2,.8,.2,1) both; box-shadow: 0 30px 70px -20px rgba(0,0,0,.8); }
/* con il popup aperto il timer sale e si rimpicciolisce: cifre sempre leggibili sopra il modulo */
.tm-card.is-full:has(.tm-form:not([hidden])) .tm-stage { justify-content: flex-start; padding-top: max(64px, 8vh); }
.tm-card.is-full:has(.tm-form:not([hidden])) .tm-digits { font-size: min(21cqi, 22vh); }
.tm-card.is-full:has(.tm-form:not([hidden])) .tm-status { display: none; }
@keyframes tm-sheet { from { opacity: 0; transform: translate(-50%, 24px); } }

.tm-card[data-state="running"]:not(.is-editing) .tm-setup,
.tm-card[data-state="running"] .tm-presets-wrap,
.tm-card[data-state="running"] .tm-hint:not(.tm-hint-run),
.tm-card:not([data-state="running"]) .tm-hint-run,
.tm-card[data-state="done"] .tm-setup,
.tm-card[data-state="done"] .tm-stage,
.tm-card[data-state="done"] .tm-status,
.tm-card[data-state="done"] .tm-log { display: none; }

/* ---------- Impostazione ---------- */
.tm-setup { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; }
.tm-cap { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; }
.tm-presets-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tm-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-chip {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #55554f;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .1s ease;
}
.tm-chip:hover { border-color: rgba(8,8,8,.3); color: var(--ink); }
.tm-chip:active { transform: scale(.97); }
.tm-chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }

.tm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tm-tile {
  position: relative; overflow: hidden; padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--line); border-radius: 20px; background: #fff; transition: opacity .2s ease, background .2s ease;
}
.tm-tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--phase); }
.tm-tile-head { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tm-tile-name { display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; }
.tm-tile-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--phase); }
.tm-stepper { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tm-stepper output { flex: 1; min-width: 0; text-align: center; font-size: clamp(24px, 2.3vw, 32px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.tm-stepper button, .tm-param button {
  flex: 0 0 auto; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f1f1ef; color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer; transition: background .15s ease, transform .1s ease;
}
.tm-stepper button:hover, .tm-param button:hover { background: #e6e6e3; }
.tm-stepper button:active, .tm-param button:active { transform: scale(.92); }
.tm-tile.is-off { background: #f7f7f5; }
.tm-tile.is-off::before, .tm-tile.is-off .tm-tile-name::before { background: #cfcfca; }
.tm-tile.is-off .tm-stepper { opacity: .3; pointer-events: none; }
.tm-tile.is-off .tm-tile-name { color: var(--muted); }

/* Interruttore */
.tm-switch { position: relative; flex: 0 0 auto; display: inline-flex; cursor: pointer; }
.tm-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tm-switch i { width: 42px; height: 26px; border-radius: 999px; background: #d9d9d5; transition: background .2s ease; }
.tm-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s cubic-bezier(.3,.8,.3,1); }
.tm-switch input:checked + i { background: var(--ink); }
.tm-switch input:checked + i::after { transform: translateX(16px); }
.tm-switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

.tm-options { border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.tm-opt { padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.tm-opt + .tm-opt { border-top: 1px solid var(--line); }
.tm-opt b { display: block; font-size: 15px; font-weight: 600; }
.tm-opt small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.tm-hint { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Popup serie ---------- */
.tm-form { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 8px 20px -14px rgba(0,0,0,.35); animation: tm-pop .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes tm-pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.tm-form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tm-form-head b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.tm-form-head span { color: var(--muted); font-size: 13px; }
.tm-name input { width: 100%; margin-top: 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafaf9; font-size: 16px; }
.tm-name input:focus { outline: 2px solid var(--brand); outline-offset: 1px; background: #fff; }
.tm-params { margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tm-param { padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: 16px; background: #f6f6f4; }
.tm-param > span { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 700; }
.tm-param > div { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tm-val { flex: 1; width: 100%; min-width: 0; padding: 2px 0; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: center; font: inherit; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.tm-val.is-accent { color: var(--brand); }
.tm-val:hover { background: rgba(255,255,255,.7); }
.tm-val:focus { outline: 2px solid var(--brand); outline-offset: 0; background: #fff; }
.tm-param button { width: 34px; height: 34px; background: #fff; }
.tm-form-actions { margin-top: 16px; display: flex; gap: 10px; }
.tm-skip { width: 54px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--muted); font-size: 18px; cursor: pointer; }
.tm-ok { flex: 1; min-height: 54px; border: 0; border-radius: 14px; background: var(--brand); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; transition: background .15s ease, transform .1s ease; }
.tm-ok:hover { background: var(--brand-dark); }
.tm-ok:active { transform: scale(.985); }
.tm-form-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Serie della sessione ---------- */
.tm-log { --log-cols: 40px minmax(0, 1fr) repeat(5, 52px); }
.tm-log-scroll { max-height: 300px; overflow: auto; }
.tm-log-cols, .tm-log-list li { display: grid; grid-template-columns: var(--log-cols); gap: 8px; align-items: center; padding-inline: 12px; }
.tm-log-cols { position: sticky; top: 0; z-index: 1; padding-block: 0 8px; background: #fbfbfb; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 700; }
.tm-log-cols span:nth-child(2) { padding-left: 6px; }
.tm-log-cols span, .tm-log-list li > * { text-align: center; }
.tm-log-cols span:nth-child(2), .tm-log-list li > :nth-child(2) { text-align: left; }
.tm-log-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column-reverse; gap: 6px; }
.tm-log-list li { padding-block: 10px; border-radius: 12px; background: #f6f6f4; font-size: 15px; font-variant-numeric: tabular-nums; }
.tm-log-list li span:first-child { font-weight: 800; color: var(--brand); }
.tm-log-list li > :nth-child(2) { font-weight: 600; }
/* celle modificabili: sembrano testo, si accendono al passaggio e al focus */
.tm-cell { width: 100%; min-width: 0; padding: 5px 2px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; text-align: center; text-overflow: ellipsis; cursor: text; }
.tm-log-list li > :nth-child(2).tm-cell { padding-left: 6px; text-align: left; }
.tm-cell::placeholder { color: #a3a39e; font-weight: 400; opacity: 1; }
.tm-cell:hover { background: rgba(255,255,255,.75); }
.tm-cell:focus { outline: 2px solid var(--brand); outline-offset: 0; background: #fff; }
.tm-log-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: right; }

/* ---------- Riepilogo: scheda sul modello di quella dell'app ---------- */
.tm-summary { display: flex; flex-direction: column; gap: 18px; }
.tm-sum-stack {
  --ink2: #1a1c1f; --muted2: rgba(26,28,31,.55); --line2: rgba(26,28,31,.12);
  border: 1px solid var(--line2); border-radius: 30px; background: #fafafb; color: var(--ink2); overflow: hidden;
  box-shadow: 0 30px 60px -34px rgba(0,0,0,.45); animation: tm-pop .35s cubic-bezier(.2,.8,.2,1) both;
}
.tm-sum-card { padding: clamp(20px, 2.6vw, 30px); }
.tm-sum-actions { margin-top: 16px; display: flex; justify-content: center; }
.tm-sum-eye { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; color: var(--ink2); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.tm-sum-eye svg { width: 20px; height: 20px; fill: currentColor; }
.tm-sum-eye:hover { background: #f1f1ef; }
.tm-sum-eye[aria-expanded="true"] { border-color: var(--ink2); background: var(--ink2); color: #fff; }
.tm-sum-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* elenco serie sotto il banner, in continuità con esso: si apre senza spostare il resto */
.tm-sum-detail-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s cubic-bezier(.3,.8,.3,1); }
.tm-sum-stack.is-open .tm-sum-detail-wrap { grid-template-rows: 1fr; }
.tm-sum-detail-in { min-height: 0; overflow: hidden; }
.tm-sum-detail { --log-cols: 40px minmax(0, 1fr) repeat(5, 52px); margin: 0 clamp(14px, 2vw, 22px); padding: 18px 0 clamp(16px, 2.2vw, 24px); border-top: 1px solid var(--line2); }
.tm-sum-detail .tm-log-cols { background: #fafafb; }
.tm-log-list li .is-empty { color: #a3a39e; font-weight: 400; }
.tm-sum-top { display: flex; align-items: center; gap: 10px; }
.tm-sum-top img { border-radius: 9px; }
.tm-sum-top > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.tm-sum-top b { font-size: 14px; font-weight: 600; }
.tm-sum-top div span { color: var(--muted2); font-size: 12px; }
.tm-sum-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255,75,11,.1); color: var(--ink2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tm-sum-pill svg { width: 14px; height: 14px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; }
.tm-sum-name { margin: clamp(18px, 2.4vw, 28px) 0 clamp(18px, 2.2vw, 24px); font-size: clamp(31px, 3.6vw, 42px); line-height: .98; font-weight: 600; letter-spacing: -.03em; text-transform: none; }
.tm-sum-metrics { padding: 14px 0; display: flex; align-items: stretch; border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.tm-sum-metrics > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tm-sum-metrics > i { width: 1px; background: var(--line2); }
.tm-sum-metrics span { color: var(--muted2); font-size: 12px; letter-spacing: .08em; }
.tm-sum-metrics strong { font-size: clamp(26px, 3vw, 34px); line-height: 1.05; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tm-sum-cap { margin: 18px 0 8px; text-align: center; color: var(--muted2); font-size: 11px; letter-spacing: .08em; }
.tm-sum-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tm-sum-list li { display: flex; align-items: baseline; gap: 12px; font-size: 15px; }
.tm-sum-list li > span:first-child { color: var(--muted2); font-size: 12px; font-variant-numeric: tabular-nums; }
.tm-sum-list li b { font-weight: 600; }
.tm-sum-record { margin: 16px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(26,28,31,.05); text-align: center; font-size: 14px; font-weight: 500; }
.tm-summary-text { margin: 0; color: #3d3d3d; font-size: 15px; text-align: center; }
.tm-summary-cta {
  position: relative; width: 100%; min-height: 64px; padding: 10px 10px 10px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1.5px solid rgba(255,75,11,.55); border-radius: 999px;
  background: linear-gradient(180deg, #fff, #fff7f2); color: var(--ink); text-decoration: none;
  font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  box-shadow: 0 14px 34px -14px rgba(255,75,11,.45), 0 0 0 6px rgba(255,75,11,.06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tm-summary-cta span { min-width: 0; }
.tm-summary-cta i { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; transition: transform .2s ease; }
.tm-summary-cta svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tm-summary-cta:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 18px 40px -14px rgba(255,75,11,.55), 0 0 0 8px rgba(255,75,11,.08); }
.tm-summary-cta:hover i { transform: translateX(3px); }
.tm-summary-cta:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
/* su telefono: logo dello store al posto della freccia */
.tm-summary-cta.is-store svg { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.tm-summary-cta.is-store:hover i { transform: none; }
.tm-again { align-self: center; padding: 8px 16px; border: 0; background: none; color: var(--muted); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- Sezione preimpostazioni ---------- */
.tm-modes { padding: 0 0 105px; }
.tm-modes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.tm-modes-grid article { padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.tm-modes-grid h3 { margin: 0 0 12px; font-size: 24px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.tm-modes-grid p { margin: 0; color: var(--muted); font-size: 16px; }

/* fasi in riga quando la scheda è stretta (telefono, o colonna stretta su desktop) */
@container (max-width: 640px) {
  .tm-tiles { grid-template-columns: 1fr; gap: 10px; }
  .tm-tile { padding: 14px 14px 12px 18px; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
  .tm-tile::before { inset: 0 auto 0 0; width: 4px; height: auto; }
  .tm-tile-head { flex: 1; min-width: 0; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .tm-tile-name::before { display: none; }
  .tm-stepper { flex: 0 0 auto; gap: 2px; }
  .tm-stepper output { flex: 0 0 auto; min-width: 78px; font-size: 24px; }
}
@container (max-width: 400px) {
  .tm-tile { padding: 12px 10px 12px 16px; gap: 8px; }
  .tm-tile-head { gap: 8px; }
  .tm-tile-name { letter-spacing: .03em; font-size: 11px; }
  .tm-tile .tm-switch i { width: 36px; height: 22px; }
  .tm-tile .tm-switch i::after { top: 3px; left: 3px; width: 16px; height: 16px; }
  .tm-tile .tm-switch input:checked + i::after { transform: translateX(14px); }
  .tm-stepper button { width: 30px; height: 30px; font-size: 17px; }
  .tm-stepper output { min-width: 60px; font-size: 20px; }
}
@media (max-width: 1050px) {
  .tm-modes-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .tm-opt b { font-size: 14px; }
  .tm-params { gap: 8px; }
  .tm-param { padding: 10px 4px; }
  /* telefono: valore sopra, pulsanti sotto, così numeri come 102,5 non vengono tagliati */
  .tm-param > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .tm-val { grid-column: 1 / -1; order: -1; font-size: 24px; }
  .tm-param button { width: 100%; height: 32px; border-radius: 10px; font-size: 18px; }
  .tm-log, .tm-sum-detail { --log-cols: 22px minmax(0, 1fr) 26px 38px 26px 38px 38px; }
  .tm-log-cols, .tm-log-list li { gap: 6px; padding-inline: 8px; font-size: 13px; }
  .tm-log-cols { font-size: 10px; letter-spacing: 0; }
  .tm-sum-pill { padding: 6px 8px; }
  .tm-actions { flex-wrap: nowrap; gap: 8px; }
  .tm-edit, .tm-end { flex: 1 1 0; min-width: 0; padding: 12px 8px; font-size: 15px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-form, .tm-log-list li, .tm-sum-stack { animation: none; }
  .tm-sum-detail-wrap { transition: none; }
  .tm-bar span, .tm-switch i, .tm-switch i::after { transition: none; }
}
