/* ============================================================
   妙脆角小猫 · AI English Tutor — Marble Minimal Design System
   暖白大理石 × 香槟金 × 衬线标题 · 温柔、干净、醒目
   ============================================================ */

:root {
  /* marble palette */
  --bg:            #f5f3ef;
  --surface:       #fffdf9;
  --surface-2:     #f0ede6;
  --surface-3:     #e9e5db;
  --border:        #e7e2d8;
  --border-strong: #d6cfc1;

  --ink:           #2d2a24;
  --ink-2:         #5d574c;
  --ink-3:         #97907f;
  --ink-4:         #bcb4a5;

  --brand:         #b0895c;   /* 香槟金 */
  --brand-soft:    #f5ebdd;
  --brand-deep:    #8a6a42;
  --violet:        #c2a983;   /* 青铜，用于渐变收尾 */
  --mint:          #2e9e8f;
  --mint-soft:     #e2f4f0;
  --amber:         #d99a2b;
  --amber-soft:    #f9f1de;
  --rose:          #d95c65;
  --rose-soft:     #fbeef0;

  /* geometry */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(90,80,60,.05), 0 1px 3px rgba(90,80,60,.04);
  --sh-2: 0 4px 16px rgba(90,80,60,.07), 0 1px 3px rgba(90,80,60,.04);
  --sh-3: 0 12px 34px rgba(90,80,60,.12), 0 2px 8px rgba(90,80,60,.05);
  --sh-brand: 0 8px 22px rgba(176,137,92,.30);

  --sidebar-w: 256px;
  --ease: cubic-bezier(.32,.72,.28,1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-en: "Georgia", "Inter", "Segoe UI", -apple-system, serif;
  --font-display: Georgia, "Times New Roman", "STZhongsong", "KaiTi", "楷体", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* 大理石底：暖白 + 淡淡的石纹 */
  background:
    radial-gradient(1100px 560px at 88% -8%, rgba(176,137,92,.075), transparent 62%),
    radial-gradient(900px 520px at -8% 108%, rgba(125,112,90,.075), transparent 60%),
    repeating-linear-gradient(113deg, transparent 0 44px, rgba(140,125,100,.030) 44px 46px, transparent 46px 128px),
    repeating-linear-gradient(64deg, transparent 0 90px, rgba(140,125,100,.022) 90px 92px, transparent 92px 210px),
    var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand-soft); }

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: content-box; }

/* ============================== SIDEBAR ============================== */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #fffefb 0%, #fbf9f4 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: transform .34s var(--ease);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px 14px; }
.brand-mark {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--sh-2);
  background: var(--surface-2);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: -.2px; font-family: var(--font-display); }
.brand-text span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.sidebar-close { display: none; margin-left: auto; }

.nav { flex: 1; padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }

