:root {
    --bg:          #080f1f;
    --glass:       rgba(255, 255, 255, 0.08);
    --glass-h:     rgba(255, 255, 255, 0.13);
    --border:      rgba(255, 255, 255, 0.15);
    --border-h:    rgba(255, 255, 255, 0.26);
    --white:       #ffffff;
    --blue-light:  #bae6fd;
    --blue-mid:    #60a5fa;
    --blue-dim:    rgba(255, 255, 255, 0.55);
    --text-faint:  rgba(255, 255, 255, 0.30);
    --blur:        blur(22px);
    --r:           20px;
    --r-sm:        12px;
    --shadow:      0 8px 32px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    min-height: 100vh;
    background: var(--bg);
    color: var(--white);
    overflow-x: hidden;
}

/* ── Background ── */
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
}

.orb-1 {
    width: 750px; height: 750px;
    background: radial-gradient(circle, rgba(29,78,216,.50) 0%, transparent 65%);
    top: -200px; left: -180px;
    animation: da 20s ease-in-out infinite alternate;
}
.orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(14,165,233,.38) 0%, transparent 65%);
    bottom: -160px; right: -120px;
    animation: db 24s ease-in-out infinite alternate;
}
.orb-3 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,.30) 0%, transparent 65%);
    top: 35%; left: 52%;
    animation: dc 18s ease-in-out infinite alternate;
}
.orb-4 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(186,230,253,.05) 0%, transparent 65%);
    top: 15%; right: 18%;
    animation: db 28s ease-in-out infinite alternate-reverse;
}

@keyframes da { to { transform: translate(80px, 100px); } }
@keyframes db { to { transform: translate(-80px, -80px); } }
@keyframes dc { to { transform: translate(-50px, 70px); } }

/* ── Glass card base ── */
.glass-card {
    background: var(--glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    transition: border-color .2s;
}
.glass-card:hover { border-color: var(--border-h); }

/* ── Shared search row ── */
.search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.locate-btn {
    width: 52px; height: 52px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--blue-light);
    cursor: pointer;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: background .18s, border-color .18s, transform .15s;
}
.locate-btn:hover {
    background: rgba(59,130,246,.22);
    border-color: rgba(96,165,250,.55);
    transform: scale(1.06);
}
.locate-btn.sm { width: 44px; height: 44px; }
.locate-btn svg { width: 20px; height: 20px; }
.locate-btn.sm svg { width: 17px; height: 17px; }

