/* ==========================================================================
   AIrtworks — foglio di stile
   Palette: carta calda / inchiostro caldo, accento ottone.
   Modifica solo le variabili qui sotto per cambiare i colori del sito.
   ========================================================================== */

:root {
  /* --- tema chiaro (predefinito) --- */
  --bg:          #FDFBFF;
  --bg-2:        #FFFFFF;
  --bg-3:        #F4EFFB;
  --fill:        #EFE8F9;
  --line:        #E3DAF2;
  --line-2:      #C2B4DD;
  --ink:         #16111F;
  --ink-2:       #574D6B;
  --ink-3:       #7C7191;
  --accent:      #D1005C;
  --accent-2:    #FF3D81;
  --accent-ink:  #FFFFFF;
  /* secondo colore delle sfumature (pulsante "+", profilo) e quello caldo degli avatar:
     uguali nei due temi. Per cambiare palette basta cambiare queste righe e gli --accent. */
  --grad-2:      #8A2BE2;
  --grad-2-hover:#7A1FD0;
  --caldo:       #F59E0B;
  --danger:      #C01424;
  --ok:          #0E7A45;
  --shadow:      0 1px 2px rgba(22, 17, 31, .06), 0 10px 30px rgba(22, 17, 31, .08);

  /* un colore per ogni tipo di opera: la griglia diventa leggibile a colpo d'occhio */
  --k-image:   #D6006B;
  --k-video:   #6A2BE0;
  --k-audio:   #00897B;
  --k-text:    #A86100;
  --k-code:    #0E8A42;
  --k-model3d: #C94A00;
  --k-ink:     #FFFFFF;

  --font-display: "Bodoni Moda", "Didot", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:    "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 2.2vw, 40px);
  --maxw: none;            /* il sito occupa tutta la larghezza dello schermo */
  --r: 3px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #0C0A14;
    --bg-2:       #15121F;
    --bg-3:       #1C1829;
    --fill:       #241F33;
    --line:       #2E2742;
    --line-2:     #4A3E68;
    --ink:        #F6F2FF;
    --ink-2:      #B4A9CE;
    --ink-3:      #8A7FA8;
    --accent:     #FF3D81;
    --accent-2:   #FF77AA;
    --accent-ink: #1A0410;
    --danger:     #FF7A72;
    --ok:         #45E08C;
    --shadow:     0 1px 2px rgba(0,0,0,.5), 0 14px 40px rgba(0,0,0,.45);
    --k-image:   #FF3D81;
    --k-video:   #9B6CFF;
    --k-audio:   #00E5CF;
    --k-text:    #FFC93D;
    --k-code:    #4DE884;
    --k-model3d: #FF9144;
    --k-ink:     #140A1C;
  }
}

:root[data-theme="dark"] {
    --bg:         #0C0A14;
  --bg-2:       #15121F;
  --bg-3:       #1C1829;
  --fill:       #241F33;
  --line:       #2E2742;
  --line-2:     #4A3E68;
  --ink:        #F6F2FF;
  --ink-2:      #B4A9CE;
  --ink-3:      #8A7FA8;
  --accent:     #FF3D81;
  --accent-2:   #FF77AA;
  --accent-ink: #1A0410;
  --danger:     #FF7A72;
  --ok:         #45E08C;
  --shadow:     0 1px 2px rgba(0,0,0,.5), 0 14px 40px rgba(0,0,0,.45);
  --k-image:   #FF3D81;
  --k-video:   #9B6CFF;
  --k-audio:   #00E5CF;
  --k-text:    #FFC93D;
  --k-code:    #4DE884;
  --k-model3d: #FF9144;
  --k-ink:     #140A1C;
}

/* --- reset leggero --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* --- impalcatura --- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
main { min-height: 60vh; padding-block: 28px 64px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* --- testata --- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: inline-flex; align-items: baseline; gap: 2px; text-decoration: none; letter-spacing: -.01em; }
.brand b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  font-optical-sizing: auto;
}
.brand .ai { color: var(--accent); }
.brand small {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-left: 8px;
  align-self: center;
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .icon-btn {
  padding: 7px 11px;
  border-radius: var(--r);
  text-decoration: none;
  font-size: 14px;
  color: var(--ink-2);
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}
.nav a:hover, .icon-btn:hover { color: var(--ink); background: var(--fill); }
.nav a.on { color: var(--ink); border-color: var(--line); background: var(--bg-2); }

/* --- bottoni --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--bg-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: var(--fill); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--fill); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: none; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }

/* --- etichette e testo di servizio --- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(30px, 5.2vw, 46px); letter-spacing: -.015em; }
h2 { font-size: clamp(21px, 3vw, 27px); }
h3 { font-size: 18px; }
p { margin: 0 0 14px; }
.prose { max-width: 66ch; }
.prose h2 { margin: 32px 0 10px; }
.prose h3 { margin: 24px 0 8px; font-family: var(--font-sans); font-size: 16px; font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); }

/* --- apertura --- */
.hero { border-bottom: 1px solid var(--line); padding-block: 36px 26px; margin-bottom: 26px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 28px; align-items: end; }
.hero p { max-width: 46ch; color: var(--ink-2); margin: 12px 0 0; }
.hero-stats { display: flex; gap: 26px; justify-content: flex-end; }
.stat b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; }
.stat span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: 18px; }
  .hero-stats { justify-content: flex-start; }
}

/* --- barra filtri --- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
/* ricerca: una lente tonda come le altre icone, che si allarga quando la tocchi */
.search {
  display: flex; align-items: center; flex: none;
  width: 42px; height: 42px;
  border: 1px solid var(--line-2); border-radius: 100px;
  background: var(--bg-2); overflow: hidden;
  transition: width .3s ease, border-color .2s ease, box-shadow .2s ease;
}
.search:hover { border-color: var(--ink-3); }
.search.aperta {
  width: min(340px, calc(100vw - 2 * var(--gutter) - 140px));
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
.search-lente {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; border: 0; background: none;
  color: var(--ink-2); cursor: pointer;
}
.search-lente svg { width: 19px; height: 19px; }
.search.aperta .search-lente { color: var(--accent); cursor: default; }
.search input#q {
  flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; outline: none;
  font-size: 14.5px; color: var(--ink);
}
.search input#q::placeholder { color: var(--ink-3); }
.search-x {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px; margin-right: 8px; padding: 0;
  border: 0; border-radius: 50%; background: var(--fill); color: var(--ink-2); cursor: pointer;
}
.search-x:hover { background: var(--accent); color: var(--accent-ink); }
.search-x[hidden] { display: none; }

