/* zivoltra — un solo foglio di stile. Carta, inchiostro, linee. */
:root {
  --bg: #f1efea; --bg2: #e8e5de; --paper: #f8f7f3; --ink: #121211; --ink2: #3a3935; --muted: #87847c;
  --line: rgba(18,18,17,.14); --line2: rgba(18,18,17,.07); --line3: rgba(18,18,17,.32);
  --green: #1c9c58; --yellow: #dc9c00; --red: #e4432c; --off: #cdc9bf; --blue: #2f6bff;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(16px, 4vw, 48px);
  --max: 1360px;
  --hh: 64px;
  --term-bg: #121211; --term-fg: #ecebe5;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0f0e; --bg2: #181816; --paper: #161614; --ink: #ecebe5; --ink2: #c7c5bd; --muted: #8a877f;
  --line: rgba(236,235,229,.14); --line2: rgba(236,235,229,.07); --line3: rgba(236,235,229,.32);
  --green: #3ccf7c; --yellow: #f2c23b; --red: #ff6a4d; --off: #3a3935; --blue: #6b95ff;
  --term-bg: #0a0a09; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f0f0e; --bg2: #181816; --paper: #161614; --ink: #ecebe5; --ink2: #c7c5bd; --muted: #8a877f;
    --line: rgba(236,235,229,.14); --line2: rgba(236,235,229,.07); --line3: rgba(236,235,229,.32);
    --green: #3ccf7c; --yellow: #f2c23b; --red: #ff6a4d; --off: #3a3935; --blue: #6b95ff;
    --term-bg: #0a0a09; color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); letter-spacing: -.005em; transition: background .5s var(--ease), color .5s var(--ease); min-height: 100vh; overflow-x: hidden; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999; opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] body::after { mix-blend-mode: screen; opacity: .04; }
::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
code, kbd, pre { font-family: var(--mono); }
kbd { font-size: .72em; border: 1px solid var(--line3); border-radius: 5px; padding: 1px 5px; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- tipografia ---------- */
.serif { font-family: var(--serif); font-weight: 400; }
.mono { font-family: var(--mono); }
.eyebrow { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.idx { font: 400 11px var(--mono); color: var(--muted); letter-spacing: .04em; }
.display { font-family: var(--serif); font-size: clamp(3rem, 8.4vw, 7.4rem); line-height: .92; letter-spacing: -.025em; }
.display.xl { font-size: clamp(3.6rem, 12.5vw, 11.5rem); line-height: .86; }
.display em, .sec-h h2 em, .serif em { font-style: italic; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.45; color: var(--ink2); max-width: 46ch; }
.muted { color: var(--muted); }
.giant { font-family: var(--serif); font-size: clamp(7rem, 21vw, 17rem); line-height: .78; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.num { font-family: var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.page-h { padding: clamp(48px, 11vh, 120px) 0 clamp(28px, 4vw, 56px); }
.page-h .lead { margin-top: 1.4em; }
.page-h .actions { margin-top: 1.8em; display: flex; gap: .6em; flex-wrap: wrap; }
.sec { border-top: 1px solid var(--line); padding: clamp(28px, 4.5vw, 56px) 0; }
.sec-h { display: grid; grid-template-columns: 70px 1fr auto; align-items: baseline; gap: 12px; margin-bottom: clamp(20px, 3vw, 36px); }
.sec-h h2 { font-family: var(--serif); font-size: clamp(1.9rem, 3.2vw, 3rem); line-height: 1; letter-spacing: -.02em; }
.sec-h h2 .tail { font-style: italic; color: var(--muted); }
.sec-h .act { display: flex; gap: .5em; flex-wrap: wrap; justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: end; }
.cols { display: grid; grid-template-columns: repeat(4, 1fr); }
.cols > * { padding: 0 20px 0 20px; border-left: 1px solid var(--line2); }
.cols > *:first-child { padding-left: 0; border-left: 0; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 20px; }
.kv > div { border-top: 1px solid var(--line); padding-top: 12px; }
.kv .num { font-size: 2.1rem; line-height: 1; margin-top: 6px; display: block; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cells > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px; transition: background .5s var(--ease); position: relative; min-width: 0; }
.cells > a { text-decoration: none; display: block; }
.cells > a:hover, .cells > [role=button]:hover, .cells > a:focus-visible { background: var(--paper); }
.rows > * { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line2); text-decoration: none; transition: padding .6s var(--ease), background .5s var(--ease); }
.rows > *:last-child { border-bottom: 0; }
.rows > a:hover { padding-left: 10px; }
.rows .t { font-family: var(--serif); font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.05; letter-spacing: -.015em; }
.rows > a:hover .t { font-style: italic; }
.rows .arr { transition: transform .6s var(--ease); font-family: var(--serif); font-size: 1.6rem; }
.rows > a:hover .arr { transform: translateX(6px); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); }
.stack > * + * { margin-top: 1em; }
.flex { display: flex; gap: .6em; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; }
.right { margin-left: auto; }

/* ---------- header ---------- */
.hd { position: sticky; top: 0; z-index: 50; height: var(--hh); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line2); }
.hd .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 400 27px/1 var(--serif); letter-spacing: -.02em; white-space: nowrap; }
.logo small { font: 11px var(--mono); color: var(--muted); letter-spacing: .04em; margin-left: 2px; text-transform: lowercase; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); display: inline-block; flex: none; }
.dot.green { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.dot.red { background: var(--red); box-shadow: 0 0 10px var(--red); }
.dot.blue { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.dot.sm { width: 7px; height: 7px; }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.nav { display: flex; gap: 22px; }
.nav a { font-size: 13px; color: var(--muted); text-decoration: none; position: relative; padding: 4px 0; white-space: nowrap; transition: color .4s var(--ease); }
.nav a sup { font: 9px var(--mono); margin-right: 3px; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease); }
.nav a:hover, .nav a.on { color: var(--ink); }
.nav a:hover::after, .nav a.on::after { transform: scaleX(1); transform-origin: left; }
.hd .tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sites { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.sites a { font: 11px var(--mono); text-decoration: none; padding: 4px 10px; border-radius: 999px; color: var(--muted); transition: all .4s var(--ease); }
.sites a.on { background: var(--ink); color: var(--paper); }
.sites a:not(.on):hover { color: var(--ink); }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--uc, var(--line3)); color: var(--uc, var(--ink)); display: inline-grid; place-items: center; font: 500 11px var(--mono); text-decoration: none; flex: none; }
.avatar.lg { width: 88px; height: 88px; font-size: 26px; }
.btn.menu-btn { display: none; }

