/* ==========================================================================
   Biblioteca dei Sussurri — stili
   Palette: inchiostro caldo, candela, cera, sangue. Font: Alegreya.
   ========================================================================== */

@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Alegreya'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/alegreya-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: italic; font-weight: 500; font-display: swap; src: url('../fonts/alegreya-latin-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/alegreya-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: italic; font-weight: 600; font-display: swap; src: url('../fonts/alegreya-latin-600-italic.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/alegreya-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: italic; font-weight: 700; font-display: swap; src: url('../fonts/alegreya-latin-700-italic.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Ext'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-latin-ext-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Ext'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-latin-ext-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Ext'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/alegreya-latin-ext-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/alegreya-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/alegreya-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya SC'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/alegreya-sc-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya SC'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/alegreya-sc-latin-700-normal.woff2') format('woff2'); }

:root {
  --ink: #0c0905;
  --soot: #16100a;
  --umber: #2a1b10;
  --leather: #3b2617;
  --candle: #e2a845;
  --candle-hi: #ffd98a;
  --wax: #f1e3c4;
  --parchment: #e8d9b8;
  --ash: #8c8073;
  --ash-dim: #5c534a;
  --blood: #8f1d22;
  --blood-hi: #c8363c;
  --moss: #5f8a6a;
  --serif: 'Alegreya', 'Alegreya Ext', Georgia, 'Times New Roman', serif;
  --sans: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --sc: 'Alegreya SC', 'Alegreya', serif;
  --radius: 6px;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease-back: cubic-bezier(.34,1.56,.64,1);
  --glow: 0 0 24px rgba(226,168,69,.25), 0 0 64px rgba(226,168,69,.12);
  --shadow-deep: 0 30px 60px -20px rgba(0,0,0,.9), 0 10px 20px -8px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html { background: var(--ink); color: var(--wax); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--sans); font-size: 17px; line-height: 1.5;
  background: radial-gradient(1200px 700px at 50% -10%, #2a1a0c 0%, transparent 60%),
              radial-gradient(900px 500px at 50% 110%, #1b120a 0%, transparent 60%), var(--ink);
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--candle); text-decoration: none; }
::selection { background: rgba(226,168,69,.35); }
:focus-visible { outline: 2px solid var(--candle); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* grain + vignette on everything -------------------------------------------- */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}
body::after {
  content: ''; position: fixed; inset: -50%; pointer-events: none; z-index: 1; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 20%{transform:translate(-3%,2%)} 40%{transform:translate(2%,-3%)} 60%{transform:translate(-1%,4%)} 80%{transform:translate(3%,1%)} 100%{transform:translate(0,0)} }

#motes { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#cursor-glow {
  position: fixed; left: 0; top: 0; width: 360px; height: 360px; margin: -180px 0 0 -180px; pointer-events: none; z-index: 2;
  background: radial-gradient(circle, rgba(226,168,69,.10) 0%, rgba(226,168,69,.03) 35%, transparent 65%);
  opacity: 0; transition: opacity .6s;
}
@media (hover: none) { #cursor-glow { display: none; } }

/* intro ----------------------------------------------------------------------- */
#intro {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; text-align: center;
  background: var(--ink);
}
#intro .door {
  position: absolute; top: 0; bottom: 0; width: 50.5%; background: linear-gradient(90deg, #1a110a, #241710 50%, #1a110a);
  box-shadow: inset 0 0 120px rgba(0,0,0,.8);
}
#intro .door::after { content:''; position:absolute; inset: 6% 8%; border: 2px solid rgba(226,168,69,.12); border-radius: 2px; }
#intro .door.left { left: 0; transform-origin: left center; }
#intro .door.right { right: 0; transform-origin: right center; }
#intro .intro-inner { position: relative; z-index: 2; padding: 24px; max-width: 640px; }
#intro .flame { width: 18px; height: 34px; margin: 0 auto 22px; border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 80%, #fff6d8 0%, var(--candle-hi) 30%, #e0862b 65%, transparent 72%);
  filter: blur(.4px) drop-shadow(0 0 18px rgba(226,168,69,.8)); animation: flame .9s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scaleX(.92) scaleY(1) rotate(-2deg) } to { transform: scaleX(1.06) scaleY(1.08) rotate(2deg) } }
#intro h1 { font-size: clamp(38px, 7vw, 72px); font-weight: 400; font-style: italic; letter-spacing: -.01em; color: var(--wax); }
#intro h1 .w { display: inline-block; opacity: 0; transform: translateY(14px); }
#intro p { color: var(--ash); font-family: var(--serif); font-size: 20px; margin: 14px 0 30px; opacity: 0; }
#intro .btn { opacity: 0; }
#intro .small { font-size: 14px; color: var(--ash-dim); margin-top: 18px; opacity: 0; }