/* --- griglia galleria --- */
.gallery { columns: 250px; column-gap: 18px; }   /* tante colonne quante ne stanno, come Pinterest */
@media (max-width: 640px) { .gallery { columns: 2 150px; column-gap: 12px; } }
.card {
  break-inside: avoid;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  display: block;
  text-decoration: none;
  position: relative;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card-media { position: relative; background: var(--fill); overflow: hidden; }
.card-media img, .card-media canvas, .card-media svg { width: 100%; height: auto; display: block; }
.card-body { padding: 11px 12px 13px; }
.card-title { font-family: var(--font-display); font-size: 17px; line-height: 1.2; margin-bottom: 4px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; flex: none; }
.kind-tag {
  position: absolute; top: 8px; left: 8px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 7px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.likes { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }

/* --- testo/codice nelle anteprime --- */
.excerpt {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 18px 16px;
  color: var(--ink-2);
  background: var(--bg-3);
  min-height: 150px;
  white-space: pre-wrap;
  overflow: hidden;
}
.wave { display: block; width: 100%; height: 110px; background: var(--bg-3); }

/* --- pagina opera --- */
.work { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 34px; align-items: start; }
@media (max-width: 900px) { .work { grid-template-columns: 1fr; gap: 22px; } }
.work-media {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 10px;
}
.work-media img, .work-media video, .work-media canvas { width: 100%; height: auto; }
.work-media pre {
  margin: 0; padding: 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.65;
  background: var(--bg-3); color: var(--ink);
  white-space: pre-wrap;
}
.label { border-top: 2px solid var(--ink); padding-top: 14px; }
.label h1 { font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 6px; }
.byline { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.byline a { color: var(--accent); text-decoration: none; }
.byline a:hover { text-decoration: underline; }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0 0 20px; font-size: 13px; }
dl.meta dt {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding-top: 3px;
}
dl.meta dd { margin: 0; font-family: var(--font-mono); font-size: 13px; word-break: break-word; }
.prompt-box {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
  background: var(--bg-3); border-left: 2px solid var(--accent);
  padding: 12px 14px; margin-bottom: 18px; white-space: pre-wrap; word-break: break-word;
}
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tag { font-size: 12px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 100px; color: var(--ink-2); text-decoration: none; }
.tag:hover { border-color: var(--line-2); color: var(--ink); }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }

/* --- moduli --- */
.form { max-width: 520px; }
.form.wide { max-width: 720px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--bg-2);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 92px; font-family: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; margin-bottom: 12px; }
.check input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* --- area di rilascio file --- */
.drop {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r);
  padding: 34px 20px;
  text-align: center;
  background: var(--bg-2);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--fill); }
.drop strong { display: block; font-size: 15px; margin-bottom: 4px; }
.drop .preview { max-height: 260px; width: auto; margin: 0 auto 12px; border: 1px solid var(--line); }

/* --- avvisi --- */
.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  font-size: 13.5px;
  margin-bottom: 20px;
  border-radius: 0 var(--r) var(--r) 0;
}
.notice.err { border-left-color: var(--danger); }
.notice.ok { border-left-color: var(--ok); }
.notice b { display: block; margin-bottom: 2px; }
.demo-banner {
  background: var(--fill);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  padding: 7px 16px;
}
.demo-banner b { color: var(--ink); }

/* --- profilo --- */
.profile-head { display: flex; gap: 20px; align-items: flex-start; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.avatar {
  width: 78px; height: 78px; flex: none;
  border-radius: 50%;
  background: var(--fill);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 30px; color: var(--ink-2);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --- tabella moderazione --- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 400;
  padding: 8px 10px; border-bottom: 1px solid var(--line-2);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: var(--bg-2); }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 100px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.warn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.table-scroll { overflow-x: auto; }

/* --- vuoto / caricamento --- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-2); border: 1px dashed var(--line); }
.empty h3 { font-family: var(--font-sans); font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.skeleton { background: var(--fill); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.spinner {
  width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- piè di pagina --- */
.site-footer { border-top: 1px solid var(--line); padding-block: 30px 42px; margin-top: 40px; background: var(--bg-2); }
.footer-grid { display: flex; gap: 30px; flex-wrap: wrap; justify-content: space-between; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- anteprime speciali: video, audio, segnaposto --- */
.media-play { position: relative; background: var(--fill); }
.media-play > span {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); pointer-events: none;
}
.media-play img { width: 100%; }
.wave-box { padding: 20px 14px; color: var(--accent); background: var(--bg-3); }
.wave-box svg { width: 100%; height: 100px; }
.audio-box { padding: 22px 18px; color: var(--accent); background: var(--bg-3); }
.audio-box svg { width: 100%; height: 120px; margin-bottom: 14px; }
.audio-box audio { width: 100%; }
.ph {
  display: grid; place-items: center; gap: 8px;
  min-height: 170px; padding: 26px; color: var(--ink-3); background: var(--bg-3);
}
.ph.big { min-height: 320px; }
.ph span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

/* --- messaggio temporaneo in alto --- */
#toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  max-width: min(520px, calc(100% - 32px));
  box-shadow: var(--shadow);
  background: var(--bg-2);
  margin: 0;
}

/* --- correzioni di impaginazione --- */

/* l'icona "play" non deve ereditare la larghezza piena delle anteprime */
.card-media .media-play > span svg,
.work-media .media-play > span svg { width: 54px; height: 54px; }

/* il testo delle anteprime non deve finire sotto l'etichetta del tipo */
.excerpt { padding-top: 36px; }

