:root {
  color-scheme: dark;
  --bg: #0d1321;
  --card-bg: #161f38;
  --text: #eef0f5;
  --muted: #9aa3b8;
  --accent: #6fb3f2;
  --high: #6fb3f2;
  --low: #f2a26f;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0d1321 0%, #10182c 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#moon-canvas {
  display: block;
  margin: 0 auto 12px;
}

.phase-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.illumination {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1321;
}

.tide-card {
  text-align: left;
}

.tide-card h2 {
  margin-bottom: 2px;
}

.location-label {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

.day-heading {
  margin: 16px 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.day-heading:first-child {
  margin-top: 0;
}

.tide-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  border-left: 3px solid transparent;
}

.tide-row.high {
  border-left-color: var(--high);
}

.tide-row.low {
  border-left-color: var(--low);
}

.tide-type {
  font-weight: 600;
  flex: 1;
}

.tide-time {
  font-variant-numeric: tabular-nums;
  margin: 0 12px;
  color: var(--text);
}

.tide-height {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 56px;
  text-align: right;
}

.loading,
.error {
  color: var(--muted);
  text-align: center;
  margin: 8px 0;
}

.error {
  color: var(--low);
}

.stale-banner {
  background: rgba(242, 162, 111, 0.12);
  border: 1px solid rgba(242, 162, 111, 0.35);
  color: var(--low);
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

footer {
  text-align: center;
  margin-top: 8px;
}

#last-updated {
  color: var(--muted);
  font-size: 0.8rem;
}
