/* ===========================================================
   FONDAZIONE — interfaccia testuale animata
   =========================================================== */
:root {
  --bg: #0a0b0c;
  --bg-2: #101214;
  --panel: #14171a;
  --line: #262b30;
  --line-2: #353b42;
  --text: #ece7dc;
  --text-2: #b9b4aa;
  --muted: #7d8287;
  --accent: #e0302a;
  --accent-2: #ff5a4f;
  --amber: #f0b44c;
  --ok: #4fc483;
  --blue: #6aa8ff;
  --paper: #efe9dc;
  --paper-ink: #17150f;
  --paper-line: #cfc6b2;

  --f-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --f-stencil: "Big Shoulders Stencil Display", "Big Shoulders Display", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --f-serif: "IBM Plex Serif", Georgia, serif;

  --nav-h: 64px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---------- Effetti di sfondo ---------- */
.fx-scan, .fx-grain { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.fx-scan {
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.fx-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 120px; top: -120px;
  background: linear-gradient(to bottom, transparent, rgba(224,48,42,.05), transparent);
  animation: sweep 7s linear infinite;
}
.fx-grain {
  opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain .9s steps(4) infinite;
}
@keyframes sweep { to { transform: translateY(calc(100vh + 240px)); } }
@keyframes grain { 0%{transform:translate(0,0)} 25%{transform:translate(-8px,6px)} 50%{transform:translate(6px,-4px)} 75%{transform:translate(-4px,-8px)} }

/* ---------- Boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 200; background: #050606;
  display: grid; place-items: center; padding: 24px; cursor: pointer;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
#boot.done { opacity: 0; transform: scale(1.04); pointer-events: none; }
#boot[hidden] { display: none !important; }
[hidden] { display: none !important; }
.boot-inner { width: min(560px, 100%); }
.boot-mark {
  font-family: var(--f-stencil); font-weight: 900; font-size: clamp(48px, 16vw, 96px);
  letter-spacing: .04em; line-height: .9; color: var(--text);
  animation: flicker 1.6s steps(1) 1;
}
#boot-log { margin-top: 20px; font-size: 13px; color: var(--ok); min-height: 140px; }
#boot-log div::before { content: "> "; color: var(--muted); }
#boot-log div:last-child::after { content: "▌"; animation: blink 1s steps(1) infinite; }
.boot-skip { margin-top: 18px; font-size: 11px; color: var(--muted); letter-spacing: .2em; text-transform: uppercase; }
@keyframes flicker { 0%{opacity:0} 10%{opacity:1} 14%{opacity:.2} 18%{opacity:1} 40%{opacity:.6} 44%{opacity:1} }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Shell ---------- */
#shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  padding: calc(10px + var(--safe-t)) 16px 0;
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(10,11,12,.85));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.logo {
  font-family: var(--f-stencil); font-weight: 900; font-size: 26px; letter-spacing: .06em;
  line-height: 1; position: relative;
}
.logo::after { content: "▌"; color: var(--accent); margin-left: 2px; animation: blink 1.1s steps(1) infinite; font-family: var(--f-mono); font-size: 18px; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(79,196,131,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(79,196,131,0); } 100% { box-shadow: 0 0 0 0 rgba(79,196,131,0); } }
#clock { font-variant-numeric: tabular-nums; color: var(--text-2); }

.ticker { overflow: hidden; border-top: 1px solid var(--line); margin: 0 -16px; white-space: nowrap; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.ticker-track { display: inline-block; padding: 5px 0; animation: ticker 40s linear infinite; }
.ticker-track span { margin: 0 18px; }
.ticker-track b { color: var(--accent-2); font-weight: 600; }
@keyframes ticker { to { transform: translateX(-50%); } }

.layout { flex: 1; display: flex; width: 100%; max-width: 1100px; margin: 0 auto; }
main#view { flex: 1; min-width: 0; padding: 20px 16px calc(var(--nav-h) + 40px + var(--safe-b)); }

/* ---------- Navigazione ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(10,11,12,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.nav a {
  position: relative; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  transition: color .25s;
}
.nav a .ico { font-size: 18px; line-height: 1; transition: transform .35s var(--ease); }
.nav a::before {
  content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 2px; background: var(--accent);
  transform: scaleX(0); transition: transform .4s var(--ease);
}
.nav a.active { color: var(--text); }
.nav a.active::before { transform: scaleX(1); }
.nav a.active .ico { transform: translateY(-2px) scale(1.12); color: var(--accent-2); }
.nav .badge-dot { position: absolute; top: 12px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: none; }
.nav .badge-dot.on { display: block; animation: pulse 1.8s infinite; }

@media (min-width: 860px) {
  .nav {
    position: sticky; top: 92px; align-self: flex-start; width: 210px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 20px 0 0 16px; backdrop-filter: none;
  }
  .nav a { height: auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; font-size: 13px; letter-spacing: .12em; border-left: 1px solid var(--line); }
  .nav a::before { top: 0; bottom: 0; left: -1px; right: auto; width: 2px; height: auto; transform: scaleY(0); }
  .nav a.active::before { transform: scaleY(1); }
  .nav a:hover { color: var(--text); background: linear-gradient(90deg, rgba(224,48,42,.08), transparent); }
  .nav .badge-dot { position: static; }
  main#view { padding: 28px 28px 60px; }
}

/* ---------- Transizioni di pagina ---------- */
#view.enter > * { animation: rise .6s var(--ease) both; }
#view.enter > *:nth-child(2) { animation-delay: .06s; }
#view.enter > *:nth-child(3) { animation-delay: .12s; }
#view.enter > *:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.stagger > * { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* ---------- Tipografia ---------- */
.page-head { margin-bottom: 22px; }
.kicker { margin: 0 0 4px; font-size: 11px; letter-spacing: .28em; color: var(--accent-2); text-transform: uppercase; }
.kicker::before { content: "■ "; animation: blink 2s steps(1) infinite; }
h1, .h1 {
  font-family: var(--f-display); font-weight: 900; text-transform: uppercase;
  font-size: clamp(40px, 11vw, 84px); line-height: .88; letter-spacing: .01em; margin: 0; overflow-wrap: anywhere;
}
h2 { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 26px; line-height: 1; margin: 0 0 10px; }
.lede { color: var(--text-2); margin: 10px 0 0; max-width: 60ch; }
strong { color: #fff; font-weight: 700; }
mark {
  color: var(--paper-ink); background: linear-gradient(var(--amber), var(--amber)) no-repeat 0 0 / 0% 100%;
  animation: markin .9s .3s var(--ease) forwards; padding: 0 3px; border-radius: 2px; color: inherit;
}
@keyframes markin { to { background-size: 100% 100%; color: var(--paper-ink); } }
.redact {
  background: var(--text); color: transparent; border-radius: 1px; cursor: pointer; padding: 0 2px;
  transition: background .4s var(--ease), color .4s var(--ease); user-select: none;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.redact:hover { background: var(--accent); }
.redact.open { background: rgba(224,48,42,.16); color: var(--accent-2); user-select: text; }
.mention { color: var(--blue); font-weight: 600; }
.scp-ref { color: var(--accent-2); font-weight: 700; letter-spacing: .02em; }

/* ---------- Componenti ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel); padding: 10px 16px; border-radius: 2px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
  transition: border-color .25s, color .25s, transform .15s;
}
.btn::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform .6s var(--ease);
}
.btn:hover::after { transform: translateX(100%); }
.btn:hover { border-color: var(--text-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px; padding: 12px 13px;
  font-size: 16px; line-height: 1.5; outline: none; transition: border-color .25s, box-shadow .25s;
}
textarea.input { resize: vertical; min-height: 110px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224,48,42,.18); }

.card { background: var(--panel); border: 1px solid var(--line); padding: 16px; border-radius: 2px; }

.composer { border: 1px solid var(--line); background: var(--bg-2); margin-bottom: 22px; position: relative; transition: border-color .3s; }
.composer:focus-within { border-color: var(--line-2); }
.composer::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .45s var(--ease); }
.composer:focus-within::before { transform: scaleY(1); }
.composer textarea { display: block; width: 100%; border: 0; background: transparent; padding: 14px 16px; font-size: 17px; line-height: 1.55; outline: none; resize: none; min-height: 84px; font-family: var(--f-mono); }
.composer-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px 16px; border-top: 1px dashed var(--line); }
.composer-bar .hint { font-size: 11px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-bar .count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.composer-bar .count.warn { color: var(--amber); }

/* ---------- Post ---------- */
.list { display: flex; flex-direction: column; }
.post {
  position: relative; padding: 18px 0 14px; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
}
.post.fresh { animation: fresh 1.4s var(--ease); }
@keyframes fresh { 0% { background: rgba(224,48,42,.18); transform: translateY(-8px); opacity: 0; } 30% { opacity: 1; transform: none; } 100% { background: transparent; } }
.post.gone { animation: gone .45s var(--ease) forwards; }
@keyframes gone { to { opacity: 0; transform: translateX(30px); filter: blur(4px); } }
.post-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--f-stencil); font-weight: 900; font-size: 19px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--accent-2);
}
.who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handle { font-size: 12px; color: var(--muted); }
.post-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.lvl { font-size: 10px; font-weight: 700; letter-spacing: .1em; padding: 1px 6px; border: 1px solid var(--line-2); color: var(--amber); }
.post-body {
  grid-column: 1 / -1; margin-top: 10px; font-size: 17px; line-height: 1.6; color: var(--text);
  overflow-wrap: anywhere;
}
.post.big .post-body { font-size: 21px; line-height: 1.5; }
.post-actions { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 10px; }
.act {
  background: none; border: 1px solid transparent; padding: 4px 10px; font-size: 13px; color: var(--muted); cursor: pointer;
  border-radius: 2px; transition: color .2s, border-color .2s;
}
.act:hover { color: var(--text); border-color: var(--line-2); }
.act.on { color: var(--accent-2); }
.act.pop { animation: pop .4s var(--ease); }
@keyframes pop { 40% { transform: scale(1.3); } }
.act.del { margin-left: auto; }
.act.del:hover { color: var(--accent-2); }

.thread-line { margin: 4px 0 0 16px; padding-left: 16px; border-left: 1px solid var(--line-2); }

/* ---------- Archivio ---------- */
.searchbar { display: flex; gap: 10px; margin-bottom: 18px; }
.searchbar .input { flex: 1; }
.doc-row {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "num cls" "title title";
  gap: 4px 12px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line);
  transition: padding .35s var(--ease), background .35s;
  position: relative;
}
.doc-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); transform: scaleY(0); transition: transform .35s var(--ease); }
.doc-row:hover { padding-left: 14px; background: linear-gradient(90deg, rgba(224,48,42,.06), transparent); }
.doc-row:hover::before { transform: scaleY(1); }
.doc-num { grid-area: num; font-family: var(--f-display); font-weight: 900; font-size: 30px; line-height: 1; letter-spacing: .02em; }
.doc-title { grid-area: title; color: var(--text-2); font-size: 14px; }
.doc-row .right { grid-area: cls; justify-self: end; display: flex; gap: 8px; align-items: center; }

