  :root {
    --bg: #0a0e1a;
    --surface: rgba(255,255,255,0.05);
    --surface2: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.10);
    --border2: rgba(255,255,255,0.18);
    --text: #f0f4ff;
    --text2: rgba(240,244,255,0.60);
    --text3: rgba(240,244,255,0.38);
    --accent: #4f8ef7;
    --accent2: #7fb3ff;
    --warm: #f9a850;
    --cool: #64d8e8;
    --danger: #f87171;
    --success: #4ade80;
    --radius: 16px;
    --radius-sm: 10px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }
  /* Animated background */
  .bg-canvas {
    position: fixed; inset: 0; z-index: 0; overflow: hidden;
  }
  .bg-orb {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.18;
    animation: drift 20s ease-in-out infinite alternate;
  }
  .orb1 { width: 600px; height: 600px; background: #1a3a8f; top: -200px; left: -200px; animation-delay: 0s; }
  .orb2 { width: 500px; height: 500px; background: #0e4f6e; top: 40%; right: -150px; animation-delay: -7s; }
  .orb3 { width: 400px; height: 400px; background: #1a0f4a; bottom: -100px; left: 30%; animation-delay: -14s; }
  @keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(40px,30px) scale(1.08); } }

  /* Layout */
  .app { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

  /* Header */
  .header { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
  .logo { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  .logo span { color: var(--accent2); }
  .header-sub { font-size: 13px; color: var(--text3); margin-top: 1px; }

  /* Search */
  .search-wrap { position: relative; margin-bottom: 36px; }
  .search-box {
    width: 100%; padding: 16px 56px 16px 20px;
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 14px; color: var(--text); font-size: 16px;
    font-family: 'DM Sans', sans-serif; outline: none;
    transition: border-color 0.2s, background 0.2s;
  }
  .search-box:focus { border-color: var(--accent); background: rgba(79,142,247,0.08); }
  .search-box::placeholder { color: var(--text3); }
  .search-btn {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: var(--accent); border: none; border-radius: 9px; padding: 8px 14px;
    color: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
    font-family: 'DM Sans', sans-serif; transition: background 0.2s, transform 0.1s;
  }
  .search-btn:hover { background: #3a7ae8; }
  .search-btn:active { transform: translateY(-50%) scale(0.97); }
  .search-btn.location-btn { right: 70px; }
  .suggestions {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: #141828; border: 1px solid var(--border2); border-radius: 12px;
    overflow: hidden; z-index: 100; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  }
  .sug-item {
    padding: 12px 20px; cursor: pointer; font-size: 14px;
    border-bottom: 1px solid var(--border); transition: background 0.15s;
    display: flex; align-items: center; gap: 10px;
  }
  .sug-item:last-child { border-bottom: none; }
  .sug-item:hover { background: var(--surface2); }
  .sug-flag { font-size: 18px; }
  .sug-name { font-weight: 500; }
  .sug-region { font-size: 12px; color: var(--text3); margin-top: 1px; }

  /* Main hero card */
  .hero-card {
    background: linear-gradient(135deg, rgba(79,142,247,0.15) 0%, rgba(14,79,110,0.20) 100%);
    border: 1px solid var(--border2); border-radius: 24px;
    padding: 36px; margin-bottom: 20px;
    display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start;
    position: relative; overflow: hidden;
  }
  .hero-card::before {
    content: ''; position: absolute; top: -50%; right: -10%;
    width: 400px; height: 400px; border-radius: 50%;
    background: radial-gradient(circle, rgba(127,179,255,0.08) 0%, transparent 70%);
    pointer-events: none;
  }
  .hero-location { font-size: 14px; color: var(--accent2); font-weight: 500; letter-spacing: 0.5px; margin-bottom: 6px; }
  .hero-city { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
  .hero-country { font-size: 15px; color: var(--text2); margin-top: 4px; }
  .hero-desc { font-size: 18px; color: var(--text2); margin-top: 16px; text-transform: capitalize; }
  .hero-temp { font-family: 'Space Grotesk', sans-serif; font-size: 88px; font-weight: 300; line-height: 1; letter-spacing: -4px; text-align: right; }
  .hero-temp sup { font-size: 32px; vertical-align: super; letter-spacing: 0; opacity: 0.7; }
  .hero-feels { font-size: 14px; color: var(--text2); text-align: right; margin-top: 8px; }
  .hero-icon { font-size: 72px; text-align: right; line-height: 1; }
  .hero-updated { font-size: 12px; color: var(--text3); margin-top: 20px; }

  /* Stats grid */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
  @media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    display: flex; flex-direction: column; gap: 8px;
    transition: border-color 0.2s, background 0.2s;
  }
  .stat-card:hover { background: var(--surface2); border-color: var(--border2); }
  .stat-icon { font-size: 20px; opacity: 0.8; }
  .stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }
  .stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 600; line-height: 1; }
  .stat-unit { font-size: 13px; color: var(--text2); font-weight: 400; }
  .stat-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 4px; overflow: hidden; }
  .stat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.8s ease; }

  /* Section title */
  .section-title { font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); margin-bottom: 14px; }

  /* Hourly scroll */
  .hourly-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px; overflow: hidden;
  }
  .hourly-scroll { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .hourly-scroll::-webkit-scrollbar { height: 3px; }
  .hourly-scroll::-webkit-scrollbar-track { background: transparent; }
  .hourly-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
  .hour-item {
    flex: 0 0 72px; text-align: center; padding: 14px 8px; border-radius: 10px;
    transition: background 0.15s; cursor: default;
  }
  .hour-item:hover { background: var(--surface2); }
  .hour-item.active { background: rgba(79,142,247,0.18); border: 1px solid rgba(79,142,247,0.3); }
  .hour-time { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
  .hour-icon { font-size: 20px; margin-bottom: 6px; }
  .hour-temp { font-size: 15px; font-weight: 600; }
  .hour-prec { font-size: 11px; color: var(--cool); margin-top: 4px; }

  /* 7-day forecast */
  .forecast-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 20px;
  }
  .forecast-row {
    display: grid; grid-template-columns: 110px 36px 1fr 80px 80px;
    align-items: center; gap: 12px; padding: 16px 20px;
    border-bottom: 1px solid var(--border); transition: background 0.15s;
  }
  .forecast-row:last-child { border-bottom: none; }
  .forecast-row:hover { background: var(--surface2); }
  .forecast-day { font-weight: 500; font-size: 14px; }
  .forecast-icon { font-size: 22px; }
  .temp-bar-wrap { display: flex; align-items: center; gap: 10px; }
  .temp-min, .temp-max { font-size: 13px; font-weight: 500; min-width: 30px; }
  .temp-min { color: var(--text3); text-align: right; }
  .temp-max { color: var(--text); }
  .temp-range { flex: 1; height: 5px; background: var(--border); border-radius: 3px; position: relative; overflow: visible; }
  .temp-range-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--cool), var(--warm)); position: absolute; }
  .forecast-prec { font-size: 13px; color: var(--cool); text-align: right; }
  .forecast-humid { font-size: 13px; color: var(--text2); text-align: right; }

  /* Sun arc */
  .sun-wrap {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px;
  }
  .sun-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
  }
  .sun-arc-svg { width: 100%; display: block; margin: 12px 0 8px; }
  .sun-row { display: flex; justify-content: space-between; align-items: center; }
  .sun-time-label { font-size: 13px; color: var(--text2); }
  .sun-time-val { font-size: 15px; font-weight: 600; }

  /* AQI + extra */
  .extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
  .extra-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
  }
  .extra-title { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; font-weight: 600; }
  .wind-compass { position: relative; width: 100px; height: 100px; margin: 0 auto 12px; }
  .wind-circle { width: 100%; height: 100%; border-radius: 50%; border: 1px solid var(--border2); position: relative; }
  .wind-arrow { position: absolute; top: 50%; left: 50%; width: 2px; height: 42px; background: var(--accent2); transform-origin: bottom center; border-radius: 1px; }
  .wind-dot { position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; transform: translate(-50%, -50%); }
  .compass-n, .compass-s, .compass-e, .compass-w { position: absolute; font-size: 11px; color: var(--text3); font-weight: 600; }
  .compass-n { top: 4px; left: 50%; transform: translateX(-50%); }
  .compass-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
  .compass-e { right: 4px; top: 50%; transform: translateY(-50%); }
  .compass-w { left: 4px; top: 50%; transform: translateY(-50%); }
  .wind-speed-big { text-align: center; font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 600; }
  .wind-speed-unit { font-size: 13px; color: var(--text2); }
  .wind-dir-label { text-align: center; font-size: 13px; color: var(--text2); margin-top: 4px; }

  /* Uv + vis */
  .uv-bar-wrap { margin-top: 8px; }
  .uv-bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #4ade80, #facc15, #f97316, #ef4444, #9333ea); position: relative; margin: 8px 0; }
  .uv-marker { position: absolute; top: -3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; border: 2px solid rgba(0,0,0,0.3); transform: translateX(-50%); transition: left 0.6s; }
  .uv-value-big { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 600; }
  .uv-label { font-size: 14px; margin-top: 2px; }

  /* Loading + error states */
  .state-box { text-align: center; padding: 80px 20px; }
  .state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
  .state-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
  .state-msg { font-size: 14px; color: var(--text2); max-width: 360px; margin: 0 auto 24px; }
  .spinner {
    width: 48px; height: 48px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 20px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Quick location pills */
  .quick-locations { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
  .quick-pill {
    padding: 8px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 50px; font-size: 13px; cursor: pointer; transition: all 0.15s;
    font-weight: 500;
  }
  .quick-pill:hover { background: var(--surface2); border-color: var(--accent); color: var(--accent2); }

  /* Unit toggle */
  .unit-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-left: auto; }
  .unit-btn { padding: 6px 14px; font-size: 13px; background: transparent; border: none; color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s; }
  .unit-btn.active { background: var(--accent); color: #fff; }

  .fade-in { animation: fadeIn 0.4s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

  /* Charts & Tabs */
  .tabs-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 20px;
  }
  .tabs-bar {
    display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
  }
  .tab-btn {
    flex: 1; min-width: 100px; padding: 12px 16px; background: transparent; border: none;
    color: var(--text2); cursor: pointer; font-size: 13px; font-weight: 500;
    border-right: 1px solid var(--border); transition: all 0.2s;
    font-family: 'DM Sans', sans-serif; position: relative; z-index: 10;
    pointer-events: auto; user-select: none;
  }
  .tab-btn:last-child { border-right: none; }
  .tab-btn:hover { background: rgba(79,142,247,0.1); color: var(--accent2); }
  .tab-btn:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
  .tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

  .tab-panel { 
    padding: 20px; 
    display: none; 
    animation: fadeIn 0.3s ease;
  }
  .tab-panel[style*="display: block"],
  .tab-panel.active { 
    display: block !important; 
  }

  .chart-wrap { position: relative; width: 100%; height: 280px; }
  .chart-wrap canvas { width: 100% !important; height: 280px !important; }

  @media (max-width: 600px) {
    .hero-card { grid-template-columns: 1fr; }
    .hero-temp { text-align: left; font-size: 72px; }
    .hero-icon { text-align: left; }
    .sun-wrap, .extra-grid { grid-template-columns: 1fr; }
    .forecast-row { grid-template-columns: 80px 28px 1fr 60px; }
    .forecast-humid { display: none; }
    .tabs-bar { flex-direction: column; }
    .tab-btn { border-right: none; border-bottom: 1px solid var(--border); }
    .tab-btn:last-child { border-bottom: none; }
  }

 .chart-container {
  width: 100%;
  height: 220px;
  position: relative; /* Add this to help Chart.js confine to the container */
 }