/* ==========================================================================
   Colección Blu-ray — estilos
   Oscuro por defecto (estética de cinemateca); modo claro según el sistema.
   ========================================================================== */

:root {
  --bg: #0b0c0f;
  --bg-elev: #111318;
  --surface: #16181e;
  --surface-2: #1f222a;
  --surface-3: #2a2e38;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f3f4f6;
  --text-2: #c4c7cf;
  --muted: #868b96;
  --accent: #f2c14e;
  --accent-ink: #1a1405;
  --accent-soft: rgba(242, 193, 78, 0.14);
  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);
  --p1: #fb7185;
  --p2: #a78bfa;
  --p3: #2dd4bf;
  --p4: #94a3b8;
  --uhd-bg: #050505;
  --uhd-ink: #f2c14e;
  --bd-bg: #0b5ed7;
  --dvd-bg: #4b5563;
  --shadow-cover: 0 10px 30px -8px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --tabbar-h: 58px;
  --head-pad: max(env(safe-area-inset-top), 12px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f3f0;
    --bg-elev: #faf9f7;
    --surface: #ffffff;
    --surface-2: #efeeea;
    --surface-3: #e3e1dc;
    --line: rgba(20, 20, 30, 0.08);
    --line-strong: rgba(20, 20, 30, 0.15);
    --text: #15161a;
    --text-2: #3d4048;
    --muted: #747782;
    --accent: #b07d0a;
    --accent-ink: #ffffff;
    --accent-soft: rgba(176, 125, 10, 0.12);
    --good: #15803d;
    --good-soft: rgba(21, 128, 61, 0.1);
    --warn: #b45309;
    --warn-soft: rgba(180, 83, 9, 0.1);
    --bad: #dc2626;
    --bad-soft: rgba(220, 38, 38, 0.09);
    --p1: #e11d48;
    --p2: #7c3aed;
    --p3: #0d9488;
    --p4: #64748b;
    --shadow-cover: 0 10px 24px -10px rgba(0, 0, 0, 0.45), 0 2px 5px rgba(0, 0, 0, 0.15);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  overscroll-behavior-y: none;
}
body.no-tabbar { padding-bottom: 0; }
body:has(dialog[open]) { overflow: hidden; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 24px; height: 24px; }

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Cabeceras ---------- */

.page-head {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px; padding: calc(var(--head-pad) + 6px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
}
.page-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--line); opacity: 0; transition: opacity .2s;
}
.scrolled .page-head::after { opacity: 1; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.large-title { font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; margin: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }

/* ---------- Buscador y chips ---------- */

.search {
  position: relative; margin-top: 12px;
}
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; height: 42px; padding: 0 38px 0 40px; border: 0; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 16px; outline: none;
  transition: box-shadow .2s;
}
.search input:focus { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--accent) inset; }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; background: none; color: var(--muted); display: grid; place-items: center;
}
.search .spinner { position: absolute; right: 12px; top: 50%; margin-top: -9px; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 12px; opacity: .65; font-variant-numeric: tabular-nums; }

/* ---------- Resumen ---------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px 10px;
}
.stat b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat.accent b { color: var(--accent); }

/* ---------- Secciones de prioridad ---------- */

