:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #65717d;
  --line: #d8e0e6;
  --paper: #f5f7f8;
  --panel: #ffffff;
  --green: #0f6b54;
  --green-dark: #094537;
  --blue: #174c7c;
  --red: #c74432;
  --gold: #d9a441;
  --shadow: 0 18px 44px rgba(16, 24, 32, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(245, 247, 248, 0.96), rgba(245, 247, 248, 0.98)),
    url("/assets/ball.svg") center 56px / 420px no-repeat;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(216, 224, 230, 0.85);
  backdrop-filter: blur(18px);
}

.brand, .userbar, .hero-stats, .tabs {
  display: flex;
  align-items: center;
}

.brand { gap: 12px; min-width: 0; }

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
}

.mark img { width: 28px; height: 28px; }
.brand h1 { margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.35rem); }
.brand p, .mini { margin: 2px 0 0; color: var(--muted); font-size: 0.86rem; }
.userbar { justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
  gap: clamp(26px, 6vw, 68px);
  align-items: center;
  min-height: 100vh;
  padding: clamp(22px, 5vw, 64px);
  overflow: hidden;
  background:
    linear-gradient(110deg, rgba(16, 24, 32, 0.88), rgba(15, 107, 84, 0.76)),
    url("https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 26vh;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.18) 1px, transparent 1px) 0 0 / 8vw 100%,
    linear-gradient(0deg, rgba(255,255,255,0.18) 1px, transparent 1px) 0 0 / 100% 50%,
    linear-gradient(180deg, transparent, rgba(9, 69, 55, 0.88));
}

.hero-copy, .login-card { position: relative; z-index: 1; }
.hero-copy { max-width: 760px; color: #fff; }

.eyebrow {
  margin: 0 0 16px;
  color: #f2c86d;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h2 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: 0.93;
  letter-spacing: 0;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 610px;
  color: rgba(255,255,255,0.86);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.hero-stats {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.hero-stats span {
  min-width: 128px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.76);
  backdrop-filter: blur(12px);
}

.hero-stats strong {
  display: block;
  color: #fff;
  font-size: 1.35rem;
}

.login-card, .panel, .match-card, .table-wrap, .squad-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(216, 224, 230, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card { padding: 24px; }
.login-card h3, .panel h2 { margin: 0 0 16px; }
.form-grid { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.45;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 76, 124, 0.12);
}

.primary, .ghost, .tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

.primary { color: #fff; background: var(--green); }
.ghost, .tab { color: var(--ink); background: #edf2f5; }
.ghost.danger { color: #7e281c; background: #ffe2dc; }

.tabs {
  gap: 8px;
  flex-wrap: wrap;
  padding: 18px clamp(16px, 4vw, 42px) 0;
}

.tab.active { color: #fff; background: var(--ink); }
.content {
  display: grid;
  gap: 18px;
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 18px clamp(16px, 3vw, 30px) 42px;
}
.panel { padding: 18px; }

.filters-panel {
  display: grid;
  gap: 14px;
}

.bonus-panel {
  display: grid;
  gap: 14px;
}

.bonus-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.bonus-head h2 {
  margin: 0 0 4px;
}

.bonus-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 420px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f5;
}

.view-switch button {
  min-height: 36px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 950;
}

.view-switch button.active {
  color: #fff;
  background: var(--ink);
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 220px) minmax(150px, 220px);
  gap: 12px;
}

.matches { display: grid; gap: 12px; }

.day-title {
  position: sticky;
  top: 67px;
  z-index: 2;
  margin: 14px 0 0;
  padding: 8px 0;
  color: var(--muted);
  background: rgba(245, 247, 248, 0.88);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.match-card {
  display: grid;
  grid-template-columns: 52px minmax(260px, 1fr) 190px;
  align-items: start;
  gap: 16px;
  padding: 12px;
  box-shadow: none;
}

.match-no {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 950;
}

.teams strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow-wrap: anywhere;
  font-size: 1.06rem;
}

.teams strong span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.teams .versus {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.meta { margin-top: 6px; color: var(--muted); font-size: 0.86rem; }

.prediction {
  display: grid;
  gap: 8px;
  justify-self: end;
  width: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.prediction::before {
  content: attr(data-label);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.score-row span { color: var(--muted); text-align: center; font-weight: 950; }
.score-row input {
  min-height: 48px;
  padding: 8px;
  border-color: #c8d4dc;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 950;
}

.prediction .primary {
  width: 100%;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 8px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 950;
}

.open { color: #075c41; background: #dff4e9; }
.locked { color: #7e281c; background: #ffe2dc; }
.saved { color: #6f4c07; background: #fff0c7; }

.history {
  grid-column: 2 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.history summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 950;
  list-style: none;
  text-transform: uppercase;
}

.history summary::-webkit-details-marker { display: none; }

.history summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #bed0dc;
  border-radius: 999px;
  color: var(--blue);
  background: #fff;
  font-size: 0.92rem;
  line-height: 1;
}

.history[open] summary::before {
  content: "-";
}

.history summary span {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 0.72rem;
}

.history p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.history-list { display: grid; gap: 6px; margin-top: 8px; }

.history-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) minmax(100px, auto);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-row strong { color: var(--ink); overflow-wrap: anywhere; }
.history-row em { font-style: normal; text-align: right; }

.table-wrap { overflow: auto; box-shadow: none; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; }

.group-board {
  display: grid;
  gap: 18px;
}

.group-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(216, 224, 230, 0.92);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  box-shadow: none;
}

.group-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.group-head h2 {
  margin: 0;
}

.group-table-wrap {
  border: 1px solid var(--line);
}

.group-table {
  min-width: 760px;
}

.group-table th,
.group-table td {
  padding: 10px 12px;
}

.group-table td:not(:nth-child(2)),
.group-table th:not(:nth-child(2)) {
  text-align: center;
}

.group-table td:nth-child(2) strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.team-flag {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  line-height: 1;
}

.group-dates {
  display: grid;
  gap: 10px;
}

.group-date {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.date-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #f8fafb;
  font-weight: 950;
  text-align: left;
}

.date-toggle span:last-child {
  color: var(--green);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.group-date-matches {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.group-date-matches .match-card {
  background: #fff;
}

.leaderboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: center;
}

.pot-box {
  padding: 14px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--green-dark));
}

.pot-box span,
.prize-card span {
  display: block;
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.pot-box strong,
.prize-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
}

.pot-box p,
.prize-card p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.prize-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.prize-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.prize-card span {
  color: var(--green);
}

.prize-card p {
  color: var(--muted);
}

.notice, .error {
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 850;
}

.notice { color: #134c39; background: #e4f6ec; }
.error { color: #7e281c; background: #ffe2dc; }

.classification-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.classification-head h2 {
  margin: 0 0 4px;
}

.classification-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.classification-stats span {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.78rem;
  font-weight: 850;
}

.classification-stats strong {
  display: block;
  color: var(--green);
  font-size: 1.35rem;
}

.classification-slider {
  position: sticky;
  top: 67px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(237, 242, 245, 0.92);
  backdrop-filter: blur(14px);
  overflow-x: auto;
}

.classification-slider button {
  min-height: 38px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 950;
}

.classification-slider button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--green));
}

.classification-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: start;
}

.classification-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.classification-card,
.classification-thirds,
.bracket-match {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  box-shadow: none;
}

.classification-card,
.classification-thirds {
  padding: 12px;
}

.classification-card-head,
.bracket-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.classification-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.classification-card-head span,
.bracket-match-head span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.mini-table {
  display: grid;
  gap: 5px;
}

.mini-table-head,
.mini-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px 34px;
  gap: 8px;
  align-items: center;
}

.mini-table-head {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mini-table-row {
  min-height: 38px;
  border-radius: 7px;
  padding: 6px 8px;
  background: #f8fafb;
  font-size: 0.82rem;
  font-weight: 850;
}

.mini-table-row.leader { background: #dff4e9; outline: 1px solid rgba(15, 107, 84, 0.2); }
.mini-table-row.qualified { background: #e5f0fb; outline: 1px solid rgba(23, 76, 124, 0.18); }
.mini-table-row.third-in { background: #fff0c7; outline: 1px solid rgba(217, 164, 65, 0.25); }
.mini-table-row.third-out,
.mini-table-row.alive { background: #f8fafb; }

.mini-team {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mini-team em,
.third-item em {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 950;
}

.mini-team strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classification-note {
  margin: 8px 0 0;
  color: #7a5208;
  font-size: 0.76rem;
  line-height: 1.35;
}

.classification-thirds {
  position: sticky;
  top: 124px;
}

.third-list {
  display: grid;
  gap: 7px;
}

.third-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 34px 48px;
  gap: 7px;
  align-items: center;
  min-height: 38px;
  border-radius: 7px;
  padding: 7px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.8rem;
}

.third-item.in {
  color: var(--ink);
  background: #fff0c7;
}

.third-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.third-item b {
  text-align: right;
}

.classification-bracket {
  display: grid;
  gap: 14px;
}

.bracket-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.bracket-title h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}

.bracket-title .eyebrow {
  margin-bottom: 6px;
  color: var(--green);
}

.bracket-title .mini {
  max-width: 520px;
}

.bracket-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
}

.bracket-grid.final-grid {
  grid-template-columns: minmax(260px, 520px);
}

.bracket-match {
  padding: 12px;
}

.bracket-match-head {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.bracket-slot {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafb;
}

.bracket-slot strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-slot span {
  color: var(--muted);
  font-size: 0.76rem;
}

.bracket-slot.pending {
  color: var(--muted);
  background: #edf2f5;
}

.bracket-line {
  width: 1px;
  height: 10px;
  margin-left: 22px;
  background: var(--line);
}

.forum-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.forum-head h2 {
  margin: 0 0 4px;
}

.forum-composer form {
  display: grid;
  gap: 12px;
}

.forum-actions,
.forum-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.forum-list {
  display: grid;
  gap: 10px;
}

.forum-post {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
}

.forum-post-head strong,
.forum-post-head span {
  display: block;
}

.forum-post-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.forum-post p {
  margin: 0;
  color: #2c3944;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.admin-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-section-head h2 {
  margin: 0;
}

.users-list {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.squads-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 16px;
  align-items: end;
}

.squad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.squad-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  box-shadow: none;
}

.squad-card h3 { margin: 0; font-size: 1.2rem; }

.squad-line {
  display: grid;
  gap: 3px;
}

.squad-line span {
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.squad-line p {
  margin: 0;
  color: #2c3944;
  font-size: 0.9rem;
  line-height: 1.42;
}

.footer { color: var(--muted); font-size: 0.82rem; }
.footer a { color: var(--blue); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; align-items: end; }
  .filters, .admin-grid, .bonus-form, .squads-head, .user-row, .leaderboard-head, .prize-grid, .classification-layout, .classification-groups, .bracket-grid { grid-template-columns: 1fr; }
  .classification-head, .bracket-title { align-items: start; flex-direction: column; }
  .classification-stats { justify-content: flex-start; }
  .classification-thirds { position: static; }
  .forum-head, .forum-actions, .forum-post-head { align-items: stretch; flex-direction: column; }
  .bonus-head { align-items: start; flex-direction: column; }
  .admin-section-head { align-items: start; flex-direction: column; }
  .match-card { grid-template-columns: 56px minmax(0, 1fr); }
  .prediction, .history { grid-column: 1 / -1; }
  .prediction { justify-self: stretch; width: 100%; }
  .history-row { grid-template-columns: 1fr; gap: 2px; }
  .history-row em { text-align: left; }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .userbar { width: 100%; justify-content: space-between; }
  .hero { padding: 18px; }
  .hero-copy h2 { font-size: clamp(2.55rem, 17vw, 4.4rem); }
  .hero-stats span { min-width: 0; flex: 1 1 120px; }
  .match-card { padding: 12px; }
}
