/* FluentGo / 流利学 - mobile-first UI */
:root{
  --bg:#0a1120;
  --bg-soft:#0f1a2e;
  --card:#132138;
  --card-2:#17273f;
  --line:rgba(148,178,222,.14);
  --text:#e9f0ff;
  --muted:#8ea3c6;
  --brand:#25d0e6;
  --brand-2:#6b7cff;
  --ok:#2fe0a1;
  --warn:#ffc247;
  --bad:#ff6b8a;
  --shadow:0 16px 40px rgba(0,0,0,.35);
  --radius:20px;
}
body.light{
  --bg:#f4f7fc;
  --bg-soft:#ffffff;
  --card:#ffffff;
  --card-2:#f1f5fd;
  --line:rgba(23,55,110,.12);
  --text:#12203a;
  --muted:#66799b;
  --shadow:0 12px 30px rgba(28,60,120,.12);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0}
body{
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans","Noto Sans SC","Microsoft YaHei",sans-serif;
  font-size:15px;
  line-height:1.5;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}
button{font-family:inherit;color:inherit;border:0;background:none;cursor:pointer}
h1,h2,h3,h4,p{margin:0}
#app{
  display:flex;flex-direction:column;
  height:100vh;height:100dvh;
  max-width:560px;margin:0 auto;position:relative;
}
.screen{
  flex:1;overflow-y:auto;overflow-x:hidden;
  padding:4px 16px 24px;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.screen::-webkit-scrollbar{display:none}

/* ---------- topbar ---------- */
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:calc(14px + env(safe-area-inset-top)) 16px 10px;
}
.brand{display:flex;align-items:center;gap:9px;min-width:0}
.logo{
  width:32px;height:32px;border-radius:11px;flex:0 0 auto;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  display:grid;place-items:center;font-weight:800;font-size:15px;color:#03121c;
  box-shadow:0 6px 16px rgba(37,208,230,.35);
}
.brand-name{font-weight:700;font-size:16px;letter-spacing:.3px}
.brand-sub{font-size:11px;color:var(--muted);margin-top:-2px}
.top-meta{display:flex;gap:8px;align-items:center}
.chip{
  display:inline-flex;align-items:center;gap:5px;
  padding:5px 10px;border-radius:999px;font-size:12px;font-weight:600;
  background:var(--card);border:1px solid var(--line);color:var(--muted);
}
.chip.fire{color:var(--warn)}
.chip.xp{color:var(--brand)}
.icon-btn{
  width:34px;height:34px;border-radius:12px;display:grid;place-items:center;
  background:var(--card);border:1px solid var(--line);font-size:15px;color:var(--muted);
}

/* ---------- shared ---------- */
.card{
  background:var(--card);border:1px solid var(--line);
  border-radius:var(--radius);padding:16px;
}
.section-title{
  display:flex;align-items:center;justify-content:space-between;
  margin:22px 2px 10px;font-size:14px;font-weight:700;color:var(--muted);letter-spacing:.4px;
}
.section-title small{font-weight:500;font-size:12px;color:var(--muted);opacity:.8}
.muted{color:var(--muted)}
.tiny{font-size:12px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  padding:11px 18px;border-radius:14px;font-size:14px;font-weight:700;
  background:var(--card-2);border:1px solid var(--line);color:var(--text);
}
.btn.primary{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#04121d;border:0;box-shadow:0 10px 24px rgba(37,208,230,.28);
}
.btn.block{width:100%}
.btn:disabled{opacity:.45}
.btn-sm{padding:8px 13px;font-size:13px;border-radius:11px}
.row{display:flex;align-items:center;gap:10px}
.grow{flex:1;min-width:0}
.pill{
  padding:6px 12px;border-radius:999px;font-size:13px;font-weight:600;
  background:var(--card);border:1px solid var(--line);color:var(--muted);
  white-space:nowrap;
}
.pill.on{background:rgba(37,208,230,.14);border-color:rgba(37,208,230,.5);color:var(--brand)}
.hscroll{display:flex;gap:8px;overflow-x:auto;padding:2px 0 4px;scrollbar-width:none}
.hscroll::-webkit-scrollbar{display:none}

