:root {
  --bg: #0e0e0e;
  --bg-alt: #141414;
  --surface: #181818;
  --surface-alt: #1f1f1f;
  --border: #2c2c2c;
  --text: #f3f3f3;
  --text-muted: #a0a0a0;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.6);
  --accent-blue: #60a5fa;
  --accent-green: #4ade80;
  --accent-amber: #facc15;
  --accent-purple: #a855f7;
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-temp { height: 3.4rem; width: 120px; }
.skeleton-text { height: 1em; width: 60%; }
.skeleton-icon { width: 80px; height: 80px; border-radius: 28px; }
.skeleton-hour { min-width: 88px; height: 130px; border-radius: var(--radius-md); flex-shrink: 0; }
.skeleton-day  { height: 52px; border-radius: var(--radius-md); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

html[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f3f3f3;
  --border: #d4d4d4;
  --text: #111111;
  --text-muted: #6b7280;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.12);
  background-color: #f9fafb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: #050505;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #121212 0, #050505 55%);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  width: 100%;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

html[data-theme="light"] body {
  background: radial-gradient(circle at top, #e5e7eb 0, #f9fafb 55%);
}

.app {
  width: 100%;
  max-width: 1120px;
  padding: 20px;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--surface-alt), var(--surface));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2.1rem;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search-wrapper {
  position: relative;
  min-width: 250px;
  max-width: 320px;
}

.search-wrapper input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.9rem;
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.suggestions {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  list-style: none;
  padding: 4px 0;
  margin: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
}

.suggestions.hidden {
  display: none;
}

.suggestions li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.suggestions li:hover,
.suggestions li.highlighted {
  background: var(--surface-alt);
}

.suggestions li.highlighted {
  outline: 1px solid var(--border);
}

.suggestions .suggest-main {
  font-size: 0.9rem;
}

.suggestions .suggest-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  padding: 7px 13px;
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn.secondary {
  background: var(--surface);
}

.btn:hover {
  background: var(--surface-alt);
}

.unit-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.unit-btn {
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--text-muted);
}

.unit-btn.active {
  background: var(--surface);
  color: var(--text);
}

.icon-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.status-banner {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: center;
}

.card {
  margin-top: 16px;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h2 {
  margin: 0;
  font-size: 1.02rem;
}

.section-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.current-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  position: relative;
}

.current-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.7;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(circle at top right, #27272f, #111827 60%);
}

.current-card.theme-clear::before {
  background: radial-gradient(circle at top right, #facc15, transparent 55%);
}

.current-card.theme-cloudy::before {
  background: radial-gradient(circle at top right, #9ca3af, transparent 55%);
}

.current-card.theme-rain::before {
  background: radial-gradient(circle at top right, #38bdf8, transparent 55%);
}

.current-card.theme-snow::before {
  background: radial-gradient(circle at top right, #e5e7eb, transparent 55%);
}

.current-card.theme-storm::before {
  background: radial-gradient(circle at top right, #a855f7, transparent 55%);
}

.current-header {
  position: relative;
  z-index: 1;
}

.current-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.subtitle {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.current-main {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 8px;
}

.current-icon-lg {
  width: 80px;
  height: 80px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(248, 250, 252, 0.25);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.7);
}

.current-icon-lg i {
  font-size: 2.8rem;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.current-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.current-temp-lg {
  font-size: 3.4rem;
  font-weight: 600;
}

.current-hi-lo {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: -4px;
}

.current-desc-lg {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.current-extra {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.current-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.alerts-card.hidden {
  display: none;
}


.alert-item {
  margin-top: 8px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.06);
  overflow: hidden;
}

.alert-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}

.alert-item-header:hover {
  background: rgba(239, 68, 68, 0.1);
}

.alert-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fca5a5;
}

.alert-item-title i {
  color: #f87171;
  flex-shrink: 0;
}

.alert-item .chevron {
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.alert-item-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.alert-item-body-inner {
  padding: 0 12px 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-item-body-inner p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.alert-headline {
  color: var(--text);
  font-style: italic;
}

.alert-item.open .chevron {
  transform: rotate(90deg);
}

.hourly-scroll {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.hour-card {
  min-width: 88px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 8px 8px 10px;
  font-size: 0.78rem;
  text-align: center;
  scroll-snap-align: center;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.65);
}

html[data-theme="light"] .hour-card {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hour-card-time {
  font-weight: 500;
  margin-bottom: 2px;
}

.hour-card i {
  font-size: 1rem;
  margin: 2px 0;
}

.hour-card-temp {
  font-weight: 600;
}

.hour-card-precip {
  color: var(--text-muted);
}

.hour-date-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  align-self: stretch;
  padding: 0 10px;
  min-width: fit-content;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.hour-card-feels,
.hour-card-wind {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.hour-card-precip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.precip-bar {
  height: 6px;
  width: 40px;
  background: rgba(100, 100, 100, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.precip-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(to right, #38bdf8, #60a5fa);
  transition: width 0.25s ease-out;
}

.seven-day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}

.day-accordion {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.day-accordion:hover {
  background: #262626;
}

html[data-theme="light"] .day-accordion:hover {
  background: #e5e7eb;
}

.day-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.day-title {
  display: flex;
  flex-direction: column;
}

.day-title-main {
  font-size: 0.95rem;
  font-weight: 600;
}

.day-title-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.day-range {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.day-accordion-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-accordion-header-right i {
  font-size: 1.1rem;
}

.chevron {
  font-size: 0.7rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.day-accordion.open .chevron {
  transform: rotate(90deg);
}

.day-hourly-container {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

.day-hourly-container-inner {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.day-accordion.open .day-hourly-container {
  opacity: 1;
}

.radar-card.hidden {
  display: none;
}

.radar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.radar-timestamp {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 56px;
  text-align: right;
  flex-shrink: 0;
}

.radar-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.radar-slider:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.radar-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
}

.radar-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: none;
  cursor: pointer;
}

.radar-slider:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
}

.radar-slider:disabled::-moz-range-thumb {
  cursor: not-allowed;
}

.radar-map {
  margin-top: 8px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 260px;
}

.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left {
  z-index: 1;
}

@media (min-width: 900px) {
  .radar-map {
    height: 420px;
  }
}

@media (max-width: 799px) {
  .hourly-scroll::-webkit-scrollbar,
  .day-hourly-container-inner::-webkit-scrollbar {
    display: none;
  }
}

@media (min-width: 800px) {
  .hourly-scroll {
    padding-bottom: 8px;
  }

  .hourly-scroll::-webkit-scrollbar {
    height: 20px;
  }

  .hourly-scroll::-webkit-scrollbar-track {
    background: transparent;
  }

  .hourly-scroll::-webkit-scrollbar-thumb {
    background: rgba(140, 140, 140, 0.7);
    border-radius: 999px;
    border: 6px solid var(--surface);
    background-clip: padding-box;
  }

  .hourly-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(180, 180, 180, 0.95);
    background-clip: padding-box;
  }

  html[data-theme="light"] .hourly-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 100, 100, 0.6);
    background-clip: padding-box;
  }

  html[data-theme="light"] .hourly-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(80, 80, 80, 0.85);
    background-clip: padding-box;
  }
}

.empty-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 700px) {
  .app {
    padding: 14px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-wrapper {
    width: 100%;
    max-width: none;
  }

  .current-main {
    margin-top: 10px;
  }

  .current-temp-lg {
    font-size: 3rem;
  }

  .current-icon-lg {
    width: 70px;
    height: 70px;
  }

  #use-my-location .btn-text {
    display: none;
  }

  .radar-map {
    height: 320px;
  }
}