/* Forma Attiva Nutri: tema caldo (verde acqua profondo, accento corallo, fondo crema). Tutti i colori sono variabili. */
:root {
  --bg: #fdf6ec; --surface: #ffffff; --surface-2: #f6ecdd; --text: #23302f; --muted: #5f6b69;
  --primary: #0f6466; --primary-strong: #0a4a4c; --primary-text: #ffffff;
  --accent: #e8643c; --accent-text: #ffffff; --accent-soft: #fde3d6;
  --border: #eadfce; --shadow: 0 2px 6px rgba(80, 50, 20, .07), 0 10px 24px rgba(80, 50, 20, .08);
  --warn-bg: #fff1d0; --warn-border: #f0cf82; --warn-text: #5a4000; --warn-ico: #d98a00;
  --hero-from: #0f6466; --hero-to: #168a86; --hero-text: #ffffff;
  --ring-bg: rgba(255, 255, 255, .25); --ring-fg: #ffb48f;
  --focus: #e8643c;
  /* figure degli esercizi */
  --figura: #2b3a42; --accento: #e8643c; --sfondo: #fff9f0;
  --fig-skin: #f2c9a0; --fig-skin-far: #d9ac80; --fig-shirt: #168a86; --fig-shirt-far: #0d6663;
  --fig-pants: #3d4a63; --fig-pants-far: #2a3448; --fig-shoe: #e8643c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101a1a; --surface: #182524; --surface-2: #1f302f; --text: #eef3f0; --muted: #a3b5b1;
    --primary: #4fc4bd; --primary-strong: #7fd9d3; --primary-text: #07211f;
    --accent: #ff8a5c; --accent-text: #2a0e03; --accent-soft: #43261a;
    --border: #2c3f3d; --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 24px rgba(0, 0, 0, .3);
    --warn-bg: #3b2f10; --warn-border: #6b5520; --warn-text: #ffe3a1; --warn-ico: #ffc044;
    --hero-from: #0b4749; --hero-to: #12706d; --hero-text: #f4fbf9;
    --ring-bg: rgba(255, 255, 255, .18); --ring-fg: #ff9d74;
    --focus: #ff8a5c;
    --figura: #dfe9e6; --accento: #ff8a5c; --sfondo: #1d2e2d;
    --fig-skin: #e9b88c; --fig-skin-far: #bf9068; --fig-shirt: #3fb3ac; --fig-shirt-far: #2a827d;
    --fig-pants: #6f80a3; --fig-pants-far: #4f5d7c; --fig-shoe: #ff8a5c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h2 { font-size: 1.6rem; line-height: 1.2; margin: .4rem 0 .2rem; color: var(--primary-strong); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .5rem; }
p { margin: .4rem 0; }
ul { margin: .4rem 0; padding-left: 1.2rem; }
li { margin: .2rem 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Avviso sanitario: scheda morbida, sempre in cima a ogni sezione */
.notice { display: flex; gap: 12px; align-items: flex-start; margin: 12px 16px 0; max-width: 1068px; padding: 12px 14px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); border-radius: 16px; font-size: .92rem; line-height: 1.45; }
.notice-ico { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--warn-ico); color: #fff; font-weight: 800; display: grid; place-items: center; }
@media (min-width: 1100px) { .notice { margin-left: auto; margin-right: auto; width: calc(100% - 32px); } }

/* Pulsanti */
button, select { font: inherit; }
button { background: var(--surface); color: var(--primary-strong); border: 1.5px solid var(--primary); border-radius: 12px; padding: 10px 16px; min-height: 48px; min-width: 44px; cursor: pointer; font-weight: 600; margin: 4px 6px 4px 0; transition: transform .12s ease, background-color .15s ease; }
button:hover { background: var(--surface-2); }
button:active { transform: scale(.97); }
button:not(.secondary):not(.tab):not([aria-pressed]) { background: var(--accent); color: var(--accent-text); border-color: var(--accent); box-shadow: 0 2px 6px rgba(232, 100, 60, .3); }
button:not(.secondary):not(.tab):not([aria-pressed]):hover { filter: brightness(1.06); }
button.secondary { background: transparent; }
button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button[aria-pressed="false"] { background: var(--surface); }
select { min-height: 44px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 6px 10px; }
input, textarea { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; font: inherit; max-width: 100%; }
label { display: block; margin: 12px 0; font-weight: 500; }
textarea { width: 100%; display: block; margin-top: 8px; }

/* Navigazione: barra in basso su telefono, schede in alto da 900px */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(80, 50, 20, .08); }
.tab { flex: 1 1 0; min-width: 0; margin: 0; padding: 6px 2px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; color: var(--muted); box-shadow: none; font-size: .7rem; font-weight: 600; border-radius: 12px; }
.tab:hover { background: var(--surface-2); }
.tab .ico { display: grid; place-items: center; width: 48px; height: 28px; border-radius: 14px; transition: background-color .2s ease; }
.tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tab[aria-current="page"] { color: var(--primary-strong); background: transparent; }
.tab[aria-current="page"] .ico { background: var(--accent-soft); color: var(--accent); }
.content { padding: 12px 16px 104px; max-width: 1100px; margin: 0 auto; }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 0; bottom: auto; justify-content: center; gap: 8px; padding: 8px 16px; border-top: 0; border-bottom: 1px solid var(--border); box-shadow: 0 6px 18px rgba(80, 50, 20, .06); margin-top: 12px; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 18px; font-size: 1rem; min-height: 48px; }
  .tab .ico { width: 28px; background: transparent; }
  .tab[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
  .tab[aria-current="page"] .ico { background: transparent; color: var(--primary-text); }
  .tab-label { overflow: visible; }
  .content { padding-bottom: 40px; }
}

