:root {
  color-scheme: light;
  --ink: #201b38;
  --muted: #625c76;
  --purple: #5640c4;
  --purple-deep: #4431a5;
  --purple-light: #ede8ff;
  --border: #e8e4f1;
  --surface: #fff;
  --ground: #f7f6fb;
  --radius: 22px;
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
button, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #7556df; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: clamp(1.2rem, 2.2vw, 1.45rem); line-height: 1.35; letter-spacing: -.025em; }
.wrap { max-width: 1160px; width: calc(100% - 64px); margin-inline: auto; }
.site-header { background: #fff; border-bottom: 1px solid #ece9f4; }
.site-header-inner { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 11px; align-items: center; font-size: 1.25rem; font-weight: 800; letter-spacing: -.025em; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; border-radius: 12px; width: 37px; height: 37px; background: #6550d8; }
.brand-icon i { width: 16px; height: 16px; position: relative; border-radius: 50%; background: #f4eeff; }
.brand-icon i::after { content: ""; border: 2px solid #fff; border-radius: 50%; width: 22px; height: 7px; position: absolute; inset: 3px auto auto -5px; transform: rotate(-26deg); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.progress-button { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; color: var(--ink); font-weight: 700; background: #fff; border: 1px solid var(--border); border-radius: 100px; padding: 5px 14px; white-space: nowrap; }
.progress-button:hover { background: #f8f5ff; }
.sound-switch { color: var(--purple-deep); border-color: #e6dfff; background: #f7f4ff; }
.sound-note { position: relative; font: bold 1.25rem/1 system-ui, sans-serif; }
.sound-switch[aria-pressed="false"] { color: var(--muted); border-color: var(--border); background: #fff; }
.sound-switch[aria-pressed="false"] .sound-note::after { content: ""; position: absolute; left: -2px; right: -2px; top: 52%; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-40deg); }
.star { color: #a36308; }
.hero { margin-top: 28px; min-height: 238px; position: relative; display: flex; align-items: center; overflow: hidden; isolation: isolate; border-radius: 26px; background: radial-gradient(ellipse at 77% 44%, #463583 0%, transparent 49%), linear-gradient(118deg, #211947 2%, #30205a 100%); color: white; }
.hero::before { content: ""; border: 1px solid #a995ff30; border-radius: 50%; position: absolute; width: 75%; height: 110%; top: -1%; left: 31%; transform: rotate(-16deg); z-index: -1; }
.hero::after { content: ""; background: radial-gradient(circle, #b9adf39c 1px, transparent 1.6px) 0 0 / 53px 41px; mask-image: linear-gradient(115deg, transparent 23%, black 90%); position: absolute; inset: 0; z-index: -2; opacity: .65; }
.hero-copy { position: relative; z-index: 1; padding: 34px 0 36px 44px; }
.hero-label { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; font-size: .875rem; font-weight: 700; border: 1px solid #bfb0ff52; border-radius: 100px; color: #eee8ff; background: #b29aff22; }
.hero-label span { color: #ffd792; }
.hero h1 { font-size: clamp(2.12rem, 5.5vw, 4rem); line-height: 1.17; font-weight: 900; letter-spacing: -.045em; margin-block: 13px 10px; }
.hero h1 span { color: #ffdb9c; }
.hero p { color: #efe7ff; font-size: clamp(1rem, 2vw, 1.14rem); line-height: 1.6; }
.hero-art { position: absolute; inset: 0 4% 0 auto; width: 44%; display: grid; place-items: center; }
.hero-art img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.planet-fallback { width: min(63%, 180px); aspect-ratio: 1.12; border-radius: 50%; background: linear-gradient(148deg, #ffc791 0 32%, #f5a382 33% 46%, #ffc791 47% 55%, #fba888 56%); position: relative; transform: rotate(-17deg); box-shadow: inset -12px -14px #d9757470, 0 0 80px #e2b1ff42; }
.planet-fallback i { width: 147%; height: 39%; border: 13px solid #c0a6fb; border-top-color: #9d86e880; border-radius: 50%; position: absolute; top: 36%; left: -23%; }
.planet-fallback b { width: 18%; height: 14%; border-radius: 50%; background: #ffd7ad; position: absolute; top: 20%; left: 22%; }
.spark { position: absolute; font-size: 1.22rem; color: #d2bfff; pointer-events: none; }
.spark-one { top: 16%; right: 15%; }
.spark-two { top: 70%; right: 44%; color: #ffdc97; }
.spark-three { top: 22%; left: 52%; font-size: .8rem; }
.spark-four { bottom: 15%; right: 8%; color: #ffdc97; font-size: 1rem; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); margin-block: 22px 23px; padding: 0 7px; border: 1px solid var(--border); border-radius: 17px; background: #fff; box-shadow: 0 4px 14px #2a134505; }
.mode { min-height: 61px; display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 750; position: relative; white-space: nowrap; color: #57516c; }
.mode:hover { color: var(--purple-deep); }
.mode[aria-current="page"] { color: var(--purple-deep); }
.mode[aria-current="page"]::after { content: ""; position: absolute; bottom: 0; left: 14%; width: 72%; height: 3px; background: #7257de; border-radius: 4px 4px 0 0; }
.mode-icon { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 9px; display: grid; place-items: center; }
.icon-build { background: #efe9ff; color: #654dcc; }
.icon-build i { width: 7px; height: 7px; background: currentColor; border-radius: 1.5px; margin: 0 8px 8px 0; box-shadow: 9px 0, 0 9px, 9px 9px; }
.icon-table { background: #e4f7f0; color: #167851; }
.icon-table i { width: 16px; height: 15px; border: 1.8px solid currentColor; border-radius: 3px; background: linear-gradient(currentColor,currentColor) center 4px / 100% 1px no-repeat, linear-gradient(currentColor,currentColor) center / 1px 100% no-repeat; }
.icon-practice { background: #fff0d6; color: #9e5709; }
.icon-practice i { width: 15px; height: 18px; background: currentColor; clip-path: polygon(55% 0, 0 55%, 42% 55%, 30% 100%, 100% 34%, 56% 34%); }
.icon-divide { background: #ffe9f4; color: #a74079; font-size: 1.45rem; line-height: 1; }
.content { padding-bottom: 48px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(258px, .45fr); align-items: start; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(17px, 3vw, 26px); box-shadow: 0 6px 24px #25184307; min-width: 0; }
.card-description { color: var(--muted); font-size: 1rem; line-height: 1.65; margin-top: 6px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-block: 19px 16px; }
.control { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; min-height: 56px; padding: 6px 9px 6px 13px; border-radius: 13px; border: 1px solid var(--border); }
.control strong { font-size: .94rem; font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper output { min-width: 24px; text-align: center; font-size: 1.15rem; font-weight: 800; }
.stepper button { width: 36px; height: 40px; padding: 0; border-radius: 9px; border: 0; font-weight: 600; font-size: 1.25rem; color: var(--purple-deep); background: var(--purple-light); line-height: 1; }
.stepper button:hover:not(:disabled) { background: #ded4ff; }
.stepper button:disabled { opacity: .42; }
.board { background: #f5f1ff; border: 1px solid #eee6ff; border-radius: 17px; padding: 15px; min-height: 152px; }
.board-caption { font-size: .875rem; font-weight: 750; color: #5c469f; margin-bottom: 10px; }
.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.group { min-width: 0; display: grid; justify-items: center; align-content: center; gap: 7px; min-height: 86px; padding: 9px 5px; background: #ffffffbe; border: 1px dashed #d6c8f9; border-radius: 11px; }
.group span, .tray-label { font-size: .875rem; font-weight: 700; color: #615282; line-height: 1.2; }
.cubes { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; min-height: 24px; }
.cube { width: clamp(14px, 4vw, 25px); aspect-ratio: 1; border-radius: 5px; border: 1px solid #6f50df; background: linear-gradient(150deg, #a28cf7, #8062ee); box-shadow: inset 0 -3px #6243d079, inset 2px 2px #d3c7ff59; }
.group:nth-child(even) .cube { background: linear-gradient(150deg, #5edbb0, #3dbd94); border-color: #239e78; box-shadow: inset 0 -3px #2a9f7e80, inset 2px 2px #bdfbe67d; }
.equation-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 16px; padding-block: 14px 6px; }
.equation { font: 850 clamp(1.65rem, 5vw, 2.18rem)/1.15 system-ui, sans-serif; letter-spacing: -.035em; }
.equation em { color: var(--purple); font-style: normal; }
.rhyme { padding: 5px 10px; border-radius: 999px; background: #fff1d7; color: #825015; font-weight: 750; font-size: .95rem; }
.addition { color: var(--muted); line-height: 1.55; font-size: .94rem; overflow-wrap: anywhere; }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 17px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 11px; padding: 9px 15px; font-weight: 750; line-height: 1.25; border: 1px solid transparent; }
.primary { background: var(--purple); color: white; }
.primary:hover:not(:disabled) { background: var(--purple-deep); }
.secondary { background: #f3efff; color: var(--purple-deep); border-color: #e9e1ff; }
.secondary:hover:not(:disabled) { background: #e9e0ff; }
.button:disabled { opacity: .55; }
.full { width: 100%; }
.side-heading { display: flex; align-items: center; gap: 9px; }
.facts { display: grid; gap: 3px; margin-block: 13px 15px; }
.fact { border: 1px solid transparent; color: inherit; background: transparent; text-align: left; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 5px 9px; font-size: .9rem; font-weight: 700; }
.fact span:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact span:last-child { color: var(--muted); text-align: right; }
.fact:hover, .fact[aria-pressed="true"] { background: #f2edff; border-color: #e7dfff; color: var(--purple-deep); }
.fact[aria-pressed="true"] span:last-child { color: var(--purple-deep); }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 13px; }
.pill { min-width: 43px; min-height: 43px; padding: 7px 12px; border: 1px solid var(--border); background: #fff; border-radius: 10px; color: var(--muted); font-weight: 750; }
.pill[aria-pressed="true"], .pill:hover { border-color: #dad0fd; color: var(--purple-deep); background: #f1ebff; }
.table-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 19px 0; gap: 9px; }
.table-facts .fact { flex-direction: column; justify-content: center; align-items: center; padding: 11px 3px; gap: 4px; background: #f9f7ff; border-color: #eee9fb; }
.table-facts .fact[aria-pressed="true"], .table-facts .fact:hover { background: #ebe3ff; border-color: #d9ccfa; }
.table-facts .fact span:first-child { font-size: clamp(.95rem, 2.5vw, 1.18rem); }
.table-facts .fact span:last-child { text-align: center; }
.side-equation { padding-top: 16px; padding-bottom: 9px; }
.side-rhyme { display: inline-block; margin-top: 8px; }
.round-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.counter { color: var(--purple-deep); font-weight: 750; white-space: nowrap; }
.meter { display: block; width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: #eee8fc; margin-top: 12px; }
.meter::-webkit-progress-bar { background: #eee8fc; border-radius: 99px; }
.meter::-webkit-progress-value { background: #7c60e2; border-radius: 99px; }
.meter::-moz-progress-bar { background: #7c60e2; border-radius: 99px; }
.question { margin-top: 18px; text-align: center; border-radius: 16px; background: #f5f1ff; padding: 17px 10px 20px; position: relative; overflow: hidden; }
.question .equation { margin-top: 7px; font-size: clamp(2rem, 7vw, 3.2rem); }
.question p:first-of-type { font-weight: 700; color: #5f4b94; }
.question.is-solved { background: #ecf8f0; }
.question.is-solved p:first-of-type, .question.is-solved em { color: #146344; }
.answer-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.answer { min-height: 53px; border: 1px solid #e6def7; background: #fff; color: var(--ink); border-radius: 12px; font-size: 1.27rem; font-weight: 800; }
.answer:hover:not(:disabled) { border-color: #b7a5f1; background: #f4efff; }
.answer.is-wrong { color: #9b562b; background: #fff2e5; border-color: #f9ddc6; }
.answer.is-right { color: #146344; background: #e4f8ed; border-color: #b9e8cd; }
.feedback { margin-top: 13px; min-height: 1.5em; color: var(--muted); line-height: 1.55; font-size: .96rem; }
.feedback.is-right { color: #146344; font-weight: 700; }
.hint { margin-top: 10px; }
.practice-settings h3 { font-size: 1rem; margin-top: 17px; }
.practice-settings .pills { margin-top: 8px; }
.practice-settings .pill { min-width: 37px; padding-inline: 9px; }
.summary { margin-top: 15px; background: #f5f1ff; padding: 20px; border-radius: 14px; overflow: hidden; position: relative; }
.summary h3 { font-size: 1.3rem; margin-bottom: 6px; }
.summary p { color: var(--muted); line-height: 1.6; }
select { min-width: 65px; min-height: 40px; border: 1px solid #e8e0f8; background-color: #f5f1ff; border-radius: 9px; padding: 5px 8px; color: var(--purple-deep); font-weight: 750; }
.divide-board { background: #fcf2fa; border-color: #f6e5f0; }
.tray { border: 1px solid #f2dfed; background: #fff; padding: 10px; min-height: 67px; border-radius: 11px; margin-bottom: 10px; }
.tray-label { display: block; margin-bottom: 7px; color: #793765; }
.tray .cubes { justify-content: flex-start; }
.divide-board .group { border-color: #e7c3de; }
.divide-board .group .cube { background: linear-gradient(150deg, #eeb0db, #d67bbf); border-color: #bf65a6; box-shadow: inset 0 -3px #a4448c55, inset 2px 2px #ffe4f87d; }
.knowledge { margin-top: 14px; padding: 13px; border-radius: 12px; background: #f6f2ff; color: #514283; line-height: 1.6; }
.knowledge p + p { margin-top: 4px; }
dialog { width: min(470px, calc(100% - 28px)); max-height: 88vh; margin: auto; padding: 23px; border: 1px solid var(--border); border-radius: 21px; color: var(--ink); box-shadow: 0 15px 70px #271b4c4a; }
dialog::backdrop { background: #21183c66; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.close-button { width: 42px; height: 42px; border: 0; border-radius: 12px; background: #f4efff; color: #4b3a82; font-size: 1.5rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.stat { display: flex; flex-direction: column; gap: 5px; background: #f6f3ff; border-radius: 13px; padding: 13px; font-size: .875rem; color: var(--muted); }
.stat strong { font: 800 1.7rem/1 system-ui, sans-serif; color: var(--purple-deep); }
.dialog-note { margin-top: 13px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.review-heading { margin-top: 15px; font-size: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.celebration { display: none; }
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(216px, .5fr); gap: 13px; }
  .control { display: grid; justify-content: normal; justify-items: center; gap: 6px; text-align: center; padding: 7px; }
  .hero-copy { padding-left: 30px; }
  .hero-art { right: 1%; width: 46%; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .site-header-inner { height: 59px; }
  .brand { font-size: 1.12rem; gap: 8px; }
  .brand-icon { width: 33px; height: 33px; }
  .header-actions { gap: 5px; }
  .progress-button { font-size: .875rem; padding-inline: 9px; gap: 5px; }
  .hero { margin-top: 15px; min-height: 173px; border-radius: 20px; }
  .hero-copy { padding: 18px 0 20px 16px; width: 62%; }
  .hero h1 { font-size: clamp(1.64rem, 6.9vw, 2.5rem); margin-block: 9px 5px; }
  .hero h1 span { display: inline-block; }
  .hero p { font-size: .875rem; }
  .hero-art { width: 53%; right: -7%; }
  .spark-three { display: none; }
  .modes { margin-block: 14px; padding: 0 3px; }
  .mode { flex-direction: column; gap: 4px; min-height: 65px; font-size: .88rem; }
  .mode-icon { width: 27px; height: 27px; flex-basis: 27px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .card { border-radius: 18px; }
  .stepper button { width: 42px; height: 43px; }
  .board { padding: 10px; }
  .answer-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 365px) {
  .brand { font-size: 1rem; gap: 6px; }
  .brand-icon { width: 29px; height: 29px; }
  .sound-switch { width: 42px; justify-content: center; }
  .sound-label { display: none; }
  .stepper button { width: 30px; }
  .hero-art { right: -10%; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-art img { animation: art-appear .7s ease-out both; }
  .cube-arrive { animation: cube-pop .29s cubic-bezier(.21,.74,.4,1.2) both; }
  .divide-board .cube-arrive { animation: cube-drop .34s cubic-bezier(.25,.66,.42,1.13) both; }
  .equation-updated .equation em { display: inline-block; animation: number-pulse .28s ease-out; }
  .tray-restored, .feedback-arrive { animation: soft-appear .25s ease-out; }
  .answer-celebrate { animation: answer-brighten .5s ease-out; }
  .celebration { display: block; position: absolute; inset: 0; pointer-events: none; }
  .summary .celebration { left: 50%; }
  .celebration i {
    position: absolute;
    top: 56%;
    left: 20%;
    color: #b26808;
    font: normal 1.35rem/1 system-ui, sans-serif;
    --drift-x: -30px;
    --drift-y: -27px;
    animation: star-float .85s ease-out both;
  }
  .celebration i:nth-child(2) { top: 34%; left: 25%; color: #7860d3; font-size: 1rem; --drift-x: -14px; --drift-y: -22px; animation-delay: .07s; }
  .celebration i:nth-child(3) { top: 46%; left: 78%; --drift-x: 27px; --drift-y: -24px; }
  .celebration i:nth-child(4) { top: 72%; left: 76%; color: #7860d3; font-size: 1rem; --drift-x: 20px; --drift-y: 9px; animation-delay: .07s; }
  .celebration i:nth-child(5) { top: 32%; left: 83%; color: #168054; font-size: .85rem; --drift-x: 10px; --drift-y: -12px; animation-delay: .14s; }

  @keyframes art-appear {
    from { opacity: 0; transform: translateY(9px) scale(.97); }
    to { opacity: 1; transform: none; }
  }
  @keyframes cube-pop {
    from { opacity: 0; transform: scale(.4); }
    65% { opacity: 1; transform: scale(1.14); }
    to { opacity: 1; transform: none; }
  }
  @keyframes cube-drop {
    from { opacity: 0; transform: translateY(-13px) scale(.82); }
    70% { opacity: 1; transform: scale(1.1, .92); }
    to { opacity: 1; transform: none; }
  }
  @keyframes number-pulse {
    45% { transform: scale(1.15); }
  }
  @keyframes soft-appear {
    from { opacity: .45; }
  }
  @keyframes answer-brighten {
    from { background: #f5f1ff; }
  }
  @keyframes star-float {
    from { opacity: 0; transform: translate(0, 7px) scale(.4) rotate(-12deg); }
    35% { opacity: 1; }
    to { opacity: 0; transform: translate(var(--drift-x), var(--drift-y)) scale(1.1) rotate(20deg); }
  }
}
