/* Tiếng Anh Mỗi Ngày — visual language: the Vietnamese school notebook (vở ô ly) and purple ink (mực tím). */
@font-face { font-family: "BVP"; font-weight: 400; font-display: swap; src: url(fonts/be-vietnam-pro-latin-400-normal.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; }
@font-face { font-family: "BVP"; font-weight: 400; font-display: swap; src: url(fonts/be-vietnam-pro-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "BVP"; font-weight: 400; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-400-normal.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: "BVP"; font-weight: 500; font-display: swap; src: url(fonts/be-vietnam-pro-latin-500-normal.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; }
@font-face { font-family: "BVP"; font-weight: 500; font-display: swap; src: url(fonts/be-vietnam-pro-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "BVP"; font-weight: 500; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-500-normal.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: "BVP"; font-weight: 600; font-display: swap; src: url(fonts/be-vietnam-pro-latin-600-normal.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; }
@font-face { font-family: "BVP"; font-weight: 600; font-display: swap; src: url(fonts/be-vietnam-pro-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "BVP"; font-weight: 600; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-600-normal.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: "BVP"; font-weight: 700; font-display: swap; src: url(fonts/be-vietnam-pro-latin-700-normal.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; }
@font-face { font-family: "BVP"; font-weight: 700; font-display: swap; src: url(fonts/be-vietnam-pro-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "BVP"; font-weight: 700; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-700-normal.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: "BVP"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/be-vietnam-pro-latin-400-italic.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F; }
@font-face { font-family: "BVP"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-400-italic.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: "IPA"; font-weight: 400; font-display: swap; src: url(fonts/noto-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F; }
@font-face { font-family: "IPA"; font-weight: 400; font-display: swap; src: url(fonts/noto-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02FF,U+1D00-1DBF; }

:root {
  --paper: #F6F7FB;
  --sheet: #FFFFFF;
  --grid: #DCDDF0;
  --grid-strong: #C5C6E6;
  --ink: #1E1B3A;
  --ink-2: #55526F;
  --ink-3: #6B6985;           /* ≥4.5:1 on white and paper (WCAG AA) */
  --purple: #4B3FA8;          /* mực tím */
  --purple-soft: #ECEAFB;
  --red: #C93636;             /* bút đỏ của cô giáo */
  --red-soft: #FCEDED;
  --green: #217A4B;
  --green-soft: #E7F4EC;
  --mark: #FFE68A;            /* bút dạ quang */
  --slogan: #C2410C;
  --line: #E4E5EE;
  --radius-card: 14px;
  --radius-ctl: 10px;
  --fs: 17px;
  --top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13122A; --sheet: #1C1B38; --grid: #2A2950; --grid-strong: #36356A;
    --ink: #ECEBFA; --ink-2: #B9B7D6; --ink-3: #8886AA;
    --purple: #ADA3FF; --purple-soft: #2A2758; --red: #FF8A8A; --red-soft: #3A1E2A;
    --green: #7AD6A2; --green-soft: #173528; --mark: #6B5A12; --line: #2C2B4E; color-scheme: dark;
    --slogan: #FFB37A;
  }
}
:root[data-theme="dark"] {
  --paper: #13122A; --sheet: #1C1B38; --grid: #2A2950; --grid-strong: #36356A;
  --ink: #ECEBFA; --ink-2: #B9B7D6; --ink-3: #8886AA;
  --purple: #ADA3FF; --purple-soft: #2A2758; --red: #FF8A8A; --red-soft: #3A1E2A;
  --green: #7AD6A2; --green-soft: #173528; --mark: #6B5A12; --line: #2C2B4E; color-scheme: dark;
  --slogan: #FFB37A;
}
:root[data-size="l"] { --fs: 19px; }
:root[data-size="xl"] { --fs: 21px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 var(--fs)/1.55 "BVP", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--purple); }
strong { font-weight: 600; }
.ipa { font-family: "IPA", "BVP", sans-serif; color: var(--ink-2); letter-spacing: .01em; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

/* ---------- shell ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  padding: calc(var(--top) + 10px) calc(var(--right) + 16px) 10px calc(var(--left) + 16px); display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 1.12em; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center;
  color: var(--ink); cursor: pointer; flex: none;
}
.iconbtn:active { background: var(--purple-soft); }
.iconbtn svg { width: 24px; height: 24px; }
main { flex: 1; padding: 4px calc(var(--right) + 16px) calc(var(--bottom) + 96px) calc(var(--left) + 16px); max-width: 720px; width: 100%; margin: 0 auto; }
main.full { padding-bottom: calc(var(--bottom) + 24px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--sheet);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--right) var(--bottom) var(--left);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px;
  text-decoration: none; color: var(--ink-3); font-size: .72em; font-weight: 500;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--purple); }
.tabbar a.on svg { stroke-width: 2.2; }

/* ---------- common blocks ---------- */
.sheet { background: var(--sheet); border-radius: var(--radius-card); padding: 16px; border: 1px solid var(--line); }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--ink-2); }
.small { font-size: .86em; }
.h2 { font-size: 1.05em; font-weight: 600; margin: 24px 0 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--radius-ctl); border: 1.5px solid var(--purple); background: var(--purple); color: #fff;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
/* Dark text only on filled buttons; ghost buttons keep their purple text on the dark page. */
:root[data-theme="dark"] .btn:not(.ghost), .btn.on-dark { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost) { color: #14122B; } }
.btn.ghost { background: transparent; color: var(--purple); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn:active { transform: translateY(1px); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--purple); border-radius: 3px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: .8em; font-weight: 500; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--bottom) + 84px); z-index: 30; margin: 0 auto; max-width: 480px;
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: .9em;
  animation: toast .2s ease-out; pointer-events: none;   /* never blocks a tap on the buttons under it */
}
/* Full-screen pages (flashcards, quiz) keep their buttons at the bottom: show messages at the top instead. */
body:has(main.full) .toast { bottom: auto; top: calc(var(--top) + 68px); }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }

/* list rows */
.list { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.list a, .list .li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; color: inherit; }
.list > * + * { border-top: 1px solid var(--line); }
.list a:active { background: var(--purple-soft); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 500; }
.li-sub { color: var(--ink-2); font-size: .86em; }
.num { width: 2.2em; flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .9em; }
.tick { width: 22px; height: 22px; flex: none; color: var(--green); }
.ring { --p: 0; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--purple) calc(var(--p) * 1%), var(--grid) 0); display: grid; place-items: center; }
.ring::after { content: ""; width: 26px; height: 26px; border-radius: 50%; background: var(--sheet); }

/* ---------- home ---------- */
.hello { margin: 6px 0 14px; }
/* Home header: the app icon (same drawing as the launcher icon), its name and slogan, like a logo. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 6px 0 8px; }  /* room for the float and shadow: the title clips overflow */
.brand .logo { width: 52px; height: 52px; flex: none; border-radius: 15px; overflow: hidden; box-shadow: 0 6px 14px -8px rgba(40, 30, 120, .6); animation: float 4s ease-in-out infinite; }
.brand .logo svg { display: block; }
.brand .names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand .name { font-weight: 700; font-size: 1.05em; color: var(--purple); overflow: hidden; text-overflow: ellipsis; }
.brand .slogan { color: var(--slogan); font-weight: 600; font-size: .78em; }
@keyframes float { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .brand .logo { animation: none; } }
.hello .date { color: var(--ink-2); font-size: .9em; }
.hello h2 { margin: 0; font-size: 1.5em; font-weight: 700; letter-spacing: -.01em; }
.today {
  position: relative; border-radius: 18px; padding: 20px 18px 18px; overflow: hidden; color: var(--ink);
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 18px 18px; border: 1px solid var(--grid-strong);
}
.today::before { content: ""; position: absolute; top: 0; bottom: 0; left: 30px; width: 2px; background: color-mix(in srgb, var(--red) 55%, transparent); }
.today > * { position: relative; padding-left: 26px; }
.today .big { font-size: 2.4em; font-weight: 700; line-height: 1.05; color: var(--purple); }
.today .what { color: var(--ink-2); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.25em; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78em; color: var(--ink-2); }

/* ---------- flashcard: the notebook page ---------- */
/* Fill the visible screen (dvh excludes browser chrome; the insets exclude the phone's status and navigation bars). */
.session { display: flex; flex-direction: column; min-height: calc(100vh - 150px); min-height: calc(100dvh - var(--top) - var(--bottom) - 150px); }
/* Action buttons pinned above the phone's navigation bar (3-button or gesture), whatever its height. */
.actionbar {
  position: sticky; bottom: 0; z-index: 4; background: var(--paper);
  margin: 14px -16px calc(-24px - var(--bottom)); padding: 10px 16px calc(var(--bottom) + 12px);
}
.progress-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .85em; margin-bottom: 12px; }
.card {
  position: relative; flex: 1; min-height: 340px; border-radius: 18px; padding: 26px 20px 20px 46px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-strong) 1px, transparent 1px);
  background-size: 9px 9px, 9px 9px, 36px 36px; background-position: -1px -1px;
  border: 1px solid var(--grid-strong); box-shadow: 0 1px 0 var(--grid-strong), 0 10px 24px -18px rgba(40, 30, 120, .45);
  display: flex; flex-direction: column;
}
.card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 30px; width: 2px; background: color-mix(in srgb, var(--red) 55%, transparent); }
.card .tag { color: var(--ink-3); font-size: .8em; }
.card .word { font-size: 2.6em; font-weight: 700; color: var(--purple); line-height: 1.1; margin: 18px 0 6px; word-break: break-word; letter-spacing: -.01em; }
.card .pos { font-style: italic; color: var(--ink-2); }
.card .meaning { font-size: 1.15em; font-weight: 600; margin: 14px 0 6px; background: linear-gradient(transparent 58%, var(--mark) 58%); display: inline; }
.card .back { margin-top: 10px; }
.card .back p { margin: 8px 0; }
.card .hint { margin-top: auto; color: var(--ink-3); font-size: .85em; text-align: center; padding-top: 16px; }
.card.flip { animation: flip .22s ease-out; }
@keyframes flip { from { transform: rotateX(8deg); opacity: .6; } }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grade { min-height: 56px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet); font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.grade small { font-weight: 400; color: var(--ink-3); font-size: .72em; }
.grade.again { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); color: var(--red); }
.grade.good { border-color: color-mix(in srgb, var(--purple) 50%, var(--line)); color: var(--purple); }
.grade.easy { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); color: var(--green); }
.say { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--purple-soft); color: var(--purple); cursor: pointer; vertical-align: middle; flex: none; }
.say svg { width: 20px; height: 20px; }
.say.sm { width: 32px; height: 32px; }
.say.sm svg { width: 16px; height: 16px; }

