:root {
  --bg: #0a0e17;
  --surface: #141a27;
  --surface-hover: #1c2333;
  --border: #2a3142;
  --text: #e8eaed;
  --text-secondary: #8b92a5;
  --accent: #8b1538;
  --accent-light: #c2185b;
  --gold: #d4a843;
  --group: #1a5276;
  --r32: #1e6f50;
  --qf: #7d5a00;
  --sf: #6a1b9a;
  --final: #b71c1c;
  --radius: 8px;
  --max-width: 720px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.header-actions-side {
  flex: 1;
  display: flex;
}

.header-actions-right {
  justify-content: flex-end;
}

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

.header-actions .divider {
  color: var(--border);
  font-size: 0.85rem;
  font-weight: 300;
  user-select: none;
}

.share-group {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.share-group button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.share-group button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* Bottom sheet */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.share-sheet.hidden {
  display: none !important;
}

.share-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.share-sheet-panel {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 420px;
  padding: 0 0 1rem;
  animation: sheet-up 0.2s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.share-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.share-sheet-header button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.share-sheet-header button:hover {
  color: var(--text);
}

.share-sheet-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.share-sheet-action:hover {
  background: var(--surface-hover);
}

.share-sheet-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.share-sheet-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.share-sheet-label {
  flex: 1;
}

.share-sheet-status {
  font-size: 0.75rem;
  color: #4caf50;
  font-weight: 600;
}

.view-nav {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-nav a {
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.view-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.view-nav a.active {
  color: var(--text);
  background: var(--border);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

header {
  position: relative;
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(180deg, var(--accent) 0%, var(--bg) 100%);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.subtitle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.subtitle-row .divider {
  color: var(--border);
  font-size: 0.85rem;
  font-weight: 300;
  user-select: none;
}

.subtitle-row .subtitle {
  text-align: right;
  flex: 1;
}

.subtitle-row .tz-display {
  flex: 1;
  justify-content: flex-start;
}

.subtitle {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.tz-display {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.2;
}


#tz-change {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}

#tz-change:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

#tz-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  padding: 0.25rem;
}

.intro {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: var(--max-width);
  margin: 0.75rem auto 0;
  padding: 0 1rem;
  line-height: 1.5;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0 0 100vmax var(--bg);
  clip-path: inset(0 -100vmax);
}

.filters select {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 0;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b92a5'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.filters select:focus {
  outline: none;
  border-color: var(--accent-light);
}

#filter-clear {
  flex: 1 1 100%;
  padding: 0.4rem;
  background: var(--surface);
  color: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
}

#filter-clear:hover {
  background: var(--surface-hover);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.date-group {
  margin-top: 1.5rem;
}

.date-heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  position: sticky;
  top: 3.25rem;
  background: var(--bg);
  z-index: 5;
  padding-top: 0.5rem;
}

.match-card {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.match-card:last-child {
  border-bottom: none;
}

.match-time {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.match-teams {
  min-width: 0;
}

.match-teams .team {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-teams .vs {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.match-teams .score {
  font-weight: 700;
  color: var(--gold);
}

.match-meta {
  text-align: right;
}

.match-venue {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}

.stage-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-top: 0.2rem;
}

.stage-badge[data-stage="GROUP_STAGE"] { background: var(--group); }
.stage-badge[data-stage="ROUND_OF_32"] { background: var(--r32); }
.stage-badge[data-stage="ROUND_OF_16"] { background: var(--r32); }
.stage-badge[data-stage="QUARTER_FINAL"] { background: var(--qf); }
.stage-badge[data-stage="SEMI_FINAL"] { background: var(--sf); }
.stage-badge[data-stage="THIRD_PLACE"] { background: var(--sf); }
.stage-badge[data-stage="FINAL"] { background: var(--final); }

.match-status-live {
  color: #4caf50;
  font-weight: 700;
  font-size: 0.75rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.no-matches {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  max-width: var(--max-width);
  margin: 0 auto;
}

footer a {
  color: var(--accent-light);
  text-decoration: none;
}

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

.country-links {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  line-height: 1.8;
}

.tbd-chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-size: 0.72em;
  padding: 1px 0.4em;
  border-radius: 3px;
  font-style: italic;
}

.hidden {
  display: none !important;
}

@media (min-width: 640px) {
  h1 { font-size: 2rem; }

  .filters select {
    flex: 1 1 0;
    min-width: 120px;
  }

  #filter-clear {
    flex: 0 0 auto;
  }

  .match-card {
    grid-template-columns: 4rem 1fr auto;
    gap: 1rem;
    padding: 0.85rem 0;
  }
}
