:root {
  color-scheme: light;
  --ink: #17242b;
  --muted: rgba(23, 36, 43, 0.68);
  --faint: rgba(23, 36, 43, 0.48);
  --line: rgba(21, 44, 55, 0.16);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --dialog-bg: #f7fbfb;
  --dialog-control-bg: #ffffff;
  --accent: #7ecbca;
  --warn: #f6c85f;
  --danger: #f06d5e;
  --good: #8fd36c;
  --radarwise-blue: #0d3a5c;
  --page-bg:
    radial-gradient(circle at 18% 8%, rgba(126, 203, 202, 0.22), transparent 32rem),
    linear-gradient(135deg, #eef6f5 0%, #dbe8e8 42%, #f7f4ed 100%);
  --hero-bg: linear-gradient(135deg, rgba(34, 128, 160, 0.96), rgba(54, 86, 160, 0.95));
  --hero-ink: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef7f8;
  --muted: rgba(238, 247, 248, 0.72);
  --faint: rgba(238, 247, 248, 0.46);
  --line: rgba(255, 255, 255, 0.18);
  --panel: rgba(14, 25, 33, 0.76);
  --panel-strong: rgba(11, 23, 32, 0.9);
  --dialog-bg: #101b24;
  --dialog-control-bg: #ffffff;
  --page-bg:
    radial-gradient(circle at 18% 8%, rgba(126, 203, 202, 0.24), transparent 32rem),
    linear-gradient(135deg, #081018 0%, #102934 42%, #28353a 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--page-bg);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(10px, 1.2vw, 16px);
  display: grid;
  place-items: stretch;
}

.weather-surface {
  width: min(1880px, 100%);
  min-height: calc(100vh - clamp(20px, 2.4vw, 32px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(235, 248, 249, 0.34));
  box-shadow: 0 18px 56px rgba(18, 38, 48, 0.18);
  overflow: hidden;
  backdrop-filter: blur(22px);
}

.status-row {
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.48);
  border-bottom: 1px solid rgba(21, 44, 55, 0.08);
}

.status-row > div:first-child {
  min-width: 0;
}

.place {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  max-width: 360px;
}

.tagline {
  color: var(--faint);
  font-size: 12px;
  margin-top: 2px;
}

.location-form {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-form input {
  width: min(190px, 23vw);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-strong);
  padding: 7px 12px;
}

.location-form button,
.icon-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-strong);
  padding: 7px 12px;
  font-weight: 800;
  cursor: pointer;
}

.icon-button {
  min-width: 72px;
}

.gps-button.active {
  color: #ffffff;
  background: #247b92;
}

