:root {
  color-scheme: light;
  --bg: #f3f6f3;
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.72);
  --ink: #16201b;
  --muted: #617069;
  --line: #d9e0dc;
  --accent: #0f766e;
  --accent-strong: #155e75;
  --warn: #9f580a;
  --shadow: 0 18px 50px rgba(23, 43, 36, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07100d;
  --surface: #0d1713;
  --surface-soft: rgba(13, 23, 19, 0.82);
  --ink: #edf7f2;
  --muted: #9db0a8;
  --line: rgba(216, 231, 224, 0.16);
  --accent: #4fd1c5;
  --accent-strong: #7dd3fc;
  --warn: #f6ad55;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

.app {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar,
.current,
.globe-panel,
.forecast-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(520px, 720px);
  gap: 20px;
  align-items: end;
  padding: 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 850;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin-top: 6px;
  color: var(--muted);
}

.search {
  display: grid;
  grid-template-columns: 1fr 1fr 76px 118px 86px 74px;
  gap: 9px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.search button[type="submit"],
#locationButton {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 760;
}

.globe-panel {
  margin-top: 12px;
  overflow: hidden;
}

.globe-panel.collapsed iframe {
  display: none;
}

.globe-panel.collapsed {
  box-shadow: none;
}

.globe-panel-head {
  min-height: 52px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 40px;
  min-height: 36px;
  font-size: 22px;
  line-height: 1;
}

iframe {
  display: block;
  width: 100%;
  height: 33vh;
  min-height: 260px;
  max-height: 390px;
  border: 0;
}

.current {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 12px 0;
  padding: 18px;
  background: var(--surface);
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

#currentValue {
  display: block;
  margin-top: 4px;
  font-size: 44px;
  line-height: 1;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metrics span {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--muted);
}

.forecast-section {
  margin-top: 12px;
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.card-row {
  display: grid;
  gap: 10px;
}

.daily-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.weekly-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.two-week-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.forecast-card {
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.muted-card {
  color: var(--muted);
}

.card-date {
  min-height: 34px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.15;
}

.card-temp {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
  font-weight: 850;
}

.card-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.hourly-drawer {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

.hourly-card {
  min-height: 150px;
}

details {
  margin-top: 8px;
}

summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 750;
}

.source-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  background: var(--surface);
}

.source-table th,
.source-table td {
  padding: 8px;
  border: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
}

.source-table th {
  color: var(--muted);
}

.status {
  padding: 12px 0;
  color: var(--muted);
}

.footer {
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1040px) {
  .topbar,
  .search {
    grid-template-columns: 1fr;
  }

  .daily-grid,
  .two-week-grid {
    grid-template-columns: repeat(4, minmax(132px, 1fr));
  }

  .hourly-drawer {
    grid-template-columns: repeat(3, minmax(132px, 1fr));
  }
}

@media (max-width: 680px) {
  .app {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .topbar,
  .current,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    display: flex;
  }

  .search {
    width: 100%;
  }

  iframe {
    height: 31vh;
    min-height: 220px;
  }

  .metrics {
    justify-content: flex-start;
  }

  .daily-grid,
  .weekly-grid,
  .two-week-grid,
  .hourly-drawer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-card {
    min-height: 118px;
  }

  .card-temp {
    font-size: 23px;
  }
}
