/* ===========================================================
   日语酱 · 设计系统 v3 「Aurora Glass」
   极光渐变背景 + 玻璃浮层 + 弹性动效
   所有动画只跑 transform / opacity，吃满 120Hz ProMotion
   =========================================================== */

/* ---------------- 设计令牌 ---------------- */
:root {
  /* 色板 */
  --ink: #1c1930;
  --ink-2: #6e6a88;
  --ink-3: #9b96b0;
  --pink: #ff7eb3;
  --pink-l: #ffb3d1;
  --violet: #a78bfa;
  --cyan: #67e8f9;
  --mint: #6ee7b7;
  --amber: #fbbf24;
  --rose: #fb7185;
  --ok: #34d399;
  --danger: #fb7185;

  /* 渐变 */
  --g-main: linear-gradient(135deg, #ff7eb3 0%, #a78bfa 100%);
  --g-soft: linear-gradient(135deg, rgba(255,126,179,.16), rgba(167,139,250,.16));
  --g-cyan: linear-gradient(135deg, #67e8f9, #6ee7b7);
  --g-warm: linear-gradient(135deg, #fbbf24, #fb7185);

  /* 表面 */
  --bg: #f7f4ff;
  --bg-2: #efeafc;
  --surface: rgba(255, 255, 255, .74);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, .52);
  --line: rgba(28, 25, 48, .07);
  --line-2: rgba(255, 255, 255, .65);
  --blur: 22px;

  /* 阴影：多层叠加才有"浮起来"的质感 */
  --sh-1: 0 1px 2px rgba(28,25,48,.05), 0 4px 12px rgba(28,25,48,.06);
  --sh-2: 0 2px 6px rgba(28,25,48,.06), 0 12px 28px rgba(28,25,48,.09);
  --sh-3: 0 4px 12px rgba(28,25,48,.08), 0 24px 56px rgba(28,25,48,.13);
  --sh-glow: 0 10px 30px rgba(255,126,179,.32), 0 4px 12px rgba(167,139,250,.24);

  /* 圆角 */
  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 13px;
  --r-pill: 999px;

  /* 动效 */
  --e-spring: cubic-bezier(.34, 1.56, .64, 1);
  --e-out: cubic-bezier(.22, 1, .36, 1);
  --e-inout: cubic-bezier(.65, 0, .35, 1);
  --t-fast: .16s;
  --t-mid: .3s;
  --t-slow: .5s;

  --top-h: 58px;
  --tab-h: 66px;
}

/* 深色 */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --ink: #f4f2ff; --ink-2: #a9a3c2; --ink-3: #7d7796;
    --bg: #0d0a18; --bg-2: #16112a;
    --surface: rgba(32, 27, 54, .72);
    --surface-solid: #1b1630;
    --surface-2: rgba(255, 255, 255, .05);
    --line: rgba(255, 255, 255, .09);
    --line-2: rgba(255, 255, 255, .10);
    --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.35);
    --sh-2: 0 2px 6px rgba(0,0,0,.45), 0 12px 28px rgba(0,0,0,.45);
    --sh-3: 0 4px 12px rgba(0,0,0,.5), 0 24px 56px rgba(0,0,0,.55);
  }
}

/* 皮肤：只换主色与极光色，保持质感统一 */
html[data-skin="star"]    { --pink: #8b9cff; --pink-l: #b9c3ff; --violet: #c084fc; --g-main: linear-gradient(135deg,#8b9cff,#c084fc); --sh-glow: 0 10px 30px rgba(139,156,255,.34), 0 4px 12px rgba(192,132,252,.26); }
html[data-skin="matcha"]  { --pink: #4ade80; --pink-l: #a7f3c8; --violet: #34d399; --g-main: linear-gradient(135deg,#4ade80,#34d399); --sh-glow: 0 10px 30px rgba(74,222,128,.32), 0 4px 12px rgba(52,211,153,.24); }
html[data-skin="sunset"]  { --pink: #fb923c; --pink-l: #fdba74; --violet: #f472b6; --g-main: linear-gradient(135deg,#fb923c,#f472b6); --sh-glow: 0 10px 30px rgba(251,146,60,.32), 0 4px 12px rgba(244,114,182,.24); }
html[data-skin="ocean"]   { --pink: #38bdf8; --pink-l: #7dd3fc; --violet: #818cf8; --g-main: linear-gradient(135deg,#38bdf8,#818cf8); --sh-glow: 0 10px 30px rgba(56,189,248,.32), 0 4px 12px rgba(129,140,248,.24); }

/* ---------------- 基础 ---------------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, "SF Pro SC", "PingFang SC", "Hiragino Sans", "Noto Sans JP", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .01em;
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 极光背景：四团缓慢漂移的光斑 */
#aurora {
  position: fixed; inset: -20% -20% -20% -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(38% 30% at 18% 12%, rgba(255,126,179,.55), transparent 62%),
    radial-gradient(34% 28% at 86% 8%, rgba(167,139,250,.52), transparent 60%),
    radial-gradient(40% 32% at 78% 82%, rgba(103,232,249,.42), transparent 62%),
    radial-gradient(36% 30% at 8% 78%, rgba(110,231,183,.40), transparent 62%);
  filter: blur(22px) saturate(1.2);
  animation: aurora 26s var(--e-inout) infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2.5%, -2%, 0) scale(1.07); }
  100% { transform: translate3d(-2%, 2.5%, 0) scale(1.03); }
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 40%, var(--bg) 100%);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) #aurora { opacity: .5; }
}
html[data-theme="dark"] #aurora { opacity: .5; }

