@font-face {
  font-family: Nunito;
  font-weight: 400 900;
  font-display: swap;
  src: url("./assets/nunito-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: Nunito;
  font-weight: 400 900;
  font-display: swap;
  src: url("./assets/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  color-scheme: light;
  font-family: Nunito, system-ui, sans-serif;
  color: #231941;
  background: #faf8fd;
  --ink: #231941;
  --muted: #5e5573;
  --purple: #5835ba;
  --purple-dark: #43258f;
  --line: #e8e0f2;
  --radius: 22px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; }
button { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #7747d4; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 900; line-height: 1.12; letter-spacing: -.025em; }
img { display: block; max-width: 100%; }
.wrap { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 5; padding: 12px; border-radius: 10px; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.header { background: #fff; border-bottom: 1px solid #eee8f5; }
.header-inner { width: min(1160px, calc(100% - 64px)); margin: auto; min-height: 78px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 22px; font-weight: 900; line-height: 1; white-space: nowrap; }
.brand small { display: block; margin-top: 6px; color: #615478; font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.brand-mark { position: relative; display: grid; place-items: center; flex: 0 0 auto; width: 43px; aspect-ratio: 1; border-radius: 14px; background: var(--purple); box-shadow: 0 3px 0 #40238d; }
.sprout { position: relative; display: block; width: 3px; height: 17px; border-radius: 3px; background: #e2f2be; transform: translateY(3px); }
.sprout::before, .sprout::after { content: ""; position: absolute; width: 11px; height: 8px; background: #e2f2be; }
.sprout::before { top: 1px; left: -9px; border-radius: 2px 8px 2px 8px; transform: rotate(13deg); }
.sprout::after { top: -4px; left: 2px; border-radius: 8px 2px 8px 2px; transform: rotate(-15deg); }
.nav { display: flex; gap: 5px; align-items: center; }
.nav a { min-height: 44px; padding: 11px 20px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 800; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--purple-dark); background: #f0e8fc; }
.garden-badge { justify-self: end; display: flex; align-items: center; gap: 7px; padding: 9px 13px; border: 1px solid #e4ecd3; border-radius: 999px; background: #f3f8e9; color: #3a5826; font-weight: 900; white-space: nowrap; }
.hero { display: grid; grid-template-columns: 49% 51%; align-items: stretch; margin-top: 34px; border: 1px solid #e6d9f8; border-radius: 29px; overflow: hidden; background: #eee3ff; }
.hero-content { position: relative; z-index: 1; padding: clamp(27px, 4.2vw, 58px); align-self: center; }
.hero h1 { font-size: clamp(43px, 5.15vw, 75px); line-height: .99; letter-spacing: -.056em; }
.hero h1 span { color: var(--purple); }
.hero p { margin-top: 17px; font-size: clamp(16px, 1.65vw, 20px); color: #514366; font-weight: 700; max-width: 345px; line-height: 1.45; }
.hero-actions { display: flex; gap: 12px 18px; flex-wrap: wrap; align-items: center; margin-top: 23px; }
.hero-actions .text-button { border-color: #d9c6f4; }
.hero-art { min-height: 100%; position: relative; overflow: hidden; background: #e8dbfa; }
.hero-art img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center 55%; }
.hero-art::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 24%; background: linear-gradient(90deg, #eee3ff, transparent); pointer-events: none; }
.primary, .secondary, .text-button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 46px; padding: 10px 18px; border-radius: 13px; font-weight: 900; text-decoration: none; border: 1px solid transparent; line-height: 1.2; text-align: center; }
.primary { background: var(--purple); color: white; box-shadow: 0 3px 0 var(--purple-dark); }
.primary:hover { background: #4c2da5; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--purple-dark); }
.secondary { background: #fff; border-color: #dcd0ec; color: var(--purple-dark); }
.secondary:hover, .text-button:hover { background: #f1eafb; }
.text-button { background: transparent; color: var(--purple-dark); }
.primary:disabled, .secondary:disabled { opacity: .52; }
.arrow { font-size: 20px; line-height: 1; }
.choose, .games { margin-top: 32px; }
.section-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; }
.section-head h2, .progress-view h2 { font-size: clamp(23px, 3vw, 31px); }
.section-head p, .muted { color: var(--muted); font-weight: 700; }
.tables { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 11px; }
.table-button { position: relative; display: grid; justify-items: center; align-content: center; min-height: 83px; padding: 8px 3px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 16px; background: #fff; font-weight: 900; line-height: 1.05; }
.table-button span:first-child { color: #574a6d; font-size: 12px; letter-spacing: .02em; }
.table-button strong { font-size: 32px; }
.table-button:hover { border-color: #c1a9ee; }
.table-button[aria-pressed="true"] { color: var(--purple-dark); border-color: #8356df; background: #f0e6ff; }
.table-button[aria-pressed="true"] span:first-child { color: var(--purple-dark); }
.table-button .master-mark { position: absolute; top: 5px; right: 6px; color: #316330; font-size: 14px; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-card { min-width: 0; min-height: 153px; padding: 17px; border: 1px solid var(--card-edge); border-bottom-width: 3px; border-radius: var(--radius); display: grid; text-align: left; grid-template-columns: 48px 1fr auto; align-items: start; gap: 11px; background: var(--card-bg); transition: transform .15s ease, border-color .15s ease; }
.game-card:hover { transform: translateY(-2px); border-color: var(--card-ink); }
.game-card strong { display: block; font-size: 20px; font-weight: 900; line-height: 1.18; margin: 3px 0 5px; }
.game-card .card-description { display: block; color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1.32; }
.game-card .arrow { align-self: center; color: var(--card-ink); }
.game-icon { width: 46px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 13px; background: var(--icon-bg); color: var(--card-ink); font-weight: 900; font-size: 25px; }
.mode-xep { --card-bg: #eef7df; --card-edge: #dbeac6; --icon-bg: #d8ebba; --card-ink: #38612c; }
.mode-tinh { --card-bg: #f1eaff; --card-edge: #e3d5fb; --icon-bg: #e1d2fd; --card-ink: #5633a7; }
.mode-loivan { --card-bg: #fff2d9; --card-edge: #f2e1bb; --icon-bg: #ffe5ad; --card-ink: #794b1e; }
.mode-du { --card-bg: #fbeaf1; --card-edge: #efd7e3; --icon-bg: #f4d5e5; --card-ink: #8d3e64; }
.mode-nhan-doc { --card-bg: #eaf1fd; --card-edge: #d6e3f8; --icon-bg: #d5e3fa; --card-ink: #3c548e; }
.mode-chia-doc { --card-bg: #e6f5ed; --card-edge: #d0e9dc; --icon-bg: #cdeadc; --card-ink: #2e654e; }
.digit-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 850; }
.digit-picker span { margin-right: 4px; }
.digit-picker button { min-height: 44px; padding-inline: 11px; }
.digit-picker button[aria-pressed="true"] { background: #f0e6ff; border-color: #8356df; }
.advanced-head { align-items: center; }
[aria-labelledby="advanced-heading"] .game-card { min-height: 112px; }
.check-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; margin-top: 15px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.check-strip strong { display: block; font-size: 16px; }
.check-strip p { font-size: 14px; }
.play-view, .result-view { max-width: 750px; margin: 25px auto 0; }
.back-link { margin: 0 0 13px -10px; min-height: 40px; padding: 7px 10px; }
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: var(--muted); font-weight: 850; }
.play-top strong { color: var(--ink); }
.play-top > span { flex-shrink: 0; }
.round-track { height: 8px; border-radius: 99px; background: #e9def7; margin: 0 0 14px; overflow: hidden; }
.round-track span { display: block; height: 100%; background: #7851d2; border-radius: 99px; transition: width .2s ease; }
.question-card, .result-card, .progress-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 0 #ede6f5; }
.question-card { padding: clamp(18px, 4vw, 33px); }
.question-prompt { font-size: clamp(20px, 3.7vw, 29px); line-height: 1.27; }
.expression { color: var(--purple-dark); font-size: clamp(37px, 7vw, 65px); font-weight: 900; letter-spacing: -.035em; line-height: 1.15; margin-top: 12px; }
.play-content { margin-top: 16px; }
.vertical {
  display: inline-grid;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 14px;
  background: #f6efff;
  color: var(--purple-dark);
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}
.vertical-multiply { min-width: 5.4ch; text-align: right; }
.vertical-multiplier { display: flex; justify-content: space-between; gap: 1.8ch; border-bottom: 2px solid currentColor; }
.vertical-product { padding-top: 4px; }
.vertical-divide { grid-template-columns: auto auto; }
.vertical-dividend { padding-right: .45ch; text-align: right; }
.vertical-divisor, .vertical-quotient { min-width: 2.6ch; padding-left: .45ch; border-left: 2px solid currentColor; }
.vertical-divisor { border-bottom: 2px solid currentColor; }
.vertical-quotient { grid-column: 2; padding-top: 4px; }
.choices, .operations { display: grid; gap: 9px; }
.choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.division-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.operations { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 7px; }
.choice { min-height: 56px; padding-inline: 8px; font-size: 22px; }
.choice-correct, .choice[aria-pressed="true"] { color: #215b31; background: #eaf7e7; border-color: #a7cda8; opacity: 1; }
.choice-missed { color: #894424; background: #fff1e5; border-color: #edd3bf; opacity: 1; text-decoration: line-through; }
.step-label { display: block; font-weight: 850; }
.story-choices { margin-top: 12px; }
.model-area { margin: 12px 0; padding: 12px; background: #f5f9ee; border-radius: 15px; border: 1px solid #e4ecd7; }
.model-controls { display: flex; gap: 8px 15px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.model-counter { color: #3d572d; font-weight: 900; font-size: 15px; }
.trays { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 5px; margin-top: 8px; }
.tray { min-height: 38px; border-radius: 9px; border: 1px dashed #9cb483; padding: 4px; display: flex; gap: 1px; align-content: center; justify-content: center; align-items: center; flex-wrap: wrap; background: #fff; font-size: 12px; line-height: 1; }
.tray.filled { background: #ebf6db; border-style: solid; }
.feedback { margin-top: 12px; padding: 10px 13px; border-radius: 12px; font-weight: 800; background: #fff0da; color: #714418; }
.feedback:empty { display: none; }
.feedback.good { background: #e9f6e6; color: #2d6236; }
.worked-steps { margin-top: 12px; color: var(--muted); }
.worked-steps summary { padding: 10px 0; color: var(--purple-dark); font-weight: 850; cursor: pointer; }
.worked-steps ol { margin: 0; padding-left: 24px; }
.worked-steps li + li { margin-top: 5px; }
.hint-box { margin-top: 10px; padding: 9px 12px; border-radius: 12px; color: var(--purple-dark); background: #f2eafd; font-weight: 800; }
.play-footer { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.result-card { padding: clamp(23px, 6vw, 49px); text-align: center; }
.result-card .reward { display: block; font-size: 53px; margin-bottom: 8px; }
.result-card h1, .progress-heading h1 { font-size: clamp(33px, 5.2vw, 56px); }
.result-card p { margin: 12px auto; max-width: 470px; font-size: 18px; font-weight: 750; color: var(--muted); }
.result-card .result-buttons { display: flex; flex-wrap: wrap; gap: 11px; justify-content: center; margin-top: 20px; }
.progress-view { max-width: 920px; margin: 31px auto 0; }
.progress-heading p { margin-top: 7px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin: 18px 0; }
.stat { padding: 17px; border-radius: 17px; border: 1px solid var(--line); background: #f1eaff; color: var(--purple-dark); font-weight: 850; }
.stat:nth-child(2) { background: #eef7df; color: #37562a; border-color: #e0ebd0; }
.stat:nth-child(3) { background: #fff2d9; color: #6a431e; border-color: #f2e1bb; }
.stat strong { display: block; font-size: 35px; line-height: 1.1; }
.progress-panel { padding: clamp(16px, 3vw, 24px); margin-bottom: 15px; }
.progress-panel > p { margin-top: 5px; }
.topic-stats { list-style: none; padding: 0; margin: 6px 0 0; }
.topic-stats li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.topic-stats li + li { border-top: 1px solid var(--line); }
.topic-stats small { display: block; color: var(--muted); font-weight: 750; }
.review-items { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.review-items span { background: #f3ebff; border-radius: 9px; padding: 5px 9px; color: var(--purple-dark); font-weight: 900; }
.progress-table { width: 100%; border-collapse: collapse; margin-top: 9px; text-align: left; font-variant-numeric: tabular-nums; }
.progress-table th, .progress-table td { padding: 8px 5px; border-bottom: 1px solid #ede7f3; }
.progress-table thead th { color: var(--muted); font-size: 13px; }
.progress-table tbody td { font-weight: 750; }
.progress-table tbody tr:last-child > * { border-bottom: 0; }
.status-tag { display: inline-block; padding: 3px 8px; border-radius: 8px; background: #f5f1f9; color: #5d5070; font-size: 13px; font-weight: 850; white-space: nowrap; }
.status-tag.learning { background: #efe5ff; color: #502d9e; }
.status-tag.mastered { background: #e7f4dc; color: #2b5f32; }
.storage-note { margin: 0 0 13px; background: #fff0d9; color: #6a421e; padding: 10px 13px; border-radius: 12px; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-top: 34px; padding: 15px 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 750; }
.footer-brand { color: var(--ink); font-weight: 900; }
@media (max-width: 820px) {
  .wrap, .header-inner { width: calc(100% - 38px); }
  .hero { grid-template-columns: 55% 45%; }
  .game-card { grid-template-columns: 39px 1fr; gap: 8px; padding: 13px; min-height: 135px; }
  .game-icon { width: 36px; font-size: 21px; }
  .game-card .arrow { display: none; }
  .game-card strong { font-size: 18px; }
}
@media (max-width: 560px) {
  .wrap, .header-inner { width: calc(100% - 28px); }
  .header-inner { min-height: 65px; grid-template-columns: auto 1fr auto; gap: 6px; }
  .nav { justify-self: center; }
  .brand { gap: 6px; font-size: 17px; }
  .brand small { font-size: 8px; }
  .brand-mark { width: 32px; border-radius: 10px; }
  .sprout { transform: translateY(2px) scale(.82); }
  .nav { gap: 2px; }
  .nav a { padding: 10px 8px; min-height: 41px; font-size: 14px; }
  .garden-badge { gap: 4px; padding: 6px 7px; font-size: 12px; }
  .hero { position: relative; grid-template-columns: 1fr; margin-top: 16px; border-radius: 21px; }
  .hero-content { padding: 22px; }
  .hero h1 { font-size: clamp(39px, 12vw, 62px); }
  .hero p { margin-top: 10px; }
  .hero-actions { margin-top: 14px; gap: 9px 12px; }
  .hero-actions .text-button { padding-inline: 11px; }
  .hero-art { min-height: clamp(130px, 40vw, 230px); }
  .hero-art img { object-position: center 64%; }
  .hero-art::after { inset: 0 0 auto 0; width: 100%; height: 35%; background: linear-gradient(#eee3ff, transparent); }
  .choose, .games { margin-top: 23px; }
  .section-head { margin-bottom: 10px; gap: 5px; }
  .section-head p { font-size: 14px; }
  .tables { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .table-button { min-height: 63px; border-radius: 12px; }
  .table-button strong { font-size: 25px; }
  .game-grid { grid-template-columns: 1fr; gap: 8px; }
  .game-card { min-height: 69px; grid-template-columns: 39px 1fr auto; align-items: center; }
  [aria-labelledby="advanced-heading"] .game-card { min-height: 69px; }
  .game-card strong { margin: 0 0 3px; }
  .game-card .card-description { font-size: 14px; }
  .game-card .arrow { display: block; }
  .check-strip { flex-wrap: wrap; padding: 12px; }
  .stats-grid { gap: 6px; }
  .stat { padding: 9px; border-radius: 12px; font-size: 13px; line-height: 1.2; }
  .stat strong { font-size: 28px; }
  .progress-table { font-size: 13px; }
  .status-tag { padding-inline: 5px; font-size: 12px; }
  .question-card { padding: 15px; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .brand small { display: none; }
  .brand-mark { display: none; }
  .garden-badge { padding: 5px; }
  .play-top { font-size: 14px; }
  .status-tag { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
