:root{
      --bg: #2a2d35;
      --card: rgba(255, 255, 255, 0.06);
      --card2: rgba(255, 255, 255, 0.09);
      --border: rgba(255, 255, 255, 0.12);
      --text: rgba(255,255,255,0.92);
      --muted: rgba(255,255,255,0.68);
      --muted2: rgba(255,255,255,0.55);
      --accent: rgba(255,255,255,0.18);
      --shadow: 0 10px 28px rgba(0,0,0,0.35);
    }

/* Wind open card tint — matches impact bar color */
.card.wind-tint-calm     { background: rgba(96,165,250,0.08) !important; }
.card.wind-tint-light    { background: rgba(100,200,200,0.08) !important; }
.card.wind-tint-moderate { background: rgba(253,224,71,0.08) !important; }
.card.wind-tint-strong   { background: rgba(255,140,60,0.10) !important; }
.card.wind-tint-severe   { background: rgba(239,68,68,0.10) !important; }

    /* ── iOS overscroll rubber-band fix ─────────────────────────
       Without this, bouncing past the top/bottom on iOS flashes
       white (light) or whatever the browser default is.
       html background anchors the overscroll color to our dark bg.
    ──────────────────────────────────────────────────────────── */
    html {
      background: #0b1220;
      overflow-x: clip;
    }
    body.theme-light ~ html,
    html:has(body.theme-light) {
      background: #f0f2f5;
    }

    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
      background: radial-gradient(1200px 600px at 20% -10%, rgba(84, 150, 255, 0.25), transparent 55%),
                  radial-gradient(900px 500px at 80% 0%, rgba(90, 255, 190, 0.12), transparent 55%),
                  var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: clip;
      /* Safe area insets for iOS notch / home indicator */
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }

    .container {
      max-width: 980px;
      margin: 0 auto;
      padding: 16px 14px 28px;
    }

    header {
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 16px 16px 10px;
      border: none;
      border-radius: 0;
      box-shadow: none;
      position: fixed;
      top: 0;
      padding-top: env(safe-area-inset-top, 0px);
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 980px;
      z-index: 100;
      background: rgba(30,30,30,0.72);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      border-bottom: 0.5px solid rgba(255,255,255,0.16);
    }

    header h1 {
      margin: 0;
      font-size: 1.25rem;
      letter-spacing: 0.2px;
      font-weight: 900;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .version-pill{
      font-size: 0.78rem;
      font-weight: 800;
      color: rgba(255,255,255,0.78);
      border: 1px solid rgba(255,255,255,0.18);
      padding: 6px 10px;
      border-radius: 999px;
      background: rgba(255,255,255,0.06);
      white-space: nowrap;
    }

    .meta-row{
      display: flex;
      flex-wrap: wrap;
      gap: 10px 14px;
      align-items: center;
      color: var(--muted);
      font-size: 0.92rem;
    }

    .meta-item{
      display: inline-flex;
      gap: 8px;
      align-items: center;
      white-space: nowrap;
    }

    .meta-label{
      color: rgba(255,255,255,0.55);
      font-weight: 800;
      letter-spacing: 0.2px;
    }

    .meta-value{
      color: rgba(255,255,255,0.86);
      font-weight: 800;
    }

    .source-row{
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 4px;
    }

    .source-pill{
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.14);
      background: rgba(255,255,255,0.05);
      font-size: 0.82rem;
      font-weight: 800;
      color: rgba(255,255,255,0.86);
    }
    .source-pill .small{
      font-weight: 800;
      color: rgba(255,255,255,0.65);
    }



    /* Tab swipe slide animations */
    @keyframes slideInFromRight {
      from { transform: translateX(60px); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }
    @keyframes slideInFromLeft {
      from { transform: translateX(-60px); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }
    .slide-in-right { animation: slideInFromRight 0.35s ease-out; }
    .slide-in-left { animation: slideInFromLeft 0.35s ease-out; }

    .grid {
      margin-top: 14px;
      display: grid;
      grid-template-columns: repeat(12, 1fr);
      gap: 12px;
      grid-auto-rows: 192px;
    }

    .card{
      grid-column: span 6;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 14px 14px 12px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(8px);
      position: relative;
      transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease-out;
    }

    /* Collapsed tile: show pointer + subtle lift to indicate interactivity */
    .card:not(.card-expanded):has(.card-collapsed-preview:not([style*="display:none"])) {
      cursor: pointer;
    }
    .card:not(.card-expanded):has(.card-collapsed-preview:not([style*="display:none"])):hover {
      transform: translateY(-2px);
      border-color: rgba(255,255,255,0.18);
      box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    }
    body.theme-light .card:not(.card-expanded):has(.card-collapsed-preview:not([style*="display:none"])):hover {
      border-color: rgba(0,0,0,0.18);
      box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    }

    .card.col-12{ grid-column: span 12; }
    .card.col-6{ grid-column: span 6; overflow: hidden; }

    /* Temperature-based tile backgrounds - only when collapsed */
    .tile-temp-cold {
      background: linear-gradient(135deg, rgba(147,197,253,0.12) 0%, rgba(59,130,246,0.06) 100%) !important;
    }
    .tile-temp-cool {
      background: linear-gradient(135deg, rgba(96,165,250,0.15) 0%, rgba(59,130,246,0.08) 100%) !important;
    }
    .tile-temp-mild {
      background: linear-gradient(135deg, rgba(253,224,71,0.12) 0%, rgba(234,179,8,0.06) 100%) !important;
    }
    .tile-temp-warm {
      background: linear-gradient(135deg, rgba(255,140,60,0.18) 0%, rgba(255,100,30,0.10) 100%) !important;
    }
    .tile-temp-hot {
      background: linear-gradient(135deg, rgba(251,146,60,0.15) 0%, rgba(249,115,22,0.08) 100%) !important;
    }

    /* Weather condition backgrounds for Sky & Precip - only when collapsed */
    .weather-clear-day {
      background: linear-gradient(135deg, rgba(135,206,250,0.5) 0%, rgba(255,223,186,0.4) 100%) !important;
    }
    .weather-clear-night {
      background: linear-gradient(135deg, rgba(25,25,112,0.5) 0%, rgba(72,61,139,0.4) 100%) !important;
    }
    .weather-partly-day {
      background: linear-gradient(135deg, rgba(176,196,222,0.4) 0%, rgba(230,230,250,0.4) 100%) !important;
    }
    .weather-partly-night {
      background: linear-gradient(135deg, rgba(47,79,79,0.4) 0%, rgba(105,105,105,0.4) 100%) !important;
    }
    .weather-cloudy-day {
      background: linear-gradient(135deg, rgba(169,169,169,0.35) 0%, rgba(192,192,192,0.35) 100%) !important;
    }
    .weather-cloudy-night {
      background: linear-gradient(135deg, rgba(105,105,105,0.4) 0%, rgba(119,136,153,0.4) 100%) !important;
    }
    .weather-rain-day {
      background: linear-gradient(135deg, rgba(119,136,153,0.4) 0%, rgba(176,196,222,0.35) 100%) !important;
    }
    .weather-rain-night {
      background: linear-gradient(135deg, rgba(47,79,79,0.5) 0%, rgba(70,130,180,0.4) 100%) !important;
    }
    .weather-snow-day {
      background: linear-gradient(135deg, rgba(230,240,255,0.5) 0%, rgba(200,220,240,0.45) 100%) !important;
    }
    .weather-snow-night {
      background: linear-gradient(135deg, rgba(70,90,120,0.5) 0%, rgba(100,120,150,0.45) 100%) !important;
    }
    .weather-mist-day {
      background: linear-gradient(135deg, rgba(220,220,220,0.4) 0%, rgba(240,240,240,0.35) 100%) !important;
    }
    .weather-mist-night {
      background: linear-gradient(135deg, rgba(105,105,105,0.4) 0%, rgba(128,128,128,0.35) 100%) !important;
    }

    /* ========== HYPERLOCAL & ALMANAC TILE BACKGROUNDS ========== */
    
    /* Fog Risk - white fog overlay that increases with risk level */
    .tile-fog-low {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.06) 0%, transparent 50%),
        rgba(240,240,245,0.05) !important;
    }
    .tile-fog-moderate {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.25) 0%, transparent 65%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.20) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 20%, rgba(255,255,255,0.15) 0%, transparent 55%),
        rgba(240,240,245,0.12) !important;
    }
    .tile-fog-high {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.45) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.40) 0%, transparent 65%),
        radial-gradient(ellipse at 50% 20%, rgba(255,255,255,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(255,255,255,0.30) 0%, transparent 55%),
        rgba(240,240,245,0.25) !important;
    }
    .tile-fog-low {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.06) 0%, transparent 50%),
        rgba(240,240,245,0.05) !important;
    }
    .tile-fog-moderate {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.25) 0%, transparent 65%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.20) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 20%, rgba(255,255,255,0.15) 0%, transparent 55%),
        rgba(240,240,245,0.12) !important;
    }
    .tile-fog-high {
      background: 
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.45) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 60%, rgba(255,255,255,0.40) 0%, transparent 65%),
        radial-gradient(ellipse at 50% 20%, rgba(255,255,255,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(255,255,255,0.30) 0%, transparent 55%),
        rgba(240,240,245,0.25) !important;
    }

    /* Wind Impact - green (calm) to red (severe) */
    .tile-wind-calm {
      background: linear-gradient(135deg, rgba(96,165,250,0.15) 0%, rgba(59,130,246,0.08) 100%) !important;
    }
    .tile-wind-light {
      background: linear-gradient(135deg, rgba(100,200,200,0.15) 0%, rgba(80,180,180,0.08) 100%) !important;
    }
    .tile-wind-moderate {
      background: linear-gradient(135deg, rgba(253,224,71,0.12) 0%, rgba(234,179,8,0.06) 100%) !important;
    }
    .tile-wind-strong {
      background: linear-gradient(135deg, rgba(255,140,60,0.18) 0%, rgba(255,100,30,0.10) 100%) !important;
    }
    .tile-wind-severe {
      background: linear-gradient(135deg, rgba(239,68,68,0.15) 0%, rgba(220,38,38,0.08) 100%) !important;
    }

    /* Corrections - confidence-based */
    .tile-corrections-high {
      background: linear-gradient(135deg, rgba(134,239,172,0.08) 0%, rgba(34,197,94,0.04) 100%) !important;
    }
    .tile-corrections-moderate {
      background: linear-gradient(135deg, rgba(253,224,71,0.08) 0%, rgba(234,179,8,0.04) 100%) !important;
    }
    .tile-corrections-low {
      background: linear-gradient(135deg, rgba(248,113,113,0.08) 0%, rgba(239,68,68,0.04) 100%) !important;
    }

    /* Sea Breeze - ocean teal/blue */
    .tile-seabreeze-unlikely {
      background: linear-gradient(135deg, rgba(140,160,180,0.12) 0%, rgba(120,140,160,0.08) 100%) !important;
    }
    .tile-seabreeze-possible {
      background: linear-gradient(135deg, rgba(120,190,200,0.15) 0%, rgba(100,170,180,0.10) 100%) !important;
    }
    .tile-seabreeze-likely {
      background: linear-gradient(135deg, rgba(80,220,230,0.22) 0%, rgba(60,200,210,0.15) 100%) !important;
    }

    /* Sunset Score - subtle warm gradient based on quality */
    .tile-sunset-poor {
      background: linear-gradient(135deg, rgba(128,128,128,0.12) 0%, rgba(140,140,150,0.08) 100%) !important;
    }
    .tile-sunset-fair {
      background: linear-gradient(135deg, rgba(200,180,140,0.15) 0%, rgba(180,160,120,0.10) 100%) !important;
    }
    .tile-sunset-good {
      background: linear-gradient(135deg, rgba(255,140,60,0.18) 0%, rgba(255,100,30,0.10) 100%) !important;
    }
    .tile-sunset-verygood {
      background: linear-gradient(135deg, rgba(255,140,60,0.22) 0%, rgba(249,115,22,0.14) 100%) !important;
    }
    .tile-sunset-spectacular {
      background: linear-gradient(135deg, rgba(255,100,50,0.30) 0%, rgba(255,70,30,0.20) 100%) !important;
    }

    /* Dock Day - score-based like Wind Impact */
    .tile-dock-great {
      background: linear-gradient(135deg, rgba(96,165,250,0.15) 0%, rgba(59,130,246,0.08) 100%) !important;
    }
    .tile-dock-good {
      background: linear-gradient(135deg, rgba(100,200,200,0.15) 0%, rgba(80,180,180,0.08) 100%) !important;
    }
    .tile-dock-marginal {
      background: linear-gradient(135deg, rgba(253,224,71,0.12) 0%, rgba(234,179,8,0.06) 100%) !important;
    }
    .tile-dock-poor {
      background: linear-gradient(135deg, rgba(251,146,60,0.18) 0%, rgba(249,115,22,0.10) 100%) !important;
      background: linear-gradient(135deg, rgba(255,140,60,0.18) 0%, rgba(255,100,30,0.10) 100%) !important;
    }
    .tile-dock-stayinside {
      background: linear-gradient(135deg, rgba(239,68,68,0.15) 0%, rgba(220,38,38,0.08) 100%) !important;
    }

    /* Astronomical tiles - subtle dark space gradient */
    /* Current tide text inside water */
    /* 0 ft tide reference line - darker in light mode */
    body.theme-light .card-collapsed-preview > div[style*="rgba(210,180,140"] {
      background: rgba(160,140,100,0.6) !important;
    }

    body.theme-light .current-tide-text {
      color: rgba(0,0,0,0.6) !important;
    }

    .tile-astro {
      background: linear-gradient(180deg, rgba(30,41,59,0.15) 0%, rgba(15,23,42,0.08) 100%) !important;
    }


    /* ========== TILE PREVIEW STYLING ========== */
    
    /* Tile title (upper-left corner label) */
    .tile-label {
      position: absolute;
      top: 0;
      left: 0;
      font-size: 11px;
      font-weight: 600;
      color: rgba(255,255,255,0.4);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      z-index: 10;
    }
    body.theme-light .tile-label {
      color: rgba(0,0,0,0.4);
    }
    
    /* Right Now tile specific */
    .tile-temp-main {
      font-size: 68px;
      font-weight: 300;
      line-height: 0.9;
      color: rgba(255,255,255,0.95);
    }
    body.theme-light .tile-temp-main {
      color: rgba(0,0,0,0.95);
    }
    
    .tile-temp-degree {
      font-size: 34px;
      font-weight: 400;
      color: rgba(255,255,255,0.4);
    }
    body.theme-light .tile-temp-degree {
      color: rgba(0,0,0,0.4);
    }
    
    .tile-feels-like {
      font-size: 15px;
      color: rgba(255,255,255,0.5);
      font-weight: 400;
      margin-top: 8px;
    }
    body.theme-light .tile-feels-like {
      color: rgba(0,0,0,0.5);
    }
    
    /* Thermometer SVG */
    .thermometer-tube {
      fill: rgba(255,255,255,0.95);
      stroke: rgba(255,255,255,0.25);
      stroke-width: 1.5;
    }
    body.theme-light .thermometer-tube {
      fill: rgba(255,255,255,0.95);
      stroke: rgba(0,0,0,0.25);
    }
    
    .thermometer-bulb {
      fill: rgba(220,38,38,1);
      stroke: rgba(255,255,255,0.25);
      stroke-width: 1.5;
    }
    body.theme-light .thermometer-bulb {
      stroke: rgba(0,0,0,0.25);
    }
    
    .thermometer-mercury {
      fill: rgba(220,38,38,0.9);
    }
    
    .thermometer-marks {
      stroke: rgba(255,255,255,0.3);
      stroke-width: 1.5;
    }
    body.theme-light .thermometer-marks {
      stroke: rgba(0,0,0,0.3);
    }
    
    /* Sky & Precip tile */
    .tile-sky-condition {
      font-size: 28px;
      font-weight: 500;
      color: rgba(255,255,255,0.95);
      margin-bottom: 8px;
    }
    body.theme-light .tile-sky-condition {
      color: rgba(0,0,0,0.95);
    }
    
    .tile-sky-stats {
      font-size: 15px;
      color: rgba(255,255,255,0.5);
    }
    body.theme-light .tile-sky-stats {
      color: rgba(0,0,0,0.5);
    }
    
    /* Wind tile */
    /* Wind tile — split layout */
    [data-collapse-key="48h_wind"] .card-collapsed-preview {
      height: 100%;
    }

    .wind-tile-body {
      position: absolute;
      top: 26px;
      left: 0;
      right: 0;
      bottom: 32px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      gap: 14px;
    }

    .wind-compass-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      flex-shrink: 0;
    }

    .wind-compass-svg {
      width: 84px;
      height: 84px;
    }

    .wind-dir-label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.06em;
      color: rgba(255,255,255,0.50);
    }
    body.theme-light .wind-dir-label {
      color: rgba(0,0,0,0.50);
    }

    .wind-speed-col {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      gap: 5px;
    }

    .wind-speed-row {
      display: flex;
      align-items: baseline;
      gap: 3px;
      line-height: 1;
    }

    .wind-speed-num {
      font-size: 46px;
      font-weight: 300;
      color: rgba(255,255,255,0.95);
      line-height: 1;
    }
    body.theme-light .wind-speed-num {
      color: rgba(0,0,0,0.90);
    }

    .wind-speed-unit {
      font-size: 13px;
      font-weight: 400;
      color: rgba(255,255,255,0.38);
      margin-bottom: 3px;
    }
    body.theme-light .wind-speed-unit {
      color: rgba(0,0,0,0.38);
    }

    .wind-stat-grid {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .wind-stat-row {
      display: flex;
      align-items: baseline;
      gap: 5px;
    }

    .wind-stat-key {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      color: rgba(255,255,255,0.28);
      width: 34px;
      flex-shrink: 0;
      white-space: nowrap;
    }
    body.theme-light .wind-stat-key {
      color: rgba(0,0,0,0.30);
    }

    .wind-stat-val {
      font-size: 13px;
      font-weight: 400;
      color: rgba(255,255,255,0.62);
    }
    body.theme-light .wind-stat-val {
      color: rgba(0,0,0,0.62);
    }

    .wind-stat-unit {
      font-size: 10px;
      color: rgba(255,255,255,0.28);
    }
    body.theme-light .wind-stat-unit {
      color: rgba(0,0,0,0.28);
    }
    
    /* Wind impact bar */
    .tile-wind-impact {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(59,130,246,0.15);
      border-radius: 6px;
      padding: 7px 10px;
      font-size: 0.8rem;
      font-weight: 500;
      text-align: center;
      color: rgba(255,255,255,0.8);
      white-space: nowrap;
      transition: background 0.3s ease;
    }
    body.theme-light .tile-wind-impact {
      color: rgba(0,0,0,0.8);
    }
    .tile-wind-impact.wind-bar-calm     { background: rgba(96,165,250,0.25); }
    .tile-wind-impact.wind-bar-light    { background: rgba(100,200,200,0.25); }
    .tile-wind-impact.wind-bar-moderate { background: rgba(253,224,71,0.28); }
    .tile-wind-impact.wind-bar-strong   { background: rgba(255,140,60,0.30); }
    .tile-wind-impact.wind-bar-severe   { background: rgba(239,68,68,0.30); }


    
    /* 10-Day tile */
    .tile-temp-high {
      font-size: 44px;
      font-weight: 300;
      color: rgba(255,255,255,0.95);
      line-height: 1;
    }
    body.theme-light .tile-temp-high {
      color: rgba(0,0,0,0.95);
    }
    
    .tile-temp-separator {
      font-size: 24px;
      font-weight: 300;
      color: rgba(255,255,255,0.4);
      line-height: 1;
    }
    body.theme-light .tile-temp-separator {
      color: rgba(0,0,0,0.4);
    }
    
    .tile-temp-low {
      font-size: 44px;
      font-weight: 300;
      color: rgba(255,255,255,0.5);
      line-height: 1;
    }
    body.theme-light .tile-temp-low {
      color: rgba(0,0,0,0.5);
    }
    
    .tile-temp-label {
      font-size: 15px;
      color: rgba(255,255,255,0.5);
      font-weight: 400;
      margin-top: 6px;
    }
    body.theme-light .tile-temp-label {
      color: rgba(0,0,0,0.5);
    }
    
    /* Detailed Forecast tile */
    .tile-forecast-summary {
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 4;
      -webkit-box-orient: vertical;
      font-size: 20px;
      font-weight: 400;
      color: rgba(255,255,255,0.75);
      line-height: 1.3;
    }
    body.theme-light .tile-forecast-summary {
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 4;
      -webkit-box-orient: vertical;
      color: rgba(0,0,0,0.75);
    }

    .card-title-collapsible{
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .card-title-collapsible:hover{ color: rgba(255,255,255,1); }
    .collapse-chevron{
      font-size: 0.75rem;
      color: rgba(255,255,255,0.4);
      font-weight: 700;
      margin-left: 8px;
      transition: transform 0.2s;
    }
    .card-title{
      font-weight: 900;
      color: rgba(255,255,255,0.88);
      font-size: 0.95rem;
      letter-spacing: 0.2px;
      margin-bottom: 10px;
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: baseline;
    }

    .small-note{
      color: rgba(255,255,255,0.6);
      font-size: 0.85rem;
      line-height: 1.2rem;
      margin-top: 8px;
    }

    .current-temp{
      position: relative;
      font-size: 3rem;
      font-weight: 1000;
      letter-spacing: -1px;
      margin-top: 8px;
    }

    .temp-unit{
      font-size: 1.25rem;
      font-weight: 900;
      color: rgba(255,255,255,0.7);
      margin-left: 6px;
    }

    .feels-like{
      position: relative;
      margin-top: 2px;
      font-size: 1rem;
      color: rgba(255,255,255,0.76);
      font-weight: 800;
    }

    .condition{
      position: relative;
      margin-top: 10px;
      font-size: 1.05rem;
      font-weight: 900;
      color: rgba(255,255,255,0.86);
    }

    .row{
      display: flex;
      justify-content: space-between;
      gap: 10px;
      padding: 7px 0;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      font-size: 0.95rem;
    }

    .row-category-header {
      font-size: 0.65rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      opacity: 0.4;
      padding: 10px 0 4px;
      margin-top: 4px;
    }
    .row-category-header:first-child {
      padding-top: 0;
      margin-top: 0;
    }
    body.theme-light .row-category-header {
      opacity: 0.35;
    }
    .row:last-child{ border-bottom: none; }

    .label{
      color: rgba(255,255,255,0.62);
      font-weight: 800;
      min-width: 45%;
    }
    /* Wind window pill buttons */
    .wind-window-pills { display:flex; gap:4px; }
    .wpill {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.15);
      color: rgba(255,255,255,0.5);
      border-radius: 999px;
      padding: 3px 10px;
      font-size: 0.75rem;
      font-weight: 800;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .wpill:hover { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.8); }
    .wpill.active { background: rgba(100,160,255,0.25); border-color: rgba(100,160,255,0.5); color: rgba(160,200,255,0.95); }
    /* Pure-CSS hover tooltips — add data-tip="..." to any element */
    .value{
      color: rgba(255,255,255,0.9);
      font-weight: 900;
      text-align: right;
      flex: 1;
      min-width: 0; /* Allow flex item to shrink below content size */
    }

    .pressure-alarm{
      border-radius: 14px;
      padding: 10px 16px;
      margin: 8px 0 4px 0;
      font-weight: 800;
      font-size: 0.92rem;
      text-align: center;
      display: none;
    }
    .pressure-alarm.falling{
      background: rgba(255,80,80,0.18);
      border: 1px solid rgba(255,80,80,0.4);
      color: rgba(255,180,180,0.95);
    }
    .pressure-alarm.rising{
      background: rgba(80,200,120,0.15);
      border: 1px solid rgba(80,200,120,0.35);
      color: rgba(150,240,180,0.95);
    }
    .alert-banner{
      background: rgba(255, 80, 80, 0.18);
      border: 1px solid rgba(255, 80, 80, 0.30);
      border-radius: 16px;
      padding: 12px 14px;
      margin-top: 12px;
      box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    }
    .alert-title{ font-weight: 1000; }
    .alert-desc{ color: rgba(255,255,255,0.78); margin-top: 4px; }

    .tide-grid{
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-top: 8px;
    }
    .tide-item{
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 14px;
      padding: 10px 10px;
      background: rgba(255,255,255,0.05);
    }
    .tide-item .tide-type{
      font-weight: 1000;
      color: rgba(255,255,255,0.85);
      margin-bottom: 2px;
    }
    .tide-item .tide-time{
      font-weight: 900;
      color: rgba(255,255,255,0.78);
    }
    .tide-item .tide-height{
      font-weight: 900;
      color: rgba(255,255,255,0.72);
      font-size: 0.9rem;
    }

    canvas:not(.moon-canvas){
      touch-action: pan-y;
      width: 100% !important;
      height: 220px !important;
    }


    /* ===== iOS-style Header ===== */
    .header-title {
      font-size: 1.65rem;
      font-weight: 800;
      letter-spacing: -0.3px;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .header-icon-btn {
      position: relative;
      background: none;
      border: none;
      color: var(--muted);
      font-size: 1.2rem;
      padding: 8px;
      cursor: pointer;
      border-radius: 50%;
      transition: background 0.15s;
      -webkit-tap-highlight-color: transparent;
      line-height: 1;
    }
    .header-icon-btn:active {
      background: rgba(128,128,128,0.15);
    }

    /* Alert badge */
    .alert-badge {
      position: relative;
    }
    .alert-badge-dot {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 8px;
      height: 8px;
      background: #ff3b30;
      border-radius: 50%;
      animation: alert-pulse 2s ease-in-out infinite;
    }
    .alert-badge-icon {
      font-size: 1.1rem;
    }
    @keyframes alert-pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    .precip-badge {
      position: relative;
    }
    .precip-badge-dot {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 8px;
      height: 8px;
      background: #3b9eff;
      border-radius: 50%;
      animation: alert-pulse 2s ease-in-out infinite;
    }

    /* ===== Modal Sheet ===== */
    .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 200;
      background: rgba(0,0,0,0.5);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      animation: modal-fade-in 0.2s ease;
    }
    @keyframes modal-fade-in {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    .modal-sheet {
      width: 100%;
      max-width: 980px;
      max-height: 85vh;
      background: var(--card-bg, #1c1c1e);
      border-radius: 14px 14px 0 0;
      overflow-y: auto;
      animation: modal-slide-up 0.3s ease;
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    @keyframes modal-slide-up {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }

    .modal-handle {
      width: 36px;
      height: 5px;
      background: rgba(128,128,128,0.4);
      border-radius: 3px;
      margin: 8px auto 4px;
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 20px 8px;
    }
    .modal-header h2 {
      font-size: 1.15rem;
      font-weight: 800;
      margin: 0;
      color: var(--text, rgba(255,255,255,0.92));
    }
    .modal-close {
      background: rgba(128,128,128,0.2);
      border: none;
      color: var(--muted, rgba(255,255,255,0.55));
      font-size: 0.9rem;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      -webkit-tap-highlight-color: transparent;
    }

    .modal-body {
      padding: 8px 20px 24px;
    }

    .modal-setting-group {
      margin-bottom: 16px;
    }
    .modal-setting-label {
      font-size: 0.82rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--muted, rgba(255,255,255,0.55));
      margin-bottom: 8px;
    }
    .modal-setting-options {
      display: flex;
      gap: 8px;
    }

    /* Light theme modal */
    body.theme-light .modal-sheet {
      background: #f2f2f7;
    }
    body.theme-light .modal-header h2 {
      color: rgba(0,0,0,0.88);
    }
    body.theme-light .modal-close {
      background: rgba(0,0,0,0.08);
      color: rgba(0,0,0,0.5);
    }
    body.theme-light .modal-setting-label {
      color: rgba(0,0,0,0.45);
    }

    /* Alert in modal */
    .alert-modal-item {
      background: rgba(180,60,60,0.12);
      border: 1px solid rgba(255,120,120,0.2);
      border-radius: 12px;
      padding: 14px 16px;
      margin-bottom: 10px;
    }
    .alert-modal-title {
      font-weight: 800;
      font-size: 0.95rem;
      color: rgba(255,200,200,0.95);
      margin-bottom: 8px;
    }
    .alert-modal-desc {
      font-size: 0.85rem;
      line-height: 1.6;
      color: var(--muted);
    }
    body.theme-light .alert-modal-item {
      background: rgba(180,60,60,0.08);
      border-color: rgba(180,60,60,0.15);
    }
    body.theme-light .alert-modal-title {
      color: rgba(180,40,40,0.9);
    }

    /* ===== iOS Bottom Tab Bar ===== */
    .bottom-tab-bar {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 980px;
      z-index: 100;
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
      background: rgba(30,30,30,0.72);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      border-top: 0.5px solid rgba(255,255,255,0.16);
    }

    .bottom-tab {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      padding: 4px 16px;
      border: none;
      background: none;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: opacity 0.15s;
    }

    .bottom-tab .tab-icon {
      display: block;
      line-height: 1;
      color: rgba(255,255,255,0.45);
      transition: color 0.15s;
    }

    .bottom-tab .tab-icon svg {
      width: 24px;
      height: 24px;
      display: block;
    }

    .bottom-tab .tab-icon .icon-filled { display: none; }
    .bottom-tab.active .tab-icon .icon-outline { display: none; }
    .bottom-tab.active .tab-icon .icon-filled { display: block; }

    .bottom-tab .tab-label {
      font-size: 0.62rem;
      font-weight: 600;
      letter-spacing: 0.2px;
      color: rgba(255,255,255,0.45);
      transition: color 0.15s;
    }

    .bottom-tab.active .tab-icon {
      color: #0a84ff;
    }

    .bottom-tab.active .tab-label {
      color: #0a84ff;
      font-weight: 700;
    }

    /* Light theme bottom bar */
    body.theme-light .bottom-tab-bar {
      background: rgba(249,249,249,0.72);
      border-top-color: rgba(0,0,0,0.12);
    }
    body.theme-light .bottom-tab .tab-icon {
      color: rgba(0,0,0,0.40);
    }
    body.theme-light .bottom-tab .tab-label {
      color: rgba(0,0,0,0.45);
    }
    body.theme-light .bottom-tab.active .tab-icon {
      color: #007aff;
    }
    body.theme-light .bottom-tab.active .tab-label {
      color: #007aff;
    }

    /* Add bottom padding to container so content isn't hidden behind tab bar */
    .container {
      padding-bottom: 80px !important;
    }



    @media (max-width: 780px){
      .card{ grid-column: span 12; }
      canvas:not(.moon-canvas){ height: 240px !important; }
      header{ position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 100%; }

      /* 3-column grids → single column */
      .mobile-3col {
        grid-template-columns: 1fr !important;
      }
      .mobile-3col > div {
        padding: 0 0 10px 0 !important;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.06) !important;
        margin-bottom: 4px !important;
      }
      .mobile-3col > div:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
      }

      /* Sources table — hide description column on narrow screens */
      .sources-col-desc { display: none !important; }

      /* Radar map — don't eat the whole screen */
      #radarMap { height: 52vh !important; min-height: 260px; }

      /* Wind pills — never wrap */
      .wind-window-pills { flex-wrap: nowrap !important; }
    }

    /* =============================================
       MOBILE LAYOUT FIXES (max-width: 480px)
       ============================================= */
    @media (max-width: 480px) {

      /* Header meta row — smaller text */
      .meta-row { font-size: 0.78rem; gap: 6px 10px; }

      /* Radar map — responsive height */
      #radarMap { height: min(65vw, 380px) !important; }

      /* 3-column grids collapse to 1 column stacked */
      .mobile-3col { grid-template-columns: 1fr !important; }
      .mobile-3col > div {
        padding: 0 0 12px 0 !important;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.07) !important;
      }
      .mobile-3col > div:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
      }

      /* Dock day + sunset quality — horizontal scroll */
      .dock-day-grid, .scroll-day-grid {
        display: flex !important;
        overflow-x: auto !important;
        gap: 10px !important;
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .dock-day-grid::-webkit-scrollbar,
      .scroll-day-grid::-webkit-scrollbar { display: none; }
      .dock-day-grid > div, .scroll-day-grid > div { min-width: 140px !important; flex-shrink: 0 !important; }

      /* Solar system — 3 columns on mobile instead of 5 */
      .solar-grid { grid-template-columns: repeat(3, 1fr) !important; }

      /* Wind window pills — smaller */
      .wpill { padding: 2px 8px; font-size: 0.7rem; }

      /* NWS hourly grid — 2 per row on mobile */
      .nws-hourly-row { grid-template-columns: repeat(2, 1fr) !important; }
    }
    /* --- iOS Chart Fix --- */
    canvas {
    display: block;  
    }

    #windChart {
    width: 100% !important;
    height: 220px !important;
    }

    /* Make 48-hour charts less “stretched” on wide screens */
  @media (min-width: 900px) {
  #tempPrecipChart, #windChart {
    height: 420px !important;
  }
}

