:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #fbfcfe;
  --panel: #ffffff;
  --teal: #007c80;
  --teal-dark: #075a5f;
  --coral: #d1495b;
  --gold: #c49021;
  --green: #1a7f4b;
  --navy: #1e3a5f;
  --shadow: 0 14px 42px rgba(20, 31, 48, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, rgba(0, 124, 128, 0.08), transparent 340px), var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 10px 0 18px;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
}

h2 {
  font-size: 1rem;
}

.player-box,
.metric,
.login-panel,
.signin-callout,
.signedin-callout,
.match-card,
.sync-panel,
.sync-run,
.leader-row {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.player-box {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  display: flex;
  gap: 9px;
  align-items: center;
  font-weight: 800;
  color: var(--navy);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--coral);
  font-weight: 900;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  border-radius: 8px;
  min-height: 74px;
  padding: 14px;
}

.metric span,
.leader-stat small,
.match-meta,
.sync-run span {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.16rem;
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  box-shadow: none;
  border: 0;
  background: transparent;
}

.signin-callout,
.signedin-callout {
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.signin-callout {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) 1.4fr;
  gap: 18px;
  align-items: end;
  border-left: 5px solid var(--coral);
}

.signedin-callout {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-left: 5px solid var(--teal);
}

.signin-callout h2 {
  font-size: 1.35rem;
  margin-bottom: 7px;
}

.signin-callout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.callout-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.signedin-callout .callout-kicker {
  color: var(--teal-dark);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
}

.compact {
  min-height: 36px;
}

.primary-button {
  border: 0;
  color: #fff;
  background: var(--teal);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--navy);
  background: #fff;
}

.error-banner,
.success-banner,
.empty-state {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 800;
}

.error-banner {
  background: rgba(209, 73, 91, 0.1);
  color: #9b2034;
  border: 1px solid rgba(209, 73, 91, 0.25);
}

.success-banner {
  background: rgba(26, 127, 75, 0.1);
  color: var(--green);
  border: 1px solid rgba(26, 127, 75, 0.25);
}

.hidden,
.view,
.group-panel,
.group-mode-panel,
.round-panel {
  display: none;
}

.view.active,
.group-panel.active,
.group-mode-panel.active,
.round-panel.active {
  display: grid;
}

.tabs,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  margin: 14px 0;
}

.tab,
.segment {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  font-weight: 900;
}

.tab {
  min-height: 46px;
  padding: 0 14px;
}

.segment {
  min-width: 42px;
  min-height: 38px;
  padding: 0 12px;
}

.segment.active,
.tab.active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.workspace {
  gap: 14px;
}

.group-mode-panel,
.day-section {
  gap: 14px;
}

.day-section {
  display: grid;
}

.view-switch {
  padding-bottom: 4px;
}

.view-switch .segment {
  min-width: 104px;
}

.day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 4px 0 10px;
}

.day-heading h2 {
  font-size: 1.15rem;
}

.day-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.workspace.split {
  grid-template-columns: 320px 1fr;
  align-items: start;
}

.wide .segment {
  min-width: 126px;
}

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

.match-card {
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 13px;
  min-height: 258px;
}

.match-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.match-number {
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill {
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: var(--navy);
  background: #eef4ff;
  border: 1px solid #ccdcff;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill.ft,
.status-pill.ok {
  color: var(--green);
  background: rgba(26, 127, 75, 0.1);
  border-color: rgba(26, 127, 75, 0.25);
}

.status-pill.error {
  color: #9b2034;
  background: rgba(209, 73, 91, 0.1);
  border-color: rgba(209, 73, 91, 0.25);
}

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

.team-line {
  min-height: 46px;
  display: grid;
  grid-template-columns: 34px 1fr 28px;
  gap: 10px;
  align-items: center;
  font-weight: 900;
}

.team-line img,
.flag-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.team-line img {
  object-fit: cover;
}

.flag-fallback {
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: var(--navy);
  font-size: 0.74rem;
}

.team-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-line strong {
  text-align: right;
  font-size: 1.2rem;
}

.match-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

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

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

.pick-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-button.selected {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.pick-button:disabled {
  color: #98a2b3;
  background: #f5f7fa;
}

.leaderboard,
.sync-list {
  display: grid;
  gap: 10px;
}

.leader-row {
  min-height: 70px;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px 1fr 90px 100px 70px;
  gap: 12px;
  align-items: center;
}

.rank,
.score {
  font-weight: 950;
  text-align: center;
}

.rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 124, 128, 0.1);
  color: var(--teal-dark);
}

.leader-name {
  font-weight: 950;
  font-size: 1.05rem;
}

.leader-stat span {
  display: block;
  font-weight: 950;
}

.score {
  color: var(--coral);
  font-size: 1.5rem;
}

.sync-panel,
.sync-run,
.empty-state {
  border-radius: 8px;
}

.sync-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.sync-config {
  display: grid;
  gap: 8px;
  margin: 0;
}

.sync-config div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.sync-config dt,
.sync-config dd {
  margin: 0;
}

.sync-config dt,
.sync-run small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sync-config dd {
  font-weight: 900;
  text-align: right;
}

.sync-run {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.sync-run strong,
.sync-run span,
.sync-run small {
  display: block;
}

.empty-state {
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 16px;
  }

  .top-bar,
  .match-header,
  .sync-run {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip,
  .login-panel,
  .signin-callout,
  .workspace.split {
    grid-template-columns: 1fr;
  }

  .signedin-callout {
    align-items: stretch;
    flex-direction: column;
  }

  .tab {
    flex: 1 1 calc(50% - 8px);
  }

  .wide .segment {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .leader-row {
    grid-template-columns: 38px 1fr 56px;
  }

  .leader-stat {
    display: none;
  }

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