/* ---------- pulsanti ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: .5em; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line3); background: transparent; color: var(--ink); font: 500 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: color .55s var(--ease), border-color .55s var(--ease), transform .2s; }
.btn::before { content: ""; position: absolute; inset: 0; background: var(--ink); transform: translateY(101%); transition: transform .55s var(--ease); z-index: -1; border-radius: inherit; }
.btn:hover { color: var(--paper); border-color: var(--ink); }
.btn:hover::before { transform: translateY(0); }
.btn:active { transform: scale(.97); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.solid::before { background: var(--ink2); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger::before { background: var(--red); }
.btn.danger:hover { color: #fff; }
.btn.big { height: 54px; padding: 0 26px; font-size: 16px; }
.btn.sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; }
.btn .ar { transition: transform .55s var(--ease); display: inline-block; }
.btn:hover .ar { transform: translateX(4px); }
.btn[disabled], .btn.busy { opacity: .45; pointer-events: none; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 1px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { color: inherit; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size .5s var(--ease); cursor: pointer; border: 0; padding: 0; font: inherit; }
.link:hover { background-size: 0 1px; background-position: 100% 100%; }
.plus { display: inline-block; transition: transform .6s var(--ease); font-family: var(--serif); }
*:hover > .plus { transform: rotate(90deg); }

/* ---------- tab ---------- */
.tabs { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.tabs > * { font: 13px var(--sans); color: var(--muted); padding: 6px 14px; border-radius: 999px; border: 0; background: none; cursor: pointer; text-decoration: none; transition: all .45s var(--ease); white-space: nowrap; }
.tabs > .on { background: var(--ink); color: var(--paper); }
.tabs > :not(.on):hover { color: var(--ink); }
.utabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.utabs > * { padding: 10px 0; color: var(--muted); background: none; border: 0; cursor: pointer; position: relative; text-decoration: none; font: 14px var(--sans); white-space: nowrap; }
.utabs > * sup { font: 9px var(--mono); margin-left: 2px; }
.utabs > .on { color: var(--ink); }
.utabs > .on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--ink); animation: draw .5s var(--ease); transform-origin: left; }
@keyframes draw { from { transform: scaleX(0); } }

