/* =========================================================
   SPATIA — design tokens
   ========================================================= */
:root {
  --bg: #f5f3f0;
  --bg-2: #ece8e3;
  --surface: #ffffff;
  --ink: #1f1c26;
  --ink-2: #4a4555;
  --muted: #7a7486;
  --line: #e4dfd9;
  --accent: #6b5f86;
  --accent-2: #8e82a8;
  --accent-soft: #ece8f3;
  --accent-ink: #ffffff;
  --ok: #2f8f5b;
  --warn: #b7791f;
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(31, 28, 38, .04), 0 8px 24px rgba(31, 28, 38, .06);
  --shadow-lg: 0 2px 6px rgba(31, 28, 38, .06), 0 24px 60px rgba(31, 28, 38, .14);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131217; --bg-2: #1a1920; --surface: #1d1c23; --ink: #efedf3; --ink-2: #c9c5d2;
    --muted: #9a95a6; --line: #2c2a34; --accent: #a99acb; --accent-2: #8e82a8; --accent-soft: #2a2636;
    --accent-ink: #17151c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131217; --bg-2: #1a1920; --surface: #1d1c23; --ink: #efedf3; --ink-2: #c9c5d2;
  --muted: #9a95a6; --line: #2c2a34; --accent: #a99acb; --accent-2: #8e82a8; --accent-soft: #2a2636;
  --accent-ink: #17151c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.45); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden vince sempre sui display impostati dalle classi */
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 500 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 40px; padding: 0; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn:focus-visible, .field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); white-space: nowrap;
}
.chip svg.i { width: 14px; height: 14px; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  height: 68px; padding: 0 max(16px, 4vw);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand img { width: 34px; height: 34px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; border: 0; cursor: pointer;
}
.avatar.on { box-shadow: 0 0 0 3px var(--accent-soft); }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 48px; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); display: none;
}
.menu-pop.open { display: block; animation: pop .16s ease; }
.menu-pop button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.menu-pop button:hover { background: var(--bg-2); }
.menu-pop .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

