/**
 * Sunbird Styles
 * Abstract museum-poster palette: 5 pigments + white glow
 */

/* CSS Custom Properties */
:root {
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-data: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;
  --gradient-from: #FDF9F0;
  --gradient-to: #EDE6D6;
  --solar-color: #FFFDF7;
  --solar-glow: rgba(255,253,247,0.55);
  --hero-bloom: radial-gradient(circle at 35% 28%, rgba(255,236,200,0.55), transparent 60%);
  --veil: none;
  --text-primary: #2B2E3A;
  --text-secondary: rgba(43,46,58,0.42);
  --text-muted: rgba(43,46,58,0.32);
  --rain-color: #8898B8;
  --light-strip-edge: #C4B899;
  --light-strip-mid: #F5E8B0;
  --accent-color: #2F5EEA;
  --accent-filter: brightness(0) saturate(100%) invert(32%) sepia(60%) saturate(1800%) hue-rotate(215deg) brightness(92%) contrast(90%);
  --bird-dormant: #D0CCC4;
  --bird-active: #C4A860;
  --bird-glow: rgba(196,168,96,0.40);
  --glass-bg: rgba(0, 0, 0, 0.05);
  --glass-border: rgba(0, 0, 0, 0.08);
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --text-xs: 11px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 22px;
  --text-hero: 128px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--gradient-from) 0%, var(--gradient-to) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  transition: background 0.8s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Atmospheric veil overlay (mist, haze — per-theme) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--veil, none);
}

/* Grain/noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.038;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

#app {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-3);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  position: relative;
  z-index: 1;
  flex-direction: column;
  overflow-x: hidden;
}

.content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.middle-group {
  display: flex;
  flex-direction: column;
}

.bottom-group {
  margin-top: var(--space-2);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Loading State */
.loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Error State */
.error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-message {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  opacity: 0.8;
}

/* Warning Banner */
.warning {
  background: rgba(255, 193, 7, 0.2);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: var(--space-3);
  font-size: 0.8rem;
  color: var(--text-primary);
  text-align: center;
  opacity: 0.9;
}

/* ==================== HERO ZONE ==================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding-top: var(--space-3);
  padding-bottom: var(--space-2);
  flex-shrink: 0;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: -100px;
  right: -100px;
  bottom: -60vh;
  background: var(--hero-bloom);
  pointer-events: none;
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
}

.location-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.location-btn:hover {
  color: var(--text-primary);
}

.hero-headline {
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-secondary);
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

.hero-temp {
  font-family: var(--font-data);
  font-size: var(--text-hero);
  font-weight: 700;
  color: var(--accent-color);
  line-height: 0.85;
  letter-spacing: -0.06em;
  margin: 0;
}

.hero-meta {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ==================== LIGHT WINDOW (signature component) ==================== */
.light-window {
  margin-top: var(--space-1);
  padding: var(--space-1) 0;
  flex-shrink: 0;
}

.light-window-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

/* Light strip */
.light-strip-container {
  padding: var(--space-1) 0;
}

.light-strip {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--light-strip-edge) 0%, var(--light-strip-mid) 50%, var(--light-strip-edge) 100%);
}

/* Sun/moon marker on light strip */
.light-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: left 0.3s ease, filter 0.3s ease;
  color: var(--text-primary);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

/* UV glow levels (sunlight diffusion behind icon) */
.light-dot.uv-0 { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12)); }
.light-dot.uv-low { filter: drop-shadow(0 0 6px rgba(191,217,246,0.5)); }
.light-dot.uv-moderate { filter: drop-shadow(0 0 8px rgba(255,253,247,0.6)); }
.light-dot.uv-high { filter: drop-shadow(0 0 10px rgba(196,101,77,0.5)) drop-shadow(0 0 4px rgba(196,101,77,0.3)); }
.light-dot.uv-very-high { filter: drop-shadow(0 0 12px rgba(196,101,77,0.7)) drop-shadow(0 0 6px rgba(196,101,77,0.4)); }

.light-dot.night {
  color: #E8E6F0;
  filter: drop-shadow(0 0 6px rgba(232,230,240,0.5));
}

