/* BridgeOS · Apple HIG 风格浅色界面 */
:root {
  --bg: #fbfbfd;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --line: rgba(0, 0, 0, .07);
  --line-strong: rgba(0, 0, 0, .12);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --blue: #0071e3;
  --blue-soft: #e8f2ff;
  --blue-ink: #0062c4;
  --green: #2e9e62;
  --green-soft: #e9f7ee;
  --amber: #b7791f;
  --amber-soft: #fff5e2;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .055), 0 1px 3px rgba(0, 0, 0, .035);
  --shadow-lift: 0 14px 42px rgba(0, 0, 0, .09), 0 2px 6px rgba(0, 0, 0, .04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  letter-spacing: -.01em;
  min-height: 100vh;
  overflow-x: hidden;
}

.orb { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; opacity: .55; }
.orb-a { width: 620px; height: 620px; background: radial-gradient(circle, #dcecff, transparent 70%); top: -260px; left: -160px; }
.orb-b { width: 520px; height: 520px; background: radial-gradient(circle, #ffe9f0, transparent 70%); top: 260px; right: -220px; opacity: .4; }

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 34px 24px 60px; }

/* ── header ── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 42px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(145deg, #3b9bff, #0062c4);
  color: #fff; font-size: 24px; font-weight: 700; letter-spacing: -.04em;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 113, 227, .28);
}
.brand-text h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
.brand-text p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-2); }
.top-right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  backdrop-filter: blur(16px);
}
.chip.accent { color: var(--blue-ink); background: var(--blue-soft); border-color: rgba(0, 113, 227, .16); }
.chip.dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 7px; vertical-align: 1px; }
.chip.dot.offline::before { background: var(--amber); }

/* ── hero ── */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 0 4px 34px;
}
.eyebrow { font-size: 12px; font-weight: 650; color: var(--blue); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
.hero h2 { margin: 0; font-size: clamp(30px, 4.4vw, 44px); font-weight: 680; letter-spacing: -.045em; line-height: 1.12; }
.hero p { margin: 10px 0 20px; color: var(--text-2); font-size: 16px; }
.pack-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.pack-btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  padding: 9px 16px; border-radius: 999px; font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer; transition: .2s ease; backdrop-filter: blur(16px);
}
.pack-btn:hover { transform: translateY(-1px); border-color: var(--blue); color: var(--blue); }
.pack-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 6px 18px rgba(0, 113, 227, .24); }
.hero-ring { position: relative; width: 120px; height: 120px; flex: 0 0 120px; }
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(0, 0, 0, .06); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--blue); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .5s cubic-bezier(.2,.8,.2,1); }
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-text b { font-size: 30px; font-weight: 680; line-height: 1; letter-spacing: -.04em; }
.ring-text span { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* ── tabs ── */
.tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 22px;
  background: rgba(0, 0, 0, .045); border-radius: 14px; width: fit-content;
  border: 1px solid var(--line);
}
.tab {
  border: 0; background: transparent; color: var(--text-2); font: inherit;
  font-size: 14px; font-weight: 550; padding: 9px 22px; border-radius: 11px;
  cursor: pointer; transition: .2s ease; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); font-weight: 620; }

