:root {
  --bg: #06101d;
  --bg2: #0b1930;
  --panel: rgba(255, 255, 255, 0.07);
  --panel2: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f7f0dc;
  --muted: #aeb8c8;
  --gold: #f4c45b;
  --gold2: #a87322;
  --danger: #ffdf9e;
  --green: #7ff1bc;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(244, 196, 91, 0.2), transparent 30%),
    radial-gradient(circle at 90% 12%, rgba(62, 123, 255, 0.22), transparent 32%),
    linear-gradient(145deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  min-height: 260px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.13), rgba(255,255,255,0.04)),
    linear-gradient(90deg, rgba(6,16,29,0.96), rgba(10,28,55,0.88));
  box-shadow: var(--shadow);
}

.hero::before {
  content: '';
  position: absolute;
  inset: auto -15% -50% -15%;
  height: 210px;
  background:
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(255,255,255,0.08) 29px 30px),
    radial-gradient(ellipse at center, rgba(31, 155, 89, 0.45), rgba(5, 51, 31, 0.18) 60%, transparent 72%);
  transform: perspective(450px) rotateX(55deg);
  transform-origin: top;
}

.hero-glow {
  position: absolute;
  right: -70px;
  top: -90px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(244,196,91,0.45), transparent 65%);
  filter: blur(4px);
}

.topbar {
  position: relative;
  display: flex;
  gap: 18px;
  align-items: center;
}

.brand-badge {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--gold), var(--gold2));
  color: #1a1205;
  font-weight: 1000;
  letter-spacing: -0.08em;
  box-shadow: 0 14px 36px rgba(244,196,91,0.27);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  line-height: 0.9;
  margin-bottom: 0;
  letter-spacing: -0.07em;
}

h2 { font-size: clamp(1.45rem, 4vw, 2.2rem); margin-bottom: 0; }
h3 { margin-bottom: 8px; }

.lead {
  position: relative;
  width: min(660px, 100%);
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(720px, 100%);
  margin-top: 26px;
}

.hero-stats div {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0,0,0,0.18);
}

.hero-stats strong { display: block; font-size: 1.6rem; }
.hero-stats span { color: var(--muted); font-size: 0.86rem; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(6, 16, 29, 0.83);
  backdrop-filter: blur(14px);
}

.tab, .filter, .ghost, .gold {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 800;
}

.tab.active, .filter.active, .gold {
  background: linear-gradient(145deg, var(--gold), var(--gold2));
  color: #191104;
  border-color: rgba(244,196,91,0.72);
}

.ghost:hover, .tab:hover, .filter:hover { background: rgba(255,255,255,0.12); }
.gold:hover { filter: brightness(1.07); }

.view { display: none; }
.view.active { display: block; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
}
.section-head.wrap { align-items: center; flex-wrap: wrap; }

.panel, .rank-card, .match-card, .notice {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0,0,0,0.18);
}

.panel { padding: 20px; margin-top: 18px; }
.notice { padding: 16px; margin-bottom: 16px; color: var(--muted); }
.notice.warning { color: var(--danger); }

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rank-card {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  overflow: hidden;
}

.rank-card.leader {
  background: linear-gradient(135deg, rgba(244,196,91,0.24), rgba(255,255,255,0.08));
  border-color: rgba(244,196,91,0.55);
}

.place {
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 1000;
}

.avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,0.12);
  font-weight: 1000;
}

.rank-main p, .match-meta, .match-footer, .empty, .panel p, .clean-list { color: var(--muted); }
.points { text-align: right; }
.points strong { display: block; font-size: 2rem; color: var(--gold); }
.points span { color: var(--muted); }

.mini-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mini-stats span, .chips span, .points-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(0,0,0,0.18);
  color: var(--muted);
  font-size: 0.88rem;
}

.select-label {
  display: grid;
  gap: 6px;
  color: var(--gold);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}
select, input, textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,0.24);
  color: var(--text);
}
select { padding: 12px 14px; min-width: 190px; }

.filters {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.filter { min-width: 46px; }

.match-list {
  display: grid;
  gap: 12px;
}
.match-list.compact { gap: 10px; }

.match-card {
  padding: 16px;
}
.match-card.small { padding: 14px; }
.match-top, .admin-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.match-card h3 span { color: var(--gold); font-size: 0.86em; }
.points-pill { color: var(--gold); font-weight: 900; }

.score-row {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}
.score-row label {
  flex: 1;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}
.score-row input {
  width: 100%;
  padding: 14px;
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}
.colon {
  padding-bottom: 13px;
  color: var(--gold);
  font-weight: 1000;
  font-size: 1.4rem;
}
.match-footer { margin-top: 12px; }

.group-block { margin-bottom: 18px; }
.admin-score { margin-top: 0; }
.admin-score input { width: 74px; flex: 0; }

.teams-line { margin: 6px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.data-panel textarea {
  width: 100%;
  min-height: 170px;
  padding: 14px;
  resize: vertical;
  margin: 12px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}
.rule-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
}
.rule-card strong { display: block; color: var(--gold); font-size: 1.8rem; }
.rule-card span { color: var(--muted); }
.clean-list { padding-left: 18px; line-height: 1.7; }

footer {
  color: var(--muted);
  text-align: center;
  padding: 28px 8px 14px;
}

@media (max-width: 760px) {
  .app-shell { padding: 12px; }
  .hero { padding: 20px; border-radius: 22px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .ranking-grid { grid-template-columns: 1fr; }
  .rank-card { grid-template-columns: auto auto 1fr; }
  .points { grid-column: 1 / -1; text-align: left; }
  .section-head { align-items: stretch; flex-direction: column; }
  .match-top, .admin-card { align-items: stretch; flex-direction: column; }
  .rule-grid { grid-template-columns: 1fr; }
}
