:root {
  --navy-900: #040a63;
  --navy-800: #0a0a61;
  --navy-700: #11207a;
  --blue-500: #2b4cc7;
  --blue-400: #4b63d6;
  --blue-300: #6f86e8;
  --cyan: #1bc4db;
  --cyan-100: #e5fcff;
  --green: #32a72c;
  --red: #cb333b;
  --gold: #f2c94c;
  --ink: #1a313c;
  --ink-soft: #455c67;
  --ink-muted: #637a85;
  --line: #dbdde9;
  --paper: #ffffff;
  --ground: #f1f3f8;
  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 16px;
  --font: 'Manrope', system-ui, -apple-system, sans-serif;
  --shadow: rgba(0, 0, 0, 0.1) 0 2px 4px 0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--ground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--navy-900) url('assets/bg-dark.jpg') center top / 100% auto no-repeat;
}
#app { display: contents; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
img { max-width: 100%; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding-inline: 16px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  color: #fff;
  background: var(--navy-800) url('assets/bg-header.jpg') center / cover no-repeat;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(4, 10, 99, 0.25);
}
.topbar__row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 34px; height: 34px; display: grid; place-items: center; }
.starball { width: 34px; height: 34px; display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__text b { font-size: 20px; font-weight: 800; letter-spacing: 0.04em; }
.brand__text small { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.85; margin-top: 3px; }
.user { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.12); border: 0; color: #fff; padding: 4px 12px 4px 4px; border-radius: 999px; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 8px 13px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: rgba(255, 255, 255, 0.85); }
.tab.is-active { background: var(--cyan); color: var(--navy-900); }

/* ---------------------------------------------------------------- page */
.page { flex: 1; padding-block: 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--ink-muted); }
.page > .muted { color: rgba(255, 255, 255, 0.8); }
.count { font-weight: 700; color: var(--ink-muted); font-size: 13px; }

