:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  background: #f9f8f6;
  color: #3c302a;
  --bg: #f9f8f6;
  --surface: rgba(239, 233, 227, 0.92);
  --surface-strong: #efe9e3;
  --border: rgba(217, 207, 199, 0.75);
  --text: #3c302a;
  --muted: #8a7668;
  --primary: #c9b59c;
  --primary-strong: #b59c8a;
  --accent: #8a6f5f;
}

.theme-dark {
  color-scheme: dark;
  background: #37353e;
  color: #d3dad9;
  --bg: #37353e;
  --surface: rgba(68, 68, 78, 0.94);
  --surface-strong: #44444e;
  --border: rgba(211, 218, 217, 0.16);
  --text: #4c7c13;
  --muted: #a9aeb0;
  --primary: #715a5a;
  --primary-strong: #ad3d5a;
  --accent: #d3dad9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  transition: background 0.25s ease, color 0.25s ease;
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.app-footer {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 15% 10%, rgba(201, 181, 156, 0.16), transparent 18%),
    radial-gradient(circle at 80% 20%, rgba(217, 207, 199, 0.14), transparent 18%),
    radial-gradient(circle at 50% 85%, rgba(116, 106, 90, 0.08), transparent 20%);
  pointer-events: none;
  opacity: 0.9;
}

.app-header,
.hero-card,
.auth-card,
.match-card,
.page-section,
.preferences-form,
.leaderboard-table,
.previous-table {
  position: relative;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  margin-bottom: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
}

.theme-toggle,
button,
input[type='submit'] {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease;
}

.theme-toggle:hover,
button:hover,
input[type='submit']:hover {
  background: var(--primary-strong);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.main-nav button {
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 999px;
  padding: 10px 16px;
}

.nav-logout {
  margin-left: auto;
  background: var(--accent);
}

.page-section {
  margin-bottom: 24px;
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.page-section.hidden {
  display: none;
}

.auth-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.auth-card,
.hero-card,
.match-card {
  background: var(--surface-strong);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  padding: 24px;
}

.auth-card h2,
.hero-card h2,
.page-section h2 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input[type='number'] {
  width: 100%;
}

.matches-grid {
  display: grid;
  gap: 18px;
}

.match-card {
  display: grid;
  gap: 18px;
}

.match-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pagination-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.95rem;
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.pagination-controls button,
.pagination-controls select {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
}

.pagination-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.match-teams {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

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

.prediction-form label {
  margin-bottom: 0;
}

.match-result {
  color: var(--accent);
  font-weight: 700;
}

.leaderboard-table,
.previous-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td,
.previous-table th,
.previous-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th,
.previous-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.preferences-form {
  display: grid;
  gap: 16px;
}

.status {
  margin-top: 18px;
  min-height: 24px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.12);
  color: #0f172a;
}

.status.status-error {
  background: rgba(248, 113, 113, 0.14);
  color: #991b1b;
}

.status.status-success {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

.sync-output {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  min-height: 120px;
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
  }

  .main-nav {
    justify-content: center;
  }
}
