:root {
  --ink: #f2f4f7;
  --muted: #8b95a5;
  --paper: #12151c;
  --panel: rgba(16, 18, 24, 0.72);
  --line: rgba(242, 244, 247, 0.1);
  --accent: #e8ecf2;
  --accent-deep: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --gold: #e0b34a;
  --silver: #c5ced8;
  --bronze: #d08a55;
  --danger: #ff7b72;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Onest", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255, 255, 255, 0.08), transparent 58%),
    radial-gradient(700px 420px at 90% 15%, rgba(180, 200, 255, 0.05), transparent 55%),
    radial-gradient(600px 380px at 10% 80%, rgba(255, 255, 255, 0.035), transparent 50%),
    linear-gradient(165deg, #0c0e13 0%, #12151c 45%, #161a22 100%);
}

.bg::after {
  display: none;
}

.fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shell {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 6.5rem;
}

.brand {
  text-align: center;
  margin-bottom: 2rem;
  animation: rise 0.7s ease both;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.28em;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.tournament-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0.58em;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 0.2em;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.44em;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  background: transparent;
}

.tagline {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.participants-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0.42rem 0.85rem 0.42rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: rise 0.7s ease 0.12s both;
}

.participants-chip[hidden] {
  display: none;
}

.participants-icon {
  width: 1.05rem;
  height: 1.05rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.participants-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.participants-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.active-banner {
  margin: 1.25rem auto 0;
  width: fit-content;
  max-width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  animation: pulseSoft 2.4s ease-in-out infinite;
}

.active-banner.hidden {
  display: none;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  animation: rise 0.7s ease 0.08s both;
}

.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.tab:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

.tab.is-active {
  background: #fff;
  color: #050608;
  border-color: #fff;
}

.tab:active {
  transform: scale(0.98);
}

.panel {
  animation: rise 0.65s ease 0.12s both;
}

.panel[hidden] {
  display: none;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search input::placeholder {
  color: rgba(242, 244, 247, 0.4);
}

.search input:focus {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.search button {
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #050608;
  font: inherit;
  font-weight: 700;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.search button:hover {
  background: #e8ecf2;
}

.search button:active {
  transform: scale(0.98);
}

.search-result {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.search-result.is-miss {
  border-color: rgba(255, 123, 114, 0.35);
  color: var(--danger);
}

.search-result.is-hit {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.35rem;
}

.search-block {
  display: grid;
  gap: 0.35rem;
}

.search-toggle {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-toggle-text {
  font-weight: 600;
}

.search-toggle-hint {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.board {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-head,
.row {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1.1rem;
}

.board-head {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.row {
  border-bottom: 0;
  transition: background 0.2s ease;
}

.row-block {
  border-bottom: 1px solid var(--line);
}

.row-block:last-child {
  border-bottom: 0;
}

.row-block .row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.row:last-child {
  border-bottom: 0;
}

.row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.place {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.place.p1 { color: var(--gold); }
.place.p2 { color: var(--silver); }
.place.p3 { color: var(--bronze); }

.nick {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.15rem 0.25rem;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex-wrap: wrap;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nick-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nick-name {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.28);
  text-underline-offset: 0.18em;
}

.nick-toggle:hover .nick-name {
  text-decoration-color: rgba(255, 255, 255, 0.7);
}

.row-preds {
  padding: 0.55rem 1.1rem 0.85rem;
  animation: rise 0.25s ease both;
}

.row-preds[hidden] {
  display: none;
}

.search-block .row-preds {
  padding: 0.35rem 0.55rem 0.55rem;
}

.accuracy {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 0.12rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.streak-flame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.85rem;
  height: 2.15rem;
  background: url("/streak-flame.png") center / contain no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 110, 20, 0.45));
}

.streak-flame--blue {
  background-image: url("/streak-flame-blue.png");
  filter: drop-shadow(0 0 6px rgba(60, 140, 255, 0.55));
}

.streak-num {
  position: relative;
  z-index: 1;
  margin-top: 0.45rem;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1a0800;
  text-shadow:
    0 0 3px rgba(255, 245, 200, 0.95),
    0 0 1px rgba(255, 255, 255, 0.9);
  line-height: 1;
}

.streak-flame--blue .streak-num {
  color: #041018;
  text-shadow:
    0 0 3px rgba(210, 240, 255, 0.95),
    0 0 1px rgba(255, 255, 255, 0.9);
}

.points {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.empty {
  margin: 0;
  padding: 2rem 1.1rem;
  text-align: center;
  color: var(--muted);
}

.matches {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.match {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.45s ease both;
}

.match-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 1.2rem;
}

.match-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.match-meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.match-side {
  text-align: right;
}

.match-winner {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}

.match-count {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.toggle-voters {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  width: 100%;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1.2rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}

.toggle-voters:hover {
  background: rgba(255, 255, 255, 0.05);
}

.voters {
  padding: 0.85rem 1.2rem 1.15rem;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.45rem;
  border-top: 1px solid var(--line);
}

.voters[hidden] {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  font-weight: 500;
}

.show-all-voters {
  display: inline-flex;
  align-items: center;
  margin-top: 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.show-all-voters:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.show-all-voters:disabled {
  opacity: 0.6;
  cursor: wait;
}

.footer-links {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  width: max-content;
  max-width: calc(100% - 1.5rem);
  padding: 0.45rem;
  border-radius: 999px;
  background: rgba(12, 14, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.footer-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.footer-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.footer-link:active {
  transform: scale(0.98);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(16, 18, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: rise 0.28s ease both;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.modal-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow: auto;
}

.preds-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.preds-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.45rem;
}

.pred-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-chip.is-win {
  color: #b6f0d0;
  background: rgba(46, 160, 100, 0.22);
  border: 1px solid rgba(70, 190, 120, 0.4);
}

.pred-chip.is-lose {
  color: #ffc4c0;
  background: rgba(180, 60, 60, 0.22);
  border: 1px solid rgba(220, 90, 90, 0.4);
}

.pred-chip.is-pending {
  color: #ffe6a8;
  background: rgba(210, 160, 40, 0.22);
  border: 1px solid rgba(230, 180, 50, 0.45);
}

.rules-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.7rem;
  color: rgba(242, 244, 247, 0.88);
  font-size: 0.95rem;
  line-height: 1.45;
}

.rules-list strong {
  color: #fff;
  font-weight: 700;
}

body.modal-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseSoft {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1.25rem, 920px);
    padding-top: 2.25rem;
    padding-bottom: 6.75rem;
  }

  .footer-link {
    min-width: 0;
    padding: 0.55rem 0.9rem;
    font-size: 0.86rem;
  }

  .board-head {
    display: none;
  }

  .row {
    grid-template-columns: 48px 1fr auto;
    gap: 0.2rem 0.75rem;
  }

  .match-main {
    grid-template-columns: 1fr;
  }

  .match-side {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .tabs,
  .panel,
  .match,
  .active-banner {
    animation: none !important;
  }
}