/* ---------- campi ---------- */
.field { display: block; margin-bottom: 1em; }
.field > span, .lbl { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink2); margin-bottom: 6px; }
.field small { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.in, .field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea, textarea.in, select.in {
  width: 100%; background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: .75em .9em; font: 15px var(--sans); color: var(--ink); transition: border-color .4s var(--ease), background .4s var(--ease); outline: none; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); background: var(--paper); }
textarea.in, .field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select.in, .field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.4em; }
.in.mono, .field .mono { font-family: var(--mono); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; margin-bottom: .8em; }
.check input { margin-top: 3px; accent-color: var(--ink); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border: 1px solid var(--line3); border-radius: 999px; transition: all .45s var(--ease); cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: all .45s var(--ease); }
.switch input:checked + i { background: var(--ink); border-color: var(--ink); }
.switch input:checked + i::after { transform: translateX(16px); background: var(--paper); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line3); border-radius: 999px; padding: 4px 12px; font-size: 13px; background: none; cursor: pointer; text-decoration: none; color: var(--ink); transition: all .4s var(--ease); }
.chip.on, .chip:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 11px var(--mono); border: 1px solid var(--line3); border-radius: 999px; padding: 2px 9px; color: var(--muted); white-space: nowrap; }
.pill.green { color: var(--green); border-color: var(--green); }
.pill.yellow { color: var(--yellow); border-color: var(--yellow); }
.pill.red { color: var(--red); border-color: var(--red); }
.pill.ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pbar { height: 2px; background: var(--line); position: relative; overflow: hidden; }
.pbar > i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 1.4s var(--ease) .15s; }
.pbar.green > i { background: var(--green); } .pbar.yellow > i { background: var(--yellow); } .pbar.red > i { background: var(--red); }
.pbar.thick { height: 4px; }
.sbadge { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--c, var(--ink)); color: var(--c, var(--ink)); display: inline-grid; place-items: center; font: 500 9.5px var(--mono); flex: none; }
.sbadge.lg { width: 44px; height: 44px; font-size: 14px; }
.utag { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--tc); color: var(--tc); border-radius: 6px; padding: 1px 7px 1px 5px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.utag i { width: 6px; height: 6px; border-radius: 50%; background: var(--tc); }
.utag b { font-weight: 600; }
:root[data-theme="dark"] .utag[style*="#121211"], :root[data-theme="dark"] .utag[style*="#111111"] { --tc: var(--ink) !important; }

