:root {
  --bg: #17120e;
  --bg-2: #211a14;
  --floor: #2a2019;
  --ink: #f3e9dc;
  --ink-2: #c9b8a3;
  --ink-3: #8f7d69;
  --accent: #e0a64a;
  --accent-2: #d2694b;
  --ok: #7fb58f;
  --line: rgba(243, 233, 220, 0.12);
  --glass: rgba(33, 26, 20, 0.82);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; overflow-x: clip; }
/* nada puede ensanchar la página: en móvil, contenido que sobresale hace que Chrome amplíe el viewport */
body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(224, 166, 74, 0.13), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(210, 105, 75, 0.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ cabecera */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 28px;
  padding: calc(22px + env(safe-area-inset-top)) max(clamp(16px, 4vw, 48px), env(safe-area-inset-right)) 16px max(clamp(16px, 4vw, 48px), env(safe-area-inset-left));
  background: linear-gradient(var(--bg) 60%, rgba(23, 18, 14, 0));
}
.brand h1 {
  margin: 0; font-family: var(--serif); font-weight: 800;
  font-size: clamp(28px, 4.2vw, 46px); letter-spacing: -0.02em; line-height: 1;
}
.brand h1 span { color: var(--accent); font-style: italic; font-weight: 600; }
.stats { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.stats b { color: var(--ink); font-weight: 600; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.segmented button {
  border: 0; background: none; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  color: var(--ink-2); font-weight: 500; font-size: 14px; transition: background .25s, color .25s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-selected="true"] { background: var(--accent); color: #231708; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.search input, #sort {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 14px;
}
.search input { width: min(260px, 70vw); }
.search input:focus, #sort:focus, .segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ suelo con pilas */
#floor-wrap { padding: 10px clamp(16px, 4vw, 48px) 60px; perspective: 1400px; overflow-x: clip; } /* el zoom de cámara escala el suelo más allá de los bordes */
.floor { transform-origin: 50% 0; will-change: transform; }
.floor-section + .floor-section { margin-top: 36px; }
.floor-section h3 {
  font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 4px; display: flex; gap: 10px; align-items: baseline;
}
.floor-section h3 small { font-family: var(--sans); font-size: 13px; color: var(--ink-3); font-weight: 400; }
.floor-section.recs h3::before { content: "✦"; color: var(--accent); }
.piles {
  display: grid; gap: 6px 18px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  padding-top: 8px;
  border-bottom: 10px solid #3a2c21;
  box-shadow: 0 14px 18px -12px rgba(0, 0, 0, .7);
  background: linear-gradient(to top, rgba(0, 0, 0, .25), transparent 90px);
  border-radius: 0 0 6px 6px;
}
.empty { color: var(--ink-3); padding: 40px 0; text-align: center; }

.pile {
  --W: 104px; --D: 150px;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: end;
  background: none; border: 0; padding: 0 4px 12px; cursor: pointer; text-align: center; min-height: 290px;
  animation: pile-in .6s var(--ease-out) backwards;
  content-visibility: auto; contain-intrinsic-size: auto 310px; overflow-clip-margin: 30px; padding-top: 24px; animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes pile-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.pile:focus-visible { outline: none; }
.pile:focus-visible .pile-label strong { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.stage { position: relative; width: 190px; height: var(--stage-h, 210px); pointer-events: none; }
.stack {
  position: absolute; left: 50%; bottom: 0;
  width: var(--W); height: var(--D); margin-left: calc(var(--W) / -2);
  transform-style: preserve-3d;
  transform: translateY(calc(var(--D) * .22)) rotateX(58deg) rotateZ(var(--rz, -24deg));
  transition: transform .6s var(--ease-out);
}
.pile:hover .stack, .pile:focus-visible .stack { transform: translateY(calc(var(--D) * .22)) rotateX(52deg) rotateZ(calc(var(--rz, -24deg) + 8deg)); }

.shadow {
  position: absolute; inset: -10px; border-radius: 12px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
  transform: translateZ(-1px) scale(1.15);
}

.book3d {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: translateZ(var(--z)) translate(var(--dx), var(--dy)) rotateZ(var(--r));
  transition: transform .5s var(--ease-out);
}
.pile:hover .book3d { transform: translateZ(calc(var(--z) * 1.12)) translate(var(--dx), var(--dy)) rotateZ(calc(var(--r) * 1.8)); }
.pile:hover .book3d.is-top { transform: translateZ(calc(var(--z) * 1.12 + 14px)) translate(calc(var(--dx) + 6px), calc(var(--dy) - 4px)) rotateZ(calc(var(--r) - 5deg)); }

.book3d .f { position: absolute; backface-visibility: hidden; }
/* tapa (con bisagra y brillo) */
.book3d .f-top {
  inset: 0; transform: translateZ(var(--t));
  background: var(--spine); border-radius: 2px 4px 4px 2px; overflow: hidden;
}
.book3d .f-top::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.42), rgba(255,255,255,.2) 3px, rgba(0,0,0,.22) 6px, transparent 11px),
    linear-gradient(125deg, rgba(255,255,255,.16), transparent 38%, transparent 70%, rgba(0,0,0,.18));
}
.book3d .f-top img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.book3d .f-top .fallback { padding: 10px 8px 10px 14px; font-family: var(--serif); font-size: 12px; line-height: 1.15; color: rgba(255,255,255,.92); text-align: left; }
/* lomo en el borde izquierdo (el largo), redondeado: sombreado cilíndrico, cabezadas y letras doradas */
.book3d .f-spine {
  left: 0; top: 0; width: var(--t); height: 100%;
  transform-origin: left center; transform: rotateY(-90deg);
  border-radius: 45% / 3px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.5), rgba(255,255,255,.07) 22%, rgba(255,255,255,.28) 45%, rgba(255,255,255,.06) 65%, rgba(0,0,0,.55)),
    linear-gradient(to bottom, rgba(0,0,0,.35), transparent 7px, transparent calc(100% - 7px), rgba(0,0,0,.35)),
    var(--spine);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.book3d .f-spine span {
  writing-mode: vertical-rl; max-height: calc(100% - 34px); overflow: hidden; white-space: nowrap;
  font-family: var(--serif); font-weight: 600; font-size: min(9px, calc(var(--t) * .6)); letter-spacing: .06em; text-transform: uppercase;
  color: #f1d9a4; text-shadow: 0 1px 0 rgba(0,0,0,.45);
}
.book3d .f-spine::before, .book3d .f-spine::after {
  content: ""; position: absolute; left: 14%; right: 14%; height: 1.5px; background: rgba(241, 217, 164, .55); box-shadow: 0 0 0 .5px rgba(0,0,0,.2);
}
.book3d .f-spine::before { top: 9px; }
.book3d .f-spine::after { bottom: 9px; }
/* cantos de las páginas (abajo y a la derecha), un poco metidos respecto a las tapas */
.book3d .f-front {
  left: 2px; top: calc(100% - 2px); width: calc(100% - 4px); height: var(--t);
  transform-origin: top center; transform: translateZ(var(--t)) rotateX(-90deg);
  background:
    linear-gradient(to bottom, var(--spine) 0 1.5px, transparent 1.5px calc(100% - 1.5px), var(--spine) calc(100% - 1.5px)),
    linear-gradient(90deg, rgba(0,0,0,.22), transparent 10%, transparent 90%, rgba(0,0,0,.18)),
    repeating-linear-gradient(to bottom, #f3e8d2 0 1px, #d8c9ac 1px 2px);
}
.book3d .f-right {
  left: calc(100% - 2px); top: 2px; width: var(--t); height: calc(100% - 4px);
  transform-origin: left center; transform: translateZ(var(--t)) rotateY(90deg);
  background:
    linear-gradient(90deg, var(--spine) 0 1.5px, transparent 1.5px calc(100% - 1.5px), var(--spine) calc(100% - 1.5px)),
    linear-gradient(to bottom, rgba(0,0,0,.18), transparent 10%, transparent 90%, rgba(0,0,0,.18)),
    repeating-linear-gradient(to right, #f3e8d2 0 1px, #d8c9ac 1px 2px);
}
.book3d.ghost .f-top img { filter: grayscale(.85) brightness(.7); }
.book3d.ghost .f-top::before { content: ""; position: absolute; inset: 0; z-index: 3; background: repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 6px, transparent 6px 12px); }

/* al abrir una pila: copia "levantada" de la pila, con la postura de hover congelada */
.lifted { position: fixed; z-index: 41; pointer-events: none; transform-origin: 50% 50%; will-change: transform; }
.lifted .stage { width: 100%; }
.lifted .stack { transition: none; transform: translateY(calc(var(--D) * .22)) rotateX(52deg) rotateZ(calc(var(--rz, -24deg) + 8deg)); }
.lifted .book3d { transition: none; transform: translateZ(calc(var(--z) * 1.12)) translate(var(--dx), var(--dy)) rotateZ(calc(var(--r) * 1.8)); }
.lifted .book3d.is-top { transform: translateZ(calc(var(--z) * 1.12 + 14px)) translate(calc(var(--dx) + 6px), calc(var(--dy) - 4px)) rotateZ(calc(var(--r) - 5deg)); }
.lifted.rec .stage::before {
  content: ""; position: absolute; left: 50%; bottom: 10px; width: 200px; height: 150px; margin-left: -100px;
  background: radial-gradient(closest-side, rgba(224, 166, 74, .22), transparent);
}


.pile-label { margin-top: 6px; display: grid; gap: 3px; justify-items: center; max-width: 180px; }
.pile-label strong { font-family: var(--serif); font-weight: 600; font-size: 16px; line-height: 1.15; }
.pile-label span { font-size: 12.5px; color: var(--ink-3); }
.pile-label .bar { width: 110px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.pile-label .bar i { display: block; height: 100%; background: var(--ok); width: var(--p); }
.tag {
  position: absolute; top: 8px; right: 12px; z-index: 2; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 999px; background: rgba(224, 166, 74, .16); color: var(--accent); border: 1px solid rgba(224, 166, 74, .4);
}
.tag.missing { background: rgba(210, 105, 75, .14); color: #f0a08a; border-color: rgba(210, 105, 75, .45); }
.pile.rec .stage::before {
  content: ""; position: absolute; left: 50%; bottom: 10px; width: 200px; height: 150px; margin-left: -100px;
  background: radial-gradient(closest-side, rgba(224, 166, 74, .22), transparent); pointer-events: none;
}

/* ------------------------------------------------------------------ vista de detalle */
.detail-bg {
  position: fixed; inset: 0; z-index: 40; pointer-events: none; will-change: opacity;
  background:
    radial-gradient(1100px 600px at 50% -5%, rgba(224, 166, 74, .13), transparent 70%),
    radial-gradient(ellipse at 50% 120%, rgba(0,0,0,.6), transparent 60%),
    repeating-linear-gradient(92deg, rgba(255,235,200,.018) 0 2px, transparent 2px 9px, rgba(0,0,0,.05) 9px 11px, transparent 11px 23px),
    linear-gradient(#21180f, #140f0b);
}
.detail-bg[hidden] { display: none; }
.detail { position: fixed; inset: 0; z-index: 42; overflow-y: auto; overscroll-behavior: contain; }
.detail[hidden] { display: none; }
.detail-inner { max-width: 1180px; margin: 0 auto; padding: calc(22px + env(safe-area-inset-top)) max(clamp(16px, 4vw, 40px), env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) max(clamp(16px, 4vw, 40px), env(safe-area-inset-left)); }
.detail-head { display: flex; gap: 20px; align-items: start; position: sticky; top: 0; z-index: 3; padding: 8px 0 16px; background: linear-gradient(rgba(26,19,13,.97) 70%, rgba(26,19,13,0)); }
.back {
  flex: none; border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 8px 14px; cursor: pointer; color: var(--ink-2); margin-top: 6px;
}
.back:hover { color: var(--ink); border-color: var(--accent); }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent); font-weight: 600; }
.detail-head h2 { margin: 2px 0 4px; font-family: var(--serif); font-size: clamp(28px, 4.5vw, 48px); line-height: 1.05; letter-spacing: -.015em; }
.detail-sub { margin: 0; color: var(--ink-2); font-size: 14px; }
.progress { margin-top: 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.progress .bar { width: 200px; max-width: 50vw; height: 6px; background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, var(--ok), #b7d98a); }

.shelf { margin-top: 26px; content-visibility: auto; contain-intrinsic-size: auto 420px; }
.shelf h4 { margin: 0 0 4px; font-family: var(--serif); font-weight: 600; font-size: 20px; display: flex; gap: 10px; align-items: baseline; }
.shelf h4 small { font-family: var(--sans); color: var(--ink-3); font-size: 13px; font-weight: 400; }
.shelf p.hint { margin: 0 0 12px; color: var(--ink-3); font-size: 13px; }
.covers {
  --w: 124px; --h: 186px;
  display: grid; gap: 34px 18px; grid-template-columns: repeat(auto-fill, minmax(calc(var(--w) + 18px), 1fr));
  padding: 18px 0 28px;
}
.cover-item { display: grid; gap: 10px; align-content: start; justify-items: start; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.cover-item:focus-visible { outline: none; }
.cover-item .cap { display: grid; gap: 4px; }
/* mesa preparada pero oculta mientras la cámara se acerca */
.detail-inner.pre .cover-item, .detail-inner.pre .detail-head, .detail-inner.pre #detail-body > .chips,
.detail-inner.pre .shelf h4, .detail-inner.pre .shelf .hint { visibility: hidden; }

/* libro 3D: tapa, contratapa, lomo redondeado y cantos de papel */
.bk-wrap { position: relative; width: var(--w); height: var(--h); }
.bk-shadow {
  position: absolute; left: 6%; right: -8%; bottom: -14px; height: 34px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.6), transparent); transition: transform .5s var(--ease-out), opacity .5s;
}
.cover-item:hover .bk-shadow, .cover-item:focus-visible .bk-shadow { transform: translateY(10px) scale(.9); opacity: .6; }
.bk {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: perspective(1100px) translateZ(0px) rotateX(14deg) rotateY(20deg) rotateZ(var(--r, 0deg));
  transition: transform .55s var(--ease-out);
}
.cover-item:hover .bk, .cover-item:focus-visible .bk { transform: perspective(1100px) translateZ(26px) rotateX(4deg) rotateY(-10deg) rotateZ(0deg); }
.bk-face { position: absolute; backface-visibility: hidden; }
.bk-front {
  inset: 0; transform: translateZ(calc(var(--t) / 2)); border-radius: 2px 5px 5px 2px; overflow: hidden; background: var(--spine);
}
.bk-front::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.22) 3px, rgba(0,0,0,.25) 7px, transparent 13px),
    linear-gradient(120deg, rgba(255,255,255,.18), transparent 35%, transparent 72%, rgba(0,0,0,.2));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.bk-front img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-front .fallback { position: absolute; inset: 0; padding: 14px 10px 10px 16px; font-family: var(--serif); font-size: 15px; line-height: 1.15; color: rgba(255,255,255,.92); }
.bk-front:has(img) .fallback { visibility: hidden; }
.bk-front .fallback em { display: block; margin-top: 8px; font-size: 12px; opacity: .75; font-family: var(--sans); font-style: normal; }
.bk-back { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); background: var(--spine); border-radius: 5px 2px 2px 5px; }
.bk-spine {
  top: 0; left: calc(50% - var(--t) / 2); width: var(--t); height: 100%;
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
  border-radius: 45% / 3px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.55), rgba(255,255,255,.06) 20%, rgba(255,255,255,.3) 45%, rgba(255,255,255,.05) 68%, rgba(0,0,0,.55)),
    linear-gradient(to bottom, rgba(0,0,0,.3), transparent 8px, transparent calc(100% - 8px), rgba(0,0,0,.3)),
    var(--spine);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.bk-spine span {
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  font-size: min(10px, calc(var(--t) * .55)); color: #f1d9a4; white-space: nowrap; max-height: 80%; overflow: hidden; text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.bk-spine::before, .bk-spine::after { content: ""; position: absolute; left: 12%; right: 12%; height: 1.5px; background: rgba(241,217,164,.55); }
.bk-spine::before { top: 14px; }
.bk-spine::after { bottom: 14px; }
.bk-edge-r {
  top: 3px; height: calc(100% - 6px); width: calc(var(--t) - 2px); left: calc(50% - (var(--t) - 2px) / 2);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 3px));
  background:
    linear-gradient(90deg, rgba(0,0,0,.22), transparent 25%, transparent 75%, rgba(0,0,0,.22)),
    repeating-linear-gradient(90deg, #f4ead6 0 1px, #d9cbaf 1px 2px);
}
.bk-edge-t, .bk-edge-b {
  left: 2px; width: calc(100% - 5px); height: calc(var(--t) - 2px); top: calc(50% - (var(--t) - 2px) / 2);
  background:
    linear-gradient(to bottom, rgba(0,0,0,.22), transparent 25%, transparent 75%, rgba(0,0,0,.22)),
    repeating-linear-gradient(to bottom, #f4ead6 0 1px, #d9cbaf 1px 2px);
}
.bk-edge-t { transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 3px)); }
.bk-edge-b { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2 - 3px)); }
.bk .num, .bk .badge { z-index: 3; }
.bk .num {
  position: absolute; left: 12px; top: 7px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; font-weight: 600; font-size: 12px; background: rgba(15, 11, 8, .8); color: var(--ink);
}
.bk .badge {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 999px;
  background: rgba(15, 11, 8, .8); color: var(--ink);
}
.bk .badge.read { color: #b9e6c4; }
.bk .badge.pending { color: #ffd489; }
.cover-item:focus-visible .bk-front { outline: 2px solid var(--accent); outline-offset: -2px; }
.cover-item.missing .bk-front { outline: 2px dashed rgba(240, 160, 138, .75); outline-offset: -4px; }
.cover-item.missing .bk-front img { filter: grayscale(.7) brightness(.72); transition: filter .35s; }
.cover-item.missing:hover .bk-front img { filter: none; }
.cover-item.missing .bk .badge { color: #f5b3a0; }
.flyers { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.flyer .badge, .flyer .num { display: none; }
.flyer { position: fixed; transform-origin: 50% 50%; will-change: transform; }
.cover-item .t { font-family: var(--serif); font-size: 14.5px; line-height: 1.2; font-weight: 600; }
.cover-item .a { font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.cover-item .why { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.cover-item .why b { color: var(--ink-2); font-weight: 500; }
.stars { color: var(--accent); letter-spacing: 1px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2);
  transition: border-color .2s, color .2s;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ ficha de libro */
.card-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(8, 6, 4, .72); backdrop-filter: blur(6px); }
.card-layer[hidden] { display: none; }
.card {
  position: relative; width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  display: grid; grid-template-columns: 250px 1fr; gap: 26px; padding: 26px;
  background: linear-gradient(160deg, #2b2119, #1c1612); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.8);
}
.card-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-size: 20px; line-height: 1; }
.card-cover { --w: 220px; --h: 330px; padding: 6px 0 20px 14px; }
.card-cover .bk { transform: perspective(1100px) translateZ(0px) rotateX(8deg) rotateY(24deg) rotateZ(0deg); }
.card-cover:hover .bk { transform: perspective(1100px) translateZ(0px) rotateX(4deg) rotateY(-28deg) rotateZ(0deg); }
.card-info h3 { margin: 0 0 4px; font-family: var(--serif); font-size: clamp(24px, 3vw, 32px); line-height: 1.1; padding-right: 30px; }
.card-info .by { margin: 0 0 12px; color: var(--ink-2); }
.card-info .by button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.meta span b { color: var(--ink); font-weight: 600; }
.desc { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); white-space: pre-line; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none;
  background: var(--accent); color: #231708; border: 0; cursor: pointer;
}
.btn.secondary { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.status-pill.read { background: rgba(127, 181, 143, .16); color: #b9e6c4; }
.status-pill.pending { background: rgba(224, 166, 74, .16); color: #ffd489; }
.status-pill.missing { background: rgba(210, 105, 75, .16); color: #f5b3a0; }

/* libro volador durante la animación de apertura */
.flyer .badge, .flyer .num { display: none; }
.flyer { position: fixed; z-index: 45; pointer-events: none; border-radius: 3px 6px 6px 3px; overflow: hidden; box-shadow: 0 16px 30px -10px rgba(0,0,0,.8); background: var(--spine); }
.flyer img { width: 100%; height: 100%; object-fit: cover; display: block; }

.foot { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 0 16px calc(30px + env(safe-area-inset-bottom)); line-height: 1.9; }
.foot .install { margin-top: 6px; color: var(--ink); border-color: rgba(224, 166, 74, .5); }
.foot .ios-hint b { color: var(--ink-2); font-weight: 600; }
.foot code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.foot .stale { color: var(--accent); font-weight: 600; }
.foot .chip { padding: 2px 10px; font-size: 12px; }

@media (max-width: 640px) {
  .top { position: static; }
  .piles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 6px; }
  .pile { --W: 84px; --D: 122px; min-height: 250px; }
  .stage { width: 150px; }
  .covers { --w: 96px; --h: 144px; gap: 28px 10px; }
  .card { grid-template-columns: 1fr; padding: 20px; }
  .card-cover { --w: 150px; --h: 225px; }
  .detail-head { flex-direction: column; gap: 8px; }
  .back { margin-top: 0; }
  .segmented button { padding: 7px 11px; font-size: 13px; }
}

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

/* como app instalada: sin selección de texto ni menú al mantener pulsado sobre los libros */
@media (display-mode: standalone) {
  .pile, .cover-item, .segmented { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
