/* Jensen sul sito: come l'app (stessi colori, stessa sfera, stesso cambio di tema), bianco e nero in due temi:
   scuro di base, chiaro se lo chiede il sistema o lo sceglie chi guarda. Una colonna: la sfera, i totali, ogni giorno. */
:root {
  color-scheme: dark;
  --bg: #000; --line: rgba(255, 255, 255, .08); --line2: rgba(255, 255, 255, .16);
  --text: #f4f4f4; --soft: #c8c8c8; --muted: #8c8c8c; --dim: #5c5c5c;
  --ink: #fff; --ink-rgb: 255, 255, 255;
  --glass: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.025)); --glass-line: rgba(255,255,255,.1);
  --glass-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 24px 70px rgba(0,0,0,.45);
  --up: #22c55e; --down: #ef4444; --claude: #D97757; --giornaliero: #5B8DEF;  /* i colori dei conti in Jensen */
  --skel: rgba(255, 255, 255, .07);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="chiaro"] {
  color-scheme: light;
  --bg: #fff; --line: rgba(0, 0, 0, .07); --line2: rgba(0, 0, 0, .15);
  --text: #0a0a0a; --soft: #383838; --muted: #6e6e6e; --dim: #a5a5a5;
  --ink: #000; --ink-rgb: 0, 0, 0;
  --glass: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.5)); --glass-line: rgba(0,0,0,.08);
  --glass-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 24px 70px rgba(0,0,0,.08);
  --up: #16a34a; --down: #dc2626; --skel: rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="scuro"]) {
    color-scheme: light;
    --bg: #fff; --line: rgba(0, 0, 0, .07); --line2: rgba(0, 0, 0, .15);
    --text: #0a0a0a; --soft: #383838; --muted: #6e6e6e; --dim: #a5a5a5;
    --ink: #000; --ink-rgb: 0, 0, 0;
    --glass: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.5)); --glass-line: rgba(0,0,0,.08);
    --glass-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 24px 70px rgba(0,0,0,.08);
    --up: #16a34a; --down: #dc2626; --skel: rgba(0, 0, 0, .06);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); transition: background .4s; }
body { margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: .005em; overflow-x: clip; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#field { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; }

/* barra: niente sfondo né bordo, solo una sfumatura; il clic passa nella parte vuota */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; pointer-events: none;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(var(--bg) 30%, transparent); }
.bar > * { pointer-events: auto; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px 0 8px; border-radius: 999px; color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 500; letter-spacing: .01em; transition: color .2s, background .2s; }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.ico { width: 40px; height: 40px; display: inline-grid; place-items: center; border: none; background: none; border-radius: 12px; color: var(--muted); cursor: pointer; padding: 0; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.ico:active { transform: scale(.92); }
@media (hover: hover) {
  .back:hover { color: var(--text); background: rgba(var(--ink-rgb), .06); } .back:hover svg { transform: translateX(-2px); }
  .ico:hover { color: var(--text); background: rgba(var(--ink-rgb), .07); } .ico:hover svg { transform: scale(1.12); }
}
.theme-sun { display: none; }
.theme-sun, .theme-moon { animation: icon-in .7s var(--ease); }
:root[data-theme="chiaro"] .theme-sun { display: block; } :root[data-theme="chiaro"] .theme-moon { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="scuro"]) .theme-sun { display: block; } :root:not([data-theme="scuro"]) .theme-moon { display: none; } }

