:root {
  --bg: #050a05;
  --surface: #0d1a0d;
  --surface2: #111e11;
  --accent: #00ff41;
  --accent-dim: #00a829;
  --text: #e0ffe0;
  --text-muted: #6a8f6a;
  --border: rgba(0, 255, 65, 0.15);
  --border-hover: rgba(0, 255, 65, 0.3);
  --danger: #ff4444;
  --warning: #ffaa00;
  --score-good: #00ff41;
  --score-fair: #ffaa00;
  --score-poor: #ff4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.navbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-location {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.back-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.back-link:hover { color: var(--accent-dim); }

/* ── Container ── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

/* ── Score Section ── */
.score-section {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 8px;
  text-align: center;
}

.score-value {
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px currentColor;
  transition: color 0.3s;
}

.score-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-subtitle {
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
}

/* ── Mode Badge ── */
.mode-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 8px;
}

.mode-badge.enhanced {
  background: rgba(0, 255, 65, 0.15);
  color: var(--accent);
  border: 1px solid var(--border);
}

.mode-badge.offline {
  background: rgba(106, 143, 106, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(106, 143, 106, 0.2);
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Conditions Card ── */
.conditions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.condition-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 12px;
}

.condition-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.condition-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.condition-unit {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Sun/Moon Card ── */
.sun-moon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sun-moon-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sun-moon-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.sun-moon-label svg { flex-shrink: 0; opacity: 0.7; }

.sun-moon-value {
  font-size: 16px;
  font-weight: 600;
}

.moon-phase-display {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.moon-phase-svg {
  flex-shrink: 0;
  line-height: 0;
}

/* ── Visibility dots (planet rating) ── */
.vis-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.vis-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--text-muted);
}

.vis-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.moon-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.moon-phase-name {
  font-size: 16px;
  font-weight: 600;
}

.moon-illumination {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Planets Section ── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.planet-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.planet-symbol {
  font-size: 22px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.planet-info {
  flex: 1;
  min-width: 0;
}

.planet-name {
  font-size: 15px;
  font-weight: 600;
}

.planet-times {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.planet-note {
  font-size: 11px;
  color: var(--warning);
  margin-top: 2px;
}

.planet-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 48px;
}

.planet-stars {
  font-size: 14px;
  line-height: 1;
}

.planet-altitude {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 14px; /* always occupies space even when empty */
}

.planet-not-visible {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Week Grid ── */
.week-grid {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

.week-grid-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.week-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.week-row:hover {
  border-color: var(--border-hover);
  background: var(--surface2);
}

.week-row.today {
  border-color: rgba(0, 255, 65, 0.4);
}

.week-day-name {
  font-size: 14px;
  font-weight: 700;
  width: 36px;
  flex-shrink: 0;
}

.week-date {
  font-size: 12px;
  color: var(--text-muted);
  width: 44px;
  flex-shrink: 0;
}

.week-cloud {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.week-cloud-pct {
  font-size: 12px;
  color: var(--text-muted);
  width: 34px;
  flex-shrink: 0;
}

.week-moon {
  font-size: 18px;
  flex: 1;
  text-align: center;
}

.week-score {
  font-size: 16px;
  font-weight: 700;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.week-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.15s;
  border-top: 2px solid transparent;
}

.bottom-nav-item.active {
  color: var(--accent);
  border-top-color: var(--accent);
}

.bottom-nav-item:hover:not(.active) {
  color: var(--text);
}

.bottom-nav-icon {
  display: block;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Location Input ── */
.location-section {
  max-width: 480px;
  margin: 16px auto;
  padding: 0 16px;
}

.location-form {
  display: flex;
  gap: 8px;
}

.location-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.location-input:focus {
  border-color: var(--accent-dim);
}

.location-input::placeholder {
  color: var(--text-muted);
}

.btn {
  background: var(--accent-dim);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: var(--accent); }
.btn:active { background: var(--accent-dim); }

.location-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Skeleton ── */
.skeleton {
  background: var(--surface2);
  border-radius: 6px;
  height: 1em;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ── Stale banner ── */
.stale-banner {
  max-width: 480px;
  margin: 8px auto 0;
  padding: 0 16px;
}

.stale-banner-inner {
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--warning);
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Date header (for ?date= views) ── */
.date-header {
  max-width: 480px;
  margin: 12px auto 0;
  padding: 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
