:root {
  --bg-primary: #000000; /*pure black = transparent on additive display*/
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --accent-primary: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --success: #00ff88;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --focus-tf: transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
              border-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
              box-shadow 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
              background 300ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

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

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

#app { width: 100%; height: 100%; position: relative; padding: 8px; box-sizing: border-box; }

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

.header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
}
.header h1 { font-size: 24px; font-weight: 700; flex: 1; }
.header-meta { font-size: 14px; color: var(--accent-secondary); font-variant-numeric: tabular-nums; }
.back-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 22px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
}

.content {
  flex: 1;
  min-height: 0;
  padding: 14px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

/* --- Current conditions --- */
.loc-name { font-size: 18px; color: var(--text-secondary); text-align: center; }
.hero { display: flex; align-items: center; justify-content: center; gap: 20px; }
.hero-symbol { font-size: 84px; line-height: 1; }
.hero-temp { font-size: 96px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-cond { font-size: 24px; font-weight: 600; text-align: center; color: var(--accent-primary); }

.stat-row { display: flex; gap: 10px; margin-top: 8px; }
.stat {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
}
.stat-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--accent-primary); font-variant-numeric: tabular-nums; }

/* --- Loading / error states --- */
.state-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-text { font-size: 18px; color: var(--text-secondary); max-width: 440px; }
.state-icon { font-size: 52px; color: var(--danger); }

/* --- Scroll region + scrims (validated pattern) --- */
.scroll-region { position: relative; flex: 1; min-height: 0; }
.scroll-body {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: none;
}
.scroll-body::-webkit-scrollbar { display: none; }
.scrim {
  position: absolute;
  left: 0; right: 0;
  height: 56px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 250ms ease;
}
.scrim-top { top: 0; background: linear-gradient(to bottom, #000000 0%, transparent 100%); }
.scrim-bottom { bottom: 0; background: linear-gradient(to top, #000000 0%, transparent 100%); }
.scrim.show { opacity: 1; }

/* --- Forecast rows --- */
.wx-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--focus-tf);
}
.wx-row-time { font-size: 18px; font-weight: 600; width: 96px; flex-shrink: 0; }
.wx-row-symbol { font-size: 30px; width: 44px; text-align: center; flex-shrink: 0; }
.wx-row-cond { flex: 1; font-size: 16px; color: var(--text-secondary); min-width: 0; }
.wx-row-temp { font-size: 22px; font-weight: 700; color: var(--accent-primary); font-variant-numeric: tabular-nums; }
.wx-row-temp .lo { color: var(--text-secondary); font-weight: 500; }

/* --- Nav bar --- */
.nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  flex-shrink: 0;
  border-radius: var(--radius-md);
}
.nav-item {
  flex: 1;
  min-height: 88px;
  padding: 14px 12px;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--focus-tf);
}
.nav-item.primary { background: var(--accent-primary); color: #0a0a0f; font-size: 20px; }

/* --- Focus states --- */
.focusable { outline: none; }
.nav-item:focus, .back-btn:focus, .wx-row:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 24px var(--focus-glow);
  transform: scale(calc(1 - 8/88));
}
.wx-row:focus { background: var(--bg-card); }

.hidden { display: none !important; }
