/* ===== AI 星图 · 环境主题引擎（全站生效） v3 =====
 * 白天亮度随天气变化；文字颜色随背景明暗自动切换（亮天气深色字 / 暗天气浅色字）
 */

/* 全站 3D 背景画布与光晕 */
#bg{position:fixed;inset:0;z-index:-2;display:block}
.veil{position:fixed;inset:0;z-index:-1;pointer-events:none;background:
  radial-gradient(1200px 600px at 70% -10%, rgba(34,211,238,.10), transparent 60%),
  radial-gradient(900px 500px at 10% 20%, rgba(167,139,250,.10), transparent 60%)}

/* ---- 天气 / 季节粒子 ---- */
#aiWeather{position:fixed;inset:0;pointer-events:none;z-index:0;overflow:hidden}
#aiWeather i{position:absolute;top:-24px;display:block;pointer-events:none}
.ai-drop{width:2px;height:24px;background:linear-gradient(transparent,rgba(175,215,255,.95));border-radius:2px;animation:aiRain linear infinite;filter:drop-shadow(0 0 3px rgba(120,180,255,.6))}
@keyframes aiRain{to{transform:translateY(112vh)}}
.ai-flake{color:#fff;text-shadow:0 0 5px rgba(255,255,255,.85);animation:aiSnow linear infinite;line-height:1}
@keyframes aiSnow{to{transform:translateY(112vh) rotate(400deg)}}
.ai-petal-el{width:11px;height:11px;background:radial-gradient(circle,#ffb3cd,#ff7ba6);border-radius:60% 0 60% 50%;animation:aiPetal linear infinite}
@keyframes aiPetal{to{transform:translateY(112vh) rotate(560deg)}}

/* ---- 雷电特效（雷阵雨 weather-thunder） ---- */
.ai-flash{position:fixed;inset:0;background:radial-gradient(circle at 50% 25%, rgba(255,255,255,.95), rgba(210,230,255,.5) 55%, transparent 75%);opacity:0;pointer-events:none;animation:aiFlash linear infinite}
@keyframes aiFlash{
  0%,100%{opacity:0}
  3%{opacity:.9}
  6%{opacity:.12}
  9%{opacity:.7}
  12%{opacity:0}
  22%{opacity:0}
}
.ai-bolt{width:3px;height:70px;background:linear-gradient(#fff,#9bd0ff);box-shadow:0 0 10px 3px rgba(200,230,255,.9);transform:rotate(18deg);opacity:0;animation:aiBolt linear infinite;border-radius:2px}
@keyframes aiBolt{
  0%,100%{opacity:0}
  3%{opacity:1}
  6%{opacity:0}
  9%{opacity:.85}
  12%{opacity:0}
  24%{opacity:0}
}

/* ---- 白天模式：亮度随天气变化，文字颜色随背景明暗自动切换 ---- */
/* 默认=亮天气（晴/多云/雾/雪）：亮背景 + 深色文字 */
body.theme-day{
  --surface:rgba(255,255,255,.88);
  --border:rgba(20,45,70,.14);
  --text:#0d2033;
  --muted:#33475c;
  --accent:#0b7bb8;
  --accent2:#6d28d9;
  --accent3:#0a7a52;
  background:linear-gradient(180deg,#4f93d4 0%,#8ac1ee 45%,#c9e8fb 100%) fixed !important;
  color:var(--text);
}
body.theme-day #bg{opacity:.65}
body.theme-day .veil{background:
  radial-gradient(1200px 600px at 70% -10%, rgba(14,120,190,.12), transparent 60%),
  radial-gradient(900px 500px at 10% 20%, rgba(109,40,217,.10), transparent 60%)}
body.theme-day header, body.theme-day .nav{background:rgba(255,255,255,.55)}
body.theme-day .nav-links a{color:#0d2033}
body.theme-day .card3d, body.theme-day .tool, body.theme-day .rank-row, body.theme-day .tut, body.theme-day .search{
  background:rgba(255,255,255,.92);border-color:rgba(20,45,70,.14)}
body.theme-day .logo, body.theme-day h1, body.theme-day h2, body.theme-day h3{color:#0d2033}
body.theme-day .hero p, body.theme-day .stat .lab, body.theme-day .sec-head .sub{color:#33475c}
body.theme-day .tool p, body.theme-day .tut p, body.theme-day .tool .tag{color:#3f5568}
body.theme-day .tool .meta, body.theme-day .rank-row .cat, body.theme-day .card3d .cnt{color:#57697e}
body.theme-day .search input{color:#0d1b2a}
body.theme-day .search button{color:#fff}

/* 晴天：最亮 */
body.theme-day.weather-sunny{
  background:linear-gradient(180deg,#4f93d4 0%,#8ac1ee 45%,#c9e8fb 100%) fixed !important;
}
/* 多云：灰蓝，较暗 */
body.theme-day.weather-cloudy{
  background:linear-gradient(180deg,#66768a 0%,#93a3b5 45%,#c4cfdb 100%) fixed !important;
}
/* 雾：灰 */
body.theme-day.weather-fog{
  background:linear-gradient(180deg,#76818c 0%,#a2abb5 45%,#cbd2d9 100%) fixed !important;
}
/* 雪：冷白灰 */
body.theme-day.weather-snow{
  background:linear-gradient(180deg,#6d809b 0%,#9db0c7 45%,#d2dfeb 100%) fixed !important;
}

/* 雨天：暗灰蓝 → 改用浅色文字 */
body.theme-day.weather-rain:not(.weather-thunder){
  background:linear-gradient(180deg,#2c3748 0%,#4a5a6e 45%,#6c7d90 100%) fixed !important;
  --text:#eaf4ff; --muted:#c3d8f0; --border:rgba(255,255,255,.16);
  --accent:#38bdf8; --accent2:#a78bfa; --accent3:#34d399;
  color:var(--text);
}
body.theme-day.weather-rain:not(.weather-thunder) header,
body.theme-day.weather-rain:not(.weather-thunder) .nav{background:rgba(8,20,38,.6)}
body.theme-day.weather-rain:not(.weather-thunder) .nav-links a{color:#dceeff}
body.theme-day.weather-rain:not(.weather-thunder) .logo,
body.theme-day.weather-rain:not(.weather-thunder) h1,
body.theme-day.weather-rain:not(.weather-thunder) h2,
body.theme-day.weather-rain:not(.weather-thunder) h3{color:#f0f8ff;text-shadow:0 1px 4px rgba(0,10,25,.45)}
body.theme-day.weather-rain:not(.weather-thunder) .hero p,
body.theme-day.weather-rain:not(.weather-thunder) .stat .lab,
body.theme-day.weather-rain:not(.weather-thunder) .sec-head .sub{color:#dcebfa;text-shadow:0 1px 3px rgba(0,10,25,.4)}

/* 雷阵雨：暗沉 → 浅色文字 */
body.theme-day.weather-thunder{
  background:linear-gradient(180deg,#141c2a 0%,#293449 45%,#3f4d63 100%) fixed !important;
  --text:#eaf4ff; --muted:#c3d8f0; --border:rgba(255,255,255,.18);
  --accent:#60a5fa; --accent2:#c084fc; --accent3:#34d399;
  color:var(--text);
}
body.theme-day.weather-thunder header, body.theme-day.weather-thunder .nav{background:rgba(6,12,22,.65)}
body.theme-day.weather-thunder .nav-links a{color:#dceeff}
body.theme-day.weather-thunder .logo,
body.theme-day.weather-thunder h1,
body.theme-day.weather-thunder h2,
body.theme-day.weather-thunder h3{color:#f5faff;text-shadow:0 1px 4px rgba(0,10,25,.6)}
body.theme-day.weather-thunder .hero p,
body.theme-day.weather-thunder .stat .lab,
body.theme-day.weather-thunder .sec-head .sub{color:#dcebfa;text-shadow:0 1px 3px rgba(0,10,25,.5)}

/* ---- 黎明 / 黄昏（渐变过渡） ---- */
body.theme-dawn{
  --surface:rgba(255,244,230,.85);
  --border:rgba(120,70,20,.14);
  --text:#3a2410;
  --muted:#6b5638;
  --accent:#d97706;
  --accent2:#b45309;
  background:linear-gradient(180deg,#ffd9a0 0%,#fff3e2 50%,#ffc9a3 100%) fixed !important;
  color:var(--text);
}
body.theme-dusk{
  --surface:rgba(30,20,50,.65);
  --border:rgba(255,255,255,.12);
  --text:#f5ecff;
  --muted:#b9a8d8;
  --accent:#f0abfc;
  --accent2:#a78bfa;
  background:linear-gradient(180deg,#2a1a4e 0%,#5b2a5e 45%,#c96b4a 100%) fixed !important;
  color:var(--text);
}
body.theme-dawn #bg, body.theme-dusk #bg{opacity:.6}
body.theme-dawn .veil, body.theme-dusk .veil{background:
  radial-gradient(1200px 600px at 70% -10%, rgba(255,190,90,.18), transparent 60%),
  radial-gradient(900px 500px at 10% 20%, rgba(255,120,120,.16), transparent 60%)}
body.theme-dawn .tool, body.theme-dawn .card3d, body.theme-dawn .rank-row, body.theme-dawn .tut,
body.theme-dusk .tool, body.theme-dusk .card3d, body.theme-dusk .rank-row, body.theme-dusk .tut{
  background:rgba(255,255,255,.1);border-color:var(--border);
}

/* ---- 夜晚：保持默认深色星空 ---- */
body.theme-night{background:var(--bg,#05060a)}

/* ---- 雪天 / 冬季让卡片更贴合 ---- */
body.weather-snow{--accent:#bae6fd;--accent2:#e0f2fe}

/* ---- 节日氛围 ---- */
body.festival-cny .nav .btn, body.festival-national .nav .btn{border-color:#e02424;color:#e02424}
body.festival-cny .logo .orb, body.festival-national .logo .orb{background:conic-gradient(#e02424,#f5a623)}
body.festival-christmas .nav .btn{border-color:#16a34a;color:#16a34a}
body.festival-christmas .logo .orb{background:conic-gradient(#16a34a,#e02424)}

/* 白天时雪花用深色，保证可见 */
body.theme-day .ai-flake{color:#dbeafe;text-shadow:0 0 4px rgba(255,255,255,.6)}