.card { background: var(--paper); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 16px; }
.card--center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-block: 32px; }
.card--prose { line-height: 1.5; }
.card--prose h1 { font-size: 24px; margin-bottom: 12px; }
.card--prose h2 { font-size: 16px; margin: 20px 0 6px; }
.card--prose ol { list-style: decimal; padding-left: 20px; display: grid; gap: 6px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 10px; }
.card__head h2 { font-size: 16px; }
.card__head h3 { font-size: 14px; color: var(--ink-soft); }
.card__head + .card__head, .standings + .card__head, .muted + .card__head { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.card__actions { padding-top: 12px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

.matchcard {
  color: #fff;
  background: var(--navy-800) url('assets/bg-dark.jpg') center 30% / cover no-repeat;
  border-radius: var(--radius-l);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow);
}
.matchcard__kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.75; font-weight: 700; }
.matchcard__title { font-size: 26px; font-weight: 800; }
.matchcard__meta { font-size: 14px; opacity: 0.85; }
.matchcard__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.matchcard__note { font-size: 13px; opacity: 0.9; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill--open, .pill--soon, .pill--closed { background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; }
.pill--open::before, .pill--soon::before, .pill--closed::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pill--open::before { background: var(--green); }
.pill--soon::before { background: var(--gold); }
.pill--closed::before { background: var(--red); }
.pill--draft { background: var(--gold); color: var(--navy-900); font-size: 11px; }
.card .pill--open, .card .pill--soon, .card .pill--closed { background: var(--ground); border-color: transparent; color: var(--ink-soft); font-size: 11px; }

.btn { border: 0; border-radius: var(--radius-m); padding: 12px 20px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 10px; justify-content: center; transition: transform 0.08s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--primary { background: var(--cyan); color: var(--navy-900); }
.btn--ghost { background: rgba(255, 255, 255, 0.14); color: #fff; border: 1px solid rgba(255, 255, 255, 0.5); }
.card .btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--link { background: none; color: var(--ink-muted); text-decoration: underline; padding: 6px; font-weight: 500; }
.btn--lg { padding: 16px 28px; font-size: 16px; border-radius: 12px; }
.btn--sm { padding: 8px 14px; font-size: 13px; }

/* ---------------------------------------------------------------- standings-like lists */
.standings { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row__pos { width: 20px; text-align: center; color: var(--ink-muted); font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.row__name { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__name em { font-style: normal; font-size: 11px; color: var(--navy-800); background: var(--cyan-100); padding: 2px 6px; border-radius: 999px; margin-left: 4px; }
.row__time { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.row--empty .row__name { color: var(--ink-muted); font-weight: 500; }
.row.is-me { background: linear-gradient(90deg, var(--cyan-100), transparent); margin-inline: -16px; padding-inline: 16px; }
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.star { color: var(--line); font-size: 12px; line-height: 1; }
.star.is-on { color: var(--gold); }
.stars--set { gap: 0; background: var(--ground); border-radius: 999px; padding: 3px 5px; }
.stars--set .star { border: 0; background: transparent; padding: 3px 4px; font-size: 16px; }
.teamsum { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.teamsum b { color: var(--ink); }

.avatar { border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--ground); display: inline-grid; place-items: center; font-weight: 800; color: var(--navy-800); }
.avatar--sm { width: 32px; height: 32px; font-size: 13px; }
.avatar--md { width: 44px; height: 44px; font-size: 16px; }
.avatar--lg { width: 72px; height: 72px; font-size: 26px; }
.avatar--initial { background: var(--cyan-100); }

.log { display: flex; flex-direction: column; gap: 8px; }
.log__item { display: flex; gap: 12px; font-size: 13px; align-items: baseline; }
.log__item time { color: var(--ink-muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; font-size: 12px; }
.log__item--promote span { color: var(--green); }
.log__item--leave span { color: var(--red); }

/* ---------------------------------------------------------------- teams */
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.teams__vs { align-self: center; color: var(--ink-muted); font-weight: 800; font-size: 12px; text-transform: uppercase; }
.team { border-radius: var(--radius-m); padding: 10px; }
.team--color { background: var(--navy-800); color: #fff; }
.team--blanco { background: var(--ground); color: var(--ink); border: 1px solid var(--line); }
.team__name { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; opacity: 0.85; }
.team__player { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-weight: 600; font-size: 13px; min-width: 0; }
.team__player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team__player.is-me span { text-decoration: underline; text-decoration-color: var(--cyan); text-underline-offset: 3px; }

.scoreline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 12px; }
.scoreline__team { font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
.scoreline__team--blanco { text-align: right; }
.scoreline__team.is-winner { opacity: 1; }
.scoreline__team.is-winner::after { content: ' ★'; color: var(--gold); }
.scoreline__result { background: rgba(255, 255, 255, 0.12); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }

/* ---------------------------------------------------------------- mvp */
.mvp { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 16px; text-align: center; }
.mvp__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); font-weight: 700; }
.mvp__name { font-size: 20px; font-weight: 800; }
.mvp__votes { color: var(--ink-muted); font-size: 13px; }
.votelist { display: grid; gap: 6px; margin: 12px 0; }
.votebtn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--paper); font-weight: 600; text-align: left; min-width: 0; }
.votebtn span:not(.avatar) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.votebtn.is-selected { border-color: var(--cyan); background: var(--cyan-100); }
.votebtn .check { color: var(--navy-800); }
.tally { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tally li { display: grid; grid-template-columns: 110px 1fr 24px; align-items: center; gap: 10px; font-size: 13px; }
.tally__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tally__bar { height: 8px; background: var(--ground); border-radius: 999px; overflow: hidden; }
.tally__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-500), var(--cyan)); border-radius: 999px; }
.tally li.is-leader .tally__name { font-weight: 800; }
.tally li.is-leader .tally__bar i { background: var(--green); }
.fold { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.fold > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '▾'; opacity: 0.5; }
.fold[open] > summary::after { content: '▴'; }
.tally__n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- history */
.history { display: flex; flex-direction: column; }
.history__item { border-bottom: 1px solid var(--line); }
.history__item:last-child { border-bottom: 0; }
.history__item summary { list-style: none; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 0; cursor: pointer; align-items: center; }
.history__item summary::-webkit-details-marker { display: none; }
.history__date { font-weight: 700; }
.history__mvp { grid-column: 1 / -1; color: var(--ink-muted); font-size: 12px; }
.history__teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 0 14px; font-size: 13px; }
.history__teams b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); margin-bottom: 4px; }
.result { justify-self: end; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.result--color { background: var(--navy-800); color: #fff; }
.result--blanco { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.result--empate { background: var(--ground); color: var(--ink-soft); }
.result--none { color: var(--ink-muted); }

/* ---------------------------------------------------------------- admin */
.seg { display: inline-flex; background: var(--ground); border-radius: 999px; padding: 3px; gap: 2px; flex: 0 0 auto; }
.seg--wide { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.seg__btn { border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 12px; color: var(--ink-soft); }
.seg__btn.is-on { background: var(--paper); box-shadow: var(--shadow); color: var(--ink); }
.seg__btn--color.is-on { background: var(--navy-800); color: #fff; }
.seg__btn--blanco.is-on { background: var(--paper); }
.seg__btn--empate.is-on { background: var(--ink-soft); color: #fff; }
.pool { display: flex; flex-direction: column; }
.poolrow { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.poolrow:last-child { border-bottom: 0; }
.poolrow.is-pending { opacity: 0.6; }
.poolrow__id { display: flex; align-items: center; gap: 10px; }
.poolrow__id small { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.poolrow__ctl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.poolrow__ctl label { display: flex; align-items: center; gap: 6px; }
.poolrow input[type="number"] { width: 56px; }
.poolrow input, .poolrow select { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); color: var(--ink); }
.poolrow__notes { width: 100%; }
.chk input { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- hero / login */
.hero { color: #fff; background: transparent; border-radius: var(--radius-l); padding: 40px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.hero__logo { width: 150px; height: auto; margin-bottom: 8px; }
.hero h1 { font-size: 30px; font-weight: 800; line-height: 1.05; }
.hero p { font-size: 22px; font-weight: 600; line-height: 1.3; opacity: 0.92; max-width: 22ch; }
.hero .btn { margin-top: 10px; background: #fff; color: var(--ink); }

/* ---------------------------------------------------------------- misc */
.toast { position: fixed; left: 16px; right: 16px; bottom: 24px; padding: 14px 16px; border-radius: var(--radius-m); font-weight: 600; text-align: center; z-index: 20; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.toast--error { background: var(--red); color: #fff; }
.toast--ok { background: var(--navy-800); color: #fff; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--blue-500); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  .page { padding-block: 24px 56px; }
  .matchcard { padding: 28px 24px; }
  .matchcard__title { font-size: 32px; }
}