/* un'immagine molto alta non deve spingere la targhetta fuori schermo */
.work-media img, .work-media video { max-height: 62vh; object-fit: contain; margin-inline: auto; }

/* testata compatta sui telefoni: niente sottotitolo, menu che non sborda */
.nav { min-width: 0; }
@media (max-width: 760px) {
  .brand small { display: none; }
  .brand b { font-size: 22px; }
  /* logo e menu sulla stessa riga: lingua, tema e moderazione stanno nel menu dell'avatar */
  .site-header .wrap { height: 58px; gap: 6px; }
  .nav a, .icon-btn { padding: 6px 8px; font-size: 13.5px; }
  .hero { padding-block: 24px 20px; }
  .hero p { font-size: 15px; }
}

/* il pulsante "Accedi" nella testata deve restare in evidenza:
   senza questa regola la voce di menu ne cancellerebbe lo sfondo */
.nav a.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav a.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }

/* ==========================================================================
   APERTURA DELLA HOME — la scritta grande
   ========================================================================== */

.hero { padding-block: 44px 30px; }
.hero h1 {
  font-size: clamp(42px, 9vw, 96px);
  line-height: .96;
  letter-spacing: -.035em;
  margin-bottom: 4px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  white-space: nowrap;
  /* sottolineatura spessa che scavalca le lettere con la coda (g, y, à) */
  text-decoration: underline;
  text-decoration-color: var(--k-audio);
  text-decoration-thickness: .075em;
  text-underline-offset: .14em;
  text-decoration-skip-ink: auto;
}
.hero p { font-size: clamp(15px, 1.7vw, 18px); max-width: 44ch; margin-top: 16px; }
.hero .eyebrow { color: var(--k-audio); margin-bottom: 14px; }
.hero-stats .stat b { color: var(--ink); }
.hero-stats .stat:nth-child(1) b { color: var(--k-image); }
.hero-stats .stat:nth-child(2) b { color: var(--k-video); }
.hero-stats .stat:nth-child(3) b { color: var(--k-code); }

/* ==========================================================================
   UN COLORE PER OGNI TIPO DI OPERA
   ========================================================================== */

[data-kind="image"]   { --k: var(--k-image); }
[data-kind="video"]   { --k: var(--k-video); }
[data-kind="audio"]   { --k: var(--k-audio); }
[data-kind="text"]    { --k: var(--k-text); }
[data-kind="code"]    { --k: var(--k-code); }
[data-kind="model3d"] { --k: var(--k-model3d); }
[data-kind="all"]     { --k: var(--accent); }

/* striscia colorata in cima a ogni scheda: dice il tipo prima ancora di leggere */
.card { position: relative; }
.card::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--k, var(--accent));
}
.card:hover { border-color: var(--k, var(--line-2)); }
.card-media .kind-tag {
  background: var(--k, var(--accent));
  color: var(--k-ink);
  border: 0;
  font-weight: 600;
  backdrop-filter: none;
  top: 10px; left: 10px;
}
.card-title { font-size: 18px; }

/* filtri: quello attivo prende il colore del suo tipo */
.chip.on { background: var(--k, var(--ink)); border-color: var(--k, var(--ink)); color: var(--k-ink); font-weight: 600; }
.chip:hover { border-color: var(--k, var(--line-2)); color: var(--ink); }

/* pagina opera: la targhetta prende il colore del tipo */
.label { border-top-color: var(--k, var(--ink)); border-top-width: 4px; }
.prompt-box { border-left-color: var(--k, var(--accent)); }
.wave-box, .audio-box { color: var(--k, var(--accent)); }

/* ==========================================================================
   PULSANTE PER APRIRE IL FILE ORIGINALE
   ========================================================================== */

.open-original {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin-top: 16px;
  padding: 20px 26px;
  border: 2px solid var(--k, var(--accent));
  border-radius: 6px;
  background: var(--k, var(--accent));
  color: var(--k-ink);
  text-decoration: none;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 700;
  letter-spacing: -.01em;
  text-align: center;
  transition: transform .12s ease, filter .15s ease;
}
.open-original:hover { filter: brightness(1.08); transform: translateY(-2px); }
.open-original:active { transform: translateY(0); }
.open-original svg { flex: none; }
.open-original .meta {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .78;
  margin-top: 3px;
}
@media (max-width: 560px) {
  .open-original { padding: 16px 18px; gap: 10px; }
}

/* ==========================================================================
   RITOCCHI D'INSIEME
   ========================================================================== */

.btn-primary { font-weight: 700; }
.site-header { border-bottom-width: 2px; }
.brand .ai { color: var(--accent); }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.empty { border-color: var(--line-2); }
.empty h3 { font-size: 18px; }

/* apertura su una colonna sola: il titolo grande usa tutta la larghezza */
.hero-grid { display: block; }
.hero .eyebrow { display: block; margin-bottom: 16px; }
.hero h1 { max-width: 17ch; }
.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px 34px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.hero-foot .hero-stats { justify-content: flex-start; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
@media (max-width: 760px) {
  .hero h1 { max-width: none; }
  .hero-foot { gap: 18px; }
  .btn-lg { width: 100%; }
}

/* il titolo e l'occhiello non devono ereditare la larghezza del paragrafo */
.hero h1 { max-width: none; }
.hero p.eyebrow { max-width: none; }

/* ==========================================================================
   VOTI
   ========================================================================== */

.score-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--bg-3);
  border-left: 4px solid var(--k, var(--accent));
  border-radius: 0 4px 4px 0;
}
.score-box b {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
  color: var(--k, var(--accent));
  font-variant-numeric: tabular-nums;
}
.score-box span { font-size: 13px; color: var(--ink-2); }
.score-box em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--ink-3); }
.score-box.empty { border-left-color: var(--line-2); }
.score-box.empty span { font-size: 14px; }