/* Dark-theme daylight dot — visible glow on muted strips */
[data-theme="overcast"] .light-dot,
[data-theme="rain"] .light-dot,
[data-theme="storm"] .light-dot {
  color: #F0EDEA;
  filter: drop-shadow(0 0 8px rgba(240,237,234,0.6));
}

/* Sunrise/Sunset labels */
.light-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.light-label-left,
.light-label-right {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* UV legend (centered between times) */
.light-legend {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==================== BIRD ACTIVITY ==================== */
.bird-strip-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.bird-strip-container {
  padding: var(--space-1) 0;
}

.bird-strip {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bird-dormant, #D0CCC4) 0%,
    var(--bird-dormant, #D0CCC4) 18%,
    var(--bird-active, #C4A860) 28%,
    var(--bird-active, #C4A860) 35%,
    var(--bird-dormant, #D0CCC4) 48%,
    var(--bird-dormant, #D0CCC4) 58%,
    var(--bird-active, #C4A860) 68%,
    var(--bird-active, #C4A860) 75%,
    var(--bird-dormant, #D0CCC4) 85%,
    var(--bird-dormant, #D0CCC4) 100%
  );
}

.bird-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: left 0.3s ease, filter 0.3s ease;
  color: #E8E6F0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

.bird-dot.activity-high {
  filter: drop-shadow(0 0 10px var(--bird-glow, rgba(196,168,96,0.40))) drop-shadow(0 0 4px var(--bird-glow, rgba(196,168,96,0.40)));
}

.bird-dot.activity-moderate {
  filter: drop-shadow(0 0 6px var(--bird-glow, rgba(196,168,96,0.35)));
}

.bird-dot.activity-low {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.bird-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.bird-label-left,
.bird-label-right {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

.bird-legend {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* View toggle (segmented pill) */
.view-toggle {
  display: flex;
  align-items: center;
  margin-left: auto;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}

.view-toggle-seg {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s, font-weight 0.2s;
  white-space: nowrap;
  line-height: 1;
  position: relative;
}

.view-toggle-seg:first-child::after {
  content: '';
  position: absolute;
  right: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--glass-border);
  transition: opacity 0.2s;
}

.view-toggle-seg.active {
  color: var(--text-primary);
  background: var(--glass-bg);
  font-weight: 600;
  cursor: default;
}

.view-toggle-seg.active:first-child::after {
  opacity: 0;
}

.view-toggle-seg:not(.active):hover {
  color: var(--text-secondary);
}

.view-toggle-seg:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
  border-radius: 14px;
}

.view-toggle-seg svg {
  flex-shrink: 0;
  opacity: 0.35;
}

.view-toggle-seg.active svg {
  opacity: 1;
}

/* Bird view (full page - mirrors weather layout) */
.bird-view {
  display: flex;
  flex-direction: column;
}

.bird-middle-group {
  display: flex;
  flex-direction: column;
}

.bird-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding-top: var(--space-3);
  padding-bottom: var(--space-2);
  position: relative;
}

.bird-hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: -100px;
  right: -100px;
  bottom: -60vh;
  background: var(--hero-bloom);
  pointer-events: none;
  z-index: 0;
}

.bird-hero > * {
  position: relative;
  z-index: 1;
}

.bird-hero-icon {
  width: 160px;
  height: 80px;
  background-color: var(--accent-color);
  -webkit-mask-image: url('/icons/bird.svg');
  mask-image: url('/icons/bird.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.bird-hero-headline {
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  letter-spacing: -0.01em;
}

.bird-hero-meta {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.bird-view-strip-section {
  padding: var(--space-2) 0;
  flex-shrink: 0;
  border-top: 1px solid var(--glass-border);
}

.bird-notable {
  padding-top: var(--space-2);
  border-top: 1px solid var(--glass-border);
}

.bird-notable-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.bird-notable-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bird-notable-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 0;
  border-top: 1px solid var(--glass-border);
}

.bird-notable-item:first-child {
  border-top: none;
}

.bird-notable-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--glass-bg);
  cursor: pointer;
}

.bird-notable-thumb.no-image {
  display: none;
}

.bird-notable-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.6) contrast(0.88) brightness(1.04);
}

.bird-notable-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bird-notable-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-color);
}

/* Pearl accent on dark backgrounds (design rule: accent on light, pearl on dark) */
[data-theme="overcast"] .bird-notable-name,
[data-theme="rain"] .bird-notable-name,
[data-theme="storm"] .bird-notable-name,
[data-theme="partlyCloudyNight"] .bird-notable-name,
[data-theme="clearNight"] .bird-notable-name {
  color: var(--text-primary);
}

.bird-notable-sci {
  font-size: var(--text-xs);
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
}

/* ---- Bird Image Modal ---- */
.bird-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.bird-image-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.bird-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.bird-image-modal-content {
  position: relative;
  max-width: calc(100vw - var(--space-3) * 2);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bird-image-modal-loading {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 237, 234, 0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.bird-image-modal-img {
  max-width: calc(100vw - var(--space-3) * 2);
  max-height: 70vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bird-image-modal-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  padding: var(--space-1) 0;
  max-width: calc(100vw - var(--space-3) * 2);
}

.bird-image-modal-name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #F0EDEA;
}

.bird-image-modal-credit {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 237, 234, 0.4);
}

.bird-bottom-group {
  flex-shrink: 0;
  border-top: 1px solid var(--glass-border);
  padding-top: var(--space-2);
}

.bird-species-list {
  padding: 0;
}

.bird-species-list::-webkit-scrollbar {
  width: 2px;
}

.bird-species-list::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 1px;
}

.bird-species-header {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  padding-bottom: 0;
}

.bird-empty-state {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-2) 0;
}

.bird-species-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  color: var(--text-primary);
  border-top: 1px solid var(--glass-border);
}

.bird-species-header + .bird-species-row {
  border-top: none;
}

.bird-species-name {
  flex: 1;
  font-weight: 400;
}

.bird-species-count {
  width: 28px;
  text-align: right;
  color: var(--text-secondary);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 500;
}

.bird-species-time {
  width: 46px;
  text-align: right;
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: 11px;
}

/* ==================== SCROLLABLE 12-HOUR STRIP ==================== */
.hourly-section {
  margin-top: var(--space-2);
  margin-right: calc(-1 * var(--space-3));
  flex-shrink: 0;
}

.hourly-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-3) 0 0;
  scrollbar-width: none;
}

