:root {
  color-scheme: light dark;
  --border: #d0d5dc;
  --accent: #01426a;
  --bg-card: rgba(1, 66, 106, 0.04);
  --bg-stat: rgba(0, 0, 0, 0.03);
  --bg-stat-total: rgba(1, 66, 106, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --border: #3a4048;
    --accent: #6fb3e0;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-stat: rgba(255, 255, 255, 0.06);
    --bg-stat-total: rgba(111, 179, 224, 0.18);
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 64px;
  line-height: 1.4;
  font-size: 16px;
}

header h1 {
  margin-bottom: 0;
  font-size: 1.5em;
  color: var(--accent);
}
.subtitle {
  margin-top: 4px;
  opacity: 0.7;
  font-size: 0.9em;
}
.check-schedule {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 0.8em;
  opacity: 0.85;
  line-height: 1.35;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}
.card h2 {
  margin-top: 0;
  font-size: 1.1em;
}

/* Search form: stacked full-width fields on mobile, row layout on wider screens */
#search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#search-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85em;
  font-weight: 600;
  gap: 4px;
}
#search-form input {
  width: 100%;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px; /* keeps iOS Safari from auto-zooming in on focus */
}
#search-form button {
  width: 100%;
}

@media (min-width: 640px) {
  #search-form {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: end;
  }
  #search-form label {
    flex: 1 1 120px;
  }
  #search-form button {
    width: auto;
  }
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.95em;
  min-height: 44px; /* comfortable touch target */
}
button:hover {
  opacity: 0.9;
}
button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.full-width {
  width: 100%;
  margin-top: 12px;
}

/* Results and watches: one card per flight, stacks on mobile, grid on desktop */
.card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 640px) {
  .card-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.flight-card,
.watch-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-card);
}

.flight-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 700;
}
.flight-number {
  font-size: 1.15em;
  color: var(--accent);
}
.flight-time,
.route {
  font-size: 0.9em;
  font-weight: 400;
  opacity: 0.8;
}

.flight-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
  text-align: center;
}
.stat {
  display: flex;
  flex-direction: column;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--bg-stat);
}
.stat-total {
  background: var(--bg-stat-total);
  font-weight: 700;
}
.stat-value {
  font-size: 1.2em;
  font-weight: 700;
}
.stat-label {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.65;
}

.notify-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.notify-row-label {
  font-size: 0.8em;
  font-weight: 600;
  opacity: 0.6;
}
.notify-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.notify-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85em;
  cursor: pointer;
}
.notify-pill input {
  width: 18px;
  height: 18px;
}

.watch-time {
  margin-top: 6px;
  font-size: 0.95em;
}
.checked-at {
  margin-top: 6px;
  font-size: 0.75em;
  opacity: 0.55;
  cursor: default;
}
.watch-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.85em;
  opacity: 0.8;
}

.empty-message {
  margin-top: 12px;
  font-size: 0.9em;
  opacity: 0.7;
}

.hidden {
  display: none;
}

#search-status {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 0.9em;
  opacity: 0.8;
}