.section-head {
  display: flex; align-items: center; gap: 10px; margin: 26px 2px 10px;
}
.section-head .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--pc, var(--muted)); box-shadow: 0 0 12px var(--pc); }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .count { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.section-hint { margin: -6px 2px 10px 22px; font-size: 13px; color: var(--muted); }
.p1 { --pc: var(--p1); } .p2 { --pc: var(--p2); } .p3 { --pc: var(--p3); } .p4 { --pc: var(--p4); }

/* ---------- Carátulas ---------- */

.cover {
  position: relative; aspect-ratio: 620 / 854; border-radius: 6px; overflow: hidden;
  background: var(--surface-2); box-shadow: var(--shadow-cover); flex: none;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { /* brillo sutil de caja */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  background: linear-gradient(115deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 35%);
}
.cover .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 10% 9%; color: rgba(255, 255, 255, .92); font-weight: 750; letter-spacing: -0.01em;
  background:
    radial-gradient(120% 80% at 20% 10%, hsl(var(--h) 60% 45% / .9), transparent 60%),
    linear-gradient(160deg, hsl(var(--h) 45% 22%), hsl(calc(var(--h) + 40) 40% 10%));
  font-size: clamp(9px, 2.6vw, 15px); line-height: 1.15;
}
.cover .ph-band { position: absolute; top: 0; left: 0; right: 0; height: 9%; }
.cover .ph-band.f-uhd { background: var(--uhd-bg); }
.cover .ph-band.f-bd { background: var(--bd-bg); }
.cover .ph-band.f-dvd { background: var(--dvd-bg); }

/* ---------- Filas de la wishlist ---------- */

.rows { display: grid; gap: 8px; }
.row {
  display: flex; gap: 13px; align-items: center; padding: 10px 12px 10px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .15s var(--ease), background .15s;
}
.row:active { transform: scale(.985); background: var(--surface-2); }
.row .cover { width: 54px; border-radius: 5px; }
.row .main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.row .t {
  font-size: 16px; font-weight: 650; line-height: 1.22; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.row .price { text-align: right; flex: none; display: grid; gap: 2px; justify-items: end; }
.row .price b { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.row .price b.none { color: var(--muted); font-weight: 500; font-size: 15px; }
.row .price small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .price .hit { color: var(--good); }

/* ---------- Distintivos ---------- */

.fmt {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; white-space: nowrap;
}
.fmt.f-uhd { background: var(--uhd-bg); color: var(--uhd-ink); box-shadow: inset 0 0 0 1px rgba(242, 193, 78, .35); }
.fmt.f-bd { background: var(--bd-bg); color: #fff; }
.fmt.f-dvd { background: var(--dvd-bg); color: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.gold { background: var(--accent-soft); color: var(--accent); }
.pill .i { width: 12px; height: 12px; stroke-width: 2.5; }

.dot-av { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dot-av::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.av-Disponible { color: var(--good); }
.av-Parcial { color: var(--warn); }
.av-Sin-stock { color: var(--bad); }
.av-Por-comprobar { color: var(--muted); }

/* ---------- Biblioteca (cuadrícula) ---------- */

.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 12px; margin-top: 8px; }
@media (min-width: 560px) { .shelf { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 720px) { .shelf { grid-template-columns: repeat(5, 1fr); } }
.shelf a { display: grid; gap: 7px; transition: transform .15s var(--ease); }
.shelf a:active { transform: scale(.96); }
.shelf .cap { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shelf .cover .fmt { position: absolute; left: 5px; bottom: 5px; z-index: 1; height: 16px; font-size: 9px; padding: 0 4px; }

/* ---------- Detalle ---------- */

.hero { position: relative; margin: 0 -16px; padding: calc(var(--head-pad) + 52px) 16px 8px; overflow: hidden; isolation: isolate; }
.hero-bg {
  position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center;
  filter: blur(40px) saturate(1.4); opacity: .55; transform: scale(1.1);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 30%, transparent) 0%, var(--bg) 92%);
}
.hero-top { display: flex; gap: 16px; align-items: flex-end; }
.hero .cover { width: 128px; border-radius: 8px; }
.hero-info { min-width: 0; flex: 1; display: grid; gap: 6px; padding-bottom: 2px; }
.hero h1 { margin: 0; font-size: 25px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
.hero .orig { font-size: 14px; color: var(--text-2); }
.hero .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }

.floating-back {
  position: fixed; top: calc(var(--head-pad) + 4px); left: max(12px, calc(50% - 368px)); z-index: 30;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(16px) saturate(1.6); -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid var(--line-strong);
}
.floating-back .i { width: 22px; height: 22px; margin-left: -2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.card + .card, .block + .block { margin-top: 12px; }
.block-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 10px; }
.block-title h2 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 4px 0; }

.price-hero { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: end; }
.price-hero .big { font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.price-hero .big.hit { color: var(--good); }
.price-hero .big.none { font-size: 22px; color: var(--muted); font-weight: 650; letter-spacing: -0.01em; }
.price-hero .where { font-size: 14px; color: var(--muted); }
.price-hero .side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--good); }
.meter-label { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.store-list { list-style: none; margin: 14px -16px -16px; padding: 0; border-top: 1px solid var(--line); }
.store-list li { border-bottom: 1px solid var(--line); }
.store-list li:last-child { border-bottom: 0; }
.store {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer;
}
.store:active { background: var(--surface-2); }
.store .logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  font-size: 13px; font-weight: 800; color: #fff; background: var(--surface-3); letter-spacing: -0.02em;
}
.store .name { flex: 1; min-width: 0; }
.store .name b { display: block; font-weight: 600; font-size: 15px; }
.store .name small { color: var(--muted); font-size: 12px; }
.store .amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; }
.store.best .amt { color: var(--good); }
.store.oos .amt { color: var(--muted); font-weight: 500; font-size: 14px; }

.quick-links { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.quick-links::-webkit-scrollbar { display: none; }
.quick-links a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 550;
}
.quick-links a .i { width: 14px; height: 14px; color: var(--muted); }
.links-label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 2px 8px; }
.links-label:first-child { margin-top: 0; }

.specs { display: grid; gap: 0; margin: -4px 0; }
.spec { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec:last-child { border-bottom: 0; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; color: var(--text-2); }
.spec .es { color: var(--good); font-weight: 600; }

.synopsis { color: var(--text-2); font-size: 15px; line-height: 1.55; margin: 0; }
.synopsis.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.notes { white-space: pre-wrap; margin: 0; color: var(--text-2); font-size: 15px; }
.note-card { background: var(--warn-soft); border-color: transparent; }
.note-card .label { font-size: 12px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }

.priority-line { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 15px; }
.priority-line .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--pc); box-shadow: 0 0 12px var(--pc); }

