/* ==========================================================================
   I Segnalibri: identità "Salvia", seconda edizione (novembre 2026)

   Regole del sistema (vedi public/brand/index.html):
   - un solo carattere, Schibsted Grotesk, ospitato sul sito;
   - colori piatti: niente sfumature, niente vetro smerigliato, niente ombre sulle schede;
   - il verde foresta si usa per le azioni, l'ambra solo per voti e puntino del marchio;
   - forme: angoli piccoli (6-14 px), cerchi solo per gli avatar;
   - il segnalibro con la tacca a V è l'unico elemento grafico ricorrente
     (voto sulle copertine, voce di menu attiva, copertine generate).
   ========================================================================== */

@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('/fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-display: swap;
  font-weight: 400 900;
  src: url('/fonts/schibsted-grotesk-latin-wght-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

:root {
  /* carta e superfici */
  --paper: #FBFCFA;        /* Bianco Pagina */
  --surface: #FFFFFF;
  --sage: #E4ECE3;         /* Salvia Velo */
  --sage-2: #EFF4EE;
  --rule: #DCE5DA;
  --rule-strong: #C3D0C0;
  /* testo */
  --ink: #17241D;          /* Inchiostro Bosco */
  --ink-2: #55695D;        /* Salvia Spenta */
  /* azioni e accenti */
  --forest: #1F5C41;       /* Foresta */
  --forest-ink: #FFFFFF;
  --forest-soft: #DCEBE1;
  --amber: #F2A03D;        /* Ambra: voti e puntino */
  --amber-ink: #2B1A04;
  --amber-soft: #FCEBD3;
  --danger: #B3261E;
  --danger-ink: #FFFFFF;
  /* copertine generate */
  --tone-forest: #1F5C41;
  --tone-ink: #17241D;
  --tone-amber: #E08E2B;
  --tone-sage: #8DA893;
  --tone-clay: #A65A3A;
  --tone-night: #2E4057;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --overlay-shadow: 0 1px 2px rgba(23, 36, 29, .08), 0 12px 32px -8px rgba(23, 36, 29, .22);
  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

/* Tema scuro: automatico (segue il sistema) oppure scelto in Impostazioni (data-theme su <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B0D0C;      /* Inchiostro notte: quasi nero, appena caldo */
    --surface: #131615;    /* schede */
    --sage: #1C201E;       /* riempimenti, pulsanti secondari */
    --sage-2: #171A19;     /* passaggio del mouse */
    --rule: #222725;
    --rule-strong: #303633;
    --ink: #EDF0EE;
    --ink-2: #99A39D;
    --forest: #7DD3A2;     /* Salvia Luce: le azioni */
    --forest-ink: #08110C;
    --forest-soft: #15241B;
    --amber: #F4B45C;
    --amber-ink: #241503;
    --amber-soft: #2D2416;
    --danger: #F28B80;
    --danger-ink: #1A0806;
    --tone-forest: #2C6E50;
    --tone-ink: #262C29;
    --tone-amber: #B9732A;
    --tone-sage: #5E7B66;
    --tone-clay: #8A4A30;
    --tone-night: #2B3D52;
    --overlay-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 48px -12px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #0B0D0C;      /* Inchiostro notte: quasi nero, appena caldo */
    --surface: #131615;    /* schede */
    --sage: #1C201E;       /* riempimenti, pulsanti secondari */
    --sage-2: #171A19;     /* passaggio del mouse */
    --rule: #222725;
    --rule-strong: #303633;
    --ink: #EDF0EE;
    --ink-2: #99A39D;
    --forest: #7DD3A2;     /* Salvia Luce: le azioni */
    --forest-ink: #08110C;
    --forest-soft: #15241B;
    --amber: #F4B45C;
    --amber-ink: #241503;
    --amber-soft: #2D2416;
    --danger: #F28B80;
    --danger-ink: #1A0806;
    --tone-forest: #2C6E50;
    --tone-ink: #262C29;
    --tone-amber: #B9732A;
    --tone-sage: #5E7B66;
    --tone-clay: #8A4A30;
    --tone-night: #2B3D52;
    --overlay-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 48px -12px rgba(0, 0, 0, .8);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-weight: 750; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--forest); }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--amber-soft); color: var(--ink); }

.strong { font-weight: 650; }
.muted { color: var(--ink-2); }
.small { font-size: .84rem; }
.grow { flex: 1; min-width: 0; }
.icon { display: inline-flex; flex-shrink: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .5rem 1rem;
  border: 1px solid transparent; border-radius: 8px;
  background: none; cursor: pointer;
  font-weight: 650; font-size: .94rem; line-height: 1.2; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--forest); color: var(--forest-ink); }
.btn-primary:hover { color: var(--forest-ink); background: color-mix(in srgb, var(--forest) 88%, var(--ink)); }
.btn-secondary { background: var(--surface); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--forest); color: var(--forest); }
.btn-ghost { color: var(--ink-2); font-weight: 550; padding-inline: .7rem; }
.btn-ghost:hover { background: var(--sage-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: var(--danger-ink); }
.btn-danger:hover { color: var(--danger-ink); background: color-mix(in srgb, var(--danger) 88%, var(--ink)); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); color: var(--danger); }
.btn-icon { width: 40px; padding: 0; color: var(--ink-2); }
.btn-icon:hover { background: var(--sage-2); color: var(--ink); }
.btn-icon-round { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn-block { width: 100%; min-height: 46px; }
.btn-sm { min-height: 32px; padding: .3rem .75rem; font-size: .86rem; }
.link { background: none; border: 0; padding: 0; color: var(--forest); font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Campi ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field > span { font-size: .86rem; font-weight: 650; }
input:not([type=range]):not([type=file]):not([type=checkbox]):not([type=radio]), textarea, .select {
  width: 100%; min-height: 44px; padding: .6rem .8rem;
  border: 1px solid var(--rule-strong); border-radius: 8px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
input:hover, textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--rule-strong) 60%, var(--ink-2)); }
input:focus, textarea:focus, .select:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 20%, transparent); }
::placeholder { color: color-mix(in srgb, var(--ink-2) 80%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--forest); width: 18px; height: 18px; margin: 0; }
.form-error { color: var(--danger); margin: .2rem 0 .8rem; font-size: .9rem; font-weight: 550; }
.form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.hint { font-size: .82rem; color: var(--ink-2); margin: .45rem 0 0; }
.hint-shield { display: flex; gap: .4rem; align-items: flex-start; }
.hint-shield .icon { margin-top: .12rem; color: var(--forest); }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--amber); color: var(--amber-ink);
  font-size: .72rem; font-weight: 800; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
}
.tag { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 650; padding: .15rem .5rem; border-radius: 4px; background: var(--sage); color: var(--ink-2); }
.tag-warn { background: var(--amber-soft); color: var(--ink); }