.nav-group {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--ink-4); text-transform: uppercase;
  padding: 13px 12px 5px;
  display: flex; align-items: center; gap: 7px;
}
.nav-group::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background .16s, color .16s, transform .16s var(--ease);
  text-align: left; width: 100%;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(120deg, var(--brand-soft), #faf3e8);
  color: var(--brand-deep); font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(176,137,92,.22);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--brand), var(--violet));
}
.nav-ico { font-size: 17px; width: 22px; text-align: center; flex: none; }
.nav-label { white-space: nowrap; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.level-card {
  background: linear-gradient(150deg, var(--brand-soft), #f7efe2);
  border: 1px solid rgba(176,137,92,.18);
  border-radius: var(--r-md); padding: 12px 13px; margin-bottom: 10px;
}
.level-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.level-badge { font-size: 12px; font-weight: 700; color: var(--brand-deep); }
.level-xp { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.level-bar { height: 6px; background: rgba(255,255,255,.8); border-radius: 99px; overflow: hidden; }
.level-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--violet)); transition: width .5s var(--ease); }
.level-hint { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

.sys-status { display: flex; align-items: center; gap: 7px; padding: 2px 4px; }
.sys-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; box-shadow: 0 0 0 3px var(--amber-soft); }
.sys-status.ok .dot { background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.sys-status.err .dot { background: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.sys-text { font-size: 11.5px; color: var(--ink-3); }

.scrim {
  position: fixed; inset: 0; background: rgba(45,42,36,.35);
  backdrop-filter: blur(2px); opacity: 0; pointer-events: none;
  transition: opacity .28s; z-index: 55;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ============================== MAIN ============================== */
.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .34s var(--ease);
}

.topbar {
  height: 64px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(250,248,244,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.hamburger { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 700; letter-spacing: .2px; font-family: var(--font-display); }
.topbar-title p { font-size: 12.5px; color: var(--ink-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 550; color: var(--ink-2);
  transition: all .18s;
}
.pill-btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.pill-btn.off { opacity: .5; }
.pill-btn.off .pill-label { text-decoration: line-through; }

.grade-picker { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.grade-picker select {
  padding: 7px 11px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 550; color: var(--ink); cursor: pointer;
  outline: none; transition: border-color .18s;
}
.grade-picker select:hover { border-color: var(--border-strong); }
.grade-picker select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px; color: var(--ink-2);
  transition: background .16s;
}
.icon-btn:hover { background: var(--surface-2); }

.stage { flex: 1; overflow: hidden; position: relative; }
.view { display: none; height: 100%; }
.view.active { display: flex; animation: fadeUp .32s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* ============================== HERO ============================== */
.hero-card {
  display: flex; align-items: center; gap: 15px;
  padding: 16px 18px; margin-bottom: 12px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(300px 120px at 90% 0%, rgba(176,137,92,.12), transparent 70%),
    linear-gradient(120deg, #fffdf9 0%, #f8f2e8 100%);
  border: 1px solid rgba(176,137,92,.25);
  box-shadow: var(--sh-2);
  flex: none;
}
.hero-avatar {
  width: 62px; height: 62px; flex: none;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(176,137,92,.15), var(--sh-2);
  animation: heroFloat 4.5s ease-in-out infinite;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.hero-text h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.hero-text p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.hero-badge {
  margin-left: auto; flex: none; align-self: flex-start;
  font-size: 11px; font-weight: 700; color: var(--brand-deep);
  background: rgba(255,255,255,.75); border: 1px solid rgba(176,137,92,.3);
  padding: 4px 10px; border-radius: var(--r-full);
}

/* ============================== CHAT ============================== */
.chat-wrap {
  flex: 1; display: flex; flex-direction: column;
  max-width: 760px; margin: 0 auto; width: 100%;
  padding: 16px 20px 0; min-width: 0;
}

.scenario-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: none; flex: none;
}
.scenario-row::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; padding: 8px 15px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 550; color: var(--ink-2);
  transition: all .18s var(--ease); white-space: nowrap;
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); transform: translateY(-1px); }
.chip-btn.active { background: linear-gradient(120deg, var(--brand), var(--violet)); border-color: var(--brand); color: #fff; box-shadow: var(--sh-brand); }

.messages { flex: 1; overflow-y: auto; padding: 6px 2px 14px; display: flex; flex-direction: column; gap: 16px; }

.msg { display: flex; gap: 11px; max-width: 100%; animation: msgIn .34s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 17px;
  background: var(--surface-2); overflow: hidden;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.msg.tutor .avatar {
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--sh-1);
  background: var(--surface);
}
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { font-size: 18px; background: var(--surface-3); }

.bubble {
  padding: 11px 15px; border-radius: var(--r-lg);
  font-size: 14.5px; line-height: 1.65;
  max-width: 78%; word-break: break-word; white-space: pre-wrap;
  position: relative;
}
.msg.tutor .bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-top-left-radius: 7px; box-shadow: var(--sh-1); color: var(--ink);
}
.msg.user .bubble {
  background: linear-gradient(130deg, var(--brand) 0%, #c2a173 100%);
  color: #fff;
  border-top-right-radius: 7px; box-shadow: var(--sh-brand);
}

.bubble .en { font-weight: 550; }
.bubble .zh { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 13px; color: var(--ink-3); }
.msg.tutor .bubble .zh { color: var(--ink-3); }

.bubble-actions { display: flex; gap: 5px; margin-top: 8px; }
.bubble-act {
  font-size: 12px; padding: 3px 9px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--ink-2); transition: all .16s;
}
.bubble-act:hover { background: var(--brand-soft); color: var(--brand-deep); }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: blink 1.3s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.correction-card {
  margin-top: 9px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px;
}
.cc-head {
  padding: 7px 12px; font-size: 12px; font-weight: 700;
  background: var(--mint-soft); color: #1c7365; letter-spacing: .2px;
}
.cc-body { padding: 9px 12px; display: flex; flex-direction: column; gap: 5px; }
.cc-line { display: flex; gap: 8px; align-items: flex-start; }
.cc-tag { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; margin-top: 2px; }
.cc-tag.bad { background: var(--rose-soft); color: #b0424a; }
.cc-tag.good { background: var(--mint-soft); color: #1c7365; }
.cc-tag.why { background: var(--amber-soft); color: #a06f14; }
.cc-text { flex: 1; }
.cc-text s { color: var(--ink-3); }

.composer { flex: none; padding: 12px 0 18px; border-top: 1px solid var(--border); background: linear-gradient(180deg, rgba(245,243,239,0), var(--bg) 34%); }

.mic-row { display: flex; flex-direction: column; align-items: center; gap: 7px; margin-bottom: 11px; }

.mic-btn {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), #c2a173);
  color: #fff; display: grid; place-items: center;
  box-shadow: var(--sh-brand);
  position: relative; transition: transform .2s var(--ease), box-shadow .2s;
}
.mic-btn:hover { transform: scale(1.06); }
.mic-btn:active { transform: scale(.95); }
.mic-btn .mic-ico { font-size: 23px; position: relative; z-index: 2; line-height: 1; }
.mic-btn .mic-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; }
.mic-btn.rec { background: linear-gradient(140deg, var(--rose), #e08576); box-shadow: 0 8px 22px rgba(217,92,101,.32); }
.mic-btn.rec .mic-ring { animation: pulse 1.5s ease-out infinite; opacity: 1; border-color: var(--rose); }
@keyframes pulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.75); opacity: 0; } }
.mic-btn.big { width: 76px; height: 76px; }
.mic-btn.big .mic-ico { font-size: 30px; }

.mic-hint { font-size: 12px; color: var(--ink-3); font-weight: 500; min-height: 17px; }
.mic-hint.live { color: var(--rose); font-weight: 650; }

.input-row { display: flex; gap: 9px; align-items: center; }
.input-row input {
  flex: 1; padding: 12px 17px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  outline: none; font-size: 14px; transition: border-color .18s, box-shadow .18s;
  box-shadow: var(--sh-1);
}
.input-row input::placeholder { color: var(--ink-4); }
.input-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.send-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: linear-gradient(130deg, var(--brand), var(--violet));
  color: #fff; font-size: 17px;
  display: grid; place-items: center; box-shadow: var(--sh-brand);
  transition: transform .18s var(--ease), opacity .18s;
}
.send-btn:hover { transform: scale(1.07); }
.send-btn:disabled { opacity: .4; transform: none; cursor: not-allowed; }

/* chat side panel */
.side-panel {
  width: 268px; flex: none; padding: 16px 18px 16px 0;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
}
.sp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 15px; box-shadow: var(--sh-1);
}
.sp-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.1px; font-family: var(--font-display); }
.sp-card p { font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.goal-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.goal-list li { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.goal-list li::before { content: '○'; color: var(--ink-4); font-size: 11px; margin-top: 1px; }
.goal-list li.done { color: var(--mint); text-decoration: line-through; text-decoration-color: var(--mint); }
.goal-list li.done::before { content: '●'; color: var(--mint); }

.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip {
  font-size: 12px; padding: 4px 10px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--ink-2); font-weight: 550;
}
.word-chip.new { background: var(--amber-soft); color: #a06f14; }

/* ============================== PANELS ============================== */
.panel-wrap {
  flex: 1; overflow-y: auto; padding: 24px 24px 40px;
  display: flex; justify-content: center; align-items: flex-start;
}
.card {
  background:
    repeating-linear-gradient(100deg, transparent 0 60px, rgba(140,125,100,.016) 60px 62px, transparent 62px 160px),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-2);
  padding: 26px 28px; width: 100%;
}
.card.wide { max-width: 780px; }
.card-head { margin-bottom: 20px; }
.card-head h2 {
  font-size: 21px; font-weight: 700; letter-spacing: .3px; margin-bottom: 4px;
  font-family: var(--font-display);
  display: inline-block; padding-bottom: 8px; position: relative;
}
.card-head h2::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 38px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--violet));
}
.card-head p { font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }

.field-label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 7px; }

/* buttons */
.primary-btn {
  padding: 11px 22px; border-radius: var(--r-full);
  background: linear-gradient(130deg, var(--brand) 0%, #c2a173 100%);
  color: #fff; font-size: 14px; font-weight: 620;
  box-shadow: var(--sh-brand); transition: transform .18s var(--ease), opacity .18s;
}
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0) scale(.98); }
.primary-btn:disabled { opacity: .45; transform: none; cursor: not-allowed; box-shadow: none; }

.ghost-btn {
  padding: 10px 18px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  transition: all .18s;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }

.row-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.row-actions.compact { gap: 7px; }
.row-actions.compact .chip-btn { font-size: 12.5px; padding: 7px 13px; }

textarea, .card input[type=text] {
  width: 100%; padding: 13px 16px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface);
  outline: none; font-size: 14.5px; resize: vertical;
  line-height: 1.65; transition: border-color .18s, box-shadow .18s;
  font-family: var(--font-en);
}
textarea:focus, .card input[type=text]:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea::placeholder, input::placeholder { color: var(--ink-4); }

/* tabs */
.tab-row {
  display: flex; gap: 8px; padding: 5px;
  background: var(--surface-2); border-radius: var(--r-full);
  width: fit-content; margin-bottom: 20px;
}
.tab-btn {
  padding: 9px 20px; border-radius: var(--r-full);
  font-size: 13.5px; font-weight: 620; color: var(--ink-3);
  transition: all .2s var(--ease);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: var(--surface); color: var(--brand-deep);
  box-shadow: var(--sh-1), inset 0 0 0 1px rgba(176,137,92,.25);
}

