/* ==========================================================
   霖霖英语 · 三主题样式系统
   星河战舰（默认）/ 乐高家园 / 现代时尚
   主题通过 html[data-theme=...] 切换；:root 默认即星河战舰。
   冷暖配比设计：星河战舰以暖金/珊瑚为交互主色（≥55%），
   深空底色仅作背景层，冷色调不超 50%。
   ========================================================== */
:root {
  /* ---- 结构（全主题共用） ---- */
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-en: "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 60px;

  /* ---- 星河战舰（默认主题）：暖金舰桥 · 星云透窗 · 冷色仅作极光点缀(<40%) ---- */
  color-scheme: light;
  --bg: #F7EFDF;
  --bg-alt: #EFE4CD;
  --surface: rgba(255, 251, 243, .84);
  --surface-2: rgba(255, 251, 243, .62);
  --fg: #33291A;
  --fg-2: #6B5C42;
  --fg-3: #9C8B6C;
  --line: rgba(196, 150, 70, .26);
  --line-2: rgba(196, 150, 70, .14);
  --primary: #F59E2B;
  --primary-soft: rgba(245, 158, 43, .16);
  --primary-deep: #C47A08;
  --accent: #F26B4A;
  --accent-soft: rgba(242, 107, 74, .15);
  --ok: #2FA36B;
  --ok-soft: rgba(47, 163, 107, .13);
  --warn: #E8A317;
  --warn-soft: rgba(232, 163, 23, .15);
  --danger: #E04E3C;
  --glass: rgba(253, 248, 239, .82);
  --mask: rgba(70, 45, 18, .38);
  --toast-bg: rgba(56, 40, 20, .93);
  --skel-hi: rgba(196, 150, 70, .14);
  --shadow: 0 2px 6px rgba(120, 85, 30, .12), 0 10px 28px rgba(120, 85, 30, .16);
  --shadow-lg: 0 6px 14px rgba(120, 85, 30, .14), 0 22px 50px rgba(120, 85, 30, .2);
  --hero-bg: linear-gradient(135deg, rgba(255, 246, 226, .88) 0%, rgba(255, 233, 200, .82) 60%, rgba(255, 216, 186, .82) 100%);
  --hero-line: rgba(196, 150, 70, .35);
  --hero-glow: rgba(242, 150, 70, .22);
}

