:root {
      --bg-day:   linear-gradient(160deg, #0f2443 0%, #1a4a8a 40%, #2d7dd2 100%);
      --bg-night: linear-gradient(160deg, #060b18 0%, #0f1f3d 50%, #1a3060 100%);
      --bg-cloudy:linear-gradient(160deg, #2c3e50 0%, #4a5568 50%, #718096 100%);
      --bg-rain:  linear-gradient(160deg, #1a202c 0%, #2d3748 50%, #4a6080 100%);
      --bg-clear: linear-gradient(160deg, #0f2443 0%, #1a4a8a 40%, #2d7dd2 100%);
      --surface: rgba(255,255,255,0.08);
      --border:  rgba(255,255,255,0.15);
      --text:    #f0f4ff;
      --muted:   rgba(240,244,255,0.6);
      --accent:  #60d0ff;
      --card-bg: rgba(255,255,255,0.07);
    }

    * { margin:0; padding:0; box-sizing:border-box; }
    html { scroll-behavior: smooth; }

    body {
      font-family: 'Outfit', sans-serif;
      min-height: 100vh;
      background: var(--bg-day);
      color: var(--text);
      transition: background 1.2s ease;
      overflow-x: hidden;
    }

    /* animated sky particles */
    #particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
    .particle {
      position: absolute; border-radius: 50%;
      background: rgba(255,255,255,0.5);
      animation: drift linear infinite;
    }
    @keyframes drift {
      0%   { transform: translateY(100vh) translateX(0) scale(0); opacity:0; }
      10%  { opacity: 1; }
      90%  { opacity: 0.6; }
      100% { transform: translateY(-10vh) translateX(40px) scale(1); opacity:0; }
    }

    /* MAIN LAYOUT */
    .app {
      position: relative; z-index: 1;
      min-height: 100vh;
      padding: 2rem 1.5rem 3rem;
      max-width: 1100px;
      margin: 0 auto;
    }

    /* HEADER */
    header {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 2.5rem;
    }
    .logo {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 1.5rem; font-weight: 700;
      display: flex; align-items: center; gap: .5rem;
      letter-spacing: -.02em;
    }
    .logo-icon { font-size: 1.4rem; }
    .logo span { color: var(--accent); }
    .unit-toggle {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 50px; padding: .3rem;
      display: flex; gap: .2rem; align-items: center;
    }
    .reset-key-btn {
      background: transparent; border: 1px solid var(--border);
      color: var(--muted); padding: .38rem .85rem; border-radius: 50px;
      cursor: pointer; font-family: 'Outfit', sans-serif; font-size: .78rem;
      transition: all .2s; margin-right: .6rem;
    }
    .reset-key-btn:hover { border-color: var(--accent); color: var(--accent); }
    .unit-btn {
      background: transparent; border: none; color: var(--muted);
      padding: .4rem .9rem; border-radius: 50px; cursor: pointer;
      font-family: 'Outfit', sans-serif; font-size: .85rem; font-weight: 500;
      transition: all .25s;
    }
    .unit-btn.active { background: var(--accent); color: #000; font-weight: 600; }

    /* SEARCH */
    .search-wrap {
      position: relative; max-width: 560px; margin: 0 auto 2.5rem;
    }
    .search-wrap input {
      width: 100%; background: rgba(255,255,255,0.12);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border);
      border-radius: 18px; color: var(--text);
      padding: 1.1rem 4.5rem 1.1rem 1.6rem;
      font-family: 'Outfit', sans-serif; font-size: 1rem;
      outline: none; transition: border-color .3s, box-shadow .3s;
    }
    .search-wrap input::placeholder { color: var(--muted); }
    .search-wrap input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(96,208,255,0.15);
    }
    .search-btn {
      position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
      background: var(--accent); border: none; border-radius: 12px;
      width: 42px; height: 42px; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      font-size: 1rem; color: #000; transition: transform .2s, box-shadow .2s;
    }
    .search-btn:hover { transform: translateY(-50%) scale(1.08); box-shadow: 0 4px 20px rgba(96,208,255,0.4); }
    .search-suggestions {
      position: absolute; top: calc(100% + 8px); left: 0; right: 0;
      background: rgba(15,36,67,0.95); backdrop-filter: blur(20px);
      border: 1px solid var(--border); border-radius: 14px;
      overflow: hidden; display: none; z-index: 100;
    }
    .suggestion-item {
      padding: .85rem 1.6rem; cursor: pointer; font-size: .9rem;
      display: flex; align-items: center; gap: .8rem;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      transition: background .2s; color: var(--muted);
    }
    .suggestion-item:hover { background: rgba(96,208,255,0.1); color: var(--text); }
    .suggestion-item:last-child { border-bottom: none; }

    /* ERROR */
    .error-msg {
      text-align: center; color: #ff7b7b; font-size: .9rem;
      padding: .8rem; display: none; margin-bottom: 1rem;
      background: rgba(255,100,100,0.1); border-radius: 10px;
      border: 1px solid rgba(255,100,100,0.2);
    }

    /* WEATHER CARD */
    .weather-main {
      background: rgba(255,255,255,0.08);
      backdrop-filter: blur(30px);
      border: 1px solid var(--border);
      border-radius: 28px; padding: 2.5rem;
      margin-bottom: 1.5rem;
      animation: slideUp .6s ease;
      display: none;
    }
    @keyframes slideUp { from { opacity:0; transform:translateY(30px);} to { opacity:1; transform:translateY(0);} }

    .main-top {
      display: flex; justify-content: space-between; align-items: flex-start;
      flex-wrap: wrap; gap: 1rem;
    }
    .location-wrap { }
    .city-name {
      font-family: 'Space Grotesk', sans-serif;
      font-size: clamp(1.8rem, 4vw, 2.8rem);
      font-weight: 700; line-height: 1.1;
    }
    .country-date {
      color: var(--muted); font-size: .9rem; margin-top: .3rem;
      display: flex; align-items: center; gap: .5rem;
    }
    .temp-wrap { text-align: right; }
    .main-temp {
      font-family: 'Space Grotesk', sans-serif;
      font-size: clamp(4rem, 10vw, 6.5rem);
      font-weight: 700; line-height: 1;
      letter-spacing: -.04em;
    }
    .main-temp sup { font-size: 2rem; font-weight: 400; vertical-align: super; }
    .feels-like { color: var(--muted); font-size: .88rem; margin-top: .3rem; }

    .weather-icon-row {
      display: flex; align-items: center; gap: 1.2rem;
      margin: 1.5rem 0 2rem;
    }
    .w-icon { font-size: 4rem; line-height: 1; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)); }
    .w-desc { font-size: 1.2rem; font-weight: 500; text-transform: capitalize; }
    .w-range { color: var(--muted); font-size: .88rem; margin-top: .2rem; }

    /* STAT GRID */
    .stat-grid {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 1rem; margin-top: 1.5rem;
    }
    .stat-card {
      background: rgba(255,255,255,0.07);
      border: 1px solid var(--border);
      border-radius: 16px; padding: 1.1rem;
      transition: transform .2s, background .2s;
    }
    .stat-card:hover { transform: translateY(-3px); background: rgba(255,255,255,0.12); }
    .stat-icon { font-size: .95rem; color: var(--accent); margin-bottom: .5rem; }
    .stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
    .stat-value { font-size: 1.3rem; font-weight: 600; margin-top: .2rem; }
    .stat-unit  { font-size: .8rem; color: var(--muted); }

    /* SUN TIMES */
    .sun-bar {
      margin-top: 1.8rem;
      background: rgba(255,255,255,0.05);
      border: 1px solid var(--border);
      border-radius: 16px; padding: 1.2rem 1.5rem;
    }
    .sun-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    .sun-item { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
    .sun-time { font-weight: 600; font-size: 1rem; }
    .sun-track { flex: 1; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; position: relative; overflow: hidden; }
    .sun-fill { height: 100%; background: linear-gradient(90deg, #f6c549, #ff7b1e); border-radius: 2px; width: 0; transition: width 1.5s cubic-bezier(.4,0,.2,1) .5s; }

    /* FORECAST ROW */
    .section-title {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 1rem; font-weight: 600; color: var(--muted);
      text-transform: uppercase; letter-spacing: .1em;
      margin-bottom: 1rem;
    }
    .forecast-row {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
      gap: .9rem; margin-bottom: 1.5rem;
    }
    .forecast-card {
      background: var(--card-bg); backdrop-filter: blur(20px);
      border: 1px solid var(--border); border-radius: 18px;
      padding: 1.2rem .8rem; text-align: center;
      transition: transform .2s, background .2s;
      animation: slideUp .6s ease;
    }
    .forecast-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.12); }
    .fc-day { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
    .fc-icon { font-size: 1.8rem; margin: .6rem 0; display: block; }
    .fc-high { font-size: 1.1rem; font-weight: 700; }
    .fc-low  { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
    .fc-rain { font-size: .75rem; color: #90cdf4; margin-top: .4rem; display: flex; align-items: center; justify-content: center; gap: .25rem; }

    /* HOURLY */
    .hourly-scroll {
      display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .5rem;
      margin-bottom: 1.5rem; scrollbar-width: thin;
      scrollbar-color: rgba(255,255,255,0.2) transparent;
    }
    .hour-card {
      background: var(--card-bg); border: 1px solid var(--border);
      border-radius: 16px; padding: 1rem .9rem; text-align: center;
      min-width: 80px; flex-shrink: 0;
      transition: transform .2s, background .2s;
      animation: slideUp .5s ease;
    }
    .hour-card:hover { transform: translateY(-3px); background: rgba(255,255,255,0.12); }
    .h-time { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
    .h-icon { font-size: 1.4rem; margin: .5rem 0; display: block; }
    .h-temp { font-size: .95rem; font-weight: 600; }
    .h-wind { font-size: .7rem; color: var(--muted); margin-top: .3rem; }

    /* AIR QUALITY */
    .aqi-card {
      background: var(--card-bg); border: 1px solid var(--border);
      border-radius: 20px; padding: 1.5rem 2rem;
      margin-bottom: 1.5rem; animation: slideUp .6s ease;
    }
    .aqi-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
    .aqi-num { font-size: 3rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
    .aqi-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-top: .2rem; }
    .aqi-track { flex: 1; min-width: 200px; }
    .aqi-bar { height: 8px; background: linear-gradient(90deg, #68d391 0%, #f6e05e 40%, #fc8181 70%, #e53e3e 100%); border-radius: 4px; position: relative; }
    .aqi-pointer { position: absolute; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,0.3); transform: translateX(-50%); transition: left 1s ease .5s; }

    /* LOADING SKELETON */
    .skeleton { animation: shimmer 1.5s infinite; }
    @keyframes shimmer {
      0%  { opacity: .4; }
      50% { opacity: .8; }
      100%{ opacity: .4; }
    }
    .skeleton-block {
      background: rgba(255,255,255,0.1); border-radius: 10px;
      height: 20px; margin-bottom: 10px;
    }

    /* EMPTY STATE */
    .empty-state {
      text-align: center; padding: 4rem 2rem;
    }
    .empty-icon { font-size: 4.5rem; margin-bottom: 1.2rem; opacity: .6; }
    .empty-title { font-size: 1.5rem; font-weight: 600; margin-bottom: .6rem; }
    .empty-sub   { color: var(--muted); font-size: .95rem; line-height: 1.6; }
    .demo-btns   { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.8rem; }
    .demo-btn {
      background: rgba(255,255,255,0.1); border: 1px solid var(--border);
      color: var(--text); padding: .65rem 1.4rem; border-radius: 50px;
      cursor: pointer; font-family: 'Outfit', sans-serif; font-size: .9rem;
      font-weight: 500; transition: all .2s; display: flex; align-items: center; gap: .5rem;
    }
    .demo-btn:hover { background: rgba(96,208,255,0.15); border-color: var(--accent); color: var(--accent); }

    /* FOOTER */
    footer {
      text-align: center; margin-top: 3rem;
      color: rgba(255,255,255,0.3); font-size: .78rem;
    }
    footer a { color: var(--accent); text-decoration: none; }

    /* API KEY BANNER */
    .api-banner {
      background: rgba(96,208,255,0.08); border: 1px solid rgba(96,208,255,0.2);
      border-radius: 16px; padding: 1.2rem 1.6rem; margin-bottom: 1.5rem;
      font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .8rem;
      flex-wrap: wrap;
    }
    .api-banner i { color: var(--accent); font-size: 1rem; }
    .api-banner input {
      flex: 1; min-width: 200px;
      background: rgba(255,255,255,0.08); border: 1px solid var(--border);
      border-radius: 8px; color: var(--text); padding: .5rem 1rem;
      font-family: 'Outfit', sans-serif; font-size: .85rem; outline: none;
      transition: border-color .2s;
    }
    .api-banner input:focus { border-color: var(--accent); }
    .api-banner button {
      background: var(--accent); border: none; border-radius: 8px;
      color: #000; padding: .5rem 1.2rem; cursor: pointer;
      font-family: 'Outfit', sans-serif; font-weight: 600; font-size: .85rem;
      transition: opacity .2s;
    }
    .api-banner button:hover { opacity: .85; }

    @media (max-width: 600px) {
      .main-top { flex-direction: column; align-items: flex-start; }
      .temp-wrap { text-align: left; }
      .weather-main { padding: 1.8rem 1.4rem; }
    }