:root {
  --bg: #0b1020;
  --bg2: #121a30;
  --panel: #151e36;
  --panel2: #1b2643;
  --line: #27345a;
  --text: #e9edf7;
  --muted: #8b95ad;
  --gold: #e8c36a;
  --gold2: #b8913b;
  --accent: #5aa9ff;
  --danger: #ff6b6b;
  --ok: #3fb68b;
  --origins: #d9534f;
  --spiritforged: #3fb68b;
  --unleashed: #8a63d2;
  --vendetta: #e07a2e;
  --radiance: #e8c36a;
  --provinggrounds: #4a8fd9;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #22164a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.spacer { flex: 1; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: rgba(11, 16, 32, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--gold); font-size: 26px; }
.brand-title { font-family: Cinzel, serif; font-weight: 700; letter-spacing: .06em; color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: 0; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--text); background: var(--panel); }
.tabs button.active { color: var(--text); background: var(--panel2); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
body.live .live-dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(63,182,139,.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(63,182,139,0); } 100% { box-shadow: 0 0 0 0 rgba(63,182,139,0); } }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nick { font-weight: 600; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h2 { margin: 0 0 4px; font-family: Cinzel, serif; letter-spacing: .03em; }
.view-head p { margin: 0; max-width: 640px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.save-status { font-size: 13px; color: var(--muted); margin-right: 4px; }
.save-status.dirty { color: var(--gold); }

/* buttons */
.btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 16px; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.btn:hover:not(:disabled) { border-color: var(--gold2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #1a1406; border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted);
}
.chip.active { color: var(--text); border-color: var(--gold2); background: var(--panel2); }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: 12px; }
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--line); }
.icon-btn:disabled { opacity: .25; cursor: default; }

/* auth */
.auth-card {
  max-width: 520px; margin: 40px auto; padding: 32px;
  background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 18px;
}
.auth-card h1 { font-family: Cinzel, serif; font-size: 26px; margin: 0 0 10px; color: var(--gold); line-height: 1.25; }
.auth-switch { display: flex; gap: 8px; margin: 20px 0 16px; flex-wrap: wrap; }
form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
form input, .inline-form input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
}
form input:focus, .pool-search:focus { outline: 2px solid var(--gold2); outline-offset: -1px; }
#auth-form .btn { width: 100%; margin: 6px 0 10px; padding: 12px; }
dialog.auth-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; }
.auth-dialog .auth-switch { margin: 14px 0 16px; }
.auth-reason { margin: 8px 0 0; }
.form-hint { font-size: 12px; margin: -4px 0 8px; }
.auth-intro { margin: 10px 0 14px; }
.success {
  color: var(--ok); background: rgba(63,182,139,.1); border: 1px solid rgba(63,182,139,.35);
  padding: 10px 12px; border-radius: 9px; font-size: 14px; margin: 10px 0 14px;
}
/* campo trampa para bots: fuera de la pantalla, no se ve ni se puede tabular */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.captcha { margin: 4px 0 10px; min-height: 65px; }
.link-btn { display: block; margin: 2px auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 14px; padding: 6px; }
.link-btn:hover { color: var(--text); }
.userbox .btn.nick { font-weight: 700; }
.guest-banner {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; padding: 18px 20px;
  background: linear-gradient(90deg, rgba(232,195,106,.14), rgba(138,99,210,.10)); border: 1px solid var(--gold2); border-radius: var(--radius);
}
.guest-banner > div:first-child { flex: 1; min-width: 260px; }
.guest-banner strong { font-family: Cinzel, serif; color: var(--gold); font-size: 18px; }
.guest-banner p { margin: 6px 0 0; }
.guest-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; max-width: 480px; }
.inline-form input { margin: 0; }