/* Also helps iPhone landscape / tablet landscape */
@media (orientation: landscape) and (max-width: 900px) {
  #tempPrecipChart, #windChart {
    height: 260px !important;
  }
}
  /* --- Wind Risk tiles --- */
.risk-tiles{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 12px 0 14px 0;
}

@media (max-width: 780px){
  .risk-tiles{
    grid-template-columns: repeat(2, 1fr);
  }
}

.risk-tile{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 12px 12px 10px 12px;
}

.risk-tile .kicker{
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 6px;
}

.risk-tile .big{
  font-size: 22px;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 4px;
}

.risk-tile .sub{
  font-size: 15px;
  opacity: 0.7;
}

/* Risk badge colors */
.badge{
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 6px;
  border: 1px solid rgba(255,255,255,0.15);
}

.badge.calm         { background: rgba(160,160,160,0.18); }
.badge.breezy       { background: rgba(100,180,255,0.22); }
.badge.notable      { background: rgba(255,170,0,0.22); }
.badge.significant  { background: rgba(255,80,80,0.25); }
.badge.severe       { background: rgba(200,60,255,0.30); }
  
    /* Radar tab */
    .radar-btn {
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.15);
      color: rgba(255,255,255,0.6);
      border-radius: 999px;
      padding: 4px 12px;
      font-size: 0.78rem;
      font-weight: 900;
      cursor: pointer;
      transition: all 0.15s;
    }
    .radar-btn:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9); }
    .radar-btn-active {
      background: rgba(100,180,255,0.18) !important;
      border-color: rgba(100,180,255,0.5) !important;
      color: rgba(140,210,255,0.95) !important;
    }
    /* =============================================
       SETTINGS BUTTON
       ============================================= */
    .setting-btn {
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.15);
      color: rgba(255,255,255,0.65);
      border-radius: 999px;
      padding: 4px 12px;
      font-size: 0.78rem;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .setting-btn:hover { background: rgba(255,255,255,0.12); }
    .setting-btn.active {
      background: rgba(100,180,255,0.2);
      border-color: rgba(100,180,255,0.5);
      color: rgba(160,210,255,0.95);
    }

    /* =============================================
       LIGHT MODE
       ============================================= */
    body.theme-light {
      --bg:     #f0f2f6;
      --card:   rgba(255,255,255,0.9);
      --border: rgba(0,0,0,0.10);
      --text:   #0d1117;
      --muted:  rgba(0,0,0,0.55);
      --shadow: 0 2px 12px rgba(0,0,0,0.10);
    }
    body.theme-light {
      background: radial-gradient(1200px 600px at 20% -10%, rgba(100,160,255,0.10), transparent 55%),
                  radial-gradient(900px 500px at 80% 0%, rgba(60,200,140,0.06), transparent 55%),
                  #f0f2f6;
    }
    body.theme-light header {
      background: rgba(249,249,249,0.72);
      border-bottom-color: rgba(0,0,0,0.12);
    }
    body.theme-light .card {
      background: #ffffff;
      border-color: rgba(0,0,0,0.08);
    }
    body.theme-light .card-title {
      color: rgba(0,0,0,0.85);
      border-bottom-color: rgba(0,0,0,0.07);
    }
    body.theme-light .label { color: rgba(0,0,0,0.52); }
    body.theme-light .value { color: rgba(0,0,0,0.88); }
    body.theme-light .row   { border-bottom-color: rgba(0,0,0,0.06); }
    body.theme-light .small-note { color: rgba(0,0,0,0.4); }

    /* Force all text inside cards to be dark in light mode */
    body.theme-light .card-body { color: rgba(0,0,0,0.85); }
    body.theme-light .card-body div,
    body.theme-light .card-body span,
    body.theme-light .card-body p  { color: inherit; }

    /* NWS forecast rows — JS renders inline white colors, override them */
    body.theme-light #nwsForecastList div,
    body.theme-light #nwsForecastList span { color: rgba(0,0,0,0.80) !important; }
    body.theme-light #nwsForecastList [style*="border-bottom"] {
      border-bottom-color: rgba(0,0,0,0.07) !important;
    }

    /* 10-day forecast rows */
    body.theme-light #forecastList .forecast-day-row { color: rgba(0,0,0,0.80) !important; }
    body.theme-light #forecastList .forecast-day-row span { color: inherit !important; }
    body.theme-light #forecastList .forecast-day-row .value { color: rgba(0,0,0,0.88) !important; }
    /* Keep precip % blue-ish but dark enough */
    body.theme-light #forecastList [style*="140,180,255"] { color: rgba(30,100,200,0.85) !important; }
    body.theme-light #forecastSelectionHint { color: rgba(0,0,0,0.35) !important; }

    /* Sources rows */
    body.theme-light #sourcesTable div,
    body.theme-light #sourcesTable span { color: rgba(0,0,0,0.75) !important; }

    /* Solar system, dock day, sunset quality — JS-rendered */
    body.theme-light #solarSystemGrid div,
    body.theme-light #solarSystemGrid span { color: rgba(0,0,0,0.80) !important; }
    body.theme-light #dockDayContainer div,
    body.theme-light #dockDayContainer span { color: rgba(0,0,0,0.80) !important; }
    body.theme-light #sunsetQualityGrid div,
    body.theme-light #sunsetQualityGrid span { color: rgba(0,0,0,0.80) !important; }

    body.theme-light #tempPrecipChart,
    body.theme-light #windChart {
      background: rgba(0,0,0,0.02);
      border-radius: 8px;
    }

    /* Wind pills */
    body.theme-light .wpill {
      background: rgba(0,0,0,0.07);
      border-color: rgba(0,0,0,0.15);
      color: rgba(0,0,0,0.65);
    }
    body.theme-light .wpill.active {
      background: rgba(30,100,255,0.12);
      border-color: rgba(30,100,255,0.4);
      color: rgba(20,80,200,0.95);
    }

    /* Radar buttons */
    body.theme-light .radar-btn {
      background: rgba(0,0,0,0.07);
      border-color: rgba(0,0,0,0.15);
      color: rgba(0,0,0,0.65);
    }
    body.theme-light .radar-btn-active {
      background: rgba(30,100,255,0.12) !important;
      border-color: rgba(30,100,255,0.4) !important;
      color: rgba(20,80,200,0.95) !important;
    }

    /* Misc pills + badges */
    body.theme-light .version-pill {
      color: rgba(0,0,0,0.6);
      border-color: rgba(0,0,0,0.15);
      background: rgba(0,0,0,0.05);
    }
    body.theme-light .meta-label { color: rgba(0,0,0,0.45); }
    body.theme-light .meta-value { color: rgba(0,0,0,0.85); }
    body.theme-light .source-pill {
      background: rgba(0,0,0,0.04);
      border-color: rgba(0,0,0,0.12);
      color: rgba(0,0,0,0.8);
    }

    /* Settings panel */
    body.theme-light #settingsBtn {
      background: rgba(0,0,0,0.06);
      border-color: rgba(0,0,0,0.14);
      color: rgba(0,0,0,0.6);
    }
    body.theme-light #refreshBtn {
      background: rgba(0,0,0,0.06);
      border-color: rgba(0,0,0,0.14);
      color: rgba(0,0,0,0.6);
    }
    body.theme-light #settingsPanel {
      background: rgba(0,0,0,0.04);
      border-color: rgba(0,0,0,0.10);
    }
    body.theme-light #settingsPanel div { color: rgba(0,0,0,0.80) !important; }
    body.theme-light #changelogToggle   { color: rgba(0,0,0,0.55) !important; }
    body.theme-light #changelogBody     { color: rgba(0,0,0,0.55) !important; }
    body.theme-light #changelogBody li  { color: rgba(0,0,0,0.60) !important; }
    body.theme-light .setting-btn {
      background: rgba(0,0,0,0.06);
      border-color: rgba(0,0,0,0.14);
      color: rgba(0,0,0,0.65);
    }
    body.theme-light .setting-btn.active {
      background: rgba(30,120,255,0.12);
      border-color: rgba(30,120,255,0.4);
      color: rgba(20,90,200,0.95);
    }

    /* Risk tiles */
    body.theme-light .risk-tile {
      background: rgba(0,0,0,0.03);
      border-color: rgba(0,0,0,0.08);
    }
    body.theme-light .risk-tile .big,
    body.theme-light .risk-tile .kicker,
    body.theme-light .risk-tile .sub { color: rgba(0,0,0,0.80) !important; }

    /* Leaflet map */
    body.theme-light .leaflet-container { background: #e8edf5 !important; }
    body.theme-light .leaflet-control-zoom a {
      background: rgba(255,255,255,0.9) !important;
      color: rgba(0,0,0,0.7) !important;
      border-color: rgba(0,0,0,0.2) !important;
    }
    body.theme-light .leaflet-control-attribution {
      background: rgba(255,255,255,0.7) !important;
      color: rgba(0,0,0,0.5) !important;
    }

    /* Alert banners — keep them legible in light mode */
    body.theme-light #alertSummaryBar {
      background: rgba(200,40,40,0.12) !important;
      border-color: rgba(200,40,40,0.4) !important;
    }
    body.theme-light #alertSummaryText { color: rgba(140,20,20,0.95) !important; }
    body.theme-light #alertSummaryChev { color: rgba(140,20,20,0.6) !important; }
    body.theme-light #stormModeBanner {
      background: rgba(200,40,40,0.12) !important;
      border-color: rgba(200,40,40,0.4) !important;
      color: rgba(140,20,20,0.95) !important;
    }
    body.theme-light .alert-banner {
      background: rgba(200,40,40,0.08) !important;
      border-color: rgba(200,40,40,0.3) !important;
      color: rgba(120,10,10,0.9) !important;
    }
    body.theme-light .alert-banner * { color: rgba(120,10,10,0.85) !important; }
    body.theme-light .alert-title    { color: rgba(120,10,10,0.9) !important; }

    /* Current conditions — °F unit, feels like, condition text */
    body.theme-light .current-temp { color: rgba(0,0,0,0.88) !important; }
    body.theme-light .temp-unit    { color: rgba(0,0,0,0.55) !important; }
    body.theme-light .feels-like   { color: rgba(0,0,0,0.7)  !important; }
    body.theme-light .condition    { color: rgba(0,0,0,0.75) !important; }

    /* Any element that uses white or near-white text hardcoded */
    body.theme-light .value        { color: rgba(0,0,0,0.88) !important; }
    body.theme-light .label        { color: rgba(0,0,0,0.55) !important; }
    body.theme-light .small-note   { color: rgba(0,0,0,0.4)  !important; }

    /* Card titles */
    body.theme-light .card-title   { color: rgba(0,0,0,0.85) !important; }

    /* Source pills */
    body.theme-light .source-pill  { color: rgba(0,0,0,0.75) !important; }
    body.theme-light .source-pill .small { color: rgba(0,0,0,0.5) !important; }

    /* Meta row */
    body.theme-light .meta-label   { color: rgba(0,0,0,0.5)  !important; }
    body.theme-light .meta-value   { color: rgba(0,0,0,0.85) !important; }

    /* Badges */
    body.theme-light .badge { border-color: rgba(0,0,0,0.15) !important; }

    /* Collapse chevron */
    body.theme-light .collapse-chevron { color: rgba(0,0,0,0.4) !important; }

    /* Settings panel text */
    body.theme-light #settingsPanel { color: rgba(0,0,0,0.8) !important; }
    body.theme-light #settingsPanel div[style*="rgba(255,255,255"] { color: rgba(0,0,0,0.8) !important; }

    /* Sun/Moon/Solar system inline white text */
    body.theme-light #sunStatus,
    body.theme-light #daylight,
    body.theme-light #solarNoonLabel,
    body.theme-light #moonPhaseName,
    body.theme-light #moonIllumination { color: rgba(0,0,0,0.75) !important; }

    /* NWS forecast text */
    body.theme-light #nwsForecastList * { color: rgba(0,0,0,0.8) !important; }
    body.theme-light #nwsOfficeLabel   { color: rgba(0,0,0,0.35) !important; }
    body.theme-light #nwsFilterLabel   { color: rgba(30,100,220,0.85) !important; }

    /* ── NUCLEAR INLINE OVERRIDE ──────────────────────────────
       Inline style= attributes beat class selectors, so we must
       use attribute selectors to catch every hardcoded white text.
       Covers opacity 0.2 through 0.95 in all faint/mid/bright forms.
    ──────────────────────────────────────────────────────────── */
    body.theme-light [style*="color:rgba(255,255,255,0.2"]  { color: rgba(0,0,0,0.35) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.3"]  { color: rgba(0,0,0,0.42) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.4"]  { color: rgba(0,0,0,0.50) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.5"]  { color: rgba(0,0,0,0.60) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.6"]  { color: rgba(0,0,0,0.68) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.7"]  { color: rgba(0,0,0,0.75) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.8"]  { color: rgba(0,0,0,0.82) !important; }
    body.theme-light [style*="color:rgba(255,255,255,0.9"]  { color: rgba(0,0,0,0.90) !important; }
    body.theme-light [style*="color:rgba(255,255,255,1)"]   { color: rgba(0,0,0,0.92) !important; }
    /* Spaced variants (color: rgba ...) */
    body.theme-light [style*="color: rgba(255,255,255,0.2"] { color: rgba(0,0,0,0.35) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.3"] { color: rgba(0,0,0,0.42) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.4"] { color: rgba(0,0,0,0.50) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.5"] { color: rgba(0,0,0,0.60) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.6"] { color: rgba(0,0,0,0.68) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.7"] { color: rgba(0,0,0,0.75) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.8"] { color: rgba(0,0,0,0.82) !important; }
    body.theme-light [style*="color: rgba(255,255,255,0.9"] { color: rgba(0,0,0,0.90) !important; }
    /* Exceptions — keep colored badges/status text from being forced black */
    body.theme-light [style*="color:rgba(80,220,120"]   { color: rgba(20,140,60,0.9)   !important; } /* green wind */
    body.theme-light [style*="color:rgba(100,220,100"]  { color: rgba(20,140,60,0.9)   !important; } /* green alt */
    body.theme-light [style*="color:rgba(200,100,60"]   { color: rgba(180,60,20,0.9)   !important; } /* orange score */
    body.theme-light [style*="color:rgba(220,80,80"]    { color: rgba(180,30,30,0.9)   !important; } /* red wind */
    body.theme-light [style*="color:rgba(255,200,80"]   { color: rgba(160,110,0,0.9)   !important; } /* yellow crosswind */
    body.theme-light [style*="color:rgba(255,190,50"]   { color: rgba(160,110,0,0.9)   !important; } /* orange marginal */
    body.theme-light [style*="color:rgba(160,220,80"]   { color: rgba(70,140,20,0.9)   !important; } /* yellow-green */
    body.theme-light [style*="color:rgba(180,80,80"]    { color: rgba(160,30,30,0.9)   !important; } /* red dock dry */
    body.theme-light [style*="color:rgba(255,120,120"]  { color: rgba(200,30,30,0.9)   !important; } /* source error */
    body.theme-light [style*="color:rgba(140,240,160"]  { color: rgba(20,140,60,0.9)   !important; } /* source ok */

    /* Row borders */
    body.theme-light .row { border-bottom-color: rgba(0,0,0,0.07) !important; }
    body.theme-light [style*="border-bottom:1px solid rgba(255,255,255"] {
      border-bottom-color: rgba(0,0,0,0.07) !important;
    }
    .leaflet-container { background: #0b1220 !important; }
    .leaflet-control-attribution {
      background: rgba(0,0,0,0.6) !important;
      color: rgba(255,255,255,0.4) !important;
      font-size: 10px !important;
    }
    .leaflet-control-attribution a { color: rgba(255,255,255,0.5) !important; }
    .leaflet-control-zoom a {
      background: rgba(20,30,50,0.9) !important;
      color: rgba(255,255,255,0.8) !important;
      border-color: rgba(255,255,255,0.15) !important;
    }

    /* ========== OVERHEAD (FLIGHT TRACKER) ========== */
    #overheadMap {
      width: 100%;
      height: clamp(320px, 55vh, 520px);
      border-radius: 8px;
      overflow: hidden;
      background: #1a1a2e;
    }

    .oh-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding: 12px 16px;
      background: rgba(255,255,255,0.03);
      border-radius: 8px;
    }

    .oh-title {
      font-size: 0.78rem;
      font-weight: 600;
      color: #e0e0e0;
      letter-spacing: 0.05em;
    }

    .oh-meta {
      font-size: 12px;
      color: #888;
      margin-left: 8px;
    }

    .oh-controls {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #oh-status {
      font-size: 11px;
      color: #666;
    }

    .oh-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 6px;
      color: #aaa;
      font-size: 11px;
      padding: 4px 10px;
      cursor: pointer;
      transition: all 0.15s;
    }
    .oh-btn:hover { background: rgba(255,255,255,0.14); }
    .oh-btn:active { transform: scale(0.97); }

    .oh-legend {
      display: flex;
      gap: 12px;
      margin-top: 10px;
      font-size: 11px;
      color: #666;
      padding: 0 16px;
    }
    .oh-legend span { margin-right: 3px; }