/* ---------- finestre ---------- */
.veil { position: fixed; inset: 0; background: rgba(0,0,0,0); z-index: 200; transition: background .6s var(--ease); display: grid; place-items: center; padding: 16px; }
.veil.open { background: rgba(0,0,0,.42); }
.dlg { background: var(--bg); width: 100%; max-width: 540px; border-radius: 20px; padding: 28px; box-shadow: 0 30px 90px rgba(0,0,0,.25); max-height: 88vh; overflow: auto; opacity: 0; transform: translateY(24px) scale(.985); transition: all .7s var(--ease); position: relative; }
.dlg.wide { max-width: 860px; }
.veil.open .dlg { opacity: 1; transform: none; }
.dlg h3 { font-family: var(--serif); font-size: 2.2rem; line-height: 1; letter-spacing: -.02em; margin-bottom: .6em; padding-right: 40px; }
.xbtn { position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line3); background: none; cursor: pointer; transition: transform .6s var(--ease); }
.xbtn::before, .xbtn::after { content: ""; position: absolute; left: 11px; right: 11px; top: 50%; height: 1px; background: var(--ink); transform: rotate(45deg); }
.xbtn::after { transform: rotate(-45deg); }
.xbtn:hover { transform: rotate(90deg); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); z-index: 201; transform: translateX(100%); transition: transform .8s var(--ease); overflow: auto; padding: 28px; border-left: 1px solid var(--line); }
.drawer.open { transform: none; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); border-radius: 999px; padding: 11px 20px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); opacity: 0; transform: translateY(16px) scale(.96); transition: all .6s var(--ease); pointer-events: auto; display: flex; gap: 12px; align-items: center; max-width: 92vw; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); color: #fff; }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- entrate ---------- */
[data-reveal] { opacity: 0; transform: translateY(32px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); transition-delay: calc(var(--d, 0) * 80ms); }
[data-reveal].rv { opacity: 1; transform: none; }
.no-anim [data-reveal] { opacity: 1; transform: none; transition: none; }
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; margin-bottom: -.06em; }
.w > span { display: inline-block; transform: translateY(108%); animation: wup 1.25s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms + 80ms); }
.no-anim .w > span { transform: none; animation: none; }
@keyframes wup { to { transform: none; } }

