:root {
  color-scheme: dark;
  --bg: #07101c;
  --panel: #0e1a2a;
  --panel-2: #101f31;
  --panel-3: #14263b;
  --text: #eef5ff;
  --muted: #91a4bb;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7dd3fc;
  --accent-2: #c4b5fd;
  --accent-ink: #07131e;
  --radius: 22px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(125, 211, 252, 0.1), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(196, 181, 253, 0.08), transparent 30%),
    var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, .hour-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 28, 0.82);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--text); font: 800 18px Manrope, sans-serif; padding: 0; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, rgba(125,211,252,.18), rgba(196,181,253,.16)); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.ghost-btn, .icon-btn, .secondary-btn {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: 13px;
  padding: 10px 14px;
}
.icon-btn { width: 42px; height: 42px; padding: 0; font-size: 20px; }
.ghost-btn:hover, .icon-btn:hover, .secondary-btn:hover { background: rgba(255,255,255,.08); }

.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 80px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: stretch; margin-bottom: 22px; }
.hero-copy { padding: 10px 0; }
.eyebrow { letter-spacing: .16em; font-size: 11px; font-weight: 800; color: #7f95ad; }
h1, h2 { font-family: Manrope, sans-serif; letter-spacing: -.03em; margin: 5px 0 8px; }
h1 { font-size: clamp(40px, 7vw, 72px); line-height: .98; }
h2 { font-size: 30px; }
p { margin: 0; }
.muted { color: var(--muted); line-height: 1.55; }

.current-card {
  padding: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}
.current-icon { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 22px; font-size: 44px; background: rgba(255,255,255,.05); }
.current-temp { font: 800 58px/1 Manrope, sans-serif; letter-spacing: -.06em; }
.current-condition { margin-top: 6px; font-weight: 600; }
.current-meta { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; padding-top: 6px; color: var(--muted); font-size: 14px; }
.current-meta strong { color: var(--text); }

.search-strip { position: relative; margin: 0 0 22px; }
.search-wrap { display: flex; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); }
.search-icon { color: var(--muted); font-size: 26px; padding: 0 6px; }
.search-wrap input, .dialog-search input, #timeInput { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; min-width: 0; }
.search-wrap input::placeholder, .dialog-search input::placeholder { color: #64778e; }
.search-wrap button, .primary-btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.primary-btn:hover { filter: brightness(1.04); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 12; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: #0d1928; box-shadow: var(--shadow); }
.search-result { width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 0; border-radius: 12px; padding: 12px; color: var(--text); background: transparent; }
.search-result:hover { background: rgba(255,255,255,.06); }
.search-result-main { display: flex; gap: 10px; min-width: 0; }
.search-result-pin { opacity: .8; }
.search-result-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.time-panel, .detail-card, .forecast-section { border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: var(--radius); }
.time-panel { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 24px; }
.time-controls { display: flex; gap: 8px; align-items: center; width: min(460px, 100%); }
#timeInput { min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.04); }
#timeInput::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .75; }

.detail-card { margin-top: 18px; padding: 24px; }
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.detail-main { display: flex; align-items: center; gap: 14px; }
.detail-icon { font-size: 52px; }
.detail-temp { font: 800 48px/1 Manrope, sans-serif; letter-spacing: -.05em; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.stat-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.03); }
.stat-label, .stat-sub { display: block; color: var(--muted); font-size: 12px; }
.stat-label { margin-bottom: 8px; }
.stat-card strong { font: 800 22px Manrope, sans-serif; }
.stat-sub { margin-top: 4px; }

.forecast-section { margin-top: 22px; padding: 22px 0 20px; overflow: hidden; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 0 22px 18px; }
.hourly-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); gap: 10px; overflow-x: auto; padding: 0 22px 4px; scrollbar-width: thin; }
.hour-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: rgba(255,255,255,.025); min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.hour-card.is-now { border-color: rgba(125,211,252,.45); background: rgba(125,211,252,.07); }
.hour-time { font-size: 12px; color: var(--muted); }
.hour-icon { font-size: 34px; }
.hour-temp { font: 800 24px Manrope, sans-serif; }
.hour-rain { color: var(--accent); font-size: 12px; font-weight: 700; }
.hour-precip { color: var(--muted); font-size: 11px; }

.days-list { display: grid; gap: 8px; padding: 0 22px 2px; }
.day-row { display: grid; grid-template-columns: 1.2fr auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.02); }
.day-name { font-weight: 700; }
.day-icon { font-size: 25px; }
.day-rain { color: var(--muted); font-size: 13px; }
.day-temps { justify-self: end; font-weight: 700; }

.footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 30px; color: #6f8198; font-size: 12px; display: flex; justify-content: center; gap: 8px; }

.location-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(3, 8, 15, .8); backdrop-filter: blur(14px); }
.location-overlay[aria-hidden="true"] { display: none; }
.location-dialog { width: min(520px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: #0d1928; box-shadow: 0 30px 100px rgba(0,0,0,.48); }
.dialog-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: rgba(125,211,252,.1); color: var(--accent); font-size: 28px; margin-bottom: 20px; }
.location-dialog h2 { font-size: 38px; margin-top: 8px; }
.location-dialog > .muted { margin-bottom: 22px; }
.wide { width: 100%; }
.or-divider { position: relative; text-align: center; margin: 20px 0; color: #65798f; font-size: 12px; }
.or-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.or-divider span { position: relative; padding: 0 10px; background: #0d1928; }
.dialog-search { display: flex; gap: 8px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.04); }
.dialog-search input { padding: 10px; }
.dialog-search button { flex: 0 0 auto; }
.dialog-results { position: static; margin-top: 8px; }
.tiny { margin-top: 18px; color: #61758c; line-height: 1.5; font-size: 11px; }

.toast { position: fixed; bottom: 22px; left: 50%; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: #0d1928; color: var(--text); box-shadow: var(--shadow); transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.loading-bar { position: fixed; top: 0; left: 0; z-index: 100; width: 0; height: 3px; background: var(--accent); transition: width .25s ease; }
.loading-bar.active { width: 70%; }
.loading-bar.done { width: 100%; }

@media (max-width: 820px) {
  .hero, .time-panel { grid-template-columns: 1fr; }
  .time-controls { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .topbar .ghost-btn { display: none; }
  .page { width: min(100% - 20px, 1120px); padding-top: 28px; }
  .hero { gap: 16px; }
  h1 { font-size: 48px; }
  .current-card { padding: 20px; }
  .current-icon { width: 62px; height: 62px; font-size: 34px; }
  .current-temp { font-size: 46px; }
  .time-panel, .detail-card { padding: 18px; }
  .time-controls { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-header { align-items: flex-start; }
  .detail-main { gap: 8px; }
  .detail-icon { font-size: 40px; }
  .detail-temp { font-size: 38px; }
  .day-row { grid-template-columns: 1fr auto; }
  .day-rain { grid-column: 1 / 2; }
  .day-temps { grid-column: 2 / 3; grid-row: 1 / span 2; }
  .footer { width: calc(100% - 20px); }
}
