/* Paleta RankID.
   Light: blanco de fondo, detalles en negro #08090D, botones y detalles en azul #087BFF.
   Dark: se intercambian blanco y negro; el azul queda igual.
   Sigue el modo del teléfono, salvo que el usuario elija uno a mano (data-theme en <html>). */
:root {
  --bg: #FFFFFF;
  --surface: #F5F7FA;
  --surface-2: #EBEEF3;
  --line: #E1E5EC;
  --text: #08090D;
  --muted: #5E6472;
  --accent: #087BFF;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6F1FF;
  --danger: #E5354A;
  --gold: #F5B70A;
  --gold-ink: #A26F00;
  --silver-ink: #6B7380;
  --bronze-ink: #B0602A;
  --overlay: rgba(8, 9, 13, 0.45);
  --shadow: 0 10px 30px -18px rgba(8, 9, 13, 0.35);
  color-scheme: light;
  --radius: 18px;
  --display: 'Outfit', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08090D;
    --surface: #13151B;
    --surface-2: #1C1F27;
    --line: #2A2E38;
    --text: #FFFFFF;
    --muted: #9AA1AF;
    --accent: #087BFF;
    --accent-ink: #FFFFFF;
    --accent-soft: #0B2546;
    --danger: #FF5D6C;
    --gold: #FFD25A;
    --gold-ink: #FFD25A;
    --silver-ink: #CFD6E4;
    --bronze-ink: #E39A62;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08090D;
  --surface: #13151B;
  --surface-2: #1C1F27;
  --line: #2A2E38;
  --text: #FFFFFF;
  --muted: #9AA1AF;
  --accent: #087BFF;
  --accent-ink: #FFFFFF;
  --accent-soft: #0B2546;
  --danger: #FF5D6C;
  --gold: #FFD25A;
  --gold-ink: #FFD25A;
  --silver-ink: #CFD6E4;
  --bronze-ink: #E39A62;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--body);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; line-height: 1.05; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; font: 800 21px/1 var(--display); letter-spacing: -0.02em; color: var(--text); }
.brand-mark { width: 30px; height: 29px; flex: none; color: var(--text); }
.brand-name b { color: var(--accent); font-weight: 800; }
.theme-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); flex: none; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 360px) { .brand-name { display: none; } }
.balance {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.balance b { font-weight: 700; }
.balance small { color: var(--muted); font-size: 11px; font-weight: 600; }
.coin {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font: 800 12px/1 var(--display);
}
.balance.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }

/* ---------- Layout ---------- */
.view {
  max-width: 640px; margin: 0 auto;
  padding: 16px 16px 8px;
  outline: none;
}
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 12px var(--safe-b);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: var(--tabbar-h); color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--text); }
.tab-cta .plus {
  display: grid; place-items: center; width: 52px; height: 52px; margin-top: -26px;
  border-radius: 18px; background: var(--accent); color: var(--accent-ink);
  font: 700 30px/1 var(--display); box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform .15s;
}
.tab-cta:active .plus { transform: scale(.92); }
.tabbar a.tab-cta.active { color: var(--accent); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 15px; transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.sm { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 12px 0 4px; }
.hero h1 { font-size: clamp(34px, 10vw, 52px); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 12px 0 0; color: var(--muted); font-size: 16px; max-width: 34ch; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.step { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.step b { display: block; font: 800 22px/1 var(--display); color: var(--accent); margin-bottom: 6px; }
.step span { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: block; }

/* ---------- Tarjetas de categoría ---------- */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-card {
  box-shadow: var(--shadow);
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 4 / 5; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s;
}
.cat-card:active { transform: scale(.98); }
.cat-card .bgimg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.cat-card::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, transparent) 0%, transparent 40%, color-mix(in srgb, var(--bg) 92%, transparent) 82%);
}
.cat-card .pf { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--c); color: #fff; }
.cat-card .pf svg { width: 20px; height: 20px; fill: currentColor; }
.cat-card h3 { font-size: 19px; font-weight: 800; }
.cat-card .meta { margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.cat-card .meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.cat-card .leader { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
.cat-card .leader span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crown { color: var(--gold-ink); flex: none; }

/* ---------- Ranking ---------- */
.rank-head {
  position: relative; overflow: hidden; margin: -16px -16px 0; padding: 22px 16px 20px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c) 38%, transparent), transparent 60%);
}
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.rank-head .pf { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--c); color: #fff; margin-bottom: 14px; }
.rank-head .pf svg { width: 24px; height: 24px; fill: currentColor; }
.rank-head h1 { font-size: clamp(28px, 8.4vw, 40px); font-weight: 800; }
.rank-head .stats { display: flex; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.rank-head .stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.rank-head .live { display: inline-flex; align-items: center; gap: 6px; }
.rank-head .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.rank-cta { display: flex; gap: 10px; margin-top: 18px; }
.rank-cta .btn { flex: 1; }

.leader-card {
  position: relative; margin-top: 18px; border-radius: 22px; overflow: hidden;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  box-shadow: 0 20px 50px -28px color-mix(in srgb, var(--gold) 70%, transparent);
}
.leader-card .media { position: relative; display: block; aspect-ratio: 16 / 11; background: var(--surface-2); }
.leader-card .media img { width: 100%; height: 100%; object-fit: cover; }
.leader-card .media.round { display: grid; place-items: center; }
.leader-card .media.round img { width: 46%; height: auto; aspect-ratio: 1; border-radius: 50%; }
.leader-card .badge {
  position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 8px; border-radius: 999px; background: var(--gold); color: #08090D; font: 800 13px/1 var(--display);
}
.leader-card .body { padding: 14px 16px 16px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.leader-card .title { font-weight: 700; font-size: 16px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 28px 64px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px 10px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .3s, background .3s;
}
.row .pos { text-align: center; font: 800 17px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.row.r2 .pos { color: var(--silver-ink); }
.row.r3 .pos { color: var(--bronze-ink); }
.row .thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb.round img { width: 78%; height: 78%; border-radius: 50%; }
.row .info { min-width: 0; }
.row .title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.author { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.votebox { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.votes { font: 800 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.votes small { font: 500 11px var(--body); color: var(--muted); margin-left: 2px; }
.row.flash, .leader-card.flash { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.thumb-fallback { width: 100%; height: 100%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 30%, var(--surface-2)); color: #fff; }
.thumb-fallback svg { width: 40%; height: 40%; fill: currentColor; opacity: .9; }

.empty { margin-top: 24px; padding: 32px 20px; text-align: center; border-radius: var(--radius); border: 1.5px dashed var(--line); }
.empty h3 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Participar ---------- */
.page-title { font-size: 30px; font-weight: 800; margin: 6px 0 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 18px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--muted);
}
.chip i { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--c); color: #fff; }
.chip i svg { width: 13px; height: 13px; fill: currentColor; }
.chip.on { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.field { margin-top: 18px; }
.field label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.input-wrap { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0; height: 52px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text); font: 16px var(--body); outline: none;
}
.input:focus { border-color: var(--accent); }
.hint { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.preview { margin-top: 18px; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.preview .media { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.preview .media img { width: 100%; height: 100%; object-fit: cover; }
.preview .media.round img { width: 50%; height: auto; aspect-ratio: 1; border-radius: 50%; }
.preview .media.wide { aspect-ratio: 16 / 9; }
.preview .body { padding: 14px 16px 16px; }
.preview .title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.preview.error { padding: 16px; border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); font-weight: 500; }
.preview.exists { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 14px; border-radius: 6px; margin-top: 8px; }

/* ---------- Stepper / costo ---------- */
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.stepper button { width: 44px; height: 44px; font-size: 22px; font-weight: 600; }
.stepper input { width: 56px; text-align: center; background: none; border: 0; color: var(--text); font: 800 20px var(--display); outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.quick { display: flex; gap: 6px; margin-top: 10px; }
.quick button { flex: 1; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.cost { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 6px; font-size: 14px; }
.cost div { display: flex; justify-content: space-between; }
.cost b { font-variant-numeric: tabular-nums; }
.cost .warn { color: var(--danger); }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: var(--overlay); backdrop-filter: blur(2px); animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-width: 640px; margin: 0 auto;
  padding: 10px 18px calc(18px + var(--safe-b)); border-radius: 24px 24px 0 0;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  animation: up .25s cubic-bezier(.2,.9,.3,1); max-height: 92dvh; overflow-y: auto;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.sheet-item .thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.sheet-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sheet h3 { font-size: 22px; margin: 18px 0 2px; }
.sheet .actions { margin-top: 16px; display: grid; gap: 8px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Billetera ---------- */
.wallet-card {
  margin-top: 8px; padding: 22px 20px; border-radius: 24px; color: var(--accent-ink);
  background: radial-gradient(130% 120% at 100% 0%, #5FAEFF 0%, var(--accent) 50%, #0058C7 100%);
}
.wallet-card .lbl { font-weight: 600; font-size: 13px; opacity: .75; }
.wallet-card .big { font: 800 52px/1 var(--display); margin-top: 6px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.wallet-card .big small { font-size: 18px; margin-left: 6px; }
.wallet-card .sub { margin-top: 10px; font-weight: 600; font-size: 14px; }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 13px; background: color-mix(in srgb, var(--gold) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); color: var(--text); }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pack {
  position: relative; padding: 16px 14px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); transition: transform .12s, border-color .2s;
}
.pack:active { transform: scale(.97); }
.pack.pop { border-color: var(--accent); }
.pack .tag { position: absolute; top: -9px; right: 12px; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 800; letter-spacing: .03em; }
.pack .amt { font: 800 26px/1 var(--display); }
.pack .amt small { font-size: 13px; color: var(--muted); margin-left: 3px; }
.pack .eq { margin-top: 6px; font-size: 13px; color: var(--muted); }
.pack .price { margin-top: 12px; display: inline-block; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: 14px; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .plus-t { color: var(--accent); font-weight: 700; }
.history .minus-t { color: var(--text); font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 560px) {
  .cat-grid { grid-template-columns: 1fr 1fr 1fr; }
  .packs { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Cuentas ---------- */
.hdr { display: flex; align-items: center; gap: 8px; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; font: 800 15px/1 var(--display);
}
.avatar.xl { width: 64px; height: 64px; font-size: 26px; }
.by { margin-top: 4px; font-size: 12px; color: var(--accent); font-weight: 600; }
.login-card { margin-top: 8px; padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.login-card b { font: 800 20px/1.1 var(--display); }
.login-card p { margin: 8px 0 16px; }

.auth { padding-top: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg button { height: 40px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 var(--line); }
.gbtn { display: flex; justify-content: center; margin-top: 18px; min-height: 44px; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; color: var(--muted); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.input-at { position: relative; display: flex; }
.input-at span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-at .input { padding-left: 32px; }
.form-error { margin-top: 12px; color: var(--danger); font-size: 14px; font-weight: 500; min-height: 1em; }
.form-error:empty { display: none; }
.legal { text-align: center; margin-top: 16px; }

.profile { display: flex; align-items: center; gap: 16px; padding-top: 8px; }
.profile h1 { font-size: 26px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.stat { padding: 14px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font: 800 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.2; }
a.stat b { color: var(--accent); }
.row a.info { display: block; }
.field > .input { width: 100%; }
.forgot { display: inline-block; margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.sent-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 12px 0 18px; border-radius: 20px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); font-size: 30px; }
.verify-banner {
  display: grid; gap: 12px; margin-top: 14px; padding: 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
}
.verify-banner b { font-size: 14.5px; }
.verify-banner p { margin: 4px 0 0; font-size: 13px; color: var(--muted); word-break: break-word; }
.verify-banner p b { color: var(--text); font-size: 13px; }
.verify-banner .btn { justify-self: start; }
.verify-banner.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.ok-badge { color: var(--accent); font-weight: 600; white-space: nowrap; }
.pay-list { display: grid; gap: 8px; }
.pay-opt {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); transition: border-color .15s, transform .12s;
}
.pay-opt:active { transform: scale(.98); }
.pay-opt:hover { border-color: var(--accent); }
.pay-opt[disabled] { opacity: .6; }
.pay-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); font-size: 20px; }
.pay-txt { min-width: 0; }
.pay-txt b { display: block; font-size: 15px; }
.pay-txt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pay-price { font-weight: 700; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Panel de administración ---------- */
.adm-head { display: flex; align-items: center; gap: 10px; }
.adm-tabs { grid-template-columns: repeat(5, 1fr); margin-top: 6px; }
.adm-tabs a { display: grid; place-items: center; height: 38px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.adm-tabs a.on { background: var(--surface-2); color: var(--text); }
#adm { margin-top: 16px; }
.st { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.st-ok { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.st-wait { background: var(--surface-2); color: var(--muted); }
.st-warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-ink); }
.st-bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.st-admin { background: var(--text); color: var(--bg); }
.adm-alert {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 8px; padding: 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--gold) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line));
}
.adm-alert b { color: var(--gold-ink); }
.adm-alert span { grid-column: 1; font-size: 13px; color: var(--muted); }
.adm-alert i { grid-column: 2; grid-row: 1 / 3; align-self: center; font-style: normal; font-size: 22px; color: var(--gold-ink); }
.adm-ok { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-weight: 600; }
.adm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.adm-grid .stat { padding: 12px 10px; min-width: 0; }
.adm-grid .stat b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.adm-rows { margin-top: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.adm-rows > div { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; font-size: 14px; border-top: 1px solid var(--line); }
.adm-rows > div:first-child { border-top: 0; }
.adm-rows a { color: var(--accent); font-weight: 600; }
.adm-search { width: 100%; }
.adm-chips { margin-top: 10px; }
.adm-chips .chip { --c: var(--accent); padding: 8px 14px; }
.adm-list { display: grid; gap: 10px; margin-top: 12px; }
.adm-card { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 6px; min-width: 0; }
.adm-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-top .st { margin-left: auto; }
.adm-top b { font-size: 16px; }
.adm-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-note { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.adm-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0; }
.adm-kv div { padding: 8px; border-radius: 10px; background: var(--surface-2); text-align: center; min-width: 0; }
.adm-kv b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.adm-kv span { font-size: 11px; color: var(--muted); }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.adm-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.adm-item .thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.adm-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.adm-item .title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; word-break: break-all; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.danger { background: var(--danger); color: #fff; }
.danger-t { color: var(--danger) !important; }
.report-link { display: block; margin: 14px auto 0; font-size: 13px; color: var(--muted); text-decoration: underline; }
.radio-list { display: grid; gap: 6px; }
.radio { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; }

/* ---------- Períodos y ganadores ---------- */
.h-per { color: var(--c); }
.per-tabs { grid-template-columns: repeat(4, 1fr); margin-top: 14px; }
.per-tabs button, .per-tabs a { height: 38px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); display: grid; place-items: center; }
.per-tabs .on { background: var(--surface-2); color: var(--text); }
.hist-tabs { grid-template-columns: repeat(3, 1fr); }
.per-info { display: grid; gap: 2px; margin-top: 10px; padding: 0 2px; font-size: 13px; color: var(--muted); }
.per-info b { color: var(--text); font-size: 14px; }
.champ {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 16%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line));
}
.champ-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 20%, transparent); font-size: 20px; }
.champ-txt { min-width: 0; }
.champ-txt small { display: block; color: var(--gold-ink); font-weight: 600; font-size: 12px; }
.champ-txt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ i { font-style: normal; font-size: 22px; color: var(--gold-ink); }
.champ-link { display: block; margin-top: 14px; font-size: 13.5px; font-weight: 600; color: var(--gold-ink); }
.hof { margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; }
.hof-head { font: 700 15px/1.2 var(--display); }
.hof-win { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: color-mix(in srgb, var(--gold) 9%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); }
.hof-win .thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--surface); }
.hof-win .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hof-win .thumb.round img { width: 78%; height: 78%; border-radius: 50%; }
.hof-txt { min-width: 0; display: grid; gap: 2px; }
.hof-txt b { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hof-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hof-m { font-size: 12px; font-weight: 700; color: var(--gold-ink); }
.hof-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 4px; font-size: 14px; min-width: 0; }
.hof-row .hof-m { font-size: 16px; }
.hof-row b { font-variant-numeric: tabular-nums; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.rules > div { display: grid; gap: 4px; align-content: start; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.rules b { font-size: 12px; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.rules .ok { color: var(--accent); font-size: 12.5px; }
.rules .no { color: var(--muted); font-size: 12.5px; }
@media (max-width: 360px) { .rules { grid-template-columns: 1fr; } }

/* ---------- Compartir ---------- */
.share-prev { margin-top: 14px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.share-prev img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--surface-2); }
.share-prev span { display: block; padding: 8px 12px; font-size: 12px; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.share-btn { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.share-btn:active { background: var(--surface); }
.share-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; }
.share-ic.plain { color: var(--text); border: 1px solid var(--line); }
.share-ic svg { width: 26px; height: 26px; fill: currentColor; }
.share-item { margin-top: 0; }
.ig-wrap { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; margin-top: 14px; }
.ig-prev { width: 110px; height: auto; aspect-ratio: 1080 / 1920; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.ig-steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.ig-steps b { color: var(--text); }
.ig-link { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.ig-link span { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Quién votó / Regalos ---------- */
.votes-btn { padding: 0; background: none; border: 0; cursor: pointer; text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent); text-underline-offset: 4px; }
.voters-sum { margin: 14px 0 8px; font-size: 13px; color: var(--muted); }
.voters { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 52vh; overflow-y: auto; }
.voters li { display: grid; grid-template-columns: 22px 32px 1fr auto; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; }
.voters li.me { background: var(--accent-soft); }
.voters .vpos { font-size: 12px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.vname { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-weight: 600; font-size: 14px; }
.vtag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.vgift { font-size: 11.5px; color: var(--accent); font-weight: 600; width: 100%; }
.voters b { font-variant-numeric: tabular-nums; }
.sheet-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.sheet-tools button { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 18px; }
.sheet-tools span { font-size: 12px; font-weight: 600; }
.gift-note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.gift-chip { margin-left: 2px; color: var(--accent) !important; font-weight: 700 !important; }
.gift-target { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; margin-top: 14px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; width: 100%; }
.gift-target .thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--surface); }
.gift-target .thumb img { width: 100%; height: 100%; object-fit: cover; }
.gift-target .pf { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff; }
.gift-target .pf svg { width: 28px; height: 28px; fill: currentColor; }
.gift-target .title { font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gift-pick { display: grid; gap: 8px; max-height: 40vh; overflow-y: auto; }
.gift-pick .gift-target { margin-top: 0; }
.gift-scope { grid-template-columns: 1fr 1fr; margin-top: 10px; }
.gift-scope button { height: 40px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--muted); }
.gift-scope button.on { background: var(--surface-2); color: var(--text); }
.gift-chips { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.gift-chips .chip { --c: var(--accent); padding: 8px 14px; }
.gift-hero { display: grid; place-items: center; width: 72px; height: 72px; margin: 8px auto 0; border-radius: 22px; background: var(--accent-soft); font-size: 36px; }
.gift-card { display: grid; gap: 6px; margin-top: 10px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.gift-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gift-head b { flex: 1; min-width: 0; }
.gift-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.gift-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.gift-list { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); font-size: 14px; }
.gift-list > div { display: grid; gap: 2px; }
.gift-list small { font-size: 12px; color: var(--muted); }

/* ---------- Legales ---------- */
.site-foot {
  max-width: 640px; margin: 24px auto 0; padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px);
  border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: center; text-align: center;
}
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 13px; }
.site-foot nav a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.site-foot small { font-size: 11.5px; color: var(--muted); }
.foot-refund { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--text); font-weight: 700; font-size: 13.5px; }
.legal-doc { line-height: 1.6; }
.legal-doc h2 { font-size: 18px; margin: 24px 0 8px; }
.legal-doc p, .legal-doc li { font-size: 14.5px; }
.legal-doc ul { padding-left: 20px; display: grid; gap: 6px; }
.legal-doc a { color: var(--accent); text-decoration: underline; }
.legal-doc code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.legal-doc .aaip { font-size: 12.5px; color: var(--muted); padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
mark.todo { background: #FFE58A; color: #08090D; padding: 0 4px; border-radius: 4px; font-weight: 700; }
.consent { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.consent a { color: var(--accent); text-decoration: underline; }
.consent b { color: var(--text); }
.link-danger { display: block; margin: 18px auto 0; font-size: 13.5px; color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.del-list { margin: 14px 0 8px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }

/* ---------- Ventas ---------- */
.adm-tabs a { font-size: 12.5px; }
.sales-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sales-total { display: grid; gap: 3px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.sales-total b { font: 800 19px/1.1 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sales-total small { font-size: 11.5px; line-height: 1.35; }
.sales-progress { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; }
.adm-card.is-credit { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* ---------- Paquetes con descuento ---------- */
.pack .off { color: var(--accent); font-weight: 800; }
/* En el celular (2 columnas) el último paquete, si queda solo, ocupa todo el ancho */
@media (max-width: 559px) { .packs .pack:last-child:nth-child(odd) { grid-column: 1 / -1; } }

/* ---------- Idioma ---------- */
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; cursor: pointer; }
.foot-lang { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.foot-select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