.history { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.history td { padding: 8px 0; border-top: 1px solid var(--line); }
.history tr:first-child td { border-top: 0; }
.history td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details > summary .i { transition: transform .2s; color: var(--muted); }
details[open] > summary .i { transform: rotate(90deg); }

.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

/* Barra de acciones fija del detalle */
.action-bar {
  position: fixed; left: 0; right: 0; z-index: 15;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 10px 16px; display: flex; justify-content: center;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.action-bar .inner { display: flex; gap: 10px; width: 100%; max-width: 728px; }
.action-bar .btn { flex: 1; }
.action-bar .btn.ghost { background: var(--surface-2); }
body.has-action-bar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px); }

/* ---------- Botones ---------- */

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 16px; cursor: pointer;
  transition: transform .12s var(--ease), opacity .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.good { background: var(--good); border-color: transparent; color: #04210f; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); background: transparent; }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }

/* ---------- Formularios ---------- */

.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--bg-elev); color: var(--text); font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23868b96' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 15px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(20px); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; border-radius: 12px; background: var(--surface-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center; min-height: 38px; padding: 4px 6px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--text-2); text-align: center; line-height: 1.15; transition: background .15s, color .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented .p1 input:checked + span, .segmented .p2 input:checked + span,
.segmented .p3 input:checked + span, .segmented .p4 input:checked + span { color: var(--pc); }

/* ---------- Hoja inferior ---------- */

dialog.sheet {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none; width: 100%; height: 100%;
  background: transparent; color: var(--text); display: flex; align-items: flex-end; justify-content: center;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .55); animation: fade .25s var(--ease); }
