:root {
  color-scheme: light;
  --bg: #eef3ec;
  --surface: #ffffff;
  --surface-2: #e7f0e6;
  --ink: #11231b;
  --muted: #5f6e64;
  --line: #dde6d9;
  --green: #11713f;
  --green-bright: #18a05a;
  --green-dark: #0a3a26;
  --green-soft: #dcefe2;
  --red: #ce3a2c;
  --gold: #e8b842;
  --gold-deep: #c8901a;

  /* layered elevation */
  --shadow-sm: 0 1px 2px rgba(14, 38, 26, 0.06), 0 2px 6px rgba(14, 38, 26, 0.05);
  --shadow-md: 0 8px 24px rgba(14, 38, 26, 0.09);
  --shadow-lg: 0 22px 54px rgba(14, 38, 26, 0.16);
  --shadow: 0 18px 48px rgba(22, 44, 32, 0.1);

  /* radius scale */
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --speed: 0.18s;
  --ring: 0 0 0 3px rgba(17, 113, 63, 0.32);

  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(24, 160, 90, 0.14), transparent 38%),
    radial-gradient(circle at top right, rgba(232, 184, 66, 0.2), transparent 36%),
    linear-gradient(180deg, rgba(17, 113, 63, 0.06), transparent 30%),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Crisp, consistent keyboard focus everywhere */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  border-radius: var(--radius-sm);
}

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

.auth-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(24, 160, 90, 0.3), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(232, 184, 66, 0.26), transparent 40%),
    linear-gradient(160deg, #0a3a26, #0d4d31 55%, #11713f);
}

/* Subtle pitch stripes behind the login card */
.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.04) 0 56px,
    rgba(255, 255, 255, 0) 56px 112px
  );
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: min(100%, 440px);
  padding: 32px 30px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: card-rise 0.5s var(--ease) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--gold) 60%, var(--green-bright));
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.trophy,
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: linear-gradient(150deg, var(--green-bright), var(--green-dark));
  box-shadow:
    0 0 0 1px rgba(232, 184, 66, 0.7),
    0 8px 20px rgba(10, 58, 38, 0.32);
  font-size: 26px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  font-size: 23px;
}

.brand-lockup h1,
.brand h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand-lockup p,
.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
}

.login-form input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(17, 105, 62, 0.12);
}

.login-form button,
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  color: white;
  background: var(--green);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(17, 105, 62, 0.22);
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.topbar,
.status-strip,
.picks-panel,
.leaderboard-panel,
.score-panel,
.matches-panel,
.share-panel,
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(18, 35, 28, 0.06);
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 251, 246, 0.95));
  box-shadow: var(--shadow-md);
}

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

.top-actions,
.toolbar,
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-button,
.secondary-button,
.text-button,
.tab,
.view-all,
.avatar-button,
dialog button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button,
.secondary-button,
.view-all,
dialog button {
  padding: 0 13px;
}

.avatar-button {
  width: 40px;
  padding: 0;
  border-color: var(--green-dark);
  color: white;
  background: var(--green-dark);
}

