:root {
  --bg: #f6faff;
  --card: #ffffff;
  --card-soft: #f0f4fa;
  --text: #171c20;
  --muted: #3e4850;
  --line: #bec8d2;
  --line-soft: #dee3e9;
  --primary: #006591;
  --primary-bright: #0ea5e9;
  --primary-soft: #c9e6ff;
  --secondary: #6b38d4;
  --secondary-soft: #e9ddff;
  --gold: #de8712;
  --gold-soft: #ffdcbd;
  --success: #138a3d;
  --danger: #ba1a1a;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top left, rgb(201 230 255 / 0.8), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

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

.public-shell {
  padding-bottom: 24px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 16px;
  background: rgb(255 255 255 / 0.9);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  transition: background 180ms ease, border 180ms ease, color 180ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--card-soft);
  border-color: var(--line-soft);
  color: var(--primary);
  outline: none;
}

.view {
  padding: 20px 16px 28px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-two {
  grid-template-columns: 1fr;
}

.section {
  margin-top: 22px;
}

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

.section-head h2,
.card h2,
.card h3 {
  margin: 0;
}

.section-head h2 {
  font-size: 18px;
  line-height: 1.35;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.card {
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 18px;
}

.featured-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-left: 5px solid var(--primary-bright);
}

.featured-card::after {
  position: absolute;
  inset: -80px -80px auto auto;
  width: 180px;
  height: 180px;
  content: "";
  background: rgb(14 165 233 / 0.15);
  border-radius: 999px;
}

.team-row,
.fixture-row,
.model-row,
.leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flag {
  display: grid;
  width: 52px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, var(--card-soft));
  font-size: 26px;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.04);
}

.flag-lg {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  font-size: 40px;
}

.team-name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.team-code {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.score {
  margin: 14px 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.score strong {
  display: block;
  color: var(--text);
  font-size: clamp(42px, 15vw, 64px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-live {
  background: #ffe4e4;
  color: var(--danger);
}

.badge-win {
  background: var(--gold-soft);
  color: #693c00;
}

.badge-good {
  background: #dcfce7;
  color: var(--success);
}

.distribution-card {
  padding: 16px;
  border-left: 4px solid var(--primary-bright);
}

.distribution-card.draw {
  border-left-color: var(--secondary);
}

.distribution-card.away {
  border-left-color: var(--gold);
}

.distribution-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.distribution-head h3 {
  font-size: 16px;
}

.model-row,
.leader-row {
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.model-row:first-of-type,
.leader-row:first-of-type {
  border-top: 0;
}

.score-chip {
  min-width: 58px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--card-soft);
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-bright), var(--secondary));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.summary-card {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--card-soft);
}

.summary-card b {
  display: block;
  font-size: 16px;
}

.summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.same-day-grid {
  display: grid;
  gap: 10px;
}

.same-day-match {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--card-soft);
}

.same-day-match.active {
  border-color: var(--primary-bright);
  background: #eef9ff;
}

.same-day-match > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.same-day-match strong {
  font-variant-numeric: tabular-nums;
}

.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.match-tile,
.model-tile {
  width: 100%;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--card);
  text-align: left;
  transition: border 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.match-tile {
  overflow: hidden;
}

.match-tile-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.match-tile-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-tile-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.match-tile-teams span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-tile-teams span:last-child {
  justify-content: flex-end;
}

.match-tile-teams b {
  color: var(--muted);
  font-size: 10px;
}

.mini-flag {
  flex: 0 0 24px;
  width: 24px;
  height: 18px;
  border-radius: 6px;
  font-size: 13px;
}

.match-tile:hover,
.match-tile.active,
.model-tile:hover,
.model-tile.active {
  border-color: var(--primary-bright);
  background: #eef9ff;
  box-shadow: var(--shadow);
}

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

.model-tile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-mark {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--secondary);
  font-weight: 900;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-soft);
  color: var(--text);
  outline: none;
  padding: 12px 14px;
  transition: border 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary-bright);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgb(14 165 233 / 0.15);
}

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

.score-inputs .input {
  min-height: 76px;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash {
  padding-bottom: 20px;
  color: var(--muted);
  font-size: 28px;
  font-weight: 800;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.range {
  width: 100%;
  accent-color: var(--primary-bright);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  border: 1px solid var(--primary);
  border-radius: 16px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border 160ms ease;
}

.compact-button {
  width: auto;
  min-height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}

.button:hover,
.button:focus-visible {
  background: #004c6e;
  border-color: #004c6e;
  outline: none;
}

.button:active {
  transform: translateY(1px);
}

.button.secondary {
  border-color: var(--line);
  background: var(--card-soft);
  color: var(--text);
}

.split-actions {
  display: grid;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 92px;
  z-index: 50;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 560px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.12);
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.match-admin-list {
  display: grid;
  max-height: 62vh;
  overflow: auto;
  gap: 10px;
  padding-right: 4px;
}

.past-match-group {
  margin-top: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--card-soft);
}

.past-match-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.past-match-group summary::marker {
  content: "";
}

.past-match-group summary::before {
  content: "▸";
  margin-right: 8px;
  color: var(--primary);
}

.past-match-group[open] summary::before {
  content: "▾";
}

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

.manage-match-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  text-align: left;
  transition: border 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.manage-match-card:hover,
.manage-match-card:focus-visible,
.manage-match-card.active {
  border-color: var(--primary-bright);
  background: #eef9ff;
  box-shadow: var(--shadow);
  outline: none;
}

.manage-match-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .top-bar {
    padding-right: 32px;
    padding-left: 32px;
  }

  .view {
    padding: 28px 32px 40px;
  }

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

  .split-actions {
    grid-template-columns: 1fr 1fr;
  }

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

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

@media (min-width: 1024px) {
  .desktop-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
    align-items: start;
  }

  .prediction-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
    align-items: start;
  }

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

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

  .prediction-right .model-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .prediction-right .model-tile {
    display: grid;
    justify-items: center;
    min-height: 112px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