.rate { margin-bottom: 20px; }
.rate-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; }
.rate-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.rate-btn:hover { border-color: var(--k, var(--accent)); color: var(--ink); }
.rate-btn.on {
  background: var(--k, var(--accent));
  border-color: var(--k, var(--accent));
  color: var(--k-ink);
}
.rate-note { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
.rate-note a { color: var(--accent); }

/* ==========================================================================
   COMMENTI
   ========================================================================== */

.comments { margin-top: 48px; padding-top: 28px; border-top: 2px solid var(--line); max-width: 72ch; }
.comments h2 { margin-bottom: 16px; }
.comments h2 .muted { font-family: var(--font-sans); font-size: 16px; }
.comment-form { margin-bottom: 26px; }
.comment-form textarea { margin-bottom: 10px; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.comment-head a { text-decoration: none; color: var(--ink); }
.comment-head a:hover { color: var(--accent); }
.comment.hidden-comment { opacity: .6; }
.empty-comment { color: var(--ink-3); border-bottom: 0; padding: 18px 0; }

.linky {
  background: none; border: 0; padding: 0;
  font-size: 12.5px; color: var(--ink-3);
  cursor: pointer; text-decoration: underline;
}
.linky:hover { color: var(--accent); }

#descbox { margin-bottom: 18px; }
#descbox .work-desc { margin-bottom: 6px; }

/* ==========================================================================
   CLASSIFICA IN HOME
   ========================================================================== */

.top { margin-bottom: 34px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.top h2 { margin-bottom: 16px; }
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.top-list li { border-bottom: 1px solid var(--line); }
.top-list li:last-child { border-bottom: 0; }
.top-list a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 6px;
  text-decoration: none;
  border-radius: 4px;
}
.top-list a:hover { background: var(--bg-3); }
.rank {
  flex: none;
  width: 34px;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  color: var(--k, var(--accent));
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.top-thumb {
  flex: none;
  width: 66px; height: 66px;
  overflow: hidden;
  background: var(--fill);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.top-thumb img, .top-thumb .media-play { width: 100%; height: 100%; object-fit: cover; }
.top-thumb .excerpt, .top-thumb .wave-box, .top-thumb .ph {
  padding: 6px; min-height: 0; height: 100%; width: 100%;
  font-size: 8px; line-height: 1.35; overflow: hidden;
}
.top-thumb .ph svg { width: 20px; height: 20px; }
.top-thumb .ph span { display: none; }
.top-thumb .media-play > span svg { width: 22px; height: 22px; }
.top-who { flex: 1 1 auto; min-width: 0; }
.top-who b { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1.2; }
.top-who em {
  font-style: normal; font-size: 12.5px; color: var(--ink-3);
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-score {
  flex: none; text-align: right;
  font-family: var(--font-display); font-size: 26px; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.top-score small {
  display: block; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px;
}
@media (max-width: 560px) {
  .top-list a { gap: 10px; padding: 9px 2px; }
  .rank { width: 24px; font-size: 22px; }
  .top-thumb { width: 50px; height: 50px; }
  .top-who b { font-size: 15px; }
  .top-score { font-size: 20px; }
}

/* spigoli arrotondati per le opere, come su Pinterest */
:root { --r-opera: 16px; }
.card { border-radius: var(--r-opera); overflow: hidden; }
.work-media { border-radius: var(--r-opera); overflow: hidden; }
.work-media img, .work-media video, .work-media canvas, .work-media pre { border-radius: calc(var(--r-opera) - 8px); }
.top-thumb { border-radius: 10px; }
@media (max-width: 640px) { :root { --r-opera: 12px; } }

/* prima pagina dei testi caricati come file: un foglio bianco */
.doc-page {
  aspect-ratio: 1 / 1.414;
  background: #fff;
  color: #24211d;
  overflow: hidden;
}
.doc-page .excerpt {
  background: transparent; color: inherit; min-height: 0; height: 100%;
  font-family: Georgia, "Times New Roman", serif; font-size: 12px;
  padding: 14% 11% 0;
}
.doc-page.ok { aspect-ratio: auto; }
.doc-page img { display: block; width: 100%; height: auto; }
.work-media .doc-page, .work-media .doc-img { max-width: 640px; margin-inline: auto; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
.work-media .doc-page img, .work-media .doc-img { max-height: none; }
.top-thumb .doc-page { width: 100%; height: 100%; aspect-ratio: auto; }
.top-thumb .doc-page img { height: 100%; object-fit: cover; object-position: top; }
.top-thumb .doc-page .excerpt { padding: 6px; font-size: 6px; }

/* accesso con Google, Facebook & co. */
.social-list { display: grid; gap: 10px; }
.btn-social { padding: 12px 16px; font-size: 15px; font-weight: 600; gap: 12px; }
.btn-social svg { width: 20px; height: 20px; flex: none; }
.social-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--ink-3); font-size: 13px; }
.social-or::before, .social-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- ideogrammi al posto delle parole ---------- */
.ico { width: 20px; height: 20px; display: block; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* il suggerimento con la parola, quando ci passi sopra col mouse */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 8px);
  transform: translate(-50%, -4px);
  padding: 6px 10px; border-radius: 9px;
  background: var(--ink); color: var(--bg);
  font: 600 11.5px/1 var(--font-sans); letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity .15s ease, transform .15s ease;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
/* il pulsante col mouse sopra va in primo piano, così il suggerimento non finisce sotto le opere
   (l'effetto "si alza" del pulsante lo chiuderebbe in un livello suo) */
[data-tip]:hover, [data-tip]:focus-visible { z-index: 80; }
.nav [data-tip]::after, .seg [data-tip]::after { left: auto; right: 0; transform: translateY(-4px); }
.nav [data-tip]:hover::after, .nav [data-tip]:focus-visible::after,
.seg [data-tip]:hover::after, .seg [data-tip]:focus-visible::after { transform: translateY(0); }
@media (hover: none) { [data-tip]::after { display: none; } }

/* menu in alto: bottoni tondi */
.nav { gap: 6px; }
.nav .nav-ico {
  display: grid; place-items: center;
  width: 42px; height: 42px; padding: 0;
  border-radius: 50%; border: 1px solid transparent;
  color: var(--ink-2); background: none;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav .nav-ico:hover { color: var(--ink); background: var(--fill); transform: translateY(-1px); }
.nav .nav-ico.on {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.nav .nav-create {
  color: #fff; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--grad-2));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.nav .nav-create .ico { width: 22px; height: 22px; stroke-width: 2.2; transition: transform .25s ease; }
.nav .nav-create:hover, .nav .nav-create.on { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--grad-2-hover)); }
/* gira solo il "+", non il pulsante: altrimenti girerebbe anche il fumetto con la scritta */
.nav .nav-create:hover .ico { transform: rotate(90deg); }
.nav .nav-signin { color: var(--accent-ink); background: var(--accent); }
.nav .nav-signin:hover { color: var(--accent-ink); background: var(--accent-2); }
.nav .avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--caldo)); color: #fff;
  font: 700 15px/1 var(--font-display);
}
.nav-sep { width: 1px; height: 22px; background: var(--line); margin-inline: 2px; }
.nav .lang-badge {
  position: absolute; right: 2px; bottom: 3px;
  font: 700 8.5px/1 var(--font-mono); letter-spacing: .04em;
  padding: 2px 3px; border-radius: 4px; background: var(--ink); color: var(--bg);
}
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* filtri per tipo: ideogrammi tondi, quello scelto prende il colore del tipo */
.chips { gap: 8px; }
.chip.chip-ico {
  display: grid; place-items: center;
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  color: var(--k, var(--ink-2));
  border-color: color-mix(in srgb, var(--k, var(--line)) 35%, var(--line));
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.chip.chip-ico:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--k, var(--fill)) 10%, transparent); }
.chip.chip-ico.on { color: var(--k-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--k, var(--ink)) 35%, transparent); }