button, input, select, textarea { font: inherit; color: inherit; }
h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
b, strong { font-weight: 800; }
.dim { color: var(--ink-2); font-size: 13px; line-height: 1.62; }
.hidden { display: none !important; }
.en { font-size: 11px; opacity: .7; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- 顶栏 ---------------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  transition: height var(--t-mid) var(--e-out), background var(--t-mid);
  background: transparent;
}
#topbar.solid {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}
.tb-title {
  display: block; font-size: 21px; font-weight: 900; letter-spacing: -.02em;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tb-sub { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; transition: opacity var(--t-fast); }
#topbar.solid .tb-sub { opacity: .75; }
.tb-right { display: flex; gap: 9px; align-items: center; }

/* 通用图标按钮 */
.icon-btn {
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--r-sm); padding: 8px 11px; font-size: 15px;
  box-shadow: var(--sh-1); cursor: pointer; position: relative; overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast);
}
.icon-btn:active { transform: scale(.88); box-shadow: none; }

/* ---------------- 主体 ---------------- */
#main {
  padding: calc(var(--top-h) + env(safe-area-inset-top) + 10px) 16px
           calc(var(--tab-h) + env(safe-area-inset-bottom) + 26px);
  max-width: 580px; margin: 0 auto;
}
.view { display: none; }
.view.active { display: block; }
.view.active > * { animation: rise .52s var(--e-out) both; }
.view.active > *:nth-child(1) { animation-delay: .02s; }
.view.active > *:nth-child(2) { animation-delay: .07s; }
.view.active > *:nth-child(3) { animation-delay: .12s; }
.view.active > *:nth-child(4) { animation-delay: .17s; }
.view.active > *:nth-child(5) { animation-delay: .22s; }
.view.active > *:nth-child(6) { animation-delay: .27s; }
.view.active > *:nth-child(n+7) { animation-delay: .31s; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.985); }
  to   { opacity: 1; transform: none; }
}
/* 逐个入场的列表项 */
.stagger > * { animation: rise .5s var(--e-out) both; }

/* ---------------- 卡片 ---------------- */
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 17px; margin-bottom: 15px;
  box-shadow: var(--sh-2);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
}
/* 顶部高光，玻璃感的关键 */
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 34%);
  opacity: .9; mix-blend-mode: overlay;
}
html[data-theme="dark"] .card::after { opacity: .25; }

/* ---------------- 按钮 ---------------- */
.btn {
  position: relative; overflow: hidden;
  border: 0; border-radius: var(--r-md); padding: 13px 20px;
  font-weight: 800; font-size: 14.5px; letter-spacing: .01em;
  background: var(--surface-solid); color: var(--ink); box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast), filter var(--t-fast);
}
.btn:active { transform: scale(.95); box-shadow: none; }
.btn.primary { background: var(--g-main); color: #fff; box-shadow: var(--sh-glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.42) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 3.6s var(--e-inout) infinite;
}
@keyframes sheen { 0%, 62% { transform: translateX(-120%); } 92%, 100% { transform: translateX(120%); } }
.btn.ok { background: linear-gradient(135deg, #34d399, #6ee7b7); color: #06301f; }
.btn.danger { background: linear-gradient(135deg, #fb7185, #fda4af); color: #43060f; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--sh-1); }
.btn.small { padding: 9px 15px; font-size: 13px; border-radius: var(--r-sm); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* 水波纹 */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255,255,255,.55); transform: scale(0); opacity: .7;
  animation: ripple .58s var(--e-out) forwards;
}
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700;
  background: var(--g-main); color: #fff; box-shadow: 0 2px 8px rgba(167,139,250,.3);
}
.chip.soft { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; }

/* ---------------- 首页舞台 ---------------- */
.stage {
  position: relative; height: 300px; margin-bottom: 16px; border-radius: var(--r-xl);
  overflow: hidden; border: 1px solid var(--line-2); box-shadow: var(--sh-3);
  background:
    radial-gradient(120% 80% at 50% 6%, rgba(255,255,255,.9), rgba(255,255,255,.25) 55%, transparent 78%),
    linear-gradient(165deg, rgba(255,126,179,.30), rgba(167,139,250,.28) 52%, rgba(103,232,249,.24));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .stage {
    background: radial-gradient(120% 80% at 50% 6%, rgba(255,255,255,.10), transparent 60%),
                linear-gradient(165deg, rgba(255,126,179,.20), rgba(167,139,250,.22) 52%, rgba(103,232,249,.16));
  }
}
#live2d-box { position: absolute; inset: 0; }
#live2d-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.live2d-tip {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-2); font-size: 13px; pointer-events: none;
}
.bubble {
  position: absolute; left: 14px; top: 14px; max-width: 64%;
  padding: 10px 15px; border-radius: 18px 18px 18px 5px;
  background: var(--surface-solid); border: 1px solid var(--line-2);
  font-size: 12.5px; line-height: 1.5; box-shadow: var(--sh-2); z-index: 3;
  animation: bubbleIn .55s var(--e-spring);
}
@keyframes bubbleIn { from { opacity: 0; transform: translate3d(-6px,-10px,0) scale(.9); } to { opacity: 1; transform: none; } }
.char-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  border: 1px solid var(--line-2); width: 44px; height: 44px; border-radius: 16px;
  font-size: 19px; background: var(--surface); box-shadow: var(--sh-2); cursor: pointer;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform var(--t-fast) var(--e-spring);
}
.char-btn:active { transform: scale(.86) rotate(-8deg); }