/* top bar --------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(12,9,5,.92), rgba(12,9,5,.72));
  border-bottom: 1px solid rgba(226,168,69,.12);
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--wax); white-space: nowrap; }
.brand .candle { width: 10px; height: 10px; border-radius: 50%; background: var(--candle-hi); box-shadow: 0 0 12px 4px rgba(226,168,69,.55); animation: candle 1.6s ease-in-out infinite alternate; }
@keyframes candle { from { box-shadow: 0 0 10px 3px rgba(226,168,69,.45) } to { box-shadow: 0 0 16px 6px rgba(226,168,69,.75) } }
.nav { display: flex; gap: 4px; margin: 0 auto; }
.nav a {
  position: relative; padding: 8px 14px; color: var(--ash); font-family: var(--sans); font-weight: 500; font-size: 16px; border-radius: var(--radius);
  transition: color .25s;
}
.nav a::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px; background: var(--candle); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease-out); box-shadow: 0 0 8px var(--candle); }
.nav a:hover, .nav a.active { color: var(--wax); }
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }
.nav a.dark-link { color: #c99; }
.nav a.dark-link::after { background: var(--blood-hi); box-shadow: 0 0 8px var(--blood-hi); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ash); transition: color .2s, background .2s, transform .2s; }
.icon-btn:hover { color: var(--wax); background: rgba(255,255,255,.05); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.muted { color: var(--ash-dim); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 30px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); color: var(--wax); font-size: 15px; transition: background .2s; }
.user-chip:hover { background: rgba(255,255,255,.08); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--umber); display: grid; place-items: center; font-family: var(--sc); color: var(--candle); overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 40px; }
.menu-btn { display: none; }

/* buttons & inputs ----------------------------------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: var(--radius);
  font-family: var(--sans); font-weight: 500; font-size: 16px; letter-spacing: .01em; overflow: hidden;
  background: linear-gradient(180deg, #f0c266, var(--candle)); color: #1a1006;
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 8px 24px -8px rgba(226,168,69,.6);
  transition: transform .2s var(--ease-out), box-shadow .3s, filter .2s;
}
.btn::after { content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); transition: left .6s var(--ease-out); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 14px 30px -8px rgba(226,168,69,.7); }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--wax); box-shadow: inset 0 0 0 1px rgba(241,227,196,.25); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px rgba(241,227,196,.6); background: rgba(255,255,255,.03); }
.btn.blood { background: linear-gradient(180deg, #b22a30, var(--blood)); color: #fff; box-shadow: 0 8px 24px -8px rgba(143,29,34,.8); }
.btn.sm { padding: 7px 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--blood-hi); box-shadow: inset 0 0 0 1px rgba(200,54,60,.4); }
.btn.danger:hover { background: rgba(200,54,60,.1); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--ash); font-weight: 500; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius); background: rgba(0,0,0,.35); border: 1px solid rgba(241,227,196,.14); color: var(--wax);
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.input:focus { outline: none; border-color: rgba(226,168,69,.7); box-shadow: 0 0 0 3px rgba(226,168,69,.14); background: rgba(0,0,0,.5); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
select.input option { background: #1a120a; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.help { font-size: 14px; color: var(--ash-dim); }
.err { color: var(--blood-hi); font-size: 14px; min-height: 1.2em; }

/* views ------------------------------------------------------------------------ */
main { position: relative; z-index: 3; min-height: calc(100vh - 64px); }
.view { display: none; padding: 34px 22px 90px; max-width: 1240px; margin: 0 auto; }
.view.active { display: block; }
.hall-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 28px; }
.hall-head h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 400; }
.hall-head h1 em { font-style: italic; color: var(--candle); }
.hall-head p { color: var(--ash); font-family: var(--serif); font-size: 19px; max-width: 56ch; margin: 6px 0 0; }
.hall-tools { display: flex; gap: 10px; align-items: center; }
.hall-tools .input { width: 220px; }
.empty { text-align: center; color: var(--ash); font-family: var(--serif); font-size: 20px; padding: 60px 20px; }
.empty b { display: block; color: var(--wax); font-weight: 500; font-size: 26px; margin-bottom: 6px; }

/* shelves & tomes ------------------------------------------------------------ */
.shelves { display: flex; flex-direction: column; gap: 58px; perspective: 1600px; }
.shelf-row { position: relative; display: flex; gap: 34px; justify-content: center; align-items: flex-end; padding: 0 18px 22px; }
.shelf-row::after {
  content: ''; position: absolute; left: -2%; right: -2%; bottom: 0; height: 16px; border-radius: 3px;
  background: linear-gradient(180deg, #4a2f1b 0%, #2d1b0f 45%, #1a0f08 100%);
  box-shadow: 0 18px 30px -8px rgba(0,0,0,.9), 0 2px 0 rgba(255,220,150,.08) inset;
}
.shelf-row::before { content:''; position:absolute; left:-2%; right:-2%; bottom:16px; height: 40px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.5)); pointer-events:none; }
.tome { position: relative; width: 168px; flex: none; text-align: left; color: var(--wax); -webkit-tap-highlight-color: transparent; }
.tome-3d { display: block; position: relative; width: 168px; height: 250px; transform-style: preserve-3d; transform: rotateY(-16deg); transition: transform .55s var(--ease-out); will-change: transform; }
.tome:hover .tome-3d, .tome:focus-visible .tome-3d { transform: rotateY(-30deg) translateY(-12px) translateZ(10px); }
.tome-cover { position: absolute; inset: 0; border-radius: 3px 8px 8px 3px; overflow: hidden; transform: translateZ(14px); background: var(--umber);
  box-shadow: 0 30px 50px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(0,0,0,.6); }
