:root {
  color-scheme: dark;
  --bg: #061116;
  --panel: #0b1b22;
  --panel-soft: #0f252e;
  --ink: #edf7f5;
  --muted: #95aab1;
  --line: #1d3944;
  --accent: #28c79a;
  --accent-dark: #73e8c6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(40, 199, 154, .14), transparent 34rem),
    linear-gradient(180deg, #071a21 0%, var(--bg) 34rem);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--accent-dark); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(6, 17, 22, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { color: var(--ink); font-weight: 900; }
.topbar nav { display: flex; gap: 12px; font-size: 14px; }

.shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 18px 14px 92px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 6px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.45; }

.panel, .match-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
}

.panel { padding: 16px; margin-bottom: 14px; }
.intro { max-width: 480px; margin: 28px auto; }
.stack { display: grid; gap: 12px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea, button, .ghost {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
}
input, select, textarea {
  padding: 10px 12px;
  background: #07161c;
  color: var(--ink);
}
textarea { resize: vertical; }
button, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: #031b14;
  font-weight: 800;
  cursor: pointer;
}
.ghost {
  width: auto;
  min-width: 92px;
  background: transparent;
  color: var(--accent-dark);
}

.flash {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(40, 199, 154, .13);
  border: 1px solid rgba(40, 199, 154, .42);
  border-radius: 8px;
}
.flash p { margin: 0; color: var(--accent-dark); }

.match-list { display: grid; gap: 12px; }
.match-card {
  position: relative;
  padding: 14px;
  background: linear-gradient(180deg, var(--panel-soft), var(--panel));
  overflow: hidden;
}
.match-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: .8;
}
.match-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 12px 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.score-row strong:last-child { text-align: right; }
.score-row input {
  text-align: center;
  padding: 8px 4px;
  background: #041016;
  border-color: #2c5360;
  font-weight: 900;
}
.flag {
  display: inline-block;
  margin-right: 6px;
}
.muted, .result { margin: 10px 0 0; font-size: 14px; }
.result { color: var(--accent-dark); font-weight: 800; }

.group-pick {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.group-pick:first-of-type { border-top: 0; }

.sticky-save {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  width: auto;
  box-shadow: 0 12px 30px rgba(15, 138, 115, .3);
}

.ranking { display: grid; gap: 8px; }
.ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ranking-row:last-child { border-bottom: 0; }
.place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(40, 199, 154, .14);
  color: var(--accent-dark);
  font-weight: 800;
}

.admin-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px 78px;
  gap: 8px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.check input { width: auto; min-height: auto; }

@media (max-width: 620px) {
  .score-row {
    grid-template-columns: minmax(0, 1fr) 46px 10px 46px minmax(0, 1fr);
    font-size: 14px;
  }
  .admin-match { grid-template-columns: 1fr 54px 54px; }
  .admin-match .check { grid-column: 1 / -1; }
  .ranking-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .ranking-row span:nth-child(3) { display: none; }
}