@media (max-width: 640px) { .hide-sm { display: none; } }
.page { padding: 32px max(16px, 4vw) 64px; max-width: 1360px; margin: 0 auto; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* =========================================================
   LANDING
   ========================================================= */
.landing { position: relative; min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; color: #1f1c26; overflow: hidden; }
.landing .hero-pano { position: absolute; inset: 0; background: #d9d2c8 url("../data/hub.jpg") repeat-x 0 50% / auto 135%; }
.landing::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(245,243,240,0) 0%, rgba(245,243,240,.25) 55%, rgba(245,243,240,.85) 100%);
}
.landing > * { position: relative; z-index: 1; }
.landing .topbar { background: transparent; border: 0; backdrop-filter: none; }
.hero { align-self: center; justify-self: center; text-align: center; padding: 24px 16px; max-width: 760px; }
.hero img.logo { width: 120px; height: 120px; margin: 0 auto 8px; filter: drop-shadow(0 18px 30px rgba(107,95,134,.35)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.hero h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.hero h1 span { background: linear-gradient(120deg, #6b5f86, #a99acb 60%, #6b5f86); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(16px, 2.2vw, 20px); color: #4a4555; margin: 18px auto 30px; max-width: 560px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing .btn:not(.primary) { background: rgba(255,255,255,.75); color: #1f1c26; border-color: rgba(31,28,38,.08); backdrop-filter: blur(8px); }
.landing .btn.primary { background: #6b5f86; border-color: #6b5f86; color: #fff; }
.platforms { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 0 16px 28px; }
.platforms .chip { background: rgba(255,255,255,.7); color: #4a4555; backdrop-filter: blur(8px); height: 32px; padding: 0 14px; }
.hint-drag { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); font-size: 12px; color: #7a7486; display: flex; gap: 6px; align-items: center; z-index: 1; }

.how { padding: 72px max(16px, 4vw); max-width: 1160px; margin: 0 auto; }
.how h2 { font-size: clamp(26px, 3.4vw, 36px); text-align: center; }
.how > p { text-align: center; color: var(--muted); margin: 10px 0 40px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.step .num { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.step h3 { font-size: 18px; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
/* sezioni della presentazione */
.lsec { padding: 72px max(16px, 4vw) 0; max-width: 1160px; margin: 0 auto; }
.lhead { text-align: center; max-width: 680px; margin: 0 auto 36px; }
.lhead h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; line-height: 1.15; }
.lhead p { color: var(--muted); margin: 12px 0 0; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.lsec.how .lhead { margin-bottom: 36px; }
.showcase { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.showcase a { position: relative; border-radius: var(--radius); overflow: hidden; background: #d9d2c8 center / cover no-repeat; color: #fff; text-decoration: none; box-shadow: var(--shadow); }
.showcase a::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.55)); transition: opacity .2s; }
.showcase a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.showcase a { transition: transform .2s, box-shadow .2s; }
.showcase a > * { position: relative; z-index: 1; }
.show-main { min-height: 380px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; }
.show-play { align-self: flex-start; display: inline-flex; gap: 8px; align-items: center; height: 38px; padding: 0 16px; border-radius: 999px; background: rgba(255,255,255,.9); color: #1f1c26; font-weight: 600; font-size: 14px; }
.show-meta b { display: block; font-size: 20px; }
.show-meta span { font-size: 13px; opacity: .85; }
.show-views { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.show-views a { min-height: 110px; display: flex; align-items: flex-end; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.show-views a:first-child { grid-column: span 2; }
.lgrid { display: grid; gap: 16px; }
.lgrid.four { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.lgrid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.tile .num { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.tile h3 { font-size: 17px; margin-bottom: 6px; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.hero p.hero-for { font-size: 14px; font-weight: 600; color: #6b5f86; margin: -16px auto 26px; }
.tile-points { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.tile-points li { display: flex; gap: 8px; align-items: flex-start; }
.tile-points svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); margin-top: 2px; }
.cta-row { display: flex; gap: 8px; flex-wrap: wrap; }
.offer { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.offer-card { border-radius: var(--radius); padding: 32px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: flex-start; }
.offer-card h3 { font-size: 22px; letter-spacing: -.01em; }
.offer-card p { color: var(--muted); margin: 8px 0 22px; flex: 1; }
.offer-price { font-size: 40px; font-weight: 700; letter-spacing: -.03em; margin-top: 14px; }
.offer-price { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; }
.offer-price small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; white-space: nowrap; }
.offer-card.dark { background: linear-gradient(140deg, #2a2537, #4b4163); color: #fff; border-color: transparent; }
.offer-card.dark .eyebrow { color: #cfc4ea; }
.offer-card.dark p, .offer-card.dark .offer-price small { color: rgba(255,255,255,.75); }
.offer-card.dark .btn.primary { background: #fff; color: #2a2537; border-color: #fff; }
.final { margin: 72px max(16px, 4vw) 0; padding: 64px 20px; text-align: center; border-radius: 24px; position: relative; overflow: hidden;
  background: #d9d2c8 url("../data/hub.jpg") 30% 50% / cover; color: #1f1c26; max-width: 1160px; margin-left: auto; margin-right: auto; }
.final::before { content: ""; position: absolute; inset: 0; background: rgba(245,243,240,.72); }
.final > * { position: relative; }
.final h2 { font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -.02em; }
.final p { color: #4a4555; margin: 10px 0 26px; }
.final .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.final .btn:not(.primary) { background: rgba(255,255,255,.8); color: #1f1c26; border-color: rgba(31,28,38,.08); }
.final .btn.primary { background: #6b5f86; border-color: #6b5f86; color: #fff; }
@media (max-width: 760px) {
  .showcase { grid-template-columns: 1fr; }
  .show-main { min-height: 260px; }
  .lsec { padding-top: 56px; }
  .offer-card { padding: 24px; }
}
.foot { margin-top: 64px; }
.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; vertical-align: middle; }
.lang-switch button { border: 0; background: none; color: inherit; font: inherit; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.lang-switch button.on { background: var(--accent); color: var(--accent-ink); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; line-height: 1.7; }
.foot a { color: inherit; }
.foot .foot-links { margin-top: 4px; }

/* =========================================================
   LOGIN
   ========================================================= */
.auth { min-height: 100svh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #e9e5df url("../data/hub.jpg") 0 50% / auto 140% repeat-x; animation: pan 90s linear infinite; }
@keyframes pan { to { background-position-x: -200vh; } }
.auth-art .quote { position: absolute; left: 40px; right: 40px; bottom: 40px; color: #1f1c26; }
.auth-art .quote b { display: block; font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(400px, 100%); }
.auth-card .auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.auth-card h1 { font-size: 30px; margin-bottom: 6px; }
.auth-card > p { color: var(--muted); margin: 0 0 28px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  height: 46px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: 90px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-card .btn.primary { width: 100%; margin-top: 8px; }
.auth-note { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* =========================================================
   PROJECTS
   ========================================================= */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-head h1 { font-size: clamp(28px, 3.6vw, 38px); }
.dash-head p { margin: 6px 0 0; color: var(--muted); }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 112px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px 0 42px; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.card {
  position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow); cursor: pointer; text-decoration: none; display: flex; flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card .cover { position: relative; aspect-ratio: 16 / 10; background-color: var(--bg-2); background-size: auto 100%; background-repeat: repeat-x; background-position: 50% 50%; }
.card:hover .cover { animation: coverpan 14s linear infinite; }
@keyframes coverpan { from { background-position-x: 50%; } to { background-position-x: calc(50% - 200%); } }
.card .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.35)); }
.card .badges { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; z-index: 1; }
.card .badges .chip { background: rgba(20,18,26,.55); color: #fff; backdrop-filter: blur(6px); }
.card .play {
  position: absolute; right: 14px; bottom: 14px; z-index: 1; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: #1f1c26; transform: scale(.85); opacity: 0; transition: .25s ease;
}
.card:hover .play { transform: none; opacity: 1; }
.card .body { padding: 16px 18px 18px; display: grid; gap: 4px; }
.card h3 { font-size: 17px; }
.card .meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .foot-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.card .del { position: absolute; right: 10px; top: 10px; z-index: 2; opacity: 0; transition: .2s; background: rgba(255,255,255,.9); color: var(--danger); border: 0; }
.card:hover .del { opacity: 1; }
.card.new {
  border: 2px dashed var(--line); background: transparent; box-shadow: none; align-items: center; justify-content: center;
  min-height: 300px; color: var(--muted); gap: 12px; text-align: center; padding: 20px;
}
.card.new:hover { border-color: var(--accent-2); color: var(--accent); transform: none; box-shadow: none; }
.card.new .plus { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.card.new .plus svg { width: 26px; height: 26px; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 48px; color: var(--muted); }

/* =========================================================
   WIZARD
   ========================================================= */
.wiz-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper .s { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stepper .s i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: var(--bg-2); font-size: 12px; }
.stepper .s.on { color: var(--ink); }
.stepper .s.on i { background: var(--accent); color: var(--accent-ink); }
.stepper .s.done i { background: var(--accent-soft); color: var(--accent); }
.stepper .bar { width: 28px; height: 2px; background: var(--line); border-radius: 2px; }

.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.source {
  text-align: left; padding: 20px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; gap: 6px; transition: .2s;
}
.source:hover { border-color: var(--accent-2); }
.source.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.source .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.source b { font-size: 16px; }
.source span { font-size: 13px; color: var(--muted); }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 38px 20px; text-align: center; background: var(--surface);
  transition: .2s; cursor: pointer; display: grid; gap: 10px; justify-items: center;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dropzone .big svg { width: 26px; height: 26px; }
.dropzone b { font-size: 17px; }
.dropzone small { color: var(--muted); }

.views-list { display: grid; gap: 10px; margin-top: 18px; }
.vrow {
  display: grid; grid-template-columns: 24px 120px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 12px 10px 8px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); animation: fadeUp .25s ease both;
}
.vrow.dragging { opacity: .4; }
.vrow .handle { cursor: grab; color: var(--muted); display: grid; place-items: center; }
.vrow canvas, .vrow img { width: 120px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--bg-2); }
.vrow input { border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 8px; font-weight: 600; width: 100%; }
.vrow input:hover { border-color: var(--line); }
.vrow input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.vrow .sub { font-size: 12px; color: var(--muted); padding: 0 8px; }
@media (max-width: 640px) { .vrow { grid-template-columns: 20px 84px 1fr auto; } .vrow canvas, .vrow img { width: 84px; height: 42px; } .vrow .chips { display: none; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h3 { font-size: 17px; margin-bottom: 4px; }
.panel > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.kv div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kv small { display: block; color: var(--muted); font-size: 12px; }
.kv b { font-size: 15px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.code {
  position: relative; background: #17151c; color: #e9e6f1; border-radius: 12px; padding: 16px 52px 16px 16px; font: 500 12.5px/1.6 ui-monospace, Consolas, monospace;
  overflow-x: auto; white-space: pre; margin: 12px 0 0;
}
.code button { position: absolute; right: 8px; top: 8px; background: rgba(255,255,255,.1); color: #fff; border: 0; height: 32px; width: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }

.split { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.covers label { position: relative; cursor: pointer; border-radius: 10px; overflow: hidden; border: 2px solid transparent; }
.covers input { position: absolute; opacity: 0; }
.covers label:has(input:checked) { border-color: var(--accent); }
.covers img, .covers canvas { width: 100%; aspect-ratio: 2/1; object-fit: cover; display: block; }
.wiz-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.success { text-align: center; padding: 56px 20px; }
.success .ok-ico { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); animation: pop .4s ease; }
.success .ok-ico svg { width: 36px; height: 36px; }

/* =========================================================
   TOUR VIEWER (sempre scuro)
   ========================================================= */
.tour { position: fixed; inset: 0; background: #0c0b0f; color: #f2f0f6; overflow: hidden; user-select: none; }
.tour .viewer-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #131217; }
.tour canvas.pano { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.tour canvas.pano:active { cursor: grabbing; }
.glass { background: rgba(18, 16, 24, .52); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border: 1px solid rgba(255,255,255,.08); }
.tour .ui { transition: opacity .5s ease, transform .5s ease; }
.tour.idle .ui { opacity: 0; pointer-events: none; }
.tour.idle .t-bottom { transform: translateY(16px); }
.t-top { position: absolute; left: 16px; right: 16px; top: max(16px, env(safe-area-inset-top)); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; pointer-events: none; }
.t-top > * { pointer-events: auto; }
.t-title { display: flex; align-items: center; gap: 12px; padding: 6px 18px 6px 6px; border-radius: 999px; min-width: 0; }
.t-title .btn { background: rgba(255,255,255,.1); border: 0; color: #fff; }
.t-title .btn:hover { background: rgba(255,255,255,.18); }
.t-title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-title small { display: block; font-size: 12px; color: rgba(242,240,246,.65); white-space: nowrap; }
.t-tools { display: flex; gap: 4px; padding: 5px; border-radius: 999px; }
.t-tools .btn { background: transparent; border: 0; color: #fff; }
.t-tools .btn:hover, .t-tools .btn.on { background: rgba(255,255,255,.16); }
.t-tools .btn.on { color: #d6ccf0; }
.t-bottom { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 10px; padding: 0 12px; }
.t-view-name { font-size: clamp(20px, 3vw, 28px); font-weight: 700; letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(0,0,0,.6); }
.t-groups { display: flex; gap: 4px; padding: 4px; border-radius: 999px; }
.t-groups button { border: 0; background: transparent; color: rgba(255,255,255,.75); height: 30px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }
.t-groups button.on { background: rgba(255,255,255,.92); color: #1f1c26; }
.strip { display: flex; gap: 8px; padding: 8px; border-radius: 18px; max-width: min(100%, 980px); overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.strip::-webkit-scrollbar { display: none; }
.strip button {
  flex: none; position: relative; width: 132px; height: 78px; border-radius: 12px; overflow: hidden; border: 2px solid transparent; padding: 0;
  cursor: pointer; background: #222 center / cover; transition: transform .2s, border-color .2s;
}
.strip button:hover { transform: translateY(-2px); }
.strip button.on { border-color: #d6ccf0; }
.strip button span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; font-size: 11px; font-weight: 600; text-align: left; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .strip button { width: 104px; height: 62px; } .t-title small { display: none; } .t-tools .opt { display: none; } }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; cursor: pointer; border: 0; }
.nav-arrow.prev { left: 16px; } .nav-arrow.next { right: 16px; }
@media (max-width: 640px) { .nav-arrow { display: none; } }

.minimap { position: absolute; right: 16px; bottom: 150px; width: 220px; padding: 12px; border-radius: 18px; }
.minimap header { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.6); margin-bottom: 6px; }
.minimap svg { width: 100%; height: auto; display: block; overflow: visible; }
.minimap .pt { cursor: pointer; }
.minimap .pt circle { fill: rgba(255,255,255,.35); transition: .2s; }
.minimap .pt:hover circle { fill: #fff; }
.minimap .pt.on circle { fill: #d6ccf0; }
.minimap .pt text { fill: rgba(255,255,255,.75); font-weight: 600; } /* dimensione in metri, impostata via attributo */
.minimap .pt.on text { fill: #fff; }
@media (max-width: 640px) { .minimap { width: 150px; bottom: 140px; right: 10px; } }

.loader { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 14px; transition: opacity .4s; }
.loader.hide { opacity: 0; pointer-events: none; }
.loader img { width: 72px; animation: float 2.4s ease-in-out infinite; }
.loader .bar { width: 160px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.loader .bar i { display: block; height: 100%; width: 40%; background: #d6ccf0; border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.hd-badge { position: absolute; right: 16px; top: 74px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; letter-spacing: .06em; transition: opacity .4s; }
.hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 20px; border-radius: 16px; display: flex; gap: 10px; align-items: center; font-weight: 600; animation: hintFade 4.5s ease forwards; pointer-events: none; }
@keyframes hintFade { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- caricamento ---------- */
.busy { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(3px); cursor: progress; }
.busy-card { min-width: 280px; max-width: 420px; padding: 22px 26px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; justify-items: center; gap: 8px; text-align: center; }
.busy-card b { font-size: 15px; }
.busy-card span { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy-bar { width: 100%; height: 4px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.busy-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.busy-bar.indeterminate i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
/* nel tour: indicatore finché la vista non è caricata in HD */
.t-loading { position: absolute; left: 50%; top: max(76px, calc(env(safe-area-inset-top) + 64px)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: opacity .3s; }
.t-loading .spinner { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255,255,255,.2); border-top-color: #d6ccf0; }
.t-loading.off { opacity: 0; pointer-events: none; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: fadeUp .25s ease; display: flex; gap: 10px; align-items: center; }

/* editor dell'audio ambiente (audiotrim.js) */
.atrim { margin-top: 12px; }
.atrim-wave { display: block; width: 100%; height: 96px; border-radius: var(--radius-sm); background: var(--bg-2); cursor: ew-resize; touch-action: none; }
.atrim-info { margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.atrim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
