:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --sun: #ffce4a;
  --night-dot: #6f80c8;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

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

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

.focusable {
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer; outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 18px;
  background: var(--bg-primary);
  border-bottom: 1px solid #20202c;
  flex-shrink: 0;
}
.title {
  display: flex; align-items: center; gap: 10px;
  font-size: 21px; font-weight: 650; letter-spacing: 0.2px;
  flex: 1; min-width: 0;
}
.title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sun-glyph { color: var(--sun); font-size: 22px; }

.clock { text-align: right; line-height: 1.15; }
#utc-time {
  font-size: 19px; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}
.clock-sub { display: block; font-size: 12px; color: var(--text-secondary); }

.backbtn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.count-pill {
  display: inline-block;
  background: var(--bg-tertiary);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 14px; font-weight: 600;
  color: var(--accent-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---------- map ---------- */
.map-wrap {
  width: 600px; height: 300px;
  position: relative; flex-shrink: 0;
  background: #04060c;
  border-bottom: 1px solid #20202c;
}
#map { display: block; width: 600px; height: 300px; }

/* ---------- stat strip ---------- */
.stat-strip {
  display: flex; gap: 10px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.stat {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid #22222e;
  border-radius: var(--radius-md);
  padding: 10px 14px;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 3px; }
.stat-value {
  font-size: 18px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- home city chip ---------- */
.home-chip {
  display: flex; align-items: center; gap: 12px;
  margin: 0 16px 10px;
  padding: 12px 14px;
  height: 56px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.chip-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--sun); flex-shrink: 0;
  box-shadow: 0 0 8px rgba(255,206,74,0.7);
}
.chip-name { flex: 1; font-size: 16px; font-weight: 600; }
.chip-time {
  font-size: 17px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.chip-status { font-size: 18px; }

/* ---------- home nav ---------- */
.home-nav {
  margin-top: auto;
  display: flex; gap: 12px;
  padding: 14px 16px 18px;
}
.navbtn {
  flex: 1; height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  position: relative;
}
.navbtn-icon { font-size: 26px; }
.navbtn-text { font-size: 16px; font-weight: 600; }
.navbtn-chev {
  position: absolute; top: 8px; right: 12px;
  color: var(--text-muted); font-size: 20px;
}

/* ---------- cities list ---------- */
.list {
  flex: 1; overflow-y: auto;
  padding: 10px 14px 18px;
  scrollbar-width: none;
}
.list::-webkit-scrollbar { display: none; }

.city-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.city-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0; background: var(--night-dot);
}
.city-dot.day { background: var(--sun); box-shadow: 0 0 8px rgba(255,206,74,0.7); }
.city-info { flex: 1; min-width: 0; }
.city-name { font-size: 17px; font-weight: 600; }
.city-sub { font-size: 13px; color: var(--text-secondary); }
.city-time {
  font-size: 19px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.city-day { font-size: 20px; width: 26px; text-align: center; }
.city-day.is-day { color: var(--sun); }
.city-day.is-night { color: var(--night-dot); }

/* ---------- detail ---------- */
.detail-body {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: none;
}
.detail-body::-webkit-scrollbar { display: none; }

.status-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid #22222e;
}
.status-hero.day { background: linear-gradient(135deg, #2a2410, var(--bg-secondary)); }
.status-hero.night { background: linear-gradient(135deg, #10162a, var(--bg-secondary)); }
.hero-glyph { font-size: 52px; line-height: 1; }
.status-hero.day .hero-glyph { color: var(--sun); }
.status-hero.night .hero-glyph { color: var(--night-dot); }
.hero-text { flex: 1; }
.hero-status { font-size: 22px; font-weight: 700; }
.hero-local {
  font-size: 17px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; margin-top: 2px;
}

.det-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.det-cell {
  background: var(--bg-secondary);
  border: 1px solid #22222e;
  border-radius: var(--radius-md);
  padding: 12px 14px; min-height: 64px;
}
.det-k { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.det-v {
  font-size: 20px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.bigbtn {
  height: 60px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px; font-weight: 600;
}
.bigbtn.active {
  background: linear-gradient(135deg, #1a3a2a, var(--bg-tertiary));
  color: var(--accent-secondary);
}

/* ---------- legend ---------- */
.legend-body {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: none;
}
.legend-body::-webkit-scrollbar { display: none; }
.leg-row { display: flex; align-items: center; gap: 16px; }
.leg-mark {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; border-radius: 10px;
}
.mark-sun { color: var(--sun); }
.mark-night { background: rgba(3,6,22,0.85); border: 1px solid #2a3550; }
.mark-term { background: var(--accent); height: 4px; align-self: center; border-radius: 2px; }
.mark-day-dot { background: var(--sun); border-radius: 50%; width: 18px; height: 18px; margin: 11px; box-shadow: 0 0 8px rgba(255,206,74,0.7); }
.mark-night-dot { background: var(--night-dot); border-radius: 50%; width: 18px; height: 18px; margin: 11px; }
.leg-txt { display: flex; flex-direction: column; }
.leg-txt b { font-size: 16px; }
.leg-txt span { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.leg-note {
  margin-top: 6px;
  font-size: 13px; line-height: 1.5; color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px;
}
