:root {
  --bg: #070707;
  --bg-2: #0e0e0f;
  --surface: #141415;
  --surface-2: #1b1b1d;
  --line: #2a2a2d;
  --line-soft: #1f1f22;
  --text: #ffffff;
  --muted: #a3a3a8;
  --dim: #6c6c72;
  --gold: #c8ad6a;
  --gold-2: #e9d9a6;
  --gold-3: #9a8040;
  --gold-grad: linear-gradient(135deg, #f1e2b3 0%, #c8ad6a 45%, #9a8040 100%);
  --silver: #cfd3d8;
  --bronze: #c48a5a;
  --red: #d2343a;
  --green: #4fbf7f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --font-head: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(200, 173, 106, .10), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(200, 173, 106, .06), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold); color: #000; }

h1, h2, h3, .head { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .04em; margin: 0; font-weight: 600; }
h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.1; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
.gold { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: grid; place-items: center; transition: opacity .6s ease, visibility .6s;
}
#splash.out { opacity: 0; visibility: hidden; }
.splash-inner { position: relative; width: min(62vw, 300px); aspect-ratio: 1; display: grid; place-items: center; }
.splash-logo {
  width: 100%; border-radius: 50%;
  opacity: 0; transform: scale(.7); filter: brightness(.4) blur(6px);
  animation: logoIn 1.1s cubic-bezier(.2, .9, .2, 1) .15s forwards;
}
.splash-ring { position: absolute; inset: -6%; width: 112%; height: 112%; transform: rotate(-90deg); }
.splash-ring circle { fill: none; stroke-width: 2.2; }
.splash-ring .track { stroke: #1a1a1a; }
.splash-ring .bar {
  stroke: url(#goldStroke); stroke-linecap: round;
  stroke-dasharray: 340; stroke-dashoffset: 340;
  animation: ring 1.7s cubic-bezier(.6, .1, .2, 1) .2s forwards;
}
.splash-shine {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none;
}
.splash-shine::after {
  content: ''; position: absolute; top: -20%; left: -60%; width: 40%; height: 140%;
  background: linear-gradient(100deg, transparent, rgba(255, 240, 200, .35), transparent);
  transform: skewX(-18deg); animation: shine 1.1s ease 1.2s forwards;
}
.splash-text {
  position: absolute; bottom: -64px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-head); letter-spacing: .5em; font-size: 12px; color: var(--gold);
  opacity: 0; animation: fadeUp .6s ease 1.1s forwards;
}
@keyframes logoIn { to { opacity: 1; transform: scale(1); filter: brightness(1) blur(0); } }
@keyframes ring { to { stroke-dashoffset: 0; } }
@keyframes shine { to { left: 130%; } }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 173, 106, .0); } 50% { box-shadow: 0 0 60px 6px rgba(200, 173, 106, .25); } }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; border-right: 1px solid var(--line-soft);
  background: rgba(10, 10, 11, .85); backdrop-filter: blur(10px);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand img { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(200, 173, 106, .35); }
.brand .t1 { font-family: var(--font-head); font-size: 17px; letter-spacing: .08em; line-height: 1.1; }
.brand .t2 { font-size: 11px; color: var(--gold); letter-spacing: .25em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 500; transition: background .2s, color .2s;
}
.nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(200, 173, 106, .16), rgba(200, 173, 106, .02)); color: var(--gold-2); box-shadow: inset 2px 0 0 var(--gold); }
.nav .sep { height: 1px; background: var(--line-soft); margin: 10px 8px; }
.nav .label { font-size: 10.5px; letter-spacing: .2em; color: var(--dim); text-transform: uppercase; padding: 6px 12px 2px; }
.sidebar .me { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--surface); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--gold-grad); color: #111; font-family: var(--font-head); font-weight: 700; font-size: 15px;
}
.main { flex: 1; min-width: 0; padding: 28px clamp(16px, 4vw, 44px) 110px; max-width: 1180px; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-size: 11.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 6px; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 10px 16px; background: rgba(7, 7, 7, .88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-soft);
  }
  .topbar img { width: 36px; height: 36px; border-radius: 50%; }
  .topbar .t1 { font-family: var(--font-head); letter-spacing: .08em; font-size: 15px; line-height: 1.1; }
  .topbar .t2 { font-size: 10px; color: var(--gold); letter-spacing: .22em; }
  .topbar .spacer { flex: 1; }
  .main { padding: 18px 16px 110px; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
    background: rgba(10, 10, 11, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--dim); padding: 4px 8px; border-radius: 10px; min-width: 56px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--gold-2); }
}
@media (min-width: 861px) { .bottom-nav { display: none; } }