/* ordinamento: tre ideogrammi uniti */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 100px; background: var(--bg-2); }
.seg-btn {
  display: grid; place-items: center; width: 38px; height: 34px;
  border: 0; border-radius: 100px; background: none; color: var(--ink-3); cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.seg-btn .ico { width: 18px; height: 18px; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--ink); color: var(--bg); }

/* etichetta del tipo sulle schede: solo l'ideogramma */
.card-media .kind-tag { display: grid; place-items: center; padding: 6px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .22); }
.card-media .kind-tag .ico { width: 16px; height: 16px; stroke-width: 2; }

/* pulsanti sotto l'opera */
.work-actions { align-items: center; }
.act-ico {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--ink-2); cursor: pointer;
  transition: transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}
.act-ico .ico { width: 19px; height: 19px; }
.act-ico:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.act-wa:hover { color: #25D366; border-color: #25D366; }
.act-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.act-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.act-more { width: 52px; height: 52px; }
.act-more .ico { width: 24px; height: 24px; }

/* dati dell'opera: ideogramma al posto della parola */
dl.meta dt { display: flex; align-items: center; color: var(--ink-3); }
dl.meta dt .ico { width: 17px; height: 17px; }

@media (max-width: 760px) {
  .nav { gap: 2px; }
  .nav .nav-ico { width: 38px; height: 38px; }
  .chip.chip-ico { width: 38px; height: 38px; }
}
.work-actions [data-act="like"] { height: 40px; padding: 0 14px; border-radius: 100px; }
.work-actions [data-act="like"] svg { width: 17px; height: 17px; }

/* modelli 3D: anteprima su sfondo scuro "da studio" e visore che si gira */
.m3d-view {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 70vh;
  display: grid; place-items: center; overflow: hidden;
  border-radius: calc(var(--r-opera) - 8px);
  background: radial-gradient(circle at 50% 40%, #4a4a4a, #111111 75%);
  color: rgba(255, 255, 255, .35);
}
.m3d-view.ok { cursor: grab; touch-action: none; }
.m3d-view.ok:active { cursor: grabbing; }
.m3d-go {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 20px; border: 0; border-radius: 100px; cursor: pointer;
  font: 600 14px/1 var(--font-sans); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--grad-2));
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: transform .18s ease;
}
.m3d-go:hover { transform: translateX(-50%) translateY(-2px); }
.m3d-go .ico { width: 20px; height: 20px; }
.m3d-view > .ico { width: 64px; height: 64px; stroke-width: 1.2; }
.m3d-view > img { width: 100%; height: 100%; object-fit: cover; }
.m3d-view canvas { width: 100%; height: 100%; display: block; }
.m3d-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
.m3d-hint svg { width: 16px; height: 16px; }
.m3d-hint[hidden] { display: none; }
/* modello 3D ancora senza foto: segnaposto leggero, nessun calcolo 3D in galleria */
.m3d-ph {
  aspect-ratio: 1 / 1; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #4a4a4a, #111111 75%);
  color: rgba(255, 255, 255, .4);
}
.m3d-ph .ico { width: 54px; height: 54px; stroke-width: 1.2; }
.top-thumb .m3d-ph { width: 100%; height: 100%; aspect-ratio: auto; }
.top-thumb .m3d-ph .ico { width: 24px; height: 24px; }