/* ============================== SPEAK ============================== */
.speak-body { display: flex; flex-direction: column; align-items: center; gap: 22px; }

.sentence-box {
  width: 100%; padding: 24px 26px; border-radius: var(--r-lg);
  background:
    radial-gradient(280px 110px at 100% 0%, rgba(176,137,92,.10), transparent 70%),
    linear-gradient(150deg, #faf5ec, #f3ecdf);
  border: 1px solid rgba(176,137,92,.2);
  text-align: center;
}
.sentence-en { font-family: var(--font-en); font-size: 24px; font-weight: 680; line-height: 1.45; letter-spacing: -.2px; color: var(--ink); }
.sentence-en .hl { color: var(--brand-deep); background: rgba(255,255,255,.8); border-radius: 5px; padding: 0 3px; }
.sentence-zh { margin-top: 9px; font-size: 13.5px; color: var(--ink-2); }
.sentence-tools { display: flex; gap: 9px; justify-content: center; margin-top: 17px; flex-wrap: wrap; }

.score-ring-wrap { position: relative; width: 120px; height: 120px; }
.score-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: var(--brand); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset .7s var(--ease), stroke .4s;
}
.score-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--ink);
  font-family: var(--font-display);
}

.speak-actions { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.score-feedback { margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }

.fb-card {
  border-radius: var(--r-md); padding: 12px 15px; font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.6;
  animation: fadeUp .3s var(--ease);
}
.fb-card.good { background: var(--mint-soft); color: #1c7365; }
.fb-card.warn { background: var(--amber-soft); color: #8a6212; }
.fb-card.info { background: var(--brand-soft); color: var(--brand-deep); }
.fb-ico { font-size: 15px; flex: none; }
.fb-card b { font-weight: 700; }

.diff-word { border-radius: 4px; padding: 0 2px; }
.diff-word.bad { background: rgba(217,92,101,.15); color: #b0424a; text-decoration: line-through; }
.diff-word.good { background: rgba(46,158,143,.16); color: #1c7365; font-weight: 650; }

/* ============================== CORRECT ============================== */
.correct-body { display: flex; flex-direction: column; gap: 14px; }

.wrong-sentence {
  padding: 20px 22px; border-radius: var(--r-lg);
  background: var(--rose-soft); border: 1px dashed rgba(217,92,101,.35);
  font-family: var(--font-en); font-size: 19px; font-weight: 600;
  color: #a13a42; line-height: 1.55;
}

.result-box { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.verdict {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 17px; border-radius: var(--r-md);
  font-size: 14.5px; font-weight: 650; animation: fadeUp .3s var(--ease);
}
.verdict.right { background: var(--mint-soft); color: #1c7365; }
.verdict.wrong { background: var(--rose-soft); color: #b0424a; }
.verdict.close { background: var(--amber-soft); color: #a06f14; }
.verdict-ico { font-size: 19px; }

/* ============================== BLANK ============================== */
.blank-top { margin-bottom: 18px; }
.blank-progress { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 620; color: var(--ink-3); margin-bottom: 8px; }
.blank-score { color: var(--brand-deep); }
.blank-bar { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.blank-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--violet)); transition: width .45s var(--ease); }

.blank-body { display: flex; flex-direction: column; gap: 18px; }

.blank-sentence {
  padding: 22px 24px; border-radius: var(--r-lg);
  background: var(--surface-2); font-family: var(--font-en);
  font-size: 20px; line-height: 1.9; font-weight: 550; text-align: center;
  color: var(--ink);
}
.blank-slot {
  display: inline-block; min-width: 92px; padding: 0 10px;
  border-bottom: 2.5px solid var(--brand); color: var(--brand-deep);
  font-weight: 750; text-align: center; transition: all .25s;
}
.blank-slot.filled { border-bottom-color: transparent; background: rgba(255,255,255,.9); border-radius: 7px; box-shadow: var(--sh-1); }
.blank-slot.ok { color: var(--mint); border-bottom-color: var(--mint); }
.blank-slot.no { color: var(--rose); border-bottom-color: var(--rose); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; }
.choice {
  padding: 15px 18px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--border);
  font-family: var(--font-en); font-size: 16px; font-weight: 620;
  transition: all .18s var(--ease); text-align: center;
}
.choice:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-2px); }
.choice:disabled { cursor: default; }
.choice.picked { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.choice.right { border-color: var(--mint); background: var(--mint-soft); color: #1c7365; }
.choice.wrong { border-color: var(--rose); background: var(--rose-soft); color: #b0424a; }

/* ============================== LISTEN ============================== */
.listen-pane { display: flex; flex-direction: column; gap: 15px; }

.listen-play-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.play-btn {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), #c2a173);
  color: #fff; font-size: 30px;
  display: grid; place-items: center;
  box-shadow: var(--sh-brand);
  transition: transform .2s var(--ease);
  position: relative;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn:active { transform: scale(.94); }
.play-btn.playing .mic-ring { animation: pulse 1.4s ease-out infinite; opacity: 1; border-color: var(--brand); }
.play-btn .mic-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; }

.listen-hint {
  text-align: center; font-size: 13.5px; color: var(--ink-3);
  padding: 13px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}

.story-controls { display: flex; gap: 9px; flex-wrap: wrap; }
.story-status {
  font-size: 13.5px; color: var(--ink-3); text-align: center;
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.story-status.live { color: var(--brand-deep); background: var(--brand-soft); border-style: solid; border-color: rgba(176,137,92,.35); font-weight: 600; }

.passage-reveal {
  padding: 18px 20px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border);
  animation: fadeUp .35s var(--ease);
}
.passage-reveal .pr-en { font-family: var(--font-en); font-size: 16.5px; line-height: 1.9; color: var(--ink); }
.passage-reveal .pr-zh { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-strong); font-size: 13.5px; color: var(--ink-2); line-height: 1.8; }

/* quiz (shared by listening + reading) */
.quiz { display: flex; flex-direction: column; gap: 17px; }
.quiz-q {
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--sh-1);
}
.quiz-q .qq-title { font-family: var(--font-en); font-size: 16px; font-weight: 650; margin-bottom: 12px; }
.qq-num {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; margin-right: 8px; font-family: var(--font);
}
.qq-opts { display: flex; flex-direction: column; gap: 8px; }
.qq-opt {
  text-align: left; padding: 11px 15px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--surface);
  font-family: var(--font-en); font-size: 14.5px; font-weight: 550;
  transition: all .16s var(--ease); display: flex; gap: 10px; align-items: center;
}
.qq-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.qq-opt:disabled { cursor: default; }
.qq-opt .opt-key {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--ink-3); font-family: var(--font);
}
.qq-opt.picked { border-color: var(--brand); background: var(--brand-soft); }
.qq-opt.picked .opt-key { background: var(--brand); color: #fff; }
.qq-opt.right { border-color: var(--mint); background: var(--mint-soft); }
.qq-opt.right .opt-key { background: var(--mint); color: #fff; }
.qq-opt.wrong { border-color: var(--rose); background: var(--rose-soft); }
.qq-opt.wrong .opt-key { background: var(--rose); color: #fff; }
.qq-explain {
  margin-top: 10px; padding: 10px 13px; border-radius: var(--r-sm);
  background: var(--surface-2); font-size: 13px; color: var(--ink-2); line-height: 1.7;
  animation: fadeUp .3s var(--ease);
}

/* ============================== READ ============================== */
.read-actions-top { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }

.passage-card {
  padding: 24px 28px; border-radius: var(--r-lg);
  background:
    radial-gradient(320px 130px at 100% 0%, rgba(176,137,92,.08), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(140,125,100,.03) 34px 35px, transparent 35px 100%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-1);
  margin-bottom: 18px;
}
.passage-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 12px; letter-spacing: .2px; }
.passage-text { font-family: var(--font-en); font-size: 16.5px; line-height: 2.05; color: var(--ink); }
.passage-meta { margin-top: 12px; font-size: 12px; color: var(--ink-3); display: flex; gap: 14px; }

.gloss-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.gloss-chip {
  font-size: 12.5px; padding: 5px 12px; border-radius: var(--r-full);
  background: var(--brand-soft); color: var(--brand-deep);
  border: 1px solid rgba(176,137,92,.25); font-weight: 600;
  transition: all .16s;
}
.gloss-chip:hover { background: #efe2cd; transform: translateY(-1px); }

.zh-reveal {
  margin-top: 14px; padding: 13px 16px; border-radius: var(--r-md);
  background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); line-height: 1.85;
  animation: fadeUp .35s var(--ease);
}
.zh-reveal b { color: var(--ink); }

/* ============================== PHOTO ============================== */
.photo-body { display: flex; flex-direction: column; gap: 15px; }

.drop-zone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  min-height: 210px; display: grid; place-items: center;
  background: var(--surface-2); cursor: pointer;
  transition: all .22s var(--ease); overflow: hidden; position: relative;
  padding: 20px;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone.has-img { border-style: solid; border-color: var(--border); background: #fff; padding: 0; }
.dz-inner { text-align: center; }
.dz-ico { font-size: 38px; margin-bottom: 9px; }
.dz-title { font-size: 14.5px; font-weight: 640; margin-bottom: 4px; }
.dz-sub { font-size: 12.5px; color: var(--ink-3); }
#photoPreview { display: none; max-height: 340px; width: auto; margin: 0 auto; }
.drop-zone.has-img #photoPreview { display: block; }
.drop-zone.has-img .dz-inner { display: none; }

.explain-box { margin-top: 4px; display: flex; flex-direction: column; gap: 11px; }

.exp-card {
  border-radius: var(--r-md); padding: 15px 17px; background: var(--surface-2);
  border-left: 3px solid var(--brand); animation: fadeUp .3s var(--ease);
}
.exp-card h4 { font-size: 13px; font-weight: 700; color: var(--brand-deep); margin-bottom: 7px; }
.exp-card p { font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; }
.exp-card.answer { border-left-color: var(--mint); background: var(--mint-soft); }
.exp-card.answer h4 { color: #1c7365; }
.exp-card.answer p { color: #145f54; font-weight: 600; }

/* ============================== WRITE ============================== */
.write-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 1140px; width: 100%; align-items: start; }
.write-layout .card { padding: 22px 24px; }
.write-body { display: flex; flex-direction: column; gap: 8px; }

.topic-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }

.write-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); padding: 0 3px; }

.review-box { display: flex; flex-direction: column; gap: 11px; max-height: 62vh; overflow-y: auto; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty-ico { font-size: 34px; margin-bottom: 10px; opacity: .8; }
.empty-state p { font-size: 13.5px; }
.empty-mascot {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 12px; opacity: .92;
  border: 2px solid var(--border-strong);
}

.rv-block { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); animation: fadeUp .3s var(--ease); }
.rv-head { padding: 9px 14px; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.rv-head.good { background: var(--mint-soft); color: #1c7365; }
.rv-head.bad  { background: var(--rose-soft); color: #b0424a; }
.rv-head.tip  { background: var(--amber-soft); color: #a06f14; }
.rv-head.up   { background: var(--brand-soft); color: var(--brand-deep); }
.rv-body { padding: 12px 14px; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.rv-body ul { margin: 0; padding-left: 19px; display: flex; flex-direction: column; gap: 6px; }
.rv-body li::marker { color: var(--ink-4); }

.score-badge {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 26px; font-weight: 820; letter-spacing: -1px; color: var(--brand-deep);
  font-family: var(--font-display);
}
.score-badge small { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }

.polished {
  background: var(--surface-2); border-radius: var(--r-md);
  padding: 13px 15px; font-family: var(--font-en); font-size: 14px;
  line-height: 1.85; color: var(--ink);
}

/* ============================== MISC ============================== */
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block { display: flex; align-items: center; gap: 10px; padding: 18px; color: var(--ink-3); font-size: 13.5px; justify-content: center; }
.loading-block img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-strong); animation: heroFloat 2.6s ease-in-out infinite; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fffbf5; padding: 11px 20px;
  border-radius: var(--r-full); font-size: 13.5px; font-weight: 550;
  box-shadow: var(--sh-3); opacity: 0; pointer-events: none;
  transition: all .3s var(--ease); z-index: 200; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--rose); }

.star-burst { position: fixed; font-size: 22px; pointer-events: none; z-index: 300; animation: burst .9s var(--ease) forwards; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0,0) scale(.5); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.35); }
}

/* ============================== RESPONSIVE ============================== */
@media (max-width: 1180px) {
  .side-panel { display: none; }
}
@media (max-width: 900px) {
  .write-layout { grid-template-columns: 1fr; }
  .panel-wrap { padding: 18px 14px 32px; }
  .card { padding: 20px 18px; border-radius: var(--r-lg); }
  .hero-avatar { width: 52px; height: 52px; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--sh-3); }
  .sidebar-close { display: grid; }
  .main { margin-left: 0; }
  .hamburger { display: grid; }
  .topbar { padding: 0 14px; gap: 9px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title p { display: none; }
  .pill-label { display: none; }
  .grade-picker label { display: none; }
  .chat-wrap { padding: 12px 12px 0; }
  .hero-card { padding: 13px 14px; gap: 11px; }
  .hero-text h2 { font-size: 16.5px; }
  .hero-text p { font-size: 12px; }
  .bubble { max-width: 88%; }
  .sentence-en { font-size: 19px; }
  .blank-sentence { font-size: 17px; padding: 18px; }
  .wrong-sentence { font-size: 16.5px; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .choice { font-size: 14.5px; padding: 13px; }
  .score-num { font-size: 25px; }
  .passage-card { padding: 18px 16px; }
  .passage-text { font-size: 15px; }
  .tab-btn { padding: 8px 14px; font-size: 12.5px; }
  .play-btn { width: 66px; height: 66px; font-size: 26px; }
}

/* ============================== LEVEL TOWER ============================== */
#levelCard { cursor: pointer; transition: border-color .18s, background .18s; }
#levelCard:hover { border-color: var(--brand); background: linear-gradient(120deg, var(--brand-soft), #fbf6ec); }

.lv-hero-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--brand-soft), #faf3e8);
  border: 1px solid rgba(176,137,92,.25); box-shadow: var(--sh-1);
}
.lv-hero-card.done { background: linear-gradient(120deg, #fdf6e3, var(--amber-soft)); border-color: rgba(217,154,43,.35); }
.lv-hero-mascot {
  width: 64px; height: 64px; flex: none; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--brand); box-shadow: 0 0 0 3px rgba(255,255,255,.75), var(--sh-2);
  animation: heroFloat 2.6s ease-in-out infinite;
}
.lv-hero-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--brand-deep); }
.lv-hero-sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

