:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #18212f;
  --muted: #64748b;
  --line: #dce3ec;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --user-green: #047857;
  --user-blue: #2563eb;
  --user-red: #dc2626;
  --danger-bg: #fff1f2;
  --danger: #be123c;
  --success-bg: #ecfdf5;
  --success: #047857;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.brand {
  display: block;
  flex: 0 1 210px;
  min-width: 118px;
  line-height: 0;
}

.brand img {
  display: block;
  width: 100%;
  max-width: 210px;
  aspect-ratio: 3 / 1;
  object-fit: contain;
  object-position: center;
}

nav {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 22px 16px 92px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.title-banner {
  margin: -8px 0 22px;
  background: transparent;
}

.title-banner img {
  display: block;
  width: 100%;
  max-height: 320px;
  aspect-ratio: 3 / 1.4;
  object-fit: contain;
  object-position: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.score-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 14px;
  font-weight: 800;
}

.user-display,
.user-color-name,
.prediction-user {
  font-weight: 850;
}

.user-color-green {
  color: var(--user-green);
}

.user-color-blue {
  color: var(--user-blue);
}

.user-color-red {
  color: var(--user-red);
}

.stack {
  display: grid;
  gap: 24px;
}

.group-section {
  display: grid;
  gap: 12px;
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.user-color-panel {
  display: grid;
  gap: 10px;
}

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

.admin-link-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.admin-link-row a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.user-color-row {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.user-color-name {
  font-size: 17px;
}

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

.color-choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.color-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-choice::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border-radius: 999px;
}

.color-choice-green::before {
  background: var(--user-green);
}

.color-choice-blue::before {
  background: var(--user-blue);
}

.color-choice-red::before {
  background: var(--user-red);
}

.color-choice:has(input:checked) {
  border-color: currentColor;
  background: #f8fafc;
  color: var(--text);
}

.color-choice-green:has(input:checked) {
  color: var(--user-green);
}

.color-choice-blue:has(input:checked) {
  color: var(--user-blue);
}

.color-choice-red:has(input:checked) {
  color: var(--user-red);
}

.rules-grid {
  display: grid;
  gap: 12px;
}

.rules-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.rules-card h2 {
  margin-bottom: 12px;
}

.rules-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  font-weight: 650;
}

.points-list,
.example-list {
  display: grid;
  gap: 10px;
}

.points-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.points-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.points-row strong {
  color: var(--accent);
  font-size: 20px;
}

.points-row span,
.example-list {
  color: var(--muted);
  font-weight: 700;
}

.example-list strong {
  color: var(--text);
}

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

.match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.match-card.missing-match {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.match-card.missing-match input[type="number"] {
  border-color: var(--danger);
  background: #fff;
}

.match-card.missing-match .result-line {
  color: var(--danger);
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.match-row label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.match-row label:last-child {
  grid-template-columns: 62px minmax(0, 1fr);
  text-align: right;
}

.match-row span {
  overflow-wrap: anywhere;
}

.versus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input[type="number"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: center;
}

input:disabled {
  background: #eef2f7;
  color: var(--muted);
}

.result-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sticky-actions {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

button {
  display: block;
  width: min(100%, 948px);
  min-height: 48px;
  margin: 0 auto;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.notice {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 750;
}

.notice.success {
  background: var(--success-bg);
  color: var(--success);
}

.notice.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.results-section {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.results-group-list {
  display: grid;
  gap: 14px;
}

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

.results-group h3 {
  margin: 0;
  font-size: 16px;
}

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

.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.result-match {
  font-weight: 850;
  overflow-wrap: anywhere;
}

.result-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.official-score {
  min-width: 76px;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--success);
  padding: 7px 10px;
  text-align: center;
  font-weight: 900;
  white-space: nowrap;
}

.official-score.not-played {
  background: #eef2f7;
  color: var(--muted);
}

.prediction-section {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

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

.prediction-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.prediction-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

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

.prediction-card summary::after {
  content: "+";
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 900;
}

.prediction-card[open] summary::after {
  content: "-";
}

.prediction-user {
  font-size: 17px;
  font-weight: 850;
}

.prediction-summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.prediction-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.prediction-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.prediction-row:last-child {
  border-bottom: 0;
}

.prediction-match {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.prediction-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.prediction-score {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 2px;
  min-width: 64px;
}

.prediction-score strong {
  font-size: 18px;
}

.prediction-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  color: var(--muted);
  font-weight: 750;
}

@media (min-width: 720px) {
  .topbar {
    padding: 16px 28px;
  }

  .shell {
    padding-top: 36px;
  }

  h1 {
    font-size: 44px;
  }

  .match-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-color-row {
    grid-template-columns: minmax(160px, 1fr) minmax(320px, 1.4fr);
    align-items: center;
  }

  .admin-link-row {
    grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
    align-items: center;
  }

  .rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rules-card-wide {
    grid-column: 1 / -1;
  }
}