body.theme-light .oh-legend {
  color: rgba(0, 0, 0, 0.6) !important;
}

    #oh-popup {
      display: none;
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 1000;
      background: rgba(10,10,20,0.88);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-top: 1px solid rgba(255,255,255,0.15);
      border-radius: 0 0 8px 8px;
      padding: 10px 14px 12px;
    }

    .oh-pop-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
    }

    #oh-pop-flight {
      font-size: 18px;
      font-weight: 700;
      color: #fff;
      letter-spacing: 0.03em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    #oh-pop-route {
      font-size: 15px;
      color: #aaa;
      margin-top: 3px;
    }

    #oh-pop-airline {
      font-size: 12px;
      color: #666;
      margin-top: 2px;
    }

    .oh-close {
      background: none;
      border: none;
      color: #555;
      font-size: 28px;
      cursor: pointer;
      padding: 0 0 0 8px;
      line-height: 1;
    }
    .oh-close:hover { color: #aaa; }

    .oh-stats {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 8px;
      margin-top: 12px;
    }

    .oh-stat {
      text-align: center;
    }

    .oh-stat-val {
      font-size: 14px;
      font-weight: 600;
      color: #60a5fa;
    }

    .oh-stat-lbl {
      font-size: 10px;
      color: #555;
      margin-top: 2px;
      letter-spacing: 0.08em;
    }

    .oh-plane-icon {
      font-size: 28px;
    }
    @media (min-width: 768px) {
      .oh-plane-icon {
        font-size: 40px;
      line-height: 1;
      cursor: pointer;
      user-select: none;
      
      display: block;
      width: 32px;
      height: 32px;
      text-align: center;
    }

    .oh-home-icon {
      font-size: 16px;
      line-height: 1;
    }
    }

    /* Light theme overrides */


/* Radar tile border and title in dark mode */
body:not(.theme-light) [data-collapse-key="radar"] .card-collapsed-preview {
  border: 1px solid rgba(255,255,255,0.25);
}
body:not(.theme-light) [data-collapse-key="radar"] .card-collapsed-preview > div {
  color: rgba(255,255,255,0.5) !important;
}

    body.theme-light #overheadMap { background: #e8edf5; }
    body.theme-light .oh-header { background: rgba(0,0,0,0.03); }
    body.theme-light .oh-title { color: #1a1a2e; }
body.theme-light .oh-meta { color: rgba(0,0,0,0.65); }
body.theme-light #oh-status { color: rgba(0,0,0,0.65); }
    body.theme-light .oh-btn {
      background: rgba(0,0,0,0.05);
      border-color: rgba(0,0,0,0.1);
      color: #555;
    }
    body.theme-light .oh-btn:hover { background: rgba(0,0,0,0.08); }
    body.theme-light #oh-popup {
      background: rgba(245,245,250,0.92);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-top: 1px solid rgba(0,0,0,0.1);
    }
    body.theme-light #oh-pop-flight { color: #1a1a2e; }
    body.theme-light .oh-close { color: #999; }
    body.theme-light .oh-close:hover { color: #333; }


    /* Temp/Precip Chart Data Bar */
    .chart-data-bar {
      display: block;
      background: rgba(30, 35, 50, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 6px;
      padding: 12px 16px;
      margin-top: 12px;
    }


    .chart-data-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding: 0 12px;
    }

    .chart-data-time {
      font-size: 0.78rem;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.9);
    }

    .chart-data-close {
      background: none;
      border: none;
      color: rgba(255, 255, 255, 0.5);
      font-size: 20px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
    }

    .chart-data-close:hover {
      color: rgba(255, 255, 255, 0.8);
    }

    .chart-data-stats {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 8px;
    }

    .chart-data-stat {
      text-align: center;
    }

    .chart-data-stat-val {
      font-size: 16px;
      font-weight: 600;
      color: #60a5fa;
    }

    .chart-data-stat-lbl {
      font-size: 10px;
      color: rgba(255, 255, 255, 0.4);
      margin-top: 2px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }
</head>
/* Mobile chart data bar fixes */
@media (max-width: 780px) {
  .chart-data-header {
    position: absolute;
    right: 12px;
    top: 12px;
    width: auto;
    margin-bottom: 0;
    padding: 0;
    z-index: 10;
  }
  
  .chart-data-bar {
    position: relative;
    padding-top: 48px;
  }
  
  .chart-data-time {
    display: block;
    margin-bottom: 8px;
  }
  
  #tempPrecipDataLine, #windDataLine {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* Light mode data bar background */
body.theme-light .chart-data-bar {
  background: rgba(240, 242, 245, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

body.theme-light .chart-data-time {
  color: rgba(0, 0, 0, 0.85) !important;
}

body.theme-light #tempPrecipDataLine,
body.theme-light #windDataLine {
  color: rgba(0, 0, 0, 0.9) !important;
}

.wind-legend-label {
  color: rgba(150,150,150,0.7);
}


body.theme-light .wind-legend-label {
  color: rgba(0,0,0,0.5) !important;
}

body.theme-light .chart-data-close {
  color: rgba(0, 0, 0, 0.5) !important;
}

body.theme-light .chart-data-close:hover {
  color: rgba(0, 0, 0, 0.8) !important;
}

/* ========== TEXT COLOR CLASSES FOR THEME SUPPORT ========== */

/* Very light text (0.25-0.45 opacity) */
.text-subtle { color: rgba(255,255,255,0.35); }
body.theme-light .text-subtle { color: rgba(0,0,0,0.45); }

/* Light secondary text (0.45-0.6 opacity) */
.text-secondary { color: rgba(255,255,255,0.55); }
body.theme-light .text-secondary { color: rgba(0,0,0,0.65); }

/* Medium text (0.6-0.75 opacity) */
.text-medium { color: rgba(255,255,255,0.7); }
body.theme-light .text-medium { color: rgba(0,0,0,0.75); }

/* Emphasis text (0.8-0.9 opacity) */
.text-emphasis { color: rgba(255,255,255,0.85); }
body.theme-light .text-emphasis { color: rgba(0,0,0,0.9); }

/* Primary text (0.95+ opacity) */
.text-primary { color: rgba(255,255,255,0.95); }
body.theme-light .text-primary { color: rgba(0,0,0,0.95); }

/* Special: bluish-tinted text */
.text-blue-tint { color: rgba(200,210,230,0.75); }
body.theme-light .text-blue-tint { color: rgba(0,0,0,0.7); }

.chart-legend-header {
  color: rgba(200,210,230,0.5);
}

body.theme-light .chart-legend-header {
  color: rgba(0,0,0,0.7) !important;
}

/* Tappable hyperlocal links in Right Now card */
.hyperlocal-link {
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.hyperlocal-link:hover {
  color: rgba(100,200,255,0.95) !important;
}

body.theme-light .hyperlocal-link:hover {
  color: rgba(0,100,200,0.95) !important;
}

.hyperlocal-link:active {
  transform: scale(0.98);
}

.hyperlocal-link::after {
  content: ' ›';
  opacity: 0.4;
  font-size: 0.9em;
  margin-left: 2px;
}

/* Card expanded modal state */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.card-collapsed-preview {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 140px;
  max-height: 140px;
  padding: 12px 12px;
  transition: opacity 0.25s ease;
  backface-visibility: hidden;
}

/* Smaller title when collapsed */
.card-collapsed-preview > div:first-child {
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.2px;
  margin-bottom: 8px;
  opacity: 0.88;
}

/* Hide title when collapsed - content goes in preview instead */
.card .card-title-collapsible {
  display: none;
}

/* Show title when expanded */
:root {
  --header-bottom: 55px;
  --tabbar-height: 70px;
}
.card.card-expanded {
  position: fixed !important;
  top: calc(var(--header-bottom) + 12px + (100vh - var(--header-bottom) - var(--tabbar-height) - 44px) / 2) !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(680px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - var(--header-bottom) - var(--tabbar-height) - 44px) !important;
  z-index: 200 !important;
  display: flex !important;
  flex-direction: column !important;
  grid-column: unset !important;
  margin: 0 !important;
  border-radius: 18px !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4) !important;
  animation: card-expand 0.28s ease-out;
}
@keyframes card-expand {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.card.card-expanded .card-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.card.card-expanded .card-title-collapsible {
  display: flex !important;
  opacity: 1 !important;
}

/* Hide collapsed preview when card is expanded */
.card.card-expanded .card-collapsed-preview {
  opacity: 0;
}

/* Expanded card children inherit the opacity animation from the .card-expand keyframe —
   no separate delayed transitions needed (they used to fight the keyframe, causing jank). */
.card-title-collapsible {
  opacity: 1;
}

.card .card-title-collapsible {
  opacity: 0;
}

.card.card-expanded .card-title-collapsible {
  opacity: 1;
}


    /* ========== EXPANDED CARD - BOOSTED TILE BACKGROUNDS ========== */
    .card.card-expanded.tile-temp-cold    { background: linear-gradient(135deg, rgba(147,197,253,0.35) 0%, rgba(59,130,246,0.20) 100%) !important; }
    .card.card-expanded.tile-temp-cool    { background: linear-gradient(135deg, rgba(96,165,250,0.40) 0%, rgba(59,130,246,0.25) 100%) !important; }
    .card.card-expanded.tile-temp-mild    { background: linear-gradient(135deg, rgba(253,224,71,0.35) 0%, rgba(234,179,8,0.20) 100%) !important; }
    .card.card-expanded.tile-temp-warm    { background: linear-gradient(135deg, rgba(255,140,60,0.45) 0%, rgba(255,100,30,0.30) 100%) !important; }
    .card.card-expanded.tile-temp-hot     { background: linear-gradient(135deg, rgba(251,146,60,0.45) 0%, rgba(249,115,22,0.30) 100%) !important; }
    .card.card-expanded.tile-wind-calm    { background: linear-gradient(135deg, rgba(96,165,250,0.40) 0%, rgba(59,130,246,0.25) 100%) !important; }
    .card.card-expanded.tile-wind-light   { background: linear-gradient(135deg, rgba(100,200,200,0.40) 0%, rgba(80,180,180,0.25) 100%) !important; }
    .card.card-expanded.tile-wind-moderate{ background: linear-gradient(135deg, rgba(253,224,71,0.35) 0%, rgba(234,179,8,0.20) 100%) !important; }
    .card.card-expanded.tile-wind-strong  { background: linear-gradient(135deg, rgba(255,140,60,0.45) 0%, rgba(255,100,30,0.30) 100%) !important; }
    .card.card-expanded.tile-wind-severe  { background: linear-gradient(135deg, rgba(239,68,68,0.45) 0%, rgba(220,38,38,0.30) 100%) !important; }
    .card.card-expanded.tile-dock-great   { background: linear-gradient(135deg, rgba(96,165,250,0.40) 0%, rgba(59,130,246,0.25) 100%) !important; }
    .card.card-expanded.tile-dock-good    { background: linear-gradient(135deg, rgba(100,200,200,0.40) 0%, rgba(80,180,180,0.25) 100%) !important; }
    .card.card-expanded.tile-dock-marginal{ background: linear-gradient(135deg, rgba(253,224,71,0.35) 0%, rgba(234,179,8,0.20) 100%) !important; }
    .card.card-expanded.tile-dock-poor    { background: linear-gradient(135deg, rgba(255,140,60,0.45) 0%, rgba(255,100,30,0.30) 100%) !important; }
    .card.card-expanded.tile-dock-stayinside { background: linear-gradient(135deg, rgba(239,68,68,0.45) 0%, rgba(220,38,38,0.30) 100%) !important; }
    .card.card-expanded.tile-sunset-poor  { background: linear-gradient(135deg, rgba(128,128,128,0.35) 0%, rgba(140,140,150,0.25) 100%) !important; }
    .card.card-expanded.tile-sunset-fair  { background: linear-gradient(135deg, rgba(200,180,140,0.40) 0%, rgba(180,160,120,0.28) 100%) !important; }
    .card.card-expanded.tile-sunset-good  { background: linear-gradient(135deg, rgba(255,140,60,0.45) 0%, rgba(255,100,30,0.30) 100%) !important; }
    .card.card-expanded.tile-sunset-verygood { background: linear-gradient(135deg, rgba(255,140,60,0.55) 0%, rgba(249,115,22,0.38) 100%) !important; }
    .card.card-expanded.tile-sunset-spectacular { background: linear-gradient(135deg, rgba(255,100,50,0.65) 0%, rgba(255,70,30,0.50) 100%) !important; }
    .card.card-expanded.tile-seabreeze-unlikely { background: linear-gradient(135deg, rgba(140,160,180,0.35) 0%, rgba(120,140,160,0.25) 100%) !important; }
    .card.card-expanded.tile-seabreeze-possible { background: linear-gradient(135deg, rgba(120,190,200,0.40) 0%, rgba(100,170,180,0.28) 100%) !important; }
    .card.card-expanded.tile-seabreeze-likely   { background: linear-gradient(135deg, rgba(80,220,230,0.55) 0%, rgba(60,200,210,0.40) 100%) !important; }

.card.card-expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.02);
  width: calc(100% - 32px);
  max-width: 780px;
  max-height: calc(80vh);
  overflow-y: auto;
  
  border-radius: 18px;
  z-index: 1000;
  grid-column: unset;
  width: calc(100vw - 32px) !important;
}

.card-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: rgba(255,255,255,0.7);
}
body.theme-light .card-close-btn {
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.45);
}

/* ========== EXPANDED CARD BEAUTIFICATION ========== */

/* Refined row styling in expanded cards */
.card-expanded .row {
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.card-expanded .row:last-child { border-bottom: none; }
body.theme-light .card-expanded .row {
  border-bottom-color: rgba(0,0,0,0.06);
}

/* Muted labels, clean values in expanded state */
.card-expanded .label {
  color: rgba(255,255,255,0.45);
  font-weight: 600;
  font-size: 0.9rem;
}
.card-expanded .value {
  color: rgba(255,255,255,0.92);
  font-weight: 500;
  font-size: 0.9rem;
}
body.theme-light .card-expanded .label {
  color: rgba(0,0,0,0.55) !important;
}
body.theme-light .card-expanded .value {
  color: rgba(0,0,0,0.9) !important;
}

/* Expanded card title — header row with close button */
.card-expanded .card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  min-height: 32px;
  padding-right: 40px; /* space for close button */
}
body.theme-light .card-expanded .card-title {
  color: rgba(0,0,0,0.5) !important;
}

/* Close button sits in the title row area */
.card-expanded .card-close-btn {
  display: none !important;
}

/* Hero area divider for Right Now expanded */
.card-expanded .hero-divider {
  height: 0.5px;
  background: rgba(255,255,255,0.08);
  margin: 16px 0;
}
body.theme-light .card-expanded .hero-divider {
  background: rgba(0,0,0,0.06);
}

/* Hero area — centered temp block */
.card-expanded .hero-area {
  text-align: center;
  padding: 8px 0 0;
}

/* Remove tooltip underline from hero elements */

/* Expanded card body — content starts right after title row */
.card-expanded .card-body {
  padding-top: 0;
}

/* Chart cards need top padding since their canvas sits at top of card-body */
.card-expanded[data-collapse-key="48h_temp_precip"] .card-body,
.card-expanded[data-collapse-key="48h_wind"] .card-body {
  padding-top: 8px;
}

/* Expanded current temp — refined */
.card-expanded .current-temp {
  font-size: 3.5rem;
  font-weight: 300;
  letter-spacing: -2px;
}
.card-expanded .temp-unit {
  font-size: 1.5rem;
  font-weight: 400;
  color: rgba(255,255,255,0.4);
}
body.theme-light .card-expanded .temp-unit {
  color: rgba(0,0,0,0.5) !important;
}
.card-expanded .feels-like {
  font-size: 0.95rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
}
body.theme-light .card-expanded .feels-like {
  color: rgba(0,0,0,0.55) !important;
}
.card-expanded .condition {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}

/* 10-Day forecast expanded styling */
.card-expanded .forecast-day-row {
  padding: 8px 6px !important;
}
.card-expanded .forecast-day-row .value {
  font-weight: 500;
}
.card-expanded .forecast-day-row .temp-lo {
  opacity: 0.4;
  font-weight: 400;
}

/* Detailed Forecast expanded — inline layout */
.card-expanded .detailed-period {
  padding: 12px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.card-expanded .detailed-period:last-child { border-bottom: none; }
body.theme-light .card-expanded .detailed-period {
  border-bottom-color: rgba(0,0,0,0.06);
}
.card-expanded .detailed-period-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.card-expanded .detailed-period-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}
body.theme-light .card-expanded .detailed-period-name {
  color: rgba(0,0,0,0.85) !important;
}
.card-expanded .detailed-period-temp {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}
body.theme-light .card-expanded .detailed-period-temp {
  color: rgba(0,0,0,0.85) !important;
}
.card-expanded .detailed-period-wind {
  font-size: 0.78rem;
  font-weight: 400;
  color: rgba(255,255,255,0.35);
}
body.theme-light .card-expanded .detailed-period-wind {
  color: rgba(0,0,0,0.4) !important;
}
.card-expanded .detailed-period-narrative {
  font-size: 0.88rem;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  margin-top: 4px;
}
body.theme-light .card-expanded .detailed-period-narrative {
  color: rgba(0,0,0,0.55) !important;
}

/* ========== ALMANAC CARD REFINEMENTS ========== */

/* Hide the large sun emoji in expanded state */
.card-expanded #sunEmoji {
  display: none;
}

/* Tighten sun card summary column in expanded state */
.card-expanded .mobile-3col {
  margin-top: 0;
}
body.theme-light [style*="color:rgba(100,200,255"] { color: rgba(0,0,0,0.85) !important; }


/* Fixed header offset */
#weatherView, #hyperlocalView, #almanacView, #overheadView, #sourcesView {
  padding-top: 44px;
}

/* Settings gear stale-data indicator dot */
.settings-alert-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  pointer-events: none;
}