/* ---------- footer ---------- */
.ft { margin-top: clamp(60px, 14vh, 160px); border-top: 1px solid var(--line); overflow: hidden; }
.ft .meta { display: flex; justify-content: space-between; gap: 1em; flex-wrap: wrap; padding: 16px 0; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ft .meta a { text-decoration: none; }
.ft .meta a:hover { color: var(--ink); }
.ft .word { font: 400 27vw/.74 var(--serif); letter-spacing: -.055em; text-align: center; margin-bottom: -.12em; white-space: nowrap; user-select: none; }

/* ---------- annunci ---------- */
.ann { border-bottom: 1px solid var(--line2); font: 12px var(--mono); padding: 9px 0; }
.ann .wrap { display: flex; gap: 10px; align-items: center; }

/* ---------- landing ---------- */
.hero-word { font: 400 clamp(5rem, 22vw, 20rem)/.8 var(--serif); letter-spacing: -.055em; }
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee .track { display: inline-flex; gap: 40px; white-space: nowrap; animation: mq 42s linear infinite; font: 2rem var(--serif); }
.marquee:hover .track { animation-play-state: paused; }
.marquee em { color: var(--muted); }
@keyframes mq { to { transform: translateX(-50%); } }
.plan-cells .num { font-size: 3.4rem; line-height: .9; }
.plan-cells ul { list-style: none; padding: 0; margin: 16px 0 0; }
.plan-cells li { padding: 8px 0; border-top: 1px solid var(--line2); font-size: 14px; }

/* ---------- auth / onboarding ---------- */
.auth { display: grid; grid-template-columns: 1fr 440px; gap: clamp(28px, 6vw, 96px); border-top: 1px solid var(--line); padding-top: clamp(28px, 4vw, 56px); }
.bulbs { display: flex; gap: 12px; margin-bottom: 28px; }
.steps { display: flex; gap: 22px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.steps .on { color: var(--ink); }
.steps .done { text-decoration: line-through; }
.choices > button { width: 100%; display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; text-align: left; padding: 18px 0; background: none; border: 0; border-bottom: 1px solid var(--line2); cursor: pointer; transition: padding .6s var(--ease); }
.choices > button .t { font: clamp(1.6rem, 3vw, 2.6rem)/1 var(--serif); letter-spacing: -.02em; }
.choices > button:hover { padding-left: .6em; }
.choices > button:hover .t, .choices > button.on .t { font-style: italic; }
.choices > button.on .arr { color: var(--green); }
.choices > button .arr { font: 1.6rem var(--serif); transition: transform .6s var(--ease); }
.choices > button:hover .arr { transform: translateX(6px); }

/* ---------- heatmap (streak) ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--line2); outline: 1px solid var(--line2); outline-offset: -1px; }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--green) 30%, transparent); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--green) 55%, transparent); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--green) 80%, transparent); }
.heat i[data-l="4"] { background: var(--green); box-shadow: 0 0 6px color-mix(in srgb, var(--green) 50%, transparent); }
.heat i.x { visibility: hidden; }
.heat-legend { display: flex; gap: 3px; align-items: center; font: 10.5px var(--mono); color: var(--muted); }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* ---------- corsi ---------- */
.course-cell { min-height: 260px; display: flex !important; flex-direction: column; gap: 10px; }
.course-cell h3 { font: 2rem/1 var(--serif); letter-spacing: -.02em; }
.course-cell .foot { margin-top: auto; }
.lesson-row .st { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line3); display: inline-block; }
.lesson-row .st.done { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px var(--green); }
.lesson-row .st.started { background: var(--yellow); border-color: var(--yellow); }

/* ---------- lezione / workspace ---------- */
.ws { display: grid; grid-template-columns: minmax(340px, 44%) 1fr; height: calc(100vh - var(--hh)); border-top: 1px solid var(--line); }
.ws-l { overflow: auto; padding: 28px clamp(16px, 3vw, 40px) 80px; border-right: 1px solid var(--line); }
.ws-r { display: grid; grid-template-rows: auto 1fr auto minmax(140px, 36%); min-height: 0; min-width: 0; }
.ws-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 49px; }
.ws-bar .eyebrow { margin-right: auto; }
.editor { min-height: 0; position: relative; }
.editor > .monaco, .editor > textarea { position: absolute; inset: 0; }
.editor > textarea { width: 100%; height: 100%; border: 0; resize: none; background: var(--paper); color: var(--ink); font: 13.5px/1.6 var(--mono); padding: 14px; outline: none; tab-size: 4; }
.out { min-height: 0; background: var(--term-bg); color: var(--term-fg); position: relative; overflow: hidden; }
.out .xterm { padding: 10px 12px; height: 100%; }
.out iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.out .tbar { position: absolute; top: 8px; right: 10px; z-index: 3; display: flex; gap: 6px; }
.out .tbar .btn { color: var(--term-fg); border-color: rgba(236,235,229,.3); height: 26px; font-size: 11.5px; padding: 0 10px; }
.out .tbar .btn::before { background: var(--term-fg); }
.out .tbar .btn:hover { color: var(--term-bg); }
.out .hint { position: absolute; inset: 0; display: grid; place-items: center; font: 12px var(--mono); color: #87847c; text-align: center; padding: 20px; }
.resizer { height: 6px; cursor: row-resize; background: var(--line2); border-top: 1px solid var(--line); }
.resizer:hover { background: var(--line); }
.prose { max-width: 70ch; }
.prose h1, .prose h2 { font-family: var(--serif); font-size: 2rem; letter-spacing: -.02em; line-height: 1.05; margin: 1.6em 0 .5em; }
.prose h3 { font: 600 16px var(--sans); margin: 1.4em 0 .4em; }
.prose p, .prose li { color: var(--ink2); }
.prose a { color: var(--ink); }
.prose pre { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; }
.prose :not(pre) > code { background: var(--bg2); border-radius: 5px; padding: 1px 5px; font-size: .86em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 1em 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line2); padding: 8px 10px 8px 0; text-align: left; }
.prose th { font: 500 11px var(--mono); text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.prose blockquote { margin: 1em 0; padding-left: 16px; border-left: 2px solid var(--line3); color: var(--ink2); }
.prose img { border-radius: 12px; }
.verdict { border-top: 1px solid var(--line); padding: 16px 0; margin-top: 18px; }
.verdict .serif { font-size: 1.9rem; line-height: 1.05; }
.hljs { background: transparent !important; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 22px; }
.msg { display: grid; grid-template-columns: 56px 1fr; gap: 14px; }
.msg .who { font: 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-top: 4px; }
.msg.user .body { font: clamp(1.25rem, 2vw, 1.6rem)/1.2 var(--serif); letter-spacing: -.01em; }
.msg .body.prose { max-width: none; }
.composer { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 14px 0 18px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.composer textarea { min-height: 54px; max-height: 220px; font: 1.2rem/1.3 var(--serif); }
.typing::after { content: "▍"; animation: pulse 1s infinite; margin-left: 2px; }
.tutor { position: fixed; right: 16px; bottom: 16px; width: min(440px, calc(100vw - 32px)); height: min(620px, calc(100vh - 100px)); background: var(--bg); border: 1px solid var(--line3); border-radius: 20px; box-shadow: 0 30px 90px rgba(0,0,0,.22); z-index: 120; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .6s var(--ease); }
.tutor.open { transform: none; opacity: 1; pointer-events: auto; }
.tutor header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.tutor .log { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.tutor .log .u { align-self: flex-end; background: var(--ink); color: var(--paper); border-radius: 16px 16px 4px 16px; padding: 8px 12px; max-width: 85%; }
.tutor .log .a { max-width: 100%; }
.tutor .log .a pre { font-size: 12px; }
.tutor form { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 8px; }
.tutor form textarea { min-height: 42px; height: 42px; font-size: 14px; border-radius: 12px; }

/* ---------- cloud / drive ---------- */
.drive-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.crumbs { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font: 1.6rem var(--serif); letter-spacing: -.01em; margin-right: auto; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:last-child { color: var(--ink); }
.crumbs span { color: var(--line3); }
.files { width: 100%; border-collapse: collapse; }
.files td, .files th { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--line2); text-align: left; font-size: 14px; white-space: nowrap; }
.files th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.files td.name { width: 100%; white-space: normal; }
.files tr { transition: background .4s var(--ease); }
.files tbody tr:hover, .files tr.sel { background: var(--paper); }
.files .ic { font: 10px var(--mono); border: 1px solid var(--line3); border-radius: 6px; padding: 2px 5px; color: var(--muted); margin-right: 10px; min-width: 38px; display: inline-block; text-align: center; text-transform: uppercase; }
.files .ic.folder { border-color: var(--ink); color: var(--ink); }
.files a { text-decoration: none; cursor: pointer; }
.files a:hover { text-decoration: underline; }
.dropzone { position: fixed; inset: 0; z-index: 150; background: color-mix(in srgb, var(--bg) 88%, transparent); display: grid; place-items: center; font: clamp(3rem, 8vw, 7rem) var(--serif); border: 2px dashed var(--ink); pointer-events: none; opacity: 0; transition: opacity .3s; }
.dropzone.on { opacity: 1; }
.quota { min-width: 220px; }
.ctx { position: fixed; z-index: 180; background: var(--bg); border: 1px solid var(--line3); border-radius: 14px; padding: 6px; min-width: 190px; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.ctx button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.ctx button:hover { background: var(--paper); }
.ctx button.danger { color: var(--red); }
.ctx hr { margin: 4px 0; border-color: var(--line2); }

/* ---------- IDE ---------- */
.ide { display: grid; grid-template-columns: 240px 1fr; height: calc(100vh - var(--hh)); }
.ide-side { border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; min-width: 0; }
.ide-side .tree { padding: 6px 0; font: 13px var(--mono); flex: 1; }
.tree .n { display: flex; align-items: center; gap: 6px; padding: 4px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.tree .n:hover { background: var(--paper); }
.tree .n.on { background: var(--bg2); color: var(--ink); }
.tree .n .car { width: 10px; color: var(--muted); font-size: 9px; }
.ide-main { display: grid; grid-template-rows: auto auto 1fr 6px minmax(120px, 34%); min-width: 0; min-height: 0; }
.ftabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); min-height: 36px; }
.ftabs > div { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-right: 1px solid var(--line2); font: 12.5px var(--mono); color: var(--muted); cursor: pointer; white-space: nowrap; }
.ftabs > div.on { color: var(--ink); background: var(--paper); }
.ftabs > div .d { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.ftabs > div button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0 2px; }
.pk-state { display: inline-flex; align-items: center; gap: 7px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- player ---------- */
.player { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 110; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 6px 8px 6px 6px; box-shadow: 0 14px 40px rgba(0,0,0,.2); max-width: calc(100vw - 32px); transition: all .6s var(--ease); }
.player button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: none; color: inherit; cursor: pointer; display: grid; place-items: center; flex: none; transition: background .3s; }
:root[data-theme="dark"] .player button, :root[data-theme="auto"] .player button { border-color: color-mix(in srgb, var(--paper) 25%, transparent); }
.player button:hover { background: color-mix(in srgb, var(--paper) 15%, transparent); }
.player .np { font: 12px var(--mono); max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.player .np small { display: block; opacity: .6; font-size: 10.5px; }
.player .bars { display: flex; gap: 2px; align-items: flex-end; height: 14px; width: 14px; }
.player .bars i { width: 2px; background: var(--green); height: 30%; }
.player.playing .bars i { animation: eq 1s ease-in-out infinite; }
.player.playing .bars i:nth-child(2) { animation-delay: .2s; } .player.playing .bars i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 50% { height: 100%; } }
.player.mini .np, .player.mini .pctl { display: none; }
.player-panel { position: fixed; left: 16px; bottom: 70px; width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); overflow: auto; background: var(--bg); border: 1px solid var(--line3); border-radius: 20px; z-index: 111; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.2); transform: translateY(12px); opacity: 0; pointer-events: none; transition: all .6s var(--ease); }
.player-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.player-panel .tr { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line2); cursor: pointer; font-size: 13.5px; }
.player-panel .tr.on { font-style: italic; }
.player-panel .tr:hover { padding-left: 4px; }
.player-panel input[type=range] { width: 100%; accent-color: var(--ink); }