.hourly-strip::-webkit-scrollbar {
  display: none;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 52px;
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: var(--space-1) 0;
}

.hourly-item.now {
  opacity: 1;
}

.hourly-time {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hourly-item.now .hourly-time {
  color: var(--text-primary);
  font-weight: 600;
}

.hourly-icon {
  width: 22px;
  height: 22px;
  filter: var(--icon-filter, none);
}

.hourly-temp {
  font-family: var(--font-data);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.hourly-rain {
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  color: var(--rain-color);
  min-height: 13px;
}

/* ==================== KEY MOMENTS ==================== */
.moments {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.moment {
  padding: var(--space-2) 0;
  border-top: 1px solid var(--glass-border);
}

.moment:first-child {
  border-top: none;
}

.moment-time {
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.moment-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.moment-detail {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ==================== 3-DAY FORECAST ==================== */
.forecast-days {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: var(--space-2);
}

.forecast-day {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 0;
  border-top: 1px solid var(--glass-border);
}

.forecast-day:first-child {
  border-top: none;
}

.forecast-day-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  width: 80px;
  flex-shrink: 0;
}

.forecast-day-condition {
  flex: 1;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forecast-day-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: var(--icon-filter, none);
}

.forecast-day-temps {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.forecast-day-temps .low {
  color: var(--text-secondary);
}

/* ==================== FRESHNESS FOOTER ==================== */
.freshness {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) 0 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: linear-gradient(180deg, transparent 0%, var(--gradient-to) 40%);
  z-index: 100;
}

.freshness-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6DB88A;
}

.freshness.stale .freshness-dot {
  background: #9B9994;
}

.freshness.old .freshness-dot {
  background: #C4654D;
}

.refresh-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  opacity: 1;
}

#palette-btn {
  display: flex;
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--glass-bg);
  color: var(--text-primary);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--gradient-from);
}