/* 舞台上的浮动数据条 */
.float-stats {
  position: absolute; left: 14px; bottom: 14px; z-index: 3; display: flex; gap: 7px;
}
.fs-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 11px; border-radius: 14px; min-width: 54px;
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  border: 1px solid var(--line-2); box-shadow: var(--sh-1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.fs-chip b { font-size: 15px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fs-chip span { font-size: 9.5px; color: var(--ink-3); }

/* ---------------- 任务环 ---------------- */
.task-head { display: flex; gap: 18px; align-items: center; }
.ring-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.ring { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: var(--pink); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s var(--e-out);
  filter: drop-shadow(0 0 8px rgba(255,126,179,.75));
}
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 9.5px; color: var(--ink-3); display: block; letter-spacing: .08em; }
.task-info h3 { margin-bottom: 6px; }
.task-info p { margin: 4px 0; font-size: 13.5px; }
.task-info b { color: var(--pink); font-variant-numeric: tabular-nums; }
.task-actions { display: flex; gap: 11px; margin-top: 16px; }
.task-actions .btn { flex: 1; }

/* ---------------- 磁贴 ---------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 15px; }
.tile {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 16px;
  background: var(--surface); box-shadow: var(--sh-2);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  display: flex; flex-direction: column; gap: 4px;
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast);
}
.tile:active { transform: scale(.95); box-shadow: var(--sh-1); }
.tile-ico { font-size: 24px; line-height: 1; margin-bottom: 2px; }
.tile span { font-weight: 800; font-size: 15px; }
.tile em { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.tile::before {
  content: ""; position: absolute; right: -30%; top: -40%; width: 90%; height: 140%;
  background: var(--g-soft); border-radius: 50%; filter: blur(6px); opacity: .8;
}

/* ---------------- 番茄钟 ---------------- */
.pomo-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pomo-time {
  font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pomo-right { text-align: center; display: flex; flex-direction: column; gap: 7px; align-items: center; }
.tip-text { margin: 0; }

/* ---------------- 分段控件 ---------------- */
.seg {
  display: flex; gap: 5px; padding: 5px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-pill);
  box-shadow: var(--sh-1); overflow-x: auto; scrollbar-width: none;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
  border: 0; background: transparent; padding: 9px 15px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; cursor: pointer;
  transition: color var(--t-fast), transform var(--t-fast) var(--e-spring);
}
.seg-btn:active { transform: scale(.94); }
.seg-btn.active { background: var(--g-main); color: #fff; box-shadow: var(--sh-glow); }
.seg.small { padding: 4px; margin-bottom: 12px; }
.seg.small .seg-btn { padding: 7px 13px; font-size: 12.5px; }

/* ---------------- 课次卡片 ---------------- */
.lesson-list { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.lesson-item {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 14px; box-shadow: var(--sh-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast);
}
.lesson-item:active { transform: scale(.96); box-shadow: none; }
.lesson-item .li-no { font-weight: 900; font-size: 15px; letter-spacing: -.01em; }
.lesson-item .li-meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }
.lesson-item .li-bar { height: 5px; border-radius: var(--r-pill); background: var(--line); margin-top: 9px; overflow: hidden; }
.lesson-item .li-bar i {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: var(--g-main); transition: width .8s var(--e-out);
}

/* ---------------- 单词行 ---------------- */
.wrow {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 12px 13px; margin-bottom: 9px; box-shadow: var(--sh-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .28s var(--e-out), opacity .28s var(--e-out);
}
.wrow.out { transform: translate3d(-104%, 0, 0); opacity: 0; }
/* 左滑露出的收藏底 */
.wrow .swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 20px; font-size: 19px; background: var(--g-main); color: #fff;
}
.wr-main { flex: 1; min-width: 0; position: relative; z-index: 1; }
.wr-jp { font-size: 16.5px; font-weight: 800; letter-spacing: .01em; }
.wr-zh { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-zh i { font-style: normal; opacity: .65; }
.wr-btn {
  position: relative; z-index: 1; padding: 7px 10px; font-size: 14px;
  box-shadow: none; background: var(--surface-2);
}

/* 搜索框 */
.search {
  width: 100%; padding: 14px 16px; margin-bottom: 12px;
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface); box-shadow: var(--sh-1); font-size: 15px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: box-shadow var(--t-mid), border-color var(--t-mid);
}
.search:focus {
  outline: none; border-color: var(--pink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pink) 18%, transparent), var(--sh-1);
}
#word-count { margin-bottom: 12px !important; }

/* ---------------- 翻转卡 ---------------- */
.deck-head { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.deck-title { font-weight: 800; font-size: 15px; flex: 1; }
.deck-pos { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.flash { position: relative; perspective: 1400px; height: 290px; margin-bottom: 16px; }
.flash-face {
  position: absolute; inset: 0; border-radius: var(--r-xl); padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--line-2); box-shadow: var(--sh-3); overflow: hidden;
  transition: transform .68s var(--e-out);
}
.flash-face::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.55), transparent 40%);
  mix-blend-mode: overlay;
}
.flash-front { background: linear-gradient(155deg, #ffffff, #ffe9f3 60%, #eadcff); }
.flash-back { background: linear-gradient(155deg, #ffffff, #e2f6ff 60%, #e6fff4); transform: rotateY(180deg); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .flash-front { background: linear-gradient(155deg, #241d3d, #33264d 60%, #3a2c56); }
  html:not([data-theme="light"]) .flash-back { background: linear-gradient(155deg, #1d2438, #223047 60%, #1f3a3a); }
}
.flash.flipped .flash-front { transform: rotateY(180deg); }
.flash.flipped .flash-back { transform: rotateY(360deg); }
.flash-kana { font-size: 44px; font-weight: 900; letter-spacing: .02em; }
.flash-kanji { font-size: 22px; color: var(--ink-2); min-height: 28px; }
.flash-zh { font-size: 27px; font-weight: 800; text-align: center; line-height: 1.35; }
.flash-meta { display: flex; gap: 8px; margin-top: 2px; }
.flash-note { font-size: 12px; text-align: center; max-width: 90%; }
.flash-hint { position: absolute; bottom: 14px; font-size: 11px; color: var(--ink-3); }
.speak { position: absolute; right: 15px; top: 15px; }
.deck-actions { display: flex; gap: 11px; }
.deck-actions .btn { flex: 1; }

/* ---------------- 听力 ---------------- */
.listen-stage { text-align: center; padding: 16px 0 8px; }
.big-speak {
  border: 0; width: 128px; height: 128px; border-radius: 50%; cursor: pointer;
  background: var(--g-main); color: #fff; font-size: 36px;
  box-shadow: var(--sh-glow); display: grid; place-items: center; gap: 2px; margin: 0 auto;
  transition: transform var(--t-fast) var(--e-spring);
}
.big-speak:active { transform: scale(.9); }
.big-speak span { font-size: 11.5px; font-weight: 800; opacity: .95; }
.big-speak.playing { animation: pulse 1.15s var(--e-inout) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: var(--sh-glow), 0 0 0 0 rgba(255,126,179,.5); }
  55% { box-shadow: var(--sh-glow), 0 0 0 22px rgba(255,126,179,0); }
}
.listen-repeat { font-size: 21px; margin-top: 14px; min-height: 28px; color: var(--ink-2); letter-spacing: .1em; }
.speed { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.listen-foot { margin-top: 10px; }

/* ---------------- 选项 ---------------- */
.options { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.opt {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-md);
  padding: 15px 16px; font-size: 15px; font-weight: 600; box-shadow: var(--sh-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform var(--t-fast) var(--e-spring), background var(--t-fast), border-color var(--t-fast);
  animation: rise .42s var(--e-out) both;
}
.opt:nth-child(1) { animation-delay: .02s; }
.opt:nth-child(2) { animation-delay: .07s; }
.opt:nth-child(3) { animation-delay: .12s; }
.opt:nth-child(4) { animation-delay: .17s; }
.opt:active { transform: scale(.975); }
.opt.right {
  background: linear-gradient(135deg, #34d399, #6ee7b7); color: #042f20;
  border-color: transparent; animation: pop .45s var(--e-spring);
}
.opt.wrong {
  background: linear-gradient(135deg, #fb7185, #fda4af); color: #45060f;
  border-color: transparent; animation: shake .5s var(--e-out);
}
.opt small { display: block; font-size: 11.5px; opacity: .78; margin-top: 5px; font-weight: 500; }
@keyframes pop { 0% { transform: scale(1); } 42% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-8px); } 38% { transform: translateX(7px); }
  58% { transform: translateX(-5px); } 78% { transform: translateX(3px); }
}

/* ---------------- 连词成句 ---------------- */
.order-area { margin-top: 14px; }
.order-built {
  min-height: 60px; display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  padding: 12px; border-radius: var(--r-md); margin-bottom: 12px;
  border: 1.5px dashed var(--line-2); background: var(--surface-2);
}
.order-pool { display: flex; flex-wrap: wrap; gap: 9px; }
.chunk {
  position: relative; overflow: hidden; border: 0; cursor: pointer;
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 700;
  background: var(--g-main); color: #fff; box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--e-spring), filter var(--t-fast);
}
.chunk:active { transform: scale(.91); }
.chunk.built { background: linear-gradient(135deg, #34d399, #6ee7b7); color: #042f20; }
.chunk.miss { background: linear-gradient(135deg, #fb7185, #fda4af); color: #45060f; }
.chunk:disabled { cursor: default; }

/* ---------------- 语法 ---------------- */
.gram-list { display: flex; flex-direction: column; gap: 11px; }
.gram-item {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 14px 15px; box-shadow: var(--sh-1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast);
}
.gram-item:active { transform: scale(.985); }
.gram-item h4 { margin: 0 0 5px; font-size: 15.5px; line-height: 1.45; font-weight: 800; }
.gram-item .gi-lesson {
  display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--pink);
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  padding: 2px 9px; border-radius: var(--r-pill); margin-bottom: 7px;
}
.gram-detail { margin-top: 12px; font-size: 13px; line-height: 1.7; animation: rise .42s var(--e-out); }
.gram-detail .gd-row { margin: 8px 0; }
.gram-detail .gd-k {
  display: inline-block; color: #fff; background: var(--g-main);
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); margin-right: 6px;
}
.gram-detail .ex {
  background: var(--surface-2); border-left: 3px solid var(--pink);
  border-radius: 12px; padding: 11px 13px; margin: 9px 0;
}
.gram-detail .ex .jp { cursor: pointer; font-size: 14.5px; font-weight: 600; }
.gram-detail .ex .zh { color: var(--ink-2); font-size: 12px; margin-top: 5px; }

/* ---------------- 测试 ---------------- */
.quiz-menu { display: flex; flex-direction: column; gap: 11px; }
.quiz-item { display: flex; gap: 14px; align-items: center; margin: 0; cursor: pointer; }
.quiz-item:active { transform: scale(.98); }
.qi-ico {
  width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; flex: none;
  font-size: 22px; font-weight: 900; color: #fff;
  background: var(--g-main); box-shadow: var(--sh-glow);
}
.quiz-item h3 { margin: 0; font-size: 15.5px; }
.quiz-item p { margin: 4px 0 0; }
.quiz-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-bar { flex: 1; height: 9px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.quiz-bar i {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: var(--g-main); box-shadow: 0 0 12px rgba(255,126,179,.7);
  transition: width .45s var(--e-out);
}
#quiz-count { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.quiz-q {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 26px 18px; text-align: center; font-size: 23px; font-weight: 800; line-height: 1.5;
  box-shadow: var(--sh-2); min-height: 108px; display: grid; place-items: center;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
}
.quiz-result { text-align: center; padding: 14px 0 0; animation: rise .5s var(--e-out); }
.qr-score {
  font-size: 46px; font-weight: 900; letter-spacing: -.02em;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.quiz-result .btn { margin: 7px 5px; }

/* ---------------- 口语跟读 ---------------- */
.speak-card { text-align: center; }
.speak-target { font-size: 26px; font-weight: 900; line-height: 1.5; letter-spacing: .01em; }
.speak-zh { font-size: 13px; margin-top: 6px; }
.speak-btns { display: flex; gap: 9px; justify-content: center; margin: 16px 0 12px; flex-wrap: wrap; }
.rec-meter { height: 11px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin: 8px 0 14px; }
.rec-meter i {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--ok), var(--amber), var(--danger));
  transition: width .06s linear;
}
.speak-score { margin-top: 6px; }
.sc-total {
  font-size: 52px; font-weight: 900; line-height: 1.05; letter-spacing: -.03em;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop .5s var(--e-spring);
}
.sc-total small { font-size: 16px; margin-left: 4px; -webkit-text-fill-color: var(--ink-3); }
.sc-word { font-size: 14.5px; font-weight: 800; margin: 4px 0 8px; }
.sc-parts { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.speak-next { margin-top: 14px; }

/* ---------------- 选择器 ---------------- */
.picker { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
.pick {
  position: relative; overflow: hidden; cursor: pointer; text-align: left;
  border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-md);
  padding: 10px 14px; box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--e-spring), border-color var(--t-fast), box-shadow var(--t-fast);
}
.pick:active { transform: scale(.94); }
.pick b { display: block; font-size: 14px; }
.pick span { font-size: 11px; color: var(--ink-3); }
.pick i { display: inline-block; width: 18px; height: 18px; border-radius: 50%; margin-right: 7px; vertical-align: -3px; }
.pick.on { border-color: var(--pink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pink) 20%, transparent), var(--sh-1); }
.pick .del {
  position: absolute; right: 4px; top: 4px; font-size: 10px; line-height: 1;
  padding: 3px 6px; border-radius: 9px; background: var(--surface-2); color: var(--ink-3);
}
#btn-add-char { border-style: dashed; }
#btn-add-char b { color: var(--pink); }

/* 结算页统计 */
.sheet .stats { margin: 12px 0 4px; }
.sheet .stat { background: var(--surface-2); }

/* ---------------- 我的 ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 10px 0 16px; }
.stat {
  text-align: center; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 12px 4px;
}
.stat b { display: block; font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 10.5px; color: var(--ink-3); }
.heat { display: grid; grid-template-columns: repeat(35, 1fr); gap: 3.5px; margin: 8px 0; }
.heat i { aspect-ratio: 1; border-radius: 3.5px; background: var(--line); transition: transform var(--t-fast) var(--e-spring); }
.heat i:active { transform: scale(1.5); }
.heat i.l1 { background: color-mix(in srgb, var(--pink) 28%, transparent); }
.heat i.l2 { background: color-mix(in srgb, var(--pink) 55%, transparent); }
.heat i.l3 { background: var(--pink); }
.heat i.l4 { background: var(--violet); box-shadow: 0 0 8px color-mix(in srgb, var(--violet) 60%, transparent); }
.set-row {
  display: flex; align-items: center; gap: 11px; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.set-row:last-child { border-bottom: 0; }
.set-row > span { flex: none; width: 92px; color: var(--ink-2); }
.set-row input[type=range] { flex: 1; accent-color: var(--pink); height: 26px; }
.set-row input[type=checkbox] { width: 21px; height: 21px; accent-color: var(--pink); }
.set-row select, .set-row input[type=time] {
  flex: 1; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface-solid);
}
.set-row b { width: 32px; text-align: right; color: var(--pink); font-variant-numeric: tabular-nums; }
textarea {
  width: 100%; border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface-solid); padding: 13px; resize: vertical; font-size: 13.5px; margin: 9px 0;
}
textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pink) 16%, transparent); }
.about p { margin: 7px 0; }

/* ---------------- 底部导航 ---------------- */
#tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(26px) saturate(1.8); -webkit-backdrop-filter: blur(26px) saturate(1.8);
  border-top: 1px solid var(--line-2);
}
#tabbar::before {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 52px; height: 4px; border-radius: var(--r-pill); background: var(--line-2);
  opacity: .8;
}
.tab {
  position: relative; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; color: var(--ink-3);
  transition: color var(--t-mid) var(--e-out);
}
.tab span { font-size: 20px; transition: transform .34s var(--e-spring); }
.tab em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.tab.active { color: var(--pink); }
.tab.active span { transform: translateY(-4px) scale(1.2); }
.tab.active::after {
  content: ""; position: absolute; bottom: 7px; width: 20px; height: 3px;
  border-radius: var(--r-pill); background: var(--g-main); box-shadow: 0 0 10px var(--pink);
  animation: tabIn .38s var(--e-spring);
}
@keyframes tabIn { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.tab:active span { transform: scale(.85); }

/* ---------------- 底部抽屉 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(12, 8, 24, .38);
  opacity: 0; transition: opacity var(--t-mid) var(--e-out);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet-mask.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--surface-solid); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 20px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,.22);
  transform: translate3d(0, 102%, 0);
  transition: transform .44s var(--e-out);
  max-width: 580px; margin: 0 auto;
}
.sheet.on { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: var(--r-pill); background: var(--line); margin: 0 auto 14px; }

/* ---------------- toast / fx ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 24px) scale(.94); z-index: 90; pointer-events: none;
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg);
  padding: 11px 19px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
  opacity: 0; max-width: 84vw; text-align: center; box-shadow: var(--sh-3);
  transition: opacity .3s var(--e-out), transform .42s var(--e-spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(100deg, var(--line) 30%, color-mix(in srgb, var(--line) 40%, transparent) 50%, var(--line) 70%);
  background-size: 220% 100%; border-radius: var(--r-md); height: 54px; margin-bottom: 9px;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 160% 0; } to { background-position: -60% 0; } }

/* 每日任务 */
.task-row {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
  transition: transform var(--t-fast) var(--e-spring), opacity var(--t-mid);
}
.task-row:last-child { border-bottom: 0; }
.task-row:active { transform: scale(.98); }
.task-row.done { opacity: .62; }
.tr-ico { font-size: 19px; width: 24px; text-align: center; flex: none; }
.tr-main { flex: 1; min-width: 0; }
.tr-main b { font-size: 14px; font-weight: 700; }
.tr-bar { height: 5px; border-radius: var(--r-pill); background: var(--line); margin-top: 6px; overflow: hidden; }
.tr-bar i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--g-main); transition: width .7s var(--e-out); }
.tr-num { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }

/* 版本徽章 */
.tb-ver {
  display: inline-block; margin-left: 7px; padding: 2px 7px; border-radius: var(--r-pill);
  font-size: 9.5px; font-weight: 800; color: #fff; background: var(--g-main);
  vertical-align: 3px; letter-spacing: .02em;
}

/* 搜索抽屉 */
.gs-list { max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; margin-top: 4px; }
.gs-h {
  font-size: 11.5px; font-weight: 800; color: var(--pink); letter-spacing: .06em;
  margin: 14px 0 8px;
}
.gs-list .gram-item { margin-bottom: 9px; }

/* ===========================================================
   特效层 v0.6
   @property 动画渐变 / @starting-style / View Transitions
   =========================================================== */

/* 可动画的自定义属性（现代浏览器才支持，不支持就静态降级） */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@property --glow { syntax: '<number>'; initial-value: 0; inherits: false; }

/* 特效画布 */
#fx-layer {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
}

/* ---------- 连击边缘光 ---------- */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 75; pointer-events: none;
  border-radius: 0; opacity: 0;
  transition: opacity .45s var(--e-out);
  box-shadow: inset 0 0 0 0 transparent;
}
html[data-combo="1"] body::after { opacity: .55; box-shadow: inset 0 0 42px 2px rgba(255,126,179,.5); }
html[data-combo="2"] body::after {
  opacity: .85;
  box-shadow: inset 0 0 62px 6px rgba(255,126,179,.62), inset 0 0 120px 22px rgba(167,139,250,.45);
  animation: edgePulse 1.5s var(--e-inout) infinite;
}
html[data-combo="3"] body::after {
  opacity: 1;
  box-shadow: inset 0 0 78px 10px rgba(255,126,179,.7), inset 0 0 150px 34px rgba(167,139,250,.55),
              inset 0 0 220px 60px rgba(103,232,249,.35);
  animation: edgePulse .9s var(--e-inout) infinite;
}
@keyframes edgePulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

/* 连击时顶栏标题也发光 */
html[data-combo="2"] .tb-title, html[data-combo="3"] .tb-title { filter: drop-shadow(0 0 10px rgba(255,126,179,.8)); }
html[data-combo="3"] .ring-fg { filter: drop-shadow(0 0 14px var(--pink)); }

/* ---------- 屏抖 ---------- */
body.shake-1 { animation: shakeS .42s var(--e-out); }
body.shake-2 { animation: shakeL .5s var(--e-out); }
@keyframes shakeS {
  0%,100% { transform: translate3d(0,0,0); }
  20% { transform: translate3d(-5px,2px,0); } 45% { transform: translate3d(4px,-2px,0); }
  70% { transform: translate3d(-3px,1px,0); }
}
@keyframes shakeL {
  0%,100% { transform: translate3d(0,0,0) rotate(0); }
  15% { transform: translate3d(-11px,3px,0) rotate(-.5deg); }
  35% { transform: translate3d(9px,-3px,0) rotate(.5deg); }
  55% { transform: translate3d(-7px,2px,0) rotate(-.3deg); }
  78% { transform: translate3d(5px,-1px,0) rotate(.2deg); }
}

/* ---------- 3D 倾斜 + 镜面高光 ---------- */
.tilting { will-change: transform; }
.flash.tilting .flash-face { box-shadow: var(--sh-3), 0 0 0 1px rgba(255,255,255,.4); }
.flash-face::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%),
              rgba(255,255,255,.85), rgba(255,255,255,.12) 34%, transparent 62%);
  mix-blend-mode: soft-light;
}
.flash.tilting .flash-face::after { opacity: 1; }