main { position: relative; z-index: 1; width: 100%; max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 44px;
  padding-block: calc(72px + env(safe-area-inset-top, 0px)) calc(40px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* la sfera: la tela sborda dal riquadro come nell'app; col dito sopra la pagina scorre lo stesso */
.hero { display: grid; justify-items: center; text-align: center; gap: 10px; overflow-x: clip; }  /* l'alone sborda: la pagina non scivola di lato */
.core { position: relative; width: clamp(210px, 34vmin, 320px); aspect-ratio: 1; margin-bottom: 30px; }
#brain { position: absolute; inset: -10%; width: 120%; height: 120%; touch-action: pan-y; cursor: grab; z-index: 2; }
.halo { position: absolute; inset: -55%; border-radius: 50%; transition: opacity .8s; pointer-events: none;
  background: radial-gradient(circle, rgba(var(--ink-rgb), .07) 0%, rgba(var(--ink-rgb), .025) 30%, transparent 60%); }
body[data-activity="thinking"] .halo { animation: breathe 2.6s ease-in-out infinite; }
body[data-activity="offline"] .halo { opacity: .3; }
.title { display: flex; align-items: center; gap: 12px; }
h1 { margin: 0; font-size: clamp(32px, 5.6vw, 42px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.badge { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); line-height: 1;
  padding: 5px 9px 5px 10px; border: 1px solid var(--line2); border-radius: 999px; }
.lead { margin: 0; max-width: 46ch; color: var(--muted); text-wrap: balance; }

h2 { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
h2:empty { min-height: 18px; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile, .panel { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tile { display: grid; gap: 3px; align-content: start; min-height: 132px; padding: 16px 16px 15px; border-radius: 20px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink); }
.dot.claude { background: var(--claude); } .dot.giornaliero { background: var(--giornaliero); }
.dot.qqq { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dim); }
.tile b { margin: 8px 0 2px; font-size: clamp(24px, 4.2vw, 30px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); } .zero { color: var(--muted); } .none { color: var(--dim); }

.panel { border-radius: 22px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 18px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { padding-block: 15px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
thead th .dot { display: inline-block; margin-right: 7px; vertical-align: 1px; }
tbody > tr > * { border-top: 1px solid var(--line); }
tbody th { font-size: 14px; font-weight: 500; color: var(--soft); }
tbody td { font-size: 14px; }
td.empty { padding-block: 22px; text-align: center; color: var(--muted); white-space: normal; }
@media (hover: hover) { tbody tr { transition: background .2s; } tbody tr:hover { background: rgba(var(--ink-rgb), .035); } }
.short { display: none; }
.foot { margin: 0; display: grid; gap: 3px; justify-items: center; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.foot span { text-wrap: balance; } .foot span + span { color: var(--dim); }

/* in caricamento: la forma finale, ferma; i dati arrivano con l'entrata di Jensen */
.skel { display: block; width: 64%; height: 11px; border-radius: 6px; background: var(--skel); }
.skel.short-skel { width: 46%; } .skel.big { width: 72%; height: 26px; margin: 10px 0 6px; }
th .skel, td .skel { width: 52px; margin-left: auto; } th:first-child .skel { width: 74px; margin-left: 0; }
.in { animation: appear .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@media (prefers-reduced-motion: no-preference) { body.loading .skel { animation: skel 1.4s ease-in-out infinite; } }
@media (prefers-reduced-motion: reduce) { .in { animation: none; } }

@media (max-width: 640px) {
  main { gap: 36px; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 0; }
}
@media (max-width: 520px) {
  .full { display: none; } .short { display: inline; }
  th, td { padding-inline: 6px; } tbody th, tbody td { font-size: 13px; }
  th:first-child, td:first-child { padding-left: 16px; } th:last-child, td:last-child { padding-right: 16px; }
  thead th .dot { display: block; margin: 0 0 6px auto; } thead th:first-child .dot { margin-left: 0; }
}

@media (max-width: 380px) {
  .wd { display: none; }
  th:first-child, td:first-child { padding-left: 13px; } th:last-child, td:last-child { padding-right: 13px; }
}

@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.03); opacity: 1; } }
@keyframes appear { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); } }
@keyframes skel { 50% { opacity: .45; } }

/* tocco sull'icona del tema e cambio di tema: come nell'app */
@keyframes icon-in { from { opacity: 0; transform: rotate(-120deg) scale(.4); } }
/* cambio tema: la pagina vecchia si dissolve sfocandosi, la nuova arriva a fuoco con una leggera profondità */
::view-transition-group(root) { animation: none; }
::view-transition-old(root) { animation: tema-via .75s var(--ease) both; }
::view-transition-new(root) { animation: tema-arriva .75s var(--ease) both; }
/* cambio di tema come la luce: allo scuro la pagina si spegne e riaffiora nel buio, al chiaro un lampo bianco e riaffiora */
html[data-verso="scuro"]::view-transition-old(root) { animation: luce-spegne .7s var(--ease) both; }
html[data-verso="scuro"]::view-transition-new(root) { animation: buio-arriva .7s .12s var(--ease) both; }
html[data-verso="chiaro"]::view-transition-old(root) { animation: luce-accende .7s var(--ease) both; }
html[data-verso="chiaro"]::view-transition-new(root) { animation: luce-arriva .7s .12s var(--ease) both; }
@keyframes luce-spegne { to { filter: brightness(.05); opacity: 0; } }
@keyframes buio-arriva { from { opacity: 0; filter: brightness(.3); } }
@keyframes luce-accende { 55% { filter: brightness(2.2) saturate(0); } to { filter: brightness(3) saturate(0); opacity: 0; } }
@keyframes luce-arriva { from { opacity: 0; filter: brightness(1.6); } }
@keyframes tema-via { to { opacity: 0; filter: blur(16px) saturate(.6); transform: scale(1.035); } }
@keyframes tema-arriva { from { opacity: 0; filter: blur(16px); transform: scale(.97); } }
#theme.tap .theme-sun path { transform-box: view-box; transform-origin: 12px 12px; animation: sun-rays .6s var(--ease); }  /* il sole si accende: i raggi girano… */
#theme.tap .theme-sun circle { transform-box: fill-box; transform-origin: center; animation: sun-core .5s var(--ease); }  /* …e il centro si gonfia */
#theme.tap .theme-moon { transform-origin: 50% 50%; animation: moon-swing .65s var(--ease); }  /* la luna entra dondolando */
@keyframes sun-rays { from { transform: rotate(-90deg) scale(.55); opacity: 0; } }
@keyframes sun-core { 0% { transform: scale(.4); } 60% { transform: scale(1.18); } }
@keyframes moon-swing { 0% { transform: rotate(-40deg) translateY(4px); opacity: 0; } 55% { transform: rotate(12deg); opacity: 1; } 80% { transform: rotate(-4deg); } }