.status-strip {
  margin-top: 12px;
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.status-strip article {
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}

.countdown-label {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
}

.countdown-label[data-tone="warn"] {
  color: var(--red);
}

.countdown-label[data-tone="locked"] {
  color: var(--muted);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}

.picks-panel {
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.panel-heading p,
.section-heading span {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.secondary-button {
  background: #fbfcfa;
}

.primary-button {
  padding: 0 15px;
}

.bracket {
  display: grid;
  grid-template-columns: repeat(5, minmax(136px, 1fr));
  gap: 12px;
  max-height: calc(100vh - 286px);
  min-height: 580px;
  overflow: auto;
  padding: 0 2px 8px 0;
}

.bracket.bracket-preview-shell {
  grid-template-columns: minmax(0, 1fr);
  max-height: none;
  min-height: 0;
  overflow: visible;
}

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

.group-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-right: 2px;
}

.group-jump {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 8px;
  background: linear-gradient(#fff, rgba(255, 255, 255, 0.88));
}

.group-jump a {
  min-width: 34px;
  min-height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: #fbfcfa;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.group-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f8fbf6);
}

.group-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.group-title h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.group-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.group-match {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.match-pair {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.match-pair span {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-pair strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
}

.match-pair small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

.match-pair em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

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

.match-choice {
  min-width: 0;
  min-height: 34px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: #fbfcfa;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
}

.match-choice[data-choice="home"] {
  order: 1;
}

.match-choice[data-choice="away"] {
  order: 2;
}

.match-choice[data-choice="draw"] {
  grid-column: 1 / -1;
  order: 3;
}

.match-choice:hover,
.match-choice:focus-visible {
  border-color: rgba(17, 105, 62, 0.34);
  background: var(--green-soft);
  outline: none;
}

.match-choice.selected {
  border-color: var(--green);
  background: #dceee2;
  box-shadow: inset 0 0 0 1px rgba(17, 105, 62, 0.12);
}

.match-choice:disabled,
.primary-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.inline-match-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--muted);
  background: #f7faf6;
  font-size: 11px;
  font-weight: 850;
}

.inline-match-status[data-status="live"] {
  color: var(--red);
  background: #fff1ef;
}

.inline-match-status[data-status="final"] {
  color: var(--green-dark);
  background: var(--green-soft);
}

.save-status {
  min-height: 22px;
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.save-status[data-tone="success"] {
  color: var(--green);
}

.save-status[data-tone="warn"] {
  color: var(--red);
}

.round {
  min-width: 136px;
  display: grid;
  align-content: start;
  gap: 9px;
}

.knockout-empty {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 100%;
  min-height: 620px;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(220, 238, 226, 0.8), rgba(255, 255, 255, 0.9)),
    #fff;
  overflow-x: auto;
}

.knockout-empty-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 780px;
}

.knockout-empty-heading h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.knockout-empty-heading p,
.knockout-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.knockout-note {
  max-width: 720px;
  margin: 0;
}

.knockout-map {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  overflow: visible;
}

.bracket-side {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  align-items: center;
  gap: 6px;
}

.bracket-preview-column {
  display: grid;
  gap: 8px;
}

.bracket-preview-column > span,
.bracket-final > span {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.bracket-preview-column > div {
  display: grid;
  gap: 7px;
}

.bracket-preview-column[data-count="4"] > div {
  gap: 24px;
}

.bracket-preview-column[data-count="2"] > div {
  gap: 88px;
}

.bracket-preview-column[data-count="1"] > div {
  min-height: 330px;
  align-content: center;
}

.preview-match {
  position: relative;
  min-height: 54px;
  display: grid;
  gap: 3px;
  padding: 7px;
  border: 1px dashed #c7d4c6;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.preview-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -7px;
  width: 7px;
  border-top: 1px solid #c7d4c6;
}

.bracket-side-right .preview-match::after {
  right: auto;
  left: -7px;
}

.preview-match small {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.preview-match strong,
.preview-match em,
.final-slot {
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.preview-match em {
  color: var(--muted);
}

.bracket-final {
  display: grid;
  justify-items: stretch;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 24px rgba(18, 35, 28, 0.08);
}

.final-slot {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px dashed #c7d4c6;
  border-radius: 6px;
  background: #fbfcfa;
  text-align: center;
}

.final-cup {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: var(--radius);
  color: white;
  background: var(--green-dark);
  font-size: 22px;
}

.bracket-final strong {
  padding-top: 2px;
  color: var(--green-dark);
  font-size: 13px;
  text-align: center;
}

.round-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 0 7px;
  color: var(--green-dark);
  background: linear-gradient(#fff, rgba(255, 255, 255, 0.86));
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.match {
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f8fbf6);
}

.team-button {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.team-button:hover,
.team-button:focus-visible {
  border-color: rgba(17, 105, 62, 0.32);
  background: var(--green-soft);
  outline: none;
}

.team-button.selected {
  border-color: var(--green);
  background: #e8f4ec;
}

.team-button[disabled] {
  color: #9ca79e;
  cursor: not-allowed;
}

.flag {
  font-size: 18px;
  line-height: 1;
}

.team-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seed {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.champion-card {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #113f2a, #1c7b4f);
  color: white;
}

.champion-card > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.13);
  font-size: 24px;
}

.champion-card p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.35;
}

.side-rail {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}

.leaderboard-panel,
.score-panel,
.matches-panel,
.share-panel {
  padding: 14px;
}

.tabs {
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 12px;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
}

.tab.active {
  color: white;
  background: var(--green-dark);
}

.tab:disabled {
  color: #9ca79e;
  cursor: not-allowed;
}

.leaderboard-panel table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.leaderboard-panel th:nth-child(1),
.leaderboard-panel td:nth-child(1) {
  width: 28px;
}

.leaderboard-panel th:nth-child(3),
.leaderboard-panel td:nth-child(3),
.leaderboard-panel th:nth-child(4),
.leaderboard-panel td:nth-child(4),
.leaderboard-panel th:nth-child(5),
.leaderboard-panel td:nth-child(5) {
  width: 42px;
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5) {
  text-align: right;
}

#leaderboard tr[data-pick-status="picked"] {
  background: linear-gradient(90deg, rgba(220, 238, 226, 0.8), transparent 46%);
}

#leaderboard tr[data-pick-status="missing"] {
  background: linear-gradient(90deg, rgba(255, 241, 239, 0.95), transparent 48%);
}

#leaderboard tr[data-pick-status="picked"] td:first-child {
  border-left: 4px solid var(--green);
}

#leaderboard tr[data-pick-status="missing"] td:first-child {
  border-left: 4px solid var(--red);
}