/* ---- 乐高家园：奶油底 + 积木色块，暖色调 >80% ---- */
html[data-theme="lego"] {
  color-scheme: light;
  --bg: #FFF3DC;
  --bg-alt: #FFEBC2;
  --surface: #FFFFFF;
  --surface-2: #FFF8EA;
  --fg: #2B2318;
  --fg-2: #6B5D45;
  --fg-3: #A2916F;
  --line: #F0DDB4;
  --line-2: #F7EBD0;
  --primary: #F59E0B;
  --primary-soft: #FEF3D7;
  --primary-deep: #C77E08;
  --accent: #E4572E;
  --accent-soft: #FDE7DF;
  --ok: #3FA34D;
  --ok-soft: #E4F4E4;
  --warn: #F5B700;
  --warn-soft: #FDF2D2;
  --danger: #D7263D;
  --glass: rgba(255, 250, 238, .92);
  --mask: rgba(43, 35, 24, .45);
  --toast-bg: rgba(43, 35, 24, .94);
  --skel-hi: rgba(245, 158, 11, .12);
  --shadow: 0 3px 0 rgba(190, 150, 70, .18), 0 6px 16px rgba(190, 150, 70, .14);
  --shadow-lg: 0 5px 0 rgba(190, 150, 70, .2), 0 16px 36px rgba(190, 150, 70, .2);
  --hero-bg: linear-gradient(135deg, #FFF6E0 0%, #FFE9BC 55%, #FFDFB0 100%);
  --hero-line: #F0DDB4;
  --hero-glow: rgba(229, 87, 46, .12);
}

/* ---- 现代时尚：米白象牙 + 活力橙，暖色调 >85% ---- */
html[data-theme="modern"] {
  color-scheme: light;
  --bg: #FAF7F0;
  --bg-alt: #F3EEE4;
  --surface: #FFFFFF;
  --surface-2: #FDFBF7;
  --fg: #23231F;
  --fg-2: #5A574E;
  --fg-3: #918B7E;
  --line: #E9E2D4;
  --line-2: #F2EDE2;
  --primary: #E8823C;
  --primary-soft: #FDF0E4;
  --primary-deep: #C46526;
  --accent: #E0603C;
  --accent-soft: #FCEBE6;
  --ok: #4FA97C;
  --ok-soft: #E8F5EE;
  --warn: #D9A441;
  --warn-soft: #FBF2DF;
  --danger: #C9503C;
  --glass: rgba(250, 247, 240, .86);
  --mask: rgba(35, 30, 20, .4);
  --toast-bg: rgba(35, 35, 31, .94);
  --skel-hi: rgba(232, 130, 60, .08);
  --shadow: 0 2px 4px rgba(60, 50, 30, .04), 0 8px 24px rgba(60, 50, 30, .07);
  --shadow-lg: 0 4px 8px rgba(60, 50, 30, .06), 0 18px 44px rgba(60, 50, 30, .11);
  --hero-bg: linear-gradient(135deg, #FFF9EF 0%, #FDEEE0 55%, #FCE8DF 100%);
  --hero-line: #F0E2CE;
  --hero-glow: rgba(232, 130, 60, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; padding:0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---------- 主题背景层（::before = 主题背景图，::after = 可读纱 + 极光/星尘动效） ---------- */
body::before, body::after {
  content:''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
/* 星河战舰：星云战舰背景图（朦胧虚化 + 降饱和 + 提亮 + 淡化，避免喧宾夺主）
   参数可独立微调：blur 虚化 / saturate 鲜艳度 / brightness 明度 / opacity 存在感 */
html[data-theme="starship"] body::before {
  background: url('/img/bg-starship.jpg') center / cover no-repeat;
  inset: -20px; /* 外扩抵消 blur 边缘，避免露出底色 */
  filter: blur(5px) saturate(.58) brightness(1.14) opacity(.42);
}
/* 星河战舰：极光流动纱 + 少量星尘，兼顾文字可读性 */
html[data-theme="starship"] body::after {
  background:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 250, 235, .9), transparent 60%),
    radial-gradient(1.4px 1.4px at 38% 10%, rgba(255, 250, 235, .7), transparent 60%),
    radial-gradient(1.8px 1.8px at 66% 22%, rgba(255, 240, 210, .8), transparent 60%),
    radial-gradient(1.4px 1.4px at 86% 12%, rgba(255, 250, 235, .7), transparent 60%),
    radial-gradient(1.6px 1.6px at 24% 40%, rgba(255, 240, 210, .6), transparent 60%),
    radial-gradient(1.4px 1.4px at 76% 44%, rgba(255, 250, 235, .55), transparent 60%),
    linear-gradient(115deg, rgba(64, 215, 182, .09) 0%, transparent 28%, rgba(255, 190, 80, .10) 52%, transparent 76%, rgba(110, 150, 235, .07) 100%),
    linear-gradient(180deg, rgba(255, 248, 236, .42) 0%, rgba(255, 248, 236, .16) 42%, rgba(255, 248, 236, .46) 100%);
  animation: auroraflow 9s ease-in-out infinite alternate;
}
@keyframes auroraflow {
  0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; opacity: .92; }
  50% { opacity: 1; }
  100% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 100% 0, 0 0; opacity: .96; }
}
/* 乐高家园：积木小镇背景图（原图高饱和，降得更重一些） */
html[data-theme="lego"] body::before {
  background: url('/img/bg-lego.jpg') center / cover no-repeat;
  inset: -20px;
  filter: blur(5px) saturate(.5) brightness(1.16) opacity(.36);
}
html[data-theme="lego"] body::after {
  background: linear-gradient(180deg, rgba(255, 250, 238, .42) 0%, rgba(255, 250, 238, .14) 45%, rgba(255, 250, 238, .5) 100%);
}
/* 现代时尚：丝绸流光背景图 */
html[data-theme="modern"] body::before {
  background: url('/img/bg-modern.jpg') center / cover no-repeat;
}
html[data-theme="modern"] body::after {
  background: linear-gradient(180deg, rgba(250, 247, 240, .38) 0%, rgba(250, 247, 240, .12) 45%, rgba(250, 247, 240, .45) 100%);
}

#app { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 18px); }
@media (min-width: 900px) { #app { max-width: 960px; } }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary-deep); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  margin: 0 -16px 14px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.topbar .brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; display: flex; align-items: center; gap: 7px; }
.topbar .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--accent)); box-shadow: 0 0 0 3px var(--primary-soft); }
.topbar .sub { color: var(--fg-3); font-size: 12px; }
.topbar .spacer { flex: 1; }
.iconbtn {
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg-2);
  font-size: 13px; font-weight: 500;
}
.iconbtn:active { transform: scale(.96); }
.iconbtn.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card.tight { padding: 14px; }
.card-title { font-size: 13px; color: var(--fg-3); font-weight: 600; letter-spacing: .6px; margin: 0 0 12px; text-transform: uppercase; display:flex; align-items:center; gap:8px; }
.card-title::before { content:''; width:3px; height:13px; border-radius:2px; background: linear-gradient(180deg,var(--primary),var(--accent)); }