/* ---------- review di ottobre: profilo, commenti, avvisi ---------- */
.avatar { overflow: hidden; }
.nav .avatar { overflow: hidden; }
.nav .avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-mini, .avatar-big {
  display: inline-grid; place-items: center; flex: none; overflow: hidden; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--caldo)); color: #fff;
  font-family: var(--font-display); font-weight: 700;
}
.avatar-mini { width: 26px; height: 26px; font-size: 13px; margin-right: 2px; }
.avatar-big { width: 84px; height: 84px; font-size: 36px; }
.avatar-mini img, .avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.avatar-field { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.avatar-field .linky { margin-left: 10px; }
.comment-head { align-items: center; }
.linky.danger { color: var(--danger); }
.traduci { font-size: 12px; color: var(--ink-3); }
.traduci:hover { color: var(--accent); }
.profile-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.notifiche { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; }
.notifiche legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.notice.code-warn { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; margin: 12px 0; }
.notice.code-warn svg { flex: none; margin-top: 2px; color: var(--danger); }
.hint.conta.warn { color: var(--danger); font-weight: 600; }
.avatar-field .hint { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 0; }

/* ======================= profilo: studio + vetrina ======================= */
.px-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 100px; border: 1px solid var(--line-2); background: var(--bg-2);
  font: 600 14px var(--font-sans); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .18s ease, border-color .18s ease;
}
.px-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.px-btn .ico { width: 18px; height: 18px; }
.px-btn.pri { border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), var(--grad-2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.px-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 100px;
  border: 1px solid var(--line-2); background: var(--bg-2); font-size: 13px; color: var(--ink-2); text-decoration: none;
}
.px-chip:hover { border-color: var(--accent); color: var(--ink); }
.px-chip i { font: 600 11px var(--font-mono); font-style: normal; color: var(--ink-3); }
.px-tabs { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); margin: 30px 0 20px; }
.px-tabs > button {
  display: inline-flex; align-items: center; gap: 6px; padding: 12px 0; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font: 600 14.5px var(--font-sans); color: var(--ink-3);
}
.px-tabs > button.on { color: var(--ink); border-color: var(--accent); }
.px-tabs > button i { font-style: normal; font-weight: 500; color: var(--ink-3); }
.px-tabs > button .ico { width: 16px; height: 16px; }
.px-tabs .seg { margin-bottom: 6px; }

.pf-vista { margin: 34px 0 12px; }
.pf-cover {
  position: relative; height: 240px; border-radius: 24px; overflow: hidden;
  display: grid; grid-template-columns: repeat(var(--n, 5), 1fr);
  background: radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--accent) 55%, #000), transparent 60%),
              radial-gradient(circle at 80% 70%, var(--grad-2), transparent 55%), #1a1426;
}
.pf-cover.n1 { --n: 1; } .pf-cover.n2 { --n: 2; } .pf-cover.n3 { --n: 3; } .pf-cover.n4 { --n: 4; }
.pf-cover > div { overflow: hidden; }
.pf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(10, 8, 18, .5)); }
.pf-head { display: flex; gap: 24px; align-items: flex-start; margin: -64px 0 0 32px; position: relative; z-index: 2; }
.pf-av {
  width: 140px; height: 140px; flex: none; border-radius: 50%; overflow: hidden; border: 6px solid var(--bg);
  display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--caldo));
  font: 700 60px var(--font-display); color: #fff;
}
.pf-av img { width: 100%; height: 100%; object-fit: cover; }
/* nome e pulsanti stanno sotto la copertina: la foto è l'unica che la sormonta */
.pf-id { flex: 1; min-width: 0; margin-top: 78px; }
.pf-id h1 { font-size: clamp(30px, 4vw, 44px); margin: 0; overflow-wrap: anywhere; }
.pf-id p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.pf-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-top: 82px; }
.pf-bio { margin: 18px 0 0 32px; max-width: 62ch; font-size: 17px; }
.pf-stats { display: flex; gap: 40px; flex-wrap: wrap; margin: 24px 0 0 32px; }
.pf-stats b { display: block; font: 700 28px/1 var(--font-display); }
.pf-stats span { display: block; margin-top: 5px; font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.pf-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0 32px; }
.pf-nota { display: flex; gap: 8px; align-items: center; margin: -6px 0 18px; }
.pf-nota .ico { width: 16px; height: 16px; }