/* ---------- hero / today ---------- */
.hero{
  position:relative;overflow:hidden;
  background:
    radial-gradient(120% 140% at 90% -20%,rgba(107,124,255,.35),transparent 55%),
    radial-gradient(100% 120% at 0% 0%,rgba(37,208,230,.28),transparent 50%),
    linear-gradient(160deg,#16263f,#101b2e);
  border:1px solid var(--line);
  border-radius:24px;padding:18px;
  display:flex;gap:14px;align-items:center;
}
body.light .hero{
  background:
    radial-gradient(120% 140% at 90% -20%,rgba(107,124,255,.25),transparent 55%),
    radial-gradient(100% 120% at 0% 0%,rgba(37,208,230,.25),transparent 50%),
    linear-gradient(160deg,#ffffff,#eef4ff);
}
.hero h2{font-size:19px;letter-spacing:.2px}
.hero p{font-size:12.5px;color:var(--muted);margin-top:4px}
.hero .grow{position:relative;z-index:1}
.ring-wrap{position:relative;flex:0 0 auto;width:86px;height:86px}
.ring-wrap .ring-label{
  position:absolute;inset:0;display:grid;place-content:center;text-align:center;
  font-size:19px;font-weight:800;line-height:1;
}
.ring-label small{display:block;font-size:10px;font-weight:600;color:var(--muted);margin-top:3px}
.ring-track{stroke:rgba(148,178,222,.18)}
.ring-bar{stroke:url(#ringGrad);stroke-linecap:round;transition:stroke-dashoffset .6s ease}

.stat-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.stat{
  background:var(--card);border:1px solid var(--line);border-radius:16px;padding:13px 14px;
}
.stat b{display:block;font-size:20px;letter-spacing:.2px}
.stat span{font-size:12px;color:var(--muted)}

.quick-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.quick{
  background:var(--card);border:1px solid var(--line);border-radius:18px;
  padding:14px 10px;text-align:center;display:flex;flex-direction:column;gap:6px;align-items:center;
}
.quick .q-ico{font-size:22px}
.quick b{font-size:12.5px;font-weight:600}
.quick span{font-size:10.5px;color:var(--muted)}

.continue-card{display:flex;gap:14px;align-items:center}
.continue-card .thumb{
  width:52px;height:52px;border-radius:16px;flex:0 0 auto;
  display:grid;place-items:center;font-size:25px;
  background:linear-gradient(150deg,rgba(37,208,230,.2),rgba(107,124,255,.24));
  border:1px solid var(--line);
}

/* ---------- unit / phrase lists ---------- */
.unit-card{display:flex;gap:13px;align-items:center;padding:14px;margin-bottom:10px}
.unit-ico{
  width:46px;height:46px;border-radius:14px;display:grid;place-items:center;font-size:22px;
  background:var(--card-2);border:1px solid var(--line);flex:0 0 auto;
}
.unit-card b{font-size:14.5px;display:block}
.unit-card .meta{font-size:11.5px;color:var(--muted);margin-top:2px}
.bar{height:5px;border-radius:99px;background:rgba(148,178,222,.16);overflow:hidden;margin-top:7px}
.bar i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,var(--brand),var(--brand-2))}
.badge{font-size:10px;font-weight:700;padding:2px 7px;border-radius:6px;background:rgba(37,208,230,.14);color:var(--brand)}
.badge.done{background:rgba(47,224,161,.16);color:var(--ok)}

.phrase-row{
  display:flex;gap:12px;align-items:flex-start;padding:13px 0;border-bottom:1px solid var(--line);
}
.phrase-row:last-child{border-bottom:0}
.phrase-row .p-main{flex:1;min-width:0}
.phrase-row .p-text{font-size:14.5px;font-weight:600;line-height:1.45}
.phrase-row .p-sub{font-size:12px;color:var(--muted);margin-top:3px}
.play-dot{
  width:36px;height:36px;border-radius:50%;flex:0 0 auto;display:grid;place-items:center;
  background:rgba(37,208,230,.12);color:var(--brand);border:1px solid rgba(37,208,230,.35);font-size:14px;
}
.play-dot.on{background:rgba(37,208,230,.25)}
.check-dot{width:20px;height:20px;border-radius:50%;border:1.5px solid var(--line);display:grid;place-items:center;font-size:11px;color:transparent;flex:0 0 auto;margin-top:8px}
.check-dot.done{background:var(--ok);border-color:var(--ok);color:#04121d}

/* ---------- flashcard ---------- */
.flash{
  perspective:1200px;height:250px;margin-top:6px;
}
.flash-inner{
  position:relative;width:100%;height:100%;transform-style:preserve-3d;
  transition:transform .55s cubic-bezier(.4,.15,.25,1);
}
.flash.flipped .flash-inner{transform:rotateY(180deg)}
.flash-face{
  position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;
  border-radius:24px;border:1px solid var(--line);padding:20px;
  display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;
  background:linear-gradient(160deg,var(--card-2),var(--card));
}
.flash-face.back{transform:rotateY(180deg)}
.flash-word{font-size:34px;font-weight:800;letter-spacing:.5px;line-height:1.25;word-break:break-word}
.flash-read{font-size:14px;color:var(--brand);margin-top:8px;letter-spacing:.5px}
.flash-hint{position:absolute;bottom:14px;font-size:11px;color:var(--muted)}
.flash-face.back .flash-word{font-size:26px}
.flash-face.back .flash-read{color:var(--muted);font-size:13px}
.cat-tag{font-size:11px;padding:3px 9px;border-radius:8px;background:rgba(107,124,255,.16);color:#a9b4ff;margin-bottom:12px}
.word-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:16px}
.word-actions .btn{padding:12px 6px;font-size:13px}
.word-actions .btn.lv0{color:var(--bad)}
.word-actions .btn.lv1{color:var(--warn)}
.word-actions .btn.lv2{color:var(--ok)}
.deck-meta{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin:12px 2px 0}

/* ---------- practice sheet ---------- */
.prac-target{font-size:22px;font-weight:800;line-height:1.4;letter-spacing:.2px;text-align:center;margin-top:6px}
.prac-read{text-align:center;color:var(--brand);font-size:13.5px;margin-top:8px;letter-spacing:.6px}
.prac-zh{text-align:center;color:var(--muted);font-size:14px;margin-top:8px}
.prac-tip{
  margin-top:14px;font-size:12.5px;color:var(--muted);
  background:var(--card-2);border:1px dashed var(--line);border-radius:14px;padding:10px 12px;
}
.prac-mic-wrap{display:flex;flex-direction:column;align-items:center;gap:10px;margin:22px 0 6px}
.mic-btn{
  width:82px;height:82px;border-radius:50%;display:grid;place-items:center;font-size:30px;
  background:linear-gradient(140deg,var(--brand),var(--brand-2));color:#04121d;
  box-shadow:0 12px 30px rgba(37,208,230,.35);position:relative;
}
.mic-btn.listening{animation:pulse 1.4s infinite;background:linear-gradient(140deg,#ff6b8a,#ff9a5b)}
@keyframes pulse{
  0%{box-shadow:0 0 0 0 rgba(255,107,138,.5)}
  70%{box-shadow:0 0 0 22px rgba(255,107,138,0)}
  100%{box-shadow:0 0 0 0 rgba(255,107,138,0)}
}
.mic-hint{font-size:12px;color:var(--muted)}
.wave{display:flex;align-items:flex-end;gap:4px;height:26px}
.wave i{width:4px;border-radius:3px;background:var(--bad);height:8px;animation:w .9s infinite ease-in-out}
.wave i:nth-child(2){animation-delay:.1s}.wave i:nth-child(3){animation-delay:.2s}
.wave i:nth-child(4){animation-delay:.3s}.wave i:nth-child(5){animation-delay:.15s}
.wave i:nth-child(6){animation-delay:.25s}.wave i:nth-child(7){animation-delay:.05s}
@keyframes w{0%,100%{height:7px}50%{height:24px}}
.result-box{margin-top:16px;background:var(--card-2);border:1px solid var(--line);border-radius:18px;padding:14px}
.score-line{display:flex;align-items:center;gap:14px}
.score-num{font-size:30px;font-weight:800;line-height:1}
.score-num small{font-size:12px;font-weight:600;color:var(--muted);margin-left:2px}
.diff-text{font-size:14.5px;line-height:1.9;margin-top:10px}
.diff-text em{font-style:normal;padding:1px 2px;border-radius:4px}
.diff-text em.hit{color:var(--ok);background:rgba(47,224,161,.12)}
.diff-text em.miss{color:var(--bad);background:rgba(255,107,138,.14);text-decoration:underline dotted}
.said-text{font-size:12.5px;color:var(--muted);margin-top:8px;word-break:break-word}
.sheet-actions{display:flex;gap:10px;margin-top:16px}
.sheet-actions .btn{flex:1}

/* ---------- quiz ---------- */
.quiz-head{display:flex;align-items:center;justify-content:space-between;font-size:12.5px;color:var(--muted)}
.quiz-q{font-size:22px;font-weight:800;text-align:center;margin:26px 0 22px;word-break:break-word;line-height:1.4}
.quiz-q .zh{display:block;font-size:15px;font-weight:600;color:var(--muted);margin-top:8px}
.opt{
  display:flex;align-items:center;gap:10px;width:100%;text-align:left;
  padding:14px 16px;border-radius:16px;background:var(--card);border:1px solid var(--line);
  font-size:14.5px;margin-bottom:10px;transition:.18s;
}
.opt .key{
  width:22px;height:22px;border-radius:7px;display:grid;place-items:center;font-size:11px;
  background:var(--card-2);color:var(--muted);flex:0 0 auto;
}
.opt.correct{border-color:rgba(47,224,161,.7);background:rgba(47,224,161,.12)}
.opt.wrong{border-color:rgba(255,107,138,.7);background:rgba(255,107,138,.1)}
.opt:disabled{opacity:.85}
.quiz-result{text-align:center;padding:26px 0}
.quiz-result .big{font-size:52px;font-weight:800;background:linear-gradient(135deg,var(--brand),var(--brand-2));-webkit-background-clip:text;background-clip:text;color:transparent}
.mode-card{display:flex;gap:13px;align-items:center;padding:15px;margin-bottom:10px}
.mode-card .thumb{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;font-size:21px;background:var(--card-2);border:1px solid var(--line)}

/* ---------- profile ---------- */
.profile-head{display:flex;gap:14px;align-items:center;margin-bottom:6px}
.avatar{
  width:58px;height:58px;border-radius:20px;display:grid;place-items:center;font-size:26px;
  background:linear-gradient(140deg,var(--brand),var(--brand-2));color:#04121d;
}
.list-item{
  display:flex;align-items:center;gap:12px;padding:15px 2px;border-bottom:1px solid var(--line);
}
.list-item:last-child{border-bottom:0}
.list-item .li-ico{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:var(--card-2);font-size:15px}
.switch{width:46px;height:27px;border-radius:99px;background:rgba(148,178,222,.25);position:relative;transition:.2s;flex:0 0 auto}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:21px;height:21px;border-radius:50%;background:#fff;transition:.2s}
.switch.on{background:linear-gradient(135deg,var(--brand),var(--brand-2))}
.switch.on::after{transform:translateX(19px)}
.goal-opts{display:flex;gap:8px;flex-wrap:wrap}

/* ---------- tabbar ---------- */
.tabbar{
  display:grid;grid-template-columns:repeat(5,1fr);
  padding:8px 6px calc(8px + env(safe-area-inset-bottom));
  background:rgba(10,17,32,.92);
  border-top:1px solid var(--line);
  backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
}
body.light .tabbar{background:rgba(255,255,255,.94)}
.tab{
  display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:4px 0 2px;color:var(--muted);font-size:10.5px;font-weight:600;position:relative;
}
.tab svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.tab.on{color:var(--brand)}
.tab.on::before{
  content:"";position:absolute;top:-8px;width:26px;height:3px;border-radius:99px;
  background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

/* ---------- sheet ---------- */
.sheet-layer{position:fixed;inset:0;z-index:60;pointer-events:none}
.sheet-layer.open{pointer-events:auto}
.sheet-mask{
  position:absolute;inset:0;background:rgba(2,8,18,.62);opacity:0;transition:.25s;
  backdrop-filter:blur(2px);
}
.sheet-layer.open .sheet-mask{opacity:1}
.sheet{
  position:absolute;left:0;right:0;bottom:0;max-width:560px;margin:0 auto;
  background:var(--bg-soft);border-radius:26px 26px 0 0;border:1px solid var(--line);border-bottom:0;
  padding:8px 18px calc(18px + env(safe-area-inset-bottom));
  transform:translateY(102%);transition:transform .32s cubic-bezier(.3,.9,.35,1);
  max-height:88vh;overflow-y:auto;box-shadow:var(--shadow);
}
.sheet-layer.open .sheet{transform:translateY(0)}
.sheet-grip{width:40px;height:4px;border-radius:99px;background:var(--line);margin:2px auto 8px}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.sheet-head h3{font-size:15px}

/* ---------- toast ---------- */
.toast-layer{position:fixed;left:0;right:0;bottom:96px;display:flex;flex-direction:column;align-items:center;gap:8px;z-index:80;pointer-events:none}
.toast{
  background:rgba(20,32,52,.96);border:1px solid var(--line);color:var(--text);
  padding:10px 16px;border-radius:14px;font-size:13px;box-shadow:var(--shadow);
  animation:toastIn .25s ease,toastOut .3s ease 1.9s forwards;max-width:86vw;text-align:center;
}
body.light .toast{background:#fff}
@keyframes toastIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes toastOut{to{opacity:0;transform:translateY(-6px)}}

.empty{text-align:center;color:var(--muted);font-size:13px;padding:40px 0}
.fade-in{animation:fadeIn .28s ease both}
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* ---------- 零基础：字母表 / 五十音速查 ---------- */
.unit-card.starter{border-color:rgba(37,208,230,.34);background:linear-gradient(140deg,rgba(37,208,230,.10),transparent 60%),var(--card)}
.chart-label{font-size:11.5px;color:var(--muted);margin:14px 2px 6px;letter-spacing:.5px}
.kana-grid,.abc-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
.kana-cell{display:flex;flex-direction:column;align-items:center;gap:1px;padding:9px 2px;border-radius:12px;border:1px solid var(--line);background:var(--card-2);color:var(--text);font:inherit;cursor:pointer}
.kana-cell:active{border-color:rgba(37,208,230,.6)}
.kana-cell b{font-size:19px;line-height:1.15}
.kana-cell small{font-size:10.5px;color:var(--brand)}
.kana-cell i{font-style:normal;font-size:10px;color:var(--muted)}
.kana-cell.empty{border:0;background:transparent;cursor:default}