.gps-button {
  min-width: 84px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-pill,
.summary-pill,
.radar-caption,
.alert-summary-block,
.alert-item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

.status-pill {
  min-width: 92px;
  padding: 9px 12px;
  border-radius: 999px;
  text-align: center;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-strip {
  padding: 0;
  display: block;
}

.alert-summary-block {
  width: 100%;
  border-radius: 16px;
  border-color: rgba(166, 32, 24, 0.62);
  background: linear-gradient(135deg, rgba(195, 42, 32, 0.98), rgba(234, 84, 55, 0.94));
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(112, 22, 18, 0.22);
}

.alert-summary-block > summary {
  min-height: 48px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.alert-summary-block > summary::-webkit-details-marker {
  display: none;
}

.alert-summary-block > summary span:last-child {
  flex: 0 0 auto;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.86;
}

.alert-details-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  max-height: min(46vh, 420px);
  overflow: auto;
}

.alert-item {
  padding: 11px 12px;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: #25130f;
}

.alert-item h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.18;
}

.alert-meta {
  color: rgba(37, 19, 15, 0.68);
  font-size: 11px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item p {
  margin: 0;
  padding: 8px 0 0;
  color: rgba(37, 19, 15, 0.8);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-line;
}

.alert-moderate {
  border-color: rgba(177, 90, 0, 0.45);
  background: linear-gradient(135deg, rgba(255, 245, 211, 0.98), rgba(255, 224, 178, 0.9));
}

.alert-severe,
.alert-extreme {
  border-color: rgba(171, 34, 26, 0.55);
  background: linear-gradient(135deg, rgba(255, 228, 225, 0.98), rgba(255, 189, 176, 0.92));
}

.dashboard {
  padding: 14px 18px 18px;
  display: grid;
  grid-template-columns: minmax(250px, 0.58fr) minmax(520px, 1fr) minmax(560px, 1.18fr);
  height: clamp(620px, calc(100vh - 146px), 880px);
  min-height: 0;
  gap: 0;
}

.left-rail,
.current-panel,
.radar-panel {
  min-width: 0;
  background: var(--panel);
}

.left-rail {
  border-radius: 18px 0 0 18px;
  border: 1px solid var(--line);
  border-right: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.current-panel {
  border: 1px solid var(--line);
  padding: clamp(18px, 1.6vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--hero-ink);
  background: var(--hero-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.mobile-clock {
  display: none;
}

.radar-panel {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  overflow: hidden;
}

.clock-time {
  display: block;
  font-size: clamp(38px, 4.6vw, 72px);
  line-height: 0.92;
  font-weight: 850;
  letter-spacing: 0;
}

.clock-date {
  color: var(--muted);
  margin-top: 8px;
  font-weight: 650;
}

.summary-pill {
  min-height: 38px;
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.section-label {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.current-panel .section-label,
.current-panel .updated,
.current-panel .feels-like,
.current-panel .stat-label,
.current-panel .day-range,
.current-panel .day-rain {
  color: rgba(255, 255, 255, 0.72);
}

.current-panel .take-card {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
}

.current-panel .alert-strip {
  margin: -2px 0 0;
}

.take-card {
  border: 1px solid rgba(36, 123, 146, 0.18);
  border-radius: 8px;
  background: rgba(126, 203, 202, 0.14);
  color: var(--ink);
  padding: 11px 13px;
  font-weight: 800;
  line-height: 1.25;
}

.hourly-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hourly-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.hour-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 54px 32px 50px minmax(64px, 1fr) 44px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.hour-time,
.hour-pop {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.hour-temp {
  font-weight: 850;
}

.bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.bar-fill {
  height: 100%;
  width: var(--fill, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warn));
}

.current-row {
  min-height: 104px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) minmax(132px, max-content);
  gap: 18px;
  align-items: center;
}

.weather-icon {
  width: 66px;
  height: 66px;
}

.weather-icon svg {
  width: 100%;
  height: 100%;
}

.condition {
  min-width: 0;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.updated,
.feels-like {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.temperature-block {
  text-align: right;
}

.temperature {
  font-size: clamp(48px, 4.8vw, 72px);
  line-height: 0.94;
  font-weight: 900;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.day-card:nth-child(n+6) {
  display: none;
}

.day-card {
  min-height: 138px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  display: grid;
  grid-template-rows: 20px 42px 34px 18px 34px;
  gap: 6px;
  align-content: space-between;
  text-align: center;
  min-width: 0;
}

.day-name {
  font-weight: 850;
  line-height: 20px;
}

.day-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto;
}

.day-temp {
  font-size: 26px;
  font-weight: 900;
  line-height: 34px;
}

.day-range,
.day-rain {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  min-height: 18px;
  display: grid;
  place-items: center;
  overflow-wrap: normal;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 850;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

#map {
  position: absolute;
  inset: 0;
  background: #17252d;
}

.leaflet-container {
  background: #17252d;
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(8, 16, 24, 0.68) !important;
  color: rgba(255, 255, 255, 0.7) !important;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

.radar-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  max-width: calc(100% - 24px);
  border-radius: 999px;
  padding: 8px 12px;
  display: flex;
  gap: 10px;
  color: var(--ink);
  background: rgba(8, 16, 24, 0.72);
}

.radar-caption span:last-child {
  color: var(--muted);
}

.radar-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  width: min(310px, calc(100% - 24px));
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr);
  gap: 8px;
  align-items: center;
}

.radar-controls button,
.radar-controls input {
  min-height: 36px;
}

.radar-controls button {
  border: 1px solid rgba(21, 44, 55, 0.18);
  border-radius: 999px;
  color: #17242b;
  background: rgba(255, 255, 255, 0.88);
  padding: 7px 12px;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(18, 38, 48, 0.12);
}

.radar-controls input {
  accent-color: #247b92;
}

.settings-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-strong);
  cursor: pointer;
}

.settings-button svg {
  width: 22px;
  height: 22px;
}

.settings-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--dialog-bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.settings-dialog h2 {
  margin: 0 0 16px;
  color: var(--ink);
}

.setting-row {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: var(--ink);
  font-weight: 750;
}

.setting-row select,
.setting-row input {
  width: 100%;
}

.setting-row select {
  min-height: 36px;
  border: 1px solid rgba(21, 44, 55, 0.3);
  border-radius: 6px;
  color: #17242b;
  background: var(--dialog-control-bg);
  padding: 5px 8px;
}

.setting-row input[type="range"] {
  accent-color: #247b92;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  border: 1px solid rgba(21, 44, 55, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-strong);
  padding: 8px 12px;
  font-weight: 750;
}

.skeleton-list::before,
.skeleton-cards::before {
  content: "";
  display: block;
  height: 120px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.16), rgba(255,255,255,.06));
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}

.noscript-copy {
  padding: 18px;
  color: #17242b;
  background: #f7fbfb;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-list::before,
  .skeleton-cards::before {
    animation: none;
  }
}

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  }

  .radar-panel {
    grid-column: 1 / -1;
    min-height: 340px;
    border-left: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

  .left-rail {
    border-radius: 8px 0 0 0;
  }

  .current-panel {
    border-radius: 0 8px 0 0;
  }

  .daily-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .day-card:nth-child(n+5) {
    display: none;
  }

  .day-temp {
    font-size: 24px;
  }

  .current-row {
    grid-template-columns: 62px minmax(0, 1fr) minmax(116px, max-content);
    gap: 14px;
  }

  .condition {
    font-size: clamp(25px, 3.2vw, 38px);
  }

  .temperature {
    font-size: clamp(42px, 5vw, 60px);
  }
}

@media (min-width: 1181px) and (max-width: 1500px) {
  .daily-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .day-card:nth-child(n+6) {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
  }

  .weather-surface {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    background:
      linear-gradient(180deg, rgba(238, 249, 249, 0.96) 0 170px, transparent 170px),
      linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(235, 248, 249, 0.36));
  }

  .status-row {
    min-height: 0;
    margin: 10px 12px 8px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(21, 44, 55, 0.1);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 28px rgba(18, 38, 48, 0.1);
    backdrop-filter: blur(18px);
  }

  .alert-strip {
    padding: 0 14px 8px;
  }

  .alert-meta {
    font-size: 10px;
  }

  .status-pill {
    display: none;
  }

  .tagline {
    display: none;
  }

  .place {
    font-size: 12px;
    line-height: 1.18;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .location-form {
    grid-column: 1 / -1;
    order: 4;
    width: 100%;
    margin: 0;
    gap: 6px;
  }

  .location-form input {
    width: 100%;
    flex: 1;
    min-height: 36px;
    padding-inline: 15px;
    font-size: 16px;
  }

  .icon-button {
    grid-row: 1;
    min-width: 0;
    min-height: 36px;
    padding-inline: 10px;
    font-size: 13px;
    box-shadow: 0 8px 18px rgba(18, 38, 48, 0.08);
  }

  .gps-button {
    grid-column: 2;
    min-width: 76px;
  }

  #refresh-button {
    grid-column: 3;
    min-width: 76px;
  }

  .dashboard {
    height: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  .left-rail {
    order: 1;
    display: contents;
  }

  .clock-panel {
    display: none;
  }

  .current-panel {
    order: 2;
    margin: 0 12px 14px;
    border: 0;
    border-radius: 24px;
    color: var(--hero-ink);
    background: var(--hero-bg);
    box-shadow: 0 22px 48px rgba(32, 78, 116, 0.26);
  }

  .radar-panel {
    order: 4;
  }

  .summary-pill,
  .hourly-panel {
    order: 3;
    margin-inline: 18px;
  }

  .summary-pill {
    display: none;
  }

  .hourly-list {
    overflow: visible;
    padding-right: 0;
  }

  .left-rail,
  .current-panel,
  .radar-panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .current-panel {
    padding: 18px 18px 20px;
    border-top: 0;
    border-radius: 24px;
  }

  .current-panel .alert-strip {
    margin: -2px -4px 0;
    padding: 0 0 2px;
  }

  .mobile-clock {
    display: block;
    padding-bottom: 4px;
  }

  .mobile-clock-time {
    display: block;
    font-size: clamp(46px, 16vw, 72px);
    line-height: 0.92;
    font-weight: 900;
    letter-spacing: 0;
  }

  .mobile-clock-date {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 800;
  }

  .current-panel .section-label,
  .current-panel .updated,
  .current-panel .feels-like,
  .current-panel .stat-label,
  .current-panel .day-range,
  .current-panel .day-rain {
    color: rgba(255, 255, 255, 0.72);
  }

  .current-panel .take-card {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.14);
  }

  .current-row {
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 0;
    gap: 12px;
  }

  .weather-icon {
    width: 58px;
    height: 58px;
  }

  .temperature-block {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: -4px;
  }

  .daily-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .day-card,
  .stat {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.14);
  }

  .day-card {
    min-height: 176px;
    padding: 10px 7px;
    grid-template-rows: 22px 40px 36px 18px 24px;
    gap: 4px;
  }

  .day-temp {
    font-size: 27px;
    line-height: 36px;
  }

  .day-rain {
    min-height: 24px;
    font-size: 12px;
  }

  .day-card:nth-child(n+4) {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .radar-panel {
    min-height: 340px;
  }

  .radar-controls {
    top: 10px;
    right: 10px;
    width: min(250px, calc(100% - 20px));
  }
}