.friend-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
}

.friend-button {
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.friend-button:hover,
.friend-button:focus-visible {
  color: var(--green);
  outline: none;
}

.friend-name {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.leaderboard-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-key i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
}

.leaderboard-key i[data-status="picked"] {
  background: var(--green);
}

.leaderboard-key i[data-status="missing"] {
  background: var(--red);
}

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

.match-dashboard-section {
  display: grid;
  gap: 8px;
}

.match-dashboard-section + .match-dashboard-section {
  margin-top: 14px;
}

.match-dashboard-section h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.score-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.score-summary p,
.score-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.score-summary strong {
  color: var(--green-dark);
}

.score-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.score-list strong {
  font-size: 13px;
}

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

.score-note {
  margin-top: 10px;
}

.match-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.match-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  line-height: 1.3;
}

.match-card span,
.match-card time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.match-status {
  align-self: start;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 900;
}

.match-card[data-status="live"] .match-status {
  color: var(--red);
  background: #fff1ef;
}

.match-card[data-status="final"] .match-status {
  color: var(--green-dark);
  background: var(--green-soft);
}

.live-room {
  display: grid;
  gap: 12px;
}

.live-room-empty,
.live-feature,
.live-pick-column,
.no-pick-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.live-room-empty {
  padding: 18px;
}

.live-room-empty h3 {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 18px;
}

.live-room-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.live-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(220, 238, 226, 0.82), rgba(255, 255, 255, 0.92)),
    #fff;
}

.live-feature[data-status="live"] {
  border-color: rgba(199, 57, 45, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 241, 239, 0.92), rgba(255, 255, 255, 0.94)),
    #fff;
}

.live-feature-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
}

.live-feature-copy span {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-feature-copy h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.live-feature-copy em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.live-feature-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.live-score-card {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 6px;
  padding: 14px;
  border-radius: 6px;
  color: white;
  background: var(--green-dark);
}

.live-feature[data-status="live"] .live-score-card {
  background: var(--red);
}

.live-score-card strong {
  font-size: 24px;
  line-height: 1;
  text-align: right;
}

.live-score-card span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-match-rail {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 8px;
}

.live-match-button {
  min-width: 58px;
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: #fff;
}

.live-match-button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(17, 105, 62, 0.12);
}

.live-match-button[data-status="live"] {
  color: var(--red);
  border-color: rgba(199, 57, 45, 0.28);
}

.live-match-button strong {
  font-size: 14px;
  line-height: 1;
}

.live-match-button span {
  color: inherit;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

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

.live-pick-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  background: #fff;
}

.live-pick-column[data-result="correct"] {
  border-color: rgba(17, 105, 62, 0.38);
  background: #f0f8f2;
}

.live-pick-column[data-result="wrong"] {
  opacity: 0.72;
}

.live-pick-column header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pick-column header > span {
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 900;
}

.live-pick-column h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
}

.live-pick-column p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.player-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.player-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfa;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
}

.player-chip b {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 9px;
}

.empty-chip {
  padding: 10px;
  border: 1px dashed #c7d4c6;
  border-radius: 6px;
  background: #fbfcfa;
}

.no-pick-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.no-pick-strip strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-button {
  min-height: auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--green);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--ink);
  background: #fbfcfa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
}

dialog {
  width: min(92vw, 440px);
  padding: 22px;
  border: 1px solid var(--line);
}

.player-dialog {
  width: min(94vw, 760px);
  max-height: min(86vh, 860px);
  overflow: auto;
}

