:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f0eee9; --border: #e2dfd8;
  --text: #1f1d1a; --muted: #6d6860; --accent: #4f46e5; --accent-2: #eef0ff; --on-accent: #fff;
  --ok: #15803d; --ok-bg: #e9f7ee; --warn: #b45309; --warn-bg: #fdf3e3; --danger: #b91c1c; --danger-bg: #fdecec;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --cover-l: 88%; --cover-text: #3a3530;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --surface: #1e2026; --surface-2: #272a31; --border: #343842;
    --text: #ecebe8; --muted: #a09c94; --accent: #8b85ff; --accent-2: #2a2950; --on-accent: #12121a;
    --ok: #4ade80; --ok-bg: #16301f; --warn: #fbbf24; --warn-bg: #3a2c10; --danger: #f87171; --danger-bg: #3d1a1a;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --cover-l: 30%; --cover-text: #f2efe9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a; --surface: #1e2026; --surface-2: #272a31; --border: #343842;
  --text: #ecebe8; --muted: #a09c94; --accent: #8b85ff; --accent-2: #2a2950; --on-accent: #12121a;
  --ok: #4ade80; --ok-bg: #16301f; --warn: #fbbf24; --warn-bg: #3a2c10; --danger: #f87171; --danger-bg: #3d1a1a;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --cover-l: 30%; --cover-text: #f2efe9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .4rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .3rem; }