/* ---------- 今日页 ---------- */
.hero {
  background: var(--hero-bg);
  border: 1px solid var(--hero-line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.hero::after {
  content:''; position:absolute; right:-30px; top:-30px; width:150px; height:150px; border-radius:50%;
  background: radial-gradient(circle, var(--hero-glow), transparent 70%);
}
.hero .hi { font-size: 19px; font-weight: 700; margin: 0 0 3px; }
.hero .quote { font-size: 13px; color: var(--fg-2); margin: 0 0 16px; }
.hero-row { display: flex; align-items: center; gap: 18px; position: relative; }
.ring-wrap { position: relative; width: 88px; height: 88px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); display: block; }
.ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-txt b { font-size: 22px; line-height: 1; font-family: var(--font-en); }
.ring-txt span { font-size: 10px; color: var(--fg-3); }
.hero-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 14px; flex: 1; }
.hstat b { display: block; font-size: 17px; font-family: var(--font-en); line-height: 1.25; }
.hstat span { font-size: 11px; color: var(--fg-3); }

.streak-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-radius: 999px; padding: 5px 13px; font-size: 12px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(224,96,60,.28);
}

/* ---------- 统计瓦片 ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px,1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 13px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 22px; font-family: var(--font-en); line-height: 1.15; color: var(--fg); }
.tile span { font-size: 11px; color: var(--fg-3); }
.tile.warn b { color: var(--accent); }
.tile.ok b { color: var(--ok); }
.tile.primary b { color: var(--primary-deep); }

/* ---------- 任务列表 ---------- */
.tasklist { display: flex; flex-direction: column; gap: 9px; }
.task {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); text-align: left; width: 100%;
}
.task:active { transform: scale(.99); }
.task .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.task .tx { flex: 1; min-width: 0; }
.task .tx b { display: block; font-size: 14px; font-weight: 600; }
.task .tx span { font-size: 11.5px; color: var(--fg-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .go { color: var(--fg-3); font-size: 17px; flex-shrink: 0; }

/* ---------- 学习卡 ---------- */
.study { text-align: center; padding: 6px 0 0; }
.study .word { font-family: var(--font-en); font-size: 32px; font-weight: 650; letter-spacing: -.3px; margin: 12px 0 4px; word-break: break-word; }
.study .ipa { font-family: var(--font-en); color: var(--fg-3); font-size: 15px; }
.study .pos { display: inline-block; font-size: 11px; color: var(--primary-deep); background: var(--primary-soft); border-radius: 6px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.study .mean { font-size: 17px; margin: 14px 0 0; line-height: 1.7; }
.study .divider { height: 1px; background: var(--line-2); margin: 18px 0; }
.study .coll { text-align: left; margin: 10px 0 0; padding: 0; list-style: none; }
.study .coll li { font-size: 13.5px; color: var(--fg-2); padding: 5px 0 5px 16px; position: relative; line-height: 1.6; }
.study .coll li::before { content:'▸'; position: absolute; left: 0; color: var(--primary); }
.study .sent { text-align: left; margin: 12px 0 0; padding: 11px 13px; background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.study .sent .en { font-family: var(--font-en); font-size: 13.5px; line-height: 1.65; }
.study .sent .zh { font-size: 12.5px; color: var(--fg-3); margin-top: 4px; }
.study .sent .kind { display:inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); margin-bottom: 5px; }
.study .deriv { text-align:left; margin-top:10px; font-size:13px; color: var(--fg-2); }
.study .deriv span { display:inline-block; margin: 3px 6px 3px 0; padding: 2px 8px; background: var(--ok-soft); color: var(--ok); border-radius: 6px; font-size: 12px; }
.src-line { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--fg-3); text-align: left; line-height: 1.7; word-break: break-all; }
.src-line b { color: var(--fg-2); font-weight: 600; }

.speak-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-deep); font-size: 13px; font-weight: 600;
}
.speak-btn:active { transform: scale(.96); }
.speak-btn.speaking { background: var(--primary); color: #fff; }

/* ---------- 反馈按钮 ---------- */
.feedback { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 16px; }
.fb {
  min-height: 48px; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; gap: 1px; color: var(--fg-2);
}
.fb small { font-size: 10px; font-weight: 400; color: var(--fg-3); }
.fb:active { transform: scale(.96); }
.fb.again { border-color: #F0C4BC; background: var(--accent-soft); color: var(--accent); }
.fb.hard  { border-color: #EDD9AE; background: var(--warn-soft); color: #A87C1E; }
.fb.good  { border-color: #B9E0CC; background: var(--ok-soft); color: var(--ok); }
.fb.easy  { border-color: #C4D9F0; background: #EDF3FA; color: #3E6EA8; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--fg-3); font-size: 10.5px; min-height: 44px; position: relative;
  filter: grayscale(1); opacity: .48; transition: filter .22s, opacity .22s, transform .18s;
}
.tabbar button .ti { font-size: 19px; line-height: 1; transition: transform .18s; }
/* 选中项：彩色 + 轻微发光 + 上浮，明确表示"正在工作" */
.tabbar button.on {
  color: var(--primary-deep); font-weight: 700;
  filter: grayscale(0); opacity: 1;
}
.tabbar button.on .ti { transform: translateY(-2px) scale(1.16); filter: drop-shadow(0 2px 5px rgba(245,158,43,.55)); }
.tabbar button.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px rgba(245,158,43,.6);
}
.tabbar button .badge {
  position: absolute; top: 6px; left: 50%; margin-left: 5px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- 徽章墙 ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill,minmax(84px,1fr)); gap: 10px; }
.badge-item { text-align: center; padding: 13px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.badge-item.locked { opacity: .42; filter: grayscale(1); }
.badge-item .ic { font-size: 30px; line-height: 1.1; }
.badge-item .nm { font-size: 11.5px; font-weight: 600; margin-top: 5px; }
.badge-item .ds { font-size: 10px; color: var(--fg-3); line-height: 1.35; margin-top: 2px; }
.badge-item.gold { border-color: #EBD9A8; background: linear-gradient(160deg,#FFFDF6,#FDF6E4); }
.badge-item.silver { border-color: #D8DEE4; background: linear-gradient(160deg,#FCFDFE,#F4F7F9); }
.badge-item.platinum { border-color: #C8DCEF; background: linear-gradient(160deg,#FBFDFF,#EFF5FB); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; color: var(--fg-3); font-weight: 600; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--fg-2); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; font-size: 16px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 88px; resize: vertical; }
.btn {
  width: 100%; min-height: 48px; border-radius: var(--r-md); background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(232,130,60,.3);
  position: relative; overflow: hidden;
}
/* 主按钮流光扫过（全主题通用，星河下最明显） */
.btn::after {
  content:''; position:absolute; top:0; left:-70%; width:45%; height:100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.38), transparent);
  transform: skewX(-18deg);
  animation: btnshine 3.6s ease-in-out infinite;
  pointer-events: none;
}
.btn.ghost::after, .btn.danger::after { display:none; }
@keyframes btnshine { 0%, 55% { left:-70% } 85%, 100% { left:140% } }
.btn:active { transform: scale(.985); }
.btn.ghost { background: var(--surface); color: var(--fg-2); border: 1.5px solid var(--line); box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: 0 4px 14px rgba(201,80,60,.28); }
.btn.sm { min-height: 38px; font-size: 13px; width: auto; padding: 0 16px; }

/* ---------- 筛选 chips ---------- */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg-2);
  font-size: 13px; display: inline-flex; align-items: center;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #241a08; font-weight: 600; }
html[data-theme="modern"] .chip.on { color: #fff; }
html[data-theme="lego"] .chip.on { color: #fff; }
.chip .cnt { opacity: .7; font-size: 11px; margin-left: 3px; }

/* ---------- 管理端筛选：紧凑控件 ---------- */
.mini-select, .mini-input {
  min-height: 36px; padding: 6px 10px; font-size: 12.5px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  outline: none; max-width: 100%;
}
.mini-select:focus, .mini-input:focus { border-color: var(--primary); }
.admin-group { margin-bottom: 4px; }
.admin-group > summary::-webkit-details-marker { display: none; }
.admin-group > summary::marker { display: none; }
.admin-group[open] > summary span:first-child { color: var(--primary-deep); }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60; background: var(--mask);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + var(--safe-b));
  max-height: 88vh; overflow-y: auto; animation: up .22s cubic-bezier(.2,.9,.3,1);
}
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
@keyframes fade { from { opacity:0 } }
@keyframes up { from { transform: translateY(24px); opacity:.5 } }
@media (min-width: 700px) {
  .sheet-mask { align-items: center; }
  .sheet { border-radius: 24px; margin: 0 20px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); transform: translateX(-50%);
  z-index: 90; background: var(--toast-bg); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; max-width: 88vw; text-align: center; animation: toastin .22s; box-shadow: var(--shadow-lg);
}
@keyframes toastin { from { opacity:0; transform: translate(-50%, 10px) } }

/* ---------- 分享卡预览 ---------- */
.share-preview { width: 100%; border-radius: var(--r-md); box-shadow: var(--shadow-lg); display: block; }

/* ---------- 图表 ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--fg-2); margin-top: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ---------- 加载 ---------- */
.skel { background: linear-gradient(90deg,var(--bg-alt) 25%, var(--skel-hi) 50%, var(--bg-alt) 75%); background-size: 200% 100%; animation: shim 1.3s infinite; border-radius: var(--r-md); }
@keyframes shim { to { background-position: -200% 0 } }
.center { text-align: center; padding: 46px 20px; color: var(--fg-3); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg) } }

.empty { text-align: center; padding: 34px 20px; color: var(--fg-3); }
.empty .em { font-size: 40px; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13px; }

.tagrow { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: var(--bg-alt); color: var(--fg-2); }
.tag.pri { background: var(--primary-soft); color: var(--primary-deep); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }

.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--fg-3); font-size: 12.5px; }
.sec { margin: 22px 0 10px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sec .cnt { font-size: 11px; color: var(--fg-3); font-weight: 500; }
.err { background: var(--accent-soft); border: 1px solid #F3CFC6; color: var(--accent); padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; }
.ok-msg { background: var(--ok-soft); border: 1px solid #C6E6D6; color: var(--ok); padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; }
.hr { height: 1px; background: var(--line-2); margin: 16px 0; }
.mono { font-family: var(--font-en); font-variant-numeric: tabular-nums; }
.pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--bg-alt); color: var(--fg-2); }
.clickable { cursor: pointer; }
.link { color: var(--primary-deep); font-weight: 600; }

/* ---------- 测验选项 ---------- */
.options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  min-height: 50px; padding: 12px 15px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1.5px solid var(--line);
  text-align: left; font-size: 14.5px; line-height: 1.55; color: var(--fg);
  display: flex; align-items: center;
}
.opt:active { transform: scale(.99); }
.opt.sel { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
.opt.sel::after { content:'✓'; margin-left: auto; color: var(--primary-deep); font-weight: 700; }

/* ---------- 学习页进度条与居中舞台 ---------- */
.progressbar { height: 5px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progressbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .3s; }
.study.center-stage { padding-top: 40px; padding-bottom: 36px; }
.study.center-stage .word { font-size: 38px; margin: 18px 0 8px; }
.hint-line { margin-top: 22px; font-size: 13px; color: var(--fg-3); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 26px; padding: 16px 0 6px; text-align: center;
  font-size: 11px; color: var(--fg-3); line-height: 1.9;
  border-top: 1px solid var(--line-2);
}
.site-footer .foot-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.site-footer a { color: var(--fg-3); }

/* ==========================================================
   主题特效层
   ========================================================== */

/* ---------- 星河战舰（亮色舰桥：暖白玻璃 + 金色舰桥线 + 极光点缀） ---------- */
html[data-theme="starship"] .card {
  position: relative; overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(196, 150, 70, .3);
  box-shadow: 0 0 0 1px rgba(255, 244, 220, .35) inset, var(--shadow);
}
/* 卡片顶部金色舰桥流线 */
html[data-theme="starship"] .card::before {
  content:''; position:absolute; inset:0 0 auto 0; height:1.5px; pointer-events:none;
  background: linear-gradient(90deg, transparent 5%, rgba(245,158,43,.6) 30%, rgba(242,107,74,.5) 55%, rgba(64,190,180,.45) 80%, transparent 95%);
}
html[data-theme="starship"] .iconbtn {
  background: var(--surface); border-color: rgba(196, 150, 70, .35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
html[data-theme="starship"] .iconbtn:active { box-shadow: 0 0 14px rgba(245, 158, 43, .4); }
html[data-theme="starship"] .btn {
  background: linear-gradient(135deg, #FFC96E, #F59E2B 55%, #F26B4A);
  box-shadow: 0 0 20px rgba(245, 158, 43, .35), 0 4px 16px rgba(150, 95, 25, .28);
}
html[data-theme="starship"] .btn:active { box-shadow: 0 0 30px rgba(245, 158, 43, .55), 0 3px 10px rgba(150, 95, 25, .28); }
html[data-theme="starship"] .btn.ghost { background: var(--surface); color: var(--fg-2); border: 1px solid var(--line); box-shadow:none; }
html[data-theme="starship"] .hero { box-shadow: 0 0 26px rgba(242, 150, 70, .16) inset, var(--shadow); }
html[data-theme="starship"] .study .word { text-shadow: 0 2px 18px rgba(245, 158, 43, .35); }
html[data-theme="starship"] .progressbar { background: rgba(196, 150, 70, .18); }
html[data-theme="starship"] .progressbar i { box-shadow: 0 0 10px rgba(245, 158, 43, .65); }
html[data-theme="starship"] .tabbar button.on .ti { filter: drop-shadow(0 0 7px rgba(245, 158, 43, .8)); }
html[data-theme="starship"] .sheet {
  background: rgba(255, 250, 241, .92);
  border: 1px solid rgba(196, 150, 70, .35);
  box-shadow: 0 0 44px rgba(242, 150, 70, .14), var(--shadow-lg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
html[data-theme="starship"] .toast { border:1px solid rgba(245, 158, 43, .4); box-shadow: 0 0 22px rgba(245, 158, 43, .25), var(--shadow-lg); }
/* 星河下任务图标统一成暖光块（覆盖内联浅色底） */
html[data-theme="starship"] .task .ico { background: rgba(245, 158, 43, .16) !important; }
html[data-theme="starship"] .badge-item { backdrop-filter: blur(8px); }
html[data-theme="starship"] .badge-item.gold { border-color: rgba(224, 160, 60, .55); }
html[data-theme="starship"] .badge-item.silver { border-color: rgba(170, 175, 190, .5); }
html[data-theme="starship"] .badge-item.platinum { border-color: rgba(130, 175, 230, .5); }

/* ---------- 乐高家园 ---------- */
html[data-theme="lego"] .card { border: 2px solid #F0DDB4; }
html[data-theme="lego"] .task, html[data-theme="lego"] .tile, html[data-theme="lego"] .badge-item { border: 2px solid #F0DDB4; }
/* 顶部积木凸点 */
html[data-theme="lego"] .hero::before {
  content:''; position:absolute; top:5px; left:16px; right:16px; height:10px; pointer-events:none;
  background: radial-gradient(circle 4px at 5px 5px, rgba(224,150,50,.4) 3px, transparent 4px);
  background-size: 22px 10px; background-repeat: repeat-x;
}
html[data-theme="lego"] .btn {
  background: #F59E0B; border-radius: 14px;
  box-shadow: 0 5px 0 #C77E08, 0 8px 16px rgba(199,126,8,.25);
  transition: transform .08s, box-shadow .08s;
}
html[data-theme="lego"] .btn:active { transform: translateY(4px) scale(.99); box-shadow: 0 1px 0 #C77E08, 0 3px 8px rgba(199,126,8,.2); }
html[data-theme="lego"] .btn.danger { background:#D7263D; box-shadow: 0 5px 0 #9E1B2C, 0 8px 16px rgba(158,27,44,.25); }
html[data-theme="lego"] .btn.danger:active { box-shadow: 0 1px 0 #9E1B2C, 0 3px 8px rgba(158,27,44,.2); }
html[data-theme="lego"] .btn.ghost { background:#FFFDF6; color:#2B2318; border:2px solid #F0DDB4; box-shadow:0 4px 0 rgba(190,150,70,.18); }
html[data-theme="lego"] .btn.ghost:active { transform: translateY(3px); box-shadow:0 1px 0 rgba(190,150,70,.18); }
html[data-theme="lego"] .iconbtn { border:2px solid #F0DDB4; background:#FFFDF6; }
html[data-theme="lego"] .iconbtn:active { transform: translateY(2px); }
html[data-theme="lego"] .fb { border-width:2px; border-radius:14px; }
html[data-theme="lego"] .fb:active { transform: translateY(2px) scale(.98); }
html[data-theme="lego"] .task { box-shadow: 0 4px 0 rgba(190,150,70,.16); }
html[data-theme="lego"] .task:active { transform: translateY(2px); }
html[data-theme="lego"] .task .ico { border-radius: 10px; }
html[data-theme="lego"] .tabbar { background: rgba(255,253,246,.96); border-top: 3px solid #F0DDB4; }
html[data-theme="lego"] .tabbar button.on { color:#C77E08; }
html[data-theme="lego"] .tabbar button.on .ti { transform: translateY(-3px) scale(1.15); }
html[data-theme="lego"] .sheet { border: 3px solid #F0DDB4; border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); }
html[data-theme="lego"] .opt { border-width: 2px; background:#FFFDF6; }
html[data-theme="lego"] .opt.sel { background:#FEF3D7; border-color:#F59E0B; }
html[data-theme="lego"] .chip { border-radius: 10px; border-width:2px; background:#FFFDF6; }
html[data-theme="lego"] .chip.on { background:#F59E0B; border-color:#C77E08; color:#fff; }

/* ---------- 现代时尚（原版微调） ---------- */
html[data-theme="modern"] .btn { background: linear-gradient(135deg, #F08A48, #E0603C); }
html[data-theme="modern"] .task, html[data-theme="modern"] .iconbtn { transition: transform .1s, box-shadow .15s; }
html[data-theme="modern"] .task:hover, html[data-theme="modern"] .iconbtn:hover { box-shadow: var(--shadow-lg); }
html[data-theme="modern"] .hero { box-shadow: 0 10px 30px rgba(224,96,60,.08); }

/* ---------- 主题选择弹层 ---------- */
.theme-grid { display: flex; flex-direction: column; gap: 12px; }
.theme-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 14px; border-radius: var(--r-md); text-align: left;
  background: var(--surface-2); border: 2px solid var(--line);
}
.theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-card:active { transform: scale(.99); }
.theme-card .t-ic { font-size: 30px; flex-shrink: 0; }
.theme-card .t-tx { flex: 1; min-width: 0; }
.theme-card .t-tx b { display: block; font-size: 15px; }
.theme-card .t-tx span { font-size: 11.5px; color: var(--fg-3); }
.theme-card .t-sw { display: flex; gap: 4px; flex-shrink: 0; }
.theme-card .t-sw i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.5); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.theme-card .t-ok { color: var(--primary); font-weight: 700; font-size: 15px; flex-shrink: 0; }

/* ---------- 家长 / 管理员工作台：登录概览、站内消息、合理化建议 ---------- */
.work-hero { padding: 22px 22px 16px; }
.work-hero .hi { font-size: 20px; }
.work-hero .quote { margin-bottom: 0; }

.people-row { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.people-row:last-child { border-bottom: 0; padding-bottom: 0; }
.people-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 7px 10px; }
.people-stats span { font-size: 11.5px; color: var(--fg-3); }
.people-stats b { font-family: var(--font-en); font-size: 15px; color: var(--fg); margin-right: 3px; }

/* 消息：窄屏单列，宽屏左侧会话 + 右侧对话 */
.msg-wrap { display: flex; flex-direction: column; gap: 12px; }
.msg-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.msg-side-title { font-size: 11.5px; color: var(--fg-3); font-weight: 600; letter-spacing: .4px; }
.msg-contact {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 3px;
  padding: 10px 11px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface-2); cursor: pointer;
}
.msg-contact.on { border-color: var(--primary); background: var(--primary-soft); }
.msg-contact .mc-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.msg-contact .mc-last {
  font-size: 11.5px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: calc(100% - 22px);
}
.msg-contact .mc-unread {
  position: absolute; right: 10px; bottom: 9px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px;
  line-height: 18px; text-align: center;
}
.msg-main { min-width: 0; display: flex; flex-direction: column; }
.msg-head { font-size: 13px; color: var(--fg-2); padding: 4px 0 10px; border-bottom: 1px solid var(--line-2); }
.msg-list { min-height: 160px; max-height: 420px; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 9px; }
.msg-bubble { max-width: 86%; align-self: flex-start; background: var(--bg-alt); border-radius: 14px 14px 14px 4px; padding: 9px 12px; }
.msg-bubble.mine { align-self: flex-end; background: var(--primary-soft); border-radius: 14px 14px 4px 14px; }
.mb-body { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.mb-time { font-size: 10.5px; color: var(--fg-3); margin-top: 4px; }
.msg-compose { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line-2); }
.msg-compose textarea, #sug-body, #sug-title {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; outline: none; width: 100%;
}
.msg-compose textarea { flex: 1; min-height: 62px; resize: vertical; }
.msg-compose textarea:focus, #sug-body:focus, #sug-title:focus { border-color: var(--primary); }
.msg-compose .btn { flex-shrink: 0; }
@media (min-width: 700px) {
  .msg-wrap { flex-direction: row; }
  .msg-side { width: 220px; max-height: 460px; overflow-y: auto; }
  .msg-main { flex: 1; }
}

/* 建议 */
#sug-category { flex-shrink: 0; }
#sug-title { flex: 1; min-width: 160px; }
.sug-item { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.sug-item:last-child { border-bottom: 0; }
.sug-body { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.sug-reply { margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--ok-soft); font-size: 12.5px; }
.sug-handle { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.sug-handle input { flex: 1; min-width: 160px; }
.pill-warn { background: var(--warn-soft); color: var(--primary-deep); font-weight: 600; }
.notice-item { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.notice-item:last-child { border-bottom: 0; }
.notice-item.unread { background: var(--primary-soft); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }

/* ---------- 打卡日历 ---------- */
.cal-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.cal-top { display: flex; align-items: center; gap: 14px; }
.cal-big { text-align: center; min-width: 72px; }
.cal-big b { display: block; font-size: 38px; line-height: 1.05; font-family: var(--font-en); color: var(--primary-deep); }
.cal-big span { font-size: 11px; color: var(--fg-3); }
.cal-praise { flex: 1; min-width: 0; }
.cal-stage {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; margin-bottom: 5px;
}
.cal-praise p { margin: 0; font-size: 12.5px; color: var(--fg-2); line-height: 1.55; }
.cal-progress { margin-top: 13px; }
.cal-bar { height: 7px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.cal-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .35s ease; }
.cal-progress-txt { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-3); margin-top: 5px; }
.cal-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--fg-2);
  margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.cal-meta b { color: var(--fg); font-family: var(--font-en); }
.cal-today-ok { color: var(--ok); font-weight: 600; }
.cal-today-no { color: var(--accent); font-weight: 600; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; }
.cal-head b { font-size: 13.5px; letter-spacing: .5px; }
.cal-nav {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--fg-2); font-size: 16px; line-height: 1; cursor: pointer;
}
.cal-nav:active { background: var(--primary-soft); }
.cal-dows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 5px; }
.cal-dows span { text-align: center; font-size: 10.5px; color: var(--fg-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line-2); background: transparent;
}
.cal-day b { font-size: 12px; font-weight: 500; color: var(--fg-2); font-family: var(--font-en); }
.cal-day.blank { border-color: transparent; }
.cal-day.on { background: var(--primary-soft); border-color: var(--line); }
.cal-day.on b, .cal-day.today b { color: var(--primary-deep); font-weight: 700; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day.future { opacity: .42; }
.cal-dot { position: absolute; bottom: 4px; left: 50%; margin-left: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary-deep); }
.cal-cta {
  width: 100%; margin-top: 12px; padding: 11px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.cal-cta:active { transform: translateY(1px); }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn::after, body::before, body::after { animation: none !important; }
}