.search-field {
    flex: 1;
    display: flex; align-items: center; gap: 10px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0 20px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: background .18s, border-color .18s, box-shadow .18s;
}
.search-field:focus-within {
    background: rgba(255,255,255,.12);
    border-color: rgba(96,165,250,.60);
    box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.search-field.sm { padding: 0 16px; }

.search-ico { width: 16px; height: 16px; color: var(--text-faint); flex-shrink: 0; }

.search-field input {
    flex: 1; height: 52px;
    background: transparent; border: none; outline: none;
    font-family: inherit; font-size: .95rem; font-weight: 400;
    color: var(--white);
}
.search-field.sm input { height: 44px; font-size: .88rem; }
.search-field input::placeholder { color: var(--text-faint); }

.search-btn {
    height: 52px; padding: 0 26px; flex-shrink: 0;
    background: linear-gradient(135deg, rgba(37,99,235,.70), rgba(99,102,241,.55));
    border: 1px solid rgba(96,165,250,.40);
    border-radius: 50px;
    color: #fff;
    font-family: inherit; font-size: .9rem; font-weight: 700;
    cursor: pointer; white-space: nowrap; letter-spacing: .2px;
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: 0 4px 20px rgba(59,130,246,.28);
    transition: background .18s, transform .13s, box-shadow .18s;
}
.search-btn:hover {
    background: linear-gradient(135deg, rgba(37,99,235,.90), rgba(99,102,241,.80));
    box-shadow: 0 6px 28px rgba(59,130,246,.45);
    transform: scale(1.03);
}
.search-btn:active { transform: scale(.97); }
.search-btn.sm { height: 44px; padding: 0 18px; font-size: .85rem; }

/* ── Status messages ── */
.hidden { display: none !important; }

.home-status {
    min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    width: 100%;
}

.status-loader {
    display: flex; align-items: center; gap: 10px;
    color: var(--blue-light); font-size: .88rem; font-weight: 500;
}

.spinner {
    width: 18px; height: 18px; display: block; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.10);
    border-top-color: var(--blue-mid);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-error {
    display: flex; align-items: center; gap: 10px;
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.28);
    border-radius: var(--r-sm);
    padding: 12px 18px;
    color: #fca5a5;
    font-size: .88rem; font-weight: 500;
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.status-error svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ══════════════════════════════
   HOME SCREEN
══════════════════════════════ */
.home-screen {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 28px;
    padding: 40px 24px;
}

/* ── Brand: fixed alignment ── */
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon-wrap {
    width: 64px; height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: 0 4px 20px rgba(59,130,246,.20);
    animation: float 4s ease-in-out infinite;
}

.brand-emoji {
    font-size: 2rem;
    line-height: 1;
    display: block;
}

@keyframes float {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

.brand-text {
    display: flex; flex-direction: column; gap: 5px;
}

.brand-name {
    font-family: "DM Serif Display", Georgia, serif;
    font-size: 2.6rem; font-weight: 400;
    line-height: 1; letter-spacing: -.4px;
    background: linear-gradient(125deg, #ffffff 0%, #bae6fd 40%, #93c5fd 70%, #c7d2fe 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: .73rem; font-weight: 500;
    color: var(--text-faint);
    letter-spacing: 1.3px; text-transform: uppercase;
}

.search-row { max-width: 520px; }

/* ══════════════════════════════
   RESULTS SCREEN
══════════════════════════════ */
.results-screen {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
    padding: 22px 28px 48px;
    gap: 18px;
    animation: riseIn .38s cubic-bezier(.22,1,.36,1) both;
}
@keyframes riseIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Topbar ── */
.topbar {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}

.topbar-logo {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}

.topbar-emoji {
    font-size: 1.5rem; line-height: 1;
    display: block;
    filter: drop-shadow(0 0 10px rgba(125,211,252,.5));
}

.topbar-name {
    font-family: "DM Serif Display", Georgia, serif;
    font-size: 1.3rem; font-weight: 400;
    background: linear-gradient(120deg, #fff, #bae6fd 55%, #93c5fd);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.search-row.compact { max-width: 440px; flex: 1; }

.topbar-error {
    display: flex; align-items: center; gap: 10px;
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.28);
    border-radius: var(--r-sm);
    padding: 11px 16px;
    color: #fca5a5; font-size: .87rem; font-weight: 500;
}
.topbar-error svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ── Dashboard ── */
.dashboard {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    flex: 1;
    align-items: start;
}

/* ── Left col ── */
.dash-left { display: flex; flex-direction: column; gap: 14px; }

.hero-card {
    padding: 28px;
    position: relative; overflow: hidden;
}

.hero-glow {
    position: absolute; top: -80px; right: -80px;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(59,130,246,.14), transparent 65%);
    border-radius: 50%; pointer-events: none;
}

.hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.hero-location { display: flex; flex-direction: column; gap: 4px; }

.city-name {
    font-size: 1.45rem; font-weight: 700;
    letter-spacing: -.4px; line-height: 1.2;
    color: var(--white);
}

.local-time {
    font-size: .78rem; font-weight: 600;
    color: var(--blue-mid);
    letter-spacing: .3px;
}

.sky-desc {
    font-size: .82rem; font-weight: 400;
    color: var(--blue-dim);
    text-transform: capitalize;
}

.wx-icon {
    width: 80px; height: 80px;
    flex-shrink: 0;
    margin-top: -6px; margin-right: -8px;
    filter: drop-shadow(0 4px 16px rgba(255,200,80,.40));
}

.big-temp {
    font-family: "DM Serif Display", Georgia, serif;
    font-size: 7.5rem; font-weight: 400;
    line-height: .9; letter-spacing: -6px;
    color: var(--white);
    display: flex; align-items: flex-start;
    margin: 10px 0 16px;
}
.big-temp sup {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 1.6rem; font-weight: 300;
    color: var(--blue-dim);
    letter-spacing: 0; margin-left: 6px; margin-top: 14px;
}

.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 99px;
    font-size: .79rem; font-weight: 500; color: var(--blue-dim);
}
.pill strong { color: var(--white); font-weight: 700; }
.pill svg { width: 13px; height: 13px; flex-shrink: 0; }
.pill-dot { color: rgba(255,255,255,.20); margin: 0 1px; }

/* ── Stats grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.stat-card {
    padding: 20px 18px;
    display: flex; flex-direction: column; gap: 9px;
    transition: background .18s, border-color .18s;
}
.stat-card:hover { background: var(--glass-h); border-color: var(--border-h); }

.stat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 19px; height: 19px; }

.stat-icon.blue   { background: rgba(59,130,246,.20);  color: #93c5fd; }
.stat-icon.cyan   { background: rgba(14,165,233,.20);  color: #7dd3fc; }
.stat-icon.violet { background: rgba(99,102,241,.20);  color: #a5b4fc; }
.stat-icon.amber  { background: rgba(245,158,11,.20);  color: #fcd34d; }
.stat-icon.rose   { background: rgba(251,113,133,.20); color: #fda4af; }
.stat-icon.indigo { background: rgba(139,92,246,.20);  color: #c4b5fd; }

.stat-val {
    font-size: 1.35rem; font-weight: 700;
    color: var(--white); letter-spacing: -.4px; line-height: 1;
}

.stat-label {
    font-size: .70rem; font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase; letter-spacing: .8px;
}

/* ── Forecast card ── */
.dash-right { display: flex; flex-direction: column; gap: 14px; }

.forecast-card { padding: 22px 22px 24px; }

.forecast-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.forecast-label {
    font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-faint);
}

.forecast-updated {
    font-size: .68rem; font-weight: 500;
    color: var(--text-faint);
}

.forecast-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.fc-day {
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
    padding: 14px 6px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--r-sm);
    cursor: default;
    transition: background .18s, border-color .18s;
}
.fc-day:hover {
    background: rgba(59,130,246,.10);
    border-color: rgba(96,165,250,.28);
}