.pf-evidenza { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 30px; }
.pf-evidenza.n1 { grid-template-columns: 1fr; }
.pf-ev-side { display: grid; gap: 20px; }
.pf-ev { position: relative; display: block; min-height: 180px; border-radius: 20px; overflow: hidden; background: var(--fill); text-decoration: none; }
.pf-ev.big { min-height: 380px; }
.pf-ev > img, .pf-ev-ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pf-ev-ph > * { width: 100%; height: 100%; object-fit: cover; }
.pf-ev::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8, 6, 14, .7)); }
.pf-ev-t { position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 2; color: #fff; font: 600 20px/1.2 var(--font-display); }
.pf-pin { position: absolute; left: 14px; top: 14px; z-index: 2; background: #fff; color: #111; font: 700 11px var(--font-mono); letter-spacing: .1em; padding: 6px 10px; border-radius: 100px; text-transform: uppercase; }
.pf-ev-x { position: absolute; right: 12px; top: 12px; z-index: 3; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(10, 8, 18, .7); color: #fff; font-size: 18px; cursor: pointer; }

/* studio */
.pf-studio { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
.pc-card { border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; background: var(--bg-2); }
.pc-hello { display: flex; gap: 20px; align-items: center; }
.pc-hello h1 { font-size: clamp(26px, 3vw, 34px); margin: 2px 0; }
.pc-hello .muted { margin: 2px 0 0; }
.pc-ring { --pct: 0%; width: 88px; height: 88px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) 0 var(--pct), var(--fill) var(--pct) 100%); }
.pc-ring b { width: 68px; height: 68px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font: 700 21px var(--font-display); }
.pc-todo { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 14px; }
.pc-todo li { display: flex; gap: 8px; align-items: center; }
.pc-todo li b { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--fill); color: var(--ink-3); }
.pc-todo li a { color: var(--ink); text-decoration-color: var(--accent); }
.pc-todo li.ok { color: var(--ink-3); text-decoration: line-through; }
.pc-todo li.ok b { background: #18a058; color: #fff; }
.pc-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pc-kpi > div { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--bg); }
.pc-kpi small { font: 600 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pc-kpi b { display: block; font: 700 28px/1.1 var(--font-display); margin-top: 4px; }
.pc-kpi em { display: block; margin-top: 4px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.pc-kpi em.su { color: #18a058; } .pc-kpi em.giu { color: var(--danger); }
.pc-kpi em span { font-weight: 400; color: var(--ink-3); }
.pc-drop {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; padding: 24px 28px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 22px;
  background: color-mix(in srgb, var(--accent) 5%, transparent); transition: background .18s ease;
}
.pc-drop:hover, .pc-drop.over { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pc-drop .ic { width: 60px; height: 60px; flex: none; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--grad-2)); }
.pc-drop .ic .ico { width: 28px; height: 28px; stroke-width: 2.2; }
.pc-drop-t { flex: 1; }
.pc-drop h3 { margin: 0; font-size: 21px; }
.pc-drop p { margin: 4px 0 0; color: var(--ink-2); }

/* opere private e in evidenza */
.lock-tag {
  position: absolute; right: 10px; top: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(10, 8, 18, .78); color: #fff; font: 700 10.5px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 100px;
}
.lock-tag .ico { width: 13px; height: 13px; }
.act-ico.on-star { color: #E0A100; border-color: #E0A100; }
.visibilita { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; }
.visibilita legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.social-campo { display: grid; grid-template-columns: 22px 92px 1fr; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.social-campo .ico { width: 20px; height: 20px; color: var(--ink-2); }

@media (max-width: 900px) {
  .pf-studio { grid-template-columns: 1fr; }
  .pf-evidenza { grid-template-columns: 1fr; }
  .pf-ev.big { min-height: 300px; }
}
@media (max-width: 640px) {
  .pf-cover { height: 150px; border-radius: 18px; }
  .pf-head { flex-direction: column; align-items: flex-start; gap: 10px; margin: -52px 0 0 16px; }
  .pf-av { width: 104px; height: 104px; font-size: 44px; border-width: 5px; }
  .pf-id, .pf-act { margin-top: 0; }
  .pf-act { justify-content: flex-start; }
  .pf-bio, .pf-stats, .pf-tools { margin-left: 16px; }
  .pf-stats { gap: 24px; }
  .pc-todo { grid-template-columns: 1fr; }
  .pc-kpi { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .pc-kpi > div { padding: 10px; }
  .pc-kpi b { font-size: 22px; }
  .pc-drop { flex-direction: column; align-items: flex-start; }
  .px-tabs { gap: 16px; flex-wrap: wrap; }
}

/* ---------- invito a iscriversi (chi arriva da un link condiviso) ---------- */
#invito { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.invito-sfondo { position: absolute; inset: 0; background: rgba(8, 6, 14, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s ease; }
.invito {
  position: relative; width: min(760px, 100%); display: grid; grid-template-columns: 1fr 1.15fr;
  background: var(--bg); border: 1px solid var(--line); border-radius: 26px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(18px) scale(.98); transition: opacity .25s ease, transform .25s ease;
}
#invito.aperto .invito-sfondo, #invito.aperto .invito { opacity: 1; }
#invito.aperto .invito { transform: none; }
.invito-img { min-height: 100%; background: var(--fill); }
.invito-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.invito-img.vuota { display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--grad-2)); }
.invito-img.vuota .ico { width: 72px; height: 72px; stroke-width: 1.3; }
.invito-c { padding: 30px 30px 24px; }
.invito-c h2 { font-size: 28px; margin: 0 0 6px; padding-right: 26px; }
.invito-c > .muted { margin: 0 0 16px; }
.invito-punti { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; font-size: 14.5px; }
.invito-punti li { display: flex; gap: 10px; align-items: center; }
.invito-punti svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
#invito-social:not(:empty) { margin-bottom: 10px; }
.invito-cta { height: 46px; font-size: 15px; }
.invito-gia { text-align: center; margin: 14px 0 0; }
.invito-gia a { color: var(--accent); font-weight: 600; }
.invito-x {
  position: absolute; right: 14px; top: 14px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer; background: var(--fill); color: var(--ink);
}
@media (max-width: 640px) {
  /* sul telefono è un pannello che sale dal basso: la pagina resta visibile sopra */
  #invito { place-items: end center; padding: 0; }
  .invito { grid-template-columns: 1fr; border-radius: 24px 24px 0 0; max-height: 88vh; overflow-y: auto; transform: translateY(40px); }
  .invito-img { height: 150px; min-height: 0; }
  .invito-c { padding: 22px 20px 26px; }
  .invito-c h2 { font-size: 24px; }
}
.avviso-schema { margin: 18px auto 0; max-width: calc(100% - 2 * var(--gutter)); display: flex; flex-direction: column; gap: 4px; }
.pwd-box { border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; }
.pwd-box h2 { font-size: 20px; margin: 0 0 14px; }

/* moderazione: elenco delle parole filtrate */
.word-form { gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.word-form input[type="text"] { flex: 1 1 220px; min-width: 0; }
.word-form select { flex: 0 0 auto; width: auto; }
.word-form .check { margin: 0; flex: none; align-items: center; white-space: nowrap; }
.word-form .check input { margin-top: 0; }
.word-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.word-lists h3 { margin-bottom: 4px; }
.word-lists .muted.small { margin-bottom: 10px; }
.chip.parola { cursor: default; display: inline-flex; align-items: center; gap: 6px; padding-right: 6px; }
.chip.parola i { font-style: normal; font-size: 11px; }
.chip.parola button { border: 0; background: none; color: var(--ink-3); padding: 2px; cursor: pointer; display: inline-flex; border-radius: 50%; }
.chip.parola button:hover { color: var(--danger); background: var(--fill); }

/* menu del profilo: si apre dall'avatar in alto a destra */
@media (min-width: 761px) { .solo-tel { display: none !important; } }
@media (max-width: 760px) { .solo-pc { display: none !important; } }
.nav-menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
  width: max-content; min-width: 230px; max-width: calc(100vw - 24px); padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(10, 8, 18, .18);
}
.menu-pop[hidden] { display: none; }
.nav .menu-pop a, .nav .menu-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px; background: none;
  color: var(--ink); font: inherit; font-size: 14.5px; text-align: left; text-decoration: none; cursor: pointer;
}
.nav .menu-pop a:hover, .nav .menu-pop button:hover, .nav .menu-pop :focus-visible { background: var(--fill); outline: none; }
.menu-pop .ico { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.menu-pop [data-act="signout"], .menu-pop [data-act="signout"] .ico { color: var(--danger); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-chi { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-chi b { display: block; font-size: 14.5px; line-height: 1.25; }
.menu-chi small { color: var(--ink-3); font-size: 12.5px; }
.nav .menu-chi .avatar { width: 38px; height: 38px; flex: none; overflow: hidden; }
.nav-me[aria-expanded="true"]::after { display: none; }

/* galleria: seconda riga di filtri (categoria e tecnologia) */
.filtri { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -8px 0 20px; }
/* le tecnologie scorrono di lato; sul telefono vanno sotto la categoria */
.filtri-tech { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.filtri-tech::-webkit-scrollbar { display: none; }
.filtri[hidden] { display: none; }
.filtri .px-chip { flex: none; cursor: pointer; font: inherit; font-size: 13px; }
.filtri .px-chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filtri .px-chip.on i { color: inherit; opacity: .7; }
.filtri .px-chip svg { width: 11px; height: 11px; }
.filtri-nome { display: inline-flex; color: var(--ink-3); flex: none; }
.filtri-nome .ico { width: 17px; height: 17px; }
.filtro-cat {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; border-radius: 100px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2);
}
.filtro-cat .ico { width: 16px; height: 16px; flex: none; }
.filtro-cat select { border: 0; background-color: transparent; padding: 6px 26px 6px 0; font-size: 13px; color: inherit; width: auto; box-shadow: none; }
.filtro-cat.on { border-color: var(--ink); color: var(--ink); }
.cat-edit, .contest-edit { padding: 4px 28px 4px 8px; font-size: 13.5px; width: auto; max-width: 100%; }
.email-stato p { margin: 0 0 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* classifica: periodo e categoria */
.top-filtri { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 22px; }
.seg-btn.seg-txt { width: auto; padding: 0 14px; font-size: 13px; text-decoration: none; white-space: nowrap; }
@media (max-width: 760px) { .top-filtri .seg { width: 100%; } .seg-btn.seg-txt { flex: 1; padding: 0 8px; } }

/* contest */
.contest-pagina h2 { margin: 34px 0 14px; }
.contest-intro { max-width: 62ch; font-size: 16px; }
.contest-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.contest-card { border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; background: var(--bg-2); display: flex; flex-direction: column; gap: 8px; }
.contest-card h3 { margin: 0; font-size: 22px; }
.contest-card h3 a { color: var(--ink); text-decoration: none; }
.contest-card p { margin: 0; }
.contest-card.stato-aperto, .contest-card.stato-votazione { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.contest-stato { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.contest-stato .ico { width: 16px; height: 16px; }
.stato-concluso .contest-stato, .stato-prossimo .contest-stato { color: var(--ink-3); }
.contest-azioni { gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.contest-podio-mini { display: flex; gap: 8px; }
.contest-podio-mini a { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; display: block; background: var(--fill); }
.contest-podio-mini .top-thumb { width: 100%; height: 100%; border: 0; }
.contest-podio-mini .rank { position: absolute; left: 4px; top: 4px; z-index: 2; background: var(--ink); color: var(--bg); font: 700 11px var(--font-mono); border-radius: 100px; padding: 1px 6px; }
.contest-tappe { list-style: none; padding: 0; margin: 18px 0 12px; display: flex; gap: 0; max-width: 640px; }
.contest-tappe li { flex: 1; border-top: 3px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; font-size: 13px; color: var(--ink-3); }
.contest-tappe li.fatta { border-top-color: var(--accent); color: var(--ink-2); }
.contest-tappe b { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-mono); }
.contest-ora { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.contest-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.contest-banner .ico { width: 22px; height: 22px; flex: none; color: var(--accent); }
.contest-banner span { flex: 1; min-width: 0; }
.contest-banner em { font-style: normal; font-weight: 700; color: var(--accent); white-space: nowrap; }
.contest-banner:hover { background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); }
@media (max-width: 560px) { .contest-banner { flex-wrap: wrap; } .contest-banner em { width: 100%; padding-left: 34px; } }
.podio { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; margin: 26px 0 8px; max-width: 760px; }
.podio a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); text-align: center; }
.podio-img.top-thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 16px; }
.podio-img .wave-box { display: grid; place-items: center; padding: 14px; }
.podio-img .excerpt { font-size: 11px; padding: 12px; text-align: left; }
.podio-pos { font: 700 34px var(--font-display); color: var(--accent); line-height: 1; margin-top: 6px; }
.podio-2 .podio-pos, .podio-3 .podio-pos { color: var(--ink-3); font-size: 26px; }
.podio b { font-family: var(--font-display); font-size: 17px; }
.podio em { font-style: normal; color: var(--ink-3); font-size: 13px; }
.podio-1 { order: 2; } .podio-2 { order: 1; } .podio-3 { order: 3; }
.tre-date { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 560px) { .tre-date { grid-template-columns: 1fr; } }
.contest-nuovo { margin-top: 14px; }
.contest-nuovo summary { list-style: none; display: inline-flex; cursor: pointer; }
.contest-nuovo summary::-webkit-details-marker { display: none; }
.contest-nuovo[open] summary { margin-bottom: 14px; }
.contest-nuovo form { max-width: 760px; }
.contest-field label .ico, .contest-edit { vertical-align: middle; }
.contest-field label .ico { width: 16px; height: 16px; }

/* badge sul profilo */
.pf-badge { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0 32px; }
@media (max-width: 760px) { .pf-badge { margin-left: 16px; } }
.badge-pf {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 100px;
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none;
  background: color-mix(in srgb, var(--caldo) 14%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--caldo) 45%, var(--line));
}
.badge-pf .ico { width: 16px; height: 16px; color: color-mix(in srgb, var(--caldo) 75%, var(--ink)); }
.badge-pf.b-contest_1 { background: linear-gradient(135deg, color-mix(in srgb, var(--caldo) 30%, var(--bg-2)), color-mix(in srgb, var(--accent) 14%, var(--bg-2))); }
.badge-pf.prossimo { background: none; border-style: dashed; border-color: var(--line-2); color: var(--ink-3); font-weight: 500; }
.badge-pf.prossimo .ico { color: var(--ink-3); }

/* Impostazioni: eliminare l'account */
.elimina-box { margin-top: 22px; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.elimina-box h2 { color: var(--danger); }