/* ---------- 聚光跟随 ---------- */
.tile, .lesson-item, .gram-item, .quiz-item, .stat { position: relative; overflow: hidden; }
.tile.spot::after, .lesson-item.spot::after, .gram-item.spot::after,
.quiz-item.spot::after, .stat.spot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255,255,255,.55), transparent 62%);
  mix-blend-mode: soft-light;
}

/* ---------- 飘心 ---------- */
.fly-heart {
  position: fixed; z-index: 92; pointer-events: none; color: #ff5c93;
  text-shadow: 0 0 12px rgba(255,92,147,.85);
  animation: flyHeart 1.3s var(--e-out) forwards;
}
@keyframes flyHeart {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  22% { opacity: 1; transform: translate(-50%, -16px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -92px) scale(.75) rotate(14deg); }
}

/* ---------- 星级展开 ---------- */
.star-row { display: flex; justify-content: center; gap: 10px; margin: 6px 0 2px; }
.star-row .star {
  font-size: 32px; color: var(--line); opacity: 0;
  transform: scale(.2) rotate(-40deg);
  animation: starPop .55s var(--e-spring) forwards;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.18));
}
.star-row .star.on {
  color: #ffc93c;
  text-shadow: 0 0 18px rgba(255,201,60,.9);
}
@keyframes starPop {
  0% { opacity: 0; transform: scale(.2) rotate(-40deg); }
  62% { opacity: 1; transform: scale(1.25) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* ---------- 声波条 ---------- */
.big-speak { position: relative; }
.wave-bars {
  position: absolute; left: 50%; bottom: -40px; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 5px; height: 26px; opacity: 0;
  transition: opacity .3s;
}
.wave-bars.on { opacity: 1; }
.wave-bars i {
  width: 5px; height: 100%; border-radius: var(--r-pill);
  background: var(--g-main); transform-origin: bottom;
  transform: scaleY(.3);
}

/* ---------- View Transitions ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vtOut .2s var(--e-out) both; }
  ::view-transition-new(root) { animation: vtIn .34s var(--e-out) both; }
}
@keyframes vtOut { to { opacity: 0; transform: scale(.985) translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: scale(1.012) translateY(12px); } }

/* ---------- @starting-style：抽屉/吐司的原生入场 ---------- */
@supports (selector(:has(*))) {
  .sheet { transition: transform .44s var(--e-out), overlay .44s allow-discrete, display .44s allow-discrete; }
  @starting-style {
    .sheet.on { transform: translate3d(0, 102%, 0); }
  }
}

/* ---------- 按钮/选项的描边流光 ---------- */
.btn.primary, .big-speak, .qi-ico {
  background-image: var(--g-main);
  background-size: 200% 200%;
  animation: gradShift 6s var(--e-inout) infinite;
}
@keyframes gradShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* 答对冲击波（挂在选项上） */
.shock {
  position: absolute; left: 50%; top: 50%; width: 12px; height: 12px;
  margin: -6px 0 0 -6px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(255,255,255,.95);
  animation: shockOut .62s var(--e-out) forwards;
}
@keyframes shockOut {
  from { opacity: .95; transform: scale(.4); }
  to { opacity: 0; transform: scale(26); }
}

/* 完成任务的对勾描线 */
.task-row.done .tr-ico { animation: checkPop .5s var(--e-spring); }
@keyframes checkPop {
  0% { transform: scale(.4) rotate(-25deg); opacity: .3; }
  60% { transform: scale(1.3) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 打字机光标 */
.bubble::after {
  content: ""; display: inline-block; width: 2px; height: 12px;
  margin-left: 2px; vertical-align: -2px; background: var(--pink);
  animation: caret .8s steps(1) infinite;
}
@keyframes caret { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* 极光视差容器 */
#aurora { will-change: transform; }

/* View Transition 期间不要叠加逐项入场动画 */
html.vt .view.active > * { animation: none !important; }
html.vt .view.active > * { opacity: 1; }

/* 输入型题型 */
.type-area { margin-top: 14px; }
.type-area .search { margin-bottom: 10px; }
.type-area .btn { width: 100%; }
#type-hint { text-align: center; margin: 10px 0 0; min-height: 20px; }
.type-ok { color: var(--ok); font-weight: 800; }
.type-bad { color: var(--danger); font-weight: 800; }
#type-input:disabled { opacity: .6; }
/* 卡片上的收藏按钮 */
.deck-star { position: absolute; left: 15px; top: 15px; }

/* 声调曲线 */
.pitch { display: block; margin: 2px auto 0; overflow: visible; }
.pitch .pline { fill: none; stroke: var(--pink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pitch .pdrop { stroke: var(--ink-3); stroke-width: 1.4; stroke-dasharray: 2 2; }
.pitch circle { fill: var(--pink); }
.pitch text { font-size: 9.5px; fill: var(--ink-3); font-weight: 600; }
.pitch.small .pline { stroke-width: 2; }
.pitch.small circle { r: 2; }
.flash-pitch { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-top: 2px; min-height: 34px; }
.pitch-tag { font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.sheet .pitch { margin: 8px auto 2px; }

/* 长列表：屏外元素跳过渲染（200 行词表滚起来更顺） */
#word-rows .wrow { content-visibility: auto; contain-intrinsic-size: auto 66px; }

/* ===========================================================
   v0.9：手动主题 / 字号缩放 / 大屏适配
   =========================================================== */
html { color-scheme: light dark; }
html[data-theme="light"] {
  color-scheme: light;
  --ink: #1c1930; --ink-2: #6e6a88; --ink-3: #9b96b0;
  --bg: #f7f4ff; --bg-2: #efeafc;
  --surface: rgba(255,255,255,.74); --surface-solid: #ffffff; --surface-2: rgba(255,255,255,.52);
  --line: rgba(28,25,48,.07); --line-2: rgba(255,255,255,.65);
  --sh-1: 0 1px 2px rgba(28,25,48,.05), 0 4px 12px rgba(28,25,48,.06);
  --sh-2: 0 2px 6px rgba(28,25,48,.06), 0 12px 28px rgba(28,25,48,.09);
  --sh-3: 0 4px 12px rgba(28,25,48,.08), 0 24px 56px rgba(28,25,48,.13);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f2ff; --ink-2: #a9a3c2; --ink-3: #7d7796;
  --bg: #0d0a18; --bg-2: #16112a;
  --surface: rgba(32,27,54,.72); --surface-solid: #1b1630; --surface-2: rgba(255,255,255,.05);
  --line: rgba(255,255,255,.09); --line-2: rgba(255,255,255,.10);
  --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.35);
  --sh-2: 0 2px 6px rgba(0,0,0,.45), 0 12px 28px rgba(0,0,0,.45);
  --sh-3: 0 4px 12px rgba(0,0,0,.5), 0 24px 56px rgba(0,0,0,.55);
}
html[data-theme="dark"] #aurora { opacity: .5; }
html[data-theme="dark"] .card::after { opacity: .25; }
html[data-theme="dark"] .flash-front { background: linear-gradient(155deg, #241d3d, #33264d 60%, #3a2c56); }
html[data-theme="dark"] .flash-back { background: linear-gradient(155deg, #1d2438, #223047 60%, #1f3a3a); }
html[data-theme="dark"] .stage {
  background: radial-gradient(120% 80% at 50% 6%, rgba(255,255,255,.10), transparent 60%),
              linear-gradient(165deg, rgba(255,126,179,.20), rgba(167,139,250,.22) 52%, rgba(103,232,249,.16));
}
html[data-theme="light"] #aurora { opacity: 1; }
html[data-theme="light"] .card::after { opacity: .9; }

/* 字号：全部用 rem，改 html 的 font-size 即可整体缩放 */
html { font-size: 16px; }
html[data-fs="s"] { font-size: 14.5px; }
html[data-fs="l"] { font-size: 17.5px; }
html[data-fs="xl"] { font-size: 19px; }
body { font-size: 1rem; }
h3 { font-size: 1rem; }
.dim { font-size: .82rem; }
.btn { font-size: .91rem; }
.btn.small { font-size: .82rem; }
.icon-btn { font-size: .94rem; }
.tb-title { font-size: 1.32rem; }
.tb-sub { font-size: .66rem; }
.tab em { font-size: .63rem; }
.tab span { font-size: 1.25rem; }
.wr-jp { font-size: 1.04rem; }
.wr-zh { font-size: .79rem; }
.opt { font-size: .94rem; }
.opt small { font-size: .72rem; }
.quiz-q { font-size: 1.44rem; }
.quiz-item h3 { font-size: .97rem; }
.flash-kana { font-size: 2.75rem; }
.flash-kanji { font-size: 1.38rem; }
.flash-zh { font-size: 1.69rem; }
.flash-note { font-size: .75rem; }
.lesson-item .li-no { font-size: .94rem; }
.lesson-item .li-meta { font-size: .69rem; }
.gram-item h4 { font-size: .97rem; }
.gram-detail { font-size: .82rem; }
.listen-repeat { font-size: 1.32rem; }
.big-speak span { font-size: .72rem; }
.speak-target { font-size: 1.63rem; }
.sc-total { font-size: 3.25rem; }
.stat b { font-size: 1.32rem; }
.stat span { font-size: .66rem; }
.task-info p { font-size: .85rem; }
.tr-main b { font-size: .88rem; }
.tr-num { font-size: .75rem; }
.tile span { font-size: .94rem; }
.tile em { font-size: .72rem; }
.pomo-time { font-size: 1.75rem; }
.search { font-size: .94rem; }
.chip { font-size: .72rem; }
.pick b { font-size: .88rem; }
.pick span { font-size: .69rem; }
.gs-h { font-size: .72rem; }
.chunk { font-size: .91rem; }
.type-area .search { font-size: .94rem; }
/* 特大字号下允许收缩，避免文字溢出容器 */
.btn, .tile, .task-actions { min-width: 0; }
.task-actions .btn { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tile span, .tile em { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
html[data-fs="xl"] .task-actions { flex-wrap: wrap; }
html[data-fs="xl"] .task-actions .btn { flex: 1 1 100%; }

/* iPad / 大屏 */
@media (min-width: 760px) {
  #main { max-width: 940px; padding-left: 28px; padding-right: 28px; }
  .grid2 { grid-template-columns: repeat(4, 1fr); }
  .lesson-list { grid-template-columns: repeat(3, 1fr); }
  .options { display: grid; grid-template-columns: 1fr 1fr; }
  .stage { height: 400px; }
  .sheet { max-width: 760px; }
  .flash { height: 340px; }
}
/* 更大的平板：iPad Pro 13" M4/M5 (1032×1376)、iPad Pro 12.9 / Air 13" (1024×1366)、横屏 */
@media (min-width: 1000px) {
  #main { max-width: 1060px; padding-left: 34px; padding-right: 34px; }
  .lesson-list { grid-template-columns: repeat(4, 1fr); }
  .kanji-grid { grid-template-columns: repeat(9, 1fr); }
  .grid2 { grid-template-columns: repeat(4, 1fr); }
  .stage { height: 470px; }
  .flash { height: 400px; }
  .sheet { max-width: 860px; }
  .quiz-q { font-size: 1.6rem; }
  .flash-kana { font-size: 3.1rem; }
}
/* 横屏（手机横握） */
@media (orientation: landscape) and (max-height: 560px) {
  .stage { height: 210px; }
  .flash { height: 220px; }
  #main { padding-top: calc(var(--top-h) + env(safe-area-inset-top) + 4px); }
}

/* 汉字表 */
.kanji-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 6px; }
@media (min-width: 760px) { .kanji-grid { grid-template-columns: repeat(7, 1fr); } }
.kj {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-md);
  padding: 10px 4px 8px; cursor: pointer; box-shadow: var(--sh-1); text-align: center;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast);
}
.kj:active { transform: scale(.92); }
.kj b { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.kj span { display: block; font-size: .6rem; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kj-head { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.kj-big {
  font-size: 3.2rem; font-weight: 800; line-height: 1;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.kj-rows { margin: 10px 0 4px; }
.kj-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.kj-row:last-child { border-bottom: 0; }
.kj-row span { flex: none; width: 46px; color: var(--ink-3); font-size: .8rem; }
.kj-row b { font-weight: 700; }

/* 本课例句串读 */
.ex-item {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 12px 14px 11px; margin-bottom: 9px; box-shadow: var(--sh-1);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ex-jp { font-size: 1.04rem; font-weight: 600; line-height: 1.6; cursor: pointer; }
.ex-jp:active { opacity: .6; }
.ex-no { display: inline-block; width: 1.5em; color: var(--pink); font-style: normal; font-weight: 800; }
.ex-sp { opacity: .45; font-size: .85em; }
.ex-zh { font-size: .82rem; margin-top: 4px; padding-left: 1.5em; }

/* 添加到主屏引导 */
.steps { margin: 6px 0 0; padding-left: 1.35em; }
.steps li { font-size: .86rem; line-height: 1.75; color: var(--ink-2); }
.steps li b { color: var(--ink); }

/* 词卡背面的真实例句 */
.fex-item { text-align: left; margin: 2px 0 8px; padding: 7px 10px; background: var(--surface-2); border-radius: var(--r-sm); }
.fex-jp { font-size: .84rem; font-weight: 600; cursor: pointer; line-height: 1.5; }
.fex-jp:active { opacity: .6; }
.fex-zh { font-size: .74rem; color: var(--ink-3); margin-top: 2px; }

/* 备份提醒横幅 */
#backup-note { display: flex; flex-direction: column; gap: 10px; border: 1px solid #ffb84d66; background: color-mix(in srgb, #fff3dc 78%, transparent); }
#backup-note p { margin: 0; font-size: .86rem; color: #7a5a1e; line-height: 1.6; }
#backup-note .btn { align-self: flex-start; }

/* ---------------- 无障碍 / 性能 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  #aurora { animation: none; }
}
html[data-motion="off"] #aurora,
html[data-motion="off"] .btn.primary::after { animation: none; }
html[data-motion="off"] .view.active > * { animation: none; }
