@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Serif+SC:wght@500;600;700&display=swap');

:root {
  --ink: #242522;
  --muted: #6c716d;
  --paper: #fbf8f3;
  --card: #fffefa;
  --line: #e4e0d8;
  --red: #a94f45;
  --red-dark: #753a34;
  --red-soft: #f4e2de;
  --jade: #315f55;
  --jade-soft: #dfede7;
  --gold: #c89648;
  --cream: #f6ecdd;
  --shadow: 0 16px 45px rgba(61, 55, 45, .08);
  --radius: 22px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 999; padding: 10px 15px; background: var(--ink); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.eyebrow { display: block; color: var(--red); font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow.light { color: #f2cbb9; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { letter-spacing: -.035em; }

/* Access */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #f7f1ee; }
.auth-panel { width: min(920px,100%); display: grid; grid-template-columns: minmax(0,1fr) 420px; align-items: center; gap: 42px; }
.auth-intro { padding: 24px; }
.auth-brand-mark { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: var(--red); color: white; font: 700 29px/1 "Noto Serif SC",serif; box-shadow: 0 9px 24px rgba(168,97,90,.2); }
.auth-intro h1 { margin: 19px 0 9px; font-size: clamp(40px,6vw,64px); line-height: 1; }
.auth-intro > p { max-width: 430px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.auth-feature { display: flex; align-items: center; gap: 14px; max-width: 430px; margin-top: 28px; padding: 16px; border: 1px solid #d8e5df; border-radius: 14px; background: #eef5f1; }
.auth-feature > span { display: grid; place-items: center; flex: 0 0 auto; width: 43px; height: 43px; border-radius: 12px; background: var(--jade); color: white; font: 600 24px/1 "Noto Serif SC",serif; }
.auth-feature strong, .auth-feature small { display: block; }
.auth-feature strong { font-size: 15px; }
.auth-feature small { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; position: relative; z-index: 1; }
.brand-glyph { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: var(--red); color: white; font: 700 25px/1 "Noto Serif SC", serif; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand strong { display: block; font-size: 20px; letter-spacing: -.02em; }
.brand small { display: block; color: #978f83; font-size: 12px; letter-spacing: .02em; margin-top: 2px; }
.auth-card { width: 100%; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 10px 30px rgba(15,23,42,.05); }
.auth-heading { margin-bottom: 26px; }
.auth-heading h2 { margin: 8px 0 8px; font-size: 31px; }
.auth-heading p { color: var(--muted); font-size: 16px; line-height: 1.5; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 25px; background: #f3ebe7; border-radius: 13px; }
.auth-tab { border: 0; padding: 12px; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; font-size: 15px; }
.auth-tab.active { background: white; color: var(--ink); box-shadow: 0 2px 9px rgba(57,45,28,.08); }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 8px; font-size: 14px; font-weight: 700; }
.auth-form input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: white; outline: 0; }
.auth-form input:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(88,120,111,.12); }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-toggle { position: absolute; right: 9px; top: 8px; height: 32px; border: 0; background: transparent; color: var(--jade); font-size: 11px; font-weight: 800; cursor: pointer; }
.auth-form .remember-login { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; color: #57534d; font-size: 14px; font-weight: 500; line-height: 1.4; cursor: pointer; }
.auth-form .remember-login input[type="hidden"] { display: none; }
.auth-form .remember-login input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--red); box-shadow: none; cursor: pointer; }
.primary-button, .secondary-button, .cream-button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 52px; padding: 0 21px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 16px; transition: .18s ease; }
.primary-button { background: var(--red); color: white; box-shadow: 0 8px 20px rgba(169,79,69,.2); }
.primary-button:hover { background: var(--red-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary-button.full { width: 100%; margin-top: 4px; }
.secondary-button { background: #f1ebe7; color: var(--ink); }
.cream-button { background: #f7ecdf; color: #694a3f; }
.cream-button:hover { background: white; transform: translateY(-1px); }
.form-alert { padding: 12px 14px; margin-top: 15px; border-radius: 10px; background: #fae5e2; color: #9b3025; font-size: 14px; }
.auth-note { margin: 22px 0 0; text-align: center; color: #9b958c; font-size: 13px; line-height: 1.55; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column; width: 250px; padding: 25px 18px 19px; background: #fffaf8; border-right: 1px solid var(--line); }
.sidebar-top { display: flex; justify-content: space-between; align-items: center; padding: 0 7px 30px; }
.sidebar-close { display: none; }
.main-nav { display: grid; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; padding: 13px 12px; border-radius: 13px; color: #655f57; }
.nav-item:hover { background: #f6efeb; }
.nav-item.active { background: var(--red-soft); color: var(--red-dark); }
.nav-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(0,0,0,.035); font: 600 19px/1 "Noto Serif SC", serif; }
.nav-item.active .nav-icon { background: white; }
.nav-item strong { display: block; font-size: 17px; line-height: 1.2; }
.nav-item small { display: block; margin-top: 4px; color: #7d766d; font-size: 13px; line-height: 1.3; }
.nav-badge { margin-left: auto; min-width: 28px; padding: 5px 8px; border-radius: 10px; background: var(--red); color: white; text-align: center; font-size: 14px; }
.sidebar-quote { margin: auto 6px 18px; padding: 17px; border-radius: 15px; background: var(--jade); color: white; }
.sidebar-quote span { display: block; font: 600 26px/1.2 "Noto Serif SC", serif; }
.sidebar-quote strong { display: block; margin-top: 5px; color: #f0cf99; font-size: 13px; }
.sidebar-quote small { display: block; margin-top: 7px; color: rgba(255,255,255,.72); font-size: 12px; }
.user-menu { display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 9px; padding-top: 14px; border-top: 1px solid var(--line); }
.user-avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: #edd8c2; color: #7d422c; font-weight: 800; }
.user-menu strong, .user-menu small { display: block; max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu strong { font-size: 14px; }
.user-menu small { margin-top: 3px; color: #7d766d; font-size: 12px; }
.user-menu button { border: 0; padding: 7px; background: transparent; color: #968f84; cursor: pointer; }
.main-content { min-height: 100vh; margin-left: 250px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; min-height: 70px; padding: 10px clamp(28px, 4vw, 58px); background: rgba(251,248,243,.92); border-bottom: 1px solid rgba(228,224,216,.86); backdrop-filter: blur(14px); }
.menu-button, .mobile-page-title { display: none; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; min-height: 35px; margin-right: 8px; padding: 0 11px; border: 1px solid #d9c7a9; border-radius: 12px; background: #fff6df; color: #79542f; font-size: 12px; font-weight: 800; }
.connection-status i { width: 7px; height: 7px; border-radius: 50%; background: #bc3e30; }
.connection-status small { color: #8e765b; font-size: 10px; font-weight: 700; }
.connection-status.syncing i { background: var(--jade); animation: connection-pulse 1s ease-in-out infinite; }
@keyframes connection-pulse { 50% { opacity: .28; } }
.topbar-stats { display: flex; gap: 8px; }
.topbar-stats > span { display: flex; align-items: center; gap: 6px; min-height: 35px; padding: 0 11px; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 12px; }
.topbar-stats b { font-size: 15px; }
.topbar-stats strong { font-size: 14px; }
.topbar-stats small { color: #8f887e; font-size: 10px; text-transform: uppercase; }
.app-view { display: none; max-width: 1260px; margin: 0 auto; padding: 48px clamp(28px, 5vw, 72px) 80px; }
.app-view.active { display: block; animation: view-in .25s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.welcome-row, .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 32px; }
.welcome-row h1, .page-heading h1 { margin: 7px 0 8px; font-size: clamp(31px, 4vw, 45px); }
.welcome-row p, .page-heading p { margin: 0; max-width: 720px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.date-stamp { width: 72px; padding: 11px 8px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.date-stamp span { display: block; font: 700 28px/1 "Noto Serif SC", serif; }
.date-stamp small { display: block; margin-top: 6px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

/* Today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 21px; }
.daily-card { min-height: 340px; position: relative; overflow: hidden; display: grid; grid-template-columns: .9fr 1.1fr; background: var(--red); border-radius: var(--radius); color: white; box-shadow: var(--shadow); }
.daily-card::after { content: ""; position: absolute; width: 400px; height: 400px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; left: -230px; top: -220px; }
.daily-copy { align-self: center; padding: 40px 36px 40px 18px; position: relative; z-index: 2; }
.daily-copy h2 { margin: 9px 0 11px; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; }
.daily-copy p { color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.6; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 13px; margin: 21px 0; }
.lesson-meta span { font-size: 12px; }
.lesson-meta.light { color: rgba(255,255,255,.75); }
.daily-art { position: relative; overflow: hidden; min-height: 340px; }
.daily-art .sun { position: absolute; width: 92px; height: 92px; left: 30px; top: 48px; border-radius: 50%; background: #edc98f; opacity: .95; }
.daily-art strong { position: absolute; z-index: 5; left: 50%; top: 48%; width: max-content; white-space: nowrap; word-break: keep-all; transform: translate(-50%,-50%); font: 700 clamp(95px, 11vw, 155px)/1 "Noto Serif SC", serif; text-shadow: 0 12px 30px rgba(70,20,15,.25); }
.mountain { position: absolute; bottom: -90px; border-radius: 50% 50% 0 0; transform: rotate(17deg); background: #753a34; }
.mountain-one { width: 300px; height: 250px; left: -60px; }
.mountain-two { width: 230px; height: 210px; right: -70px; background: #cb786e; transform: rotate(-20deg); }
.day-plan { padding: 25px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading.compact { align-items: center; }
.section-heading h2 { margin: 6px 0 0; font-size: 25px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.time-pill { padding: 7px 10px; border-radius: 20px; background: var(--jade-soft); color: var(--jade); font-size: 12px; font-weight: 800; }
.plan-step { display: grid; grid-template-columns: 33px 1fr auto; gap: 12px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.plan-step > span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: #eee9e1; color: #8e877d; font: 600 12px/1 "Noto Serif SC", serif; }
.plan-step.current > span { background: var(--red); color: white; }
.plan-step strong, .plan-step small { display: block; }
.plan-step strong { font-size: 14px; }
.plan-step small { margin-top: 4px; color: #817a70; font-size: 12px; line-height: 1.4; }
.plan-step > b { color: #aaa297; font-size: 12px; }
.knowledge-peek { margin-top: 38px; }
.text-button { border: 0; background: transparent; color: var(--red); font-size: 14px; font-weight: 800; cursor: pointer; }
.peek-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.peek-card { position: relative; min-height: 155px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 17px; text-align: center; }
.peek-card.empty { display: grid; place-items: center; grid-column: 1/-1; color: var(--muted); border-style: dashed; }
.peek-card .hanzi { display: block; font: 600 53px/1.15 "Noto Serif SC", serif; }
.peek-card .pinyin { display: block; margin-top: 6px; color: var(--red); font-size: 16px; font-weight: 800; }
.peek-card .meaning { display: block; margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.sound-button { position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: #f5efe7; color: var(--jade); cursor: pointer; }

/* Path */
.overall-progress { width: 220px; }
.overall-progress span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; text-align: right; }
.overall-progress > div { height: 7px; overflow: hidden; border-radius: 9px; background: #e9e1d6; }
.overall-progress i { display: block; height: 100%; width: 0; background: var(--red); border-radius: inherit; transition: width .4s; }
.path-levels { display: grid; gap: 25px; }
.level-card { display: grid; grid-template-columns: 185px 1fr; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(70,50,28,.05); }
.level-intro { position: relative; padding: 28px 25px; background: var(--jade); color: white; }
.level-intro::after { content: attr(data-number); position: absolute; right: -8px; bottom: -35px; color: rgba(255,255,255,.07); font: 700 140px/1 "Noto Serif SC", serif; }
.level-intro-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.level-intro-top > span:first-child { color: #f2d6a2; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.level-progress { padding: 5px 9px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.1); color: white; font-size: 13px; font-weight: 800; }
.level-progress small { color: rgba(255,255,255,.82); font-size: 11px; font-weight: 600; }
.level-intro h2 { margin: 11px 0 9px; font-size: 25px; }
.level-intro p { color: rgba(255,255,255,.86); font-size: 13px; line-height: 1.55; }
.level-lessons { display: grid; grid-template-columns: repeat(4, minmax(120px,1fr)); padding: 22px; }
.lesson-node { position: relative; min-height: 155px; padding: 15px; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.lesson-node:last-child { border-right: 0; }
.lesson-node:disabled { cursor: not-allowed; opacity: .44; }
.node-orb { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 50%; background: #f1ece4; font: 600 19px/1 "Noto Serif SC", serif; }
.node-orb.compact { font-size: 13px; }
.lesson-node.available .node-orb { background: var(--red-soft); color: var(--red); box-shadow: 0 0 0 5px #fcf6ee; }
.lesson-node.completed .node-orb { background: var(--jade); color: white; }
.node-copy { display: block; }
.lesson-node strong { display: block; font-size: 14px; line-height: 1.4; }
.lesson-node small { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 7px; color: #817a70; font-size: 11px; line-height: 1.45; }
.lesson-node small b { color: #655f57; font: inherit; font-weight: 800; white-space: nowrap; }
.node-status { position: absolute; right: 13px; top: 15px; color: var(--jade); font-size: 12px; }
.node-status.score { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; background: #edf4f1; font-weight: 800; white-space: nowrap; }

/* Map */
.map-heading { align-items: center; }
.map-count { display: flex; align-items: center; gap: 11px; padding: 12px 16px; background: var(--jade); color: white; border-radius: 15px; }
.map-count strong { font: 700 30px/1 "Noto Serif SC", serif; color: #f2d6a2; }
.map-count span { color: rgba(255,255,255,.86); font-size: 11px; line-height: 1.4; text-transform: uppercase; letter-spacing: .07em; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px; margin-bottom: 24px; background: #f3ece8; border-radius: 15px; }
.category-tabs { display: flex; flex: 1; flex-wrap: wrap; gap: 7px; min-width: 0; }
.category-tab { white-space: nowrap; border: 1px solid transparent; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.42); color: #6f685e; cursor: pointer; font-size: 13px; font-weight: 800; text-transform: capitalize; }
.category-tab.active { border-color: rgba(169,79,69,.15); background: white; color: var(--red); box-shadow: 0 2px 8px rgba(63,45,25,.08); }
.search-box { display: flex; align-items: center; gap: 7px; min-width: 265px; padding: 0 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.search-box input { width: 100%; min-height: 41px; border: 0; outline: 0; background: transparent; font-size: 14px; }
.map-group { margin-bottom: 30px; }
.map-group-title { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.map-group-title h2 { margin: 0; font-size: 22px; text-transform: capitalize; }
.map-group-title span { color: #827b71; font-size: 12px; }
.map-symbol-practice { margin-left: auto; min-height: 38px; padding: 0 13px; border: 1px solid #bfd5cd; border-radius: 999px; background: var(--jade-soft); color: var(--jade); cursor: pointer; font-size: 12px; font-weight: 800; }
.map-symbol-practice:hover { border-color: var(--jade); background: #d5e8e0; }
.map-subgroup + .map-subgroup { margin-top: 24px; }
.map-subgroup-title { display: flex; align-items: baseline; gap: 9px; margin: 0 2px 10px; }
.map-subgroup-title h3 { margin: 0; color: var(--jade); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.map-subgroup-title span { color: #827b71; font-size: 12px; }
.word-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.word-card { position: relative; display: flex; min-width: 0; min-height: 218px; padding: 54px 14px 13px; flex-direction: column; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 17px; transition: .2s; }
.word-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.word-card .hanzi { display: block; margin-top: 5px; text-align: center; white-space: nowrap; font: 600 57px/1.18 "Noto Serif SC", serif; }
.word-card.hanzi-long .hanzi { font-size: 49px; letter-spacing: -.04em; }
.word-card.hanzi-xlong .hanzi { font-size: 40px; letter-spacing: -.06em; }
.word-card .pinyin { display: block; text-align: center; color: var(--red); font-size: 17px; font-weight: 800; }
.word-card .meaning { display: block; margin-top: 5px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.35; }
.card-mastery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 10px; margin-top: auto; padding-top: 11px; }
.mastery-line { display: grid; gap: 5px; min-width: 0; color: #736c63; }
.mastery-line small { overflow: hidden; font-size: 10px; font-weight: 700; text-align: center; text-overflow: ellipsis; }
.mastery-line > i { display: flex; gap: 2px; width: 100%; font-style: normal; }
.mastery-line > i b { flex: 1; height: 4px; border-radius: 999px; background: #e8e1d7; }
.mastery-line > i b.on { background: var(--jade); }
.mastery-line.writing > i b.on { background: var(--red); }
.word-card .sound-button, .writing-card-button { display: flex; align-items: center; justify-content: center; gap: 4px; width: auto; height: 38px; padding: 0 9px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; font-weight: 800; }
.word-card .sound-button { right: 9px; top: 10px; border-color: #d1e1dc; background: var(--jade-soft); }
.word-card .sound-button svg, .writing-card-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.word-card .sound-button span, .writing-card-button span { line-height: 1; }
.writing-card-button { position: absolute; left: 9px; top: 10px; background: var(--red-soft); color: var(--red); cursor: pointer; }
.writing-card-button:hover { background: #edd6d2; color: var(--red-dark); }
.writing-card-button:focus-visible, .word-card .sound-button:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
.empty-state { padding: 55px 25px; text-align: center; background: var(--card); border: 1px dashed #d8cebf; border-radius: var(--radius); }
.empty-state .empty-glyph { display: block; font: 600 58px/1 "Noto Serif SC", serif; color: #d9cbbb; }
.empty-state h2 { margin: 14px 0 7px; }
.empty-state p { color: var(--muted); font-size: 15px; line-height: 1.55; }

/* Review and stats */
.review-area { min-height: 410px; display: grid; place-items: center; padding: 40px; background: linear-gradient(145deg,#3b6b61,#294f48); border-radius: var(--radius); color: white; box-shadow: 0 16px 40px rgba(41,79,72,.12); }
.review-card { width: min(100%, 520px); text-align: center; }
.review-card .review-count { display: block; margin-bottom: 12px; color: rgba(255,255,255,.84); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.review-character { display: block; margin: 4px 0 0; font: 700 105px/1.1 "Noto Serif SC", serif; }
.review-spanish-stimulus { display: block; margin: 7px 0 0; color: white; font-size: 34px; font-weight: 800; }
.review-listen-stimulus, .quiz-listen-stimulus { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 50%; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.review-listen-stimulus:active, .quiz-listen-stimulus:active { transform: scale(.97); }
.review-listen-stimulus svg, .quiz-listen-stimulus svg { width: 35px; height: 35px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.review-listen-stimulus { width: 112px; height: 112px; margin: 4px 0 0; background: #f2d6a2; color: #294f48; box-shadow: 0 9px 22px rgba(49,95,85,.13); }
.review-listen-stimulus span { display: block; margin: 0; font-size: 13px; font-weight: 800; line-height: 1; }
.review-pinyin { display: block; margin: 8px 0 0; color: #f2d6a2; font-size: 22px; font-weight: 800; }
.review-audio-hint { display: block; min-height: 38px; margin: 8px auto 0; padding: 0 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 20px; background: rgba(255,255,255,.08); color: white; cursor: pointer; font-size: 13px; font-weight: 800; }
.review-audio-hint:hover { background: rgba(255,255,255,.16); }
.review-prompt { margin: 8px 0 10px; color: rgba(255,255,255,.9); font-size: 16px; }
.review-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 30px; }
.review-option { min-height: 52px; padding: 10px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 11px; background: rgba(255,255,255,.08); color: white; cursor: pointer; font-size: 16px; }
.review-option:hover { background: rgba(255,255,255,.16); }
.review-option.correct { background: #e1efe5; color: #315f48; }
.review-option.wrong { background: #f4e0dd; color: #824640; }
.review-feedback { display: grid; gap: 5px; margin-top: 14px; padding: 14px 15px; border-radius: 13px; text-align: left; }
.review-feedback.correct { background: #e1efe5; color: #315f48; }
.review-feedback.wrong { background: #f4e0dd; color: #824640; }
.review-feedback > strong { font-size: 18px; }
.review-feedback > span { font-size: 15px; line-height: 1.4; }
.review-feedback > div { display: flex; justify-content: space-between; gap: 9px; margin-top: 6px; }
.review-feedback button { min-height: 42px; padding: 0 14px; border: 1px solid currentColor; border-radius: 10px; background: rgba(255,255,255,.48); color: inherit; cursor: pointer; font-size: 14px; font-weight: 800; }
.review-feedback .review-next-button { flex: 1; border-color: transparent; color: white; }
.review-feedback.correct .review-next-button { background: #22553c; }
.review-feedback.wrong .review-next-button { background: var(--red-dark); }
.review-feedback .review-next-button:disabled { opacity: .65; cursor: wait; }
.review-done { text-align: center; }
.review-done .done-glyph { display: block; font: 600 78px/1 "Noto Serif SC", serif; color: #f2d6a2; }
.review-done p { color: rgba(255,255,255,.86); }
.review-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; margin-top: 22px; }
.review-actions .cream-button { margin: 0; }
.review-writing-button { min-height: 52px; padding: 0 21px; border: 1px solid rgba(255,255,255,.4); border-radius: 12px; background: transparent; color: white; cursor: pointer; font-size: 16px; font-weight: 800; }
.review-writing-button:hover { background: rgba(255,255,255,.1); }
.review-hub { width: min(100%,680px); }
.review-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 22px; text-align: left; }
.review-mode-card { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 12px; min-height: 84px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.3); border-radius: 14px; background: rgba(255,255,255,.09); color: white; cursor: pointer; text-align: left; }
.review-mode-card:hover { background: rgba(255,255,255,.16); }
.review-mode-card.primary { border-color: #f2d6a2; background: rgba(242,214,162,.13); }
.review-mode-card > b { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.11); color: #f2d6a2; font: 600 25px/1 "Noto Serif SC",serif; }
.review-mode-card span { display: grid; gap: 3px; }
.review-mode-card strong { font-size: 16px; }
.review-mode-card small { color: rgba(255,255,255,.82); font-size: 12px; line-height: 1.35; }
.practice-session-card { width: min(100%,650px); text-align: center; }
.practice-session-card > h2, .lesson-matching h2 { margin: 8px 0 6px; }
.practice-session-card > p { margin: 0 auto 17px; color: rgba(255,255,255,.86); line-height: 1.5; }
.practice-session-card .review-count { display: block; color: rgba(255,255,255,.84); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.practice-session-card .challenge-context { color: var(--ink); }
.practice-session-card .sentence-actions .cream-button { margin: 0; }
.practice-session-card .sentence-feedback { display: flex; align-items: center; justify-content: center; min-height: 88px; margin: 20px 0 0; padding: 18px 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.1); text-align: center; }
.practice-session-card .sentence-feedback.correct { border-color: rgba(188,229,206,.5); background: rgba(188,229,206,.12); color: #ccebd9; }
.practice-session-card .sentence-feedback.wrong { border-color: rgba(255,197,189,.55); background: rgba(255,197,189,.12); color: #ffd3cd; }
.practice-round-count { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.matching-progress { display: inline-block; margin: 7px 0 13px; color: var(--jade); font-size: 13px; font-weight: 800; }
.matching-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.matching-column { display: grid; align-content: start; gap: 8px; }
.matching-column > strong { color: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; opacity: .68; }
.matching-column button { position: relative; min-height: 55px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.23); border-radius: 11px; background: rgba(255,255,255,.09); color: inherit; cursor: pointer; font-size: 16px; font-weight: 700; }
.lesson-matching { width: min(100%,590px); margin: 0 auto; text-align: center; }
.lesson-matching > p { margin: 0; color: var(--muted); }
.lesson-matching .matching-grid { margin-top: 3px; }
.lesson-matching .matching-column button { border-color: var(--line); background: white; color: var(--ink); }
.matching-column button.selected { border-color: #f2c985; box-shadow: 0 0 0 2px rgba(242,201,133,.28); }
.matching-column button.wrong { border-color: #cf8c85; background: #f5e3e0; color: #824640; animation: match-shake .22s ease-in-out 2; }
.matching-column button.matched { border-color: #91b5a0; background: #e1efe5; color: #315f48; opacity: .78; }
.matching-column button.matched::after { content: '✓'; position: absolute; right: 7px; top: 5px; font-size: 12px; font-weight: 900; }
.practice-complete { margin-top: 14px; color: #bce5ce; font-size: 16px; font-weight: 800; }
.lesson-matching .practice-complete { color: #26704b; }
.practice-finish-actions { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
.practice-finish-actions button, .review-practice-next { min-height: 46px; padding: 0 17px; border: 1px solid rgba(255,255,255,.35); border-radius: 11px; background: rgba(255,255,255,.1); color: white; cursor: pointer; font-size: 15px; font-weight: 800; }
.review-practice-next { width: 100%; margin-top: 20px; border-color: transparent; background: #f2d6a2; color: #294f48; }
.review-practice-exit.text { margin-top: 15px; border: 0; background: transparent; color: rgba(255,255,255,.84); cursor: pointer; font-size: 14px; font-weight: 700; }
.symbol-practice-session { width: min(100%,580px); text-align: center; }
.symbol-practice-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 10px; text-align: left; }
.symbol-practice-heading span, .symbol-practice-heading strong { display: block; }
.symbol-practice-heading span { margin-bottom: 3px; color: #f2d6a2; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.symbol-practice-heading strong { font-size: 22px; }
.symbol-practice-heading small { color: rgba(255,255,255,.75); font-size: 12px; font-weight: 700; }
.symbol-progress { overflow: hidden; height: 5px; margin-bottom: 16px; border-radius: 999px; background: rgba(255,255,255,.14); }
.symbol-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: #f2d6a2; transition: width .25s ease; }
.symbol-recall-card { position: relative; display: grid; place-items: center; min-height: 380px; overflow: hidden; border: 1px solid rgba(255,255,255,.45); border-radius: 22px; background: #fffdfa; color: var(--ink); box-shadow: 0 16px 35px rgba(16,42,36,.18); }
.symbol-reveal-button { display: grid; place-items: center; align-content: center; width: 100%; min-height: 380px; padding: 42px 22px 30px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.symbol-card-label { position: absolute; top: 18px; left: 0; right: 0; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.symbol-recall-hanzi { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 178px; white-space: nowrap; font: 600 clamp(66px,15vw,112px)/1 "Noto Serif SC",serif; }
.symbol-recall-hanzi .hanzi-vector-targets { max-width: 100%; }
.symbol-reveal-hint { margin-top: 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.symbol-reveal-hint b { color: var(--jade); font-size: 15px; }
.symbol-front-listen { position: absolute; top: 13px; right: 13px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 64px; min-height: 38px; padding: 0 10px; border: 1px solid #bfd5cd; border-radius: 999px; background: var(--jade-soft); color: var(--jade); cursor: pointer; font-size: 12px; font-weight: 800; box-shadow: 0 5px 15px rgba(49,95,85,.12); }
.symbol-front-listen svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.symbol-recall-card.revealed { align-content: center; min-height: 405px; padding: 43px 25px 24px; }
.symbol-recall-card.revealed .symbol-recall-hanzi { min-height: 138px; }
.symbol-recall-pinyin { margin-top: -5px; color: var(--red); font-size: 23px; }
.symbol-recall-meaning { margin-top: 5px; color: var(--muted); font-size: 18px; }
.symbol-listen-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; margin-top: 13px; padding: 0 13px; border: 1px solid #bfd5cd; border-radius: 999px; background: var(--jade-soft); color: var(--jade); cursor: pointer; font-size: 13px; font-weight: 800; }
.symbol-listen-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.symbol-example { display: grid; gap: 3px; width: 100%; margin-top: 18px; padding: 12px 15px; border-radius: 13px; background: #f5efe7; }
.symbol-example b { font: 600 22px/1.3 "Noto Serif SC",serif; }
.symbol-example span { color: var(--red); font-size: 13px; font-weight: 800; }
.symbol-example small { color: var(--muted); font-size: 13px; }
.symbol-rating { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.symbol-rating button { min-height: 50px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 800; }
.symbol-again { border: 1px solid #e3bbb5; background: #f6e5e1; color: #89483f; }
.symbol-known { border: 1px solid #b8d7c6; background: #dfeee6; color: #285c44; }
.symbol-practice-done { width: min(100%,600px); }
@keyframes match-shake { 50% { transform: translateX(3px); } }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 17px; }
.stat-card span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { display: block; margin-top: 11px; font: 700 40px/1 "Noto Serif SC", serif; }
.stat-card small { display: block; margin-top: 9px; color: #817a70; font-size: 12px; line-height: 1.4; }
.progress-panels { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
.panel { padding: 25px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.category-progress { display: grid; gap: 15px; }
.category-row { display: grid; grid-template-columns: 105px 1fr 30px; gap: 12px; align-items: center; }
.category-row span { font-size: 14px; text-transform: capitalize; }
.category-row > div { height: 6px; overflow: hidden; background: #ece5dc; border-radius: 5px; }
.category-row i { display: block; height: 100%; background: var(--red); border-radius: inherit; }
.category-row b { font-size: 14px; text-align: right; }
.insight-panel { position: relative; overflow: hidden; background: var(--red); color: white; }
.insight-panel .insight-mark { position: absolute; right: -10px; top: -25px; color: rgba(255,255,255,.08); font: 700 145px/1 "Noto Serif SC", serif; }
.insight-panel h2 { position: relative; margin: 13px 0 9px; }
.insight-panel p { position: relative; color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.6; }

/* Lesson modal */
.modal-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(35,30,23,.62); backdrop-filter: blur(7px); }
.lesson-modal { width: min(100%, 760px); max-height: min(90vh,780px); overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; background: var(--paper); border-radius: 23px; box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.lesson-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 16px; }
.lesson-header h2 { margin: 6px 0 0; font-size: 31px; line-height: 1.15; }
.lesson-header button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0e8e4; cursor: pointer; font-size: 20px; }
.lesson-progress { height: 4px; margin: 0 28px; background: #e7ded2; border-radius: 4px; }
.lesson-progress i { display: block; width: 10%; height: 100%; border-radius: inherit; background: var(--red); transition: width .25s; }
.lesson-stage { min-height: 370px; overflow-y: auto; padding: 30px 42px; }
.lesson-overview { max-width: 620px; margin: 8px auto 0; text-align: center; }
.lesson-overview h2 { margin: 10px 0 10px; font-size: 32px; line-height: 1.2; }
.lesson-overview > p { max-width: 520px; margin: 0 auto; color: #514d46; font-size: 18px; line-height: 1.6; }
.lesson-preview-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; margin-top: 26px; }
.lesson-preview-item { min-width: 0; padding: 17px 8px 15px; border: 1px solid var(--line); border-radius: 15px; background: white; cursor: pointer; transition: transform .15s ease, border-color .15s ease; }
.lesson-preview-item:hover, .lesson-preview-item:focus-visible { border-color: var(--red); outline: 0; transform: translateY(-2px); }
.lesson-preview-item span { display: block; font: 600 49px/1.15 "Noto Serif SC",serif; }
.lesson-preview-item strong { display: block; margin-top: 5px; color: var(--red); font-size: 16px; }
.lesson-preview-item small { display: block; margin-top: 5px; color: #514d46; font-size: 14px; line-height: 1.25; }
.preview-hint { display: block; margin-top: 18px; color: var(--jade); font-size: 14px; font-weight: 700; }
.tone-primer { margin: 0 auto 28px; padding: 21px; border: 1px solid #d3e2dc; border-radius: 18px; background: var(--jade-soft); }
.tone-primer h3 { margin: 8px 0 7px; font-size: 26px; }
.tone-primer > p { margin: 0 auto; color: #405e55; font-size: 16px; line-height: 1.5; }
.tone-samples { display: grid; grid-template-columns: repeat(5,1fr); gap: 7px; margin-top: 17px; }
.tone-samples button { position: relative; min-width: 0; padding: 11px 5px; border: 1px solid rgba(88,120,111,.2); border-radius: 12px; background: white; cursor: pointer; }
.tone-samples b, .tone-samples strong, .tone-samples small { display: block; }
.tone-samples b { font: 600 33px/1.1 "Noto Serif SC",serif; }
.tone-samples strong { margin-top: 3px; color: var(--red); font-size: 15px; }
.tone-samples small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.tone-samples i { position: absolute; right: 7px; top: 6px; color: var(--jade); font-style: normal; }
.concept-intro { max-width: 590px; margin: 0 auto 23px; text-align: center; }
.concept-intro h2 { margin: 9px 0 15px; font-size: 30px; line-height: 1.2; }
.concept-intro .pattern { display: inline-block; margin: 11px 0 17px; padding: 11px 16px; border-radius: 9px; background: var(--jade-soft); color: var(--jade); font-size: 17px; font-weight: 800; }
.concept-intro p { color: #514d46; font-size: 19px; line-height: 1.7; }
.concept-after { max-width: 580px; margin: 18px auto 0; text-align: center; }
.concept-after h2 { margin: 10px 0 17px; font-size: 32px; }
.concept-after .pattern { display: inline-block; padding: 12px 17px; border-radius: 10px; background: var(--jade-soft); color: var(--jade); font-size: 18px; font-weight: 800; }
.concept-after > p { margin: 22px auto; color: #514d46; font-size: 19px; line-height: 1.7; }
.known-pieces { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.known-pieces button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--red); cursor: pointer; font-size: 15px; font-weight: 700; }
.known-pieces button span { color: var(--ink); font: 600 27px/1 "Noto Serif SC",serif; }
.learn-card { max-width: 470px; margin: 0 auto; padding: 31px 30px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.learn-card > .eyebrow { font-size: 15px; }
.learn-card .hanzi { display: block; font: 700 112px/1.15 "Noto Serif SC", serif; }
.hanzi-speak { width: 100%; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; transition: transform .15s ease, color .15s ease; }
.hanzi-speak:hover, .hanzi-speak:focus-visible { color: var(--red); transform: scale(1.035); outline: 0; }
.hanzi-speak:active { transform: scale(.98); }
.learn-card .hanzi-vector-word { display: flex; align-items: center; justify-content: center; min-height: 132px; }
.hanzi-vector-targets { display: none; align-items: center; justify-content: center; max-width: 100%; }
.hanzi-vector-character { display: block; flex: 0 0 auto; }
.hanzi-vector-character svg { display: block; width: 100%; height: 100%; }
.hanzi-vector-word.vector-ready .hanzi-vector-targets { display: flex; }
.hanzi-vector-word.vector-ready .hanzi-font-fallback { display: none; }
.hanzi-vector-word:focus-visible { outline: 2px solid var(--jade); outline-offset: 5px; border-radius: 8px; }
.learn-card .pinyin { display: block; color: var(--red); font-size: 27px; font-weight: 800; }
.learn-card .meaning { display: block; margin-top: 7px; font-size: 21px; }
.item-usage { margin-top: 18px; padding: 13px 15px 14px; border: 1px solid #e7dfd3; border-radius: 12px; background: #f7f3ed; text-align: left; }
.item-usage b { display: block; color: var(--jade); font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.item-usage p { margin: 5px 0 0; color: #514d46; font-size: 15px; line-height: 1.5; }
.example-block { margin-top: 27px; padding-top: 24px; border-top: 1px solid var(--line); }
.example-block strong { display: block; font: 600 38px/1.45 "Noto Serif SC", serif; }
.example-focus { padding: 0; background: transparent; color: var(--red); }
.example-speak { width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; }
.example-speak:hover strong, .example-speak:focus-visible strong { color: var(--red); }
.example-speak:focus-visible { outline: 2px solid var(--jade); outline-offset: 5px; border-radius: 6px; }
.example-speak .example-listen-label { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; padding: 8px 12px; border: 1px solid #d1e1dc; border-radius: 999px; background: var(--jade-soft); color: var(--jade); font: 800 14px/1 "DM Sans", sans-serif; }
.example-listen-label svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.example-block > span { display: block; margin-top: 8px; color: var(--red); font-size: 21px; font-weight: 700; line-height: 1.4; }
.example-block > small { display: block; margin-top: 6px; color: #514d46; font-size: 18px; line-height: 1.45; }
.learn-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 22px; }
.learn-card .listen-large, .write-practice-button, .pronounce-button { min-height: 45px; border: 0; padding: 11px 17px; border-radius: 24px; cursor: pointer; font-size: 16px; font-weight: 800; }
.learn-card .listen-large { margin-top: 0; background: var(--jade-soft); color: var(--jade); }
.write-practice-button { background: var(--red-soft); color: var(--red-dark); }
.pronounce-button { background: #f3e8d9; color: #755a43; }
.pronounce-button.listening { background: #806653; color: white; box-shadow: 0 0 0 4px rgba(128,102,83,.12); }
.pronounce-button:disabled { opacity: .7; cursor: wait; }
.pronunciation-feedback { margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.pronunciation-feedback.listening { color: #80562f; }
.pronunciation-feedback.correct { color: #26704b; font-weight: 700; }
.pronunciation-feedback.wrong { color: #a33027; font-weight: 700; }
.example-breakdown { margin-top: 14px; padding: 12px 14px; border-radius: 11px; background: #f5f1eb; text-align: left; }
.example-breakdown b { display: block; color: var(--jade); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.example-breakdown p { margin: 5px 0 0; color: #514d46; font-size: 14px; line-height: 1.5; }
.dialogue-stage { max-width: 590px; margin: 0 auto; text-align: center; }
.dialogue-stage > h2 { margin: 8px 0 18px; font-size: 30px; }
.dialogue-lines { display: grid; gap: 8px; }
.dialogue-line { display: grid; grid-template-columns: 35px 1fr 28px; align-items: center; gap: 10px; width: 88%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; text-align: left; cursor: pointer; }
.dialogue-line.speaker-b { margin-left: auto; background: var(--jade-soft); }
.dialogue-line > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: white; font-weight: 800; }
.dialogue-line.speaker-b > span { background: var(--jade); }
.dialogue-line b, .dialogue-line strong, .dialogue-line small { display: block; }
.dialogue-line b { font: 600 25px/1.3 "Noto Serif SC",serif; }
.dialogue-line strong { color: var(--red); font-size: 14px; }
.dialogue-line small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.dialogue-line i { color: var(--jade); font-size: 18px; font-style: normal; }
.sentence-builder { margin-top: 23px; padding-top: 22px; border-top: 1px solid var(--line); }
.sentence-builder.standalone { margin-top: 0; padding-top: 0; border-top: 0; }
.sentence-builder h3 { margin: 7px 0 12px; font-size: 20px; }
.challenge-context { display: grid; gap: 3px; margin: 0 auto 11px; padding: 11px 13px; border-radius: 10px; background: #f3ede3; }
.challenge-context small { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.challenge-context .challenge-context-spanish { font-size: 19px; line-height: 1.3; }
.challenge-context .challenge-context-hanzi { margin-top: 3px; font: 600 22px/1.25 "Noto Serif SC",serif; }
.challenge-context em { color: var(--red); font-size: 13px; font-style: normal; font-weight: 800; }
.sentence-output { display: flex; align-items: center; justify-content: center; min-height: 58px; padding: 10px; border: 2px dashed #d8cec1; border-radius: 12px; background: white; color: var(--ink); font: 600 27px/1.2 "Noto Serif SC",serif; }
.sentence-output.complete b { min-width: 48px; margin-inline: 4px; padding: 4px 9px; border-radius: 8px; background: var(--red-soft); color: var(--red-dark); }
.sentence-output span { color: #999086; font: 500 14px/1.3 "DM Sans",sans-serif; }
.sentence-output-pinyin { display: block; margin-top: 7px; color: var(--red); font-size: 14px; font-weight: 800; line-height: 1.35; }
.sentence-tokens { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.sentence-tokens button { display: grid; place-items: center; gap: 4px; min-width: 62px; min-height: 64px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); cursor: pointer; }
.sentence-tokens button span { font: 600 25px/1.05 "Noto Serif SC",serif; }
.sentence-tokens button small { color: var(--red); font: 800 12px/1.1 "DM Sans",sans-serif; white-space: nowrap; }
.sentence-tokens button:disabled { opacity: .25; cursor: default; }
.sentence-actions { display: flex; justify-content: center; gap: 9px; margin-top: 13px; }
.sentence-actions button { min-height: 44px; }
.sentence-feedback { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 700; line-height: 1.45; }
.sentence-choice-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }
.practice-session-card .sentence-choice-hint { color: rgba(255,255,255,.72); }
.sentence-feedback.correct { background: #e3efe7; color: #35664e; }
.sentence-feedback.wrong { background: #f5e3e0; color: #8b4842; }
.quiz-wrap { max-width: 580px; margin: 15px auto 0; text-align: center; }
.quiz-wrap h3 { font-size: 19px; }
.quiz-hanzi { display: block; margin: 9px 0 0; font: 700 85px/1 "Noto Serif SC", serif; }
.quiz-pinyin { display: block; margin-top: 7px; color: var(--red); font-weight: 800; }
.quiz-spanish-stimulus { display: block; margin: 11px 0 0; font-size: 33px; font-weight: 800; }
.quiz-listen-stimulus { width: 110px; height: 110px; margin: 8px 0 0; background: var(--jade); color: white; box-shadow: 0 9px 22px rgba(49,95,85,.2); }
.quiz-listen-stimulus span { display: block; margin: 0; font-size: 13px; font-weight: 800; line-height: 1; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 32px; }
.quiz-option { min-height: 54px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; font-size: 16px; }
.quiz-option.selected { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }
.quiz-option.correct { border-color: #83aa94; background: #e3efe7; color: #35664e; font-weight: 800; }
.quiz-option.wrong { border-color: #c9867f; background: #f5e3e0; color: #824640; font-weight: 800; }
.quiz-option:disabled { cursor: default; opacity: 1; }
.quiz-feedback { display: grid; gap: 5px; margin-top: 18px; padding: 15px 18px; border-radius: 13px; text-align: left; }
.quiz-feedback strong { font-size: 18px; }
.quiz-feedback span { font-size: 16px; line-height: 1.45; }
.quiz-feedback.correct { background: #e3efe7; color: #35664e; }
.quiz-feedback.wrong { background: #f5e3e0; color: #824640; }
.lesson-result { max-width: 480px; margin: 30px auto 0; text-align: center; }
.lesson-result .result-mark { display: grid; place-items: center; width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 50%; background: var(--jade); color: white; font-size: 34px; }
.lesson-result h3 { font-size: 27px; }
.lesson-result p { color: var(--muted); font-size: 16px; line-height: 1.6; }
.result-score { display: flex; justify-content: center; gap: 22px; margin-top: 22px; }
.result-score span { padding: 11px 19px; background: white; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.lesson-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 28px; background: white; border-top: 1px solid var(--line); }
.lesson-footer > span { color: var(--muted); font-size: 12px; }

/* Handwriting practice */
.writing-layer { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 22px; background: rgba(35,30,23,.7); backdrop-filter: blur(9px); }
.writing-modal { width: min(100%,680px); max-height: min(94vh,900px); overflow: hidden; display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: var(--paper); border-radius: 24px; box-shadow: 0 30px 100px rgba(0,0,0,.34); }
.writing-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 27px 17px; border-bottom: 1px solid var(--line); }
.writing-header h2 { margin: 5px 0 0; font-size: 27px; }
.writing-header button { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ece5dc; cursor: pointer; font-size: 23px; }
.writing-content { overflow-y: auto; padding: 20px 28px 24px; text-align: center; overscroll-behavior: contain; }
.writing-character-tabs { display: flex; justify-content: center; gap: 8px; min-height: 44px; }
.writing-character-tabs span { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: white; color: #8a837a; font: 600 25px/1 "Noto Serif SC",serif; }
.writing-character-tabs span.active { border: 2px solid var(--red); color: var(--ink); background: var(--red-soft); }
.writing-character-tabs span.done { border-color: #91b7aa; color: var(--jade); background: var(--jade-soft); }
.writing-character-tabs span b { position: absolute; right: -5px; top: -7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--jade); color: white; font: 800 11px/1 "DM Sans",sans-serif; }
.writing-instruction { margin: 16px auto 14px; }
.writing-mode-badge { display: inline-flex; padding: 6px 10px; border-radius: 20px; background: var(--jade-soft); color: var(--jade); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.writing-instruction h3 { margin: 10px 0 5px; font-size: 25px; line-height: 1.2; }
.writing-instruction p { max-width: 510px; margin: 0 auto; color: var(--muted); font-size: 16px; line-height: 1.45; }
.writing-board { position: relative; width: min(100%,340px); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border: 2px solid #d8cec1; border-radius: 18px; background: white; touch-action: none; }
.writing-grid-lines { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .72; background: linear-gradient(to right,transparent calc(50% - .5px),#e4dbcf calc(50% - .5px),#e4dbcf calc(50% + .5px),transparent calc(50% + .5px)),linear-gradient(to bottom,transparent calc(50% - .5px),#e4dbcf calc(50% - .5px),#e4dbcf calc(50% + .5px),transparent calc(50% + .5px)),linear-gradient(45deg,transparent calc(50% - .5px),#efe7dc calc(50% - .5px),#efe7dc calc(50% + .5px),transparent calc(50% + .5px)),linear-gradient(-45deg,transparent calc(50% - .5px),#efe7dc calc(50% - .5px),#efe7dc calc(50% + .5px),transparent calc(50% + .5px)); }
.hanzi-writer-target { position: relative; z-index: 1; width: 100%; height: 100%; }
.writing-board[data-mode="free"] .writing-grid-lines { opacity: .55; }
.writing-feedback { min-height: 24px; margin: 13px 0 7px; color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1.45; }
.writing-feedback.success { color: #26704b; }
.writing-feedback.error { color: #a33027; }
.writing-tools { display: flex; justify-content: center; gap: 9px; }
.writing-tools .secondary-button { min-height: 42px; font-size: 14px; }
.writing-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 27px 18px; border-top: 1px solid var(--line); background: white; }
.writing-footer > div span { display: block; color: var(--muted); font-size: 12px; }
.writing-footer > div strong { display: block; margin-top: 2px; color: var(--jade); font-size: 17px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 150; max-width: 360px; padding: 14px 18px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 14px; }
.pwa-install-prompt { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 260; width: min(500px,calc(100vw - 28px)); padding: 20px; transform: translateX(-50%); border: 1px solid rgba(49,95,85,.2); border-radius: 22px; background: rgba(255,254,250,.98); box-shadow: 0 22px 65px rgba(36,37,34,.22); backdrop-filter: blur(18px); animation: pwa-install-in .28s ease-out; }
.pwa-install-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #f3eee7; color: var(--muted); cursor: pointer; font-size: 21px; line-height: 1; }
.pwa-install-heading { display: flex; align-items: center; gap: 14px; padding-right: 34px; }
.pwa-install-heading img { flex: 0 0 auto; border-radius: 16px; box-shadow: 0 7px 20px rgba(49,95,85,.18); }
.pwa-install-heading span, .pwa-install-heading strong { display: block; }
.pwa-install-heading span { margin-bottom: 4px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.pwa-install-heading strong { font-size: 21px; line-height: 1.15; }
.pwa-install-prompt > p { margin: 14px 0 17px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.pwa-install-actions { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10px; }
.pwa-install-actions button { min-height: 48px; padding: 0 16px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 15px; }
.pwa-install-later { background: #f1ece5; color: var(--ink); }
.pwa-install-confirm { background: var(--jade); color: white; box-shadow: 0 8px 19px rgba(49,95,85,.2); }
.pwa-install-confirm:disabled { opacity: .55; cursor: wait; }
@keyframes pwa-install-in { from { opacity: 0; transform: translate(-50%,18px); } }

@media (max-width: 1050px) {
  .auth-panel { grid-template-columns: minmax(0,1fr) 410px; gap: 28px; }
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
  .app-view { padding-inline: 30px; }
  .daily-card { grid-template-columns: .7fr 1.3fr; }
  .peek-cards, .word-grid { grid-template-columns: repeat(3,1fr); }
  .level-card { grid-template-columns: 150px 1fr; }
  .level-progress small { display: none; }
  .level-lessons { grid-template-columns: repeat(2,1fr); }
  .lesson-node:nth-child(2) { border-right: 0; }
  .lesson-node:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 790px) {
  .auth-shell { display: grid; padding: calc(24px + env(safe-area-inset-top,0px)) 18px calc(24px + env(safe-area-inset-bottom,0px)); }
  .auth-panel { grid-template-columns: 1fr; gap: 20px; }
  .auth-intro { padding: 4px 8px; }
  .auth-brand-mark { width: 46px; height: 46px; font-size: 27px; }
  .auth-intro h1 { margin: 13px 0 7px; font-size: 40px; }
  .auth-intro > p { font-size: 16px; line-height: 1.5; }
  .auth-feature { display: none; }
  .auth-card { padding: 23px 20px; }
  .auth-heading { margin-bottom: 21px; }
  .auth-heading h2 { font-size: 29px; }
  .auth-heading p { font-size: 16px; }
  .auth-tab { min-height: 48px; font-size: 17px; }
  .auth-form label { font-size: 16px; }
  .auth-form .remember-login { grid-template-columns: 22px 1fr; font-size: 15px; }
  .auth-form input { min-height: 54px; font-size: 17px; }
  .password-toggle { right: 10px; top: 7px; min-width: 48px; height: 40px; font-size: 14px; }
  .primary-button, .secondary-button, .cream-button { min-height: 56px; font-size: 17px; }
  .form-alert, .auth-note { font-size: 15px; }
  .sidebar { transform: translateX(-102%); width: min(286px,84vw); padding: 20px 16px 16px; transition: transform .25s ease; box-shadow: 20px 0 45px rgba(30,25,20,.13); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; width: 44px; height: 44px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; display: none; background: rgba(32,27,22,.35); }
  .sidebar-scrim.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar { position: static; min-height: 0; height: 0; padding: 0; border: 0; background: transparent; backdrop-filter: none; }
  .menu-button { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; z-index: 35; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.96); box-shadow: 0 3px 12px rgba(49,38,24,.09); font-size: 29px; line-height: 1; cursor: pointer; transition: opacity .18s ease; }
  .mobile-page-title { display: none; }
  .topbar-stats { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 35; transition: opacity .18s ease; }
  .connection-status { position: fixed; top: calc(25px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 34; max-width: 150px; min-height: 34px; margin: 0; padding-inline: 10px; transform: translateX(-50%); white-space: nowrap; box-shadow: 0 3px 12px rgba(49,38,24,.08); }
  .connection-status small { display: none; }
  .topbar-stats > span { min-height: 52px; padding-inline: 17px; border-radius: 15px; box-shadow: 0 4px 14px rgba(49,38,24,.11); }
  .topbar-stats b, .topbar-stats strong { font-size: 19px; }
  .topbar-stats > span:nth-child(1), .topbar-stats > span:nth-child(3) { display: none; }
  .topbar-stats small { display: none; }
  .sidebar-top { padding: 0 5px 22px; }
  .sidebar .brand { gap: 10px; }
  .sidebar .brand-glyph { width: 39px; height: 39px; font-size: 23px; }
  .sidebar .brand strong { font-size: 18px; }
  .sidebar .brand small { font-size: 11px; }
  .main-nav { gap: 4px; }
  .nav-item { gap: 11px; padding: 11px 10px; }
  .nav-icon { width: 36px; height: 36px; font-size: 19px; }
  .nav-item strong { font-size: 16px; }
  .nav-item small { margin-top: 3px; font-size: 13px; }
  .nav-badge { min-width: 25px; padding: 4px 7px; font-size: 12px; }
  .sidebar-quote { margin-bottom: 13px; padding: 14px; }
  .sidebar-quote strong { font-size: 14px; }
  .sidebar-quote small { font-size: 12px; line-height: 1.4; }
  .user-menu { grid-template-columns: 38px 1fr 40px; gap: 9px; padding-top: 11px; }
  .user-avatar { width: 38px; height: 38px; font-size: 15px; }
  .user-menu strong { font-size: 14px; }
  .user-menu small { font-size: 12px; }
  .user-menu button { width: 40px; height: 40px; font-size: 16px; }
  .eyebrow { font-size: 13px; }
  .lesson-meta { gap: 13px; }
  .lesson-meta span { font-size: 13px; }
  .time-pill { padding: 8px 11px; font-size: 13px; }
  .plan-step { grid-template-columns: 38px 1fr auto; gap: 12px; padding: 15px 0; }
  .plan-step > span { width: 36px; height: 36px; font-size: 14px; }
  .plan-step strong { font-size: 16px; }
  .plan-step small { font-size: 13px; }
  .plan-step > b { font-size: 18px; }
  .sound-button { width: 40px; height: 40px; font-size: 20px; }
  .text-button { font-size: 16px; }
  .lesson-header button { width: 44px; height: 44px; font-size: 23px; }
  .sidebar-open .menu-button, .sidebar-open .topbar-stats, .sidebar-open .connection-status { opacity: 0; pointer-events: none; }
  .app-view { padding: calc(94px + env(safe-area-inset-top, 0px)) 17px 65px; }
  .welcome-row, .page-heading { align-items: flex-start; }
  .welcome-row p, .page-heading p { font-size: 16px; line-height: 1.5; }
  .date-stamp, .overall-progress { display: none; }
  .today-grid { grid-template-columns: 1fr; }
  .daily-card { min-height: 470px; grid-template-columns: 1fr; grid-template-rows: 205px 1fr; }
  .daily-art { min-height: 205px; }
  .daily-art strong { font-size: clamp(78px, 25vw, 100px); }
  .daily-copy { padding: 25px; }
  .daily-copy p { font-size: 16px; }
  .day-plan { padding: 21px; }
  .section-heading h2 { font-size: 24px; }
  .section-heading p { font-size: 15px; }
  .peek-cards, .word-grid { grid-template-columns: repeat(2,1fr); }
  .peek-card { min-height: 185px; padding: 22px 16px; }
  .peek-card .hanzi { font-size: 58px; }
  .peek-card .pinyin { font-size: 19px; }
  .peek-card .meaning { font-size: 16px; }
  .level-card { grid-template-columns: 1fr; }
  #view-camino .page-heading { margin-bottom: 17px; }
  #view-camino .page-heading p { display: none; }
  .path-levels { gap: 18px; }
  .level-card { border-radius: 19px; }
  .level-intro { min-height: 0; padding: 17px 19px 15px; }
  .level-intro::after { right: 8px; bottom: -31px; font-size: 100px; }
  .level-intro-top > span:first-child { font-size: 14px; }
  .level-progress { padding: 6px 10px; font-size: 14px; }
  .level-progress small { font-size: 12px; }
  .level-intro h2 { position: relative; z-index: 1; margin: 7px 0 2px; font-size: 25px; }
  .level-intro p { position: relative; z-index: 1; display: -webkit-box; overflow: hidden; max-width: 560px; margin: 0; -webkit-box-orient: vertical; -webkit-line-clamp: 1; font-size: 14px; line-height: 1.4; }
  .level-lessons { grid-template-columns: 1fr; padding: 0; }
  .lesson-node { display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 13px; min-height: 80px; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .lesson-node:nth-child(odd), .lesson-node:nth-child(even) { border-right: 0; }
  .lesson-node:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .lesson-node:last-child { border-bottom: 0; }
  .node-orb { grid-column: 1; width: 50px; height: 50px; margin: 0; font-size: 23px; }
  .node-orb.compact { font-size: 13px; }
  .node-copy { grid-column: 2; min-width: 0; }
  .lesson-node strong { min-height: 0; font-size: 17px; line-height: 1.25; }
  .lesson-node small { gap: 3px 7px; margin-top: 4px; font-size: 14px; line-height: 1.3; }
  .node-status { position: static; grid-column: 3; display: grid; place-items: center; justify-self: end; width: 30px; height: 30px; border-radius: 50%; background: #edf4f1; font-size: 18px; font-weight: 800; }
  .node-status.score { width: auto; min-width: 61px; height: 30px; padding: 0 8px; font-size: 13px; }
  .lesson-node.available .node-status { background: var(--red-soft); color: var(--red); }
  .lesson-node.locked .node-status { background: #f2eee8; color: #8d857b; }
  .map-heading { align-items: flex-start; }
  .map-count { display: none; }
  .map-toolbar { display: grid; }
  .category-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }
  .search-box { min-width: 0; }
  .category-tab { width: 100%; min-height: 42px; padding: 8px 5px; overflow: hidden; font-size: 12px; text-align: center; text-overflow: ellipsis; }
  .search-box { min-height: 46px; font-size: 17px; }
  .search-box input { min-height: 44px; font-size: 15px; }
  .map-group-title h2 { font-size: 22px; }
  .map-group-title span { font-size: 13px; }
  .word-card { min-height: 235px; padding: 60px 14px 15px; }
  .word-card .hanzi { font-size: 58px; }
  .word-card.hanzi-long .hanzi { font-size: 49px; }
  .word-card.hanzi-xlong .hanzi { font-size: 40px; }
  .word-card .pinyin { font-size: 19px; }
  .word-card .meaning { font-size: 16px; }
  .mastery-line small { font-size: 11px; }
  .empty-state h2 { font-size: 24px; }
  .empty-state p { font-size: 16px; }
  .review-area { min-height: 450px; }
  .review-card .review-count { font-size: 15px; }
  .review-audio-hint { min-height: 44px; font-size: 15px; }
  .review-character { font-size: 115px; }
  .review-spanish-stimulus { font-size: 38px; }
  .review-listen-stimulus { width: 124px; height: 124px; }
  .review-listen-stimulus span { font-size: 15px; }
  .review-pinyin { font-size: 25px; }
  .review-prompt { font-size: 18px; }
  .review-option { min-height: 58px; font-size: 18px; }
  .review-feedback > strong { font-size: 20px; }
  .review-feedback > span { font-size: 17px; }
  .review-feedback button { font-size: 16px; }
  .review-done p { font-size: 17px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .stat-card { padding: 22px 18px; }
  .stat-card span { font-size: 14px; }
  .stat-card strong { font-size: 44px; }
  .stat-card small { font-size: 13px; }
  .progress-panels { grid-template-columns: 1fr; }
  .panel { padding: 22px 18px; }
  .category-row { grid-template-columns: 105px 1fr 38px; gap: 10px; }
  .category-row span, .category-row b { font-size: 14px; }
  .category-row > div { height: 8px; }
  .insight-panel p { font-size: 16px; }
  .modal-layer { place-items: stretch; height: 100dvh; padding: 0; background: var(--paper); backdrop-filter: none; }
  .lesson-modal { width: 100%; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
  .lesson-header { padding: calc(22px + env(safe-area-inset-top, 0px)) 24px 18px; }
  .lesson-progress { height: 7px; margin-inline: 24px; }
  .lesson-stage { min-height: 0; padding: 36px 24px; overscroll-behavior: contain; }
  .lesson-footer { padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .lesson-overview { max-width: none; }
  .tone-primer { padding: 19px; }
  .tone-primer h3 { font-size: 28px; }
  .tone-primer > p { font-size: 17px; }
  .tone-samples { grid-template-columns: repeat(5,minmax(105px,1fr)); overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .tone-samples button { min-height: 112px; }
  .tone-samples b { font-size: 40px; }
  .tone-samples strong { font-size: 17px; }
  .tone-samples small { font-size: 12px; }
  .learn-card { width: min(100%, 500px); padding: 30px 24px; }
  .lesson-preview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-top: 32px; }
  .lesson-preview-item { padding: 22px 10px 20px; }
  .lesson-preview-item strong { font-size: 18px; }
  .lesson-preview-item small { font-size: 16px; }
  .preview-hint { font-size: 16px; }
  .concept-intro .pattern, .concept-after .pattern { font-size: 19px; }
  .known-pieces button { min-height: 48px; font-size: 17px; }
  .learn-card .listen-large, .write-practice-button, .pronounce-button { min-height: 50px; font-size: 17px; }
  .pronunciation-feedback { font-size: 15px; }
  .example-breakdown b { font-size: 14px; }
  .example-breakdown p { font-size: 16px; }
  .dialogue-stage > h2 { font-size: 31px; }
  .dialogue-line { width: 92%; min-height: 79px; padding: 13px 15px; }
  .dialogue-line b { font-size: 29px; }
  .dialogue-line strong { font-size: 16px; }
  .dialogue-line small { font-size: 15px; }
  .sentence-builder h3 { font-size: 22px; }
  .challenge-context small { font-size: 14px; }
  .challenge-context strong { font-size: 26px; }
  .sentence-output { min-height: 66px; font-size: 31px; }
  .sentence-output span { font-size: 16px; }
  .sentence-tokens button { min-width: 60px; min-height: 53px; font-size: 27px; }
  .sentence-feedback { font-size: 17px; }
  .quiz-wrap h3 { font-size: 22px; }
  .quiz-pinyin { font-size: 20px; }
  .quiz-spanish-stimulus { font-size: 37px; }
  .quiz-listen-stimulus { width: 120px; height: 120px; }
  .quiz-listen-stimulus svg { width: 38px; height: 38px; }
  .quiz-listen-stimulus span { font-size: 14px; }
  .quiz-option { min-height: 58px; font-size: 18px; }
  .quiz-feedback { padding: 17px 19px; }
  .quiz-feedback strong { font-size: 20px; }
  .quiz-feedback span { font-size: 18px; }
  .lesson-modal[data-phase="quiz"] .lesson-header { padding-bottom: 12px; }
  .lesson-modal[data-phase="quiz"] .lesson-stage { padding-top: 14px; padding-bottom: 12px; }
  .lesson-modal[data-phase="quiz"] .quiz-wrap { margin-top: 0; }
  .lesson-modal[data-phase="quiz"] .quiz-wrap h3 { margin: 4px 0 0; line-height: 1.2; }
  .lesson-modal[data-phase="quiz"] .quiz-hanzi { margin: 6px 0 0; white-space: nowrap; font-size: clamp(68px, 20vw, 80px); }
  .lesson-modal[data-phase="quiz"] .quiz-pinyin { margin-top: 4px; }
  .lesson-modal[data-phase="quiz"] .quiz-options { gap: 8px; margin-top: 24px; }
  .lesson-modal[data-phase="quiz"] .quiz-option { min-height: 52px; padding-block: 8px; }
  .lesson-modal[data-phase="quiz"] .quiz-feedback { margin-top: 12px; padding: 12px 16px; }
  .lesson-modal[data-phase="quiz"] .quiz-feedback strong { font-size: 19px; }
  .lesson-modal[data-phase="quiz"] .quiz-feedback span { font-size: 16px; line-height: 1.35; }
  .lesson-result p { font-size: 17px; }
  .result-score span { font-size: 16px; }
  .writing-layer { place-items: stretch; height: 100dvh; padding: 0; background: var(--paper); backdrop-filter: none; }
  .writing-modal { width: 100%; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
  .writing-header { padding: calc(18px + env(safe-area-inset-top,0px)) 20px 14px; }
  .writing-header h2 { font-size: 25px; }
  .writing-content { padding: 16px 20px 18px; }
  .writing-instruction { margin-block: 13px 11px; }
  .writing-instruction h3 { font-size: 24px; }
  .writing-instruction p { font-size: 16px; }
  .writing-board { width: min(76vw,340px); }
  .writing-feedback { font-size: 16px; }
  .writing-tools .secondary-button { min-height: 46px; font-size: 15px; }
  .writing-footer { padding: 13px 18px calc(13px + env(safe-area-inset-bottom,0px)); }
  .writing-footer > div strong { font-size: 18px; }
  .toast { right: 17px; bottom: 17px; left: 17px; max-width: none; font-size: 16px; }
}

@media (max-width: 460px) {
  .welcome-row h1, .page-heading h1 { font-size: 28px; }
  .daily-copy h2 { font-size: 29px; }
  .peek-cards, .word-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .word-card { min-height: 225px; padding: 57px 9px 12px; }
  .word-card .hanzi { font-size: 54px; }
  .word-card.hanzi-long .hanzi { font-size: 42px; }
  .word-card.hanzi-xlong .hanzi { font-size: 34px; }
  .review-mode-grid { grid-template-columns: 1fr; }
  .review-mode-card { min-height: 76px; }
  .map-group-title { flex-wrap: wrap; }
  .map-symbol-practice { min-height: 36px; padding-inline: 11px; font-size: 11px; }
  .symbol-practice-heading strong { font-size: 20px; }
  .symbol-practice-heading small { max-width: 72px; text-align: right; }
  .symbol-recall-card, .symbol-reveal-button { min-height: 350px; }
  .symbol-recall-card.revealed { min-height: 390px; padding-inline: 18px; }
  .symbol-recall-hanzi { min-height: 155px; }
  .symbol-recall-card.revealed .symbol-recall-hanzi { min-height: 125px; }
  .matching-grid { gap: 8px; }
  .matching-column { gap: 7px; }
  .matching-column button { min-height: 52px; padding-inline: 7px; font-size: 15px; }
  .practice-finish-actions { display: grid; grid-template-columns: 1fr; }
  .practice-finish-actions button { width: 100%; }
  #view-camino .page-heading { margin-bottom: 14px; }
  #view-camino .page-heading h1 { margin-bottom: 0; font-size: 28px; }
  .level-intro { padding: 15px 16px 13px; }
  .level-intro h2 { font-size: 23px; }
  .level-intro p { font-size: 13px; }
  .level-lessons { grid-template-columns: 1fr; padding: 0; }
  .lesson-node { grid-template-columns: 46px minmax(0,1fr) 28px; gap: 11px; min-height: 74px; padding: 10px 12px; }
  .node-orb { width: 46px; height: 46px; font-size: 22px; }
  .node-orb.compact { font-size: 12px; }
  .lesson-node strong { font-size: 16px; }
  .lesson-node small { font-size: 13px; }
  .node-status { width: 28px; height: 28px; font-size: 16px; }
  .lesson-header { padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 16px; }
  .lesson-header h2 { font-size: 28px; }
  .lesson-progress { margin-inline: 20px; }
  .lesson-stage { padding: 32px 20px; }
  .lesson-footer { padding: 15px 16px calc(15px + env(safe-area-inset-bottom, 0px)); }
  .lesson-footer > span { display: none; }
  .concept-intro h2 { font-size: 28px; }
  .concept-intro p { font-size: 18px; }
  .learn-card .hanzi { font-size: 104px; }
  .learn-actions { display: grid; }
  .tone-primer { margin-inline: -4px; padding: 16px 13px; }
  .tone-samples { margin-inline: -2px; }
  .tone-samples button { min-height: 108px; }
  .example-block strong { font-size: 34px; }
  .example-speak .example-listen-label { font-size: 16px; }
  .example-block > span { font-size: 20px; }
  .example-block > small { font-size: 18px; }
  .lesson-overview h2, .concept-after h2 { font-size: 28px; }
  .lesson-overview > p, .concept-after > p { font-size: 17px; }
  .lesson-preview-grid { gap: 13px; }
  .lesson-preview-item { padding-inline: 8px; }
  .lesson-preview-item span { font-size: 45px; }
  .dialogue-line { width: 100%; grid-template-columns: 35px 1fr 24px; }
  .dialogue-line b { font-size: 27px; }
  .sentence-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .sentence-actions button { width: 100%; }
  .quiz-options, .review-options { grid-template-columns: 1fr; }
  .review-card.answered .review-options { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 20px; }
  .review-card.answered .review-option:not(.correct):not(.wrong) { display: none; }
  .review-card.answered.answer-correct .review-option.correct { grid-column: 1/-1; }
  .review-area { padding: 25px 18px; }
  .review-actions { display: grid; }
  .writing-header .eyebrow { font-size: 13px; }
  .writing-header h2 { max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; }
  .writing-content { padding-inline: 16px; }
  .writing-character-tabs { min-height: 40px; }
  .writing-character-tabs span { width: 40px; height: 40px; font-size: 23px; }
  .writing-mode-badge { font-size: 12px; }
  .writing-instruction h3 { font-size: 22px; }
  .writing-board { width: min(82vw,330px); }
  .writing-footer > div { display: none; }
  .writing-footer .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