/* ---------- Avatar ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--sage); }
.avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: hsl(var(--hue) 22% 86%); color: hsl(var(--hue) 35% 22%);
  font-weight: 750; letter-spacing: -.02em;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar-initials { background: hsl(var(--hue) 18% 24%); color: hsl(var(--hue) 35% 84%); }
}
:root[data-theme="dark"] .avatar-initials { background: hsl(var(--hue) 18% 24%); color: hsl(var(--hue) 35% 84%); }

/* ---------- Marchio ---------- */
.logo { display: inline-flex; align-items: center; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo-compact { display: none; }
.logo-svg { display: block; overflow: visible; }
.lg-ribbon { fill: var(--forest); }
.lg-dot { fill: var(--amber); }
.lg-word { fill: currentColor; }

/* Animazione del marchio: il nastro scende, il puntino cade sulla «i», la scritta compare */
.logo-svg.is-animated .lg-ribbon { animation: ribbon-in .62s var(--ease-out) both; }
.logo-svg.is-animated .lg-dot { transform-box: fill-box; transform-origin: 50% 100%; animation: dot-drop .7s .42s both; }
.logo-svg.is-animated .lg-word { animation: word-in .5s .28s var(--ease-out) both; }
@keyframes ribbon-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes dot-drop {
  0% { transform: translateY(-240%); opacity: 0; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  55% { transform: translateY(0) scale(1.12, .84); opacity: 1; animation-timing-function: var(--ease-out); }
  75% { transform: translateY(-12%) scale(.97, 1.04); }
  100% { transform: none; opacity: 1; }
}
@keyframes word-in { from { opacity: 0; transform: translateX(-2%); } to { opacity: 1; transform: none; } }

/* Caricamento: il nastro si riempie come una pagina che scorre */
.loading { display: grid; place-items: center; padding: 4rem 1rem; }
.loading .logo-svg .lg-ribbon { animation: ribbon-loop 1.2s var(--ease-out) infinite; }
.loading .logo-svg .lg-dot { animation: none; }
@keyframes ribbon-loop {
  0% { clip-path: inset(0 0 100% 0); }
  60%, 100% { clip-path: inset(0 0 0 0); }
}

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

/* ---------- Struttura ---------- */
.shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 640px) 288px;
  justify-content: center; gap: 40px;
  min-height: 100vh; padding: 0 20px;
}
.topbar { display: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px; padding: 30px 0 22px;
}
.sidebar > .logo { padding: 0 12px; }
.nav-links, .nav-secondary { display: flex; flex-direction: column; gap: 2px; }
.nav-secondary { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 8px;
  font-size: 1rem; font-weight: 550; color: var(--ink-2);
  background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: var(--sage-2); color: var(--ink); }
