:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #23303f;
  --muted: #7c8794;
  --line: #e6ebf2;
  --primary: #5b7cfa;
  --primary-d: #3f5ef2;
  --good: #1fbf75;
  --bad: #f2624b;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 520px at 88% -8%, #ffe9d4 0%, rgba(255, 233, 212, 0) 62%),
    radial-gradient(950px 680px at -8% 6%, #cfe0ff 0%, rgba(207, 224, 255, 0) 58%),
    linear-gradient(160deg, #c9ddfd 0%, #e2dcff 38%, #fcddca 76%, #fbf0e2 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
  min-height: 100%;
}
a { color: var(--primary); text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.brand {
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.5px;
  line-height: 1.2;
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.inline { display: inline; }
.link-btn {
  border: 0; background: none; color: var(--muted);
  font-size: 15px; padding: 0; cursor: pointer; font-family: inherit;
}
.wrap { max-width: 600px; margin: 0 auto; padding: 16px 16px 60px; margin-top: 10px;}

.flash {
  padding: 10px 14px; border-radius: 10px; margin: 8px 0; font-size: 14px;
}
.flash.error { background: #fdeceb; color: #b23b2e; }
.flash.ok { background: #e7f7ef; color: #0e8a55; }

.hero-card {
  background: linear-gradient(135deg, #5b7cfa, #7a5bfa);
  color: #fff; border-radius: var(--radius);
  padding: 22px 20px; text-align: center; margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(91,124,250,0.25);
}
.hero-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.hero-card .muted { color: rgba(255,255,255,0.85); }
.done-banner .done-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; margin-top: 10px;}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;}
.chip {
  background: rgba(255,255,255,0.18); border-radius: 999px;
  padding: 6px 12px; font-size: 13px;
}
.chip b { font-size: 16px; margin-right: 4px; }
.chip.good { background: #fff; color: var(--good); font-weight: 700; }
.chip.good b { color: var(--good); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: 12px; text-align: center;
  padding: 12px 4px; border: 1px solid var(--line);
}
.stat-num { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); }

.panel {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 16px; margin-bottom: 16px;
}
.panel-title { font-weight: 700; margin-bottom: 10px; text-align: center;}
.table-title { font-weight: 700; }

.btn {
  display: inline-block; border: 0; cursor: pointer; font-family: inherit;
  font-size: 16px; border-radius: 999px; padding: 12px 22px; font-weight: 600;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, #718bfb 0%, #4a63f2 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(63, 94, 242, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.hero-card .btn.primary,
.hero-card .btn {
  background: linear-gradient(180deg, #ffffff 0%, #edf0f8 100%);
  color: #3f46f0;
  border: 1px solid #c9d1e6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 5px 12px rgba(30, 40, 80, 0.22);
}
.hero-card .btn.btn-next-round {
  background: linear-gradient(180deg, #ffffff 0%, #e6dcff 100%);
  color: #5a4a9e;
  border: 1px solid #d3c7f0;
}
.hero-card .btn.btn-next-round:active {
  background: linear-gradient(180deg, #f4f0ff 0%, #d8caff 100%);
}
.hero-card .btn:active {
  background: linear-gradient(180deg, #e4e8f4 0%, #f5f7fc 100%);
  transform: translateY(1px);
  box-shadow: inset 0 2px 5px rgba(40, 55, 110, 0.18), 0 2px 5px rgba(30, 40, 80, 0.15);
}
.btn.ghost { background: #eef1f6; color: var(--ink); }
.btn.big { width: 100%; font-size: 18px; padding: 14px; }
.btn:disabled { opacity: 0.6; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-weight: 600; }
.good-td { color: var(--good); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-bottom: 10px;}
.small-s { font-size: 14px; }
.center { text-align: center; }
.dist-legend { margin-top: 10px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; }
.good-dot { background: var(--good); }
.bad-dot { background: var(--bad); }
.bar { position: relative; height: 14px; background: #fdeceb; border-radius: 999px; }
.ms-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid #c9d2e2;
}
.ms-dot.ms-done { background: #f6c445; border-color: #d9a322; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.panel-head .title-line {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
}
.panel-head .title-line b { color: #b8860b; }
.panel-head .title-line .title-cur { color: var(--primary); font-weight: 800; }
.ms-legend { margin-top: 4px; }
.ms-legend .ms-on { color: #b8860b; font-weight: 700; }
.modal { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(20,28,40,.45); align-items: center; justify-content: center; padding: 16px; }
.modal.show { display: flex; }
.modal-card {
  background: #fff; border-radius: 16px; padding: 16px; width: 100%; max-width: 520px;
  max-height: 86vh; overflow: auto;
}
.shop-confirm {
  margin-top: 10px; background: #fff8e3; border: 1px solid #f0d79a; border-radius: 10px;
  padding: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.shop-confirm[hidden] { display: none; }
.shop-confirm span { flex: 1; min-width: 140px; font-size: 14px; }
.btn.home-deco-btn { display: block; width: fit-content; max-width: 100%; margin: 8px auto 0; text-align: center; font-size: 12px; padding: 4px 12px; color: var(--muted); }
.coco-home .scene {
  position: relative; height: 150px; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.scene-coco { width: 92px; height: 92px; border-radius: 18px; }
.wear { position: absolute; font-size: 30px; line-height: 1; }
.wear-head { left: 50%; top: 6px; transform: translateX(-50%); font-size: 34px; }
.wear-glasses { left: 50%; top: 52px; transform: translateX(-50%); font-size: 36px; }
.wear-neck { left: 50%; top: calc(50% + 15px); transform: translate(-50%, -50%); font-size: 26px; }
.shop-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.shop-slot { width: 42px; flex: none; color: var(--muted); font-size: 13px; padding-top: 8px; }
.shop-items { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.shop-item {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 6px 10px; cursor: pointer; font-family: inherit; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px;
}
.shop-item .si-emoji { font-size: 20px; min-height: 22px; }
.shop-item .si-price { color: var(--muted); }
.shop-item.owned { border-color: #9ed4b5; }
.shop-item.on { border-color: var(--primary); background: #eef3ff; }
.shop-msg {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #e8590c;
  min-height: 18px;
}
.shop-item.sel {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.45);
  background: #f4f7ff;
}
.pie-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pie-box { position: relative; width: 150px; height: 150px; flex: none; }
.pie { width: 150px; height: 150px; transform: rotate(-90deg); }
.pie-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.pie-num { font-size: 20px; font-weight: 800; color: var(--good); }
.pie-legend { flex: 1; min-width: 180px; }
.pie-legend td { font-size: 13px; }
.pie-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.bar-good { height: 100%; background: var(--good); border-radius: 999px; }

.auth-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 24px 20px; max-width: 400px; margin: 30px auto;
}
.auth-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 14px;
}
.auth-card h1 { margin: 0 0 16px; font-size: 22px; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.auth-card input {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 16px; font-family: inherit;
}
.auth-card input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { font-size: 12px; color: var(--muted); }

.stage-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 4px; }
.stage-head h1 { margin: 0; font-size: 20px; }

.q-card {
  position: relative;
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 24px 20px; margin-bottom: 14px;
}
.enc-ticker {
  height: 24px; overflow: hidden; margin-top: 6px;
}
.enc-track { will-change: transform; }
.enc-item {
  height: 24px; line-height: 24px; font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pxline {
  margin-top: 8px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 14px;
  color: #fff7dd;
}
.pxline b { color: #ffe08a; font-size: 18px; margin-left: 2px; }
.pxbar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: #fff8e3;
  border: 1px solid #f3dd9a;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 16px;
}
.pxbar b { color: #b8860b; font-size: 22px; }
.pxpop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 2px solid #f2c14e;
  color: #b8860b;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  animation: pxin 0.3s ease;
}
.pxpop img { width: 28px; height: 28px; border-radius: 7px; }
.pxpop i { font-style: normal; font-size: 12px; color: #8a6d1a; font-weight: 600; }
.pxpop.out { opacity: 0; transition: opacity 0.4s ease; }
@keyframes pxin {
  from { transform: translate(-50%, -14px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.q-card.shake {
  animation: shake 0.5s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.rw {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}
.rw-card {
  background: #fff;
  border: 3px solid #f2c14e;
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 22px 34px;
  text-align: center;
  animation: rw-in 0.4s cubic-bezier(0.2, 1.6, 0.35, 1);
}
.rw.out .rw-card {
  transform: scale(1.25);
  opacity: 0;
  transition: all 0.35s ease;
}
@keyframes rw-in {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.rw-card img {
  width: 96px;
  height: 96px;
  display: block;
  margin: 0 auto 6px;
  border-radius: 18px;
}
.rw-amount {
  font-size: 34px;
  font-weight: 900;
  color: #b8860b;
  line-height: 1.2;
}
.rw-amount b { color: #7a5a10; }
.rw-total {
  font-size: 14px;
  color: #8a6d1a;
  margin-top: 4px;
}
.cf {
  position: absolute;
  top: 34%;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  opacity: 1;
  animation: cf-go 1.1s ease-out forwards;
}
@keyframes cf-go {
  to {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rr));
    opacity: 0;
  }
}
.word-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.word-big { font-size: 34px; font-weight: 800; letter-spacing: 0.5px; word-break: break-word; text-align: center; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 50%;
  width: 42px; height: 42px; font-size: 18px; cursor: pointer;
}
.timer { text-align: center; margin: 14px 0 4px; font-size: 15px; color: var(--muted); }
.tnum { font-size: 34px; font-weight: 800; color: var(--bad); margin-right: 4px; }
.tmuted { font-size: 14px; }
textarea#answerInput {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-size: 18px; font-family: inherit; margin-top: 10px; resize: none;
}
textarea#answerInput:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.mic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.mic-status { color: var(--bad); font-size: 12px; line-height: 1.4; }
button#micBtn.on { color: var(--good); font-weight: 700; }
.row-btns { display: flex; gap: 10px; margin-top: 12px; }
.row-btns .btn { flex: 1; }

.fb-status { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 12px; }
.fb-ok { color: var(--good); }
.fb-no { color: var(--bad); }
.fb-word { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 8px; }
.fb-answer { text-align: center; font-size: 20px; font-weight: 700; }
.fb-example {
  text-align: center; color: var(--ink); margin-top: 10px; font-size: 20px;
  background: #f6f8fc; border-radius: 10px; padding: 10px;
}
.fb-grad { text-align: center; color: var(--good); font-weight: 700; margin: 6px 0; }
.fb-question { text-align: center; margin-top: 12px; }
.seg { display: flex; gap: 8px; margin-top: 8px; }
.seg-btn {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 10px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.seg-btn.active.ok { background: #e7f7ef; border-color: var(--good); color: var(--good); font-weight: 700; }
.seg-btn.active.no { background: #fdeceb; border-color: var(--bad); color: var(--bad); font-weight: 700; }

.learn-card { text-align: center; }
.recall-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  cursor: pointer;
}
.recall-word {
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.5px;
  color: var(--ink);
  line-height: 1.2;
}
.recall-hint { margin-top: 20px; font-size: 14px; }
.word-syl span.sw {
  display: inline-block;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 6px;
  letter-spacing: 0;
}
.word-syl span.sw:nth-child(4n + 1) { background: #fdebd4; }
.word-syl span.sw:nth-child(4n + 2) { background: #e2edfc; }
.word-syl span.sw:nth-child(4n + 3) { background: #e4f2e6; }
.word-syl span.sw:nth-child(4n + 4) { background: #f1e6f7; }
.learn-card .word-big { font-size: 40px; }


.learn-phonetic { color: var(--muted); font-size: 18px; margin-top: 6px; }
.learn-morph {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  font-weight: 700;
}
.learn-morphbox {
  margin-top: 12px;
  background: #f2f7ff;
  border: 1px dashed #a9c6ef;
  border-radius: 10px;
  padding: 9px 12px 10px;
  text-align: center;
}
.morph-label {
  font-size: 12px;
  color: #6b86b0;
  font-weight: 700;
  margin-bottom: 2px;
}
.learn-morph .morph {
  padding: 1px 6px;
  border-radius: 6px;
}
.learn-morph .morph.pre { background: #e2edfc; color: #2b5fb0; }
.learn-morph .morph.suf { background: #e4f2e6; color: #2f7d3a; }
.learn-morph .morph.root { background: #fdebd4; color: #b3601a; }
.learn-morph .morph.mid { color: var(--ink); }
.learn-morph i { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 600; }
.morph-legend { margin-top: 4px; line-height: 1.6; }
.collapsed-row { display: none; }
.collapse-btn { display: block; margin: 10px auto 0; }
.flag-toggle {
  border: 1px solid #bcd3f5;
  background: #eaf2ff;
  color: #2b5fb0;
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
}
.flag-toggle:active { background: #d8e7ff; }
.grad-link {
  display: inline-block;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e7f7ef;
  color: #0e8a55;
  font-weight: 800;
}
.grad-link:active { background: #d3f0e0; }
.list-table td { text-align: left; }
.list-table .word-cell { font-weight: 700; white-space: nowrap; }
.list-table .meaning-cell { font-size: 13px; }
.list-table .unit-cell { color: var(--muted); white-space: nowrap; }
.learn-meaning { font-size: 22px; font-weight: 800; margin-top: 16px; }
.learn-tips {
  margin-top: 12px;
  background: #fff8e3;
  border: 1px dashed #eccf7a;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 17px;
  line-height: 1.6;
  color: #8a6d1a;
  text-align: left;
}
.learn-examples { margin-top: 14px; text-align: left; }
.ex-item {
  background: #f6f8fc;
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.5;
}
.ex-sense { color: #2b5fb0; font-weight: 700; }
.ex-zh { color: var(--muted); }
.ex-item .learn-hl { color: #e8590c; font-weight: 700; }
.learn-example { margin-top: 24px; font-size: 20px; background: #f6f8fc; border-radius: 10px; padding: 18px; }
.learn-example .learn-hl { color: #e8590c; font-weight: 700; }
.learn-example-zh { margin-top: 10px; font-size: 15px; }

.done-card { text-align: center; }
.done-big { font-size: 18px; line-height: 1.7; margin-bottom: 6px; }

@media (max-width: 480px) {
  .brand { font-size: 14px; letter-spacing: 0; }
  .nav { gap: 8px; font-size: 14px; }
}
@media (max-width: 380px) {
  .word-big { font-size: 28px; }
}

.coco-anim { object-fit: contain; background: #fff; }
.auth-coco.coco-anim { width: 84px; height: 84px; border-radius: 20px; }
.hero-coco.coco-anim { width: 132px; height: 132px; padding: 20px; box-sizing: border-box; border-radius: 28px; }
.brand-icon {
  height: 24px;
  width: 24px;
  vertical-align: -5px;
  margin-right: 6px;
  border-radius: 6px;
}
.hero-coco {
  width: 92px;
  height: 92px;
  object-fit: cover;
  display: block;
  margin: -30px auto 4px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.auth-coco {
  width: 84px;
  height: 84px;
  object-fit: cover;
  display: block;
  margin: 0 auto 8px;
  border-radius: 20px;
}
.page-h1 { margin: 10px 4px; font-size: 22px; }
.mic-big { font-size: 15px; padding: 10px 4px; min-height: 22px; }
.mic-big.ok { color: var(--good); font-weight: 700; }
.mic-big.err { color: var(--bad); font-weight: 700; }
.mic-big.warn { color: #d9822b; font-weight: 700; }
.result-box {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px;
  font-size: 20px; min-height: 30px; background: #fafcff;
}
.log-box {
  background: #1d2733; color: #9fe6c0; border-radius: 10px;
  padding: 10px; font-size: 12px; overflow: auto;
  max-height: 220px; white-space: pre-wrap; word-break: break-all;
}
.help { margin: 0; padding-left: 18px; font-size: 14px; }
.help li { margin-bottom: 8px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }
.device-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.device-row select {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; font-size: 14px; font-family: inherit; background: #fff;
  max-width: 100%;
}
.smallbtn { padding: 6px 12px; font-size: 13px; width: auto; margin: 0; }
.pin-btn { display: block; margin: 20px auto 0; margin-bottom: 10px;}
.pin-btn.on { background: #fff0d9; color: #b3601a; border: 1px solid #f0c98a; }
.field-static { font-size: 14px; margin-bottom: 12px; }
.auth-card label.check {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}
.auth-card label.check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
}
