/* Statum — la scheda in una schermata sola.
   Palette calda: il nero ha una base bruna, l'inchiostro è crema. */

:root {
  --bg:        #12100D;
  --bg-lift:   #1B1713;
  --surface:   #231E19;
  --line:      #342C24;
  --line-soft: #262019;

  --ink:       #F5EFE3;
  --ink-dim:   #B0A492;
  --muted:     #7C7061;

  --accent:    #EFA940;
  --accent-dim:#8A6220;
  --down:      #C4553C;

  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;

  --ease: cubic-bezier(.22,.9,.28,1);
  --num: -0.045em;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* --- cornice --- */
.stage { height: 100%; display: grid; place-items: center; }
.phone {
  position: relative;
  width: 100%; max-width: 430px; height: 100%;
  overflow: hidden;
  background: var(--bg);
  display: flex; flex-direction: column;
}
@media (min-width: 600px) {
  body { background: #0B0907; }
  .stage { padding: 24px; }
  .phone {
    height: min(920px, calc(100% - 48px));
    border-radius: 34px; border: 1px solid var(--line);
    box-shadow: 0 40px 90px rgba(0,0,0,.6);
  }
}

/* --- identità --- */
.head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
/* il cambio scheda: nome corrente + freccia verso l'altra. Toccabile. */
.cardsw {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 2px 6px 2px 0;
}
.cardsw:active { opacity: .55; }
.cardsw .wm { font-size: 9px; font-weight: 700; letter-spacing: .34em; color: var(--muted); }
.cardsw .cn {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--ink-dim);
}
.cardsw .cn i {
  font-style: normal; font-size: 12px; line-height: 1;
  color: var(--accent);
}
.who { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.who-row { display: flex; align-items: center; gap: 8px; }
.who-row b { font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px;
}
/* la costante fisiologica: sta con l'identità, non tra le capacità */
.const { font-size: 9px; font-weight: 600; letter-spacing: .05em; color: var(--muted); }
.const b { font-weight: 800; color: var(--ink-dim); font-size: 10.5px; }

/* --- il numero --- */
.hero {
  flex: none; padding: 8px 20px 0;
  max-height: 140px; overflow: hidden;
  transition: opacity .25s var(--ease), max-height .4s var(--ease), padding .4s var(--ease);
}
.hero .row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.hero .v { font-size: 58px; font-weight: 800; letter-spacing: var(--num); line-height: .86; }
.hero .side { text-align: left; }
.hero .side .k { font-size: 8.5px; font-weight: 700; letter-spacing: .28em; color: var(--muted); }
.hero .delta {
  display: inline-block; margin-top: 5px;
  font-size: 11px; font-weight: 800;
  color: var(--accent); background: rgba(239,169,64,.13);
  border-radius: 999px; padding: 3px 9px;
}
.hero .delta.ghosted { color: var(--ink-dim); background: rgba(245,239,227,.07); }
.hero .rank { margin-top: 5px; font-size: 10.5px; font-weight: 600; color: var(--ink-dim); }
.hero .rank em { font-style: normal; font-weight: 800; color: var(--ink); }

/* --- il ragno --- */
.radar-wrap {
  flex: 1 1 auto; min-height: 0;
  display: grid; place-items: center;
  padding: 2px 8px;
}
.radar {
  position: relative;
  height: min(100%, 310px); aspect-ratio: 1; max-width: 100%;
  transition: transform .45s var(--ease), opacity .35s var(--ease);
}
.radar svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.ring         { fill: none; stroke: var(--line); stroke-width: 1; }
.spoke        { stroke: var(--line); stroke-width: 1; }
.spoke.reach  { stroke: var(--ink-dim); stroke-width: 1.5; opacity: .5; }
.spoke.beyond { stroke: var(--line); stroke-width: 1; }
.tick         { stroke: var(--ink-dim); stroke-width: 2; opacity: .8; }
.spoke.on     { stroke: var(--accent-dim); stroke-width: 1.5; opacity: 1; }

.ghost     { fill: none; stroke: var(--muted); stroke-width: 1.5; opacity: .55; }
.mine      { fill: rgba(239,169,64,.07); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.vertex    { fill: var(--bg); stroke: var(--ink); stroke-width: 2.5; }
.vertex.on { fill: var(--accent); stroke: var(--accent); }
.wedge     { fill: transparent; cursor: pointer; }

/* guardando un altro profilo, il contorno ambra sei TU */
.phone.other .ghost { stroke: var(--accent); opacity: .8; }
.phone.other .mine  { fill: rgba(245,239,227,.05); stroke: var(--ink-dim); }
.phone.other .vertex { stroke: var(--ink-dim); }

/* le etichette sono piazzate sull'asse dal JS */
.axis {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 2px 4px; white-space: nowrap;
  transition: transform .25s var(--ease), opacity .3s var(--ease);
}
.axis .n { font-size: 25px; font-weight: 800; letter-spacing: var(--num); line-height: .9; }
.axis .l { font-size: 8px; font-weight: 700; letter-spacing: .13em; color: var(--muted); }
.axis .d { font-style: normal; font-weight: 800; color: var(--accent); }
.axis .d.down { color: var(--down); }
.axis .d.flat { color: var(--muted); }
.axis.on .n { color: var(--accent); }
.axis.on .l { color: var(--accent-dim); }
.axis:active { transform: translate(-50%, -50%) scale(.93); }

/* --- le statistiche: due colonne, sei gruppi, diciotto righe, tutto a schermo --- */
.sheet {
  flex: none;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px;
  padding: 0 16px;
}
.grp-h {
  width: 100%; display: flex; align-items: baseline; justify-content: space-between;
  padding: 7px 0 3px; border-bottom: 1px solid var(--line);
}
.grp-h span { font-size: 8.5px; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
.grp-h b { font-size: 13px; font-weight: 800; letter-spacing: var(--num); color: var(--ink-dim); }
.grp-h:active { opacity: .55; }

.st {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  padding: 3.5px 0;
}
.st-n {
  font-size: 11px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-r { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.st-v { font-size: 13px; font-weight: 800; letter-spacing: var(--num); }
/* il percentile: la lingua comune. Stessa scala su tutte e diciotto le righe. */
.st-p {
  min-width: 24px; text-align: right;
  font-size: 11px; font-weight: 700; color: var(--muted);
}
/* il divario non è colorato: non è un premio né una punizione, è una misura */
.st-p.gap { color: var(--ink-dim); }

/* ============ SCHEDA CARBURANTE ============
   La Zone è già una griglia: un blocco è un'unità discreta.
   Quindi mattoncini da riempire, non un diario da compilare. */

.setup { flex: none; padding: 4px 18px 12px; }
.setup-row { display: flex; align-items: center; justify-content: space-between; }
.setup-k { font-size: 9px; font-weight: 700; letter-spacing: .22em; color: var(--muted); }
.mults { display: flex; gap: 6px; }
.mult {
  min-width: 40px; padding: 5px 0; border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px; font-weight: 800; color: var(--muted);
}
.mult.on { border-color: var(--accent-dim); color: var(--accent); background: rgba(239,169,64,.10); }
/* l'energia è una conseguenza del piano, non un obiettivo:
   compare qui in impostazione e mai nel flusso della giornata */
.energy {
  margin-top: 9px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .03em; color: var(--muted);
}
.energy b { color: var(--ink-dim); font-weight: 800; margin-left: 4px; }

.meals { flex: 1 1 auto; min-height: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 6px; }
.meal {
  flex: 1 1 0; min-height: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  text-align: left; padding: 8px 12px;
  background: var(--surface); border-radius: var(--r-md);
  border: 1px solid transparent;
}
.meal.done { border-color: var(--line); background: var(--bg-lift); }
.meal:active { transform: scale(.99); }

.meal-h { display: flex; align-items: baseline; justify-content: space-between; }
.meal-h span { font-size: 9px; font-weight: 800; letter-spacing: .2em; color: var(--muted); }
.meal-h b { font-size: 15px; font-weight: 800; letter-spacing: var(--num); color: var(--ink-dim); }

/* i mattoncini: un blocco = una casella. Vuote finché non componi. */
.tiles { display: flex; gap: 4px; flex-wrap: wrap; }
.tile {
  width: 15px; height: 15px; border-radius: 3px;
  border: 1px solid var(--line);
  background: transparent;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.tile.on { background: var(--accent); border-color: var(--accent); }

.meal-p { font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.meal.done .meal-p { color: var(--ink-dim); }

/* i tre piatti proposti: si sceglie tra tre cose, non tra diecimila */
.plate {
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 15px; margin-top: 10px;
  background: var(--surface); border-radius: var(--r-md);
  border: 1px solid transparent;
}
.plate.on { border-color: var(--accent-dim); background: rgba(239,169,64,.07); }
.plate:active { transform: scale(.99); }
.pi { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.pi .k {
  width: 17px; height: 17px; border-radius: 4px; flex: none;
  display: grid; place-items: center;
  font-style: normal; font-size: 9px; font-weight: 800;
  color: var(--bg); background: var(--ink-dim);
}
.pi .k.C { background: var(--muted); }
.pi .k.G { background: var(--accent-dim); color: var(--ink); }

.disclaimer {
  margin-top: 18px; font-size: 10.5px; line-height: 1.5;
  color: var(--muted);
}

/* --- il confronto: è il L1/R1, mostrato come PES mostrava i tasti --- */
.switch {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px 14px;
}
.sw-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  font-size: 22px; line-height: 1; color: var(--muted);
}
.sw-btn:active { color: var(--ink); }
.sw-mid { flex: 1; text-align: center; }
.sw-label { font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.sw-sub { margin-top: 2px; font-size: 9px; font-weight: 600; letter-spacing: .07em; color: var(--muted); }
.dots { display: flex; gap: 5px; justify-content: center; margin-top: 7px; }
.dot2 { width: 5px; height: 5px; border-radius: 999px; background: var(--line); }
.dot2.on { background: var(--accent); }

/* --- drill-in --- */
.scrim {
  position: absolute; inset: 0; background: rgba(11,9,7,.6);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bg-lift);
  border-top: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 22px 26px;
  transform: translateY(101%);
  transition: transform .42s var(--ease);
  max-height: 66%; overflow-y: auto; scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }
.grip { width: 34px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 16px; }

.phone.open .radar   { transform: translateY(-40%) scale(.42); }
.phone.open .axis    { opacity: .3; }
.phone.open .axis.on { opacity: 1; }
.phone.open .hero    { opacity: 0; max-height: 0; padding-top: 0; pointer-events: none; }
.phone.open .scrim   { opacity: 1; pointer-events: auto; }
.phone.open .panel   { transform: translateY(0); }

.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.p-head .l { font-size: 10px; font-weight: 700; letter-spacing: .2em; color: var(--accent); }
.p-head .v { font-size: 56px; font-weight: 800; letter-spacing: var(--num); line-height: .88; margin-top: 6px; }
.p-head .r { text-align: right; padding-bottom: 4px; }
.p-head .r b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.p-head .r span { font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--muted); }

.bar { margin: 20px 0 4px; height: 6px; border-radius: 999px; background: var(--surface); position: relative; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); width: 0; transition: width .7s var(--ease); }
.bar .fill.low { background: var(--ink-dim); }
.bar .peermark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.bar-legend { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--muted); margin-top: 9px; }

.ceil { margin-top: 20px; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--r-md); }
.ceil .k { font-size: 9px; font-weight: 700; letter-spacing: .2em; color: var(--muted); }
.ceil p { margin-top: 7px; font-size: 13px; line-height: 1.45; color: var(--ink-dim); }
.ceil b { color: var(--ink); font-weight: 800; }

.p-sec { margin-top: 26px; font-size: 10px; font-weight: 700; letter-spacing: .2em; color: var(--muted); }

.bm { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.bm:last-of-type { border-bottom: 0; }
.bm .nm { font-size: 15px; font-weight: 700; }
.bm .ago { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 3px; letter-spacing: .04em; }
.bm .rt { text-align: right; white-space: nowrap; }
.bm .val { font-size: 24px; font-weight: 800; letter-spacing: var(--num); }
.bm .val em { font-style: normal; font-size: 14px; color: var(--muted); margin-left: 6px; }

/* quanto è solido il terreno sotto quel numero: tre pesi, non tre colori */
.tier {
  display: inline-block; width: 6px; height: 6px; border-radius: 999px;
  margin-right: 6px; vertical-align: middle;
}
.tier.t3 { background: var(--ink-dim); }
.tier.t2 { background: var(--muted); }
.tier.t1 { background: transparent; border: 1px solid var(--muted); }
.bm .dl { font-size: 11px; font-weight: 700; letter-spacing: .04em; margin-top: 2px; color: var(--accent); }
.bm .dl.flat { color: var(--muted); }
.bm .dl.down { color: var(--down); }

.insight {
  margin-top: 22px; padding: 16px 16px 17px;
  background: var(--surface); border-radius: var(--r-md);
  border-left: 2px solid var(--accent);
}
.insight .k { font-size: 9px; font-weight: 700; letter-spacing: .2em; color: var(--muted); }
.insight p { margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--ink); }