.dialog-close {
  float: right;
}

.player-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}

.player-detail-header h2 {
  margin: 0;
  font-size: 22px;
}

.player-detail-header p,
.detail-meta,
.detail-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.detail-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.detail-score-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.detail-score-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-score-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section + .detail-section {
  margin-top: 14px;
}

.detail-section h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 15px;
}

.detail-picks-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-pick {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.detail-pick[data-result="correct"] {
  border-color: rgba(17, 105, 62, 0.36);
  background: #f0f8f2;
}

.detail-pick[data-result="wrong"] {
  border-color: rgba(199, 57, 45, 0.32);
  background: #fff7f6;
}

.detail-pick span {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-pick strong {
  font-size: 12px;
  line-height: 1.25;
}

.detail-pick p,
.detail-loading {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

dialog::backdrop {
  background: rgba(6, 20, 14, 0.46);
}

dialog h2 {
  margin: 0 0 10px;
}

dialog p {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1040px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

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

  .matches-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    gap: 6px;
  }

  .ghost-button {
    display: none;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .secondary-button,
  .primary-button {
    width: 100%;
  }

  .bracket {
    grid-template-columns: repeat(5, 82vw);
    max-height: none;
    min-height: 0;
  }

  .group-cards {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: 0;
  }

  .group-jump {
    margin: -4px 0 2px;
  }

  .knockout-empty {
    min-height: 520px;
    padding: 24px 16px;
    overflow-x: auto;
  }

  .knockout-empty-heading {
    align-items: flex-start;
  }

  .knockout-map {
    width: 940px;
    min-width: 940px;
  }

  .side-rail {
    grid-template-columns: 1fr;
  }

  .live-feature,
  .live-pick-grid {
    grid-template-columns: 1fr;
  }

  .live-score-card {
    justify-items: start;
  }

  .live-score-card strong {
    text-align: left;
  }

  .live-feature-copy h3 {
    font-size: 22px;
  }

  .no-pick-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-picks-list {
    grid-template-columns: 1fr;
  }

  .topbar,
  .status-strip,
  .picks-panel,
  .leaderboard-panel,
  .score-panel,
  .matches-panel,
  .share-panel {
    border-radius: 12px;
  }
}

/* =====================================================================
   Polish layer — transitions, micro-interactions, depth, mobile targets
   Appended last so it augments the base rules above via source order.
   ===================================================================== */

/* --- Motion: smooth interactive feedback ------------------------------ */
.primary-button,
.ghost-button,
.secondary-button,
.text-button,
.tab,
.view-all,
.avatar-button,
.team-button,
.live-match-button,
.friend-button,
.group-jump a,
.player-chip,
dialog button {
  transition:
    transform var(--speed) var(--ease),
    background-color var(--speed) var(--ease),
    border-color var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

/* --- Primary action: confident gradient + lift ------------------------ */
.login-form button,
.primary-button {
  background: linear-gradient(160deg, var(--green-bright), var(--green));
  box-shadow: 0 10px 22px rgba(17, 113, 63, 0.26);
  letter-spacing: 0.01em;
}

.login-form button:hover,
.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(17, 113, 63, 0.32);
}

.login-form button:active,
.primary-button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(17, 113, 63, 0.26);
}

.ghost-button:hover,
.secondary-button:hover,
.view-all:hover,
dialog button:hover {
  border-color: rgba(17, 113, 63, 0.4);
  background: var(--green-soft);
  transform: translateY(-1px);
}

.avatar-button {
  background: linear-gradient(150deg, var(--green), var(--green-dark));
}

.avatar-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* --- Inputs ----------------------------------------------------------- */
.login-form input {
  transition:
    border-color var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease);
}

/* --- Status strip: accent the live countdown card --------------------- */
.status-strip article {
  transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}

.status-strip article:first-child {
  background:
    linear-gradient(135deg, rgba(24, 160, 90, 0.12), rgba(255, 255, 255, 0) 70%),
    #fbfcfa;
  border-color: rgba(17, 113, 63, 0.22);
}

/* --- Tabs: rounded pills with a lifted active state ------------------- */
.tabs {
  gap: 4px;
}

.tab {
  border-radius: calc(var(--radius) - 5px);
  font-weight: 800;
}

.tab.active {
  background: linear-gradient(150deg, var(--green), var(--green-dark));
  box-shadow: 0 6px 14px rgba(10, 58, 38, 0.26);
}

.tab:not(.active):not(:disabled):hover {
  background: rgba(17, 113, 63, 0.1);
  color: var(--green-dark);
}

/* --- Group match choices: clear hover + selected check ---------------- */
.match-choice {
  position: relative;
}

.match-choice.selected {
  border-color: var(--green);
  background: linear-gradient(150deg, var(--green-soft), #eef8f1);
  box-shadow: inset 0 0 0 1px rgba(17, 113, 63, 0.35);
  color: var(--green-dark);
}

.match-choice.selected::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 5px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.group-card {
  box-shadow: var(--shadow-sm);
}

/* --- Knockout team buttons ------------------------------------------- */
.team-button.selected {
  background: linear-gradient(150deg, var(--green-soft), #eef8f1);
  box-shadow: inset 0 0 0 1px rgba(17, 113, 63, 0.28);
}

.final-cup,
.live-pick-column header > span {
  box-shadow: var(--shadow-sm);
}

.final-cup {
  background: linear-gradient(150deg, var(--green-bright), var(--green-dark));
}

.champion-card {
  box-shadow: var(--shadow-md);
}

/* --- Leaderboard: medal accents for the top three -------------------- */
#leaderboard tr {
  transition: background-color var(--speed) var(--ease);
}

#leaderboard tr:hover {
  background: rgba(17, 113, 63, 0.05);
}

#leaderboard tr:nth-child(1) td:first-child,
#leaderboard tr:nth-child(2) td:first-child,
#leaderboard tr:nth-child(3) td:first-child {
  font-weight: 900;
}