/* ---------- manim player ---------- */
.mplayer { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #000; }
.mplayer video { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #000; }
.mplayer .ctl { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #121211; color: #ecebe5; font: 11px var(--mono); }
.mplayer .ctl button { background: none; border: 1px solid rgba(236,235,229,.25); color: inherit; border-radius: 999px; height: 26px; padding: 0 10px; cursor: pointer; font: inherit; }
.mplayer .ctl button.on { background: #ecebe5; color: #121211; }
.mplayer .ctl input { flex: 1; accent-color: #3ccf7c; }

/* ---------- tabelle admin & varie ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--paper); }
.tbl-wrap { overflow-x: auto; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); font: 1.6rem var(--serif); }
.empty small { display: block; font: 12px var(--mono); margin-top: 10px; }
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - var(--hh)); }
.admin-nav { border-right: 1px solid var(--line); padding: 20px 0; position: sticky; top: var(--hh); height: calc(100vh - var(--hh)); overflow: auto; }
.admin-nav a { display: grid; grid-template-columns: 30px 1fr; padding: 7px 20px; text-decoration: none; font-size: 14px; color: var(--muted); transition: all .4s var(--ease); }
.admin-nav a:hover { color: var(--ink); padding-left: 26px; }
.admin-nav a.on { color: var(--ink); font-style: italic; font-family: var(--serif); font-size: 18px; }
.admin-main { padding: 0 var(--pad) 80px; min-width: 0; }
.zk { outline: 1px dashed color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; cursor: text; border-radius: 2px; }
.zk:focus { outline: 1px solid var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.editbar { position: fixed; top: calc(var(--hh) + 10px); right: 16px; z-index: 130; background: var(--blue); color: #fff; border-radius: 999px; padding: 6px 8px 6px 16px; font: 12px var(--mono); display: flex; gap: 10px; align-items: center; }
.editbar a { color: #fff; }
.ticket-msg { display: grid; grid-template-columns: 120px 1fr; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line2); }
.ticket-msg.admin .body { border-left: 2px solid var(--green); padding-left: 14px; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.ach > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px; }
.ach > div.off { opacity: .35; }
.ach .serif { font-size: 1.5rem; line-height: 1; }
.lb .rk { font: 2.2rem var(--serif); letter-spacing: -.03em; }
.code-inline { font: 12px var(--mono); background: var(--bg2); padding: 2px 6px; border-radius: 5px; user-select: all; }
.vid { aspect-ratio: 16/9; background: #000; border-radius: 4px; overflow: hidden; }
.vid video { width: 100%; height: 100%; }
.loader { display: grid; place-items: center; padding: 60px 0; }
.loader i { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line3); border-top-color: var(--ink); animation: spin 1.2s linear infinite; }

/* ---------- responsive ---------- */
@media (max-width: 1220px) {
  .nav { display: none; }
  .btn.menu-btn { display: inline-flex; }
}
@media (max-width: 980px) {
  .grid2, .auth, .split { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr 1fr; gap: 24px 0; }
  .cols > *:nth-child(3) { padding-left: 0; border-left: 0; }
  .ws { grid-template-columns: 1fr; height: auto; }
  .ws-l { border-right: 0; max-height: none; }
  .ws-r { height: 92vh; border-top: 1px solid var(--line); }
  .ide { grid-template-columns: 1fr; height: auto; }
  .ide-side { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .ide-main { height: 88vh; }
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; display: flex; overflow-x: auto; padding: 8px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav a { grid-template-columns: auto auto; gap: 4px; white-space: nowrap; padding: 6px 12px; }
  .admin-nav a.on { font-size: 15px; }
  .sites { display: none; }
}
@media (max-width: 700px) {
  .veil { place-items: end center; padding: 0; }
  .dlg { border-radius: 22px 22px 0 0; max-height: 94vh; transform: translateY(100%); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .cols, .kv, .row2, .row3 { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; }
  .cols > * { padding-left: 0; border-left: 0; }
  .sec-h { grid-template-columns: 1fr; gap: 6px; }
  .sec-h .act { justify-content: flex-start; }
  .cells { grid-template-columns: 1fr; }
  .rows > * { grid-template-columns: 34px 1fr auto; }
  .hide-sm { display: none !important; }
  .files .hide-sm { display: none; }
  .ticket-msg { grid-template-columns: 1fr; gap: 6px; }
  .msg { grid-template-columns: 1fr; gap: 4px; }
  .player .np { max-width: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .w > span { transform: none; }
  .marquee .track { white-space: normal; flex-wrap: wrap; }
}
@media print {
  .hd, .ft, .player, .toasts, .btn, body::after { display: none !important; }
  body { background: #fff; color: #000; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- evidenziazione codice ---------- */
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal { color: var(--blue); }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: var(--green); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--yellow); }
.hljs-title, .hljs-section, .hljs-name, .hljs-title.function_ { color: var(--ink); font-weight: 500; }
.hljs-deletion, .hljs-meta { color: var(--red); }
.monaco { position: absolute; inset: 0; }