/* board */
.board { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 20px; align-items: start; }
.pool, .slots-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.pool { position: sticky; top: 80px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.pool-head { padding: 12px; border-bottom: 1px solid var(--line); }
.pool-search { width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.set-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.set-filters .chip { padding: 3px 9px; font-size: 12px; }
.pool-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.pool-card {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--bg2); border: 1px solid transparent; border-radius: 10px; padding: 7px 10px;
  transition: border-color .12s, transform .12s;
}
.pool-card:hover:not(:disabled) { border-color: var(--line); transform: translateX(2px); }
.pool-card.selected { border-color: var(--gold); background: #2a2440; box-shadow: 0 0 0 3px rgba(232,195,106,.15); }
.pool-card:disabled { cursor: default; opacity: .6; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; margin: 0; }

.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff;
  background: #444; border: 2px solid rgba(255,255,255,.12);
}
.card-thumb {
  flex: none; width: 40px; height: 56px; object-fit: cover; border-radius: 4px;
  background: var(--panel2); border: 1px solid rgba(255,255,255,.12); cursor: zoom-in;
}
.card-preview {
  position: fixed; z-index: 100; width: 240px; height: 335px; border-radius: 12px; pointer-events: none;
  box-shadow: 0 18px 50px rgba(0,0,0,.6); opacity: 0; transform: scale(.96); transition: opacity .12s, transform .12s;
}
.card-preview.show { opacity: 1; transform: none; }
.set-origins { background: var(--origins); }
.set-spiritforged { background: var(--spiritforged); }
.set-unleashed { background: var(--unleashed); }
.set-vendetta { background: var(--vendetta); }
.set-radiance { background: var(--radiance); color: #2a1f00; }
.set-provinggrounds { background: var(--provinggrounds); }
.lg-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lg-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-title { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.slots-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.progress { flex: 1; height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); transition: width .25s; }
.slot-section + .slot-section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; flex-wrap: wrap; }
.section-title { font-family: Cinzel, serif; font-weight: 700; color: var(--gold); letter-spacing: .03em; }
.section-range { font-size: 13px; color: var(--muted); }
.section-count { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 99px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.section-count.done { color: var(--ok); }
.slots { list-style: none; margin: 0; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.slot {
  display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 6px 8px 6px 6px;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.slot.filled { border-style: solid; border-color: transparent; }
.slot:hover { border-color: var(--line); }
.board.has-selection .slot.target { border-color: rgba(232,195,106,.45); }
.board.has-selection .slot.target:hover, .slot.over { border-color: var(--gold); background: #231f3a; }
.slot.selected { border: 1px solid var(--gold); background: #2a2440; }
.slot.next:not(.filled) { border-color: rgba(90,169,255,.5); }
.pos {
  flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; background: var(--panel2); color: var(--muted);
}
.slot.p1 .pos { background: linear-gradient(180deg, #f3d98a, #b8913b); color: #2a1f00; }
.slot.p2 .pos { background: linear-gradient(180deg, #e3e8f2, #8f9bb3); color: #1a2030; }
.slot.p3 .pos { background: linear-gradient(180deg, #e2a676, #9a5c33); color: #2a1406; }
.slot-placeholder { color: var(--muted); font-size: 13px; opacity: .7; }
.slot-actions { display: flex; gap: 0; opacity: 0; transition: opacity .12s; }
.slot:hover .slot-actions, .slot.selected .slot-actions { opacity: 1; }
.board.readonly .slot { cursor: default; }

.my-score { background: linear-gradient(90deg, rgba(232,195,106,.18), transparent); border: 1px solid var(--gold2); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }

/* tables */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th[data-sort]::after { content: '↕'; margin-left: 6px; opacity: .35; }
.table th.sorted { color: var(--gold); }
.table th.sorted[data-dir="desc"]::after { content: '↓'; opacity: 1; }
.table th.sorted[data-dir="asc"]::after { content: '↑'; opacity: 1; }
.table td { padding: 8px 14px; border-bottom: 1px solid rgba(39,52,90,.5); }
.table tr:last-child td { border-bottom: 0; }
.table tr.me td { background: rgba(232,195,106,.08); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 700; color: var(--gold); }
.lg-inline { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.bar { height: 8px; min-width: 2px; border-radius: 99px; background: linear-gradient(90deg, var(--gold2), var(--gold)); max-width: 80px; }
.empty-state { text-align: center; padding: 60px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.empty-state .big { font-size: 40px; }

/* admin */
.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }

/* dialog */
dialog {
  width: min(560px, calc(100vw - 32px)); padding: 20px; border-radius: 16px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
dialog::backdrop { background: rgba(5, 8, 18, .7); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h3 { margin: 0; font-family: Cinzel, serif; }
dialog .auth-switch { margin: 14px 0 10px; }
#export-text { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; resize: vertical; font-size: 14px; line-height: 1.5; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* compartir */
dialog.share-dialog { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.share-dialog .dialog-head { gap: 12px; }
.share-dialog .dialog-head h3 { flex: 1; }
.share-format { display: flex; gap: 6px; }
.share-preview {
  position: relative; margin-top: 14px; border-radius: 12px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line);
  aspect-ratio: 16 / 9; display: grid; place-items: center;
}
.share-preview.portrait { aspect-ratio: 9 / 16; height: min(62vh, 760px); margin-left: auto; margin-right: auto; }
.share-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.share-loading { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted); background: var(--bg); }
.share-preview.loading .share-loading { display: grid; }
.share-preview.loading img { visibility: hidden; }
.share-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.share-hint { margin: 0; flex: 1; min-width: 220px; }
.share-buttons { display: flex; gap: 8px; }
.btn.big { padding: 11px 28px; font-size: 16px; }
.share-text { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.share-text summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.share-text summary:hover { color: var(--text); }
@media (max-width: 820px) {
  dialog.share-dialog { padding: 14px; }
  .share-buttons { width: 100%; }
  .share-buttons .btn { flex: 1; }
  .share-preview.portrait { height: min(58vh, 640px); }
}

/* ---------- selector de evento ---------- */
.event-bar { display: flex; gap: 10px; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.event-chip {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 16px; min-width: 180px;
}
.event-chip:hover { border-color: var(--gold2); }
.event-chip.active { border-color: var(--gold); background: linear-gradient(180deg, rgba(232,195,106,.14), var(--panel)); }
.event-name { font-family: Cinzel, serif; font-weight: 700; color: var(--text); }
.event-chip.active .event-name { color: var(--gold); }
.event-meta { font-size: 12px; color: var(--muted); }
.event-status.open { color: var(--ok); }
.event-status.closed { color: var(--gold); }
.event-status.results { color: var(--accent); }

/* ---------- aviso en resultados ---------- */
.notice {
  margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius);
  background: rgba(90,169,255,.08); border: 1px solid rgba(90,169,255,.35);
}
.notice strong { color: var(--accent); }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- enlace público ---------- */
.share-link { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); display: grid; gap: 10px; }
.share-link p { margin: 4px 0 0; font-size: 13px; }
.share-link > .btn { justify-self: start; }
.share-link-ready { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-link-ready[hidden] { display: none; }
.share-link-ready input { flex: 1; min-width: 200px; padding: 9px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.share-link-ready .link-btn { margin: 0; }
.public-board .slot { cursor: default; }

/* ---------- "How it works" ---------- */
.tab-link { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; }
.tab-link:hover { color: var(--text); background: var(--panel); }
.tab-link.active { color: var(--text); background: var(--panel2); }
.userbox .btn { text-decoration: none; }
.userbox .btn.primary { color: #1a1406; }
.guest-actions .btn { text-decoration: none; color: var(--text); }
.public-intro { margin: -4px 0 16px; padding: 12px 16px; border-radius: var(--radius); background: rgba(232,195,106,.08); border: 1px solid rgba(232,195,106,.3); }
.public-intro p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }
.public-intro strong { color: var(--gold); }
.public-intro a { color: var(--gold); }
.about .lead { font-size: 17px; line-height: 1.6; }
.about h3 { font-size: 15px; margin: 18px 0 4px; }
.about .btn { text-decoration: none; display: inline-block; }
.about .btn.primary { color: #1a1406; }
.steps { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.steps p { margin: 4px 0 0; color: var(--muted); }
.step-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #1a1406;
}

/* ---------- pie y página de privacidad ---------- */
.site-footer { max-width: 1200px; margin: 24px auto 0; padding: 20px 24px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.site-footer p { margin: 0 0 8px; }
.site-footer a, .form-hint a, .legal a { color: var(--gold); }
.brand-link { color: inherit; text-decoration: none; }
.legal { max-width: 760px; }
.legal h1 { font-family: Cinzel, serif; color: var(--gold); margin: 8px 0 4px; }
.legal h2 { font-family: Cinzel, serif; font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { line-height: 1.65; }
.legal ul { padding-left: 20px; }
.legal-back { margin-top: 32px; }
.legal-back .btn { text-decoration: none; display: inline-block; color: var(--text); }

/* ---------- selector de leyendas (hoja inferior en móvil) ---------- */
.board > *, .slots > .slot, .pool-card, .picker-item { min-width: 0; }
.mobile-only { display: none; }
dialog.picker-dialog {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%;
  height: min(86dvh, 760px); max-height: none; padding: 0;
  border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0;
  background: var(--panel); color: var(--text);
}
dialog.picker-dialog[open] { display: flex; flex-direction: column; animation: sheet-up .18s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 10px; }
.picker-title { font-family: Cinzel, serif; font-weight: 700; color: var(--gold); font-size: 20px; }
.picker-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.picker-msg { color: var(--ok); }
.picker-head .icon-btn { font-size: 18px; padding: 6px 10px; }
.picker-tools { padding: 0 16px 8px; border-bottom: 1px solid var(--line); }
.picker-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.picker-filters .chip { flex: none; }
.picker-list { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.picker-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 64px;
  background: var(--bg2); border: 1px solid transparent; border-radius: 10px; padding: 6px 10px;
}
.picker-item:active { border-color: var(--gold); }
.picker-item.current { border-color: var(--gold2); opacity: .7; }
.picker-item .card-thumb { width: 42px; height: 59px; }
.picker-pos { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel2); border-radius: 99px; padding: 3px 9px; }
.picker-group { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 6px 4px; }
.picker-foot { display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.picker-foot .btn { flex: 1; padding: 12px; }

/* ---------- móvil ---------- */
@media (max-width: 820px) {
  .mobile-only { display: inline; }
  .desktop-only { display: none; }
  input, textarea, select { font-size: 16px !important; } /* evita el zoom automático de iOS */

  /* cabecera compacta: marca + usuario arriba, pestañas a lo ancho debajo */
  .topbar { padding: 8px 12px 0; gap: 6px 10px; }
  .brand-mark { font-size: 20px; }
  .brand-title { font-size: 15px; }
  .brand-sub { display: none; }
  .userbox { gap: 6px; min-width: 0; }
  .userbox .nick { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .tabs { order: 3; width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; overflow: visible; }
  .tabs button, .tab-link { justify-content: center; white-space: nowrap; font-size: 14px; padding: 10px 4px; border-radius: 8px 8px 0 0; }
  .guest-actions { flex-wrap: wrap; }
  .tabs button.active { box-shadow: inset 0 -2px 0 var(--gold); }

  main { padding: 14px 12px; }
  .view-head { margin-bottom: 12px; }
  .view-head h2 { font-size: 20px; }
  .view-head p { font-size: 14px; }

  .event-bar { margin-bottom: 12px; gap: 8px; }
  .event-chip { min-width: 0; padding: 8px 12px; }
  .event-name { font-size: 14px; }
  .public-actions { width: 100%; }
  .public-actions .btn { flex: 1; }
  .guest-banner { padding: 14px; gap: 12px; margin-bottom: 14px; }
  .guest-banner strong { font-size: 16px; }
  .guest-banner p { font-size: 14px; }
  .guest-actions { width: 100%; }
  .guest-actions .btn { flex: 1; padding: 11px; }

  /* tablero: en móvil no hay lista lateral; se elige desde el hueco */
  .board { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .board .pool { display: none; }
  .slots-head { padding: 10px 12px; }
  .section-head { padding: 10px 12px 0; gap: 8px; }
  .section-range { font-size: 12px; }
  .slots { grid-template-columns: minmax(0, 1fr); padding: 8px; gap: 5px; }
  .slot { min-height: 62px; gap: 8px; padding: 5px 4px 5px 6px; }
  .slot .card-thumb { width: 36px; height: 50px; }
  .slot-actions { opacity: 1; }
  .slot-actions .icon-btn { padding: 8px 7px; font-size: 13px; }
  .slot.empty .slot-placeholder { color: var(--accent); opacity: .85; }

  /* barra de acciones fija abajo */
  body.has-actionbar main { padding-bottom: 20px; }
  body.has-actionbar .site-footer { padding-bottom: 130px; }
  .site-footer { padding: 16px 12px 24px; }
  body.has-actionbar #view-predict .head-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(11, 16, 32, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  body.has-actionbar #view-predict .head-actions .save-status { grid-column: 1 / -1; text-align: center; font-size: 12px; margin: 0; min-height: 15px; }
  body.has-actionbar #view-predict .head-actions .btn { padding: 11px 4px; font-size: 14px; }
  body.has-actionbar .toast { bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { max-width: calc(100vw - 32px); text-align: center; }

  /* tablas: más compactas, con la leyenda fija al deslizar */
  .table th, .table td { padding: 8px; font-size: 13px; }
  .table th { font-size: 11px; }
  #community-table { min-width: 560px; }
  #community-table .lg-title { display: none; }
  #community-table .lg-inline { min-width: 120px; gap: 8px; }
  #community-table .card-thumb { width: 30px; height: 42px; }
  #community-table th:nth-child(1), #community-table td:nth-child(1) { position: sticky; left: 0; width: 34px; min-width: 34px; background: var(--panel); z-index: 1; }
  #community-table th:nth-child(2), #community-table td:nth-child(2) { position: sticky; left: 34px; background: var(--panel); z-index: 1; box-shadow: 6px 0 8px -6px rgba(0,0,0,.6); }

  /* ventanas */
  dialog.share-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .share-dialog .dialog-head h3 { font-size: 16px; }
  .share-preview.portrait { height: calc(100dvh - 250px); max-height: 640px; }
  .share-hint { font-size: 14px; }
  dialog.auth-dialog { padding: 18px; }
  .admin-bar { gap: 8px; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel2); border: 1px solid var(--gold2); padding: 10px 18px; border-radius: 10px; transition: .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 16px; }
  .board { grid-template-columns: 1fr; }
  .pool { position: static; max-height: 340px; }
  .slots { grid-template-columns: 1fr; }
  .slot-actions { opacity: 1; }
  .auth-card { margin: 16px auto; padding: 22px; }
}