.cls {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid currentColor;
}
.cls-safe { color: var(--ok); }
.cls-euclid { color: var(--amber); }
.cls-keter { color: var(--accent-2); animation: keter 2.4s infinite; }
.cls-thaumiel { color: var(--blue); }
.cls-neutralizzato { color: var(--muted); }
.cls-apollyon { color: #fff; background: var(--accent); border-color: var(--accent); animation: keter 1.2s infinite; }
.cls-archon { color: #c79bff; }
.cls-esoterica { color: #9fe0d8; }
@keyframes keter { 50% { box-shadow: 0 0 14px rgba(255,90,79,.45); } }

/* ---------- Dossier ---------- */
.access {
  border: 1px solid var(--line-2); padding: 26px 20px; text-align: left; font-size: 13px; color: var(--ok);
  min-height: 180px;
}
.access div::before { content: "> "; color: var(--muted); }
.access .deny { color: var(--accent-2); }
.access .grant { color: #fff; background: var(--ok); color: #04130a; display: inline-block; padding: 2px 8px; margin-top: 8px; font-weight: 700; letter-spacing: .2em; animation: flicker .8s steps(1); }
.access .grant::before { content: ""; }

.dossier {
  background: var(--paper); color: var(--paper-ink); padding: 22px 18px 28px; position: relative;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); border-radius: 2px;
  animation: unfold .8s var(--ease) both;
  transform-origin: top;
}
@keyframes unfold { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.dossier::before {
  content: "RISERVATO"; position: absolute; right: 14px; top: 70px; transform: rotate(-12deg);
  font-family: var(--f-stencil); font-size: 34px; font-weight: 900; letter-spacing: .1em; color: rgba(224,48,42,.0);
  border: 4px solid rgba(224,48,42,0); padding: 2px 10px;
  animation: stamp .5s 1s var(--ease) forwards;
}
@keyframes stamp { from { transform: rotate(-12deg) scale(2.2); } to { transform: rotate(-12deg) scale(1); color: rgba(224,48,42,.75); border-color: rgba(224,48,42,.75); } }
.dossier-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; border-bottom: 2px solid var(--paper-ink); padding-bottom: 10px; }
.dossier .label { display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: #6a6252; }
.dossier-id { margin-top: 20px; }
.dossier-id h1 { font-size: clamp(56px, 18vw, 110px); color: var(--paper-ink); }
.doc-titleline { font-family: var(--f-serif); font-style: italic; font-size: 19px; margin: 6px 0 18px; }
.dossier-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; padding: 14px 0; border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); margin-bottom: 8px; }
.dossier-meta .cls-keter, .dossier-meta .cls-euclid, .dossier-meta .cls-safe { font-size: 12px; }
.dossier .cls-safe { color: #1d7a47; } .dossier .cls-euclid { color: #a06a00; } .dossier .cls-keter { color: #b51f19; }
.dossier .cls-thaumiel { color: #1f5bb5; } .dossier .cls-archon { color: #6a3cb0; } .dossier .cls-esoterica { color: #1f7a72; }
.dossier section { margin-top: 24px; opacity: 0; animation: rise .6s var(--ease) forwards; }
.dossier section:nth-of-type(1) { animation-delay: .5s; }
.dossier section:nth-of-type(2) { animation-delay: .7s; }
.dossier section:nth-of-type(3) { animation-delay: .9s; }
.dossier h2 { font-size: 22px; color: var(--paper-ink); border-left: 4px solid var(--accent); padding-left: 10px; }
.prose { font-family: var(--f-serif); font-size: 18px; line-height: 1.72; overflow-wrap: anywhere; }
.dossier strong { color: #000; }
.dossier .redact { background: var(--paper-ink); }
.dossier .redact:hover { background: #3a3630; }
.dossier .redact.open { background: rgba(224,48,42,.14); color: #b51f19; }
.dossier mark { color: var(--paper-ink); }
.dossier-actions { display: flex; gap: 10px; margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--paper-line); }
.dossier .btn { background: transparent; border-color: #b8ae97; color: var(--paper-ink); }

/* ---------- Chat / Sale ---------- */
.room-card, .group-card {
  display: block; padding: 18px 4px; border-bottom: 1px solid var(--line); position: relative; transition: padding .35s var(--ease);
}
.room-card:hover, .group-card:hover { padding-left: 14px; }
.room-card .name, .group-card .name { font-family: var(--f-display); font-weight: 900; font-size: 30px; line-height: 1; text-transform: uppercase; }
.room-card .name::before { content: "#"; color: var(--accent); margin-right: 4px; }
.room-card p, .group-card p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.group-card .row { margin-top: 10px; font-size: 12px; color: var(--muted); }

.chat { display: flex; flex-direction: column; min-height: calc(100vh - 260px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; }
.msg { padding: 7px 0; font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; animation: rise .4s var(--ease) both; }
.msg .t { color: var(--muted); font-size: 11px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.msg .u { color: var(--amber); font-weight: 700; margin-right: 6px; }
.msg .u::after { content: " ›"; color: var(--muted); font-weight: 400; }
.msg.mine .u { color: var(--accent-2); }
.chat-input {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); display: flex; gap: 8px;
  padding: 10px 0; background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.chat-input .input { flex: 1; }
@media (min-width: 860px) { .chat-input { bottom: 0; } }

.bubble-log { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.bubble { max-width: 82%; padding: 10px 14px; border: 1px solid var(--line); background: var(--panel); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; animation: rise .4s var(--ease) both; }
.bubble.mine { align-self: flex-end; border-color: rgba(224,48,42,.5); background: rgba(224,48,42,.1); }
.bubble time { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.inbox-row { display: flex; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); transition: padding .35s var(--ease); }
.inbox-row:hover { padding-left: 12px; }
.inbox-row .who { flex: 1; }
.inbox-row .preview { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.inbox-row time { font-size: 11px; color: var(--muted); }

/* ---------- Profilo ---------- */
.profile-head { border: 1px solid var(--line); padding: 20px; position: relative; overflow: hidden; margin-bottom: 20px; }
.profile-head::after { content: attr(data-lvl); position: absolute; right: -6px; bottom: -28px; font-family: var(--f-stencil); font-weight: 900; font-size: 150px; line-height: 1; color: rgba(255,255,255,.04); }
.profile-head .bio { font-size: 17px; margin: 14px 0 0; max-width: 55ch; }
.stats { display: flex; gap: 22px; margin-top: 16px; font-size: 12px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.stats b { display: block; font-family: var(--f-display); font-size: 32px; color: var(--text); line-height: 1; letter-spacing: 0; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px calc(30px + var(--safe-b)); }
.auth-box { width: 100%; max-width: 440px; min-width: 0; }
.auth h1 { font-family: var(--f-stencil); font-size: clamp(40px, 13vw, 110px); overflow-wrap: normal; }
.auth .lede { margin-bottom: 26px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin-bottom: 20px; position: relative; }
.tabs button { background: none; border: 0; padding: 12px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); cursor: pointer; position: relative; z-index: 1; transition: color .3s; }
.tabs button.on { color: #fff; }
.tabs .slider { position: absolute; top: 0; bottom: 0; left: 0; width: 50%; background: var(--accent); transition: transform .45s var(--ease); }
.tabs.second .slider { transform: translateX(100%); }
.auth .fine { font-size: 11px; color: var(--muted); margin-top: 18px; line-height: 1.6; }

/* ---------- Varie ---------- */
.empty { padding: 40px 10px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); }
.loading { padding: 30px 0; color: var(--muted); font-size: 13px; letter-spacing: .14em; }
.loading::after { content: "▌"; animation: blink 1s steps(1) infinite; margin-left: 4px; }
.back { display: inline-block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.back:hover { color: var(--text); }
.section-title { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin: 28px 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.locked { text-align: center; padding: 40px 16px; border: 1px solid var(--line); }
.locked .big { font-family: var(--f-stencil); font-size: 64px; line-height: 1; color: var(--accent); animation: flicker 2s infinite steps(1); }
.footer { padding: 30px 16px calc(var(--nav-h) + 30px + var(--safe-b)); font-size: 11px; color: var(--muted); max-width: 1100px; margin: 0 auto; width: 100%; border-top: 1px solid var(--line); line-height: 1.7; }
.footer a { text-decoration: underline; }
@media (min-width: 860px) { .footer { padding-bottom: 30px; } }
details.help { font-size: 12px; color: var(--muted); margin: -6px 0 16px; }
details.help summary { cursor: pointer; letter-spacing: .12em; text-transform: uppercase; }
details.help code { color: var(--text-2); }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-t)); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--ok); padding: 12px 14px; font-size: 13px; animation: rise .4s var(--ease); transition: opacity .5s, transform .5s; }
.toast.err { border-left-color: var(--accent); }
.toast.out { opacity: 0; transform: translateY(-10px); }

.setup { max-width: 560px; margin: 0 auto; padding: 60px 18px; }
.setup code { color: var(--amber); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .fx-grain, .fx-scan::after { display: none; }
}