/* ---------- word detail ---------- */
.wordhead { padding: 6px 0 4px; }
.wordhead .w { font-size: 2.1em; font-weight: 700; color: var(--purple); line-height: 1.15; letter-spacing: -.01em; }
.wordhead .m { font-size: 1.08em; font-weight: 600; margin-top: 8px; }
.ex { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; }
.ex + .ex { border-top: 1px dashed var(--grid-strong); }
.ex .tx { flex: 1; }
.ex p { margin: 0; }
.col { padding: 12px 0; }
.col + .col { border-top: 1px dashed var(--grid-strong); }
.col .c { font-weight: 600; color: var(--purple); }
.col .v { color: var(--ink-2); font-size: .9em; }
.col .ctx { margin-top: 4px; }
.ex .vi, .col .vi { margin: 3px 0 0; color: var(--ink-2); font-size: .9em; }
.col .ctx b { background: linear-gradient(transparent 60%, var(--mark) 60%); font-weight: 600; }
.sec-title { font-weight: 600; margin: 20px 0 4px; color: var(--ink-2); font-size: .9em; }
.nav2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

/* search */
.search { display: flex; align-items: center; gap: 8px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; }
.search input { flex: 1; border: 0; background: transparent; padding: 12px 0; outline: none; min-width: 0; }
.search svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }

/* quiz */
.q-prompt { font-size: 1.8em; font-weight: 700; color: var(--purple); margin: 8px 0 4px; word-break: break-word; }
.options { display: grid; gap: 10px; margin-top: 18px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet); cursor: pointer; min-height: 54px; }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); text-decoration: line-through; text-decoration-color: var(--red); }
.result-big { font-size: 3.2em; font-weight: 700; color: var(--purple); line-height: 1; }

/* ---------- grammar reader ---------- */
.lesson-head { padding: 4px 0 8px; }
.lesson-head .lv { color: var(--purple); font-weight: 600; font-size: .85em; }
.lesson-head h2 { margin: 4px 0; font-size: 1.4em; line-height: 1.3; }
.lesson-head .en { color: var(--ink-2); font-size: .9em; }
.goal { background: var(--green-soft); border-radius: 12px; padding: 12px 14px; font-size: .95em; }
.goal p { margin: 0; }
.goal p + p { margin-top: 6px; }
.reader h3 { font-size: 1.12em; margin: 26px 0 8px; line-height: 1.35; }
.reader p { margin: 10px 0; }
.tbl { overflow-x: auto; margin: 12px -16px; padding: 0 16px; }
.tbl table { border-collapse: collapse; font-size: .88em; min-width: 100%; background: var(--sheet); }
.tbl th { background: var(--purple); color: #fff; text-align: left; font-weight: 600; padding: 8px 10px; }
:root[data-theme="dark"] .tbl th { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tbl th { color: #14122B; } }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.exs { border-left: 3px solid var(--purple); padding: 4px 0 4px 14px; margin: 12px 0; }
.exs .e { padding: 6px 0; display: flex; gap: 10px; align-items: flex-start; }
.exs .e > div { flex: 1; }
.exs .en { color: var(--ink); }
.exs .vn { color: var(--ink-2); font-size: .9em; font-style: italic; }
.note { background: #FFF6DA; border-radius: 12px; padding: 12px 14px; margin: 12px 0; color: #3D3420; }
:root[data-theme="dark"] .note { background: #3A3218; color: #F1E6C2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note { background: #3A3218; color: #F1E6C2; } }
.note .t { font-weight: 600; font-size: .85em; margin-bottom: 2px; }
.mis { background: var(--red-soft); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.mis .t { font-weight: 600; font-size: .85em; color: var(--red); margin-bottom: 4px; }
.mis .m + .m { margin-top: 10px; padding-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--red) 35%, transparent); }
.mis .w { color: var(--red); text-decoration: line-through; }
.mis .r { color: var(--green); font-weight: 600; }
.mis .y { color: var(--ink-2); font-size: .9em; }
.summary { background: var(--purple); color: #fff; border-radius: 14px; padding: 14px 16px; margin: 22px 0; }
:root[data-theme="dark"] .summary { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .summary { color: #14122B; } }
.summary .t { font-weight: 700; margin-bottom: 6px; }
.summary ul { margin: 0; padding-left: 20px; }
.summary li + li { margin-top: 4px; }

/* exercises */
.exercise { margin: 22px 0; }
.exercise .inst { font-weight: 600; margin-bottom: 8px; }
.qa { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.qa .qt { margin-bottom: 8px; }
.qa .qt .n { color: var(--ink-3); margin-right: 6px; font-variant-numeric: tabular-nums; }
.qa textarea { width: 100%; resize: vertical; min-height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); padding: 10px 12px; }
.qa textarea:focus { border-color: var(--purple); outline: none; }
.qa .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qa .acts .btn { min-height: 40px; padding: 0 14px; font-size: .92em; }
.fb { margin-top: 10px; border-radius: 10px; padding: 10px 12px; font-size: .93em; }
.fb.ok { background: var(--green-soft); }
.fb.no { background: var(--red-soft); }
.fb .h { font-weight: 600; }
.fb.ok .h { color: var(--green); }
.fb.no .h { color: var(--red); }
.qa.done-ok { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.qa.done-no { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.scorebox { text-align: center; padding: 18px; }

/* settings */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--paper); border-radius: 10px; padding: 4px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 8px 4px; cursor: pointer; font-size: .9em; }
.seg button.on { background: var(--purple); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .seg button.on { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { color: #14122B; } }
.setting { padding: 14px 16px; }
.setting .lbl { font-weight: 500; margin-bottom: 8px; }
input[type=range] { width: 100%; accent-color: var(--purple); }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 1.1em; margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.list a > svg, .list .li > svg { width: 22px; height: 22px; flex: none; color: var(--ink-2); }

/* ---------- where today's new words come from ---------- */
.today .from { margin-top: 12px; font-size: .85em; color: var(--ink-2); }
.today .from a { color: var(--purple); font-weight: 600; }

/* ---------- the mascot talking: mood picture + speech bubble ---------- */
.buddy { display: flex; align-items: center; gap: 12px; margin: 14px 0; text-align: left; }
.buddy-pic { width: 72px; height: 72px; flex: none; border-radius: 50%; background: var(--purple-soft); animation: pop .35s ease-out; }
.buddy-pic svg, .toast-pic svg, .fb-pic svg { width: 100%; height: 100%; display: block; }
.bubble { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.bubble::before { content: ""; position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; background: var(--sheet); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.buddy.sm { margin: 10px 0; }
.buddy.sm .buddy-pic { width: 52px; height: 52px; }
.buddy.sm .bubble { font-size: .9em; padding: 8px 12px; }
.buddy.big { flex-direction: column; text-align: center; margin: 8px 0 14px; }
.buddy.big .buddy-pic { width: 132px; height: 132px; }
.buddy.big .bubble::before { left: 50%; top: -7px; transform: translateX(-50%) rotate(135deg); }
.today .buddy .bubble { background: var(--paper); }
.today .buddy .bubble::before { background: var(--paper); }
.fb .h { display: flex; align-items: center; gap: 8px; }
.fb-pic { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--sheet); }
.toast { display: flex; align-items: center; gap: 10px; }
.toast-pic { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--purple-soft); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .buddy-pic { animation: none; } }

/* ---------- confirm box with the mascot ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20, 18, 43, .55); display: flex; align-items: center; justify-content: center;
  padding: calc(var(--top) + 16px) calc(var(--right) + 16px) calc(var(--bottom) + 16px) calc(var(--left) + 16px); animation: toast .15s ease-out; }
.modal { background: var(--paper); border-radius: 22px; padding: 18px 18px 16px; width: 100%; max-width: 420px; text-align: center; }
.modal p { margin: 4px 0 16px; }
.btn.danger { background: var(--red); border-color: var(--red); }

/* ---------- the mascot's line on the flashcard screen: reserved space, so it never covers the card ---------- */
.cue { height: max(66px, 3.6em); display: flex; align-items: center; margin-bottom: 8px; transition: opacity .3s; }
.cue .bt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }   /* at most 2 lines, then "…" */
.cue .buddy { margin: 0; }
.cue.fading { opacity: 0; }

/* ---------- Lời cảm ơn ---------- */
.thanks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.thanks li { background: var(--purple-soft); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: .92em; overflow-wrap: anywhere; }
.thanks-v { margin-bottom: 10px; }
.thanks-v ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Cây thử thách: the tree of steps, a question, a fall ------------------------------------------- */
.cl-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86em; color: var(--ink-2); margin: 10px 0 6px; }
.cl-stats b { color: var(--purple); }
.cl-tree { margin: 10px 0 20px; }
.cl-more { color: var(--ink-3); font-size: .85em; margin: 0 0 8px 48px; }
.cl-node.done .cl-dot svg { width: 18px; height: 18px; }
.cl-stage { font-size: .78em; font-weight: 700; letter-spacing: .04em; color: var(--ink-3); margin: 14px 0 6px; display: flex; align-items: center; gap: 6px; }
.cl-stage.won { color: var(--slogan); }
.cl-stage svg { width: 16px; height: 16px; }
.cl-node { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.cl-node b { font-weight: 600; display: block; }
.cl-node small { color: var(--ink-3); }
.cl-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82em; flex: none; }
.cl-node.done .cl-dot { background: var(--green); color: #fff; }
.cl-node.now .cl-dot { background: var(--purple); color: var(--sheet); box-shadow: 0 0 0 5px var(--purple-soft); }
.cl-node.lock .cl-dot { border: 2px dashed var(--grid-strong); color: var(--ink-3); }
.cl-card { flex: none; min-height: 0; padding: 18px 16px 18px 44px; text-align: left; }
.cl-card .tag { margin-bottom: 8px; }
.cl-word { font-size: 1.9em; font-weight: 700; color: var(--purple); line-height: 1.2; overflow-wrap: anywhere; }
.cl-mean { font-size: 1.2em; font-weight: 600; margin-top: 4px; }
.cl-hint { color: var(--ink-2); margin-top: 6px; letter-spacing: .04em; }
.cl-ipa { font-family: "IPA", "BVP", sans-serif; font-size: 1.7em; color: var(--purple); }
.cl-listen { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.cl-spk { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--purple); color: var(--sheet); display: grid; place-items: center; cursor: pointer; }
.cl-spk svg { width: 30px; height: 30px; }
.cl-lbl { font-weight: 600; color: var(--ink-2); font-size: .9em; margin: 16px 0 8px; }
.cl-opts { display: grid; gap: 8px; }
.cl-opts.pos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.cl-opt { text-align: left; border: 1.5px solid var(--line); background: var(--sheet); color: var(--ink); border-radius: 10px; padding: 11px 12px; font: inherit; cursor: pointer; }
.cl-opt.on { border-color: var(--purple); background: var(--purple-soft); font-weight: 600; }
.cl-opt b { color: var(--purple); margin-right: 4px; }
.cl-input { width: 100%; font: inherit; font-size: 1.2em; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--purple); background: var(--sheet); color: var(--ink); }
.cl-slots { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 48px; padding: 6px 4px; border-bottom: 2px solid var(--line); font-family: "IPA", "BVP", sans-serif; font-size: 1.3em; }
.cl-sl { color: var(--ink-3); }
.cl-sound { border: 0; background: var(--purple-soft); color: var(--ink); border-radius: 6px; padding: 2px 8px; font: inherit; cursor: pointer; }
.cl-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cl-tile { min-width: 46px; min-height: 44px; border: 1.5px solid var(--grid-strong); background: var(--sheet); color: var(--ink); border-radius: 10px; font-family: "IPA", "BVP", sans-serif; font-size: 1.25em; cursor: pointer; }
.cl-tile:disabled { opacity: .3; cursor: default; }
.cl-tile.undo { margin-left: auto; font-family: inherit; color: var(--ink-2); }
.cl-fall .buddy { background: var(--red-soft); border-radius: var(--radius-card); padding: 12px; }
.cl-ans { flex: none; min-height: 0; margin: 12px 0; padding: 14px 16px 14px 44px; display: grid; gap: 6px; }
.cl-ans .cl-word { font-size: 1.6em; }
.cl-yours { color: var(--red); font-size: .92em; }
.cl-keep { display: flex; align-items: center; gap: 8px; background: var(--green-soft); color: var(--green); border-radius: 12px; padding: 10px 12px; }
.cl-keep svg { width: 18px; height: 18px; flex: none; }
.climb .actionbar .btn, .cl-fall ~ .actionbar .btn { min-height: 48px; }

/* ---------- phước levels: card with progress, level badges, level-up fireworks ---------- */
.phuoc-card { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: inherit;
  background: var(--sheet); border: 1.5px solid color-mix(in srgb, var(--slogan) 35%, var(--line)); }
.phuoc-card:active { background: var(--purple-soft); }
.phuoc-card .bar { margin: 6px 0 4px; height: 8px; border-radius: 4px; }
.phuoc-card .bar > i { background: linear-gradient(90deg, #FF8FAB, var(--slogan)); }
.phuoc-card .li-sub b { color: var(--slogan); }
.lv-badge { position: relative; width: 50px; height: 50px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #FFE6EE, #FFB3C7); color: #C2185B; }
.lv-badge svg { width: 30px; height: 30px; }
.lv-badge b { position: absolute; right: -4px; bottom: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--slogan); color: #fff;
  font-size: 12px; line-height: 22px; text-align: center; border: 2px solid var(--sheet); }
.lv-badge.sm { width: 38px; height: 38px; }
.lv-badge.sm svg { width: 22px; height: 22px; }
.levels .lv-todo .lv-badge { filter: grayscale(1); opacity: .45; }
.levels .lv-todo .li-title { color: var(--ink-3); }
.levels .lv-now { background: color-mix(in srgb, var(--slogan) 10%, transparent); }
.earn { color: var(--slogan); white-space: nowrap; }

.levelup { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(12, 10, 32, .78);
  padding: calc(var(--top) + 16px) calc(var(--right) + 16px) calc(var(--bottom) + 16px) calc(var(--left) + 16px); animation: toast .2s ease-out; }
.levelup canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.levelup-card { position: relative; background: var(--paper); border-radius: 24px; padding: 18px 18px 16px; width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--slogan) 55%, transparent), 0 20px 50px rgba(0, 0, 0, .4); animation: lvpop .45s cubic-bezier(.2, 1.4, .4, 1); }
.levelup.big .levelup-card { box-shadow: 0 0 0 4px #FFD24D, 0 0 40px rgba(255, 210, 77, .55), 0 20px 50px rgba(0, 0, 0, .4); }
.levelup-card .lv-title { font-size: 1.6em; font-weight: 800; color: var(--slogan); letter-spacing: -.01em; }
.levelup-card p { margin: 0 0 14px; }
@keyframes lvpop { from { transform: scale(.5); opacity: 0; } }
/* ---------- topic sub-tabs, reading, speaking ---------- */
.subtabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 2px 0 14px; }
.subtabs a { text-align: center; padding: 9px 4px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .92em; }
.subtabs a.on { background: var(--purple); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .subtabs a.on { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .subtabs a.on { color: #14122B; } }
.reading .r-title { font-size: 1.45em; line-height: 1.25; margin: 6px 0 2px; color: var(--purple); letter-spacing: -.01em; }
.reading .r-title-vn { color: var(--ink-2); font-style: italic; }
.r-tools { display: flex; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }
.r-tools .btn { min-height: 40px; padding: 0 14px; font-size: .9em; }
.para { padding: 10px 0 12px; border-bottom: 1px dashed var(--grid-strong); scroll-margin: 90px; }
.para .en { margin: 0; font-size: 1.04em; line-height: 1.7; }
.para.now .en { background: linear-gradient(transparent 0, var(--purple-soft) 0); border-radius: 6px; }
.para .vn, .answer .vn { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--paper); border-left: 3px solid var(--grid-strong); color: var(--ink-2); font-size: .94em; line-height: 1.6; }
button.v { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--purple); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 6px 0 0; color: var(--purple); font: inherit; font-size: .88em; cursor: pointer; font-weight: 500; }
.tip { background: var(--purple-soft); border-color: transparent; margin-bottom: 14px; }
.qcard { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; }
.q-en { font-size: 1.12em; font-weight: 600; margin: 10px 0 4px; line-height: 1.4; }
.q-vn { color: var(--ink-2); font-size: .9em; margin: 0 0 12px; font-style: italic; }
.answer { border-top: 1px dashed var(--grid-strong); padding-top: 10px; }
.answer p { margin: 6px 0; line-height: 1.65; }
.lvchip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 600; }
.lvchip.lv1 { background: var(--green-soft); color: var(--green); }
.lvchip.lv2 { background: var(--purple-soft); color: var(--purple); }
.lvchip.lv3 { background: var(--red-soft); color: var(--red); }
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 18, 43, .4); z-index: 40; animation: toast .15s ease-out; }
.sheet-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--sheet); border-radius: 18px 18px 0 0; padding: 18px 16px calc(var(--bottom) + 18px); max-width: 720px; margin: 0 auto; box-shadow: 0 -10px 30px rgba(20, 18, 43, .2); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.sheet-panel .sw { font-size: 1.7em; font-weight: 700; color: var(--purple); line-height: 1.2; }
.sm-meaning { font-weight: 600; margin: 10px 0 4px; }

/* ---------- glossary: all words A–Z ---------- */
.letters { position: sticky; top: var(--tb, calc(var(--top) + 64px)); z-index: 4; display: flex; gap: 4px; overflow-x: auto; margin: 10px -16px 0; padding: 8px 16px;
  background: var(--paper); scrollbar-width: none; }
.letters::-webkit-scrollbar { display: none; }
.letters button { flex: none; min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--sheet); color: var(--purple); font-weight: 700; cursor: pointer; }
.letters button:disabled { opacity: .3; cursor: default; }
.gl-group { scroll-margin-top: calc(var(--tb, calc(var(--top) + 64px)) + 56px); }
.gl-letter { font-weight: 800; font-size: 1.3em; color: var(--purple); margin: 16px 0 6px; }
.list .gl { padding: 0; gap: 0; position: relative; }
.list .gl-open { flex: 1; min-width: 0; display: block; padding: 12px 16px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.list .gl-open:active { background: var(--purple-soft); }
.gl-l1 { min-height: 32px; display: flex; align-items: center; gap: 8px; padding-right: 84px; }
.gl-compact .gl-l1 { font-weight: 700; }
.gl-classic .gl-l1 { display: block; padding-top: 4px; }
.gl-classic .gl-l1 .tick { display: inline-block; vertical-align: -3px; margin-left: 6px; }
.gl-classic .gl-m { display: block; padding-right: 8px; }
.gl-view { display: flex; align-items: center; gap: 12px; }
.gl-view #gl-count { flex: 1; }
.gl-seg { flex: none; grid-auto-columns: 44px; }
.gl-seg button { display: grid; place-items: center; padding: 4px; min-height: 36px; color: var(--ink-2); }
.gl-seg button svg { width: 26px; height: 26px; }
.gl-l1 .gl-p { font-weight: 400; font-size: .86em; color: var(--ink-3); }
.gl-l1 .tick { width: 18px; height: 18px; }
.gl-l2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-top: 2px; }
.gl-l2 .ipa { font-size: .9em; }
.gl-l2 .gl-m { margin-left: auto; text-align: right; color: var(--ink); font-size: .95em; }
.gl-act { position: absolute; top: 6px; right: 6px; display: flex; align-items: center; gap: 2px; }
.favbtn { color: var(--ink-3); }
.favbtn.on { color: var(--purple); }
.gl-star { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.gl-star svg { width: 24px; height: 24px; }
.gl-star:active { background: var(--purple-soft); }
.list .gl[hidden] { display: none; }
.list .gl + .gl { border-top: 1px solid var(--line); }

/* ---------- pronunciation ---------- */
.snd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.snd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--sheet); cursor: pointer; font: inherit; color: inherit; }
.snd:active { background: var(--purple-soft); }
.snd .sym { font-size: 1.25em; font-weight: 700; color: var(--purple); }
.snd .w { font-size: .8em; color: var(--ink-2); }
.pex { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.pex + .pex { border-top: 1px dashed var(--grid-strong); }
.sheet.rule { margin: 10px 0; }
.sheet.rule p { margin: 0 0 8px; }
.end-card { border-radius: 14px; padding: 14px; margin: 12px 0; background: var(--sheet); border: 1.5px solid var(--line); border-left-width: 6px; }
.end-card.e0 { border-left-color: var(--red); }
.end-card.e1 { border-left-color: var(--purple); }
.end-card.e2 { border-left-color: var(--green); }
.end-card p { margin: 6px 0; }
.end-h { font-weight: 700; display: flex; align-items: baseline; gap: 10px; }
.end-h .ipa { font-size: 1.35em; color: var(--purple); font-weight: 700; }
.end-card .mn { background: var(--purple-soft); border-radius: 8px; padding: 6px 10px; font-size: .92em; }
.end-ex { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.say-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.say-chip svg { width: 16px; height: 16px; color: var(--purple); }
.tip-h { font-weight: 700; display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.bad { color: var(--red); font-weight: 600; }
.good { color: var(--green); font-weight: 600; }
.why { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; line-height: 1.7; }
.why .say { margin-left: 6px; }
.q-prompt.ipa { font-family: "IPA", "BVP", sans-serif; }
.btn svg { width: 18px; height: 18px; }
.sylls { display: inline-flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.syl { display: inline-block; border-radius: 8px; padding: 2px 8px; }
.syl.l2 { background: var(--purple); color: #fff; font-weight: 800; font-size: 1.15em; }
:root[data-theme="dark"] .syl.l2 { color: #14122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .syl.l2 { color: #14122B; } }
.syl.l1 { background: var(--purple-soft); color: var(--purple); font-weight: 700; }
.syl.l0 { color: var(--ink-2); font-size: .9em; }
s.silent { color: var(--red); text-decoration-thickness: 2px; }
.q-prompt u { text-decoration-color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.list a.off { opacity: .55; pointer-events: none; }
.snd { position: relative; }
.snd .rec-mark { position: absolute; top: 4px; right: 5px; width: 14px; height: 14px; color: var(--purple); opacity: .75; }
.snd .rec-mark svg { width: 14px; height: 14px; }
.inline-ic { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.18em; color: var(--purple); }
.inline-ic svg { width: 100%; height: 100%; display: block; }

/* Việc hôm nay: today's to-do list on the home page */
.todo-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; margin: 6px 0 16px; }
.todo-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 16px 6px; }
.todo-head b { font-size: 1.05em; }
.todo, .road-link { display: flex; align-items: center; gap: 12px; padding: 10px 16px; text-decoration: none; color: inherit; }
.todo:active, .road-link:active { background: var(--purple-soft); }
.todo-n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9em;
  background: var(--purple-soft); color: var(--purple); }
.todo-n svg { width: 18px; height: 18px; }
.todo.done .todo-n { background: var(--green-soft); color: var(--green); }
.todo.done .li-title { color: var(--ink-3); text-decoration: line-through; }
.road-link { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--purple-soft) 55%, transparent); }
.road-link > svg { width: 22px; height: 22px; flex: none; color: var(--purple); }
.road-link .li-title { font-weight: 600; color: var(--purple); }
.next-step { margin-top: 4px; }

/* Con đường học: stages and the winding path of stations */
.road-top { margin-bottom: 14px; }
.road-top .rt-title { font-weight: 700; font-size: 1.15em; margin: 2px 0 10px; }
.road-top .bar { height: 10px; border-radius: 5px; margin-bottom: 6px; }
.road-top .bar > i { background: linear-gradient(90deg, var(--purple), #FF8FA3); border-radius: 5px; }
.stage { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--sheet); margin-bottom: 10px; overflow: hidden;
  border-left: 6px solid var(--sc); }
.stage-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; cursor: pointer; }
.stage-head:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.stage-no { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #1E1B3A;
  background: var(--sc); }
.stage-no svg { width: 20px; height: 20px; }
.stage .pct { font-weight: 700; color: var(--ink-2); font-size: .9em; }
.stage .chev { display: grid; place-items: center; width: 24px; height: 24px; color: var(--ink-3); transform: rotate(90deg); transition: transform .2s; }
.stage .chev svg { width: 20px; height: 20px; }
.stage.open .chev { transform: rotate(-90deg); color: var(--ink-2); }
.stage.open .stage-head { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sc) 14%, var(--sheet)); }
.stage-fold { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 12px; text-align: center; font-weight: 600; font-size: .9em;
  color: var(--purple); border-top: 1px solid var(--line); cursor: pointer; }
.stage-fold:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.stage.open { background: linear-gradient(180deg, var(--sheet), color-mix(in srgb, var(--sc) 10%, var(--sheet))); }
.road-path { position: relative; margin: 40px 4px 0; }
.road-path > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.road-path > svg path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rp-todo { stroke: var(--grid-strong); stroke-width: 10; stroke-dasharray: 2 16; }
.rp-done { stroke: var(--sc); stroke-width: 10; }
.node { position: absolute; transform: translateX(-50%); display: block; width: 58px; height: 58px;
  text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.node.test { width: 66px; }
.node .dot { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--sheet); color: var(--ink-3);
  border: 3px solid var(--grid-strong); box-shadow: 0 4px 0 var(--grid-strong); transition: transform .15s; }
.node .dot svg { width: 26px; height: 26px; }
.node:active .dot { transform: translateY(3px); box-shadow: 0 1px 0 var(--grid-strong); }
.node.done .dot { background: var(--sc); border-color: var(--sc); color: #1E1B3A; box-shadow: 0 4px 0 color-mix(in srgb, var(--sc) 60%, #000); }
.node.now .dot { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--purple) 60%, #000);
  animation: nodepulse 1.8s ease-in-out infinite; }
.node.test .dot { width: 66px; height: 66px; border-radius: 18px; }
.node .lbl { position: absolute; top: 50%; transform: translateY(-50%); width: 132px; font-size: .74em; line-height: 1.25; padding: 4px 8px;
  border-radius: 10px; background: color-mix(in srgb, var(--sheet) 88%, transparent); }
.node.lbl-r .lbl { left: calc(100% + 8px); text-align: left; }
.node.lbl-l .lbl { right: calc(100% + 8px); text-align: right; }
.node .lbl b { display: block; font-weight: 600; }
.node .lbl span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.node.now .lbl b { color: var(--purple); }
@keyframes nodepulse { 0%, 100% { outline: 0 solid color-mix(in srgb, var(--purple) 35%, transparent); } 50% { outline: 9px solid color-mix(in srgb, var(--purple) 18%, transparent); } }
.road-cat { position: absolute; z-index: 1; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; pointer-events: none; animation: float 2.4s ease-in-out infinite; }
.road-cat .buddy-pic { width: 54px; height: 54px; overflow: hidden; }
.road-cat .bt { font-size: .72em; font-weight: 600; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.node .lbl .need { display: block; margin-top: 3px; font-style: normal; font-weight: 600; color: var(--purple); }
.stage-tip { display: flex; gap: 8px; align-items: flex-start; margin: 4px 14px 14px; font-size: .85em; color: var(--ink-2); }
.stage-tip svg { width: 20px; height: 20px; flex: none; color: var(--slogan); }
.run-qa textarea { width: 100%; }
@media (prefers-reduced-motion: reduce) { .node.now .dot, .road-cat { animation: none; } }
.page-foot { margin-top: 10px; }
.page-foot .btn { gap: 6px; }
.node.flash .dot { animation: nodeflash 1.2s ease-out 2; }
@keyframes nodeflash { 0% { outline: 0 solid color-mix(in srgb, var(--sc) 70%, transparent); } 60% { outline: 14px solid color-mix(in srgb, var(--sc) 0%, transparent); } }
/* flashcards: the same space above and below the cat's line */
.session .progress-line { margin-bottom: 8px; }
/* voice picker */
.setting-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: inherit; }
.setting-link > svg { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.list .voice { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.list .voice > svg { width: 22px; height: 22px; flex: none; color: var(--purple); }
.list .voice.on { background: var(--purple-soft); }
.list .voice .li-sub { word-break: break-all; }
/* downloadable recordings */
.pack-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 10px 0 4px; border: 1px dashed var(--grid-strong); border-radius: var(--radius-ctl); }
.pack-bar > svg { width: 22px; height: 22px; flex: none; color: var(--purple); }
.pack-bar.on { border-style: solid; border-color: var(--line); background: var(--green-soft); }
.pack-bar.on > svg { color: var(--green); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9em; }
.spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 3px solid var(--purple-soft); border-top-color: var(--purple); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list .li .btn.sm { flex: none; }
/* backup reminder on the home page */
.nudge { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 4px 14px 14px; margin: 0 0 16px; }