/* ── cards / layout ── */
.panel { display: none; animation: rise .38s cubic-bezier(.2,.8,.2,1) both; }
.panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); backdrop-filter: blur(24px);
  margin-bottom: 18px; transition: box-shadow .25s ease, transform .25s ease;
}
.card:hover { box-shadow: var(--shadow-lift); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 17px; font-weight: 640; letter-spacing: -.025em; }
.sub { font-size: 12.5px; color: var(--text-3); }
.badge { font-size: 12px; font-weight: 600; color: var(--blue-ink); background: var(--blue-soft); padding: 5px 12px; border-radius: 999px; }
.hint { margin: 16px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.hint-inline { font-size: 12.5px; color: var(--text-3); }
.lead { margin: -4px 0 16px; font-size: 13.5px; color: var(--text-2); }

/* ── player ── */
.speed-switch { display: flex; gap: 6px; background: rgba(0,0,0,.04); padding: 4px; border-radius: 11px; width: fit-content; margin-bottom: 20px; }
.speed { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 550; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: .2s; }
.speed.active { background: #fff; color: var(--blue); box-shadow: 0 1px 5px rgba(0,0,0,.09); }
.player { display: flex; align-items: center; gap: 18px; }
.play-btn {
  width: 58px; height: 58px; flex: 0 0 58px; border: 0; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 113, 227, .3); transition: .2s ease;
  display: grid; place-items: center;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn:active { transform: scale(.96); }
.track { flex: 1; min-width: 0; }
.track-label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#seek { width: 100%; height: 5px; -webkit-appearance: none; appearance: none; background: rgba(0,0,0,.1); border-radius: 99px; outline: none; cursor: pointer; }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); box-shadow: 0 1px 5px rgba(0,0,0,.2); }
.times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ── words ── */
.meta-rows { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.meta-pill { font-size: 12px; color: var(--text-2); background: rgba(0,0,0,.035); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; }
.words-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.word-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px;
  background: rgba(255,255,255,.7); cursor: pointer; transition: .2s ease; text-align: left;
  font: inherit; width: 100%;
}
.word-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.word-card .w { font-size: 14.5px; font-weight: 640; color: var(--text); }
.word-card .ipa { font-size: 11.5px; color: var(--blue); display: block; margin-top: 2px; }
.word-card .cn { font-size: 12.5px; color: var(--text-2); display: block; margin-top: 5px; }
.word-card .face { font-size: 12.5px; color: var(--text-2); margin-top: 7px; display: none; line-height: 1.55; }
.word-card.open .face { display: block; }
.word-card.open { background: var(--blue-soft); border-color: rgba(0,113,227,.25); }

/* ── story book（绘本故事）── */
.book-stage { position: relative; margin-bottom: 18px; border-radius: 16px; overflow: hidden;
  background: #eef2f6; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.07); }
.book-stage.hidden { display: none; }
.book-stage img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  background: linear-gradient(135deg, #eef2f6, #e4eaf1); }
.book-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 20px 16px;
  background: linear-gradient(transparent, rgba(20,20,26,.78)); color: #fff;
  font-size: clamp(15px, 2.3vw, 20px); font-weight: 600; letter-spacing: 0; line-height: 1.45;
  text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.book-nav { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,.86); border-radius: 999px; padding: 3px 5px; backdrop-filter: blur(8px); }
.book-nav-btn { border: 0; background: transparent; color: var(--text); width: 30px; height: 30px;
  border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; transition: .15s; }
.book-nav-btn:hover { background: var(--blue); color: #fff; }
.book-page { font-size: 11.5px; color: var(--text-2); min-width: 42px; text-align: center;
  font-variant-numeric: tabular-nums; }

/* ── story ── */
.sentences { display: flex; flex-direction: column; gap: 2px; }
.sentence.with-book { gap: 10px; padding: 8px 10px; border-radius: 12px; }
.sentence.with-book .sbody { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; }
.sentence.with-book .sthumb { flex: 0 0 62px; width: 62px; height: 44px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line); background: #eef2f6; }
.sentence.with-book .sthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sentence.with-book.playing .sthumb { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
@media (max-width: 560px) {
  .sentence.with-book .sthumb { flex-basis: 52px; width: 52px; height: 38px; }
  .sentence.with-book .sbody { flex-wrap: wrap; gap: 2px 10px; }
  .sentence.with-book .wc { margin-left: auto; }
}
.sentence {
  display: flex; align-items: baseline; gap: 12px; padding: 8px 12px;
  border-radius: 10px; cursor: pointer; transition: background .18s ease;
  font-size: 16px; letter-spacing: 0; line-height: 1.65;
}
.sentence:hover { background: rgba(0,113,227,.055); }
.sentence.playing { background: var(--blue-soft); }
.sentence .num { font-size: 11px; color: var(--text-3); min-width: 22px; font-variant-numeric: tabular-nums; }
.sentence .txt { flex: 1; }
.sentence .wc { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.sentence .nw { text-decoration: underline dotted var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: 3px; color: var(--blue-ink); }
.story-foot { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ── links ── */
.links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.link-item { display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px;
  background: rgba(255,255,255,.7); font: inherit; cursor: pointer; transition: .15s; }
.link-item:hover { border-color: var(--blue); background: var(--blue-soft); }
.link-item.playing { border-color: var(--blue); background: var(--blue-soft); }
.link-item .li-play { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--blue);
  color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding-left: 2px; }
.link-item .li-body { min-width: 0; }
.link-item b { display: block; font-size: 14px; font-weight: 620; color: var(--blue-ink); }
.link-item .li-body span { display: block; font-size: 12px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }
.sentence.playing { background: var(--blue-soft); }
.icon-btn.rec { background: #ffe8e8; border-color: #ffb3b3; }
.icon-btn:disabled { opacity: .7; cursor: default; font-size: 12px; }

/* ── buttons ── */
.btn { border: 0; border-radius: 11px; font: inherit; font-size: 13.5px; font-weight: 580; padding: 10px 18px; cursor: pointer; transition: .2s ease; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 5px 14px rgba(0,113,227,.22); }
.btn.primary:hover { background: #0067d0; transform: translateY(-1px); }
.btn.ghost { background: rgba(0,0,0,.045); color: var(--text-2); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn.soft { background: var(--amber-soft); color: var(--amber); }
.btn.soft:hover { filter: brightness(.97); }
.row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ── formulas ── */
.formulas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.formula { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; background: rgba(255,255,255,.68); }
.formula .fhead { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.formula .fnum { width: 25px; height: 25px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.formula .ftitle { font-size: 13.5px; font-weight: 620; }
.blocks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.block { padding: 7px 11px; border-radius: 9px; font-size: 13px; font-weight: 550; background: rgba(0,0,0,.045); color: var(--text-2); border: 1px solid var(--line); }
.block.slot { background: var(--blue-soft); border: 1px dashed rgba(0,113,227,.45); color: var(--blue-ink); padding: 0; }
.block.slot input { border: 0; background: transparent; outline: none; font: inherit; font-size: 13px; color: var(--blue-ink); width: 96px; padding: 7px 10px; }
.block.slot input::placeholder { color: rgba(0,98,196,.45); }
.plus { color: var(--text-3); font-size: 13px; }
.fhow { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 4px; }
.fscene { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.fpreview { background: var(--green-soft); border: 1px solid rgba(46,158,98,.18); border-radius: 10px; padding: 11px 13px; font-size: 14px; color: #1c6e42; min-height: 42px; margin-bottom: 10px; }
.fexamples { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.fexamples b { color: var(--text-2); font-weight: 600; }

/* ── my sentences / check ── */
.my-sentences { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mine { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255,255,255,.7); font-size: 14px; }
.mine .idx { font-size: 11px; color: var(--text-3); }
.mine .s { flex: 1; }
.mine .del { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1; }
.mine .del:hover { color: #d33; }
.mine.empty { color: var(--text-3); justify-content: center; font-size: 13px; border-style: dashed; }
.check-item { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: rgba(255,255,255,.72); }
.check-item .cs { font-size: 14.5px; font-weight: 600; margin-bottom: 10px; }
.check-item .good { font-size: 13px; color: var(--green); margin: 3px 0; }
.check-item .better { margin-top: 10px; background: var(--amber-soft); border-radius: 10px; padding: 11px 13px; font-size: 13px; line-height: 1.65; }
.check-item .better b { color: var(--amber); }
.check-item .pure { font-size: 12.5px; color: var(--green); margin-top: 6px; }

/* ── drop / ocr ── */
.drop { border: 1.5px dashed rgba(0,113,227,.3); border-radius: var(--radius-sm); background: rgba(232,242,255,.42); padding: 30px 20px; text-align: center; cursor: pointer; transition: .2s ease; }
.drop:hover, .drop.drag { background: rgba(232,242,255,.8); border-color: var(--blue); }
.drop-icon { font-size: 30px; color: var(--blue); margin-bottom: 8px; }
.drop p { margin: 0 0 5px; font-size: 14px; color: var(--text); }
.drop span { font-size: 12px; color: var(--text-2); }
.ocr-box { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: rgba(255,255,255,.72); }
.ocr-box .line { font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ocr-box .line:last-of-type { border-bottom: 0; }
.ocr-box .ok { font-size: 12.5px; color: var(--green); margin-top: 8px; }

/* ── speak ── */
.speak-wrap { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.chat-card { margin-bottom: 0; }
.chat { min-height: 300px; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.msg { max-width: 86%; padding: 12px 16px; border-radius: 17px; font-size: 14.5px; line-height: 1.6; animation: rise .3s ease both; }
.msg.friend { align-self: flex-start; background: rgba(0,0,0,.045); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.msg small { display: block; font-size: 11px; opacity: .6; margin-top: 4px; }
.speak-a { display: inline-block; margin-top: 7px; border: 1px solid rgba(0,113,227,.25);
  background: rgba(255,255,255,.7); color: var(--blue-ink); border-radius: 8px;
  padding: 3px 9px; font: inherit; font-size: 11.5px; cursor: pointer; }
.speak-a:hover { background: var(--blue); color: #fff; }
.follow-q { align-self: flex-start; max-width: 86%; text-align: left; margin-top: -4px;
  border: 1px dashed rgba(0,113,227,.35); background: var(--blue-soft); color: var(--blue-ink);
  border-radius: 12px; padding: 8px 13px; font: inherit; font-size: 13px; cursor: pointer;
  transition: .15s ease; }
.follow-q:hover { background: var(--blue); color: #fff; border-style: solid; }
.hint-box { margin-top: 14px; background: var(--amber-soft); border: 1px solid rgba(183,121,31,.18); border-radius: var(--radius-sm); padding: 16px; }
.hint-box.hidden { display: none; }
.hint-box h4 { margin: 0 0 10px; font-size: 13.5px; color: var(--amber); }
.hint-row { margin-bottom: 12px; }
.hint-row .cn { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.keys { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.key { border: 0; background: #fff; color: var(--blue-ink); border: 1px solid rgba(0,113,227,.2); border-radius: 8px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.key:hover { background: var(--blue); color: #fff; }
.hint-row .demo { font-size: 12.5px; color: var(--text-2); }
.hint-box .cheer { font-size: 12.5px; color: var(--amber); margin-top: 4px; }
.chat-input { display: flex; gap: 8px; margin-top: 16px; }
.chat-input input { flex: 1; border: 1px solid var(--line-strong); border-radius: 11px; padding: 11px 14px; font: inherit; font-size: 14px; outline: none; background: rgba(255,255,255,.85); }
.chat-input input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.1); }
.icon-btn { border: 1px solid var(--line); background: rgba(0,0,0,.035); border-radius: 11px; width: 42px; font-size: 16px; cursor: pointer; }
.icon-btn.rec { background: #ffe8e8; border-color: #ffb3b3; }
.side-card { margin-bottom: 0; }
.side-card h3 { margin-bottom: 10px; }
.side-card p { font-size: 13px; color: var(--text-2); line-height: 1.7; margin: 0 0 18px; }
.side-label { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 10px; }
.formula-mini .fm { font-size: 13px; color: var(--blue-ink); background: var(--blue-soft); border-radius: 9px; padding: 9px 12px; margin-bottom: 7px; }

/* ── me ── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: rgba(255,255,255,.7); }
.stat b { display: block; font-size: 26px; font-weight: 680; letter-spacing: -.04em; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--text-2); }
.week { display: flex; gap: 7px; }
.day { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 4px; background: rgba(255,255,255,.7); }
.day.today { background: var(--blue); border-color: var(--blue); color: #fff; }
.day .d { font-size: 12px; font-weight: 620; }
.day .t { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.day.today .t { color: rgba(255,255,255,.8); }
.day .dt { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.day.today .dt { color: rgba(255,255,255,.65); }
.mistakes { font: inherit; font-size: 13px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; margin: 0; }
.cmds { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cmd { background: rgba(0,0,0,.035); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; color: var(--text-2); word-break: break-all; }

.foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px); background: rgba(29,29,31,.92); color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: .28s ease; z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.2); backdrop-filter: blur(10px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ─────────────────────────── responsive ─────────────────────────── */
/* 平板 / 窄桌面：两列折成单列 */
@media (max-width: 860px) {
  .grid-2, .formulas, .speak-wrap, .cmds { grid-template-columns: 1fr; }
  .links { grid-template-columns: repeat(2, 1fr); }
  .my-sentences { grid-template-columns: 1fr; }
  .hero-ring { width: 92px; height: 92px; flex-basis: 92px; }
  .chat { min-height: 240px; }
  .admin-metrics { grid-template-columns: repeat(3, 1fr); }
  .admin-metric:nth-child(3) { border-right: 0; }
}

/* 手机（≤640）：核心适配 */
@media (max-width: 640px) {
  .wrap { padding: 20px 15px 44px; }

  /* 顶部：品牌一行、状态 chip 单独一行且可横向滚动，不撑破 */
  .top { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 26px; }
  .brand-text h1 { font-size: 18px; }
  .top-right {
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .top-right::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  /* Hero：标题独占一行，允许长中文换行；进度环移到右上角内联小徽标 */
  .hero { flex-direction: column; align-items: stretch; gap: 14px; padding: 0 2px 26px; }
  .hero-main { min-width: 0; padding-right: 82px; }
  .hero h2 { font-size: clamp(24px, 6.6vw, 30px); line-height: 1.16; overflow-wrap: anywhere; }
  .hero p { font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
  .hero-ring {
    position: absolute; top: 18px; right: 16px;
    width: 74px; height: 74px; flex-basis: auto; opacity: .95;
  }
  .hero { position: relative; }
  .ring-text b { font-size: 22px; }
  .ring-text span { font-size: 9px; }
  .pack-switch { gap: 7px; }
  .pack-btn { font-size: 12.5px; padding: 8px 13px; }

  /* Tabs：横向滚动，均分不溢出 */
  .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; padding: 9px 13px; font-size: 13px; text-align: center; }

  .card { padding: 18px; border-radius: 17px; }
  .card h3 { font-size: 16px; }
  .links { grid-template-columns: 1fr; }

  /* 播放器：进度条与按钮不挤压 */
  .player { gap: 13px; }
  .play-btn { width: 52px; height: 52px; flex-basis: 52px; }
  .track { min-width: 0; }

  /* 单词卡极窄屏保底两列 */
  .words-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .word-card { padding: 11px; }
  .word-card .w { font-size: 14px; }

  /* 造句积木：输入空位自适应 */
  .block.slot input { width: 84px; max-width: 100%; }

  /* 我的 sentences / 统计 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week { flex-wrap: wrap; }
  .day { min-width: 42px; }

  /* 聊天输入：话筒 + 输入 + 发送，发送不被切 */
  .chat-input { gap: 7px; }
  .chat-input input { min-width: 0; }
  .chat-input #sendBtn { flex: 0 0 auto; white-space: nowrap; }
  .row-actions { gap: 8px; }
  .row-actions .btn { flex: 1 1 auto; text-align: center; }

  /* 绘本字幕窄屏 */
  .book-cap { font-size: clamp(14px, 4vw, 18px); padding: 24px 14px 13px; }
}

/* 小屏手机（≤400）：进一步收紧 */
@media (max-width: 400px) {
  .wrap { padding: 18px 12px 40px; }
  .hero-ring { width: 64px; height: 64px; top: 16px; right: 12px; }
  .hero-main { padding-right: 72px; }
  .ring-text b { font-size: 19px; }
  .hero h2 { font-size: 23px; }
  .card { padding: 15px; }
  .sentence { font-size: 15px; gap: 9px; padding: 8px 9px; }
  .sentence .wc { font-size: 10px; }
  .words-grid { gap: 6px; }
  .word-card { padding: 10px; }
  .btn { font-size: 12.5px; padding: 10px 13px; }
  .tab { padding: 9px 11px; font-size: 12.5px; }
  .book-nav-btn { width: 27px; height: 27px; }
  .book-page { min-width: 38px; font-size: 10.5px; }
}

/* ==================== 登录 / 注册 / 付费墙 ==================== */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-wrap { position: relative; z-index: 1; width: min(430px, calc(100% - 34px)); padding: 30px 0; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .logo { margin: 0 auto 12px; }
.auth-brand h1 { font-size: 30px; letter-spacing: -.04em; margin: 0 0 5px; }
.auth-brand p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.auth-card { padding: 30px 28px; }
.auth-card h2 { font-size: 22px; margin: 0 0 5px; letter-spacing: -.02em; }
.auth-card .sub { display: block; margin-bottom: 22px; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 15px 0 6px; }
.auth-card input:not([type=checkbox]) {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 11px; background: var(--surface-solid); font: inherit; font-size: 15px;
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.auth-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.btn.block, .link-btn { width: 100%; }
.btn.block { display: block; text-align: center; margin-top: 24px; padding: 12px; }
.link-btn { margin-top: 16px; border: 0; background: none; color: var(--blue);
  font: inherit; font-size: 13.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.auth-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 20px; }
.toast.bad { background: #b3261e; }
.pay-card { text-align: center; }
.pay-icon { font-size: 42px; margin-bottom: 10px; }
.pay-list { text-align: left; background: var(--blue-soft); border-radius: 13px;
  padding: 15px 18px; margin: 18px 0; font-size: 13.5px; line-height: 2; color: var(--blue-ink); }
.pay-card .lead { font-size: 13px; color: var(--text-2); }

/* ==================== 管理后台 ==================== */
.admin-wrap { max-width: 1180px; }
.admin-grid { align-items: start; }
.stat-card-wide { padding: 18px 22px; margin-bottom: 16px; }
.admin-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.admin-metric { text-align: center; padding: 6px; border-right: 1px solid var(--line); }
.admin-metric:last-child { border-right: 0; }
.admin-metric b { display: block; font-size: 21px; letter-spacing: -.02em; }
.admin-metric span { font-size: 11.5px; color: var(--text-2); }
.admin-form label { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; margin: 12px 0 5px; }
.admin-form input:not([type=checkbox]), .admin-form select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; font-size: 14px; background: var(--surface-solid); color: var(--text); outline: none;
}
.admin-form input:focus, .admin-form select:focus { border-color: var(--blue); }
.check-row { display: flex !important; align-items: center; gap: 8px; margin-top: 15px !important; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th { text-align: left; color: var(--text-3); font-weight: 600;
  padding: 8px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.admin-table td { padding: 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .mini { padding: 4px 6px; border: 1px solid var(--line-strong);
  border-radius: 7px; font: inherit; font-size: 12px; background: var(--surface-solid); }
.admin-table .num { width: 82px; }
.mini-check { width: 16px; height: 16px; accent-color: var(--blue); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.off { background: #f2f2f7; color: var(--text-3); }
.ops { display: flex; gap: 5px; }
.mini-btn { border: 1px solid var(--line-strong); background: var(--surface-solid);
  border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 11.5px;
  color: var(--blue); cursor: pointer; }
.mini-btn:hover { background: var(--blue-soft); }
.mini-btn.danger { color: #b3261e; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 70px; align-items: center;
  gap: 10px; font-size: 12.5px; padding: 6px 0; }
.bar-row > span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.bar-row > b { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--blue-soft); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
@media (max-width: 860px) {
  .admin-metrics { grid-template-columns: repeat(3, 1fr); }
  .admin-metric:nth-child(3) { border-right: 0; }
}

/* 用量与 AI 按钮 */
.usage-box { background: var(--blue-soft); border-radius: 13px; padding: 12px 14px;
  font-size: 12.5px; color: var(--blue-ink); line-height: 1.7; }
.usage-line b { font-size: 18px; letter-spacing: -.02em; }
.usage-bar { height: 6px; background: rgba(255,255,255,.75); border-radius: 5px;
  overflow: hidden; margin-top: 6px; }
.usage-bar i { display: block; height: 100%; background: var(--blue); border-radius: 5px; }
.btn.soft { background: var(--blue-soft); color: var(--blue-ink); }
.btn.soft:hover { background: #d8e9ff; }
.btn.active-ai { background: var(--blue); color: #fff; }

/* AI 长期记忆提示 */
.memory-note { background: var(--blue-soft); color: var(--blue-ink); border-radius: 12px;
  padding: 11px 14px; font-size: 13px; line-height: 1.6; margin: 12px 0 4px; }
.memory-explain { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin: 0 0 10px; }

/* 微信/手机端：防止装饰元素或绝对定位撑出横向滚动 */
html, body { max-width: 100%; overflow-x: hidden; }
.auth-body { width: 100%; }
.auth-wrap { max-width: 100%; }
.auth-card input:not([type=checkbox]) { max-width: 100%; }

/* 触屏优化：去掉粘滞的 hover 位移，禁用点击蓝底，保证触控尺寸 */
@media (hover: none) {
  .card:hover, .word-card:hover, .pack-btn:hover, .btn.primary:hover,
  .nav-btn:hover, .link-item:hover { transform: none; }
}
button, .tab, .chip, .pack-btn, .speed, .book-nav-btn { -webkit-tap-highlight-color: transparent; }
.icon-btn, .book-nav-btn { touch-action: manipulation; }

/* 横屏矮屏：聊天区不要占满整屏 */
@media (max-height: 480px) and (orientation: landscape) {
  .chat { min-height: 150px; max-height: 200px; }
  .hero { padding-bottom: 18px; }
  .wrap { padding-top: 14px; }
}

/* 超窄屏（≤340）：极老机型兜底 */
@media (max-width: 340px) {
  .hero-ring { display: none; }
  .words-grid { grid-template-columns: 1fr; }
  .book-nav { top: 8px; right: 8px; }
}