.btn-secondary {
  opacity: 0.7;
  font-size: 0.85rem;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* ==================== MODALS ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-2);
}

.modal-content {
  max-width: 340px;
  width: 100%;
  text-align: center;
  background: linear-gradient(180deg, var(--gradient-from), var(--gradient-to));
  padding: var(--space-4);
  border-radius: 20px;
}

.modal-content h2 {
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-content p {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-content .btn {
  width: 100%;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid var(--glass-border);
}

.modal-content .btn-primary {
  background: var(--text-primary);
  color: var(--gradient-from);
  border-color: transparent;
}

.modal-content .btn:last-child {
  margin-bottom: 0;
}

/* Location hint text */
.location-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  margin: -0.25rem 0 0.75rem 0;
}

/* Location warning */
.location-warning {
  background: rgba(196, 101, 77, 0.15);
  color: #C4654D;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: var(--space-2);
}

/* ==================== INPUT ==================== */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: var(--space-2);
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

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

.input:focus {
  outline: none;
  border-color: var(--text-primary);
  background: rgba(255, 255, 255, 0.3);
}

/* ==================== COLOUR PICKER ==================== */
.colour-picker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: rgba(20, 17, 21, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px 16px 0 0;
  padding: var(--space-3);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.colour-picker.visible {
  transform: translateY(0);
}

.colour-picker-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
}

.colour-picker-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #F0EDEA;
  opacity: 0.6;
  flex: 1;
}

.colour-picker-reset {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #F0EDEA;
  font-family: var(--font-body);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-right: var(--space-2);
}

.colour-picker-close {
  background: transparent;
  border: none;
  color: #F0EDEA;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.6;
}

.colour-picker-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.colour-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}

.colour-swatch-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: border-color 0.2s;
}

.colour-swatch-circle:hover {
  border-color: rgba(255,255,255,0.4);
}

.colour-swatch-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #F0EDEA;
  opacity: 0.5;
}

.colour-swatch input[type="color"] {
  position: absolute;
  width: 40px;
  height: 40px;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* ==================== RESPONSIVE ==================== */

/* Short phones (under 667px height) - tighter spacing */
@media (max-height: 667px) {
  .hero {
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
  }

  .hero-temp {
    font-size: 96px;
  }

  .bird-hero-icon {
    width: 120px;
    height: 60px;
  }
}

/* Very short phones (under 568px height) */
@media (max-height: 568px) {
  .hero {
    padding-top: 0;
    padding-bottom: 0;
  }

  .hero-temp {
    font-size: 72px;
  }

  .bird-hero-icon {
    width: 96px;
    height: 48px;
  }
}

/* Narrow phones */
@media (max-width: 380px) {
  #app {
    padding: var(--space-2);
  }

  .hero-temp {
    font-size: 72px;
  }

  .view-toggle-seg {
    padding: 5px 8px;
    gap: 4px;
    font-size: 9px;
  }
}

/* ==================== DESKTOP ==================== */
@media (min-width: 520px) {

  /* Flat background behind the card — darkened so card edges are visible */
  body {
    background: color-mix(in srgb, var(--gradient-to) 70%, #000);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Phone-shaped card */
  #app {
    width: 420px;
    height: 860px !important;
    max-height: calc(100vh - 48px) !important;
    min-height: 0px !important;
    margin: 0;
    padding-bottom: 36px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    background: linear-gradient(180deg, var(--gradient-from) 0%, var(--gradient-to) 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 40px rgba(0, 0, 0, 0.10);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
  }

  /* Content scrolls inside the card */
  .content {
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Footer pinned to bottom of card (mirrors mobile fixed-to-viewport) */
  .freshness {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-radius: 0 0 20px 20px;
  }

  /* Scope veil and grain to the card */
  body::before,
  body::after {
    position: fixed;
    width: 420px;
    max-height: 860px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 20px;
  }
}
