/* ============================================================
   星空模式：从 lulu 站原样迁移（图层/星点/流星），
   变量名映射到新版（--bg/--card/--text/--line/--brand）
   ============================================================ */
.cosmos{
  position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden;
  opacity:0;visibility:hidden;
  transition:opacity 1.2s ease,visibility 1.2s ease;
}
:root[data-theme="star"] .cosmos{opacity:1;visibility:visible}
:root[data-theme="star"] .app{position:relative;z-index:1;background:transparent}

/* 深蓝星野：渐变 + 照片都锁在 fixed 层里，
   高度恒等于视口，切换页面（滚动高度从 3 万 px 变到 1 千 px）也不会重算 */
.cosmos-sky{position:absolute;inset:0;background:#01030A}
:root[data-theme="star"] .cosmos-sky{
  background:
    radial-gradient(ellipse 60% 45% at 18% 22%,rgba(72,96,220,.20),transparent 70%),
    radial-gradient(ellipse 50% 40% at 82% 68%,rgba(126,66,200,.16),transparent 72%),
    radial-gradient(ellipse 70% 50% at 50% 100%,rgba(20,88,168,.18),transparent 75%),
    linear-gradient(180deg,rgba(1,3,10,.30),rgba(3,9,26,.06) 45%,rgba(4,12,30,.42)),
    url(../img/stars-bg.webp) center 42%/cover no-repeat,
    #01030A;
}

.cosmos-galaxy-photo,
.cosmos-saturn-photo,
.cosmos-girl-photo{position:absolute;height:auto;pointer-events:none;user-select:none}

/* 右侧仙女座星系：左缘贴在主体（.shell）右侧外 20px，和左边的女孩形成对称；
   主体变宽变窄时它跟着走，不会钻到侧栏底下 */
.cosmos-galaxy-photo{
  left:calc(50% + var(--shell-max, 1080px) / 2 + 20px);right:auto;top:30%;
  width:clamp(360px,30vw,640px);opacity:.9;z-index:0;
}
/* 左侧星环行星 */
.cosmos-saturn-photo{
  --sat-w:clamp(160px,14vw,240px);
  left:1vw;top:5%;width:var(--sat-w);opacity:.94;z-index:3;
  filter:brightness(1.42) contrast(1.08) drop-shadow(0 0 30px rgba(120,160,255,.30));
}
/* 少女插画：以 2560 为基准等比缩放。
   2560 下图宽 789px = 视口 30.82%；JS 按这个比例写入 --girl-width，
   内容区也按同比例缩小，所以左侧留白始终容得下，任何分辨率都完整显示。 */
.cosmos-girl-photo{
  left:auto;
  right:var(--girl-right, calc(50vw + 540px - 62px));
  top:6%;
  width:var(--girl-width, 30.82vw);
  max-width:820px;
  opacity:.95;z-index:2;
  transform:none;
  filter:drop-shadow(0 0 26px rgba(120,150,255,.28));
}

/* 土星更靠内，先收；女孩在内容区过窄时（<1400）才隐藏 */
@media (max-width:1900px){
  .cosmos-saturn-photo{display:none}
  .cosmos-galaxy-photo{opacity:.55}
}
@media (max-width:1399px){
  .cosmos-girl-photo{display:none}
  .cosmos-galaxy-photo{opacity:.3}
}
@media (max-width:1023px){
  .cosmos-galaxy-photo{left:auto;right:-12vw;top:42%;width:min(70vw,420px);opacity:.22}
}

/* ---------- 星空配色（新版变量） ---------- */
:root[data-theme="star"]{
  color-scheme:dark;
  --bg:#03091A;
  --card:rgba(6,16,38,.62);
  --card-solid:rgba(8,20,46,.86);
  --text:#EAF2FF;
  --text-2:#B6CBE8;
  --text-3:#8FA6CC;
  --line:rgba(126,170,250,.20);
  --brand:#FF5C72;
  --brand-soft:rgba(28,60,116,.46);
  --shadow:0 8px 34px rgba(0,6,26,.48);
  --glass:blur(13px) saturate(140%);
}
/* body 只给纯色：一旦用渐变，它会按 scrollHeight 拉伸，
   首页 33054px 与日历 1264px 下同一个渐变会显示成完全不同的颜色（视觉上的"跳动"） */
:root[data-theme="star"]{background:#03091A}
:root[data-theme="star"] body{background:#03091A}
:root[data-theme="star"] .app{background:transparent}
:root[data-theme="star"] .cal-card,
:root[data-theme="star"] .forum-tile,
:root[data-theme="star"] .profile-card,
:root[data-theme="star"] .article,
:root[data-theme="star"] .replies,
:root[data-theme="star"] .mine-list,
:root[data-theme="star"] .navbar,
:root[data-theme="star"] .topbar,
:root[data-theme="star"] .composer,
:root[data-theme="star"] .tabbar{
  backdrop-filter:blur(13px) saturate(140%);
  -webkit-backdrop-filter:blur(13px) saturate(140%);
  background:var(--card);
  box-shadow:0 8px 34px rgba(0,6,26,.42),inset 0 1px 0 rgba(150,195,255,.07);
}
:root[data-theme="star"] .topbar,
:root[data-theme="star"] .navbar,
:root[data-theme="star"] .tabbar{
  background:rgba(6,16,38,.78);
  border-color:rgba(126,170,250,.16);
}
/* 星空：composer 是一张独立的浮起卡片，比外层实，输入框再亮一档 + 蓝描边 */
:root[data-theme="star"] .composer{
  background:rgba(7,18,40,.96);
  border-color:rgba(126,170,250,.30);
}
:root[data-theme="star"] .tb-search{background:rgba(12,28,60,.62)}
:root[data-theme="star"] .composer .fake{
  background:rgba(126,170,250,.12);
  border-color:rgba(126,170,250,.34);
  box-shadow:inset 0 1px 4px rgba(0,0,0,.22);
}
:root[data-theme="star"] .chip{background:rgba(20,40,80,.58);color:#B6CBE8}
:root[data-theme="star"] .mine-item,
:root[data-theme="star"] .reply{border-color:rgba(126,170,250,.10)}
:root[data-theme="star"] .profile-hero{
  background:linear-gradient(135deg,#1B3B6E,#0A1E3E 60%,#040C22);
}
:root[data-theme="star"] .ft-item i{background:rgba(126,170,250,.3)}

/* ---------- 深色模式 ---------- */
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0E1116;
  --card:#171A21;
  --card-solid:#1B1F27;
  --text:#E7EAF1;
  --text-2:#A5ADBE;
  --text-3:#6C7488;
  --line:#252A34;
  --brand:#FF5C72;
  --brand-soft:rgba(255,36,66,.16);
  --shadow:0 4px 18px rgba(0,0,0,.32);
}
:root[data-theme="dark"] body{background:#0E1116}
:root[data-theme="dark"] .app{background:#0E1116}
:root[data-theme="dark"] .tb-search{background:#22262F}
/* 深色：外壳不能再是白色（app.css 默认），否则白壳包黑框很突兀 */
:root[data-theme="dark"] .composer{
  background:#171A21;
  border-color:#2A303C;
}
:root[data-theme="dark"] .composer .fake{
  background:#22262F;
  border-color:#333A48;
}
:root[data-theme="dark"] .chip{background:#22262F;color:#A5ADBE}
:root[data-theme="dark"] .mine-item,
:root[data-theme="dark"] .reply{border-color:#22262F}
:root[data-theme="dark"] .profile-hero{
  background:linear-gradient(135deg,#3A1522,#22111A 60%,#140C10);
}
:root[data-theme="dark"] .forum-tile,
:root[data-theme="dark"] .profile-card{box-shadow:0 4px 18px rgba(0,0,0,.28)}

/* 主题平滑过渡 */
body,.forum-tile,.profile-card,.article,.replies,.mine-list,
.navbar,.topbar,.composer,.tabbar,.tb-search,
.chip,.reply,.mine-item,
.site-hd,.m-hd,.feed-panel,.feed-head{
  transition:background-color .55s ease,color .55s ease,
             border-color .55s ease,box-shadow .55s ease;
}

/* 动态特效：闪烁星点 + 流星（与 lulu 一致） */
.cosmos-twinkle,.cosmos-meteors{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.cosmos-meteors{z-index:4}
.cosmos-twinkle .tw{
  position:absolute;border-radius:50%;background:rgb(var(--tc));
  box-shadow:0 0 5px 1px rgba(var(--tc),.6);opacity:.25;
  animation:tw-star ease-in-out infinite alternate;
}
@keyframes tw-star{from{opacity:.10;transform:scale(.6)}to{opacity:.92;transform:scale(1.28)}}
.cosmos-twinkle .tw.bright::before,
.cosmos-twinkle .tw.bright::after{content:"";position:absolute;background:rgba(var(--tc),.7)}
.cosmos-twinkle .tw.bright::before{left:-6px;top:50%;width:14px;height:1px;transform:translateY(-50%)}
.cosmos-twinkle .tw.bright::after{top:-6px;left:50%;width:1px;height:14px;transform:translateX(-50%)}
.meteor{
  position:absolute;width:var(--mlen);height:2px;border-radius:2px;
  background:linear-gradient(90deg,transparent,rgba(170,205,255,.22) 40%,rgba(236,246,255,1) 100%);
  filter:drop-shadow(0 0 8px rgba(190,220,255,.95));opacity:0;
  animation:meteor-fly var(--mdur) cubic-bezier(.28,.08,.62,1) forwards;
}
.meteor::after{
  content:"";position:absolute;right:-1px;top:-2px;width:5px;height:5px;
  border-radius:50%;background:#fff;box-shadow:0 0 12px 3px rgba(210,232,255,.95);
}
@keyframes meteor-fly{
  0%{opacity:0;transform:translate3d(0,0,0) rotate(var(--mrot)) translateX(-24px)}
  14%{opacity:1}
  82%{opacity:.9}
  100%{opacity:0;transform:translate3d(var(--mdx),var(--mdy),0) rotate(var(--mrot)) translateX(0)}
}
@media (prefers-reduced-motion:reduce){
  .cosmos-twinkle .tw{animation:none;opacity:.6}
  .meteor{display:none}
}

/* 主题切换按钮 */
.theme-btn{
  width:34px;height:34px;border-radius:50%;display:grid;place-items:center;
  color:var(--text-2);flex:none;
}
.theme-btn:hover{background:rgba(255,255,255,.08)}
.theme-btn svg{width:19px;height:19px}

/* 详情页正文：更实的卡片底 + 更亮的正文色，保证星空下长文可读 */
:root[data-theme="star"] .article,
:root[data-theme="star"] .replies{background:rgba(9,20,44,.94)}
:root[data-theme="star"] .article .body,
:root[data-theme="star"] .reply .rt{color:#EEF5FF}
:root[data-theme="star"] .article .body p,
:root[data-theme="star"] .reply .rt p{color:inherit}

/* 固定层缓慢漂移，星空有呼吸感 */
:root[data-theme="star"] .cosmos-sky{animation:star-drift 90s ease-in-out infinite alternate}
@keyframes star-drift{from{transform:scale(1.02) translate3d(0,0,0)}to{transform:scale(1.07) translate3d(-1.2%,-1%,0)}}
@media (prefers-reduced-motion:reduce){:root[data-theme="star"] .cosmos-sky{animation:none}}


/* ============================================================
   star skin : full theme for star mode only
   ============================================================ */
/* 提权到 html:root，压过后加载的 layout.css 同名变量 */
html:root[data-theme="star"]{
  --panel-bg:rgba(9,22,50,.72);
  --panel-head:rgba(12,28,62,.80);
  --panel-line:rgba(126,170,250,.26);
  --row-hover:rgba(120,165,255,.10);
  --hd-bg:rgba(6,16,40,.72);
  --hd-line:rgba(126,170,250,.28);
  --input-bg:rgba(14,32,70,.62);
  --chip-bg:rgba(30,58,112,.52);
}

/* header */
/* 提权：layout.css 最后加载，单类选择器会盖掉这里的背景 */
/* PC 下 layout.css 把 .site-hd 背景设为透明 !important，
   真正的背景画在 .site-hd .shell 上，所以皮肤也落在 .shell */
:root[data-theme="star"] header.site-hd{
  position:sticky;
  box-shadow:0 6px 26px rgba(0,6,26,.42);
}
:root[data-theme="star"] header.site-hd .shell{
  background:linear-gradient(180deg,rgba(8,20,48,.90),rgba(8,20,48,.70)) !important;
  border-bottom:1px solid rgba(126,170,250,.30);
  box-shadow:inset 0 -1px 0 rgba(150,200,255,.10);
}
:root[data-theme="star"] header.site-hd .shell::after{
  content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(130,190,255,.55) 30%,rgba(190,150,255,.45) 70%,transparent);
  pointer-events:none;
}
:root[data-theme="star"] header.site-hd .shell{position:relative}
:root[data-theme="star"] .hd-logo{color:#EAF2FF;text-shadow:0 0 18px rgba(120,180,255,.35)}
:root[data-theme="star"] .hd-logo i{
  background:linear-gradient(135deg,#5b7cff,#a45cff);
  box-shadow:0 4px 18px rgba(110,110,255,.5);
}
:root[data-theme="star"] .hd-nav a.on{color:#fff}
:root[data-theme="star"] .hd-nav a.on::after{
  background:linear-gradient(90deg,#6aa8ff,#c07bff);
  box-shadow:0 0 10px rgba(130,170,255,.7);
}
:root[data-theme="star"] .hd-search{
  background:rgba(14,32,70,.72);
  border:1px solid rgba(126,170,250,.24);
}
:root[data-theme="star"] .hd-search:focus-within{
  border-color:rgba(140,190,255,.65);
  box-shadow:0 0 0 3px rgba(110,160,255,.14),0 0 18px rgba(90,140,255,.20);
}
:root[data-theme="star"] .hd-icon:hover{background:rgba(126,170,250,.16);color:#fff}
:root[data-theme="star"] .hd-pub{
  background:linear-gradient(135deg,#6d7dff,#a855f7);
  box-shadow:0 6px 20px rgba(120,90,255,.38);
}
:root[data-theme="star"] .hd-login{
  background:rgba(126,170,250,.16);border:1px solid rgba(126,170,250,.26);color:#EAF2FF;
}
:root[data-theme="star"] .hd-me{box-shadow:0 0 0 2px rgba(140,190,255,.35)}

/* cards */
:root[data-theme="star"] .feed-panel,
:root[data-theme="star"] .article,
:root[data-theme="star"] .replies,
:root[data-theme="star"] .profile-card,
:root[data-theme="star"] .prof-card,
:root[data-theme="star"] .cal-card,
:root[data-theme="star"] .forum-tile,
:root[data-theme="star"] .mine-list,
:root[data-theme="star"] .composer{
  background:linear-gradient(160deg,rgba(14,32,70,.78),rgba(7,18,44,.80));
  border:1px solid rgba(126,170,250,.26);
  box-shadow:0 0 0 1px rgba(140,190,255,.07),0 16px 46px rgba(0,6,28,.58),
             inset 0 1px 0 rgba(160,205,255,.12);
  backdrop-filter:blur(16px) saturate(150%);
  -webkit-backdrop-filter:blur(16px) saturate(150%);
}
:root[data-theme="star"] .feed-head{
  background:linear-gradient(180deg,rgba(16,38,84,.55),transparent);
  border-bottom:1px solid rgba(126,170,250,.20);
}

/* list rows */
:root[data-theme="star"] .post-row{border-top:1px solid rgba(126,170,250,.13)}
:root[data-theme="star"] .post-row:hover{
  background:linear-gradient(90deg,rgba(110,160,255,.10),rgba(150,110,255,.05));
}
:root[data-theme="star"] .post-row.is-pin::before{
  background:linear-gradient(180deg,#7aa4ff,#b06cff);
  box-shadow:0 0 12px rgba(130,150,255,.6);
}
:root[data-theme="star"] .pr-title{color:#EDF4FF}
:root[data-theme="star"] .post-row:hover .pr-title{color:#B9D6FF}
:root[data-theme="star"] .tag.pin{
  background:linear-gradient(135deg,rgba(109,125,255,.28),rgba(168,85,247,.26));
  color:#DCE6FF;box-shadow:inset 0 0 0 1px rgba(150,170,255,.4);
}
:root[data-theme="star"] .tag.hot{
  background:rgba(255,159,46,.16);color:#FFD08A;
  box-shadow:inset 0 0 0 1px rgba(255,180,90,.3);
}

/* tabs / chips */
:root[data-theme="star"] .ftabs a.on{color:#fff}
:root[data-theme="star"] .ftabs a.on::after{
  background:linear-gradient(90deg,#6aa8ff,#c07bff);
  box-shadow:0 0 10px rgba(140,170,255,.6);height:3px;
}
:root[data-theme="star"] .fsort button.on{
  background:linear-gradient(135deg,rgba(109,125,255,.30),rgba(168,85,247,.24));
  color:#fff;border-color:rgba(150,170,255,.35);
}
:root[data-theme="star"] .chip{
  background:rgba(30,58,112,.58);color:#C6D9F5;
  border:1px solid rgba(126,170,250,.18);
}

/* inputs */
:root[data-theme="star"] .pf input,
:root[data-theme="star"] .pf select,
:root[data-theme="star"] .pf textarea{
  background:rgba(12,30,66,.66);
  border:1px solid rgba(126,170,250,.24);
  color:#EAF2FF;
}
:root[data-theme="star"] .pf input:focus,
:root[data-theme="star"] .pf select:focus,
:root[data-theme="star"] .pf textarea:focus{
  border-color:rgba(140,190,255,.65);
  box-shadow:0 0 0 3px rgba(110,160,255,.13),0 0 20px rgba(90,140,255,.16);
}
:root[data-theme="star"] .pf select option{background:#101c38;color:#E7EEFF}

/* buttons */
:root[data-theme="star"] .prof-save,
:root[data-theme="star"] .auth-submit{
  background:linear-gradient(135deg,#6d7dff,#a855f7);
  box-shadow:0 8px 24px rgba(120,90,255,.35);
}
:root[data-theme="star"] .prof-save:hover,
:root[data-theme="star"] .auth-submit:hover{filter:brightness(1.1)}
:root[data-theme="star"] .pv-btn,
:root[data-theme="star"] .crop-zoom button{
  background:rgba(30,58,112,.62);border:1px solid rgba(126,170,250,.22);color:#D6E5FF;
}
:root[data-theme="star"] .crop-ok{
  background:linear-gradient(135deg,#7aa4ff,#b06cff);color:#0a1230;
}

/* profile page */
/* 注意：这里不用 background 简写 —— 简写会把用户上传背景图的
   background-size/position 重置成 auto，导致图片只显示原始大小的一块。
   改为分层设置：颜色 + 星云（仅当没有用户图时叠加），尺寸交给通用规则。 */
:root[data-theme="star"] .prof-hero{
  background-color:#071530;
  background-image:
    radial-gradient(ellipse 60% 90% at 20% 20%,rgba(90,120,255,.28),transparent 70%),
    radial-gradient(ellipse 50% 80% at 85% 75%,rgba(150,80,230,.22),transparent 72%),
    url(../img/stars-bg.webp);
  background-position:center,center,center 55%;
  background-size:auto,auto,cover;
  background-repeat:no-repeat;
  border-bottom:1px solid rgba(126,170,250,.28);
  box-shadow:inset 0 -30px 50px rgba(4,12,32,.55);
}
/* 用户上传了背景图时（内联 background-image），隐藏装饰性星云层 */
:root[data-theme="star"] .prof-hero[style*="background-image"]{
  background-size:cover !important;
  background-position:center !important;
  background-repeat:no-repeat !important;
}
:root[data-theme="star"] .prof-av{
  border:3px solid rgba(20,40,84,.95);
  box-shadow:0 0 0 1px rgba(150,190,255,.4),0 0 24px rgba(110,150,255,.35);
}
:root[data-theme="star"] .prof-av-edit{
  background:linear-gradient(135deg,#6d7dff,#a855f7);
}
:root[data-theme="star"] .prof-hero-btn{
  background:rgba(10,26,58,.78);border:1px solid rgba(150,190,255,.35);color:#E6F0FF;
}
:root[data-theme="star"] .prof-hero-btn:hover{background:rgba(20,44,92,.9)}

/* dialogs / bars / scrollbar */
:root[data-theme="star"] .crop-box,
:root[data-theme="star"] .auth-card,
:root[data-theme="star"] .theme-menu{
  background:linear-gradient(160deg,rgba(16,36,78,.96),rgba(8,20,48,.97));
  border:1px solid rgba(126,170,250,.32);
  box-shadow:0 24px 70px rgba(0,4,20,.7),inset 0 1px 0 rgba(160,205,255,.13);
}
:root[data-theme="star"] .tabbar,
:root[data-theme="star"] .m-hd{
  background:rgba(7,18,44,.88);
  border-color:rgba(126,170,250,.26);
}
:root[data-theme="star"] .list-foot,
:root[data-theme="star"] .pc-nums{border-color:rgba(126,170,250,.18)}
:root[data-theme="star"] ::-webkit-scrollbar{width:10px;height:10px}
:root[data-theme="star"] ::-webkit-scrollbar-track{background:rgba(4,12,32,.5)}
:root[data-theme="star"] ::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,rgba(100,140,230,.55),rgba(150,100,220,.5));
  border-radius:8px;border:2px solid rgba(4,12,32,.6);
}
:root[data-theme="star"] ::selection{background:rgba(120,150,255,.35);color:#fff}


/* ============================================================
   star skin extra : profile form + mine list rows
   ============================================================ */

/* 资料编辑卡片整体再提一层质感 */
:root[data-theme="star"] .prof-card{
  background:
    radial-gradient(ellipse 70% 40% at 15% 0%,rgba(80,110,220,.14),transparent 70%),
    linear-gradient(160deg,rgba(16,36,78,.82),rgba(7,18,44,.86));
  border:1px solid rgba(126,170,250,.30);
  box-shadow:0 0 0 1px rgba(140,190,255,.08),0 20px 54px rgba(0,6,28,.66),
             inset 0 1px 0 rgba(160,205,255,.16);
}
:root[data-theme="star"] .pf>span{
  color:#B9D2F5;letter-spacing:.4px;
}
:root[data-theme="star"] .pf input::placeholder,
:root[data-theme="star"] .pf textarea::placeholder{color:#7E96BC}
:root[data-theme="star"] .prof-av-tx b{color:#F0F6FF;text-shadow:0 0 14px rgba(120,170,255,.3)}
:root[data-theme="star"] .prof-av-tx span{color:#9FB7DE}
:root[data-theme="star"] .prof-foot{border-top:1px solid rgba(126,170,250,.22)}

/* 「发布帖子 / 切换旧版 / 退出登录」这类菜单行 */
:root[data-theme="star"] .mine-list{
  background:
    radial-gradient(ellipse 60% 100% at 0% 0%,rgba(70,100,210,.12),transparent 72%),
    linear-gradient(160deg,rgba(14,32,70,.78),rgba(7,18,44,.82));
  border:1px solid rgba(126,170,250,.26);
  box-shadow:0 0 0 1px rgba(140,190,255,.07),0 14px 40px rgba(0,6,28,.55),
             inset 0 1px 0 rgba(160,205,255,.12);
  overflow:hidden;
}
:root[data-theme="star"] .mine-item{
  background:transparent;
  border-bottom:1px solid rgba(126,170,250,.14);
  color:#DCE9FF;
  transition:background .2s ease;
}
:root[data-theme="star"] .mine-item:last-child{border-bottom:0}
:root[data-theme="star"] .mine-item:hover{
  background:linear-gradient(90deg,rgba(110,160,255,.14),rgba(150,110,255,.06));
}
:root[data-theme="star"] .mine-item .mi{
  background:linear-gradient(135deg,rgba(109,125,255,.30),rgba(168,85,247,.24));
  border:1px solid rgba(150,175,255,.30);
  color:#E6EEFF;
  box-shadow:0 3px 12px rgba(100,110,255,.25);
}
:root[data-theme="star"] .mine-item .mi svg{opacity:.95}
:root[data-theme="star"] .mine-item .arr{color:#8FA6CC}

/* 导航下拉 / 主题菜单项 */
:root[data-theme="star"] .theme-menu a,
:root[data-theme="star"] .theme-menu button{
  color:#DCE9FF;
}
:root[data-theme="star"] .theme-menu a:hover,
:root[data-theme="star"] .theme-menu button:hover{
  background:rgba(110,160,255,.14);
}
