:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --text: #17202a;
  --muted: #5d6b7a;
  --line: #d8e0ea;
  --brand: #0f5f83;
  --brand-dark: #0a4059;
  --accent: #d93f21;
  --success: #16784f;
  --shadow: 0 12px 32px rgba(28, 43, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px clamp(16px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.1;
}

h2,
h3 {
  margin: 0;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 700px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

select,
input[type="text"] {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
}

button:hover {
  border-color: var(--brand);
}

.primary-button {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.config-panel,
.sport-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.config-panel {
  align-self: start;
  padding: 18px;
  position: sticky;
  top: 16px;
}

.panel-heading,
.sport-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.manual-favorites {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.manual-favorites label {
  color: var(--muted);
  font-weight: 700;
}

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

.favorite-options {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.favorite-sport {
  display: grid;
  gap: 8px;
}

.favorite-sport h3 {
  font-size: 1rem;
}

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

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--muted);
}

.scores-panel {
  min-width: 0;
}

.status-bar {
  min-height: 24px;
  margin-bottom: 14px;
  color: var(--muted);
}

.status-bar.error {
  color: #9e2f1a;
  font-weight: 700;
}

.score-groups {
  display: grid;
  gap: 20px;
}

.sport-section {
  overflow: hidden;
}

.sport-heading {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.sport-title {
  font-size: 1.35rem;
}

.event-count {
  white-space: nowrap;
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand);
  font-weight: 700;
  padding: 6px 10px;
}

.day-groups {
  display: grid;
}

.day-section + .day-section {
  border-top: 1px solid var(--line);
}

.day-title {
  padding: 16px 18px 8px;
  font-size: 1.05rem;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 18px 18px;
}

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

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

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

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

.match-cell {
  min-width: 230px;
}

.team-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.team-name {
  font-weight: 700;
}

.team-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.winner {
  color: var(--success);
}

.favorite-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fce9e5;
  color: var(--accent);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.empty-state {
  padding: 12px 10px;
  color: var(--muted);
}

a {
  color: var(--brand);
  font-weight: 700;
}

@media (max-width: 860px) {
  .app-header,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .config-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  .panel-heading,
  .sport-heading,
  .input-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .event-count {
    justify-self: start;
  }
}