.fc-lbl {
    font-size: .67rem; font-weight: 700;
    letter-spacing: .6px; color: var(--text-faint);
    text-transform: uppercase;
}
.fc-day img { width: 38px; height: 38px; }
.fc-tmp { font-size: .95rem; font-weight: 700; color: var(--white); }

.no-forecast {
    grid-column: 1/-1; text-align: center;
    color: var(--text-faint); font-size: .9rem; padding: 8px 0;
}

/* ════════════════════════════════════
   RESPONSIVE
════════════════════════════════════ */

/* Collapse to single column at 960px */
@media (max-width: 960px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet */
@media (max-width: 720px) {
    .results-screen { padding: 18px 16px 40px; }

    .topbar { flex-wrap: wrap; }
    .search-row.compact { max-width: 100%; order: 2; flex: 1 0 100%; }

    .big-temp { font-size: 6rem; letter-spacing: -4px; }
    .hero-card { padding: 22px; }
    .wx-icon { width: 68px; height: 68px; }
    .city-name { font-size: 1.25rem; }

    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .stat-val { font-size: 1.15rem; }
    .stat-card { padding: 16px 14px; }
}

/* Mobile */
@media (max-width: 540px) {
    .home-screen { gap: 22px; padding: 32px 16px; }
    .brand-name { font-size: 2rem; }
    .brand-icon-wrap { width: 54px; height: 54px; border-radius: 14px; }
    .brand-emoji { font-size: 1.7rem; }

    .search-field input { height: 46px; }
    .search-btn { height: 46px; padding: 0 16px; font-size: .83rem; }
    .locate-btn { width: 46px; height: 46px; }

    .results-screen { padding: 14px 12px 36px; gap: 14px; }
    .topbar-name { display: none; }
    .topbar-emoji { font-size: 1.7rem; }

    .search-btn.sm { padding: 0 14px; font-size: .82rem; }
    .search-field.sm input { font-size: .82rem; }

    .big-temp { font-size: 5rem; letter-spacing: -3px; }
    .big-temp sup { font-size: 1.4rem; margin-top: 10px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { padding: 15px 13px; }
    .stat-val { font-size: 1.1rem; }

    .forecast-card { padding: 16px 14px 18px; }
    .fc-day { padding: 11px 4px; }
    .fc-day img { width: 30px; height: 30px; }
    .fc-tmp { font-size: .83rem; }
    .fc-lbl { font-size: .60rem; }
    .forecast-row { gap: 5px; }
}

/* Very small phones */
@media (max-width: 380px) {
    .search-row { flex-wrap: wrap; }
    .search-field { order: -1; flex: 1 0 100%; }
    .locate-btn { flex: 1; border-radius: var(--r-sm); width: auto; height: 44px; }
    .search-btn { flex: 2; height: 44px; }
}