.sheet-body {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-elev); border-radius: 22px 22px 0 0; border: 1px solid var(--line);
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .32s var(--ease); outline: none;
}
dialog.sheet.closing .sheet-body { animation: down .2s ease-in forwards; }
dialog.sheet.closing::backdrop { opacity: 0; transition: opacity .2s; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
@media (min-width: 700px) {
  dialog.sheet { align-items: center; }
  .sheet-body { border-radius: 22px; padding-bottom: 20px; }
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Añadir: resultados de Mubis ---------- */

.results { display: grid; gap: 8px; margin-top: 12px; }
.result {
  display: flex; gap: 12px; align-items: center; padding: 10px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  transition: transform .15s var(--ease);
}
.result:active { transform: scale(.985); }
.result .cover { width: 50px; border-radius: 4px; }
.result .main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.result .t { font-weight: 650; line-height: 1.22; }
.result .full { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.result .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.result .from { text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.result .from b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.result.owned { opacity: .6; }

.add-preview { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.add-preview .cover { width: 92px; border-radius: 6px; }
.add-preview h4 { margin: 0 0 6px; font-size: 19px; line-height: 1.15; letter-spacing: -0.02em; }

.empty { text-align: center; color: var(--muted); padding: 56px 24px; display: grid; justify-items: center; gap: 10px; }
.empty .i { width: 40px; height: 40px; stroke-width: 1.5; opacity: .6; }
.empty b { color: var(--text-2); font-size: 17px; }

/* ---------- Login ---------- */

.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 8px;
  background: radial-gradient(90% 60% at 50% 0%, var(--accent-soft), transparent 70%);
}
.login-card { width: 100%; max-width: 360px; display: grid; gap: 22px; }
.login-brand { display: grid; justify-items: center; gap: 12px; text-align: center; }
.login-brand img { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow-cover); }
.login-brand h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.login-brand p { margin: 0; color: var(--muted); }
.form-error { color: var(--bad); font-size: 14px; text-align: center; min-height: 20px; margin: -6px 0; }

/* ---------- Ajustes ---------- */

.list-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); min-height: 52px; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .rank { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.list-item button.list-btn { all: unset; display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }
.group-note { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }

/* ---------- Barra inferior ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
  backdrop-filter: saturate(1.8) blur(22px); -webkit-backdrop-filter: saturate(1.8) blur(22px);
  border-top: 1px solid var(--line);
}
.tabbar .inner { display: flex; width: 100%; max-width: 520px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); transition: color .15s;
}
.tabbar a .i { width: 24px; height: 24px; stroke-width: 1.8; }
.tabbar a.active { color: var(--accent); }
.tabbar a.add .bubble {
  width: 40px; height: 32px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.tabbar a.add .i { stroke-width: 2.6; width: 22px; height: 22px; }
.no-tabbar .tabbar { display: none; }

/* ---------- Avisos ---------- */

.offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; text-align: center;
  padding: calc(env(safe-area-inset-top) + 2px) 8px 3px; font-size: 12px; font-weight: 600;
  background: var(--warn); color: #1c1302;
}
.toast {
  position: fixed; left: 50%; z-index: 60; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: toast-in .3s var(--ease);
}
.toast.error { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

.fade-in { animation: fade .25s var(--ease); }

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

/* ---------- Puntuación y análisis ---------- */

:root { --s-top: var(--p1); --s-high: #fb923c; --s-mid: var(--accent); --s-low: var(--p4); }
.s-top { --sc: var(--s-top); } .s-high { --sc: var(--s-high); } .s-mid { --sc: var(--s-mid); }
.s-low { --sc: var(--s-low); } .s-none { --sc: var(--muted); }

.cover-wrap { position: relative; flex: none; }
.score-badge {
  position: absolute; right: -7px; bottom: -6px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  background: var(--surface); color: var(--sc); border: 2px solid var(--sc);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.score-badge .i { width: 13px; height: 13px; stroke-width: 3; }
.score-badge.s-none { border-style: dashed; font-weight: 600; }

.act { font-weight: 650; color: var(--pc); }

.score-ring { position: relative; width: 84px; height: 84px; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 7; }
.score-ring .track { stroke: var(--surface-3); }
.score-ring .bar { stroke: var(--sc); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.score-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

.score-card { display: grid; gap: 14px; }
.score-top { display: flex; gap: 16px; align-items: center; }
.score-top .info { flex: 1; min-width: 0; display: grid; gap: 3px; }
.score-top .lvl { font-size: 13px; font-weight: 700; color: var(--sc); text-transform: uppercase; letter-spacing: .06em; }
.score-top .action { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.score-top .when { font-size: 12.5px; color: var(--muted); }

.factors { display: grid; gap: 2px; }
.factor-group { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.factor-group:first-child { margin-top: 0; }
.factor { display: flex; gap: 10px; align-items: baseline; font-size: 14.5px; padding: 3px 0; color: var(--text-2); }
.factor .pts { flex: none; min-width: 34px; text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.factor .pts.pos { color: var(--good); }
.factor .pts.neg { color: var(--bad); }
.factor .pts.zero { color: var(--muted); }

.adjust { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.adjust .lbl { font-size: 14px; }
.adjust .lbl small { display: block; color: var(--muted); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.stepper button { width: 36px; height: 32px; border: 0; border-radius: 9px; background: var(--surface); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper button:disabled { opacity: .35; }
.stepper output { min-width: 38px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 8px 0; align-items: start; }
.steps .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; background: var(--surface-2); color: var(--muted); }
.steps .st .i { width: 13px; height: 13px; stroke-width: 3; }
.steps .ok .st { background: var(--good-soft); color: var(--good); }
.steps .error .st { background: var(--bad-soft); color: var(--bad); }
.steps .skipped .st { background: var(--surface-2); color: var(--muted); }
.steps .running .st { background: none; }
.steps b { display: block; font-size: 15px; font-weight: 600; }
.steps small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.steps .waiting b { color: var(--muted); font-weight: 500; }

.mini-list { list-style: none; margin: 0 -16px -16px; padding: 0; }
.mini-list li { border-top: 1px solid var(--line); }
.mini-list a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.mini-list a:active { background: var(--surface-2); }
.mini-list .cover { width: 34px; border-radius: 3px; box-shadow: none; }
.mini-list .grow { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.mini-list .grow small { display: block; color: var(--muted); font-size: 12px; }
.mini-list .amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.mini-list .amt.none { color: var(--muted); font-weight: 500; font-size: 13px; }
.mini-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.cta-analyze { display: grid; gap: 10px; justify-items: start; }
.cta-analyze p { margin: 0; color: var(--text-2); font-size: 14.5px; }
