:root {
  --bg: #0b1120;
  --row: #0e1628;
  --row-hover: #131d33;
  --line: #1c2740;
  --text: #e8ecf4;
  --muted: #8591ab;
  --gold: #fbbf24;
  --gold-soft: #d6b26a;
  --green: #a3e635;
  --red: #f87171;
  --accent: #e11d48;
  --font: "Barlow", system-ui, sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(225, 29, 72, 0.22), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 500 16px/1.4 var(--font);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- encabezado ---------- */

.hero { text-align: center; padding: 40px 16px 24px; }

.hero-logo {
  display: block; margin: 0 auto 8px;
  width: 160px; height: 160px;
  filter: drop-shadow(0 6px 24px rgba(225, 29, 72, 0.35));
}

.hero-kicker {
  margin: 0;
  font: 700 0.85rem/1 var(--font-cond);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.hero-title {
  margin: 8px 0 12px;
  font: 800 clamp(2.4rem, 8vw, 5rem)/1 "Grenze Gotisch", serif;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 55%, #b45309 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(225, 29, 72, 0.45));
}

.hero-meta { margin: 0; color: var(--muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- tabla ---------- */

main { max-width: 1400px; margin: 0 auto; padding: 0 16px 48px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.search { margin-left: auto; }

.refresh { display: flex; align-items: center; gap: 12px; }
.refresh[hidden] { display: none; }
.refresh button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #f59e0b, #b45309);
  border: 0; border-radius: 8px;
  color: #1a0f02;
  font: 700 0.95rem/1 var(--font-cond);
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer;
}
.refresh button:hover { filter: brightness(1.1); }
.refresh button:disabled { filter: grayscale(0.6) brightness(0.8); cursor: progress; }
.refresh button:disabled svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refresh button:disabled svg { animation: none; } }
.refresh-status { color: var(--muted); font-size: 0.9rem; }

.search input {
  width: min(320px, 100%);
  padding: 10px 14px;
  background: var(--row);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
.search input::placeholder { color: var(--muted); }

.board { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--row); }

table { width: 100%; border-collapse: collapse; text-align: center; }

thead th {
  padding: 14px 8px;
  font: 700 0.8rem/1 var(--font-cond);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th button {
  all: unset;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}
th button:hover { color: var(--text); }
th[aria-sort] button { color: var(--gold-soft); }
th[aria-sort="ascending"] button::after { content: " ▲"; }
th[aria-sort="descending"] button::after { content: " ▼"; }

tbody tr { border-bottom: 1px solid var(--line); transition: background 0.15s; }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }

td { padding: 18px 8px; height: 102px; }

.c-pos { width: 56px; }
.c-change { width: 70px; }
.c-tier { width: 150px; }
.c-lp { width: 100px; text-align: right; padding-right: 24px; }

td.c-pos { font-weight: 700; }
td.c-change { font-weight: 700; font-size: 1.05rem; }
td.c-name { font-weight: 700; }
td.c-account, td.c-record { font-size: 1.05rem; font-weight: 400; }
td.c-record { white-space: nowrap; }
td.c-wr { font-size: 1.1rem; font-weight: 700; }
td.c-lp { font-size: 0.85rem; white-space: nowrap; }

.up { color: var(--green); }
.down { color: var(--red); }
.same { color: var(--muted); letter-spacing: 0.1em; }

.wr-gold { color: var(--gold); }
.wr-green { color: var(--green); }
.wr-white { color: var(--text); }
.wr-red { color: var(--red); }

.muted { color: var(--muted); }

.status { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-off { color: var(--red); }
.status-live { color: var(--green); }
.status-live small { color: var(--muted); font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.status-live .dot { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0.6); }
  100% { box-shadow: 0 0 0 9px rgba(163, 230, 53, 0); }
}
@media (prefers-reduced-motion: reduce) { .status-live .dot { animation: none; } }

.role {
  width: 22px; height: 22px; vertical-align: middle;
  /* íconos blancos → dorado */
  filter: brightness(0) saturate(100%) invert(80%) sepia(28%) saturate(560%) hue-rotate(2deg) brightness(92%);
}

.tier { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tier img { height: 56px; width: auto; }
.tier span { font: 700 0.85rem/1 var(--font); letter-spacing: 0.02em; white-space: nowrap; }

.stale { color: var(--gold); margin-left: 4px; cursor: help; }

.streak {
  display: inline-flex; align-items: center; gap: 2px;
  margin-left: 8px; padding: 2px 7px;
  border-radius: 999px;
  font: 700 0.75rem/1.2 var(--font);
  vertical-align: middle;
  cursor: help;
}
.streak-w { color: var(--green); background: rgba(163, 230, 53, 0.12); }
.streak-l { color: var(--red); background: rgba(248, 113, 113, 0.12); }

.champ { display: inline-flex; align-items: center; gap: 6px; cursor: help; }
.champ img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold-soft); }
.champ small { color: var(--muted); font-size: 0.8rem; }

.stack { display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; }
.stack small { color: var(--muted); font-size: 0.78rem; font-weight: 500; }
td.c-progress { font-weight: 700; }
td.c-last { font-size: 0.9rem; }

.tier-progress { display: none; font-size: 0.7rem; font-weight: 600; }
.pending { font-style: italic; }

.empty { padding: 32px 16px; color: var(--muted); }

.footnote { color: var(--muted); font-size: 0.85rem; text-align: center; margin-top: 16px; }
.footnote a { color: var(--gold-soft); }

/* ---------- columnas ocultables ---------- */

.no-status .c-status { display: none; }
.name-dot, .name-account, .tier-lp { display: none; }

/* ---------- pantallas medianas: la cuenta pasa debajo del nombre ---------- */

@media (max-width: 1150px) {
  .c-account { display: none; }
  .name-account {
    display: block; margin-top: 2px;
    font-size: 0.75rem; font-weight: 400; color: var(--muted);
  }
}

/* ---------- móvil ---------- */

@media (max-width: 720px) {
  .hero { padding-top: 24px; }
  .hero-logo { width: 112px; height: 112px; }
  .search, .search input { width: 100%; }
  .refresh { width: 100%; }
  .c-account, .c-role, .c-champ, .c-record, .c-status, .no-status .c-status, .c-lp, .c-progress, .c-last { display: none; }
  .tier-lp { display: inline; }
  .tier-progress { display: block; }
  .streak { margin-left: 4px; padding: 1px 5px; }
  td { padding: 12px 4px; height: 84px; }
  .c-pos { width: 28px; }
  .c-change { width: 36px; }
  td.c-change { font-size: 0.9rem; }
  td.c-name { text-align: left; }
  .name-account {
    display: block; margin-top: 2px;
    font-size: 0.75rem; font-weight: 400; color: var(--muted);
    overflow-wrap: anywhere;
  }
  td.c-wr { font-size: 0.95rem; }
  .c-tier { width: 96px; }
  .tier img { height: 40px; }
  .tier span { font-size: 0.7rem; white-space: normal; }
  .name-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: middle; }
  .name-dot.live { background: var(--green); }
  .name-dot.off { background: var(--red); }
}