.tome-cover img, .tome-cover canvas { width: 100%; height: 100%; object-fit: cover; }
.tome-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(255,255,255,.14) 0%, transparent 18%, transparent 80%, rgba(0,0,0,.25) 100%), linear-gradient(90deg, rgba(0,0,0,.35) 0, transparent 5%); pointer-events: none; }
.tome-spine { position: absolute; left: 0; top: 0; width: 28px; height: 100%; transform: rotateY(-90deg) translateX(-14px) translateZ(0); transform-origin: left center; background: linear-gradient(90deg, #1b120b, #2e1d11 50%, #1b120b); border-radius: 3px 0 0 3px; display: grid; place-items: center; overflow: hidden; }
.tome-spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--sc); font-size: 12px; letter-spacing: .08em; color: rgba(241,227,196,.75); white-space: nowrap; max-height: 90%; overflow: hidden; }
.tome-pages { position: absolute; right: 0; top: 4px; bottom: 4px; width: 26px; transform: rotateY(90deg) translateX(13px) translateZ(0); transform-origin: right center; background: repeating-linear-gradient(90deg, #e4d5b5 0 1px, #c9b893 1px 2px); }
.tome-glow { position: absolute; inset: -20px; border-radius: 50%; background: radial-gradient(circle, rgba(226,168,69,.22), transparent 60%); opacity: 0; transition: opacity .5s; pointer-events: none; transform: translateZ(-30px); }
.tome:hover .tome-glow { opacity: 1; }
.tome-meta { display: block; margin-top: 16px; width: 168px; }
.tome-meta b { display: block; font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.2; color: var(--wax); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tome-meta span { display: block; font-size: 14px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tome-dust { position: absolute; inset: 0; border-radius: 3px 8px 8px 3px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); mix-blend-mode: screen; opacity: .22; transform: translateZ(15px); pointer-events: none; }
.tome.dark .tome-cover { box-shadow: 0 30px 50px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(0,0,0,.6), 0 0 30px -6px rgba(143,29,34,.6); }
.tome.dark .tome-glow { background: radial-gradient(circle, rgba(200,54,60,.25), transparent 60%); }
.tome-chain { position: absolute; left: -4px; right: -4px; top: 36%; height: 12px; transform: translateZ(16px) rotate(-6deg); background: repeating-linear-gradient(90deg, #6d6d6d 0 8px, #2b2b2b 8px 12px, transparent 12px 16px); border-radius: 6px; box-shadow: 0 3px 6px rgba(0,0,0,.8); opacity: .9; transform-origin: center; transition: transform .4s var(--ease-back); }
.tome-chain.two { top: 60%; transform: translateZ(16px) rotate(5deg); }
.tome:hover .tome-chain { transform: translateZ(16px) rotate(-3deg) scaleX(1.02); }
.tome-fav { position: absolute; top: 8px; right: 8px; transform: translateZ(18px); width: 26px; height: 26px; border-radius: 50%; background: rgba(12,9,5,.75); display: grid; place-items: center; color: var(--candle); font-size: 14px; opacity: 0; transition: opacity .25s; }
.tome-fav.on, .tome:hover .tome-fav { opacity: 1; }
.tome.enter { opacity: 0; transform: translateY(40px); }

/* dark hall ------------------------------------------------------------------- */
.dark-hall { position: relative; }
.dark-hall .hall-head h1 em { color: var(--blood-hi); }
.fog { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity 1.2s; mix-blend-mode: screen; }
.fog .layer { position: absolute; inset: -20%; background: radial-gradient(40% 30% at 30% 60%, rgba(140,120,110,.18), transparent 70%), radial-gradient(35% 28% at 70% 40%, rgba(120,100,100,.14), transparent 70%); animation: fogmove 26s ease-in-out infinite alternate; }
.fog .layer.b { animation-duration: 38s; animation-direction: alternate-reverse; background: radial-gradient(30% 25% at 55% 75%, rgba(160,130,120,.14), transparent 70%); }
@keyframes fogmove { from { transform: translate(-4%, 2%) scale(1) } to { transform: translate(5%, -3%) scale(1.12) } }
body.dark-mode .fog { opacity: 1; }
body.dark-mode { background: radial-gradient(1200px 700px at 50% -10%, #2a0c0c 0%, transparent 60%), radial-gradient(900px 500px at 50% 110%, #1a0808 0%, transparent 60%), #080405; }
body.dark-mode .brand .candle { background: #ff8a80; box-shadow: 0 0 14px 5px rgba(200,54,60,.6); }
body.dark-mode #cursor-glow { background: radial-gradient(circle, rgba(200,54,60,.12) 0%, rgba(200,54,60,.03) 35%, transparent 65%); }
body.dark-mode .shelf-row::after { background: linear-gradient(180deg, #2b1a1a 0%, #1a0f0f 45%, #0d0707 100%); }
.dark-warning { display: flex; gap: 14px; align-items: center; padding: 14px 18px; margin: 0 0 30px; border: 1px solid rgba(200,54,60,.35); border-radius: var(--radius); background: rgba(143,29,34,.08); color: #d9b3b3; font-family: var(--serif); font-size: 18px; }
.dark-warning .skull { font-size: 26px; filter: drop-shadow(0 0 10px rgba(200,54,60,.8)); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }

/* overlays -------------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(6,4,2,.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.overlay.open { display: flex; }
.modal { width: min(520px, 100%); max-height: 92vh; overflow: auto; background: linear-gradient(180deg, #1c130b, #120c07); border: 1px solid rgba(226,168,69,.18); border-radius: 10px; padding: 28px; box-shadow: var(--shadow-deep); transform: translateY(16px) scale(.98); opacity: 0; }
.modal.lg { width: min(820px, 100%); }
.modal h2 { font-size: 30px; font-weight: 400; margin-bottom: 4px; }
.modal .sub { color: var(--ash); margin-bottom: 20px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tabs button { padding: 10px 14px; color: var(--ash); font-weight: 500; position: relative; }
.tabs button.active { color: var(--wax); }
.tabs button.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--candle); box-shadow: 0 0 8px var(--candle); }

/* lectern (leggio) ------------------------------------------------------------ */
#lectern { z-index: 60; background: radial-gradient(900px 600px at 50% 40%, rgba(60,35,12,.55), rgba(6,4,2,.94) 70%); }
.lectern-stage { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 54px; align-items: center; max-width: 1000px; width: 100%; }
.lectern-book { position: relative; width: 340px; height: 500px; perspective: 1400px; margin: 0 auto; }
.lectern-book .big-cover { position: absolute; inset: 0; border-radius: 4px 12px 12px 4px; overflow: hidden; background: var(--umber); box-shadow: var(--shadow-deep), 0 0 0 1px rgba(0,0,0,.7); transform-style: preserve-3d; }
.lectern-book .big-cover img, .lectern-book .big-cover canvas { width: 100%; height: 100%; object-fit: cover; }
.lectern-book .big-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(255,255,255,.12) 0%, transparent 20%), linear-gradient(90deg, rgba(0,0,0,.4) 0, transparent 6%); pointer-events: none; }
#dust-canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 4px 12px 12px 4px; cursor: grab; touch-action: none; z-index: 3; }
#dust-canvas.done { pointer-events: none; }
.dust-hint { position: absolute; left: 50%; bottom: -54px; transform: translateX(-50%); white-space: nowrap; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--candle); text-shadow: 0 0 14px rgba(226,168,69,.5); animation: floaty 2.2s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateX(-50%) translateY(-5px); } }
.dust-ring { position: absolute; top: -18px; right: -18px; width: 54px; height: 54px; z-index: 4; }
.dust-ring circle { fill: rgba(12,9,5,.85); stroke: rgba(241,227,196,.15); stroke-width: 3; }
.dust-ring circle.p { fill: none; stroke: var(--candle); stroke-linecap: round; stroke-dasharray: 150; stroke-dashoffset: 150; transition: stroke-dashoffset .25s; transform: rotate(-90deg); transform-origin: center; }
.dust-ring text { fill: var(--wax); font: 600 13px var(--sans); text-anchor: middle; dominant-baseline: central; }
.lectern-info { opacity: 0; transform: translateX(20px); }
.lectern-info h2 { font-size: clamp(30px, 4vw, 44px); font-weight: 400; line-height: 1.1; }
.lectern-info .by { color: var(--candle); font-family: var(--serif); font-style: italic; font-size: 20px; margin: 6px 0 16px; }
.lectern-info .desc { color: var(--ash); font-family: var(--serif); font-size: 19px; line-height: 1.5; max-width: 52ch; }
.lectern-info .meta { display: flex; gap: 18px; color: var(--ash-dim); font-size: 14px; margin: 14px 0 22px; flex-wrap: wrap; }
.lectern-info .meta span b { color: var(--wax); font-weight: 500; }
.lectern-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lectern-locked { color: var(--ash); font-family: var(--serif); font-style: italic; font-size: 19px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 13px; background: rgba(255,255,255,.06); color: var(--ash); margin: 0 4px 4px 0; }
.tag.dark { background: rgba(143,29,34,.25); color: #e3a2a5; }

/* whispers chooser (ASMR) ------------------------------------------------------ */
#whispers-modal { z-index: 66; }
#confirm-modal { z-index: 90; }
.mixer { display: grid; gap: 14px; }
.mixer-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 20px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: var(--ash); font-size: 14px; transition: all .25s; }
.chip:hover { color: var(--wax); border-color: rgba(226,168,69,.5); transform: translateY(-1px); }
.chip.active { background: rgba(226,168,69,.16); color: var(--candle-hi); border-color: rgba(226,168,69,.5); box-shadow: 0 0 14px -2px rgba(226,168,69,.5); }
.mixer-group h4 { font-family: var(--sc); font-weight: 400; color: var(--ash); font-size: 15px; letter-spacing: .06em; margin: 8px 0 6px; }
.snd { display: grid; grid-template-columns: 26px minmax(0,1fr) 96px; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--radius); transition: background .2s; }
.snd:hover { background: rgba(255,255,255,.03); }
.snd .ico { font-size: 18px; text-align: center; filter: grayscale(.5); transition: filter .3s, transform .3s; }
.snd.on .ico { filter: none; transform: scale(1.12); }
.snd .name { font-size: 15px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd.on .name { color: var(--wax); }
.snd input[type=range] { width: 100%; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--candle); box-shadow: 0 0 10px rgba(226,168,69,.6); cursor: pointer; transition: transform .2s; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--candle); cursor: pointer; }
.mixer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; max-height: 44vh; overflow: auto; padding-right: 6px; }
.whisper-bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 16px; }
.whisper-bars i { width: 3px; background: var(--candle); border-radius: 2px; animation: bar 1s ease-in-out infinite; height: 40%; }
.whisper-bars i:nth-child(2) { animation-delay: .15s } .whisper-bars i:nth-child(3) { animation-delay: .3s } .whisper-bars i:nth-child(4) { animation-delay: .45s }
@keyframes bar { 50% { height: 100%; } }

/* reader ---------------------------------------------------------------------- */
#reader { position: fixed; inset: 0; z-index: 70; display: none; flex-direction: column; background: radial-gradient(1000px 700px at 50% 45%, #2a1a0d 0%, #0c0905 70%); }
#reader.open { display: flex; }
.reader-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: linear-gradient(180deg, rgba(12,9,5,.95), rgba(12,9,5,.6)); border-bottom: 1px solid rgba(226,168,69,.1); z-index: 2; }
.reader-bar .title { flex: 1; min-width: 0; font-family: var(--serif); font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bar .title i { color: var(--ash); font-size: 15px; margin-left: 8px; }
.reader-stage { flex: 1; position: relative; display: grid; place-items: center; padding: 18px 70px; min-height: 0; }
.flipbook-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
#flipbook { filter: drop-shadow(0 40px 60px rgba(0,0,0,.8)); }
.page { background: var(--parchment); color: #2a1d10; overflow: hidden; }
.page-inner { width: 600px; height: 900px; transform-origin: top left; position: relative; font-family: var(--serif); background: var(--parchment); }
.page-text { position: absolute; inset: 64px 56px 64px 56px; font-size: 21px; line-height: 1.52; color: #2b1d10; }
.page-text p { margin: 0 0 .85em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.page-text h3 { font-size: 34px; font-weight: 500; margin: 20px 0 26px; line-height: 1.15; text-align: center; }
.page-text h3 small { display: block; font-family: var(--sc); font-size: 14px; letter-spacing: .14em; color: #8a6a3f; margin-bottom: 10px; }
.page-text .dropcap::first-letter { float: left; font-size: 68px; line-height: .8; padding: 8px 8px 0 0; font-weight: 500; color: var(--blood); }
.page-num { position: absolute; bottom: 30px; left: 0; right: 0; text-align: center; font-family: var(--sc); font-size: 13px; letter-spacing: .1em; color: #8a7556; }
.page-texture { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 60%, rgba(90,60,20,.22) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }
.page.--left .page-texture { box-shadow: inset -40px 0 50px -30px rgba(70,40,10,.35); }
.page.--right .page-texture { box-shadow: inset 40px 0 50px -30px rgba(70,40,10,.35); }
.page canvas.pdf { width: 100%; height: 100%; display: block; background: #f4ecd8; }
.pdf-page .page-texture { background: radial-gradient(ellipse at center, transparent 72%, rgba(60,40,15,.12) 100%); }
.page .pdf-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #8a7556; font-family: var(--sc); letter-spacing: .1em; font-size: 14px; }
.cover-page { width: 100%; height: 100%; position: relative; background: var(--umber); }
.cover-page img, .cover-page canvas { width: 100%; height: 100%; object-fit: cover; }
.cover-page.back { background: linear-gradient(135deg, #3a2516, #1c110a); display: grid; place-items: center; font-family: var(--serif); font-style: italic; color: rgba(241,227,196,.5); font-size: 20px; text-align: center; padding: 30px; }
.reader-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 50%; background: rgba(12,9,5,.7); border: 1px solid rgba(226,168,69,.25); color: var(--wax); display: grid; place-items: center; transition: all .25s; z-index: 3; }
.reader-nav:hover { background: rgba(226,168,69,.18); transform: translateY(-50%) scale(1.08); }
.reader-nav.prev { left: 12px; } .reader-nav.next { right: 12px; }
.reader-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.reader-foot { display: flex; align-items: center; gap: 14px; padding: 10px 18px 14px; z-index: 2; }
.reader-foot input[type=range] { flex: 1; }
.reader-foot .pn { font-family: var(--sc); font-size: 14px; color: var(--ash); min-width: 90px; text-align: right; letter-spacing: .06em; }
.mixer-panel { position: absolute; right: 16px; top: 64px; width: 360px; max-width: calc(100% - 32px); background: linear-gradient(180deg, #1c130b, #120c07); border: 1px solid rgba(226,168,69,.18); border-radius: 10px; padding: 18px; box-shadow: var(--shadow-deep); z-index: 5; transform: translateX(20px); opacity: 0; pointer-events: none; transition: all .35s var(--ease-out); }
.mixer-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.mixer-panel h3 { font-size: 22px; font-weight: 400; margin-bottom: 10px; }
.mixer-panel .mixer-cols { grid-template-columns: 1fr; max-height: 46vh; }
.reader-notes { position: absolute; left: 16px; top: 64px; width: 340px; max-width: calc(100% - 32px); max-height: calc(100% - 140px); overflow: auto; background: linear-gradient(180deg, #1c130b, #120c07); border: 1px solid rgba(226,168,69,.18); border-radius: 10px; padding: 18px; box-shadow: var(--shadow-deep); z-index: 5; transform: translateX(-20px); opacity: 0; pointer-events: none; transition: all .35s var(--ease-out); }
.reader-notes.open { transform: none; opacity: 1; pointer-events: auto; }
.note { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 15px; }
.note b { font-weight: 500; color: var(--candle); font-size: 14px; }
.note p { margin: 4px 0 0; font-family: var(--serif); font-size: 17px; }
.note time { color: var(--ash-dim); font-size: 12px; margin-left: 6px; }

/* scrittoio (upload) --------------------------------------------------------- */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.desk-form { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 26px; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); transition: background .4s; }
.steps span.done { background: var(--candle); box-shadow: 0 0 8px rgba(226,168,69,.6); }
.drop { position: relative; border: 1.5px dashed rgba(226,168,69,.35); border-radius: 10px; padding: 30px 20px; text-align: center; color: var(--ash); transition: all .25s; cursor: pointer; background: rgba(226,168,69,.03); }
.drop:hover, .drop.over { border-color: var(--candle); background: rgba(226,168,69,.08); color: var(--wax); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop b { display: block; color: var(--wax); font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.drop .ok { color: var(--moss); }
.cover-preview { position: sticky; top: 90px; }
.cover-preview canvas { width: 100%; max-width: 320px; border-radius: 4px 12px 12px 4px; box-shadow: var(--shadow-deep); margin: 0 auto; transition: transform .4s var(--ease-out); }
.cover-preview:hover canvas { transform: rotateY(-6deg) translateY(-4px); }
.cover-preview .hint { text-align: center; color: var(--ash-dim); font-size: 14px; margin-top: 12px; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.style-opt { height: 56px; border-radius: 6px; border: 2px solid transparent; position: relative; overflow: hidden; transition: all .25s; }
.style-opt span { position: absolute; left: 6px; bottom: 4px; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
.style-opt.active { border-color: var(--candle); box-shadow: 0 0 12px rgba(226,168,69,.5); transform: translateY(-2px); }
.progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--candle), var(--candle-hi)); box-shadow: 0 0 12px rgba(226,168,69,.8); transition: width .4s var(--ease-out); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch i { width: 42px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.12); position: relative; transition: background .3s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ash); transition: all .3s var(--ease-back); }
.switch input { display: none; }
.switch input:checked + i { background: rgba(143,29,34,.6); }
.switch input:checked + i::after { left: 21px; background: var(--blood-hi); box-shadow: 0 0 10px var(--blood-hi); }
.my-books { margin-top: 44px; }
.my-books h2 { font-size: 28px; font-weight: 400; margin-bottom: 14px; }
.book-list { display: grid; gap: 10px; }
.book-li { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05); transition: background .2s, transform .2s; }
.book-li:hover { background: rgba(255,255,255,.05); transform: translateX(3px); }
.book-li img, .book-li canvas { width: 44px; height: 64px; object-fit: cover; border-radius: 2px 4px 4px 2px; }
.book-li b { font-family: var(--serif); font-weight: 500; font-size: 18px; display: block; }
.book-li span { color: var(--ash); font-size: 14px; }

/* sala (chat) ------------------------------------------------------------------ */
.sala { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 0; height: calc(100vh - 262px); height: calc(100dvh - 262px); min-height: 440px; border: 1px solid rgba(226,168,69,.14); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.25); }
.rooms { border-right: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; min-height: 0; background: rgba(0,0,0,.2); }
.rooms-head { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.rooms-head h2 { font-size: 24px; font-weight: 400; }
.rooms-list { flex: 1; overflow: auto; padding: 4px 8px; }
.room-li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 8px; color: var(--wax); transition: background .2s, transform .2s; }
.room-li:hover { background: rgba(255,255,255,.04); transform: translateX(2px); }
.room-li.active { background: rgba(226,168,69,.1); box-shadow: inset 2px 0 0 var(--candle); }
.room-li .ri { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--umber); font-size: 18px; }
.room-li b { display: block; font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-li span { font-size: 13px; color: var(--ash-dim); }
.rooms-foot { padding: 10px; display: grid; gap: 6px; border-top: 1px solid rgba(255,255,255,.06); }
.chat { display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.chat-head h3 { font-size: 22px; font-weight: 400; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .ttl { font-size: 13px; color: var(--ash); display: flex; align-items: center; gap: 6px; }
.chat-head .ttl i { width: 8px; height: 8px; border-radius: 50%; background: var(--candle); box-shadow: 0 0 8px var(--candle); animation: candle 1.5s infinite alternate; }
.presence { display: flex; align-items: center; gap: -6px; font-size: 13px; color: var(--ash); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--moss); box-shadow: 0 0 8px var(--moss); margin-right: 6px; }
.msgs { flex: 1; overflow: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: 10px; max-width: 78%; align-self: flex-start; animation: msgin .35s var(--ease-out); }
@keyframes msgin { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.msg.mine { align-self: flex-end; grid-template-columns: 1fr; }
.msg.mine .avatar { display: none; }
.msg .bubble { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06); border-radius: 12px 12px 12px 3px; padding: 8px 12px; position: relative; }
.msg.mine .bubble { background: rgba(226,168,69,.13); border-color: rgba(226,168,69,.22); border-radius: 12px 12px 3px 12px; }
.msg .who { font-size: 13px; color: var(--candle); font-weight: 500; margin-bottom: 2px; display: flex; gap: 8px; align-items: baseline; }
.msg .who time { color: var(--ash-dim); font-weight: 400; font-size: 12px; }
.msg .txt { white-space: pre-wrap; word-break: break-word; font-size: 16px; }
.msg .txt a { text-decoration: underline; }
.msg .fade { font-size: 11px; color: var(--ash-dim); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.msg .fade::before { content: '⌛'; font-size: 10px; opacity: .7; }
.msg .del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--soot); border: 1px solid rgba(255,255,255,.1); color: var(--ash); font-size: 12px; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.msg:hover .del { opacity: 1; }
.msg.dissolve { animation: dissolve .9s var(--ease-out) forwards; }
@keyframes dissolve { to { opacity: 0; filter: blur(6px); transform: translateY(-10px) scale(.96); } }
.att { margin-top: 6px; border-radius: 8px; overflow: hidden; max-width: 420px; }
.att img { max-height: 320px; width: auto; max-width: 100%; border-radius: 8px; cursor: zoom-in; transition: transform .3s; }
.att img:hover { transform: scale(1.02); }
.att video, .att audio { width: 100%; max-height: 360px; border-radius: 8px; background: #000; display: block; }
.att .file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; color: var(--wax); }
.att .file .fi { font-size: 22px; }
.att .file b { display: block; font-weight: 500; font-size: 14px; word-break: break-all; }
.att .file span { font-size: 12px; color: var(--ash-dim); }
.sys { align-self: center; font-size: 13px; color: var(--ash-dim); font-style: italic; font-family: var(--serif); }
.typing { height: 22px; padding: 0 18px; font-size: 13px; color: var(--ash); display: flex; align-items: center; gap: 8px; }
.typing .dots i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--candle); margin-right: 3px; animation: typing 1.1s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s } .typing .dots i:nth-child(3) { animation-delay: .4s }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4 } 30% { transform: translateY(-4px); opacity: 1 } }
.composer { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid rgba(255,255,255,.06); align-items: flex-end; }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; }
.composer .icon-btn { width: 44px; height: 44px; flex: none; background: rgba(255,255,255,.04); }
.composer .send { background: linear-gradient(180deg, #f0c266, var(--candle)); color: #1a1006; }
.composer .send:hover { transform: translateY(-2px) scale(1.04); }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 14px; color: var(--ash); border-top: 1px solid rgba(255,255,255,.06); background: rgba(226,168,69,.05); }
.attach-preview b { color: var(--wax); font-weight: 500; }
.upload-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--candle); box-shadow: 0 0 10px var(--candle); transform-origin: left; transform: scaleX(0); transition: transform .3s; }
.members { padding: 6px 0; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.member .on { width: 8px; height: 8px; border-radius: 50%; background: var(--ash-dim); }
.member .on.live { background: var(--moss); box-shadow: 0 0 8px var(--moss); }
.code-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; background: rgba(0,0,0,.35); border: 1px dashed rgba(226,168,69,.4); font-family: var(--sc); font-size: 26px; letter-spacing: .3em; color: var(--candle-hi); justify-content: center; }
.chat-login { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,4,2,.6); backdrop-filter: blur(4px); z-index: 4; text-align: center; padding: 20px; }
.chat-login h3 { font-size: 30px; font-weight: 400; margin-bottom: 8px; }
.chat-login p { color: var(--ash); font-family: var(--serif); font-size: 18px; margin-bottom: 18px; }
.lightbox { z-index: 80; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 6px; box-shadow: var(--shadow-deep); }

/* profile ------------------------------------------------------------------------ */
.profile { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 40px; align-items: start; }
.profile-card { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 26px; text-align: center; }
.profile-card .avatar { margin: 0 auto 14px; cursor: pointer; position: relative; box-shadow: 0 0 0 3px rgba(226,168,69,.2); transition: box-shadow .3s; }
.profile-card .avatar:hover { box-shadow: 0 0 0 3px var(--candle), 0 0 24px rgba(226,168,69,.5); }
.profile-card h2 { font-size: 30px; font-weight: 400; }
.profile-card .u { color: var(--ash); font-size: 15px; }
.stats { display: flex; justify-content: center; gap: 24px; margin: 18px 0; }
.stats div { text-align: center; }
.stats b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 500; color: var(--candle); line-height: 1; }
.stats span { font-size: 13px; color: var(--ash); }

/* toasts --------------------------------------------------------------------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 30px; background: rgba(28,19,11,.95); border: 1px solid rgba(226,168,69,.3); color: var(--wax); font-size: 15px; box-shadow: var(--shadow-deep); opacity: 0; transform: translateY(12px); pointer-events: auto; max-width: min(92vw, 560px); }
.toast.err { border-color: rgba(200,54,60,.5); color: #f3c0c2; }
.toast.ok { border-color: rgba(95,138,106,.5); }

/* loader ---------------------------------------------------------------------- */
.ink-loader { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(226,168,69,.2); border-top-color: var(--candle); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0 } }

/* footer ---------------------------------------------------------------------- */
footer { position: relative; z-index: 3; text-align: center; color: var(--ash-dim); font-size: 13px; padding: 30px 20px 40px; }
footer a { color: var(--ash); }

/* responsive ------------------------------------------------------------------ */
@media (max-width: 1000px) {
  .lectern-stage { grid-template-columns: 1fr; gap: 70px; text-align: center; }
  .lectern-info .desc { margin: 0 auto; }
  .lectern-actions, .lectern-info .meta { justify-content: center; }
  .lectern-book { width: 260px; height: 384px; }
  .desk, .profile { grid-template-columns: 1fr; }
  .cover-preview { position: static; }
  .mixer-cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand { font-size: 19px; }
  .nav { position: fixed; top: 58px; left: 0; right: 0; flex-direction: column; background: rgba(12,9,5,.97); padding: 10px; border-bottom: 1px solid rgba(226,168,69,.15); transform: translateY(-120%); transition: transform .4s var(--ease-out); z-index: 19; }
  .nav.open { transform: none; }
  .nav a { padding: 14px; font-size: 18px; }
  .menu-btn { display: grid; }
  .user-chip span { display: none; }
  .view { padding: 22px 16px 80px; }
  .shelf-row { gap: 18px; padding: 0 8px 18px; }
  .tome, .tome-3d, .tome-meta { width: 136px; }
  .tome-3d { height: 202px; }
  .sala { grid-template-columns: 1fr; height: calc(100vh - 300px); height: calc(100dvh - 300px); min-height: 420px; }
  #lectern { align-items: flex-start; overflow: auto; padding: 60px 16px 40px; }
  .lectern-stage { gap: 76px; }
  .rooms { position: absolute; inset: 0; z-index: 3; transform: translateX(-100%); transition: transform .35s var(--ease-out); background: #130d08; }
  .rooms.open { transform: none; }
  .sala { position: relative; }
  .msg { max-width: 92%; }
  .reader-stage { padding: 10px 8px 10px; }
  .reader-nav { width: 44px; height: 44px; }
  .reader-nav.prev { left: 4px; } .reader-nav.next { right: 4px; }
  .mixer-panel, .reader-notes { left: 8px; right: 8px; width: auto; top: 58px; }
  .modal { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body::after { display: none; }
}