#leaderboard tr:nth-child(1) .avatar {
  background: linear-gradient(150deg, #f3cf5e, var(--gold-deep));
  box-shadow: 0 0 0 2px rgba(232, 184, 66, 0.4);
}

#leaderboard tr:nth-child(2) .avatar {
  background: linear-gradient(150deg, #c9d2cd, #8c988f);
}

#leaderboard tr:nth-child(3) .avatar {
  background: linear-gradient(150deg, #d9a877, #b07a44);
}

.friend-button:hover .friend-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Live status: a soft pulse so "live" reads instantly -------------- */
.match-card[data-status="live"] .match-status,
.inline-match-status[data-status="live"],
.live-match-button[data-status="live"] {
  animation: live-pulse 2s var(--ease) infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(206, 58, 44, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(206, 58, 44, 0.14);
  }
}

.live-feature[data-status="live"] .live-score-card {
  background: linear-gradient(150deg, #e0493a, var(--red));
}

/* --- Dialogs: smoother entrance -------------------------------------- */
dialog[open] {
  animation: card-rise 0.28s var(--ease) both;
}

dialog::backdrop {
  backdrop-filter: blur(2px);
}

/* =====================================================================
   Mobile-first refinements
   ===================================================================== */
@media (max-width: 720px) {
  .app-shell {
    /* respect notch / home indicator */
    padding: 10px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .topbar {
    top: 0;
    align-items: center;
    border-radius: 12px;
  }

  .brand h1 {
    font-size: 21px;
  }

  /* Comfortable thumb targets */
  .match-choice {
    min-height: 46px;
    font-size: 12px;
  }

  .tab {
    min-height: 44px;
  }

  .team-button {
    min-height: 46px;
  }

  .primary-button,
  .avatar-button {
    min-height: 44px;
  }

  .avatar-button {
    width: 44px;
  }

  /* Compact: group card spans the row, the two scores share the next row */
  .status-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .status-strip article:first-child {
    grid-column: 1 / -1;
  }

  .status-strip article {
    min-height: 0;
    padding: 9px 10px;
  }

  .status-strip span {
    font-size: 10px;
  }

  .status-strip strong {
    font-size: 13px;
  }

  .countdown-label {
    font-size: 11px;
  }

  /* Scroll affordance + snap for the horizontally scrolling bracket */
  .bracket {
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  .bracket > .round {
    scroll-snap-align: start;
  }

  .group-jump,
  .live-match-rail {
    -webkit-overflow-scrolling: touch;
  }
}

/* Very small phones: stack the group match choices for full-width targets */
@media (max-width: 380px) {
  .match-choices {
    grid-template-columns: 1fr;
  }

  .match-choice[data-choice="draw"] {
    grid-column: auto;
  }
}