/* Sezioni e schede */
.panel[hidden] { display: none; }
.panel { display: grid; grid-template-columns: 1fr; gap: 14px; }
.panel > h2, .panel > h3, .panel > p, .panel > label, .panel > button, .panel > ul, .panel > textarea, .panel > div[role="group"], .panel > header { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card h3 { color: var(--primary-strong); }
details.card > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
details.card[open] > summary { margin-bottom: 8px; }
.ref-photo { display: block; width: 100%; max-width: 340px; margin: 4px auto 8px; border-radius: 14px; border: 1px solid var(--border); }
.figure { max-width: 340px; margin: 4px auto 8px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.anim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 8px; }
.anim-controls label { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.timer { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary-strong); margin: .2rem 0; }
.tag { color: var(--muted); font-size: .95rem; }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); padding: 10px 14px; border-radius: 14px; }

/* Fascia in alto su Oggi */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-radius: 24px; color: var(--hero-text); background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); box-shadow: var(--shadow); }
.hero h2 { color: var(--hero-text); font-size: 2rem; margin: 0 0 6px; }
.greet { margin: 0; opacity: .9; font-weight: 600; }
.hero-target { margin: 0; opacity: .95; }
.hero-target strong { display: block; font-size: 3.2rem; line-height: 1; font-weight: 800; letter-spacing: -.02em; color: var(--hero-text); }
.ring { position: relative; width: 132px; height: 132px; flex: 0 0 auto; }
.ring svg { display: block; }
.ring-bg { stroke: var(--ring-bg); }
.ring-fg { stroke: var(--ring-fg); transition: stroke-dasharray .6s ease; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; text-align: center; }
.ring-text strong { font-size: 1.7rem; font-weight: 800; }
.ring-text span { font-size: .72rem; opacity: .9; }

/* Movimento morbido: solo se consentito */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .card, .hero { animation: fadein .45s ease both; }
  .panel > .card:nth-child(2n) { animation-delay: .05s; }
  .panel > .card:nth-child(3n) { animation-delay: .1s; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 420px) {
  .hero { padding: 16px; }
  .hero-target strong { font-size: 2.6rem; }
  .ring, .ring svg { width: 112px; height: 112px; }
}
@media (min-width: 900px) {
  body { font-size: 18px; }
  .panel { grid-template-columns: 1fr 1fr; gap: 18px; }
}