.nav-link.active { color: var(--ink); font-weight: 700; background: var(--sage); }
/* voce attiva: un piccolo segnalibro sul bordo sinistro */
.nav-link.active::before {
  content: ''; position: absolute; left: -10px; top: 9px; width: 5px; height: 26px;
  background: var(--forest);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.nav-link .badge { margin-left: auto; }
.nav-minor { min-height: 38px; font-size: .92rem; }
.nav-minor .icon svg { width: 19px; height: 19px; }

.main { padding: 30px 0 72px; min-width: 0; }
.aside {
  position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column; gap: 26px; padding: 34px 0;
}
.aside h3 { font-size: .95rem; margin: 0 0 .6rem; }
.manifesto { padding-top: 22px; border-top: 1px solid var(--rule); }
.manifesto p { margin: 0; color: var(--ink-2); font-size: .9rem; }

.page { display: flex; flex-direction: column; gap: 20px; }
.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -.035em; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.page-head .page-title + .muted { margin: .3rem 0 0; }
.section-title { font-size: 1.15rem; font-weight: 750; margin: .6rem 0 0; display: flex; align-items: center; gap: .45rem; }
.empty { padding: 2.4rem 1.5rem; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin: 0 0 .3rem; font-size: 1.15rem; }
.empty .btn { margin-top: .8rem; }
.back { align-self: flex-start; margin-left: -.7rem; }

/* ---------- Riga "Cosa stai leggendo" ---------- */
.composer { display: flex; align-items: center; gap: .85rem; padding: .7rem .7rem .7rem .85rem; transition: border-color .15s; }
.composer:hover { color: inherit; border-color: var(--rule-strong); }
.composer-prompt { flex: 1; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Pubblicazione ---------- */
.feed { display: flex; flex-direction: column; gap: 20px; }
.post { overflow: visible; }
.post-head { display: flex; align-items: center; gap: .75rem; padding: .9rem .75rem .9rem 1.1rem; }
.post-who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.post-who .muted { font-size: .84rem; }
.community-link { color: var(--forest); font-weight: 650; }

.post-media {
  position: relative;
  display: flex; justify-content: center;
  padding: 34px 0 30px;
  background: var(--sage);
  border-block: 1px solid var(--rule);
}
.post-media-link { display: block; transition: transform .25s var(--ease-out); }
.post-media-link:hover { transform: translateY(-3px); }
.post-cover, .post-media .cover-gen {
  width: 220px; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 3px 6px 6px 3px;
  box-shadow: 0 1px 1px rgba(23, 36, 29, .2), 0 18px 30px -16px rgba(23, 36, 29, .55);
}
.post-pdf { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.pdf-chip {
  display: inline-flex; align-items: center; gap: .4rem; max-width: 260px;
  padding: .3rem .7rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--rule);
  font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Il voto è un segnalibro ambra che pende dal bordo superiore */
.bookmark {
  position: absolute; top: -1px; right: 22px;
  display: flex; flex-direction: column; align-items: center;
  width: 48px; padding: 10px 0 20px;
  background: var(--amber); color: var(--amber-ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 11px), 0 100%);
  line-height: 1;
}
.bookmark strong { font-size: 1.45rem; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.bookmark span { font-size: .68rem; font-weight: 700; opacity: .75; margin-top: 2px; }

.post-body { padding: 1.2rem 1.25rem .2rem; }
.book-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.book-author { margin: .2rem 0 0; color: var(--ink-2); font-weight: 550; }
.genre-tag { display: inline-flex; margin-top: .55rem; font-size: .78rem; font-weight: 650; padding: .15rem .5rem; border-radius: 4px; background: var(--forest-soft); color: var(--forest); }
.post-rating { display: flex; align-items: center; gap: .55rem; margin: .8rem 0 .2rem; }
.rating-num { font-size: .88rem; color: var(--ink-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.affinity-chip {
  display: inline-flex; align-items: center; gap: .4rem; margin: .5rem 0 0;
  font-size: .86rem; font-weight: 600; color: var(--forest);
}
.reader-info .affinity-chip { margin-top: .25rem; font-size: .82rem; }

.post-section { margin-top: 1.1rem; }
.post-section-title { font-size: .84rem; font-weight: 750; color: var(--ink-2); margin: 0 0 .25rem; letter-spacing: 0; }
.post-text { margin: 0; line-height: 1.62; white-space: pre-line; }
.post-text.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.review { font-size: 1.04rem; }
.post-quote {
  display: block; margin: 1.2rem 0 0; padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--amber);
}
.post-quote .icon { display: none; }
.post-quote p { margin: 0; font-size: 1.12rem; font-weight: 550; font-style: italic; line-height: 1.5; white-space: pre-line; letter-spacing: -.005em; }

.post-actions { display: flex; flex-wrap: wrap; gap: .2rem; padding: .5rem .6rem; margin-top: 1.1rem; border-top: 1px solid var(--rule); }

/* Commenti */
.comments { padding: .4rem 1.1rem 1.1rem; border-top: 1px solid var(--rule); }
.comment-list { list-style: none; margin: .6rem 0 .9rem; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.comment { display: flex; gap: .65rem; align-items: flex-start; }
.comment-bubble { flex: 1; min-width: 0; }
.comment-meta { margin: 0; font-size: .88rem; display: flex; gap: .5rem; align-items: baseline; }
.comment-meta time { color: var(--ink-2); font-size: .8rem; }
.comment-body { margin: .1rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment .more-menu summary { width: 32px; min-height: 32px; opacity: .55; }
.comment:hover .more-menu summary, .comment .more-menu[open] summary { opacity: 1; }
.comment-form { display: flex; gap: .4rem; align-items: center; }

/* Copertina tipografica (quando manca la foto) */
.cover-gen {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem;
  padding: 1.3rem 1.1rem;
  background: var(--tone, var(--tone-forest)); color: #FBFCFA;
  text-align: left;
}
.tone-forest { --tone: var(--tone-forest); }
.tone-ink { --tone: var(--tone-ink); }
.tone-amber { --tone: var(--tone-amber); color: #1B1204; }
.tone-sage { --tone: var(--tone-sage); color: #0F1A15; }
.tone-clay { --tone: var(--tone-clay); }
.tone-night { --tone: var(--tone-night); }
.cover-gen-title { font-size: 1.4rem; font-weight: 800; line-height: 1.05; letter-spacing: -.035em; overflow-wrap: anywhere; }
.cover-gen-author { font-size: .84rem; font-weight: 600; opacity: .85; }
.cover-gen-mark {
  position: absolute; top: 0; right: 18%; width: 12%; height: 26%;
  background: currentColor; opacity: .9;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}

/* ---------- Stelle (0-10 su 5 stelle) ---------- */
.stars { display: inline-flex; gap: 2px; }
.star { position: relative; display: inline-block; width: 18px; height: 18px; }
.star svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.star .star-empty { fill: var(--rule-strong); }
.star .star-fill path { fill: var(--amber); }
.stars-sm .star { width: 14px; height: 14px; }

.star-picker { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.star-picker-stars { display: inline-flex; padding: 4px; margin: -4px; border-radius: 8px; cursor: pointer; }
.star-picker-stars .star-row { display: inline-flex; gap: 4px; }
.star-picker-stars .star { width: 34px; height: 34px; }
.rating-label { display: inline-flex; align-items: baseline; gap: .15rem; color: var(--ink-2); font-weight: 650; }
.rating-big { font-size: 2rem; font-weight: 850; color: var(--ink); letter-spacing: -.04em; font-variant-numeric: tabular-nums; min-width: 1.4ch; text-align: right; }

/* ---------- Nuova pubblicazione ---------- */
.new-post { padding: 1.6rem; }
.new-post .page-title { margin-bottom: 1.4rem; }
.new-post-grid { display: grid; grid-template-columns: 196px 1fr; gap: 1.6rem; margin-bottom: .4rem; }
.upload-preview { margin-bottom: .8rem; }
.upload-preview img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px 6px 6px 3px; box-shadow: 0 18px 30px -16px rgba(23, 36, 29, .5); }
.upload-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; aspect-ratio: 2 / 3; padding: 1rem;
  border: 1.5px dashed var(--rule-strong); border-radius: var(--r);
  background: var(--sage-2); color: var(--ink-2);
  font-size: .9rem; text-align: center; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.upload-empty:hover { border-color: var(--forest); color: var(--forest); }
.shortlist-pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: -.4rem 0 1rem; }
.shortlist-pick:empty { display: none; }

/* Suggerimenti dal catalogo sotto il titolo */
.suggest-wrap { position: relative; }
.field-suggest > label > span { font-size: .86rem; font-weight: 650; }
.field-hint { text-align: left; margin-top: .1rem; }
.book-suggest {
  position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 360px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--overlay-shadow);
}
.book-option {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  padding: .45rem .5rem; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left;
}
.book-option:hover, .book-option:focus-visible { background: var(--sage-2); }
.book-option img, .book-thumb-empty { width: 34px; height: 50px; object-fit: cover; border-radius: 2px 3px 3px 2px; flex-shrink: 0; background: var(--sage); }
.book-option-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.book-option-text .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-suggest-note { margin: 0; padding: .55rem .6rem; font-size: .84rem; color: var(--ink-2); }

/* ---------- Profilo ---------- */
.profile { display: flex; gap: 1.5rem; padding: 1.6rem; align-items: center; }
.profile-info { flex: 1; min-width: 0; }
.profile-info h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.035em; }
.profile-info > .muted { margin: .1rem 0 .8rem; }
.stats { list-style: none; display: flex; gap: 1.4rem; padding: 0; margin: 0 0 .9rem; }
.stats li { color: var(--ink-2); font-size: .9rem; }
.stats strong { display: block; font-size: 1.35rem; font-weight: 800; color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bio { margin: 0 0 1rem; white-space: pre-line; }
.profile-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.affinity { padding: 1.1rem 1.25rem; border-left: 3px solid var(--forest); }
.affinity h2 { display: flex; align-items: center; gap: .45rem; margin: 0 0 .5rem; font-size: 1.05rem; }
.affinity h2 .icon { color: var(--forest); }
.affinity p { margin: .2rem 0; }

/* Libreria: le copertine come su uno scaffale */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 24px 18px; }
.shelf-item { position: relative; display: block; transition: transform .25s var(--ease-out); }
.shelf-item:hover { transform: translateY(-4px); }
.shelf-item img, .shelf-item .cover-gen {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 2px 5px 5px 2px;
  box-shadow: 0 1px 1px rgba(23, 36, 29, .2), 0 14px 22px -14px rgba(23, 36, 29, .55);
}
.shelf-item .cover-gen { padding: .8rem; }
.shelf-item .cover-gen-title { font-size: 1rem; }
.shelf-item .cover-gen-author { font-size: .74rem; }
.shelf-rating {
  position: absolute; top: -1px; right: 10px;
  width: 30px; padding: 5px 0 11px; text-align: center;
  background: var(--amber); color: var(--amber-ink);
  font-size: .8rem; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 6px), 0 100%);
}
.profile-market { display: flex; flex-direction: column; gap: 12px; }

.edit-profile { padding: 1.6rem; display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; }
.edit-profile .field, .edit-profile .form-actions { width: 100%; }

/* Impostazioni */
.settings-block { padding: 1.3rem 1.4rem; }
.settings-block h2 { font-size: 1.1rem; margin: 0 0 .7rem; }
.settings-block > p { margin: 0 0 1rem; }
.settings-actions { justify-content: flex-start; }
.danger-zone h2 { color: var(--danger); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-row { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.plain-list.card .plain-row { padding: .7rem 1rem; }
.plain-row:last-child { border-bottom: 0; }

/* ---------- Lettori ---------- */
.search { border-radius: 8px; }
.readers { list-style: none; padding: 0; margin: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.reader { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border: 0; border-radius: 0; border-bottom: 1px solid var(--rule); }
.reader:last-child { border-bottom: 0; }
.reader:hover { background: var(--sage-2); }
.reader-info { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }

/* ---------- Affinità (colonna destra) ---------- */
.matches-box h3 { margin-bottom: .4rem; }
.match { display: flex; align-items: center; gap: .65rem; padding: .5rem 0; }
.match + .match { border-top: 1px solid var(--rule); }
.match-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }

/* ---------- Comunità ---------- */
.communities { list-style: none; padding: 0; margin: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.community-row { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; border: 0; border-radius: 0; border-bottom: 1px solid var(--rule); }
.community-row:last-child { border-bottom: 0; }
.community-row:hover { background: var(--sage-2); }
.community-info { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.community-desc { font-size: .92rem; margin-top: .15rem; color: var(--ink-2); }
.emblem {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: var(--r); font-weight: 800; letter-spacing: -.03em; color: #FBFCFA;
  background: var(--tone-forest);
}
.emblem-premio { background: var(--tone-amber); color: #1B1204; }
.emblem-autore { background: var(--tone-night); }
.emblem-genere { background: var(--tone-forest); }
.emblem-libro { background: var(--tone-clay); }
.emblem-altro { background: var(--tone-ink); }
.create-community { padding: 1.4rem; }
.name-status { margin: .2rem 0 0; font-size: .88rem; }
.name-status.free { color: var(--forest); }
.name-status.taken { color: var(--danger); }
.name-status a { text-decoration: underline; }
.community-head { display: flex; gap: 1.4rem; padding: 1.6rem; align-items: center; }
.community-head h1 { margin: .3rem 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.035em; }
.community-head > .more-menu { align-self: flex-start; }
.kind-tag { display: inline-flex; font-size: .78rem; font-weight: 700; color: var(--forest); background: var(--forest-soft); padding: .12rem .5rem; border-radius: 4px; }
.panel { padding: 1.2rem 1.3rem; }
.panel .section-title { margin: 0 0 .7rem; }
.shortlist { margin: 0; padding: 0; list-style: none; counter-reset: sl; }
.shortlist li { counter-increment: sl; display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); }
.shortlist li:last-child { border-bottom: 0; }
.shortlist li::before { content: counter(sl); flex-shrink: 0; width: 1.5rem; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.shortlist li > span { margin-right: auto; }
.add-book { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }
.add-book input { flex: 1 1 160px; }
.member-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  min-height: 32px; padding: .2rem .65rem; border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong); background: var(--surface);
  font-size: .86rem; font-weight: 550; cursor: pointer; color: inherit;
  transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--forest); color: var(--forest); }

/* ---------- Correttore ---------- */
.spell-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: -.6rem 0 1rem; font-size: .86rem; }
.spell-bar:empty { display: none; }
.comments .spell-bar { margin: .5rem 0 0; }
.spell-label { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; color: var(--ink-2); }
.spell-ok { color: var(--forest); font-weight: 600; }
.spell-issue { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding: .15rem .4rem; border-radius: var(--r-sm); background: var(--sage-2); border: 1px solid var(--rule); }
.spell-issue s { color: var(--danger); text-decoration-color: var(--danger); }
.spell-sugg { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 4px; padding: .05rem .45rem; cursor: pointer; font: inherit; font-weight: 650; }
.spell-sugg:hover { background: var(--forest); border-color: var(--forest); color: var(--forest-ink); }
.spell-ignore { border: 0; background: none; color: var(--ink-2); cursor: pointer; font: inherit; font-size: .8rem; text-decoration: underline; }
.spell-tidy { border: 1px solid var(--rule-strong); background: var(--surface); font-weight: 650; border-radius: var(--r-sm); padding: .2rem .6rem; cursor: pointer; font: inherit; }
.spell-tidy:hover { border-color: var(--forest); color: var(--forest); }

/* ---------- Gioco del Fanta ---------- */
.fanta { border-top: 3px solid var(--amber); }
.fanta-title .icon { color: var(--amber); }
.fanta h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; display: flex; align-items: baseline; gap: .6rem; }
.fanta-phase { display: inline-flex; margin: 0 0 .7rem; padding: .2rem .55rem; border-radius: 4px; font-size: .84rem; font-weight: 650; }
.phase-aperto { background: var(--forest-soft); color: var(--forest); }
.phase-chiuso { background: var(--amber-soft); }
.phase-concluso { background: var(--sage); }
.fanta-rules summary { cursor: pointer; font-weight: 650; color: var(--forest); }
.fanta-rules ol { margin: .5rem 0 0; padding-left: 1.3rem; }
.fanta-books { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fanta-books li { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--surface); }
.fanta-books li.on { border-color: var(--forest); background: var(--forest-soft); }
.fanta-pick { display: flex; align-items: center; gap: .6rem; flex: 1; cursor: pointer; min-width: 0; }
.captain-btn { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: var(--r-sm); padding: .2rem .6rem; font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.captain-btn.on { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 750; }
.fanta-results table { width: 100%; border-collapse: collapse; margin-bottom: .8rem; font-size: .94rem; }
.fanta-results th, .fanta-results td { padding: .5rem .4rem; border-bottom: 1px solid var(--rule); text-align: center; }
.fanta-results th:first-child, .fanta-results td:first-child { text-align: left; }
.fanta-board ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fanta-board li { display: flex; align-items: center; gap: .65rem; padding: .55rem .4rem; border-bottom: 1px solid var(--rule); }
.fanta-board .rank { width: 1.6rem; text-align: center; font-weight: 850; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.board-who { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.fanta-board .points { font-weight: 850; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.podium-1 .rank { color: var(--ink); }
.podium-1 .points { color: var(--ink); background: var(--amber); padding: 0 .4rem; border-radius: 4px; }

/* ---------- Chat ---------- */
.shell.is-chat { grid-template-columns: 228px minmax(0, 968px); }
.shell.is-chat .aside { display: none; }
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 60px); overflow: hidden; }
.conv-list { border-right: 1px solid var(--rule); overflow-y: auto; padding: 1.2rem .6rem; }
.conv-list .page-title { padding: 0 .6rem .8rem; font-size: 1.5rem; }
.conv-list > .muted { padding: 0 .6rem; }
.conv-list > .muted a { color: var(--forest); text-decoration: underline; }
.conv { display: flex; align-items: center; gap: .7rem; padding: .6rem .6rem; border-radius: 8px; }
.conv:hover { background: var(--sage-2); color: inherit; }
.conv.active { background: var(--sage); }
.conv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.conv-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }

.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-empty { align-items: center; justify-content: center; color: var(--ink-2); }
.thread-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .8rem .7rem 1rem; border-bottom: 1px solid var(--rule); }
.thread-who { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.thread-back { display: none; }
.thread-blocked { margin: 0; padding: 1rem; text-align: center; color: var(--ink-2); border-top: 1px solid var(--rule); background: var(--sage-2); }
.messages { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.day-sep { align-self: center; font-size: .78rem; font-weight: 650; color: var(--ink-2); margin: .9rem 0 .3rem; }
.day-sep::first-letter { text-transform: uppercase; }
.msg { position: relative; max-width: 72%; padding: .45rem .8rem .3rem; border-radius: 12px; display: flex; flex-direction: column; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { font-size: .7rem; opacity: .7; align-self: flex-end; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.msg.mine { align-self: flex-end; background: var(--forest); color: var(--forest-ink); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--sage); border-bottom-left-radius: 4px; }
.msg .more-menu { position: absolute; top: 50%; right: -40px; transform: translateY(-50%); opacity: 0; }
.msg:hover .more-menu, .msg .more-menu[open] { opacity: 1; }
.msg .more-menu summary { width: 32px; min-height: 32px; }
.composer-chat { display: flex; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--rule); align-items: flex-end; }
.composer-chat textarea { resize: none; max-height: 140px; min-height: 44px; }

/* ---------- Accesso ---------- */
.auth {
  min-height: 100vh; max-width: 1080px; margin: 0 auto; padding: 48px 24px;
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 72px;
}
.auth-hero h1 { font-size: clamp(2.1rem, 4.2vw, 3.3rem); font-weight: 800; letter-spacing: -.045em; line-height: 1.04; margin: 2.2rem 0 2rem; max-width: 15ch; }
.auth-card { padding: 2.2rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); }
.auth-card h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em; margin: 0 0 1.4rem; }
.auth-switch { text-align: center; margin: 1.1rem 0 0; color: var(--ink-2); }
.auth-forgot { margin: -.4rem 0 1rem; text-align: right; font-size: .9rem; }
.auth-text { margin: 0 0 1.1rem; color: var(--ink-2); }
.auth-single { grid-template-columns: minmax(0, 420px); justify-content: center; align-content: center; gap: 28px; }
.auth-single > .logo-svg { justify-self: center; }
.sheet-gap { margin-top: 1rem; }

/* ---------- Mercatino ---------- */
.market-filters { padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.market-filters-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.market-filters-row .select { flex: 1 1 180px; width: auto; }
.market-filters-row .market-max { flex: 0 1 140px; width: auto !important; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .92rem; font-weight: 550; cursor: pointer; white-space: nowrap; }

.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.market-empty { grid-column: 1 / -1; }
.market-card { display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s; }
.market-card:hover { color: inherit; border-color: var(--rule-strong); }
.market-photo { position: relative; aspect-ratio: 4 / 5; background: var(--sage); }
.market-photo img { width: 100%; height: 100%; object-fit: cover; }
.market-price {
  position: absolute; left: 0; bottom: 12px;
  padding: .25rem .65rem .25rem .75rem;
  background: var(--surface); color: var(--ink);
  font-size: 1.05rem; font-weight: 850; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  border-radius: 0 6px 6px 0;
}
.market-badge { position: absolute; top: 10px; right: 10px; padding: .15rem .5rem; border-radius: 4px; font-size: .76rem; font-weight: 750; }
.badge-riservato { background: var(--amber); color: var(--amber-ink); }
.badge-venduto { background: var(--ink); color: var(--paper); }
.status-venduto .market-photo img, .status-venduto .listing-photo img { filter: grayscale(.9); opacity: .65; }
.status-venduto .market-price { text-decoration: line-through; color: var(--ink-2); }
.market-card-body { display: flex; flex-direction: column; gap: .1rem; padding: .75rem .85rem .85rem; min-width: 0; }
.market-title { font-weight: 750; line-height: 1.25; letter-spacing: -.015em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.market-author { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-cond { align-self: flex-start; margin: .35rem 0 .2rem; font-size: .76rem; font-weight: 650; color: var(--forest); background: var(--forest-soft); padding: .08rem .45rem; border-radius: 4px; }
.market-meta { display: flex; align-items: center; gap: .4rem; margin-top: .25rem; min-width: 0; }
.market-meta-text, .market-city { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-city { padding-left: calc(20px + .4rem); }

.listing { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 1.6rem; padding: 1.4rem; }
.listing-photo { position: relative; align-self: start; border-radius: var(--r); overflow: hidden; background: var(--sage); }
.listing-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.listing-info { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.listing-info .kind-tag { align-self: flex-start; }
.listing-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.listing-author { margin: 0; color: var(--ink-2); font-size: 1.04rem; }
.listing-price { margin: .2rem 0; font-size: 2.1rem; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.status-venduto .listing-price { color: var(--ink-2); text-decoration: line-through; }
.listing-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--rule); }
.listing-facts div { padding: .6rem 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.listing-facts dt { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.listing-facts dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.listing-desc { margin: .3rem 0; white-space: pre-line; }
.listing-seller { display: flex; align-items: center; gap: .65rem; padding: .6rem 0; margin: .2rem 0 .4rem; }
.seller-tools { display: flex; flex-direction: column; gap: .45rem; padding-top: .8rem; border-top: 1px solid var(--rule); }
.seller-tools .section-title { margin: 0 0 .2rem; }
.segmented { display: flex; padding: 3px; gap: 3px; border-radius: 8px; background: var(--sage); }
.segmented button { flex: 1; border: 0; background: none; padding: .45rem .6rem; border-radius: 6px; font-weight: 650; font-size: .9rem; color: var(--ink-2); cursor: pointer; transition: background-color .15s, color .15s; }
.segmented button:hover { color: var(--ink); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(23, 36, 29, .12); }
.price-edit { display: flex; gap: .5rem; }
.price-edit input { flex: 1; min-width: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }

/* ---------- Menu "altro", finestre, notifiche ---------- */
.more-menu { position: relative; flex-shrink: 0; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 210px; padding: 5px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--overlay-shadow);
}
.more-item {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .65rem; border: 0; border-radius: 6px; background: none;
  font-size: .92rem; font-weight: 550; text-align: left; cursor: pointer; white-space: nowrap;
}
.more-item:hover { background: var(--sage-2); }
.more-item.danger { color: var(--danger); }

.sheet {
  width: min(440px, calc(100vw - 32px)); padding: 1.3rem 1.4rem 1.4rem;
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--overlay-shadow);
}
.sheet::backdrop { background: rgba(15, 26, 21, .45); }
.sheet[open] { animation: sheet-in .22s var(--ease-out); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.sheet-head h2 { margin: 0; font-size: 1.2rem; }
.sheet-head .btn-icon { margin-right: -.5rem; }
.sheet-text { margin: 0 0 1.1rem; color: var(--ink-2); }
.choice-list { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; }
.choice { display: flex; align-items: center; gap: .65rem; padding: .55rem .2rem; border-bottom: 1px solid var(--rule); cursor: pointer; }
.choice:last-child { border-bottom: 0; }

#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast { padding: .7rem 1rem; border-radius: var(--r); background: var(--ink); color: var(--paper); box-shadow: var(--overlay-shadow); font-size: .94rem; font-weight: 550; transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); color: var(--danger-ink); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Moderazione ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.stat { display: flex; flex-direction: column; padding: 1rem 1.1rem; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; }
.stat strong { font-size: 1.7rem; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: .84rem; color: var(--ink-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: .6rem .8rem; font-weight: 600; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--forest); }
.admin-body { display: flex; flex-direction: column; gap: 14px; }
.report { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.report-head { display: flex; align-items: center; gap: .6rem; }
.report-count { font-weight: 750; margin-right: auto; }
.report-target { display: flex; gap: .9rem; padding: .8rem; background: var(--sage-2); border-radius: var(--r); }
.report-target p { margin: 0; }
.report-thumb { width: 64px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.report-text { margin-top: .35rem !important; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.report-reasons { margin: 0; padding-left: 1.1rem; font-size: .92rem; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table th { font-size: .82rem; color: var(--ink-2); font-weight: 650; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .ok { color: var(--forest); font-weight: 600; }
.data-table .ko { color: var(--danger); }

/* ---------- Azioni sulla lettura: mi piace, da leggere ---------- */
.post-actions .btn { gap: .35rem; }
.post-actions .count { font-variant-numeric: tabular-nums; min-width: .6ch; }
.icon .fillable { fill: transparent; transition: fill .15s; }
.action-like.on, .action-save.on { color: var(--forest); }
.action-like.on .fillable, .action-save.on .fillable { fill: currentColor; }
.action-like.on .icon { animation: like-pop .32s var(--ease-out); }
@keyframes like-pop { 40% { transform: scale(1.25); } }
.post-media { user-select: none; -webkit-user-select: none; }
.like-burst {
  position: absolute; left: 50%; top: 50%; pointer-events: none;
  color: #FBFCFA; filter: drop-shadow(0 4px 12px rgba(15, 26, 21, .45));
  animation: burst .3s var(--ease-out) forwards;
}
.like-burst .fillable { fill: currentColor; }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1); opacity: 0; }
}

/* ==========================================================================
   Scheda della lettura, seconda versione (18/11/2026): media, barra azioni,
   «Piace a…», libro, recensione firmata, «altro», commenti
   ========================================================================== */
.post-head { padding: .75rem .6rem .75rem .9rem; gap: .7rem; }
.post-avatar { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--rule-strong); }
.post-name { display: flex; align-items: center; min-width: 0; }
.post-name .strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-meta { font-size: .82rem; }
.post-media {
  background: color-mix(in srgb, var(--ambient, var(--sage)) 34%, var(--surface));
  transition: background-color .25s var(--ease-out);
  border-block: 0;
  padding: 30px 0 28px;
}
.post-bar { display: flex; align-items: center; gap: 2px; padding: .35rem .45rem 0; }
.post-bar-gap { flex: 1; }
.action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
  transition: color .15s, transform .12s;
}
.action:hover { color: var(--ink-2); }
.action:active { transform: scale(.9); }
.action .icon svg { stroke-width: 1.6; }
.action-like.on { color: #E5484D; }          /* il cuore pieno è rosso: segnale universale, solo qui */
.action-save.on { color: var(--forest); }
.action-like.on .fillable, .action-save.on .fillable { fill: currentColor; }
.post-body { padding: .1rem 1rem .9rem; display: flex; flex-direction: column; gap: .35rem; }
.post-likes { margin: 0; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; }
.post-book { margin-top: .15rem; }
.post-book .book-title { font-size: 1.3rem; }
.post-book .book-title a:hover { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.post-book .book-author { margin: .05rem 0 0; font-size: .95rem; }
.post-rating { margin: .1rem 0 0; flex-wrap: wrap; }
.post-rating .genre-tag { margin: 0 0 0 .2rem; }
.post-caption { margin: .25rem 0 0; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.post-caption.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-quiet { align-self: flex-start; border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-2); font: inherit; font-size: .92rem; }
.link-quiet:hover { color: var(--ink); }
.post-extra { display: flex; flex-direction: column; }
.post-extra .post-section:first-child { margin-top: .4rem; }
.comments-link { margin-top: .15rem; }
.post .post-actions { display: none; }      /* vecchio piede: sostituito dalla barra azioni */

/* Lettura aperta: un po' più di respiro */
.page > .post .post-caption { font-size: 1.04rem; }

/* ==========================================================================
   Profilo, seconda versione: foto e numeri in alto, testo a sinistra, griglia di copertine
   (solo CSS: la struttura HTML resta quella di views/profile.js)
   ========================================================================== */
.page > .profile.card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 1.6rem; row-gap: .15rem;
  grid-template-areas: "avatar name" "avatar handle" "avatar stats" "bio bio" "chips chips" "actions actions";
  align-items: center; text-align: left;
  background: none; border: 0; padding: .4rem 0 0;
}
.page > .profile.card > .avatar { grid-area: avatar; width: 112px !important; height: 112px !important; font-size: 40px !important; align-self: start; }
.page > .profile.card .profile-info { display: contents; }
.page > .profile.card h1 { grid-area: name; display: flex; align-items: center; flex-wrap: wrap; font-size: 1.6rem; }
.page > .profile.card .profile-info > p.muted { grid-area: handle; margin: 0; }
.page > .profile.card .stats { grid-area: stats; margin: .6rem 0 0; gap: 1.6rem; }
.page > .profile.card .bio { grid-area: bio; margin: .9rem 0 0; }
.page > .profile.card .chips { grid-area: chips; margin: .7rem 0 0; }
.page > .profile.card .profile-actions { grid-area: actions; margin-top: 1rem; }
.page > .profile.card .profile-actions > .btn { flex: 1; }
.library .tabs { justify-content: center; }
.library .tabs button { flex: 1; max-width: 220px; }

/* ---------- Account ufficiale ---------- */
.official-badge {
  display: inline-flex; align-items: center; vertical-align: .15em;
  margin-left: .4rem; padding: .05rem .4rem; border-radius: 4px;
  background: var(--forest); color: var(--forest-ink);
  font-size: .68rem; font-weight: 750; letter-spacing: .01em; line-height: 1.5;
}
h1 .official-badge { font-size: .8rem; vertical-align: .35em; }
.invite-form .check { margin-bottom: 1rem; white-space: normal; }

/* ---------- Barra in alto (telefono): cerca e campanella ---------- */
.topbar-actions { margin-left: auto; display: flex; gap: 2px; }
.topbar-bell { position: relative; }
.topbar-bell .badge { position: absolute; top: 2px; right: 0; }

/* ---------- Notifiche ---------- */
.notifications { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.notifications:empty { display: none; }
.notification { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem 1rem; border-bottom: 1px solid var(--rule); }
.notifications li:last-child .notification { border-bottom: 0; }
.notification:hover { background: var(--sage-2); color: inherit; }
.notification.unread { background: var(--forest-soft); }
.notification.unread:hover { background: color-mix(in srgb, var(--forest-soft) 80%, var(--sage)); }
.notification-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; line-height: 1.4; }
.notification-text em { font-style: normal; font-weight: 650; }
.notification-quote { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Cerca ---------- */
.search-wrap { position: relative; display: block; }
.search-wrap > .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
/* più specifico della regola generale dei campi (input:not(...)), che altrimenti azzera il rientro */
.search-wrap input.search-big:not([type=range]):not([type=file]):not([type=checkbox]):not([type=radio]) { min-height: 50px; padding-left: 2.8rem; font-size: 1.05rem; }
.search-results { display: flex; flex-direction: column; gap: 24px; }
.search-section { display: flex; flex-direction: column; gap: 12px; }
.search-section .section-title { margin: 0; }
.result-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; }
.result-book { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.result-book:hover { color: inherit; }
.result-book img, .result-book .cover-gen {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 2px 5px 5px 2px;
  box-shadow: 0 1px 1px rgba(23, 36, 29, .2), 0 14px 22px -14px rgba(23, 36, 29, .55);
  transition: transform .25s var(--ease-out);
}
.result-book:hover img, .result-book:hover .cover-gen { transform: translateY(-3px); }
.result-book .cover-gen { padding: .8rem; }
.result-book .cover-gen-title { font-size: 1rem; }
.result-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.result-list { display: flex; flex-direction: column; overflow: hidden; }
.result-row { display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem; border-bottom: 1px solid var(--rule); }
.result-row:last-child { border-bottom: 0; }
.result-row:hover { background: var(--sage-2); color: inherit; }

/* ---------- Profilo: Letti / Da leggere ---------- */
.library { display: flex; flex-direction: column; gap: 18px; }
.to-read { display: flex; flex-direction: column; gap: .45rem; }
.to-read-title { font-size: .86rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.to-read-remove {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--overlay-shadow); opacity: 0; transition: opacity .15s;
}
.to-read:hover .to-read-remove, .to-read-remove:focus-visible { opacity: 1; }
@media (hover: none) { .to-read-remove { opacity: 1; } }

/* ---------- Impostazioni: tema ---------- */
.theme-switch { max-width: 420px; }
.theme-note { margin: .6rem 0 0; }

/* ==========================================================================
   Schermi medi: colonna di sole icone
   ========================================================================== */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 76px minmax(0, 640px); gap: 32px; }
  .shell.is-chat { grid-template-columns: 76px minmax(0, 968px); }
  .aside { display: none; }
  .sidebar { align-items: center; }
  .sidebar > .logo { padding: 0; }
  .logo-full { display: none; }
  .logo-compact { display: inline-flex; }
  .nav-label { display: none; }
  .nav-link { justify-content: center; padding: 0; width: 48px; }
  .nav-link.active::before { left: -14px; }
  .nav-link .badge { position: absolute; top: 3px; right: 1px; margin: 0; }
}

/* ==========================================================================
   Telefono: barra in alto con il logo, navigazione in basso
   ========================================================================== */
@media (max-width: 720px) {
  .shell, .shell.is-chat { display: block; padding: 0 16px; }
  .topbar {
    display: flex; align-items: center; position: sticky; top: 0; z-index: 10;
    margin: 0 -16px; padding: .7rem 16px; min-height: 56px;
    background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .topbar .logo-full { display: inline-flex; }
  .topbar .logo-compact { display: none; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 20; padding: 0;
    background: var(--surface); border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom);
    align-items: stretch;
  }
  .sidebar > .logo, .nav-secondary { display: none; }
  .nav-wide { display: none; }
  .nav-links { position: relative; }
  .nav-links > .nav-link:nth-child(1) { order: 1; }      /* Bacheca */
  .nav-links > .nav-link.nav-publish { order: 4; }        /* Pubblica al centro */
  .nav-links > .nav-link[data-route="#/comunita"] { order: 2; }
  .nav-links > .nav-link[data-route="#/utenti"] { order: 3; }
  .nav-links > .nav-link[data-route="#/mercatino"] { order: 5; }
  .nav-links > .nav-link[data-route="#/chat"] { order: 6; }
  .nav-links > .nav-link.nav-me { order: 7; }
  .nav-link.nav-publish .icon {
    width: 40px; height: 32px; border-radius: 10px;
    align-items: center; justify-content: center;
    background: var(--ink); color: var(--paper);
  }
  .nav-link.nav-publish.active::before { display: none; }
  .feed .post.card, .page > .post.card {
    margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0;
  }
  .feed { gap: 10px; }
  /* barra «Ultime letture» (di Alessandro) su telefono: da bordo a bordo */
  .ticker { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .ticker-label-sub { display: none; }
  /* profilo su telefono: foto 80, tre numeri accanto, griglia a tre colonne */
  .page > .profile.card {
    grid-template-areas: "avatar stats" "name name" "handle handle" "bio bio" "chips chips" "actions actions";
    column-gap: 1rem; padding: .2rem 0 0;
  }
  .page > .profile.card > .avatar { width: 84px !important; height: 84px !important; font-size: 30px !important; align-self: center; }
  .page > .profile.card h1 { font-size: 1.15rem; margin-top: .7rem; }
  .page > .profile.card .stats { margin: 0; justify-content: space-around; text-align: center; }
  .page > .profile.card .stats li { font-size: .84rem; }
  .page > .profile.card .bio { margin-top: .5rem; font-size: .95rem; }
  .library .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 -16px; }
  .library .shelf-item img, .library .shelf-item .cover-gen { border-radius: 0; box-shadow: none; }
  .library .shelf-item:hover { transform: none; }
  .library .shelf-rating { right: 6px; width: 26px; font-size: .72rem; }
  .library .to-read-title { padding: 0 .4rem .4rem; }
  .nav-links { flex-direction: row; justify-content: space-around; }
  .nav-link { width: 100%; min-height: 56px; border-radius: 0; }
  .nav-link.active { background: none; color: var(--forest); }
  .nav-link.active::before { left: 50%; top: 0; width: 20px; height: 7px; transform: translateX(-50%); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 45%, 0 100%); }
  .main { padding: 18px 0 100px; }
  .page-title { font-size: 1.65rem; }

  .post-head { padding: .8rem .5rem .8rem .9rem; }
  .post-body { padding: 1rem 1rem .2rem; }
  .post-cover, .post-media .cover-gen { width: 180px; }
  .bookmark { right: 14px; width: 42px; }
  .bookmark strong { font-size: 1.25rem; }
  .comments { padding: .4rem .9rem 1rem; }

  .new-post { padding: 1.2rem; }
  .new-post-grid { grid-template-columns: 1fr; }
  .upload-preview { max-width: 170px; margin: 0 auto .8rem; }
  .profile, .community-head { flex-direction: column; align-items: center; text-align: center; padding: 1.3rem; }
  .stats, .profile-actions { justify-content: center; }
  .community-head > .more-menu { align-self: flex-end; margin-top: -3.4rem; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 12px; }
  .page-head { flex-direction: column; }

  .chat { grid-template-columns: 1fr; height: calc(100dvh - 56px - 56px - 36px); }
  .chat.has-thread .conv-list { display: none; }
  .chat:not(.has-thread) .thread { display: none; }
  .thread-back { display: inline-flex; }
  .msg { max-width: 82%; }
  .msg .more-menu { position: static; transform: none; opacity: 1; align-self: flex-end; margin-top: -.2rem; }
  .msg .more-menu summary { width: 24px; min-height: 20px; }

  .auth { grid-template-columns: 1fr; gap: 32px; padding: 32px 16px; min-height: auto; }
  .auth-hero h1 { margin: 1.6rem 0 1.4rem; }
  .auth-card { padding: 1.5rem; }

  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .market-card-body { padding: .6rem .7rem .7rem; }
  .market-price { font-size: .95rem; bottom: 8px; }
  .listing { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; }
  .listing-photo { max-width: 260px; justify-self: center; width: 100%; }
  .field-pair { grid-template-columns: 1fr; }
  .market-filters-row .select, .market-filters-row .market-max { flex: 1 1 140px; }

  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .sheet { margin: auto auto 0; width: 100%; max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   Barra scorrevole delle ultime letture (in cima alla bacheca)
   ========================================================================== */
.ticker { display: flex; flex-direction: column; gap: .35rem; padding: .7rem 0 .6rem; overflow: hidden; }
.ticker-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: 0 .9rem; min-height: 32px; }
.ticker-label { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .6rem; }
.ticker-label strong { font-size: .92rem; }
.ticker-label-sub { font-size: .76rem; color: var(--ink-2); }
.ticker-toggle { flex: none; margin-right: -.4rem; }
.ticker-toggle[hidden] { display: none; }
.ticker-viewport { min-width: 0; overflow: hidden; }
.ticker-track { display: flex; width: max-content; }
.ticker-list { display: flex; gap: .35rem; padding: 0 .55rem; }
.ticker-copy { display: none; }
.ticker.is-scrolling .ticker-copy { display: flex; }
.ticker.is-scrolling .ticker-track { animation: ticker-scroll var(--ticker-duration, 40s) linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track, .ticker.is-paused .ticker-track { animation-play-state: paused; }
/* Cerchio: foto della lettura, nome di chi l'ha pubblicata sotto */
.ticker-item {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  width: 76px; padding: .25rem 0; color: inherit; border-radius: var(--r-sm);
}
.ticker-item:hover { color: inherit; }
.ticker-ring {
  display: block; width: 64px; height: 64px; padding: 2px; border-radius: 50%;
  border: 2px solid var(--rule); background: var(--paper, transparent);
}
.ticker-item.is-match .ticker-ring { border-color: var(--forest); }
.ticker-item:hover .ticker-ring { border-color: var(--ink-2); }
.ticker-item.is-match:hover .ticker-ring { border-color: var(--forest); }
.ticker-photo { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--sage); }
.ticker-photo-empty { display: grid; place-items: center; overflow: hidden; }
.ticker-photo-empty .avatar { width: 100%; height: 100%; }
.ticker-name {
  max-width: 100%; font-size: .76rem; font-weight: 600; line-height: 1.2; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticker-item.is-match .ticker-name { color: var(--forest); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
/* Lo scorrimento è stato chiesto esplicitamente dal proprietario: con "riduci movimento"
   resta, ma più lento; si ferma col pulsante, passandoci sopra o col fuoco. */
@media (prefers-reduced-motion: reduce) {
  /* vince sulla regola generale che toglie ogni animazione */
  .ticker.is-scrolling .ticker-track { animation: ticker-scroll calc(var(--ticker-duration, 40s) * 1.6) linear infinite !important; }
}
@media (max-width: 720px) {
  .ticker { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .ticker-label-sub { display: none; }
}
/* Lettura aperta dalla barra: finestra più larga, la scheda senza il proprio bordo */
.sheet.sheet-post { width: min(640px, calc(100vw - 32px)); max-width: 640px; }
.sheet-post .post.card { margin: 0; border: 0; box-shadow: none; background: transparent; }

/* Annuncio del Mercatino ripubblicato in bacheca */
.market-post-body { display: flex; gap: 1.1rem; padding: .2rem 1.1rem 0; color: inherit; }
.market-post-body:hover { color: inherit; }
.market-post-photo { position: relative; flex: none; width: 150px; aspect-ratio: 3 / 4; border-radius: var(--r-sm); overflow: hidden; background: var(--sage); }
.market-post-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.market-post-info { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding-top: .2rem; }
.market-post-info .book-title { margin: .25rem 0 0; }
.market-post-info .book-author { margin: 0; }
.market-post-tag { display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start; font-size: .78rem; font-weight: 700; color: var(--forest); }
.market-post-price { margin: .4rem 0 .1rem; font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.market-post.status-venduto .market-post-photo img { filter: grayscale(1); opacity: .7; }
@media (max-width: 720px) {
  .market-post-body { padding: .1rem .9rem 0; gap: .9rem; }
  .market-post-photo { width: 110px; }
}

/* ==========================================================================
   Liquid glass e animazioni (18/11/2026)
   Il vetro si usa per ciò che sta SOPRA i contenuti (barre di navigazione, menu,
   finestre, avvisi, la scheda di accesso). Le letture restano su superfici piene:
   sotto il testo lungo il vetro stanca la vista.
   ========================================================================== */
:root {
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .84);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-line: rgba(23, 36, 29, .10);
  --glass-shadow: 0 10px 40px -14px rgba(23, 36, 29, .30), 0 2px 6px -2px rgba(23, 36, 29, .08);
  --glass-blur: blur(24px) saturate(185%);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(26, 30, 28, .56);
    --glass-strong: rgba(30, 34, 32, .80);
    --glass-edge: rgba(255, 255, 255, .10);
    --glass-line: rgba(255, 255, 255, .07);
    --glass-shadow: 0 14px 44px -12px rgba(0, 0, 0, .75), 0 2px 6px -2px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(26, 30, 28, .56);
  --glass-strong: rgba(30, 34, 32, .80);
  --glass-edge: rgba(255, 255, 255, .10);
  --glass-line: rgba(255, 255, 255, .07);
  --glass-shadow: 0 14px 44px -12px rgba(0, 0, 0, .75), 0 2px 6px -2px rgba(0, 0, 0, .5);
}

.glass,
.more-list, .sheet, .toast, .book-suggest {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.sheet { background: var(--glass-strong); }
.sheet::backdrop { background: rgba(8, 10, 9, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.toast { color: var(--ink); background: var(--glass-strong); }
.toast-error { background: color-mix(in srgb, var(--danger) 88%, transparent); color: var(--danger-ink); }
.more-item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }

/* Voce di menu attiva: una lente di vetro */
.nav-link.active {
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px var(--glass-line);
}

/* ---------- Movimento ---------- */
.btn, .action, .chip, .nav-link { transition: transform .18s var(--spring), background-color .15s, color .15s, border-color .15s, box-shadow .15s; }
.btn:active, .chip:active, .nav-link:active { transform: scale(.96); }
.feed > .post { animation: rise .28s var(--ease-out) both; }
.feed > .post:nth-child(2) { animation-delay: .04s; }
.feed > .post:nth-child(3) { animation-delay: .08s; }
.feed > .post:nth-child(4) { animation-delay: .12s; }
.feed > .post:nth-child(n+5) { animation-delay: .14s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.sheet[open] { animation: sheet-pop .26s var(--spring); }
@keyframes sheet-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.more-menu[open] .more-list { animation: menu-pop .22s var(--spring); transform-origin: top right; }
@keyframes menu-pop { from { opacity: 0; transform: scale(.92); } }
.toast { animation: toast-in .26s var(--spring); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* Passaggio tra le pagine (View Transitions: si anima solo il contenuto centrale) */
.main { view-transition-name: contenuto; }
::view-transition-old(contenuto) { animation: vt-out .14s ease-in both; }
::view-transition-new(contenuto) { animation: vt-in .24s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   Accesso e registrazione
   ========================================================================== */
.auth { position: relative; isolation: isolate; overflow: hidden; max-width: none; min-height: 100vh; padding: 48px max(24px, calc((100vw - 1080px) / 2)); }
.auth-scene { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.shape { position: absolute; display: block; will-change: transform; }
.shape-ribbon {
  width: 190px; height: 470px; right: 27%; top: -90px; background: var(--tone-forest);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.shape-dot { width: 240px; height: 240px; border-radius: 50%; right: 12%; top: 26%; background: var(--amber); animation: drift-b 18s ease-in-out infinite alternate; }
.shape-ribbon-2 {
  width: 120px; height: 300px; right: 36%; bottom: -40px; background: var(--tone-clay);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  animation: drift-c 26s ease-in-out infinite alternate;
}
.shape-page { width: 260px; height: 340px; right: 8%; bottom: -120px; border-radius: 18px; background: var(--tone-night); transform: rotate(14deg); animation: drift-d 30s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(-40px, 60px) rotate(-8deg); } }
@keyframes drift-b { to { transform: translate(-70px, -40px) scale(1.08); } }
@keyframes drift-c { to { transform: translate(50px, -70px) rotate(10deg); } }
@keyframes drift-d { to { transform: translate(-30px, -50px) rotate(4deg); } }
:root[data-theme="dark"] .shape { opacity: .62; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shape { opacity: .62; } }

.auth-hero { position: relative; }
.auth-hero h1 { margin: 2rem 0 1.6rem; }
.auth-fan { position: relative; height: 170px; margin: 0 0 1.6rem 6px; }
.auth-fan .cover-gen {
  position: absolute; top: 0; width: 112px; height: 168px; padding: .8rem;
  border-radius: 3px 7px 7px 3px; box-shadow: 0 18px 30px -16px rgba(0, 0, 0, .55);
  transform-origin: 50% 100%; animation: fan-in .9s var(--spring) both;
}
.auth-fan .cover-gen-title { font-size: .95rem; }
.auth-fan .cover-gen-author { font-size: .7rem; }
.auth-fan .cover-gen:nth-child(1) { left: 0; --r: -9deg; animation-delay: .25s; }
.auth-fan .cover-gen:nth-child(2) { left: 74px; --r: -1deg; top: -8px; z-index: 1; animation-delay: .35s; }
.auth-fan .cover-gen:nth-child(3) { left: 150px; --r: 8deg; animation-delay: .45s; }
.auth-fan .cover-gen { transform: rotate(var(--r)); }
@keyframes fan-in { from { opacity: 0; transform: translateY(30px) rotate(0deg); } }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; color: var(--ink-2); }
.auth-points b { color: var(--ink); font-weight: 800; margin-right: .35rem; font-variant-numeric: tabular-nums; }
.auth-points li::before { content: none; }
.auth-points li { padding-left: 0; }

.auth-card.glass { border-radius: 22px; padding: 1.6rem 1.6rem 1.4rem; animation: card-in .7s var(--spring) both .1s; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.auth-card h2 { margin: 1.2rem 0 .3rem; font-size: 1.55rem; }
.auth-card .auth-text { margin: 0 0 1.2rem; }
.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px;
  border-radius: 12px; background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.auth-tabs button { position: relative; z-index: 1; border: 0; background: none; padding: .55rem; border-radius: 9px; font: inherit; font-weight: 650; color: var(--ink-2); cursor: pointer; transition: color .2s; }
.auth-tabs button[aria-selected=true] { color: var(--ink); }
.auth-tabs-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), inset 0 1px 0 var(--glass-edge);
  transition: transform .42s var(--spring);
}
.auth-tabs[data-mode="register"] .auth-tabs-pill { transform: translateX(100%); }
.auth-fields { animation: fields-in .35s var(--ease-out); }
@keyframes fields-in { from { opacity: 0; transform: translateX(8px); } }
.auth-form.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-card input:not([type=checkbox]) { background: color-mix(in srgb, var(--surface) 75%, transparent); }

.field-with-action { position: relative; display: block; }
.field-with-action input { padding-right: 46px !important; }
.field-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.field-eye:hover { color: var(--ink); }
.field-prefix { position: relative; display: block; }
.field-prefix b { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 600; pointer-events: none; }
.field-prefix input { padding-left: 1.9rem !important; }
.field-hint { font-size: .8rem; color: var(--ink-2); margin-top: .1rem; }
.field-hint.ok { color: var(--forest); }
.field-hint.ko { color: var(--danger); }
.field-group { margin-bottom: 1rem; }
.field-group .field { margin-bottom: .45rem; }
.strength { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.strength i { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); transition: background-color .25s; }
.strength[data-level="1"] i:nth-child(-n+1) { background: var(--amber); }
.strength[data-level="2"] i:nth-child(-n+2) { background: var(--forest); }
.strength[data-level="3"] i { background: var(--forest); }
.btn-big { min-height: 50px; font-size: 1rem; border-radius: 12px; gap: .6rem; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-single { display: grid; place-content: center; gap: 24px; }
.auth-single > .logo-svg { justify-self: center; }
.auth-single .auth-card { width: min(420px, calc(100vw - 32px)); }

/* ==========================================================================
   Telefono: barra in alto di vetro, navigazione a pillola fluttuante
   ========================================================================== */
@media (max-width: 720px) {
  .topbar { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-bottom: 1px solid var(--glass-line); }
  .sidebar {
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 5px;
    border-radius: 28px; border: 1px solid var(--glass-line);
    background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  }
  .nav-link { min-height: 50px; border-radius: 22px; }
  .nav-link.active { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); box-shadow: none; }
  .nav-link.active::before { display: none; }
  .nav-link.nav-publish .icon { width: 44px; height: 36px; border-radius: 14px; }
  .main { padding-bottom: 120px; }
  #toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }

  .auth { padding: 28px 16px 40px; gap: 18px; }
  .auth-hero h1 { font-size: 1.9rem; margin: 1.2rem 0 1rem; }
  .auth-fan { height: 130px; transform: scale(.78); transform-origin: left top; margin-bottom: 0; }
  .auth-points { display: none; }
  .shape-ribbon { right: -30px; width: 140px; height: 340px; }
  .shape-dot { width: 170px; height: 170px; right: -40px; top: 52%; }
  .shape-ribbon-2 { right: 55%; }
  .auth-card.glass { padding: 1.3rem 1.2rem 1.2rem; }
}

/* Mercatino: pulsanti Vendi / Scambia e annunci di scambio */
.market-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.page-head .market-actions { justify-content: flex-end; }
.market-price .icon, .listing-price .icon { vertical-align: -2px; margin-right: .25rem; }
.kind-scambio .market-price { background: var(--forest, #2f6b4a); color: #fff; }
.market-wanted { margin: .25rem 0 0; }
@media (max-width: 600px) {
  .page-head .market-actions { justify-content: flex-start; }
}