/* ---------- Componentes ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card, .stack > .card + .card, .ev-layout > .card { margin-top: 0; }
.card.gold-edge { border-color: rgba(200, 173, 106, .35); box-shadow: 0 0 0 1px rgba(200, 173, 106, .08), var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; } .mb { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-weight: 600; cursor: pointer; transition: transform .1s, background .2s, border-color .2s, opacity .2s;
  white-space: nowrap; font-size: 14px;
}
.btn:hover { border-color: #3a3a3e; background: #222225; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--gold-grad); color: #121212; border: 0; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-head); font-size: 15px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a8e; border-color: rgba(210, 52, 58, .4); background: rgba(210, 52, 58, .08); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.xs { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #0c0c0d; color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 173, 106, .15); }
textarea.input { min-height: 110px; resize: vertical; }
.input.big { font-size: 26px; font-family: var(--font-head); letter-spacing: .06em; text-align: center; padding: 14px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }

.seg { display: inline-flex; background: #0c0c0d; border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--surface-2); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(200, 173, 106, .3); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-weight: 600; white-space: nowrap; font-size: 13px;
}
.tabs button.on { background: var(--gold-grad); color: #111; border-color: transparent; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge.open { color: #8ff0b5; border-color: rgba(79, 191, 127, .4); background: rgba(79, 191, 127, .08); }
.badge.open::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 1.6s infinite; }
.badge.closed { color: var(--gold-2); border-color: rgba(200, 173, 106, .4); background: rgba(200, 173, 106, .08); }
.badge.upcoming { color: var(--dim); }
.badge.ok { color: #8ff0b5; border-color: rgba(79, 191, 127, .35); }
.badge.warn { color: #ffd27a; border-color: rgba(255, 210, 122, .35); }
.badge.bad { color: #ff8a8e; border-color: rgba(210, 52, 58, .4); }
@keyframes blink { 50% { opacity: .35; } }

/* Tarjetas de semana */
.week-card { position: relative; overflow: hidden; cursor: pointer; transition: transform .2s, border-color .2s; min-height: 180px; display: flex; flex-direction: column; }
.week-card:hover { transform: translateY(-3px); border-color: rgba(200, 173, 106, .35); }
.week-card .wk { font-family: var(--font-head); font-size: 64px; line-height: .8; position: absolute; right: 14px; top: 12px; color: rgba(255, 255, 255, .04); }
.week-card.locked { cursor: default; }
.week-card.locked:hover { transform: none; border-color: var(--line-soft); }
.week-card.locked .title { color: var(--dim); }
.week-card .title { font-family: var(--font-head); font-size: 24px; letter-spacing: .05em; text-transform: uppercase; margin: 10px 0 4px; }
.week-card .foot { margin-top: auto; padding-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lock-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #0c0c0d; border: 1px solid var(--line); color: var(--dim); }
.lock-ico svg { width: 18px; height: 18px; }

/* Stats */
.stat { padding: 18px; }
.stat .k { font-size: 11px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.stat .v { font-family: var(--font-head); font-size: 34px; line-height: 1.1; margin-top: 6px; }
.stat .s { font-size: 12.5px; color: var(--dim); }

/* Hero */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: clamp(20px, 4vw, 34px);
  background: radial-gradient(600px 300px at 100% 0%, rgba(200, 173, 106, .22), transparent 60%), linear-gradient(135deg, #151515, #0b0b0b);
  border: 1px solid rgba(200, 173, 106, .25); margin-bottom: 18px;
}
.hero img.bg { position: absolute; right: -40px; bottom: -60px; width: 260px; opacity: .13; border-radius: 50%; pointer-events: none; }
.hero .cta { margin-top: 18px; }

/* Tablas */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim);
  padding: 12px 12px; background: #0c0c0d; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line-soft);
}
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
tr.me td { background: rgba(200, 173, 106, .07); }
tr.me td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
.pos {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-family: var(--font-head);
  font-size: 15px; background: #0c0c0d; border: 1px solid var(--line); color: var(--muted);
}
.pos.p1 { background: var(--gold-grad); color: #111; border: 0; box-shadow: 0 0 18px rgba(200, 173, 106, .45); }
.pos.p2 { background: linear-gradient(135deg, #f2f4f6, #9ea3a8); color: #111; border: 0; }
.pos.p3 { background: linear-gradient(135deg, #e8b48a, #8d5a35); color: #111; border: 0; }
.pts { font-family: var(--font-head); font-size: 18px; letter-spacing: .03em; }
.who { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.who .avatar { width: 30px; height: 30px; font-size: 13px; }

/* Podio */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px; align-items: end; margin: 6px 0 22px; }
.podium .pl { text-align: center; padding: 16px 10px; border-radius: 16px 16px 6px 6px; border: 1px solid var(--line-soft); background: linear-gradient(180deg, var(--surface-2), var(--bg-2)); }
.podium .pl .avatar { width: 48px; height: 48px; margin: 0 auto 8px; font-size: 19px; }
.podium .pl .nm { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pl .pt { font-family: var(--font-head); font-size: 24px; }
.podium .pl.first { min-height: 190px; border-color: rgba(200, 173, 106, .45); box-shadow: 0 -10px 40px rgba(200, 173, 106, .12); }
.podium .pl.first .avatar { width: 60px; height: 60px; font-size: 24px; animation: pulseGlow 2.6s infinite; }
.podium .pl.second { min-height: 160px; }
.podium .pl.second .avatar { background: linear-gradient(135deg, #f2f4f6, #9ea3a8); }
.podium .pl.third { min-height: 140px; }
.podium .pl.third .avatar { background: linear-gradient(135deg, #e8b48a, #8d5a35); }
.podium .medal { font-family: var(--font-head); font-size: 12px; letter-spacing: .2em; color: var(--muted); margin-bottom: 6px; }
.podium .first .medal { color: var(--gold); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(100%, 420px); }
.auth-logo { width: 130px; display: block; margin: 0 auto 10px; border-radius: 50%; animation: pulseGlow 3s infinite; }
.auth h1 { text-align: center; font-size: 26px; }
.auth .sub { text-align: center; color: var(--gold); letter-spacing: .3em; font-size: 11px; text-transform: uppercase; margin: 4px 0 22px; }

/* Toasts y modal */
#toasts { position: fixed; top: 16px; right: 16px; left: 16px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; background: #121213; border: 1px solid var(--line); border-left: 3px solid var(--gold);
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px;
  animation: toastIn .3s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

.modal-bg { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: min(100%, 560px); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); animation: pop .25s cubic-bezier(.2, .9, .2, 1); }
.modal.wide { width: min(100%, 760px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

.empty { text-align: center; padding: 40px 16px; color: var(--dim); }
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; color: var(--line); }
.desc { white-space: pre-wrap; color: #d9d9dc; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.note { padding: 12px 14px; border-radius: 12px; background: rgba(200, 173, 106, .07); border: 1px solid rgba(200, 173, 106, .22); color: #e8dcb6; font-size: 13.5px; }
.note.danger { background: rgba(210, 52, 58, .08); border-color: rgba(210, 52, 58, .3); color: #ffb3b6; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.loader { display: grid; place-items: center; padding: 60px 0; }
.loader img { width: 64px; border-radius: 50%; animation: spinPulse 1.4s ease-in-out infinite; }
@keyframes spinPulse { 0%, 100% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }

.view { animation: viewIn .35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

.status-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: #0c0c0d; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.status-switch button { border: 0; background: none; color: var(--muted); padding: 8px 6px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.status-switch button svg { width: 15px; height: 15px; }
.status-switch button.on[data-s="upcoming"] { background: #222; color: #fff; }
.status-switch button.on[data-s="open"] { background: rgba(79, 191, 127, .18); color: #9ff5c2; }
.status-switch button.on[data-s="closed"] { background: rgba(200, 173, 106, .2); color: var(--gold-2); }

.progress { height: 6px; border-radius: 999px; background: #1d1d20; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold-grad); border-radius: 999px; }

@media (max-width: 560px) {
  .podium { gap: 6px; }
  .podium .pl { padding: 12px 4px; }
  .podium .pl .pt { font-size: 20px; }
  td, th { padding: 10px 8px; }
  .hide-sm { display: none; }
}

.ev-layout { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.ev-layout > .stack:empty { display: none; }
.ev-layout:has(> .stack:empty) { grid-template-columns: 1fr; }
@media (max-width: 1100px) { .ev-layout { grid-template-columns: 1fr; } }