.level-map { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 6px; }
.map-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.map-row.passed { border-color: rgba(46,158,143,.28); background: linear-gradient(120deg, var(--mint-soft), #f5fcfb); }
.map-row.current {
  border-color: rgba(176,137,92,.4);
  background: linear-gradient(120deg, var(--brand-soft), #fbf6ec);
  box-shadow: inset 0 0 0 1px rgba(176,137,92,.18), var(--sh-2);
}
.map-row.locked { opacity: .6; }
.map-label { display: flex; align-items: baseline; gap: 8px; }
.map-ico { font-size: 15px; }
.map-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); }
.map-range { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.map-chips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.lv-chip {
  height: 30px; display: grid; place-items: center; border-radius: 8px;
  font-size: 12.5px; font-weight: 650;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--border);
}
.lv-chip.passed { background: var(--mint-soft); color: #0f766e; border-color: rgba(46,158,143,.3); }
.lv-chip.current {
  background: linear-gradient(120deg, var(--brand), var(--violet));
  color: #fffbf5; border: none; box-shadow: var(--sh-brand);
  transform: scale(1.06); animation: chipPulse 1.8s ease-in-out infinite;
}
@keyframes chipPulse { 50% { transform: scale(1.14); } }
.lv-chip.locked { background: var(--surface-2); color: var(--ink-4); }

.lv-progress {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 2px 2px 8px;
}

/* ============================== AWARDS ============================== */
.awards-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 20px; }
.sum-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 10px; text-align: center; box-shadow: var(--sh-1);
}
.sum-ico { font-size: 20px; }
.sum-num { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--brand-deep); margin-top: 2px; }
.sum-label { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.award-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 12px; text-align: center;
  transition: transform .18s var(--ease), box-shadow .18s;
}
.award-card.got {
  border-color: rgba(217,154,43,.35);
  background: linear-gradient(160deg, #fffdf9, var(--amber-soft));
  box-shadow: var(--sh-1);
}
.award-card.got:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.award-card.lock { opacity: .58; filter: grayscale(.35); }
.award-ico { font-size: 26px; }
.award-name { font-weight: 700; font-size: 13.5px; margin-top: 6px; }
.award-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.award-date { font-size: 10.5px; color: var(--brand-deep); margin-top: 7px; font-weight: 600; }

/* ============================== MIC GUIDE ============================== */
.mic-guide {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(45,42,36,.45); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: mgFade .2s ease;
}
@keyframes mgFade { from { opacity: 0; } }
.mg-card {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 28px 30px; max-width: 400px; text-align: center;
  box-shadow: var(--sh-3); border: 1px solid var(--border);
  animation: mgPop .32s var(--ease);
}
@keyframes mgPop { from { transform: scale(.9) translateY(12px); opacity: 0; } }
.mg-mascot {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 12px; border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
  animation: heroFloat 2.6s ease-in-out infinite;
}
.mg-card h3 { font-family: var(--font-display); font-size: 18px; }
.mg-card p { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.7; }
.mg-card p.mg-tip { font-size: 12.5px; color: var(--ink-3); }
.mg-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .awards-summary { grid-template-columns: repeat(2, 1fr); }
  .map-chips { grid-template-columns: repeat(5, 1fr); }
  .lv-hero-mascot { width: 52px; height: 52px; }
  .award-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .lv-hero-title { font-size: 17px; }
}