code { background: var(--surface-2); padding: 0 .3em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.cap { text-transform: capitalize; }
.prewrap { white-space: pre-line; }
.grow { flex: 1; }
.danger-txt { color: var(--danger); font-weight: 600; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.topnav { display: none; gap: .25rem; flex: 1; }
.topnav a { color: var(--muted); padding: .4rem .7rem; border-radius: 999px; font-weight: 500; position: relative; }
.topnav a.active, .topnav a:hover { background: var(--accent-2); color: var(--accent); text-decoration: none; }
.settings { margin-left: auto; font-size: 1.3rem; }
.settings.active { color: var(--accent); }
.nbadge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-style: normal; text-align: center; line-height: 1.4; }
.nbadge.danger { background: var(--danger); color: #fff; }
.nbadge[hidden] { display: none; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; padding: .45rem 0 .5rem; font-size: .7rem; color: var(--muted); position: relative; }
.bottomnav a span { font-size: 1.3rem; line-height: 1.3; }
.bottomnav a.active { color: var(--accent); font-weight: 600; }
.bottomnav a:hover { text-decoration: none; }
.bottomnav .nbadge { position: absolute; top: 4px; left: calc(50% + 6px); }
@media (min-width: 860px) {
  .topnav { display: flex; }
  .settings { margin-left: 0; }
  .bottomnav { display: none; }
  body { padding-bottom: 2rem; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 1rem 16px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .55rem 1rem; border-radius: 10px; font: inherit; font-weight: 600; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.sm { padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.big { width: 100%; padding: .9rem; font-size: 1.1rem; margin: 1rem 0; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.05rem; color: var(--muted); padding: .2rem .35rem; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.actions.center { justify-content: center; }
.row-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.fab {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 15;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 2rem; box-shadow: var(--shadow);
}
.fab:hover { text-decoration: none; }
@media (min-width: 860px) { .fab { bottom: 28px; } }

/* Formularios */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .55rem .7rem; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: .8rem; }
.form label.chk, label.chk { flex-direction: row; align-items: center; gap: .45rem; font-weight: 500; }
.form fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 .8rem; padding: .6rem .7rem; }
.form legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.row, .row3 { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; align-items: end; }
.row3 { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .row3 { grid-template-columns: 1fr 1fr 1fr; } }
.form-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .5rem; }
.form-actions.sticky {
  position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--bg);
  padding: .7rem 0; border-top: 1px solid var(--border);
}
@media (min-width: 860px) { .form-actions.sticky { bottom: 0; } }
.page-form { max-width: 760px; }
.photo-field { display: flex; gap: 1rem; align-items: center; margin-bottom: .8rem; }
.photo-ctrls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; flex: 1; }
.photo-ctrls label.small { width: 100%; margin: 0; font-weight: 500; }
.rate { display: flex; gap: .1rem; }
.rate button { background: none; border: 0; font-size: 1.6rem; color: #f59e0b; cursor: pointer; padding: 0 .1rem; line-height: 1; }
.pl-row { display: grid; grid-template-columns: 1fr 80px auto auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.pl-row .win { margin: 0; flex-direction: row; cursor: pointer; }
.pl-row .win input { display: none; }
.pl-row .win span { filter: grayscale(1); opacity: .35; font-size: 1.3rem; }
.pl-row .win input:checked + span { filter: none; opacity: 1; }
.pick-chips { margin: -.4rem 0 .8rem; }
.pick-chips .chip { cursor: pointer; border: 1px dashed var(--border); background: transparent; font: inherit; font-size: .8rem; }

/* Catálogo */
.toolbar { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .5rem; }
.search input { font-size: 1.05rem; padding: .75rem 1rem; border-radius: 12px; }
.filters { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
.filters select { width: auto; flex: 0 0 auto; padding: .4rem .6rem; font-size: .88rem; border-radius: 999px; }
.filters .chk { flex: 0 0 auto; font-size: .88rem; white-space: nowrap; padding: 0 .4rem; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: .2rem 0 .6rem; }
.list-head p { margin: 0; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .12s; }
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.thumb { position: relative; aspect-ratio: 4 / 3; }
.thumb .cover { width: 100%; height: 100%; border-radius: 0; }
.card-body { padding: .55rem .7rem .7rem; }
.card-body h3 { font-size: .98rem; line-height: 1.25; }
.meta { font-size: .8rem; color: var(--muted); }
.meta.loc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.thumb .badge { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.fav { position: absolute; top: 4px; right: 8px; color: #f59e0b; font-size: 1.2rem; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.group { margin: 1.3rem 0 .6rem; font-size: 1.05rem; }
.cover {
  display: grid; place-items: center; overflow: hidden; border-radius: 12px; aspect-ratio: 4 / 3;
  background: hsl(var(--h) 55% var(--cover-l)); color: var(--cover-text); font-weight: 800; font-size: 1.8rem;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.lg { width: 100%; max-width: 280px; font-size: 3rem; }
.cover.sm { width: 110px; font-size: 1.4rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.welcome { text-align: center; max-width: 560px; margin: 3rem auto; }
.welcome-icon { font-size: 3.5rem; }

/* Ficha */
.back { display: inline-block; margin-bottom: .6rem; font-size: .9rem; }
.detail-head { display: grid; gap: 1rem; }
@media (min-width: 700px) { .detail-head { grid-template-columns: 280px 1fr; align-items: start; } }
.detail-head h1 { margin-top: 0; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.fav-btn { font-size: 1.5rem; color: #f59e0b; }
.stars { color: #f59e0b; letter-spacing: .05em; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; margin: .8rem 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .5rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.fact-icon { font-size: 1.2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.chip { display: inline-block; font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--accent-2); color: var(--accent); }
a.chip:hover { text-decoration: none; filter: brightness(.97); }
.status-row { display: grid; gap: .7rem; margin-top: 1rem; }
@media (min-width: 640px) { .status-row { grid-template-columns: 1fr 1fr; } }
.status-box { background: var(--surface); border: 1px solid var(--border); border-left-width: 5px; border-radius: 12px; padding: .7rem .9rem; }
.status-box .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.status-box .value { font-size: 1.1rem; font-weight: 600; margin: .1rem 0; }
.status-box.ok { border-left-color: var(--ok); }
.status-box.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.status-box.danger { border-left-color: var(--danger); background: var(--danger-bg); }
.status-box .btn.sm { margin-top: .4rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin: 1rem 0; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .6rem .8rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.quick { display: grid; gap: .7rem; }
@media (min-width: 760px) { .quick { grid-template-columns: 1fr 1fr; } .quick .qcard:first-child { grid-column: 1 / -1; } }
.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.qcard p { margin: 0; }
.rules { margin: 1rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules div { margin-top: .6rem; }
.sub { margin: 1.3rem 0 .5rem; font-size: 1.05rem; }
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.kvs { display: grid; gap: .5rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .8rem; }

/* Listas */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .5rem; }
.item { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; }
.item.over { border-color: var(--danger); background: var(--danger-bg); }
.item-main { min-width: 0; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex: 0 0 auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; margin: .5rem 0 1rem; font-size: .92rem; }
.table th, .table td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table td:not(:first-child), .table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* ¿Qué jugamos? */
.picker { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
@media (min-width: 760px) { .picker { grid-template-columns: repeat(4, 1fr); } }
.picker label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.stepper { display: flex; flex-direction: column; gap: .3rem; }
.stepper .label { font-weight: 600; font-size: .9rem; }
.stepper div { display: flex; align-items: center; gap: .6rem; }
.stepper b { font-size: 1.5rem; min-width: 2ch; text-align: center; }
.pick-card { display: grid; gap: 1rem; background: var(--accent-2); border: 2px solid var(--accent); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; animation: pop .3s ease; }
@media (min-width: 640px) { .pick-card { grid-template-columns: 220px 1fr; align-items: center; } }
.pick-card h2 { font-size: 1.6rem; margin: 0 0 .2rem; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }

/* Estadísticas */
.kpis { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-bottom: 1rem; }
.kpis.sm { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.kpi b { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpis.sm .kpi b { font-size: 1.1rem; }
.kpi span { font-size: .8rem; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.panel textarea { margin-bottom: .6rem; }
.panel .row { margin-bottom: .6rem; }
.panel .row label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.danger-zone { border-color: var(--danger); }
.bars { display: grid; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 2.5rem; gap: .5rem; align-items: center; color: var(--text); font-size: .9rem; }
a.bar-row:hover { text-decoration: none; color: var(--accent); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 170px; align-items: end; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.col-bar { width: 70%; max-width: 32px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.col-val { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-label { font-size: .7rem; color: var(--muted); margin-top: 4px; }

/* Modal */
dialog { border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,10,20,.5); }
.modal-inner { padding: 1.2rem; }
.modal-inner h2 { margin-top: 0; }
dialog.full { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
dialog.full .modal-inner { height: 100%; padding: 0; }
.explain { display: flex; flex-direction: column; height: 100%; max-width: 900px; margin: 0 auto; padding: 1rem 16px; }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 700; }
.ex-body { flex: 1; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; padding: 1rem 0; }
.ex-body h2 { font-size: clamp(1.6rem, 5vw, 2.6rem); margin-bottom: 1rem; }
.ex-body p { font-size: clamp(1.15rem, 3.2vw, 1.6rem); line-height: 1.55; margin: 0; }
.ex-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-bottom: env(safe-area-inset-bottom); }
.dots { display: flex; gap: .35rem; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.dots span.on { background: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: .65rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 860px) { #toast { bottom: 28px; } }

/* ---------- Fase 1: BGG, escáner, lote, asistente ---------- */
.ok-txt { color: var(--ok); font-weight: 600; }
.inline-form { display: flex; gap: .4rem; align-items: stretch; margin-bottom: .6rem; }
.inline-form input { flex: 1; }
.form .inline-form { margin-bottom: 0; }
.list-tools { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; justify-content: flex-end; }
.list-head { flex-wrap: wrap; gap: .4rem; }
.list-tools .nbadge { margin-left: .2rem; }
.selecting .card { cursor: pointer; position: relative; }
.selecting .card::after { content: ''; position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(0,0,0,.25); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.selecting .card.selected { border-color: var(--accent); outline: 3px solid var(--accent); }
.selecting .card.selected::after { content: '✓'; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: center;
  width: min(760px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; padding: .5rem .6rem; box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.selbar[hidden] { display: none; }
.sel-count { margin-right: .3rem; }
@media (min-width: 860px) { .selbar { bottom: 20px; } }
.bgg-results { max-height: 50vh; overflow-y: auto; }
.bgg-list { list-style: none; padding: 0; margin: .3rem 0; display: grid; gap: .3rem; }
.bgg-item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .5rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: .5rem .7rem; font: inherit; }
.bgg-item:hover:not(:disabled) { border-color: var(--accent); }
.bgg-item:disabled { opacity: .6; cursor: default; }
.bgg-item.loading { opacity: 1; border-color: var(--accent); }
.bgg-item.loading::after { content: 'cargando…'; font-size: .8rem; color: var(--accent); }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .6rem 0; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress.big { height: 12px; }
.scan-box { border-radius: 12px; overflow: hidden; background: #000; }
.scan-box:empty { display: none; }
.scan-video { width: 100%; max-height: 50vh; display: block; object-fit: cover; }
.chip.on, .chips .chip.pick.on { background: var(--accent); color: var(--on-accent); }
.inv-modes .chip, .chip.pick { border: 0; cursor: pointer; font: inherit; font-size: .82rem; }
.inv-card h3 { margin: 1rem 0 .4rem; }
.inv-head { display: flex; gap: 1rem; align-items: center; }
.inv-head label { display: flex; flex-direction: column; gap: .2rem; }
.inv-head input { font-size: 1.1rem; font-weight: 700; }
.inv-card .row label, label.stack { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }
.tip { border-color: var(--accent); background: var(--accent-2); }
.tip .actions { margin-bottom: 0; }
.howto { margin: .4rem 0 .8rem; }
.howto summary { cursor: pointer; font-weight: 600; }
#list.selecting ~ .fab { display: none; }

/* ---------- Fases 2-6 ---------- */
.nbadge.info { background: var(--ok); color: #fff; margin-left: .15rem; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex: 0 0 auto; margin-left: auto; cursor: help; }
.sync-dot[data-s="ok"] { background: var(--ok); }
.sync-dot[data-s="run"] { background: var(--accent); animation: pulse 1s infinite; }
.sync-dot[data-s="err"] { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
@media (min-width: 860px) { .sync-dot { margin-left: 0; } }
.settings { margin-left: .6rem; }
.alerts { display: grid; gap: .4rem; margin: .4rem 0 .6rem; }
.alert { display: block; padding: .55rem .8rem; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: .9rem; border: 1px solid var(--border); }
.alert:hover { text-decoration: none; border-color: var(--accent); }
.alert.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.alert.info { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.two-col { display: grid; gap: 1rem; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.num { max-width: 90px; }
.inline-select { width: auto; padding: .2rem .5rem; }
.pick-btns { display: grid; gap: .5rem; grid-template-columns: 1fr; margin: 1rem 0; }
.pick-btns .btn.big { margin: 0; }
@media (min-width: 640px) { .pick-btns { grid-template-columns: 2fr 1fr; } }

/* Armario */
.armario { display: grid; gap: 1rem; margin-top: 1rem; }
.mueble { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.balda { border-bottom: 6px solid color-mix(in srgb, var(--text) 25%, transparent); padding: .5rem 0 .2rem; margin-bottom: .6rem; border-radius: 2px; min-height: 64px; }
.balda.over { background: var(--accent-2); }
.balda-name { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.lomos { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; margin-top: .3rem; }
.lomo { display: inline-block; padding: .55rem .5rem; min-width: 34px; max-width: 170px; border-radius: 4px 4px 1px 1px; font-size: .78rem; font-weight: 600;
  background: hsl(var(--h, 220) 50% var(--cover-l)); color: var(--cover-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(0,0,0,.12); cursor: grab; }
.lomo:hover { text-decoration: none; outline: 2px solid var(--accent); }
.lomo.fuera { background: repeating-linear-gradient(45deg, var(--warn-bg), var(--warn-bg) 6px, transparent 6px, transparent 12px); color: var(--warn); border-style: dashed; }
.lomo.mesa { outline: 2px dashed var(--accent); }
.lomo.hit { outline: 3px solid var(--danger); transform: translateY(-4px); }
.lomo.dim { opacity: .25; }
.lomo.demo { cursor: default; padding: .1rem .4rem; }

/* Etiquetas */
.labels { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-top: 1rem; }
.labels.size-s { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.labels.size-l { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.label { display: flex; gap: 8px; align-items: center; background: #fff; color: #111; border: 1px dashed #999; border-radius: 6px; padding: 6px; break-inside: avoid; }
.label svg { width: 64px; height: 64px; flex: 0 0 auto; }
.size-s .label svg { width: 48px; height: 48px; }
.size-l .label svg { width: 96px; height: 96px; }
.label-txt { display: flex; flex-direction: column; font-size: .8rem; line-height: 1.2; min-width: 0; }
.label-txt span { color: #555; font-size: .7rem; }
.pub-qr svg { width: 120px; height: 120px; background: #fff; padding: 6px; border-radius: 8px; }
.share-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
@media print {
  .topbar, .bottomnav, .no-print, .fab, #toast { display: none !important; }
  body { background: #fff; padding: 0; }
  .container { max-width: none; padding: 0; }
  .labels { gap: 4px; }
}

/* Componentes */
.table.comp tr.falta td { color: var(--danger); font-weight: 600; }
.mini-step { display: inline-flex; align-items: center; gap: .2rem; }
.mini-step b { min-width: 1.5ch; text-align: center; }

/* IA */
.ai-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; background: var(--accent-2); border: 1px solid var(--accent); border-radius: 12px; padding: .5rem .7rem; margin-bottom: 1rem; }
.ai-title { font-weight: 700; margin-right: .3rem; }
.chat { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; padding: .2rem; }
.msg { padding: .55rem .8rem; border-radius: 12px; max-width: 90%; font-size: .93rem; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.msg.assistant { align-self: flex-start; background: var(--surface-2); }

/* Fotos de partidas */
.play-photos { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.play-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

/* Noches y votación */
.vote-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: .3rem; max-width: 260px; }
.vote-bar span { display: block; height: 100%; background: var(--accent); }
.item.chosen { border-color: var(--ok); background: var(--ok-bg); }

/* Herramientas de mesa */
.score-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.score { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem; text-align: center; }
.score.lead { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }
.score-name { font-weight: 700; }
.score-val { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.score-btns { display: flex; gap: .25rem; justify-content: center; margin: .3rem 0; flex-wrap: wrap; }
.score .inline-form { margin: 0; }
.stepper-inline { display: flex; align-items: center; gap: .4rem; }
.spin { font-size: clamp(1.8rem, 8vw, 3rem); font-weight: 800; text-align: center; padding: 1.5rem .5rem; }
.spin.rolling { color: var(--muted); }
.dice { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1rem 0; min-height: 70px; }
.die { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; background: var(--surface-2); border: 2px solid var(--border); animation: pop .3s ease; }
.big-total { font-size: 1.3rem; font-weight: 700; }
.clock { text-align: center; border-radius: var(--radius); background: var(--surface-2); padding: 1.5rem .5rem; margin: 1rem 0; cursor: pointer; user-select: none; }
.clock-name { font-size: 1.3rem; font-weight: 700; }
.clock-time { font-size: clamp(3rem, 18vw, 6rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.clock.low { background: var(--warn-bg); color: var(--warn); }
.clock.over { background: var(--danger-bg); color: var(--danger); }

/* Logros */
.achievements { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ach { display: flex; flex-direction: column; gap: .15rem; padding: .6rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); opacity: .7; }
.ach.ok { opacity: 1; background: var(--ok-bg); border-color: var(--ok); }
.ach-icon { font-size: 1.5rem; filter: grayscale(1); }
.ach.ok .ach-icon { filter: none; }
.ach .progress { height: 5px; margin: .2rem 0 0; }
@media (max-width: 520px) {
  .table { font-size: .82rem; }
  .table th, .table td { padding: .4rem .45rem; }
  .table th { font-size: .68rem; letter-spacing: 0; }
}

/* ---------- Cuentas: acceso y aviso de cuenta ajena ---------- */
body.auth-mode { padding-bottom: 0; }
body.auth-mode .topbar, body.auth-mode .bottomnav { display: none; }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-size: 1.3rem; margin-bottom: 1rem; }
.auth-card .btn.primary { width: 100%; justify-content: center; }
.impersonation { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: center; padding: .5rem max(12px, env(safe-area-inset-left)); background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn); font-size: .9rem; text-align: center; }
