:root {
  --font-serif: "Instrument Serif", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-hanzi: "Noto Serif SC", "Instrument Serif", SimSun, "Songti SC", serif;

  /* Warm Tactile Palette (Lab Manual & Library Index Card) */
  --ink: #191919;
  --muted: #6E6A64;
  --line: #1A1A1A;
  --paper: #FAF8F5;
  --page: #F2EFE9;
  --subtle-grid: radial-gradient(#D4D0C8 1.1px, transparent 1.1px);
  --paper-hover: #EFE8D8;

  /* Status Colors: Moss Green, Brick Red, Earth Yellow */
  --moss-green: #2E6F40;
  --brick-red: #C84B31;
  --earth-yellow: #D99B26;

  --tiffany: #2E6F40;
  --tiffany-light: #489A5E;
  --teal: #2E6F40;
  --teal-dark: #1e4b2b;
  --teal-soft: #EFECE6;
  --amber: #D99B26;
  --amber-dark: #b37e1b;
  --amber-soft: #F5EEDB;

  /* Strict Mechanical Shadows (no blur) */
  --shadow: 4px 4px 0px #1A1A1A;
  --shadow-hover: 6px 6px 0px #1A1A1A;
  --shadow-btn: 2px 2px 0px #1A1A1A;
  --shadow-active: 0px 0px 0px #1A1A1A;

  /* De-AI-ify radius */
  --radius-none: 0px;
  --radius-xs: 2px;
}

:root[data-theme="dark"] {
  --ink: #FAF8F5;
  --muted: #A39E93;
  --line: #3D3B37;
  --paper: #21201D;
  --page: #161514;
  --subtle-grid: radial-gradient(#2F2D2A 1.1px, transparent 1.1px);
  --paper-hover: #2B2A26;

  --moss-green: #489A5E;
  --brick-red: #E05D43;
  --earth-yellow: #E5AD3F;

  --tiffany: #489A5E;
  --tiffany-light: #68B67B;
  --teal: #489A5E;
  --teal-dark: #357345;
  --teal-soft: #282723;
  --amber: #E5AD3F;
  --amber-dark: #b88628;
  --amber-soft: #2C2820;

  --shadow: 4px 4px 0px #000000;
  --shadow-hover: 6px 6px 0px #000000;
  --shadow-btn: 2px 2px 0px #000000;
  --shadow-active: 0px 0px 0px #000000;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--page);
  background-image: var(--subtle-grid);
  background-size: 20px 20px;
  background-attachment: fixed;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

/* Ẩn thanh trang chủ và nút Dynamic Island khi đang tải dữ liệu */
body.is-loading .topbar,
body.is-loading #islandDock,
body:has(#splashPreloader:not(.fade-out)) .topbar,
body:has(#splashPreloader:not(.fade-out)) #islandDock,
body:has(.loading-panel) .topbar,
body:has(.loading-panel) #islandDock {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 10px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 2px 0px var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
  flex: 0 0 48px;
  text-decoration: none;
}
.brand-mark .x-loader-wrapper {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  transform: scale(0.34);
  transform-origin: center center;
  pointer-events: none;
}
.brand-mark .bubble,
.brand-mark .bubble1,
.brand-mark .bubble2,
.brand-mark .bubble3,
.brand-mark .bubble4 {
  width: 22px;
  height: 22px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.85);
}
:root[data-theme="dark"] .brand-mark {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; font-weight: 700; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10.5px; font-family: var(--font-mono); }
nav { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
nav a { text-decoration: none; }
.nav-button { border: 1px solid var(--line); color: var(--ink); background: var(--paper); cursor: pointer; font-weight: 700; font-family: var(--font-mono); }
.nav-button { padding: 6px 10px; border-radius: 0px; box-shadow: var(--shadow-btn); transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.1s ease; }
.nav-button:hover { color: var(--ink); background: var(--paper-hover); }
.nav-button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.nav-button span { display: inline-grid; min-width: 20px; height: 20px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: #ffffff; background: #191919; font-size: 11px; font-family: var(--font-mono); }
:root[data-theme="dark"] .nav-button span { color: #191919; background: #fafafa; }
.room-nav.active { color: var(--ink); background: var(--paper-hover); }
.user-nav { display: flex; align-items: center; gap: 8px; padding-left: 14px; border-left: 1px solid var(--line); }
.user-nav strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.user-nav button, .text-button { padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; font-family: var(--font-mono); }
.user-nav button:hover, .text-button:hover { color: var(--ink); }

.app-shell { width: min(1180px, calc(100% - 32px)); min-height: calc(100vh - 135px); margin: 0 auto; padding: 24px 0 64px; }
.app-shell > * { animation: page-enter .38s cubic-bezier(.2,.75,.3,1) both; }
.hero {
  position: relative;
  overflow: hidden;
  padding: 32px 36px;
  border-radius: 0px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero::after { display: none !important; }
.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); }
.hero h1 { position: relative; z-index: 1; max-width: 720px; margin: 0; font-family: var(--font-serif); font-size: clamp(30px, 4vw, 46px); line-height: 1.15; color: var(--ink); font-weight: 400; }
.hero p { position: relative; z-index: 1; max-width: 680px; margin: 12px 0 0; color: var(--muted); line-height: 1.65; }
.metric-row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.metric { padding: 8px 12px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.metric strong { margin-right: 4px; font-size: 16px; color: var(--ink); }
.study-room-bar { position: sticky; top: 64px; z-index: 19; padding: 8px max(18px, calc((100vw - 1180px) / 2)); color: var(--ink); background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 2px 0px var(--line); font-size: 11px; font-family: var(--font-mono); }
.study-room-bar, .study-room-bar > div { align-items: center; justify-content: space-between; gap: 10px; }
.study-room-bar:not([hidden]), .study-room-bar > div { display: flex; }
.study-room-bar > div > span:not(.room-live-dot) { color: var(--muted); }
.study-room-bar button { padding: 4px 8px; border: 1px solid var(--line); border-radius: 0px; box-shadow: var(--shadow-btn); color: var(--ink); background: var(--paper); cursor: pointer; font-size: 10px; font-weight: 800; font-family: var(--font-mono); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.study-room-bar button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.room-live-dot { width: 8px; height: 8px; border-radius: 0px; background: #a1a1aa; border: 1px solid var(--line); }
.room-live-dot.online { background: var(--moss-green); }
.room-callout { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.room-callout > div { display: flex; align-items: center; gap: 13px; }
.room-callout-icon { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: white; background: #191919; font: 700 20px var(--font-hanzi); }
:root[data-theme="dark"] .room-callout-icon { background: #fafafa; color: #191919; }
.room-callout p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.review-callout { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.review-callout p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.daily-leaderboard { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.daily-leaderboard-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.daily-leaderboard-head .eyebrow { color: var(--muted); }
.daily-leaderboard-head h2 { margin: 0; font-family: var(--font-serif); font-size: 24px; color: var(--ink); font-weight: 400; }
.daily-leaderboard-head > span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; font-family: var(--font-mono); }
.daily-ranking { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.daily-rank-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.daily-rank-card.rank-1 { border-color: var(--line); background: var(--paper-hover); }
.daily-rank-card.is-you { outline: 2px solid var(--line); }
.daily-rank-number { position: absolute; top: -7px; left: -6px; display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: var(--paper); background: var(--ink); font-size: 10px; font-weight: 800; font-family: var(--font-mono); }
:root[data-theme="dark"] .daily-rank-number { color: #191919; background: #fafafa; }
.daily-rank-avatar { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--paper); background: var(--ink); font-size: 14px; font-weight: 800; }
:root[data-theme="dark"] .daily-rank-avatar { color: #191919; background: #fafafa; }
.daily-rank-card div { min-width: 0; }
.daily-rank-card strong, .daily-rank-card div small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-rank-card strong { font-size: 11px; color: var(--ink); }
.daily-rank-card div small { margin-top: 4px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.daily-rank-card > b { color: var(--ink); font-size: 18px; text-align: right; font-family: var(--font-mono); }
.daily-rank-card > b small { display: block; color: var(--muted); font-size: 8px; font-weight: 700; }
.daily-ranking-empty { display: flex; align-items: center; justify-content: center; gap: 13px; min-height: 76px; border: 1px dashed var(--line); border-radius: 0px; color: var(--muted); background: var(--paper); }
.daily-ranking-empty > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--paper); background: var(--ink); font: 700 18px var(--font-hanzi); }
:root[data-theme="dark"] .daily-ranking-empty > span { color: #191919; background: #fafafa; }
.daily-ranking-empty strong { color: var(--ink); font-size: 11px; }
.daily-ranking-empty p { margin: 4px 0 0; font-size: 9px; }
.home-search-panel { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(320px, 1.25fr); align-items: center; gap: 24px; margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.home-search-panel h2, .home-search-panel p { margin: 0; }
.home-search-panel h2 { font-family: var(--font-serif); font-size: 24px; color: var(--ink); font-weight: 400; }
.home-search-panel p:not(.eyebrow) { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.home-search-panel .eyebrow { color: var(--muted); }
.search-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 120px; margin-top: 18px; color: var(--muted); }
.search-loading .x-loader-wrapper { transform: scale(0.42); }
.search-loading .loader { width: 25px; height: 25px; }

.section-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-family: var(--font-serif); font-size: 24px; color: var(--ink); font-weight: 400; }
.section-title p { margin: 0; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 18px; }
.set-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 230px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform .05s ease, box-shadow .05s ease;
}
.set-card:hover { border-color: var(--line); transform: translate(-1px, -1px); box-shadow: var(--shadow-hover); }
.set-card > .tag { align-self: flex-start; }
.set-card.coming-soon { border-style: dashed; }
.set-card.coming-soon > .tag { color: var(--muted); background: var(--teal-soft); }
.set-card > .primary-link { align-self: flex-start; margin-top: auto; }
.set-card::after { display: none !important; }
.set-card h3, .set-card p, .set-card .set-stats, .set-card a { position: relative; z-index: 1; }
.set-card h3 { margin: 8px 0 9px; font-family: var(--font-serif); font-size: 24px; color: var(--ink); font-weight: 400; }
.set-card p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tag { display: inline-flex; padding: 4px 10px; border-radius: 0px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; }
.set-stats { display: flex; gap: 18px; margin: 18px 0; }
.set-stats strong, .set-stats span { display: block; }
.set-stats strong { font-size: 18px; color: var(--ink); font-family: var(--font-mono); }
.set-stats span { color: var(--muted); font-size: 10.5px; font-family: var(--font-mono); }
.primary-link, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 0px;
  color: #FAF8F5;
  background: #191919;
  box-shadow: var(--shadow-btn);
  text-decoration: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform .05s ease, background .1s ease, box-shadow .05s ease;
}
.primary-link:hover, .primary-button:hover {
  background: var(--moss-green);
  border-color: var(--line);
  color: #FAF8F5;
  box-shadow: var(--shadow-btn);
}
.primary-link:active, .primary-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}
:root[data-theme="dark"] .primary-link,
:root[data-theme="dark"] .primary-button {
  border-color: var(--line);
  color: #191919;
  background: #FAF8F5;
  box-shadow: var(--shadow-btn);
}
:root[data-theme="dark"] .primary-link:hover,
:root[data-theme="dark"] .primary-button:hover {
  background: #68B67B;
  border-color: var(--line);
  color: #191919;
}
:root[data-theme="dark"] .primary-link:active,
:root[data-theme="dark"] .primary-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}
.teal {
  --card-accent: var(--teal);
  --card-soft: var(--teal-soft);
}
.amber {
  --card-accent: var(--amber);
  --card-soft: var(--amber-soft);
}
.coral {
  --card-accent: #e11d48;
  --card-soft: #ffe4e6;
}

.page-banner { position: relative; overflow: hidden; padding: 27px 30px; border-radius: 0px; border: 1px solid var(--line); color: #fafafa; background: #191919; box-shadow: var(--shadow); }
.page-banner::after { content: attr(data-glyph); position: absolute; right: 24px; top: 50%; transform: translateY(-53%); opacity: .06; font: 700 135px var(--font-hanzi); }
.page-banner h1 { position: relative; z-index: 1; margin: 4px 0 7px; font-family: var(--font-serif); font-size: 32px; font-weight: 400; }
.page-banner p { position: relative; z-index: 1; max-width: 740px; margin: 0; color: #a1a1aa; font-size: 12.5px; line-height: 1.6; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.breadcrumb a { color: var(--ink); text-decoration: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0; }
.search-box { flex: 1; min-width: 230px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 0px; outline: 0; background: var(--paper); font-family: var(--font-sans); box-shadow: inset 1px 1px 0px rgba(0,0,0,.08); }
.search-box:focus { border-color: var(--line); outline: 2px solid var(--line); }
.secondary-button { min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font-size: 12px; font-weight: 700; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; transition: transform .05s ease, background .1s ease, box-shadow .05s ease; }
.secondary-button:hover { background: var(--paper-hover); }
.secondary-button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.toolbar a.secondary-button { display: inline-flex; align-items: center; text-decoration: none; }

.auth-layout { display: grid; grid-template-columns: 1.12fr .88fr; min-height: 590px; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: 6px 6px 0px var(--line); }
.auth-story { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 7vw, 76px); color: #fafafa; background: #191919; border-right: 1px solid var(--line); }
.auth-story h1 { max-width: 590px; margin: 4px 0 18px; font-family: var(--font-serif); font-size: clamp(34px, 5vw, 56px); line-height: 1.08; font-weight: 400; }
.auth-story > p:not(.eyebrow) { max-width: 590px; color: #a1a1aa; line-height: 1.75; }
.method-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.method-strip span { padding: 9px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 0px; background: rgba(255,255,255,.05); font-size: 11px; font-family: var(--font-mono); }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(30px, 6vw, 68px); background: var(--paper); }
.auth-card .eyebrow { color: var(--muted); }
.auth-card h2 { margin: 2px 0 23px; font-family: var(--font-serif); font-size: 30px; font-weight: 400; }
.auth-card label { display: grid; gap: 7px; margin-bottom: 15px; font-size: 11px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.auth-card input, .write-form input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 0px; outline: none; background: var(--paper); font-family: var(--font-sans); }
.auth-card input:focus, .write-form input:focus { border-color: var(--line); outline: 2px solid var(--line); }
.auth-card .primary-button { width: 100%; }
.auth-card .text-button { margin: 18px auto 14px; color: var(--ink); font-family: var(--font-mono); }
.auth-help-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 8px; width: 100%; margin-top: 13px; }
.auth-help-links.single { grid-template-columns: 1fr; }
.auth-card .auth-help-links .text-button { width: 100%; margin: 0; padding: 6px 3px; font-size: 11px; line-height: 1.45; text-align: center; }
.auth-card .forgot-password-message { align-self: stretch; margin: 9px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 11px; font-weight: 700; font-family: var(--font-mono); text-align: center; }
.auth-card small { color: var(--muted); font-size: 9.5px; line-height: 1.55; text-align: center; font-family: var(--font-mono); }
.form-error { min-height: 18px; margin: 0 0 10px; color: var(--brick-red); font-size: 10.5px; line-height: 1.5; font-family: var(--font-mono); }
.auth-card .form-error:empty { display: none; }

/* Keep the account form and page chrome within the available viewport. */
body.auth-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body.auth-page #islandDock, body.auth-page .topbar, body.auth-page footer, body.auth-page #studyRoomBar { display: none !important; }
.auth-page .app-shell { display: flex; flex: 1 1 auto; justify-content: center; align-items: center; min-height: 100vh; min-height: 100dvh; padding: clamp(16px, 3vh, 32px) 16px; box-sizing: border-box; }
.auth-page .auth-layout { width: 100%; max-width: 820px; min-height: 520px; max-height: none; }

.unit-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.topic-sections { display: grid; gap: 16px; }
.topic-section { padding: 18px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.topic-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.topic-heading > span { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font: 700 21px var(--font-hanzi); }
.topic-heading h3, .topic-heading p { margin: 0; }
.topic-heading h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 400; }
.topic-heading p { margin-top: 3px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.unit-card { position: relative; display: flex; gap: 11px; align-items: center; min-height: 76px; padding: 13px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); text-decoration: none; transition: transform .05s ease, box-shadow .05s ease; }
.unit-card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0px var(--line); }
.unit-number { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font-size: 12px; font-weight: 800; font-family: var(--font-mono); }
.unit-card strong, .unit-card small { display: block; }
.unit-card strong { font-size: 12.5px; }
.unit-card small { margin-top: 3px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.progress-dot { position: absolute; right: 10px; top: 10px; width: 8px; height: 8px; border-radius: 0px; border: 1px solid var(--line); background: #d9e2e3; }
.unit-card.done .progress-dot { background: var(--moss-green); }
.unit-card.is-coming-soon { border-style: dashed; opacity: .72; cursor: not-allowed; }
.unit-card.is-coming-soon:hover { transform: none; box-shadow: var(--shadow-btn); }
.unit-card.is-coming-soon .progress-dot { background: var(--amber); }
.coming-soon-notice { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); box-shadow: var(--shadow-btn); }
.coming-soon-notice strong { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); font-size: 10px; text-transform: uppercase; font-family: var(--font-mono); }
.coming-soon-notice span { font-size: 11px; line-height: 1.55; }

.word-list { display: grid; gap: 12px; }
.word-card { border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); transition: transform .05s ease, box-shadow .05s ease; }
.word-card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0px var(--line); }
.word-summary { display: grid; grid-template-columns: 90px minmax(150px, .8fr) minmax(210px, 1.25fr) auto; gap: 16px; align-items: center; width: 100%; padding: 17px 19px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.hanzi { font: 700 30px var(--font-hanzi); color: var(--ink); }
.word-main strong, .word-main span { display: block; }
.word-main strong { font-size: 15px; }
.word-main span { margin-top: 4px; color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.word-main .word-source { display: block; width: fit-content; margin-top: 7px; color: var(--moss-green); font-size: 9px; font-weight: 700; font-family: var(--font-mono); text-decoration: none; }
.word-main .word-source:hover { text-decoration: underline; }
.word-meaning { font-size: 13px; line-height: 1.55; }
.pos-pill { display: inline-flex; width: fit-content; margin-top: 5px; padding: 3px 8px; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font-size: 9.5px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.word-actions { display: flex; align-items: center; gap: 6px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: var(--muted); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; transition: transform 0.05s ease, box-shadow 0.05s ease; }
.icon-button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.icon-button.saved { color: var(--ink); background: var(--paper-hover); }
.chevron { transition: transform .2s ease; }
.word-card.open .chevron { transform: rotate(180deg); }
.word-details { display: none; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 19px 19px 125px; border-top: 1px solid var(--line); padding-top: 14px; }
.word-card.open .word-details { display: grid; }
.detail-block { padding: 14px; border-radius: 0px; border: 1px solid var(--line); background: var(--paper-hover); }
.detail-block.full { grid-column: 1 / -1; }
.detail-block h4 { margin: 0 0 7px; color: var(--ink); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-mono); }
.detail-block p { margin: 0; font-size: 12px; line-height: 1.65; }
.detail-block .translation { margin-top: 6px; color: var(--muted); }
.match-note { margin-top: 8px; color: var(--muted); font-size: 10.5px; font-family: var(--font-mono); }

.journey-shell { max-width: 850px; margin: 0 auto; }
.lesson-invite { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; margin: 20px 0 12px; padding: 20px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.lesson-invite h2 { margin: 7px 0 4px; font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.lesson-invite p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.lesson-shell { max-width: 760px; }
.lesson-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.lesson-top strong { color: var(--ink); font-size: 12px; }
.lesson-top p { margin: 0; }
.progress-track { height: 6px; margin: 10px 0 18px; overflow: hidden; border-radius: 0px; border: 1px solid var(--line); background: var(--paper); }
.progress-track span {
  display: block;
  height: 100%;
  border-radius: 0px;
  background: var(--moss-green);
  box-shadow: none;
  transition: width .25s ease;
}
.lesson-card { position: relative; min-height: 560px; overflow: hidden; padding: clamp(28px, 6vw, 52px); border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.lesson-card.has-result { border-width: 2px; }
.lesson-card.result-correct { border-color: var(--moss-green); box-shadow: 4px 4px 0px var(--moss-green); }
.lesson-card.result-wrong { border-color: var(--brick-red); box-shadow: 4px 4px 0px var(--brick-red); }
.lesson-card > .primary-button, .lesson-card > .secondary-button { margin: 14px 4px 0; }
.lesson-hanzi { margin: 25px 0 6px; color: var(--ink); font: 700 clamp(62px, 12vw, 100px) var(--font-hanzi); }
.lesson-hanzi.small { font-size: 58px; }
.lesson-pinyin { margin: 0 0 22px; color: var(--muted); font-size: 26px; font-weight: 600; font-family: var(--font-mono); }
.lesson-card h2 { margin: 15px 0; font-family: var(--font-serif); font-size: 30px; font-weight: 400; }
.lesson-card > p { color: var(--muted); font-size: 15px; line-height: 1.7; }
.lesson-note, .lesson-example, .context-prompt { margin: 14px auto; padding: 15px; border-radius: 0px; border: 1px solid var(--line); background: var(--paper-hover); text-align: left; font-size: 12px; line-height: 1.65; }
.lesson-note strong { color: var(--ink); font-size: 10px; text-transform: uppercase; font-family: var(--font-mono); letter-spacing: 0.05em; }
.lesson-note p { margin: 4px 0 0; }
.lesson-example span, .context-prompt span { display: block; margin-top: 5px; color: var(--muted); }
.question-label { margin: 20px 0 24px !important; color: var(--ink) !important; font-size: 24px !important; font-weight: 700; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 20px; }
.choice-grid button { min-height: 76px; padding: 15px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); cursor: pointer; font-size: 16px; font-weight: 700; line-height: 1.55; box-shadow: var(--shadow-btn); transition: transform .05s ease, box-shadow .05s ease, background .1s ease; }
.choice-grid button:hover:not(:disabled) { border-color: var(--line); background: var(--paper-hover); }
.choice-grid button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.recognition-grid button strong, .recognition-grid button span { display: block; }
.recognition-grid button strong { color: var(--ink); font: 700 24px var(--font-hanzi); }
.recognition-grid button span { margin-top: 7px; font-size: 15px; font-weight: 600; font-family: var(--font-mono); }
.audio-button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 0px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform .05s ease, box-shadow .05s ease, background .1s ease;
}
.audio-button:hover {
  background: var(--paper-hover);
  color: var(--ink);
}
.audio-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}
.write-form { display: flex; gap: 9px; max-width: 440px; margin: 28px auto; }
.answer-feedback { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; width: min(100%, 560px); margin: 24px auto 0; padding: 18px 20px; border-radius: 0px; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; }
.answer-feedback.correct { color: #1E4B2B; background: #EAF3EC; border-color: var(--moss-green); box-shadow: 4px 4px 0px var(--moss-green); }
.answer-feedback.wrong { color: #8A2B18; background: #FAF0EE; border-color: var(--brick-red); box-shadow: 4px 4px 0px var(--brick-red); }
.answer-feedback .feedback-note { flex-basis: 100%; margin: 0; font-size: 16px; font-weight: 700; font-family: var(--font-mono); }
.answer-value { display: grid; flex-basis: 100%; gap: 5px; place-items: center; }
.answer-value small { color: var(--brick-red); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-mono); }
.answer-value strong { color: var(--brick-red); font: 800 clamp(25px, 4vw, 34px) var(--font-hanzi); line-height: 1.3; }
.answer-feedback .primary-button { margin-top: 7px; }
.answer-feedback .keyboard-hint { flex-basis: 100%; color: inherit; opacity: .72; font-size: 10.5px; font-family: var(--font-mono); }
.room-reveal-note:empty { display: none; }
.room-reveal-note { flex-basis: 100%; margin: 0; font-size: 10px; opacity: .78; font-family: var(--font-mono); }
.room-waiting { display: flex; width: min(100%, 560px); margin: 24px auto 0; padding: 16px 18px; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); text-align: left; }
.room-waiting strong, .room-waiting p { display: block; margin: 0; }
.room-waiting p { margin-top: 4px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.room-waiting-spinner { flex: 0 0 20px; width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--moss-green); border-radius: 0px; animation: spin .8s linear infinite; }
.lesson-room-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.lesson-room-layout .journey-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}
.lesson-room-layout .room-question-timer {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 76px;
  width: 100%;
  margin-top: 68px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.room-question-timer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-hover);
}
.room-question-timer header strong {
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.room-question-timer header span {
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.room-timer-value {
  padding: 10px 8px 6px;
  color: var(--moss-green);
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}
.room-question-timer p {
  display: none;
}
.solo-question-timer {
  border-color: var(--line);
}
.lesson-pause-button {
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 0px;
  box-shadow: var(--shadow-btn);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.1s ease;
}
.lesson-pause-button:hover {
  background: var(--paper-hover);
  color: var(--ink);
}
.lesson-pause-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}
:root[data-theme="dark"] .lesson-pause-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .lesson-pause-button:hover {
  background: var(--paper-hover);
}
.room-leave-button, .lesson-leave-link {
  border: 0;
  color: var(--brick-red);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-family: var(--font-mono);
}
.room-leave-button {
  width: calc(100% - 16px);
  margin: 0 8px 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 0px;
  box-shadow: var(--shadow-btn);
  background: var(--paper);
  color: var(--brick-red);
  font-size: 9px;
  text-transform: uppercase;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.1s ease;
}
.room-question-timer small {
  display: block;
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 7.5px;
  line-height: 1.4;
  font-family: var(--font-mono);
}
.room-leave-button:hover, .lesson-leave-link:hover {
  background: #FAF0EE;
  color: var(--brick-red);
}
.room-leave-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-active);
}
.room-leave-button:disabled, .lesson-leave-link:disabled {
  cursor: wait;
  opacity: .55;
}

.lesson-room-layout .room-score-column {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: 176px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 192px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.room-score-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-hover);
}
.room-score-column header strong {
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.room-score-column header > span {
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}
.room-score-head, .room-score-row {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) repeat(var(--room-member-count, 2), 30px);
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
}
.solo-score-column .room-score-head, .solo-score-column .room-score-row {
  grid-template-columns: 1fr 34px;
}
.room-score-head {
  color: var(--muted);
  background: var(--paper-hover);
  font-size: 8px;
  font-weight: 800;
  font-family: var(--font-mono);
  text-transform: uppercase;
  text-align: center;
}
.room-score-head span:first-child { text-align: left; }
.room-score-rows {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.room-score-row {
  border-bottom: 1px solid var(--line);
}
.room-score-row:last-child { border-bottom: 0; }
.room-score-row strong { font-size: 8.5px; font-family: var(--font-mono); }
.room-score-row.is-current { background: var(--paper-hover); }
.score-question-link {
  justify-self: start;
  padding: 1px 3px;
  border: 0;
  border-radius: 0px;
  color: var(--ink);
  background: transparent;
  font-size: 8.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.score-question-link:hover, .score-question-link:focus-visible {
  background: var(--paper-hover);
  outline: none;
}
.room-score-row span {
  display: grid;
  width: 20px;
  height: 20px;
  margin: auto;
  place-items: center;
  border-radius: 0px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.score-correct { color: #FAF8F5; background: var(--moss-green); border-color: var(--line); }
.score-wrong { color: #FAF8F5; background: var(--brick-red); border-color: var(--line); }
.score-locked { color: #191919; background: var(--earth-yellow); border-color: var(--line); }
.score-pending { color: var(--muted); background: transparent; border-color: transparent; }
.room-score-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 8.5px; text-align: center; font-family: var(--font-mono); }

:root[data-theme="dark"] .score-correct { color: #FAF8F5; background: var(--moss-green); }
:root[data-theme="dark"] .score-wrong { color: #FAF8F5; background: var(--brick-red); }
:root[data-theme="dark"] .score-locked { color: #191919; background: var(--earth-yellow); }

@media (max-width: 900px) {
  .lesson-room-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }
  .lesson-room-layout .journey-shell {
    grid-column: 1;
    grid-row: 3;
  }
  .lesson-room-layout .room-question-timer {
    grid-column: 1;
    grid-row: 1;
    position: static;
    margin-top: 0;
  }
  .lesson-room-layout .room-score-column {
    grid-column: 1;
    grid-row: 2;
    position: static;
    max-height: 200px;
  }
}
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 30px; }
.rating-grid button { padding: 15px 8px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font-family: var(--font-mono); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.rating-grid button:hover { background: var(--paper-hover); }
.rating-grid button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.rating-grid strong, .rating-grid span { display: block; }
.rating-grid span { margin-top: 5px; color: var(--muted); font-size: 9.5px; }
.completion-card { max-width: 720px; margin: 40px auto; padding: 60px 35px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.completion-card h1 { margin: 8px 0 12px; font-family: var(--font-serif); font-size: 34px; font-weight: 400; }
.completion-card > p:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.shared-completion { max-width: 760px; margin: 35px auto; padding: 48px 38px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.shared-completion h1 { margin: 8px 0; font-family: var(--font-serif); font-size: 32px; font-weight: 400; }
.shared-completion > p:not(.eyebrow) { color: var(--muted); font-size: 11px; }
.shared-scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 18px; }
.shared-player-score { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 17px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); text-align: left; }
.shared-player-score.is-you { border-color: var(--line); background: var(--paper-hover); }
.shared-rank { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.shared-player-score strong, .shared-player-score small { display: block; }
.shared-player-score strong { font-size: 12px; }
.shared-player-score small { margin-top: 4px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.shared-player-score b { color: var(--moss-green); font-size: 22px; font-family: var(--font-mono); }
.personal-room-result { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 10px; font-family: var(--font-mono); }
.shared-completion-actions { display: flex; justify-content: center; gap: 10px; margin-top: 21px; }
.completion-mark { display: grid; width: 70px; height: 70px; margin: 0 auto 22px; place-items: center; border: 2px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; box-shadow: var(--shadow); font-size: 31px; font-family: var(--font-mono); }
.review-unit-list { display: grid; gap: 10px; margin-top: 20px; }
.review-unit-list article { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.review-unit-list article > div { display: flex; align-items: center; gap: 18px; }
.review-unit-list article span { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.review-tabs { display: flex; gap: 8px; margin: 18px 0; padding: 5px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.review-tabs a { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; padding: 11px 14px; border-radius: 0px; border: 1px solid transparent; color: var(--muted); font-size: 11px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.review-tabs a.active { color: #FAF8F5; background: #191919; border-color: var(--line); box-shadow: none; }
.review-tabs span { display: inline-grid; min-width: 22px; height: 22px; place-items: center; padding: 0 5px; border-radius: 0px; border: 1px solid var(--line); color: inherit; background: var(--paper-hover); font-size: 9px; font-family: var(--font-mono); }
.review-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.review-queue-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.review-queue-panel.almost { border-color: var(--line); background: var(--paper); }
.review-queue-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px; border-bottom: 1px solid var(--line); }
.review-queue-heading h2, .review-queue-heading p { margin: 0; }
.review-queue-heading h2 { margin-top: 3px; font-family: var(--font-serif); font-size: 24px; font-weight: 400; }
.review-queue-heading p:not(.eyebrow) { max-width: 430px; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.review-queue-heading > strong { flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 9px; font-family: var(--font-mono); }
.review-queue-panel.almost .review-queue-heading > strong { color: var(--ink); background: var(--paper-hover); }
.review-batches { display: grid; gap: 9px; padding: 12px; }
.review-batch-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.review-batch-number { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-size: 13px; font-weight: 800; font-family: var(--font-mono); }
.review-queue-panel.almost .review-batch-number { background: #191919; color: #FAF8F5; }
.review-batch-main { min-width: 0; }
.review-batch-main small, .review-batch-main strong { display: block; }
.review-batch-main small { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; font-family: var(--font-mono); }
.review-batch-main strong { margin-top: 3px; font-size: 12px; }
.review-word-chips { display: flex; gap: 4px; margin-top: 7px; overflow: hidden; }
.review-word-chips span { flex: 0 0 auto; padding: 3px 6px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font: 600 12px var(--font-hanzi); }
.review-queue-panel.almost .review-word-chips span { color: var(--ink); background: var(--paper-hover); }
.review-batch-card .primary-link { white-space: nowrap; }
.review-queue-empty { margin: 0; padding: 26px 20px; color: var(--muted); font-size: 11px; text-align: center; font-family: var(--font-mono); }
.exam-review-panel { max-width: 980px; margin: 0 auto; }
.exam-review-list { display: grid; gap: 8px; padding: 12px; }
.exam-review-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.exam-review-list small, .exam-review-list strong { display: block; }
.exam-review-list small { color: var(--muted); font-size: 8px; font-family: var(--font-mono); }
.exam-review-list strong { margin-top: 3px; font-size: 12px; }
.exam-review-list p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.exam-review-list .primary-link { white-space: nowrap; }
.difficult-set { margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.difficult-set-title { display: flex; align-items: center; gap: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.difficult-set-title h2, .difficult-set-title p { margin: 0; }
.difficult-set-title h2 { font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.difficult-set-title p { margin-left: auto; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.difficult-units { display: grid; gap: 12px; margin-top: 14px; }
.difficult-unit { overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.difficult-unit header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: var(--paper-hover); }
.difficult-unit header small, .difficult-unit header strong { display: block; }
.difficult-unit header small { color: var(--moss-green); font-size: 9px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.difficult-unit header strong { margin-top: 3px; font-size: 12px; }
.difficult-word-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 11px; }
.difficult-word-list button { padding: 11px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; text-align: left; transition: transform 0.05s ease, box-shadow 0.05s ease; }
.difficult-word-list button:hover { background: var(--paper-hover); }
.difficult-word-list button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.difficult-word-list strong, .difficult-word-list span, .difficult-word-list p, .difficult-word-list small { display: block; }
.difficult-word-list strong { color: var(--ink); font: 700 22px var(--font-hanzi); }
.difficult-word-list span { margin-top: 3px; color: var(--moss-green); font-size: 10px; font-weight: 700; font-family: var(--font-mono); }
.difficult-word-list p { margin: 5px 0; font-size: 10px; line-height: 1.45; }
.difficult-word-list small { color: var(--muted); font-size: 8.5px; font-family: var(--font-mono); }

.lesson-visual { height: 190px; margin: -22px -22px 22px; overflow: hidden; border-radius: 0px; border-bottom: 1px solid var(--line); }
.lesson-visual img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.preview-words { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 0; text-align: left; }
.preview-word-card { display: grid; grid-template-columns: 1fr auto; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.preview-word-main { display: grid; grid-template-columns: auto 1fr; column-gap: 11px; align-content: center; min-width: 0; padding: 13px 14px; border: 0; color: var(--ink); background: transparent; cursor: pointer; text-align: left; }
.preview-word-main:hover { background: var(--paper-hover); }
.preview-word-main strong { grid-row: 1 / 3; align-self: center; color: var(--ink); font: 700 29px var(--font-hanzi); }
.preview-word-main span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.preview-pinyin { color: var(--moss-green); font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.preview-meaning { margin-top: 3px; color: var(--ink); font-size: 11px; line-height: 1.45; }
.preview-save-button { align-self: center; margin-right: 11px; color: var(--muted); border-radius: 0px; }
.preview-save-button.saved { border-color: var(--line); color: var(--ink); background: var(--paper-hover); }
.task-kind {
  display: block;
  margin: 0 0 16px 0 !important;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.focus-word { margin: 25px 0; color: var(--ink); font: 700 clamp(64px, 12vw, 100px) var(--font-hanzi); cursor: pointer; }
.focus-word-wrap { position: relative; width: fit-content; margin: 25px auto 8px; }
.focus-word-wrap .focus-word { margin: 0; }
.focus-pos { position: absolute; left: 100%; bottom: 13px; width: max-content; margin-left: 10px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.recognition-answer-pinyin, .revealed-pinyin { margin-bottom: 13px; font-family: var(--font-mono); animation: reveal-answer .24s ease-out; }
.hanzi-question-pinyin { margin: 9px 0 14px; color: var(--moss-green); font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.hanzi-correct-answer { margin: -11px auto 15px !important; color: var(--muted) !important; font-size: 12px !important; }
.hanzi-correct-answer strong { margin-left: 5px; color: var(--ink); font: 700 27px var(--font-hanzi); }
.hanzi-instruction { display: inline-flex; margin: 20px 0 5px !important; padding: 9px 15px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink) !important; background: var(--paper-hover); font-size: 15px !important; font-weight: 700; font-family: var(--font-mono); letter-spacing: .025em; box-shadow: var(--shadow-btn); }
@keyframes reveal-answer { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.meaning-prompt { max-width: 620px; margin-inline: auto !important; line-height: 1.45; }
.choice-grid.compact button { min-height: 70px; font-size: 20px; }
.context-options button strong, .context-options button small { display: block; }
.context-options button strong { font: 700 23px var(--font-hanzi); }
.context-options button small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.45; font-family: var(--font-mono); }
.context-prompt.interactive-sentence { margin-top: 28px; color: var(--ink); font: 600 25px/1.9 var(--font-hanzi); text-align: center; }
.context-prompt.interactive-sentence.answered { border: 1px solid var(--line); background: var(--paper-hover); }
.lookup-token { display: inline; padding: 2px 1px; border: 0; border-bottom: 1px dotted var(--line); color: inherit; background: transparent; cursor: pointer; font: inherit; }
.lookup-token.context-answer { margin: 0 3px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-weight: 800; font-family: var(--font-mono); }
.translation-gate { min-height: 43px; margin: 15px 0; padding: 12px 14px; border-radius: 0px; border: 1px solid var(--line); color: var(--muted); background: var(--paper-hover); font-size: 16px; line-height: 1.7; }
.sentence-answer { margin: 17px 0; padding: 15px 18px; border-radius: 0px; border: 1px solid var(--line); background: var(--paper-hover); text-align: left; }
.sentence-pinyin { margin: 0; color: var(--moss-green); font-size: 20px; font-weight: 700; font-family: var(--font-mono); line-height: 1.65; }
.sentence-translation { margin: 8px 0 0; color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.65; }
.sentence-build { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; min-height: 105px; margin: 20px 0; padding: 17px; border: 2px dashed var(--line); border-radius: 0px; background: var(--paper); }
.sentence-build.correct { border-color: var(--moss-green); background: #EAF3EC; }
.sentence-build.wrong { border-color: var(--brick-red); background: #FAF0EE; }
.sentence-build button, .tile-bank button { padding: 10px 13px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font: 600 19px var(--font-hanzi); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.sentence-build button:active, .tile-bank button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.sentence-build > span { align-self: center; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.tile-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 55px; margin-bottom: 20px; }
.tile-bank button { background: var(--paper-hover); }
.matching-help { max-width: 610px; margin: -10px auto 17px !important; font-size: 12px !important; font-family: var(--font-mono); }
.matching-board { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.matching-column { display: grid; align-content: start; gap: 7px; }
.matching-column > strong { padding: 9px 11px; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-size: 11px; font-family: var(--font-mono); text-transform: uppercase; text-align: center; }
.matching-column > button { position: relative; display: flex; align-items: center; gap: 8px; min-height: 49px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font-size: 12px; line-height: 1.45; text-align: left; transition: transform 0.05s ease, box-shadow 0.05s ease; }
.matching-column:first-child > button span:last-child { color: var(--ink); font: 700 20px var(--font-hanzi); }
.matching-column > button.selected { border: 2px solid var(--line); background: var(--paper-hover); box-shadow: var(--shadow-btn); }
.matching-column > button.paired { background: var(--paper-hover); }
.matching-column > button:disabled { opacity: 1; cursor: default; }
.matching-column > button.match-correct { border: 2px solid var(--moss-green); background: #EAF3EC; box-shadow: 2px 2px 0px var(--moss-green); }
.matching-column > button.match-wrong { border: 2px solid var(--brick-red); background: #FAF0EE; box-shadow: 2px 2px 0px var(--brick-red); }
.pair-number { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-size: 10px; font-weight: 800; font-family: var(--font-mono); }
.matching-controls { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
.lookup-hint { margin: 28px 0 0 !important; color: var(--muted) !important; font-size: 10px !important; font-family: var(--font-mono); }
.lookup-hint button { padding: 0; border: 0; border-bottom: 1px dotted var(--line); color: var(--ink); background: transparent; cursor: pointer; font: inherit; font-weight: 800; font-family: var(--font-mono); }
.lookup-dialog { width: min(470px, calc(100% - 28px)); padding: 27px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: 6px 6px 0px var(--line); }
.lookup-dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: none; -webkit-backdrop-filter: none; }
.resume-dialog { width: min(480px, calc(100% - 28px)); padding: 32px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: 6px 6px 0px var(--line); }
.resume-dialog::backdrop { background: rgba(0,0,0,.5); backdrop-filter: none; -webkit-backdrop-filter: none; }
.resume-dialog h2 { margin: 7px 0 8px; font-family: var(--font-serif); font-size: 28px; font-weight: 400; }
.resume-dialog p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.resume-dialog .progress-track { margin: 0 0 22px; }
.resume-actions { display: flex; gap: 10px; }
.resume-actions button { flex: 1; }
.resume-backdrop-card { padding: 28px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper-hover); }
.dialog-close { position: absolute; right: 13px; top: 11px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font-size: 18px; font-family: var(--font-mono); transition: transform 0.05s ease; }
.dialog-close:active { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.lookup-dialog article { display: flex; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); text-align: left; }
.lookup-dialog article strong { color: var(--ink); font: 700 27px var(--font-hanzi); }
.lookup-dialog article span { margin-left: 10px; color: var(--muted); font-size: 13px; font-family: var(--font-mono); }
.lookup-dialog article p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.lookup-speak { flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; }
.lookup-form { display: flex; gap: 8px; margin: 13px 0 18px; }
.lookup-form input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 0px; outline: none; background: var(--paper); font-family: var(--font-sans); }
.lookup-form button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; box-shadow: var(--shadow-btn); cursor: pointer; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.flashcard { min-height: 455px; padding: 38px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.flash-hanzi { margin: 55px 0 10px; font: 700 clamp(55px, 12vw, 92px) var(--font-hanzi); color: var(--ink); }
.flash-pinyin { color: var(--muted); font-size: 26px; font-weight: 600; font-family: var(--font-mono); }
.flash-answer { margin: 24px auto 0; max-width: 650px; padding-top: 22px; border-top: 1px solid var(--line); }
.flash-answer[hidden] { display: none; }
.flash-answer h2 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 30px; font-weight: 400; line-height: 1.45; }
.flash-answer p { color: var(--muted); font-size: 16px; line-height: 1.75; }
.flash-answer .audio-button { margin-top: 10px; }
.journey-controls { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.journey-progress { margin: 10px 0 18px; color: var(--muted); font-size: 11px; font-family: var(--font-mono); text-align: center; }

.custom-callout { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; padding: 19px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.custom-callout p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.award-row { display: flex; justify-content: center; gap: 9px; min-height: 62px; margin: 18px 0; }
.award-row img { width: 58px; height: 58px; }
.poop-award { font-size: 55px; line-height: 1; }
.no-award { align-self: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 0px; color: var(--muted); background: var(--paper-hover); font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.speaking-section { max-width: 820px; margin: 24px auto; padding: 25px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.speaking-section .section-title { margin: 0 0 17px; }
.speaking-section .eyebrow { color: var(--moss-green); }
.speaking-grid { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; box-shadow: var(--shadow-btn); }
.speaking-grid > strong { padding: 12px 16px; color: #FAF8F5; background: #191919; font-size: 12px; font-family: var(--font-mono); text-transform: uppercase; }
.speaking-grid > button, .speaking-grid > p { min-height: 62px; margin: 0; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); background: var(--paper); text-align: left; }
.speaking-grid > button { color: var(--ink); cursor: pointer; }
.speaking-grid > button:hover { background: var(--paper-hover); }
.speaking-grid > button span, .speaking-grid > button small { display: block; }
.speaking-grid > button span { font: 700 24px var(--font-hanzi); }
.speaking-grid > button small { margin-top: 2px; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.speaking-grid > p { display: flex; align-items: center; border-left: 1px solid var(--line); font-size: 15px; line-height: 1.55; }

.exercise-unit-card { border-color: var(--line); background: var(--paper); }
.supplement-unit-card { border-color: var(--line); background: var(--paper); }
.supplement-unit-card .unit-number { color: var(--ink); background: var(--paper-hover); font: 700 18px var(--font-hanzi); }
.supplement-invite { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 19px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.supplement-invite h2, .supplement-invite p { margin: 0; }
.supplement-invite h2 { margin-top: 4px; font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.supplement-invite p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.supplement-invite-links { display: flex; flex-wrap: wrap; gap: 8px; }
.supplement-page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 22px 0; }
.supplement-page-card { display: flex; min-width: 0; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); text-decoration: none; transition: transform 0.05s ease, box-shadow 0.05s ease; }
.supplement-page-card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0px var(--line); }
.supplement-page-glyph { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font: 700 23px var(--font-hanzi); }
.supplement-page-card small { color: var(--muted); font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.supplement-page-card h2 { margin: 7px 0; font-family: var(--font-serif); font-size: 20px; font-weight: 400; line-height: 1.45; }
.supplement-page-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.supplement-page-arrow { margin-top: auto; color: var(--ink); font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.supplement-links, .supplement-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 17px 0; }
.supplement-nav a { padding: 9px 13px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); font: 700 11px var(--font-mono); text-decoration: none; text-transform: uppercase; }
.supplement-nav a:hover, .supplement-nav a.active { color: #FAF8F5; background: #191919; }
.supplement-section { margin: 24px 0; scroll-margin-top: 90px; }
.supplement-section > header { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.supplement-section > header small { color: var(--muted); font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.supplement-section > header h2 { margin: 4px 0; font-family: var(--font-serif); font-size: 24px; font-weight: 400; }
.supplement-section > header p { margin: 0; color: var(--muted); font-size: 11px; }
.supplement-section > header > strong { white-space: nowrap; color: var(--ink); font-size: 12px; font-family: var(--font-mono); }
.supplement-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.supplement-entry { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.supplement-entry-head { display: flex; align-items: center; gap: 11px; }
.supplement-entry-head > div { flex: 1; min-width: 0; }
.supplement-entry-head .supplement-speak-button { flex: 0 0 auto; margin-left: auto; }
.supplement-entry-head > span { display: grid; flex: 0 0 26px; width: 26px; height: 26px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.supplement-entry h3 { margin: 0; overflow-wrap: anywhere; font: 700 18px/1.5 var(--font-hanzi); }
.supplement-entry-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.supplement-meaning { margin: 12px 0 4px; color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.6; }
.supplement-explanation { margin: 11px 0; white-space: pre-wrap; color: var(--ink); font-size: 12px; line-height: 1.75; }
.supplement-examples { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.supplement-examples > strong { color: var(--muted); font-size: 11px; font-family: var(--font-mono); text-transform: uppercase; }
.supplement-entry ol { margin: 11px 0 0; padding-left: 22px; }
.supplement-entry li { margin: 7px 0; font-size: 12px; line-height: 1.75; }
@media (max-width: 900px) { .supplement-page-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .supplement-list { grid-template-columns: 1fr; } .supplement-invite { align-items: flex-start; flex-direction: column; } }
.exercise-unit-card .unit-number { color: var(--ink); background: var(--paper-hover); font: 700 18px var(--font-hanzi); }
.exercise-invite, .exercise-next { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 19px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.exercise-invite h2, .exercise-invite p, .exercise-next h2 { margin: 0; }
.exercise-invite h2, .exercise-next h2 { margin-top: 4px; font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.exercise-invite p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.exercise-banner { background: #191919; color: #FAF8F5; }
.exercise-notice { margin: 15px 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 11px; font-weight: 700; font-family: var(--font-mono); }
.exercise-progress-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 16px 0; padding: 16px 19px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.exercise-progress-card strong, .exercise-progress-card span { display: block; }
.exercise-progress-card strong { font-size: 14px; font-family: var(--font-mono); }
.exercise-progress-card span { margin-top: 4px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.exercise-progress-card a { color: var(--moss-green); font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.exercise-start-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 27px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.exercise-start-card h2, .exercise-start-card p { margin: 0; }
.exercise-start-card h2 { margin: 5px 0 8px; font-family: var(--font-serif); font-size: 26px; font-weight: 400; }
.exercise-start-card > div > p:last-child { max-width: 680px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.exercise-start-card .primary-link { white-space: nowrap; }
.exam-lesson-card { padding-top: 34px; }
.exam-lesson-card > .task-kind { margin-bottom: 12px; color: var(--muted); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-family: var(--font-mono); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.exam-overview-points { display: grid; gap: 5px; max-width: 510px; margin: 24px auto; padding: 15px 18px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); box-shadow: var(--shadow-btn); }
.exam-overview-points span { font-size: 11px; line-height: 1.6; }
.exam-question-prompt { margin: 20px 0 12px; }
.exam-question-prompt > span { display: inline-grid; min-width: 62px; min-height: 28px; padding: 4px 10px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.exam-question-prompt h2 { margin: 10px 0 0; font: 700 clamp(18px, 2.5vw, 24px)/1.65 var(--font-hanzi); }
.exam-inline-blank { display: inline-flex; align-items: flex-end; gap: 3px; min-width: 62px; margin: 0 5px; padding: 0 5px 2px; border-bottom: 2px solid var(--line); color: var(--ink); white-space: nowrap; vertical-align: baseline; }
.exam-inline-blank small { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; font: 800 10px var(--font-mono); }
.exam-inline-blank b { font-size: 17px; letter-spacing: -.15em; font-family: var(--font-mono); }
.exam-choice-grid { margin-top: 14px; text-align: left; }
.exam-choice-grid button { display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; transition: transform 0.05s ease, box-shadow 0.05s ease; }
.exam-choice-grid button:hover:not(:disabled) { background: var(--paper-hover); }
.exam-choice-grid button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.exam-choice-grid button > span { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font-size: 11px; font-family: var(--font-mono); }
.exam-choice-grid button > strong { font: 700 15px/1.65 var(--font-hanzi); }

/* Nổi bật câu trả lời trắc nghiệm đã chọn trong bài thi thử */
.exam-choice-grid button.selected,
.choice-grid button.selected {
  border: 2px solid var(--moss-green) !important;
  background-color: #EAF4ED !important;
  box-shadow: 3px 3px 0px var(--moss-green) !important;
  transform: translate(-1px, -1px);
}
.exam-choice-grid button.selected > span,
.choice-grid button.selected > span {
  background-color: var(--moss-green) !important;
  color: #FAF8F5 !important;
  border-color: var(--moss-green) !important;
  font-weight: 800 !important;
}
.exam-choice-grid button.selected > strong,
.choice-grid button.selected > strong {
  color: #143820 !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .exam-choice-grid button.selected,
:root[data-theme="dark"] .choice-grid button.selected {
  border-color: #68B67B !important;
  background-color: #182C1E !important;
  box-shadow: 3px 3px 0px #000 !important;
}
:root[data-theme="dark"] .exam-choice-grid button.selected > span,
:root[data-theme="dark"] .choice-grid button.selected > span {
  background-color: #68B67B !important;
  color: #0D140F !important;
  border-color: #68B67B !important;
}
:root[data-theme="dark"] .exam-choice-grid button.selected > strong,
:root[data-theme="dark"] .choice-grid button.selected > strong {
  color: #FAF8F5 !important;
}

/* ========================================================
   TACTILE EXAM QUESTION NAVIGATION (COLLAPSIBLE DRAWER)
   ======================================================== */
.exam-question-navigation {
  margin: 10px 0 16px;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  box-shadow: 2px 2px 0px var(--line);
  box-sizing: border-box;
}

.exam-nav-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 14px;
  background: var(--paper);
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-radius: 0px;
}

.exam-nav-summary::-webkit-details-marker {
  display: none;
}

.exam-nav-summary:hover {
  background: var(--paper-hover);
}

.exam-nav-summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

.exam-nav-caret {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--paper-hover);
  font-size: 11px;
  color: var(--ink);
  transition: transform 0.2s ease;
}

.exam-question-navigation[open] .exam-nav-caret {
  transform: rotate(180deg);
}

.exam-nav-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exam-nav-progress-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--paper-hover);
  color: var(--moss-green);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

:root[data-theme="dark"] .exam-nav-progress-badge {
  color: #68B67B;
}

.exam-nav-finish-btn {
  margin: 0 !important;
  padding: 6px 14px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  min-height: 30px !important;
  font-family: var(--font-mono) !important;
}

.exam-nav-drawer-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.exam-nav-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.exam-navigation-group h3 {
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
}

.exam-question-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exam-question-numbers button {
  min-width: 34px;
  height: 34px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 1px 1px 0px var(--line);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.exam-question-numbers button:hover:not(:disabled) {
  background: var(--paper-hover);
}

.exam-question-numbers button:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 0px 0px var(--line);
}

.exam-question-numbers button.answered {
  background: #EAF4ED;
  color: var(--moss-green);
  border-color: var(--moss-green);
  font-weight: 800;
}

:root[data-theme="dark"] .exam-question-numbers button.answered {
  background: #182C1E;
  color: #68B67B;
  border-color: #68B67B;
}

.exam-question-numbers button.current {
  border: 2px solid var(--line);
  background: #191919;
  color: #FAF8F5;
  box-shadow: none;
  transform: translate(1px, 1px);
}

:root[data-theme="dark"] .exam-question-numbers button.current {
  border-color: #FAF8F5;
  background: #FAF8F5;
  color: #191919;
}

.exam-navigation-legend {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.exam-reading-passage { max-height: 310px; overflow: auto; margin: 15px 0 5px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); text-align: left; scrollbar-gutter: stable; box-shadow: var(--shadow-btn); }
.exam-reading-passage header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); background: var(--paper-hover); }
.exam-reading-passage header strong { color: var(--ink); font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; }
.exam-reading-passage header span { color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exam-reading-passage > div { padding: 5px 17px 12px; }
.exam-reading-passage p { margin: 10px 0 0; color: var(--ink); font: 500 15px/2 var(--font-hanzi); text-indent: 2em; }
.exam-reading-passage.is-fully-expanded {
  max-height: none !important;
}
.exam-stimulus-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.stimulus-expand-toggle-btn {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--paper);
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  text-transform: uppercase;
}
.stimulus-expand-toggle-btn:hover {
  background: var(--paper-hover);
}
.exam-group-passage { max-height: 430px; }
.exam-group-passage p { line-height: 2.65; text-indent: 0; }
.exam-gap-control { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); vertical-align: middle; }
.exam-gap-control > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; font: 800 10px var(--font-mono); }
.exam-gap-control select { min-width: 78px; border: 0; outline: 0; color: var(--ink); background: var(--paper); font: 800 11px var(--font-mono); cursor: pointer; }
.exam-gap-control.is-correct { border-color: var(--moss-green); background: #EAF3EC; }
.exam-gap-control.is-wrong { border-color: var(--brick-red); background: #FAF0EE; }
.exam-option-bank { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; text-align: left; }
.exam-option-bank article { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.exam-option-bank article > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.exam-option-bank p { margin: 1px 0 0; font: 600 12px/1.65 var(--font-hanzi); }
.exam-group-submit { margin-top: 6px; }
.exam-group-help { margin: 8px 0 0; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exam-group-results { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.exam-group-results span { padding: 5px 8px; border-radius: 0px; border: 1px solid var(--line); font-size: 9px; font-weight: 800; font-family: var(--font-mono); }
.exam-group-results span.correct { color: #1E4B2B; background: #EAF3EC; border-color: var(--moss-green); }
.exam-group-results span.wrong { color: #8A2B18; background: #FAF0EE; border-color: var(--brick-red); }
.exam-group-mistakes { margin: 9px 0; color: var(--ink); text-align: left; }
.exam-group-mistakes summary { cursor: pointer; font-size: 10px; font-weight: 800; text-align: center; font-family: var(--font-mono); }
.exam-explanation { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); text-align: left; box-shadow: var(--shadow-btn); }
.exam-explanation strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; }
.exam-explanation p { margin: 0; font-size: 11px; line-height: 1.65; }
.exam-group-explanations { flex-basis: 100%; color: var(--ink); text-align: left; }
.exam-group-explanations summary { cursor: pointer; font-size: 10px; font-weight: 800; text-align: center; font-family: var(--font-mono); }
.exam-group-explanations > div { display: grid; gap: 7px; margin-top: 8px; }
.exam-listening-audio { position: sticky; top: 6px; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; margin: 12px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: left; }
.exam-listening-audio strong, .exam-listening-audio span { display: block; }
.exam-listening-audio strong { font-family: var(--font-mono); font-size: 11px; }
.exam-listening-audio span { margin-top: 3px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exam-listening-audio details { grid-column: 1 / -1; max-height: 150px; overflow: auto; color: var(--muted); font-size: 9px; }
.exam-listening-audio details p { color: var(--ink); font: 500 12px/1.8 var(--font-hanzi); }
.exam-listening-progress { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0 8px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exam-listening-progress strong { color: var(--moss-green); }
.exam-listening-questions { display: grid; gap: 10px; text-align: left; }
.exam-listening-question { padding: 13px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.exam-listening-question.is-correct { border-color: var(--moss-green); background: #EAF3EC; }
.exam-listening-question.is-wrong { border-color: var(--brick-red); background: #FAF0EE; }
.exam-listening-question > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.exam-listening-question > header strong { color: var(--ink); font-size: 11px; font-family: var(--font-mono); }
.exam-listening-question > header span { color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exam-listening-question > p { margin: 0 0 8px; font: 600 13px/1.7 var(--font-hanzi); }
.exam-listening-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.exam-listening-options button { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 44px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); text-align: left; cursor: pointer; box-shadow: var(--shadow-btn); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.exam-listening-options button:hover:not(:disabled) { background: var(--paper-hover); }
.exam-listening-options button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: var(--shadow-active); }
.exam-listening-options button > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-hover); font-size: 9px; font-weight: 800; font-family: var(--font-mono); }
.exam-listening-options button > b { font: 600 11px/1.55 var(--font-hanzi); }

/* Nổi bật câu trả lời phần nghe đã chọn */
.exam-listening-options button.selected {
  border: 2px solid var(--moss-green) !important;
  background-color: #EAF4ED !important;
  box-shadow: 2px 2px 0px var(--moss-green) !important;
  transform: translate(-1px, -1px);
}
.exam-listening-options button.selected > span {
  background-color: var(--moss-green) !important;
  color: #FAF8F5 !important;
  border-color: var(--moss-green) !important;
  font-weight: 800 !important;
}
.exam-listening-options button.selected > b {
  color: #143820 !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .exam-listening-options button.selected {
  border-color: #68B67B !important;
  background-color: #182C1E !important;
  box-shadow: 2px 2px 0px #000 !important;
}
:root[data-theme="dark"] .exam-listening-options button.selected > span {
  background-color: #68B67B !important;
  color: #0D140F !important;
  border-color: #68B67B !important;
}
:root[data-theme="dark"] .exam-listening-options button.selected > b {
  color: #FAF8F5 !important;
}
.exam-audio-source { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.exam-audio-source details { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 0px; color: var(--muted); background: var(--paper-hover); font-size: 10px; text-align: left; }
.exam-audio-source details p { color: var(--ink); font: 500 13px/1.8 var(--font-hanzi); }
.exam-source-warning { margin: 12px 0; padding: 10px 13px; border-left: 3px solid var(--earth-yellow); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 10px; line-height: 1.65; text-align: left; }
.exam-source-warning strong, .exam-source-warning span { display: block; font-family: var(--font-mono); }
.exam-manual-form { display: grid; gap: 12px; margin-top: 14px; }
.exam-manual-form textarea { width: 100%; resize: vertical; padding: 14px 15px; border: 1px solid var(--line); border-radius: 0px; outline: 0; color: var(--ink); background: var(--paper); font: 13px/1.8 var(--font-sans); }
.exam-manual-form textarea:focus { border-color: var(--line); outline: 2px solid var(--line); }
.exercise-form { display: grid; gap: 17px; }
.exercise-section { overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.exercise-section > header { display: flex; align-items: center; gap: 13px; padding: 18px 21px; border-bottom: 1px solid var(--line); background: var(--paper-hover); }
.exercise-section > header > span { display: grid; flex: 0 0 48px; width: 48px; min-height: 39px; padding: 0 4px; place-items: center; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; font: 700 12px var(--font-hanzi); text-align: center; }
.exercise-section header h2, .exercise-section header p { margin: 0; }
.exercise-section header h2 { margin-top: 3px; font-family: var(--font-serif); font-size: 20px; font-weight: 400; }
.exercise-section header p { color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exercise-stimulus { margin: 17px 21px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper-hover); }
.exercise-stimulus strong, .exercise-stimulus p { margin: 0; }
.exercise-stimulus p { margin-top: 7px; white-space: pre-wrap; color: var(--ink); font-size: 14px; line-height: 1.85; font-family: var(--font-hanzi); }
.exercise-stimulus.audio { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--paper-hover); border-color: var(--line); }
.exercise-stimulus.audio details { grid-column: 1 / -1; color: var(--muted); }
.exercise-stimulus.audio details > p { margin-top: 10px; color: var(--ink); }
.exercise-stimulus.missing { color: var(--brick-red); background: #FAF0EE; border-color: var(--brick-red); }
.exercise-stimulus.missing p { color: var(--brick-red); }
.exercise-data-warning { margin: 10px 21px 0; padding: 10px 12px; border-left: 3px solid var(--earth-yellow); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 10px; line-height: 1.65; font-family: var(--font-mono); }
.exercise-word-bank { display: flex; flex-wrap: wrap; gap: 7px; padding: 13px 20px; border-bottom: 1px solid var(--line); background: var(--paper-hover); }
.exercise-word-bank span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); font-size: 12px; font-weight: 700; font-family: var(--font-hanzi); }
.exercise-questions { display: grid; }
.exercise-question { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 13px; padding: 19px 21px; }
.exercise-question + .exercise-question { border-top: 1px solid var(--line); }
.exercise-question-number { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 10px; font-weight: 800; font-family: var(--font-mono); }
.exercise-question-body { min-width: 0; }
.exercise-prompt { margin: 3px 0 0; white-space: pre-wrap; color: var(--ink); font-size: 15px; line-height: 2.25; }
.exercise-long-prompt { white-space: pre-wrap; line-height: 1.8; }
.exercise-inline-input, .exercise-inline-select { display: inline-block; min-height: 36px; margin: 0 4px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 0px; outline: 0; color: var(--ink); background: var(--paper); font: inherit; vertical-align: middle; }
.exercise-inline-input { width: min(190px, 50vw); border-width: 0 0 2px; text-align: center; }
.exercise-inline-select { max-width: min(280px, 70vw); }
.exercise-inline-input:focus, .exercise-inline-select:focus, .exercise-writing-label textarea:focus { border-color: var(--line); outline: 2px solid var(--line); }
.required-expression { margin: 11px 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 11px; font-family: var(--font-mono); }
.exercise-writing-label { display: grid; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.exercise-writing-label textarea { width: 100%; resize: vertical; padding: 12px 13px; border: 1px solid var(--line); border-radius: 0px; outline: 0; color: var(--ink); background: var(--paper); font: 12px/1.7 var(--font-sans); }
.exercise-done-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--ink); font-size: 10px; font-weight: 700; font-family: var(--font-mono); }
.exercise-done-check input { width: 17px; height: 17px; accent-color: var(--moss-green); }
.exercise-reference { margin-top: 12px; padding: 11px 13px; border: 1px dashed var(--line); border-radius: 0px; background: var(--paper-hover); }
.exercise-reference summary { color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.exercise-reference p { margin: 10px 0 4px; white-space: pre-wrap; font-size: 12px; line-height: 1.65; }
.exercise-reference small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.6; }
.exercise-feedback { margin-top: 10px; padding: 8px 10px; border-radius: 0px; border: 1px solid var(--line); font-size: 10px; font-weight: 800; font-family: var(--font-mono); }
.exercise-feedback.correct { color: #1E4B2B; background: #EAF3EC; border-color: var(--moss-green); }
.exercise-feedback.wrong { color: #8A2B18; background: #FAF0EE; border-color: var(--brick-red); }
.exercise-feedback.manual { color: var(--ink); background: var(--paper-hover); }
.exercise-submit-bar { position: sticky; bottom: 10px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.exercise-submit-bar strong, .exercise-submit-bar small { display: block; }
.exercise-submit-bar strong { font-size: 12px; font-family: var(--font-mono); }
.exercise-submit-bar small { margin-top: 3px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.exercise-submit-bar button:disabled { opacity: .6; cursor: wait; }
.exercise-next { margin-top: 20px; }

.profile-hero { display: flex; align-items: center; gap: 19px; padding: 28px; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; box-shadow: var(--shadow); }
.profile-avatar { display: grid; flex: 0 0 70px; width: 70px; height: 70px; place-items: center; border: 1px solid var(--line); border-radius: 0px; background: rgba(255,255,255,.1); font-size: 30px; font-weight: 800; font-family: var(--font-mono); }
.profile-hero h1, .profile-hero p { margin: 0; }
.profile-hero h1 { font-family: var(--font-serif); font-size: 32px; font-weight: 400; }
.profile-hero > div > p:last-child { margin-top: 5px; color: rgba(255,255,255,.72); font-size: 12px; font-family: var(--font-mono); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 17px 0; }
.stats-grid article { padding: 19px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.stats-grid strong, .stats-grid span { display: block; }
.stats-grid strong { color: var(--ink); font-size: 28px; font-family: var(--font-mono); }
.stats-grid span { margin-top: 4px; color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.profile-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 16px; }
.profile-panel { padding: 23px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.profile-panel h2 { margin: 0 0 17px; font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.password-form { display: grid; gap: 12px; }
.password-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; font-family: var(--font-mono); text-transform: uppercase; }
.password-form input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 0px; outline: 0; background: var(--paper); font-family: var(--font-sans); }
.password-form input:focus { border-color: var(--line); outline: 2px solid var(--line); }
.form-status { min-height: 17px; margin: 0; font-size: 11px; font-family: var(--font-mono); }
.form-status.error { color: var(--brick-red); }
.form-status.success { color: var(--moss-green); }
.recent-results { display: grid; gap: 9px; }
.recent-results article { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 0px; border: 1px solid var(--line); background: var(--paper-hover); }
.recent-results strong, .recent-results span { display: block; }
.recent-results strong { font-size: 12px; }
.recent-results span { margin-top: 4px; color: var(--muted); font-size: 9.5px; font-family: var(--font-mono); }
.mini-award { display: flex; gap: 3px; align-items: center; font-size: 22px; }
.mini-award img { width: 24px; height: 24px; }
.wrong-panel { margin-top: 16px; }
.wrong-panel .section-title { margin: 0 0 15px; }
.wrong-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.wrong-grid article { display: flex; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.wrong-grid button { flex: 0 0 36px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); cursor: pointer; }
.wrong-grid strong, .wrong-grid span { display: inline-block; }
.wrong-grid strong { margin-right: 8px; color: var(--ink); font: 700 23px var(--font-hanzi); }
.wrong-grid span { color: var(--muted); font-size: 13px; font-family: var(--font-mono); }
.wrong-grid p { margin: 4px 0; font-size: 12px; line-height: 1.5; }
.wrong-grid small, .muted-copy { color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.wrong-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.wrong-page-controls { display: flex; align-items: center; gap: 8px; }
.wrong-page-controls label { display: flex; align-items: center; gap: 6px; }
.wrong-page-controls button, .wrong-page-controls select { min-height: 34px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); font-family: var(--font-mono); }
.wrong-page-controls button { min-width: 34px; cursor: pointer; font-size: 18px; }
.wrong-page-controls button:disabled { opacity: .4; cursor: default; }
.wrong-page-controls select { padding: 0 8px; cursor: pointer; }

.room-hero { padding: 34px; border-radius: 0px; border: 1px solid var(--line); color: #FAF8F5; background: #191919; box-shadow: var(--shadow); }
.room-hero h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(30px, 4.5vw, 44px); font-weight: 400; }
.room-hero > p:last-child { max-width: 720px; margin: 13px 0 0; color: rgba(255,255,255,.82); line-height: 1.7; }
.room-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.room-actions article, .room-actions form, .room-dashboard { padding: 25px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.room-actions h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.room-actions p { min-height: 36px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.room-actions form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 9px; }
.room-actions form h2, .room-actions form p, .room-actions form .form-error { grid-column: 1 / -1; }
.room-actions input { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 0px; text-transform: uppercase; letter-spacing: .18em; font-weight: 800; font-family: var(--font-mono); background: var(--paper); }
.room-actions .form-error { min-height: 16px; color: var(--brick-red); font-size: 10px; font-family: var(--font-mono); }
.room-dashboard { max-width: 760px; margin: 0 auto; text-align: center; }
.room-code { color: var(--ink); font-size: clamp(38px, 8vw, 70px); font-weight: 800; letter-spacing: .16em; font-family: var(--font-mono); }
.room-dashboard > p:not(.eyebrow) { color: var(--muted); font-size: 11px; }
.room-members { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0; text-align: left; }
.room-members article { display: flex; align-items: center; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.room-members .waiting-member { border-style: dashed; opacity: .7; }
.room-avatar { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; font-weight: 800; font-family: var(--font-mono); }
.room-members strong, .room-members small { display: block; }
.room-members strong { font-size: 12px; }
.room-members small { margin-top: 4px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.room-dashboard-actions { display: flex; align-items: center; justify-content: center; gap: 13px; }

.admin-nav { color: var(--ink); font-family: var(--font-mono); }
.admin-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; margin: 18px 0; }
.admin-stats article { padding: 17px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.admin-stats strong, .admin-stats span { display: block; }
.admin-stats strong { color: var(--ink); font-size: 25px; font-family: var(--font-mono); }
.admin-stats span { margin-top: 4px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.admin-panel { padding: 23px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.admin-panel .section-title { margin: 0 0 16px; }
.member-directory-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.member-directory-head h2, .member-directory-head p { margin: 0; }
.member-directory-head h2 { margin-top: 3px; font-family: var(--font-serif); font-size: 24px; font-weight: 400; }
.member-directory-head > div > p:last-child { margin-top: 5px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.member-directory-head .search-box { flex: 0 1 360px; }
.admin-users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.admin-user { overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.admin-user.locked { border-color: var(--brick-red); background: #FAF0EE; }
.admin-user-main { display: flex; align-items: center; gap: 13px; padding: 16px; }
.admin-avatar { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border: 1px solid var(--line); border-radius: 0px; color: #FAF8F5; background: #191919; box-shadow: var(--shadow-btn); font-size: 18px; font-weight: 800; font-family: var(--font-mono); }
.admin-user-main > div:nth-child(2) { min-width: 0; flex: 1; }
.admin-user-main strong, .admin-user-main span, .admin-user-main small { display: block; }
.admin-user-main strong { font-size: 14px; }
.admin-user-main span { margin-top: 3px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.admin-user-main small { margin-top: 5px; color: var(--muted); font-size: 9.5px; font-family: var(--font-mono); }
.admin-user-main em { padding: 4px 8px; border: 1px solid var(--line); border-radius: 0px; color: #1E4B2B; background: #EAF3EC; font-size: 9px; font-style: normal; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.admin-user.locked .admin-user-main em { color: #8A2B18; background: #FAF0EE; border-color: var(--brick-red); }
.member-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.member-name-row .member-role { display: inline-block; margin: 0; padding: 3px 6px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper-hover); font-size: 8px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.member-metrics { display: flex; flex-wrap: wrap; gap: 5px 11px; margin-top: 9px; }
.member-metrics span { margin: 0; font-size: 9px; font-family: var(--font-mono); }
.member-metrics b { color: var(--ink); }
.member-card-side { display: grid; flex: 0 0 auto; justify-items: end; gap: 9px; }
.member-profile-link { color: var(--moss-green); font-size: 9px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; white-space: nowrap; }
.member-manage { border-top: 1px solid var(--line); background: var(--paper); }
.member-manage summary { padding: 10px 15px; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.admin-actions { display: grid; grid-template-columns: 1.25fr .8fr auto 1.25fr; gap: 8px; padding: 0 14px 14px; }
.admin-actions form { display: flex; gap: 5px; }
.admin-actions label { display: grid; gap: 4px; color: var(--muted); font-size: 8.5px; font-weight: 700; font-family: var(--font-mono); text-transform: uppercase; }
.admin-actions input, .admin-actions select, .admin-actions button { min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); font-size: 9.5px; font-family: var(--font-mono); }
.admin-actions input { width: 100%; }
.admin-actions button { color: var(--teal); cursor: pointer; font-weight: 800; }
.admin-actions button:disabled, .admin-actions select:disabled { opacity: .48; cursor: not-allowed; }
.admin-member-hero > div:nth-child(2) { min-width: 0; flex: 1; }
.admin-member-hero > .secondary-button { margin-left: auto; border-color: rgba(255,255,255,.25); color: white; background: rgba(255,255,255,.1); }
.member-profile-stats { grid-template-columns: repeat(5, 1fr); }
.admin-member-sections { grid-template-columns: 1fr 1fr; }
.member-results-panel { margin-top: 17px; }

.empty { padding: 60px 25px; border: 1px dashed var(--line); border-radius: 0px; background: var(--paper); text-align: center; }
.empty h2 { margin: 0 0 8px; font-family: var(--font-serif); }
.loader { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--moss-green); border-radius: 0px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glyph-drift { 0%, 100% { transform: translateY(-52%) rotate(-2deg); } 50% { transform: translateY(-56%) rotate(2deg); } }
@keyframes status-pulse { 0%, 100% { box-shadow: 0 0 0 3px #e7f6ed; } 50% { box-shadow: 0 0 0 6px rgba(44,165,108,.1); } }
footer { padding: 24px; border-top: 1px solid var(--line); color: var(--muted); background: var(--paper); text-align: center; font-size: 10px; font-family: var(--font-mono); }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px 20px; margin-bottom: 11px; }
.footer-links a { color: var(--moss-green); font-size: 11px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
footer p { margin: 0; }

/* Account gate, appearance controls and result analysis */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle span { min-width: 25px; width: 25px; height: 25px; color: var(--ink); background: var(--paper-hover); box-shadow: none; border-radius: 0px; }
.theme-toggle b { font-size: 11px; font-family: var(--font-mono); }
.guest-callout { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.guest-callout > div { display: flex; align-items: center; gap: 13px; }
.guest-callout p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.auth-card .guest-continue { margin-top: 0; color: var(--muted); font-family: var(--font-mono); }
.guest-learning-note { margin: 14px 0 0; padding: 10px 13px; border: 1px solid var(--line); border-radius: 0px; color: var(--muted); background: var(--paper); font-size: 10.5px; line-height: 1.55; font-family: var(--font-mono); }
.pinyin-hint { min-height: 40px; padding: 4px 12px; border: 1px dashed var(--line); border-radius: 0px; background: transparent; filter: blur(7px); opacity: .35; transition: filter .2s ease, opacity .2s ease, background .2s ease; }
.pinyin-hint:hover, .pinyin-hint:focus-visible, .pinyin-hint:active, .pinyin-hint.revealed, .pinyin-hint.shift-revealed { background: var(--paper-hover); filter: blur(0); opacity: 1; }
.result-analysis { margin: 28px 0 6px; padding-top: 4px; border-top: 1px solid var(--line); text-align: left; }
.result-analysis .section-title { margin-top: 22px; font-family: var(--font-serif); }
.result-analysis .eyebrow { color: var(--moss-green); font-family: var(--font-mono); }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.result-stats article { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.result-stats span, .result-stats strong { display: block; }
.result-stats span { color: var(--muted); font-size: 9px; font-weight: 700; font-family: var(--font-mono); }
.result-stats strong { margin-top: 6px; font-size: clamp(15px, 2.4vw, 20px); line-height: 1.25; font-family: var(--font-mono); }
.result-chart-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; align-items: center; margin-top: 22px; }
.accuracy-donut { display: grid; width: 138px; height: 138px; place-items: center; border-radius: 0px; border: 1px solid var(--line); background: conic-gradient(var(--moss-green) calc(var(--accuracy) * 1%), var(--line) 0); box-shadow: var(--shadow-btn); }
.accuracy-donut::before { content: ""; grid-area: 1 / 1; width: 99px; height: 99px; border-radius: 0px; border: 1px solid var(--line); background: var(--paper); }
.accuracy-donut > div { z-index: 1; grid-area: 1 / 1; text-align: center; }
.accuracy-donut strong, .accuracy-donut span { display: block; }
.accuracy-donut strong { font-size: 26px; font-family: var(--font-mono); }
.accuracy-donut span { margin-top: 2px; color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.result-bars { display: grid; gap: 12px; min-width: 0; }
.result-bar-row { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(100px, 1.3fr) 42px; gap: 10px; align-items: center; }
.result-bar-row > div:first-child strong, .result-bar-row > div:first-child span { display: block; }
.result-bar-row > div:first-child strong { font-size: 10.5px; }
.result-bar-row > div:first-child span { margin-top: 3px; color: var(--muted); font-size: 8.5px; font-family: var(--font-mono); }
.result-bar-track { height: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--page); }
.result-bar-track span { display: block; height: 100%; border-radius: 0px; background: var(--moss-green); }
.result-bar-row b { color: var(--moss-green); font-size: 11px; text-align: right; font-family: var(--font-mono); }
.result-insight { margin: 20px 0 0 !important; padding: 12px 14px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink) !important; background: var(--paper-hover); font-size: 10.5px !important; line-height: 1.6 !important; font-family: var(--font-mono); }

/* Pause, group-room gate and profile analytics */
.theme-toggle { justify-content: center; width: 39px; height: 39px; padding: 5px; }
.lesson-pause-button { width: calc(100% - 22px); margin: 0 11px 7px; padding: 9px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-btn); cursor: pointer; font-size: 9.5px; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; }
.lesson-pause-button:hover { background: var(--paper-hover); }
.lesson-pause-overlay { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(22, 21, 20, .75); }
.lesson-pause-overlay section { width: min(100%, 400px); padding: 34px 26px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); box-shadow: 6px 6px 0px var(--line); text-align: center; }
.lesson-pause-overlay h2 { margin: 0 0 20px; font-size: 25px; font-family: var(--font-serif); }
.room-lesson-gate { max-width: 680px; margin: 30px auto; padding: 42px 34px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.room-lesson-gate > .room-callout-icon { margin: 0 auto 18px; }
.room-lesson-gate h1 { margin: 4px 0 10px; font-family: var(--font-serif); }
.room-lesson-gate > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.room-gate-members { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 20px 0; }
.room-gate-members span, .room-start-disabled { padding: 8px 11px; border: 1px solid var(--line); border-radius: 0px; color: var(--ink); background: var(--paper); font-size: 10px; font-weight: 800; font-family: var(--font-mono); box-shadow: var(--shadow-btn); }
.room-start-disabled { border-style: dashed; }
.profile-analysis { margin: 17px 0; padding: 24px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.profile-analysis .section-title { margin: 0 0 17px; font-family: var(--font-serif); }
.analysis-accuracy { display: grid; min-width: 92px; color: var(--moss-green); font-size: 27px; font-weight: 900; text-align: right; font-family: var(--font-mono); }
.analysis-accuracy small { color: var(--muted); font-size: 8.5px; font-weight: 700; text-transform: uppercase; font-family: var(--font-mono); }
.profile-analysis-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.profile-analysis-summary article { padding: 13px 15px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow-btn); }
.profile-analysis-summary span, .profile-analysis-summary strong { display: block; }
.profile-analysis-summary span { color: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.profile-analysis-summary strong { margin-top: 5px; font-size: 18px; font-family: var(--font-mono); }
.profile-analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 13px; }
.profile-chart-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 0px; background: var(--paper); box-shadow: var(--shadow); }
.profile-chart-card header strong, .profile-chart-card header span { display: block; }
.profile-chart-card header strong { font-size: 11px; font-family: var(--font-serif); }
.profile-chart-card header span { margin-top: 3px; color: var(--muted); font-size: 8.5px; font-family: var(--font-mono); }
.profile-trend { display: flex; align-items: end; gap: 6px; height: 145px; margin-top: 14px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.profile-trend-item { display: grid; flex: 1 1 0; align-items: end; height: 100%; min-width: 6px; }
.profile-trend-item > span { width: 100%; min-height: 4px; border-radius: 0px; background: var(--moss-green); border: 1px solid var(--line); }
.profile-trend-item small { margin: 4px 0 -17px; color: var(--muted); font-size: 7px; text-align: center; font-family: var(--font-mono); }
.profile-course-bars { display: grid; gap: 11px; margin-top: 14px; }
.profile-course-bars p { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 5px; }
.profile-course-bars p strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.profile-course-bars p span { flex: 0 0 auto; color: var(--muted); font-size: 8px; font-family: var(--font-mono); }
.profile-course-track { display: block; height: 7px; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--page); }
.profile-course-track i { display: block; height: 100%; border-radius: 0px; background: var(--moss-green); }
.profile-grade-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-top: 18px; }
.profile-grade-strip > div > span { display: flex; justify-content: space-between; gap: 7px; }
.profile-grade-strip b, .profile-grade-strip small { font-size: 8.5px; font-family: var(--font-mono); }
.profile-grade-strip small { color: var(--muted); }
.profile-grade-strip i { display: block; height: 6px; margin-top: 6px; overflow: hidden; border: 1px solid var(--line); border-radius: 0px; background: var(--page); }
.profile-grade-strip em { display: block; height: 100%; border-radius: 0px; background: var(--earth-yellow); }
.empty-analysis { box-shadow: none; }
.empty-analysis h2, .empty-analysis p { margin: 4px 0; font-family: var(--font-serif); }
.empty-analysis p:last-child { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }

:root[data-theme="dark"] {
  color-scheme: dark;
}
:root[data-theme="dark"] body {
  background: var(--page);
}
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] footer {
  border-color: var(--line);
  background: rgba(24, 24, 27, .9);
}
:root[data-theme="dark"] .set-card,
:root[data-theme="dark"] .lesson-card,
:root[data-theme="dark"] .choice-grid button {
  background: var(--paper);
}
:root[data-theme="dark"] .room-callout,
:root[data-theme="dark"] .daily-leaderboard,
:root[data-theme="dark"] .home-search-panel,
:root[data-theme="dark"] .auth-layout,
:root[data-theme="dark"] .unit-card,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .room-score-column,
:root[data-theme="dark"] .room-question-timer,
:root[data-theme="dark"] .completion-card,
:root[data-theme="dark"] .shared-completion,
:root[data-theme="dark"] .review-unit-list article,
:root[data-theme="dark"] .review-tabs,
:root[data-theme="dark"] .review-batch-card,
:root[data-theme="dark"] .exam-review-list article,
:root[data-theme="dark"] .difficult-set,
:root[data-theme="dark"] .difficult-unit header,
:root[data-theme="dark"] .difficult-word-list button,
:root[data-theme="dark"] .lookup-dialog,
:root[data-theme="dark"] .resume-dialog,
:root[data-theme="dark"] .flashcard,
:root[data-theme="dark"] .speaking-section,
:root[data-theme="dark"] .speaking-grid > button,
:root[data-theme="dark"] .speaking-grid > p,
:root[data-theme="dark"] .exercise-progress-card,
:root[data-theme="dark"] .exercise-start-card,
:root[data-theme="dark"] .exam-gap-control,
:root[data-theme="dark"] .exam-option-bank article,
:root[data-theme="dark"] .exam-listening-options button,
:root[data-theme="dark"] .stats-grid article,
:root[data-theme="dark"] .profile-panel,
:root[data-theme="dark"] .room-actions article,
:root[data-theme="dark"] .room-actions form,
:root[data-theme="dark"] .room-dashboard,
:root[data-theme="dark"] .admin-stats article,
:root[data-theme="dark"] .admin-panel,
:root[data-theme="dark"] .member-manage,
:root[data-theme="dark"] .admin-actions input,
:root[data-theme="dark"] .admin-actions select,
:root[data-theme="dark"] .admin-actions button {
  background: var(--paper);
}
:root[data-theme="dark"] .topic-section,
:root[data-theme="dark"] .empty {
  background: rgba(24, 24, 27, .78);
}
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .auth-card input,
:root[data-theme="dark"] .write-form input,
:root[data-theme="dark"] .exercise-inline-input,
:root[data-theme="dark"] .exercise-inline-select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  color: var(--ink);
  background: #121214;
}
:root[data-theme="dark"] .secondary-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .daily-rank-card,
:root[data-theme="dark"] .daily-ranking-empty,
:root[data-theme="dark"] .recent-results article,
:root[data-theme="dark"] .lesson-note,
:root[data-theme="dark"] .lesson-example,
:root[data-theme="dark"] .context-prompt,
:root[data-theme="dark"] .room-score-column header,
:root[data-theme="dark"] .room-question-timer header,
:root[data-theme="dark"] .exam-reading-passage,
:root[data-theme="dark"] .exam-listening-question,
:root[data-theme="dark"] .exercise-stimulus,
:root[data-theme="dark"] .exercise-reference {
  background: #18181b;
}
:root[data-theme="dark"] .review-callout,
:root[data-theme="dark"] .exercise-unit-card,
:root[data-theme="dark"] .exercise-invite,
:root[data-theme="dark"] .exercise-next {
  background: var(--paper);
}
:root[data-theme="dark"] .daily-rank-card.rank-1,
:root[data-theme="dark"] .exam-listening-audio,
:root[data-theme="dark"] .exam-overview-points {
  background: #27272a;
}
:root[data-theme="dark"] .audio-button {
  background: var(--paper);
}
:root[data-theme="dark"] .sentence-build {
  background: #18181b;
}
:root[data-theme="dark"] .sentence-build button,
:root[data-theme="dark"] .tile-bank button {
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .exam-reading-passage header {
  background: rgba(24, 24, 27, .97);
}
:root[data-theme="dark"] .exercise-submit-bar {
  background: rgba(24, 24, 27, .95);
}
:root[data-theme="dark"] .accuracy-donut::before {
  background: var(--paper);
}
:root[data-theme="dark"] .coral,
:root[data-theme="dark"] .amber,
:root[data-theme="dark"] .teal {
  --card-accent: var(--ink);
  --card-soft: var(--teal-soft);
}
:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .room-hero {
  background: #18181b;
}
:root[data-theme="dark"] .auth-story {
  background: #18181b;
}
:root[data-theme="dark"] .page-banner {
  background: var(--paper);
  box-shadow: var(--shadow);
}
:root[data-theme="dark"] .room-callout-icon,
:root[data-theme="dark"] .room-avatar,
:root[data-theme="dark"] .admin-avatar {
  background: var(--paper-hover);
  color: var(--ink);
  box-shadow: var(--shadow-btn);
}
:root[data-theme="dark"] .primary-link,
:root[data-theme="dark"] .primary-button {
  color: var(--page);
  background: var(--ink);
  box-shadow: var(--shadow-btn);
}
:root[data-theme="dark"] .nav-button span {
  color: var(--ink);
  background: var(--teal-soft);
  box-shadow: none;
}
:root[data-theme="dark"] .word-card,
:root[data-theme="dark"] .detail-block,
:root[data-theme="dark"] .preview-word-card,
:root[data-theme="dark"] .rating-grid button,
:root[data-theme="dark"] .translation-gate,
:root[data-theme="dark"] .custom-callout,
:root[data-theme="dark"] .guest-callout,
:root[data-theme="dark"] .guest-learning-note,
:root[data-theme="dark"] .room-members article,
:root[data-theme="dark"] .profile-analysis,
:root[data-theme="dark"] .profile-chart-card,
:root[data-theme="dark"] .room-lesson-gate,
:root[data-theme="dark"] .wrong-grid article,
:root[data-theme="dark"] .admin-user {
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .profile-analysis-summary article,
:root[data-theme="dark"] .required-expression {
  color: var(--ink);
  background: #121214;
}
:root[data-theme="dark"] .progress-track,
:root[data-theme="dark"] .profile-course-track,
:root[data-theme="dark"] .profile-grade-strip i {
  background: #27272a;
}
:root[data-theme="dark"] .room-score-head,
:root[data-theme="dark"] .room-score-row.is-current {
  background: #18181b;
}
:root[data-theme="dark"] .room-score-row {
  border-color: var(--line);
}
:root[data-theme="dark"] .score-correct,
:root[data-theme="dark"] .exercise-feedback.correct,
:root[data-theme="dark"] .answer-feedback.correct {
  color: #fafafa;
  background: #27272a;
  border: 1px solid #3f3f46;
}
:root[data-theme="dark"] .score-wrong,
:root[data-theme="dark"] .exercise-feedback.wrong,
:root[data-theme="dark"] .answer-feedback.wrong {
  color: #fafafa;
  background: #27272a;
  border: 1px solid #3f3f46;
}
:root[data-theme="dark"] .score-locked {
  color: var(--muted);
  background: #18181b;
}
:root[data-theme="dark"] .score-pending,
:root[data-theme="dark"] .exercise-feedback.manual {
  color: var(--muted);
  background: #18181b;
}
:root[data-theme="dark"] .lesson-card.result-correct {
  border-color: #fafafa;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .3), var(--shadow);
}
:root[data-theme="dark"] .lesson-card.result-wrong {
  border-color: #71717a;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .15), var(--shadow);
}
:root[data-theme="dark"] .answer-value small,
:root[data-theme="dark"] .answer-value strong {
  color: #a1a1aa;
}
:root[data-theme="dark"] .room-waiting {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .room-leave-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .room-question-timer small {
  color: var(--muted);
}
:root[data-theme="dark"] .icon-button.saved {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] .exam-source-warning {
  border-color: var(--line);
  color: var(--muted);
  background: #18181b;
}
:root[data-theme="dark"] .exercise-notice {
  border-color: var(--line);
  color: var(--ink);
  background: #18181b;
}
:root[data-theme="dark"] .coming-soon-notice {
  border-color: var(--line);
  color: var(--muted);
  background: #18181b;
}
:root[data-theme="dark"] .coming-soon-notice strong,
:root[data-theme="dark"] .set-card.coming-soon > .tag {
  color: #fafafa;
  background: #27272a;
}
:root[data-theme="dark"] .admin-user.locked {
  border-color: var(--line);
  background: #18181b;
}
:root[data-theme="dark"] .admin-user-main em {
  color: var(--muted);
  background: #27272a;
}
:root[data-theme="dark"] .admin-user.locked .admin-user-main em {
  color: var(--muted);
  background: #27272a;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #71717a;
  opacity: 1;
}
:root[data-theme="dark"] .form-error,
:root[data-theme="dark"] .form-status.error {
  color: #a1a1aa;
}
:root[data-theme="dark"] .form-status.success {
  color: #fafafa;
}
:root[data-theme="dark"] .set-card,
:root[data-theme="dark"] .lesson-card {
  border-color: var(--line);
}
:root[data-theme="dark"] .review-queue-panel,
:root[data-theme="dark"] .exercise-section,
:root[data-theme="dark"] .supplement-entry {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}
:root[data-theme="dark"] .review-queue-panel.almost {
  background: var(--paper);
  border-color: var(--line);
}
:root[data-theme="dark"] .review-queue-panel.almost .review-queue-heading > strong,
:root[data-theme="dark"] .review-queue-panel.almost .review-word-chips span {
  color: #fafafa;
  background: #27272a;
}
:root[data-theme="dark"] .difficult-unit,
:root[data-theme="dark"] .preview-word-card,
:root[data-theme="dark"] .sentence-answer,
:root[data-theme="dark"] .no-award,
:root[data-theme="dark"] .exam-explanation,
:root[data-theme="dark"] .exam-audio-source details {
  color: var(--ink);
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .shared-player-score.is-you {
  background: #27272a;
  border-color: #3f3f46;
}
:root[data-theme="dark"] .exercise-unit-card,
:root[data-theme="dark"] .supplement-unit-card,
:root[data-theme="dark"] .supplement-invite,
:root[data-theme="dark"] .supplement-page-card {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}
:root[data-theme="dark"] .supplement-page-card:hover {
  border-color: #71717a;
}
:root[data-theme="dark"] .supplement-page-glyph,
:root[data-theme="dark"] .supplement-unit-card .unit-number,
:root[data-theme="dark"] .supplement-entry-head > span {
  color: #fafafa;
  background: #27272a;
}
:root[data-theme="dark"] .supplement-page-card small,
:root[data-theme="dark"] .supplement-page-arrow,
:root[data-theme="dark"] .supplement-section > header small,
:root[data-theme="dark"] .supplement-section > header > strong,
:root[data-theme="dark"] .supplement-examples > strong {
  color: #a1a1aa;
}
:root[data-theme="dark"] .supplement-meaning {
  color: #d4d4d8;
}
:root[data-theme="dark"] .supplement-nav a {
  color: #a1a1aa;
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .supplement-nav a:hover,
:root[data-theme="dark"] .supplement-nav a.active {
  color: #fafafa;
  background: #27272a;
}
:root[data-theme="dark"] .exercise-section > header,
:root[data-theme="dark"] .exercise-word-bank {
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .exercise-question + .exercise-question {
  border-color: var(--line);
}
:root[data-theme="dark"] .exercise-word-bank span {
  color: #fafafa;
  background: #27272a;
  border-color: #3f3f46;
}
:root[data-theme="dark"] .exercise-stimulus.audio,
:root[data-theme="dark"] .exam-audio-source details {
  color: var(--ink);
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .exercise-stimulus.missing,
:root[data-theme="dark"] .exercise-data-warning {
  color: #a1a1aa;
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .exercise-stimulus.missing p {
  color: #a1a1aa;
}
:root[data-theme="dark"] .exam-overview-points {
  color: #fafafa;
  border-color: var(--line);
}
:root[data-theme="dark"] .exam-listening-question.is-correct,
:root[data-theme="dark"] .exam-gap-control.is-correct {
  background: #18181b;
  border-color: #fafafa;
}
:root[data-theme="dark"] .exam-listening-question.is-wrong,
:root[data-theme="dark"] .exam-gap-control.is-wrong {
  background: #18181b;
  border-color: #71717a;
}
:root[data-theme="dark"] .exam-gap-control select,
:root[data-theme="dark"] .password-form input {
  color: var(--ink);
  background: #121214;
  border-color: var(--line);
}
:root[data-theme="dark"] .matching-column > button,
:root[data-theme="dark"] .matching-column > button.paired {
  color: var(--ink);
  background: #18181b;
  border-color: var(--line);
}
:root[data-theme="dark"] .matching-column > button.match-wrong,
:root[data-theme="dark"] .sentence-build.wrong {
  color: #a1a1aa;
  background: #18181b;
  border-color: #71717a;
}
:root[data-theme="dark"] .room-leave-button,
:root[data-theme="dark"] .lesson-leave-link {
  color: #a1a1aa;
}
:root[data-theme="dark"] .room-leave-button:hover,
:root[data-theme="dark"] .lesson-leave-link:hover {
  color: #fafafa;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #71717a;
}
:root[data-theme="dark"] input:focus-visible,
:root[data-theme="dark"] select:focus-visible,
:root[data-theme="dark"] textarea:focus-visible,
:root[data-theme="dark"] button:focus-visible,
:root[data-theme="dark"] a:focus-visible {
  outline: 2px solid #fafafa;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *:not(.x-loader-wrapper):not(.x-loader-wrapper *),
  *:not(.x-loader-wrapper):not(.x-loader-wrapper *)::before,
  *:not(.x-loader-wrapper):not(.x-loader-wrapper *)::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 900px) {
  .lesson-room-layout { display: block; max-width: 760px; }
  .room-score-column, .room-question-timer { position: static; width: min(100%, 760px); margin: 0 auto 12px; }
  .room-score-column { max-height: 158px; }
  .room-score-rows { max-height: 96px; }
  .room-question-timer { margin-top: 12px; }
  .set-grid { grid-template-columns: 1fr 1fr; }
  .unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-summary { grid-template-columns: 72px 1fr auto; }
  .word-meaning { grid-column: 2 / 3; }
  .word-actions { grid-column: 3; grid-row: 1 / 3; }
  .word-details { padding-left: 19px; }
  .admin-users { grid-template-columns: 1fr; }
  .member-profile-stats { grid-template-columns: repeat(3, 1fr); }
  .exercise-question { padding-inline: 16px; }
  .admin-actions { grid-template-columns: 1fr 1fr; }
  .difficult-word-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-flow { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  body { background-attachment: scroll; }
  .topbar { gap: 8px; min-height: 60px; padding: 8px 10px; }
  .brand { gap: 7px; min-width: 0; }
  .brand-mark { width: 38px; height: 38px; background: transparent !important; border: none !important; box-shadow: none !important; }
  .brand-mark .x-loader-wrapper { transform: scale(0.27); }
  .brand strong { max-width: 106px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .study-room-bar { top: 60px; padding-inline: 14px; }
  .study-room-bar > div > span:not(.room-live-dot) { display: none; }
  .brand small, .topbar nav > a, .user-nav strong { display: none; }
  nav { min-width: 0; max-width: calc(100vw - 154px); gap: 2px; overflow-x: auto; font-size: 10px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  .nav-button { flex: 0 0 auto; min-height: 40px; padding: 5px 7px; }
  .nav-button span { min-width: 19px; height: 19px; }
  .theme-toggle b { display: none; }
  .theme-toggle span { width: 28px; height: 28px; }
  .user-nav { gap: 3px; padding-left: 3px; }
  .user-nav button { min-height: 40px; font-size: 9px; }
  .app-shell { width: min(100% - 16px, 1180px); padding-top: 14px; }
  .hero { padding: 28px 22px; border-radius: 0px; }
  .hero::after { right: -24px; font-size: 145px; }
  .set-grid { grid-template-columns: 1fr; }
  .unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-banner { padding: 24px 21px; }
  .word-summary { grid-template-columns: 58px 1fr auto; gap: 10px; padding: 15px; }
  .word-main { min-width: 0; }
  .word-main strong, .word-main span { overflow-wrap: anywhere; }
  .word-actions { gap: 4px; }
  .icon-button { width: 40px; height: 40px; }
  .hanzi { font-size: 24px; }
  .word-details { grid-template-columns: 1fr; padding: 0 15px 15px; }
  .detail-block.full { grid-column: auto; }
  .flashcard { min-height: 420px; padding: 25px 18px; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-story { min-height: 300px; padding: 32px 24px; }
  .auth-story h1 { font-size: 35px; }
  .auth-card { padding: 32px 24px; }
  .auth-page .app-shell { padding: 8px 0; }
  .auth-page .auth-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); max-width: 380px; }
  .auth-page .auth-story, .auth-page .auth-brand-pane { min-height: 0; padding: 18px 20px; border-right: none; border-bottom: 1px solid var(--line); }
  .auth-page .auth-large-logo { width: 56px; height: 56px; margin: 0 auto 6px; }
  .auth-page .auth-large-logo .x-loader-wrapper { transform: scale(0.42); }
  .auth-page .auth-brand-title { font-size: 24px; margin-bottom: 2px; }
  .auth-page .auth-brand-badge { margin-bottom: 10px; font-size: 9px; padding: 2px 6px; }
  .auth-page .auth-brand-tagline, .auth-page .auth-brand-pane .method-strip { display: none; }
  .auth-page .auth-form-pane { padding: 20px 14px; }
  .auth-page .auth-card { min-height: 0; padding: 18px 22px; }
  .lesson-invite { align-items: stretch; flex-direction: column; }
  .lesson-invite { display: flex; }
  .choice-grid { grid-template-columns: 1fr; }
  .rating-grid { grid-template-columns: 1fr 1fr; }
  .lesson-card { min-height: 500px; padding: 25px 18px; }
  .shared-scoreboard { grid-template-columns: 1fr; }
  .personal-room-result, .shared-completion-actions { align-items: stretch; flex-direction: column; }
  .shared-completion { padding: 38px 19px; }
  .answer-feedback { padding: 16px 14px; }
  .answer-value strong { font-size: 27px; }
  .review-callout, .review-unit-list article { align-items: stretch; flex-direction: column; }
  .review-queue-heading { flex-direction: column; }
  .review-batch-card { grid-template-columns: auto 1fr; }
  .review-batch-card .primary-link { grid-column: 1 / -1; text-align: center; }
  .exam-review-list article { grid-template-columns: 1fr; }
  .exam-review-list .primary-link { text-align: center; }
  .home-search-panel { grid-template-columns: 1fr; gap: 16px; }
  .daily-leaderboard-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .daily-ranking { grid-template-columns: 1fr; }
  .room-callout { align-items: stretch; flex-direction: column; }
  .guest-callout { align-items: stretch; flex-direction: column; }
  .guest-callout > div { align-items: flex-start; }
  .guest-callout .primary-button { width: 100%; }
  .room-actions, .room-members { grid-template-columns: 1fr; }
  .room-actions form { grid-template-columns: 1fr; }
  .room-actions form h2, .room-actions form p, .room-actions form .form-error { grid-column: auto; }
  .room-dashboard-actions { align-items: stretch; flex-direction: column; }
  .difficult-word-list { grid-template-columns: 1fr; }
  .custom-callout { align-items: stretch; flex-direction: column; }
  .preview-words { grid-template-columns: 1fr; }
  .context-prompt.interactive-sentence { font-size: 21px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .wrong-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-actions { grid-template-columns: 1fr; }
  .member-directory-head, .admin-member-hero { align-items: stretch; flex-direction: column; }
  .member-directory-head .search-box { flex-basis: auto; width: 100%; }
  .member-card-side { justify-items: start; }
  .admin-user-main { align-items: flex-start; flex-wrap: wrap; }
  .member-profile-stats { grid-template-columns: 1fr 1fr; }
  .admin-member-sections { grid-template-columns: 1fr; }
  .exam-reading-passage { max-height: 260px; }
  .exam-group-passage { max-height: 390px; }
  .exam-option-bank { grid-template-columns: 1fr; }
  .exam-listening-audio { position: static; grid-template-columns: 1fr; }
  .exam-listening-audio .audio-button { justify-self: stretch; }
  .exam-listening-options { grid-template-columns: 1fr; }
  .exercise-submit-bar .primary-button, .exercise-next .primary-link { width: 100%; text-align: center; }
  .exercise-question { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; padding: 15px 12px; }
  .exercise-inline-input { width: min(145px, 45vw); }
  .sentence-pinyin { font-size: 18px; }
  .sentence-translation { font-size: 16px; }
  .result-stats { grid-template-columns: 1fr; }
  .result-chart-grid { grid-template-columns: 1fr; justify-items: center; }
  .result-bars { width: 100%; }
  .result-bar-row { grid-template-columns: minmax(90px, 1fr) minmax(70px, 1.1fr) 38px; gap: 7px; }
  .profile-analysis { padding: 18px 14px; }
  .profile-analysis .section-title { align-items: flex-start; }
  .analysis-accuracy { min-width: 72px; font-size: 23px; }
  .profile-analysis-summary { grid-template-columns: 1fr; }
  .profile-analysis-grid { grid-template-columns: 1fr; }
  .profile-grade-strip { grid-template-columns: 1fr; }
  .lesson-pause-overlay section { padding: 32px 20px; }
  .completion-card { margin-block: 20px; padding: 38px 17px; }
}

@media (max-width: 390px) {
  .brand strong { display: none; }
  nav { max-width: calc(100vw - 62px); }
  .hero h1 { font-size: 27px; }
  .unit-grid { grid-template-columns: 1fr; }
  .word-summary { grid-template-columns: 51px minmax(0, 1fr) auto; padding: 12px 10px; }
  .word-actions .chevron { display: none; }
  .result-bar-row { grid-template-columns: minmax(88px, 1fr) minmax(62px, .8fr) 36px; }
}

@media (max-height: 700px) {
  .auth-page .topbar { min-height: 52px; padding-top: 5px; padding-bottom: 5px; }
  .auth-page .app-shell { padding: 6px 0; }
  .auth-page footer { padding: 10px 12px; }
  .auth-page .footer-links { margin-bottom: 4px; }
  .auth-page .auth-story { padding: 12px 20px; }
  .auth-page .auth-story h1 { font-size: clamp(20px, 3vw, 38px); }
  .auth-page .auth-story > p:not(.eyebrow) { margin: 8px 0 0; line-height: 1.4; }
  .auth-page .method-strip { margin-top: 12px; }
  .auth-page .method-strip span { padding: 6px 9px; }
  .auth-page .auth-card { padding: 12px 20px; }
  .auth-page .auth-card .eyebrow { margin-bottom: 3px; font-size: 10px; }
  .auth-page .auth-card h2 { margin: 0 0 10px; font-size: 22px; }
  .auth-page .auth-card label { gap: 3px; margin-bottom: 8px; }
  .auth-page .auth-card input { padding: 8px 10px; border-radius: 0px; font-size: 14px; }
  .auth-page .auth-help-links { margin-top: 7px; }
  .auth-page .auth-card .auth-help-links .text-button { padding: 3px 1px; font-size: 10px; }
  .auth-page .auth-card .forgot-password-message { margin-top: 5px; padding: 6px 8px; }
}

@media (max-width: 650px) and (max-height: 600px) {
  .auth-page .auth-layout { grid-template-rows: minmax(0, 1fr); }
  .auth-page .auth-story { display: none; }
}

@media (min-width: 651px) and (max-height: 450px) {
  .auth-page .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-page .auth-story { display: none; }
  .auth-page .auth-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 5px 14px; padding: 8px 24px; }
  .auth-page .auth-card > .eyebrow, .auth-page .auth-card h2, .auth-page .auth-card .form-error,
  .auth-page .auth-card .primary-button, .auth-page .auth-help-links, .auth-page .forgot-password-message { grid-column: 1 / -1; }
  .auth-page .auth-card h2, .auth-page .auth-card label, .auth-page .auth-help-links { margin-bottom: 0; }
  .auth-page .auth-card .auth-help-links { margin-top: 0; }
}
/* ==========================================================================
   Account card adapted from andrew-demchenk0's afraid-cougar-9 (Uiverse)
   Source: https://uiverse.io/andrew-demchenk0/afraid-cougar-9
   MIT License: docs/licenses/uiverse-auth-form.txt
   ========================================================================== */

body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  background-color: var(--page);
  background-image: var(--subtle-grid);
  background-size: 20px 20px;
}

body.auth-page #islandDock,
body.auth-page .topbar,
body.auth-page footer,
body.auth-page #studyRoomBar {
  display: none !important;
}

body.auth-page .app-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 30px 16px;
  box-sizing: border-box;
}

.auth-brand-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(30px, 5vw, 48px) clamp(24px, 4vw, 40px);
  color: #fafafa;
  background: #191919;
  border-right: 1px solid var(--line);
  text-align: center;
  box-sizing: border-box;
  position: relative;
}

.auth-brand-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--moss-green);
  margin-bottom: 20px;
  text-transform: uppercase;
  border: 1px solid rgba(46, 111, 64, 0.5);
  padding: 4px 10px;
  border-radius: 0px;
  background: rgba(46, 111, 64, 0.12);
}

.auth-brand-logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}

.auth-large-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  position: relative;
}

.auth-large-logo .x-loader-wrapper {
  transform: scale(0.68);
  transform-origin: center center;
}

.auth-brand-heading {
  text-align: center;
}

.auth-brand-title {
  margin: 0 0 6px 0;
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1.05;
  font-weight: 400;
  color: #FAF8F5;
  letter-spacing: -0.5px;
}

.auth-brand-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #A8A39D;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-brand-tagline {
  max-width: 320px;
  margin: 0 0 20px 0;
  color: #8C8881;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.auth-brand-pane .method-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.auth-brand-pane .method-strip span {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-family: var(--font-mono);
  color: #FAF8F5;
}

:root[data-theme="dark"] .auth-brand-pane {
  background: #141414;
  border-right-color: var(--line);
}

.auth-form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 36px);
  background: var(--paper);
  box-sizing: border-box;
}

.auth-wrapper {
  --input-focus: var(--moss-green);
  --font-color: var(--ink);
  --font-color-sub: var(--muted);
  --bg-color: var(--paper);
  --bg-color-alt: #191919;
  --main-color: var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.card-switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Switch Container - Luôn hiển thị rõ ràng trên đỉnh Card */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
  z-index: 10;
}

.switch-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--font-color-sub);
  cursor: pointer;
  user-select: none;
  transition: all 0.1s ease;
  padding: 4px 6px;
  text-decoration: none;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.switch-label.active {
  color: var(--ink);
  border-bottom: 2px solid var(--line);
}

/* Nút trượt Switch - Retro Mechanical */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 22px;
  margin: 0;
  cursor: pointer;
}

.toggle {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  box-sizing: border-box;
  border-radius: 0px;
  border: 1px solid var(--main-color);
  box-shadow: 2px 2px 0px var(--main-color);
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  transition: 0.2s;
}

.slider:before {
  box-sizing: border-box;
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  border: 1px solid var(--main-color);
  border-radius: 0px;
  left: 1px;
  bottom: 1px;
  background-color: #191919;
  transition: transform 0.2s cubic-bezier(0.2, 0.85, 0.32, 1.2);
}

.toggle:checked + .slider {
  background-color: var(--paper-hover);
}

.toggle:checked + .slider:before {
  transform: translateX(26px);
  background-color: var(--moss-green);
}

/* 3D Flip Card Container */
.flip-card__inner {
  width: 330px;
  min-height: 440px;
  position: relative;
  background-color: transparent;
  perspective: 1000px;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.2, 0.65, 0.3, 1);
  transform-style: preserve-3d;
  cursor: default;
}

.card-switch.is-register .flip-card__inner,
.card-switch:has(.toggle:checked) .flip-card__inner {
  transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
  padding: 24px 20px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: var(--paper);
  gap: 16px;
  border-radius: 0px;
  border: 1px solid var(--main-color);
  box-shadow: 4px 4px 0px var(--main-color);
  box-sizing: border-box;
}

.flip-card__back {
  width: 100%;
  transform: rotateY(180deg);
}

.flip-card__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.flip-card__front .title,
.flip-card__back .title {
  margin: 6px 0 10px 0;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  text-align: center;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.flip-card__input {
  width: 260px;
  height: 40px;
  border-radius: 0px;
  border: 1px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 2px 2px 0px var(--main-color);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--font-color);
  padding: 5px 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.flip-card__input::placeholder {
  color: var(--font-color-sub);
  opacity: 0.8;
}

.flip-card__input:focus {
  border: 1px solid var(--input-focus);
  outline: 2px solid var(--input-focus);
}

.flip-card__btn {
  margin: 12px 0 6px 0;
  width: 140px;
  height: 42px;
  border-radius: 0px;
  border: 1px solid var(--main-color);
  background-color: #191919;
  box-shadow: 2px 2px 0px var(--main-color);
  font-size: 12px;
  font-weight: 700;
  color: #FAF8F5;
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background-color 0.1s ease;
}

.flip-card__btn:hover {
  background-color: var(--moss-green);
}

.flip-card__btn:active {
  box-shadow: 0px 0px var(--main-color);
  transform: translate(2px, 2px);
}

.flip-card__btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.flip-card__error {
  margin: 0;
  color: var(--brick-red);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1.4;
  max-width: 260px;
  word-break: break-word;
  text-align: center;
}

.flip-card__error:empty {
  display: none;
}

.flip-card__sublink {
  background: transparent;
  border: 0;
  color: var(--font-color-sub);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.flip-card__sublink:hover {
  color: var(--ink);
}

.flip-card__note {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--font-color);
  font-family: var(--font-mono);
}

/* Dark Mode Theme */
:root[data-theme="dark"] body.auth-page {
  background-color: var(--page);
}

:root[data-theme="dark"] .auth-wrapper {
  --input-focus: var(--moss-green);
  --font-color: #FAF8F5;
  --font-color-sub: #A39E93;
  --bg-color: var(--paper);
  --bg-color-alt: #161514;
  --main-color: var(--line);
}

:root[data-theme="dark"] .flip-card__btn {
  border-color: var(--line);
  background-color: #FAF8F5;
  box-shadow: 2px 2px 0px #000;
  color: #191919;
}

:root[data-theme="dark"] .flip-card__btn:hover {
  background-color: #68B67B;
}

:root[data-theme="dark"] .flip-card__btn:active {
  box-shadow: 0px 0px #000;
  transform: translate(2px, 2px);
}

:root[data-theme="dark"] .flip-card__front,
:root[data-theme="dark"] .flip-card__back {
  background: var(--paper);
}

:root[data-theme="dark"] .flip-card__error {
  color: #f87171;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .slider,
  .slider:before,
  .flip-card__inner,
  .flip-card__btn {
    transition: none !important;
  }
}

/* ========================================================
   XIN HSK X-LOADER & SPLASH PRELOADER (massive-falcon-52)
   ======================================================== */
.x-loader-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.Strich1 {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -25px;
  margin-left: -65px;
  width: 130px;
  height: 50px;
  background: #000;
  border-radius: 25px;
  transform: rotate(45deg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 0;
}

.Strich2 {
  position: absolute;
  top: 0;
  left: 0;
  width: 130px;
  height: 50px;
  background: #000;
  border-radius: 25px;
  transform: rotate(-90deg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 0;
}

:root[data-theme="dark"] .Strich1,
:root[data-theme="dark"] .Strich2 {
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@-webkit-keyframes dropAndShift {
  0% {
    -webkit-transform: translate(0px, 15px);
    transform: translate(0px, 15px);
  }
  16.67% {
    -webkit-transform: translate(80px, 13px);
    transform: translate(80px, 13px);
  }
  33.34% {
    -webkit-transform: translate(40px, 10px);
    transform: translate(40px, 10px);
  }
  50.01% {
    -webkit-transform: translate(40px, -30px);
    transform: translate(40px, -30px);
  }
  66.68% {
    -webkit-transform: translate(40px, 55px);
    transform: translate(40px, 55px);
  }
  83.35% {
    -webkit-transform: translate(40px, 10px);
    transform: translate(40px, 10px);
  }
  100% {
    -webkit-transform: translate(0px, 15px);
    transform: translate(0px, 15px);
  }
}

@keyframes dropAndShift {
  0% {
    -webkit-transform: translate(0px, 15px);
    transform: translate(0px, 15px);
  }
  16.67% {
    -webkit-transform: translate(80px, 13px);
    transform: translate(80px, 13px);
  }
  33.34% {
    -webkit-transform: translate(40px, 10px);
    transform: translate(40px, 10px);
  }
  50.01% {
    -webkit-transform: translate(40px, -30px);
    transform: translate(40px, -30px);
  }
  66.68% {
    -webkit-transform: translate(40px, 55px);
    transform: translate(40px, 55px);
  }
  83.35% {
    -webkit-transform: translate(40px, 10px);
    transform: translate(40px, 10px);
  }
  100% {
    -webkit-transform: translate(0px, 15px);
    transform: translate(0px, 15px);
  }
}

.bubble, .bubble1, .bubble2, .bubble3, .bubble4 {
  position: absolute;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  pointer-events: none;
  will-change: transform;
  -webkit-animation-play-state: running !important;
  animation-play-state: running !important;
}

.bubble {
  left: 15px;
  background: radial-gradient(circle at 30% 30%, #ffb3c1, #e64980, #ff8787);
  -webkit-animation: dropAndShift 5.6s ease-in-out infinite 0s !important;
  animation: dropAndShift 5.6s ease-in-out infinite 0s !important;
  z-index: 1;
}

.bubble1 {
  left: 8px;
  background: radial-gradient(circle at 30% 30%, #edb3ff, #ac49e6, #fb87ff);
  -webkit-animation: dropAndShift 6.4s ease-in-out infinite -1.2s !important;
  animation: dropAndShift 6.4s ease-in-out infinite -1.2s !important;
  z-index: 2;
}

.bubble2 {
  left: 12px;
  background: radial-gradient(circle at 30% 30%, #b3d8ff, #4963e6, #87a7ff);
  -webkit-animation: dropAndShift 5.0s ease-in-out infinite -2.4s !important;
  animation: dropAndShift 5.0s ease-in-out infinite -2.4s !important;
  z-index: 3;
}

.bubble3 {
  left: 10px;
  background: radial-gradient(circle at 30% 30%, #b3ffbc, #35a32f, #75ba61);
  -webkit-animation: dropAndShift 6.8s ease-in-out infinite -3.6s !important;
  animation: dropAndShift 6.8s ease-in-out infinite -3.6s !important;
  z-index: 4;
}

.bubble4 {
  left: 14px;
  background: radial-gradient(circle at 30% 30%, #ffd8a8, #fd7e14, #ffa94d);
  -webkit-animation: dropAndShift 6.0s ease-in-out infinite -4.8s !important;
  animation: dropAndShift 6.0s ease-in-out infinite -4.8s !important;
  z-index: 5;
}

/* Splash Preloader & Fullscreen Data Loading */
.splash-preloader,
.loading-panel {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] .splash-preloader,
:root[data-theme="dark"] .loading-panel {
  background: #09090b;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.splash-preloader .x-loader-wrapper,
.loading-panel .x-loader-wrapper {
  transform: scale(1.05);
}

.splash-brand {
  text-align: center;
}

.splash-brand strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #18181b;
}

:root[data-theme="dark"] .splash-brand strong {
  color: #f4f4f5;
}

.splash-brand span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #71717a;
  letter-spacing: 0.01em;
}

.splash-preloader.fade-out,
.loading-panel.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ==========================================================================
   Exam Completion: Aligned Final Answers List & Wrong Answer Highlighting
   ========================================================================== */
.exam-final-answers {
  width: 100%;
  max-width: 760px;
  margin: 32px auto 0;
  text-align: left;
}

.exam-final-answers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.exam-final-answers-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.exam-final-stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.stat-pill.stat-correct {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-pill.stat-wrong {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.stat-pill.stat-missing {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.exam-final-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.exam-final-answer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: all 0.2s ease;
}

.exam-final-answer:hover {
  border-color: var(--line-strong, #a1a1aa);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Nổi bật câu trả lời sai */
.exam-final-answer.is-wrong {
  border-left: 5px solid #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.35);
  background: #fff8f8;
}

.exam-final-answer.is-wrong:hover {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.14);
}

:root[data-theme="dark"] .exam-final-answer.is-wrong {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.35);
}

:root[data-theme="dark"] .exam-final-answer.is-wrong:hover {
  border-color: rgba(239, 68, 68, 0.65);
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.25);
}

/* Căn chỉnh thẳng hàng thanh tóm tắt */
.exam-final-summary {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  outline: none;
  transition: background 0.15s ease;
}

.exam-final-summary::-webkit-details-marker {
  display: none;
}

.exam-final-summary:hover {
  background: var(--paper-hover);
}

.exam-final-answer.is-wrong .exam-final-summary:hover {
  background: rgba(239, 68, 68, 0.06);
}

.exam-final-col-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-final-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.exam-final-answer[open] .exam-final-chevron {
  transform: rotate(90deg);
}

.exam-final-qnum {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.exam-final-answer.is-wrong .exam-final-qnum {
  color: #dc2626;
  font-weight: 800;
}

:root[data-theme="dark"] .exam-final-answer.is-wrong .exam-final-qnum {
  color: #f87171;
}

.exam-final-col-mid {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-final-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preview-chosen strong {
  color: var(--ink);
}

.exam-final-answer.is-wrong .preview-chosen strong {
  color: #dc2626;
  text-decoration: line-through;
}

:root[data-theme="dark"] .exam-final-answer.is-wrong .preview-chosen strong {
  color: #fca5a5;
}

.preview-arrow {
  color: var(--muted);
  font-weight: 700;
}

.preview-correct strong {
  color: #059669;
  font-weight: 700;
}

:root[data-theme="dark"] .preview-correct strong {
  color: #34d399;
}

.exam-final-col-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 86px;
}

.exam-final-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3.5px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 76px;
  text-align: center;
  letter-spacing: 0.02em;
}

.badge-correct {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

:root[data-theme="dark"] .badge-correct {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.badge-wrong {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.12);
}

:root[data-theme="dark"] .badge-wrong {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.badge-missing {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-manual {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Chi tiết câu hỏi khi mở rộng */
.exam-review-content {
  padding: 16px 20px 20px 36px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

:root[data-theme="dark"] .exam-review-content {
  background: rgba(0, 0, 0, 0.2);
}

.exam-review-prompt {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 14px;
  font-weight: 500;
  color: var(--ink);
}

.exam-review-options {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.exam-review-options li {
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--paper);
  transition: all 0.15s ease;
}

.exam-review-options li.is-choice-wrong {
  border-color: #ef4444;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

:root[data-theme="dark"] .exam-review-options li.is-choice-wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.exam-review-options li.is-choice-correct {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 600;
}

:root[data-theme="dark"] .exam-review-options li.is-choice-correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.choice-tag {
  flex-shrink: 0;
  padding: 2.5px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.choice-tag.tag-wrong {
  background: #dc2626;
  color: #ffffff;
}

.choice-tag.tag-correct,
.choice-tag.tag-answer {
  background: #059669;
  color: #ffffff;
}

.exam-review-answers-summary {
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-review-answers-summary .answer-row {
  margin: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-review-answers-summary .val-wrong {
  color: #dc2626;
  font-weight: 700;
  text-decoration: line-through;
}

:root[data-theme="dark"] .exam-review-answers-summary .val-wrong {
  color: #f87171;
}

.exam-review-answers-summary .val-correct {
  color: #059669;
  font-weight: 700;
}

:root[data-theme="dark"] .exam-review-answers-summary .val-correct {
  color: #34d399;
}

.exam-review-stimulus {
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 14px;
}

.exam-review-stimulus strong {
  display: block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.exam-review-stimulus p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .exam-final-summary {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 12px;
  }
  .exam-review-content {
    padding: 12px 12px 16px 16px;
  }
}

/* ==========================================================================
   Day/Night Theme Switch (uiverse.io/Galahhad/strong-squid-82)
   ========================================================================== */
.theme-switch {
  --toggle-size: 11px;
  --container-width: 5.625em;
  --container-height: 2.5em;
  --container-radius: 6.25em;
  --container-light-bg: #3D7EAE;
  --container-night-bg: #1D1F2C;
  --circle-container-diameter: 3.375em;
  --sun-moon-diameter: 2.125em;
  --sun-bg: #ECCA2F;
  --moon-bg: #C4C9D1;
  --spot-color: #959DB1;
  --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
  --stars-color: #fff;
  --clouds-color: #F3FDFF;
  --back-clouds-color: #AACADF;
  --transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
  --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
  vertical-align: middle;
  margin: 0 4px;
}

.theme-switch,
.theme-switch *,
.theme-switch *::before,
.theme-switch *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: var(--toggle-size);
}

.theme-switch__checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-switch__container {
  width: var(--container-width);
  height: var(--container-height);
  background-color: var(--container-light-bg);
  border-radius: var(--container-radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
  transition: var(--transition);
  position: relative;
}

.theme-switch__container::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  border-radius: var(--container-radius);
}

.theme-switch__circle-container {
  width: var(--circle-container-diameter);
  height: var(--circle-container-diameter);
  position: absolute;
  top: var(--circle-container-offset);
  left: var(--circle-container-offset);
  border-radius: var(--container-radius);
  box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  display: flex;
  transition: var(--circle-transition);
  pointer-events: none;
}

.theme-switch__sun-moon-container {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  width: var(--sun-moon-diameter);
  height: var(--sun-moon-diameter);
  margin: auto;
  border-radius: var(--container-radius);
  background-color: var(--sun-bg);
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a18727 inset;
  transition: var(--transition);
  overflow: hidden;
}

.theme-switch__moon {
  transform: translateX(100%);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--moon-bg);
  border-radius: inherit;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  transition: var(--transition);
  overflow: hidden;
}

.theme-switch__spot {
  position: absolute;
  top: 0.75em;
  left: 0.312em;
  width: 0.75em;
  height: 0.75em;
  border-radius: var(--container-radius);
  background-color: var(--spot-color);
  box-shadow: 0em 0.031em 0.062em rgba(0, 0, 0, 0.25) inset;
}

.theme-switch__spot:nth-of-type(2) {
  width: 0.375em;
  height: 0.375em;
  top: 0.937em;
  left: 1.375em;
}

.theme-switch__spot:nth-of-type(3) {
  width: 0.25em;
  height: 0.25em;
  top: 0.312em;
  left: 0.937em;
}

.theme-switch__clouds {
  width: 1.25em;
  height: 1.25em;
  background-color: var(--clouds-color);
  border-radius: var(--container-radius);
  position: absolute;
  bottom: -0.625em;
  left: 0.312em;
  box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.312em var(--back-clouds-color), 0.5em -0.5em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.187em var(--clouds-color), 0.25em 0.375em var(--clouds-color);
  transition: var(--transition);
}

.theme-switch__stars-container {
  position: absolute;
  color: var(--stars-color);
  top: -100%;
  left: 0.312em;
  width: 2.75em;
  height: auto;
  transition: var(--transition);
}

.theme-switch__stars-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Checked State (Night Mode) */
.theme-switch__checkbox:checked + .theme-switch__container {
  background-color: var(--container-night-bg);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em);
}

.theme-switch__circle-container:hover {
  left: calc(var(--circle-container-offset) + 0.187em);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon {
  transform: translate(0);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds {
  bottom: -4.062em;
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container {
  top: 50%;
  transform: translateY(-50%);
}

/* ==========================================================================
   Announcement Toast Notification (Bottom Right)
   ========================================================================== */
.announcement-toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 36px);
}

.announcement-toast {
  pointer-events: auto;
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 4px 4px 0px var(--line);
  overflow: hidden;
  padding: 16px 18px 18px;
  animation: announcementSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(16px);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

@keyframes announcementSlideIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.announcement-toast.toast-dismissing {
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
}

.announcement-toast .toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.announcement-toast .toast-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(42, 157, 143, 0.15);
  color: #2a9d8f;
  border: 1px solid currentColor;
}

.announcement-toast.urgent .toast-badge {
  background: rgba(231, 111, 81, 0.15);
  color: #e76f51;
}

.announcement-toast .toast-close {
  background: transparent;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.announcement-toast .toast-close:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.06);
}

.announcement-toast .toast-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
  line-height: 1.35;
}

.announcement-toast .toast-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  opacity: 0.88;
  max-height: 200px;
  overflow-y: auto;
}

.announcement-toast .toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
}

.announcement-toast .toast-progress-bar {
  height: 100%;
  width: 100%;
  background: #2a9d8f;
  transform-origin: left;
  animation: announcementCountdown 5s linear forwards;
}

.announcement-toast.urgent .toast-progress-bar {
  background: #e76f51;
}

.announcement-toast:hover .toast-progress-bar {
  animation-play-state: paused;
}

@keyframes announcementCountdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.announcement-list .report-card {
  width: 100%;
}

.ann-edit-box {
  background: var(--paper-hover, rgba(0, 0, 0, 0.02));
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 16px;
  margin-top: 14px;
}

.ann-edit-box h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

/* v2.2.0: Adaptive SRS Badges & AI Writing Grader */
.srs-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.srs-badge.srs-due {
  background: rgba(196, 61, 47, 0.14);
  color: var(--brick-red, #c43d2f);
}
.srs-badge.srs-mastered {
  background: rgba(46, 125, 91, 0.14);
  color: var(--moss-green, #2e7d5b);
}
.srs-badge.srs-learning {
  background: rgba(31, 111, 120, 0.12);
  color: var(--teal, #1f6f78);
}

.writing-question-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.writing-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.writing-char-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #666);
  background: var(--paper-hover, rgba(0, 0, 0, 0.04));
  padding: 4px 10px;
  border-radius: 999px;
}
.ai-grade-button {
  font-weight: 600;
  border-color: var(--teal, #1f6f78);
  color: var(--teal, #1f6f78);
}
.writing-eval-host {
  margin-top: 12px;
  width: 100%;
  text-align: left;
}
.writing-eval-card {
  border: 1px solid var(--line, rgba(0, 0, 0, 0.12));
  border-radius: 12px;
  padding: 16px;
  background: var(--paper, #fff);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  align-items: stretch;
  box-sizing: border-box;
}
.writing-eval-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}
.writing-eval-header > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.writing-eval-source-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.writing-eval-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.writing-source-engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.source-metric-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

/* Gemini badge: violet/blue */
.badge-gemini {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.14), rgba(155, 114, 203, 0.2));
  color: #1a73e8;
  border-color: rgba(66, 133, 244, 0.38) !important;
}
:root[data-theme="dark"] .badge-gemini {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.25), rgba(155, 114, 203, 0.3));
  color: #8ab4f8;
  border-color: rgba(138, 180, 248, 0.4) !important;
}

/* OpenAI badge: emerald */
.badge-openai {
  background: rgba(16, 163, 127, 0.14);
  color: #0d8a6a;
  border-color: rgba(16, 163, 127, 0.38) !important;
}
:root[data-theme="dark"] .badge-openai {
  background: rgba(16, 163, 127, 0.22);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4) !important;
}

/* Local Rubric badge: amber/bronze */
.badge-local {
  background: rgba(183, 121, 31, 0.14);
  color: #8c580c;
  border-color: rgba(183, 121, 31, 0.38) !important;
}
:root[data-theme="dark"] .badge-local {
  background: rgba(214, 158, 46, 0.18);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4) !important;
}
.writing-eval-header h4 {
  margin: 0;
  font-size: 16px;
  text-align: left;
  color: var(--ink);
}
.writing-eval-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  background: rgba(31, 111, 120, 0.1);
  padding: 6px 12px;
  border-radius: 10px;
  flex-shrink: 0;
}
.writing-eval-score strong {
  font-size: 24px;
  color: var(--teal, #1f6f78);
}
.writing-eval-Summary,
.writing-eval-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  color: var(--ink, #1d1a16);
}
.writing-eval-fallback {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--earth-yellow, #d97706);
  background: rgba(217, 119, 6, 0.08);
  color: var(--ink, #1d1a16);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.writing-eval-fallback > div {
  text-align: left;
}
.writing-eval-fallback .fallback-icon {
  font-size: 15px;
  line-height: 1.2;
}
.writing-eval-criteria {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  text-align: left;
}
.writing-criterion {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: var(--paper-hover, rgba(0, 0, 0, 0.025));
  text-align: left;
  align-items: stretch;
}
.writing-criterion-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  text-align: left;
}
.writing-criterion-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.writing-criterion-bar span {
  display: block;
  height: 100%;
  background: var(--teal, #1f6f78);
  border-radius: 999px;
}
.writing-criterion small {
  text-align: left;
  line-height: 1.4;
  color: var(--muted, #666);
}
.writing-eval-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted, #666);
  padding-top: 4px;
  border-top: 1px dashed var(--line, rgba(0, 0, 0, 0.1));
  text-align: left;
  justify-content: flex-start;
  align-items: center;
}
.writing-eval-metrics span {
  text-align: left;
}
.writing-eval-list {
  font-size: 13px;
  text-align: left;
}
.writing-eval-list strong {
  display: block;
  text-align: left;
  margin-bottom: 4px;
}
.writing-eval-list ul {
  margin: 4px 0 0 20px;
  padding: 0;
  text-align: left;
  list-style-type: disc;
}
.writing-eval-list li {
  text-align: left;
  margin-top: 4px;
  line-height: 1.5;
}
.writing-eval-list p {
  margin: 4px 0 0;
  text-align: left;
  line-height: 1.5;
}
.ai-config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
}
.ai-config-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-config-form label.exercise-done-check {
  flex-direction: row;
  align-items: center;
}

/* AI Status Card & Indicator */
.ai-status-card {
  padding: 18px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--line, rgba(0, 0, 0, 0.12));
  background: var(--paper-hover, rgba(0, 0, 0, 0.025));
  margin-bottom: 22px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.ai-status-card.status-connected {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(255, 253, 248, 0.95));
}
:root[data-theme="dark"] .ai-status-card.status-connected {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(24, 24, 27, 0.95));
  border-color: rgba(52, 211, 153, 0.4);
}
.ai-status-card.status-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(255, 253, 248, 0.95));
}
:root[data-theme="dark"] .ai-status-card.status-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(24, 24, 27, 0.95));
  border-color: rgba(248, 113, 113, 0.4);
}
.ai-status-card.status-untested {
  border-color: rgba(217, 119, 6, 0.45);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(255, 253, 248, 0.95));
}
:root[data-theme="dark"] .ai-status-card.status-untested {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.18), rgba(24, 24, 27, 0.95));
  border-color: rgba(251, 191, 36, 0.4);
}
.ai-status-card.status-disabled {
  border-color: var(--line, rgba(0, 0, 0, 0.12));
  background: var(--paper-hover, rgba(0, 0, 0, 0.03));
}
.ai-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.ai-status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.ai-status-dot.is-online {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}
.ai-status-dot.is-error {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}
.ai-status-dot.is-untested {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}
.ai-status-dot.is-disabled {
  background: #9ca3af;
}
.ai-status-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}
.ai-status-title-group strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 15px;
  color: var(--ink);
}
.ai-status-badge {
  display: inline-block;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.ai-status-badge.badge-success {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
:root[data-theme="dark"] .ai-status-badge.badge-success {
  color: #34d399;
}
.ai-status-badge.badge-error {
  background: rgba(239, 68, 68, 0.18);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
:root[data-theme="dark"] .ai-status-badge.badge-error {
  color: #fca5a5;
}
.ai-status-badge.badge-warning {
  background: rgba(217, 119, 6, 0.18);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.35);
}
:root[data-theme="dark"] .ai-status-badge.badge-warning {
  color: #fbbf24;
}
.ai-status-badge.badge-neutral {
  background: rgba(156, 163, 175, 0.18);
  color: #4b5563;
  border: 1px solid rgba(156, 163, 175, 0.35);
}
:root[data-theme="dark"] .ai-status-badge.badge-neutral {
  color: #9ca3af;
}
.ai-status-time {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.ai-status-detail {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}
.ai-status-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px dashed var(--line, rgba(0, 0, 0, 0.12));
}
.ai-status-metrics span strong {
  color: var(--ink);
}
.test-ai-btn {
  font-size: 12px;
  padding: 6px 14px;
}
.ai-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.ai-status-pill.pill-online {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
}
:root[data-theme="dark"] .ai-status-pill.pill-online {
  color: #34d399;
}
.ai-status-pill.pill-error {
  background: rgba(239, 68, 68, 0.18);
  color: #dc2626;
}
:root[data-theme="dark"] .ai-status-pill.pill-error {
  color: #fca5a5;
}
.ai-status-pill.pill-untested {
  background: rgba(217, 119, 6, 0.18);
  color: #d97706;
}
:root[data-theme="dark"] .ai-status-pill.pill-untested {
  color: #fbbf24;
}
.ai-status-pill.pill-disabled {
  background: rgba(156, 163, 175, 0.18);
  color: #6b7280;
}
:root[data-theme="dark"] .ai-status-pill.pill-disabled {
  color: #9ca3af;
}

/* HSK 6 Writing Proctor Mode (10m Reading + 35m Writing) */
.writing-proctor-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line, rgba(0, 0, 0, 0.14));
  background: var(--paper-card, #fffdf8);
  box-shadow: 0 6px 18px rgba(26, 24, 21, 0.05);
}
.writing-proctor-bar.mode-free {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border-style: dashed;
  border-color: var(--teal, #1f6f78);
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.06), rgba(196, 61, 47, 0.04));
}
.writing-proctor-bar.phase-reading {
  border-color: #b7791f;
  background: linear-gradient(135deg, rgba(214, 158, 46, 0.1), rgba(255, 253, 248, 0.96));
}
.writing-proctor-bar.phase-writing {
  border-color: var(--teal, #1f6f78);
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.1), rgba(255, 253, 248, 0.96));
}
.writing-proctor-bar.phase-expired,
.writing-proctor-bar.is-danger {
  border-color: var(--brick-red, #c43d2f);
  background: linear-gradient(135deg, rgba(196, 61, 47, 0.1), rgba(255, 253, 248, 0.96));
}
.writing-proctor-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 680px;
}
.writing-proctor-info p,
.writing-proctor-note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft, #4a453e);
}
.writing-proctor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(31, 111, 120, 0.14);
  color: var(--teal, #1f6f78);
}
.writing-proctor-badge.badge-reading {
  background: rgba(183, 121, 31, 0.18);
  color: #8c580c;
}
.writing-proctor-badge.badge-writing {
  background: rgba(31, 111, 120, 0.18);
  color: var(--teal, #1f6f78);
}
.writing-proctor-badge.badge-expired {
  background: rgba(196, 61, 47, 0.18);
  color: var(--brick-red, #c43d2f);
}
.writing-proctor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.writing-proctor-steps {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted, #6f685f);
}
.writing-proctor-steps .is-active {
  font-weight: 700;
  color: var(--ink, #1d1a16);
}
.writing-proctor-steps .is-done {
  color: var(--teal, #1f6f78);
}
.writing-proctor-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.writing-proctor-clock-wrap {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.writing-proctor-clock {
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink, #1d1a16);
}
.writing-proctor-bar.is-warning .writing-proctor-clock {
  color: #b7791f;
}
.writing-proctor-bar.is-danger .writing-proctor-clock,
.writing-proctor-bar.phase-expired .writing-proctor-clock {
  color: var(--brick-red, #c43d2f);
}
.writing-proctor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.writing-proctor-progress {
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.09);
  overflow: hidden;
}
.writing-proctor-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal, #1f6f78), var(--brick-red, #c43d2f));
  transition: width 0.35s ease;
}
.exam-stimulus-withdrawn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1.5px dashed rgba(31, 111, 120, 0.45);
  background: rgba(31, 111, 120, 0.06);
}
.exam-stimulus-withdrawn .withdrawn-icon {
  font-size: 26px;
  line-height: 1;
}
.exam-stimulus-withdrawn strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}
.exam-stimulus-withdrawn p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft, #4a453e);
}
.exam-writing-label.is-reading-locked textarea {
  background: rgba(183, 121, 31, 0.06);
  border-style: dashed;
  cursor: not-allowed;
}
.answer-feedback-manual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.result-writing-ai-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 111, 120, 0.28);
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.06), rgba(255, 253, 248, 0.96));
  text-align: left;
}
.result-writing-ai-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  text-align: left;
}
.result-writing-ai-bar > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}
.result-writing-ai-bar strong {
  text-align: left;
}
.result-writing-ai-bar span {
  font-size: 13px;
  color: var(--ink-soft, #4a453e);
  text-align: left;
}
.result-manual-editor {
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.025);
  text-align: left;
}
.result-manual-editor label {
  text-align: left;
  display: block;
}

/* Multi-API Profiles Management Styles */
.ai-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 22px 24px;
  margin-bottom: 24px;
  border-radius: 14px;
  border: 1.5px solid var(--teal, #1f6f78);
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.08), rgba(255, 253, 248, 0.98));
  box-shadow: 0 4px 18px rgba(31, 111, 120, 0.08);
}
:root[data-theme="dark"] .ai-active-banner {
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.16), rgba(24, 24, 27, 0.95));
}
.ai-banner-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.ai-banner-status-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-btn);
  flex-shrink: 0;
}
.ai-banner-status-icon.is-enabled {
  color: var(--teal, #1f6f78);
  border-color: var(--teal, #1f6f78);
  background: rgba(31, 111, 120, 0.12);
}
.ai-banner-status-icon.is-disabled {
  color: var(--muted, #64748b);
  border-style: dashed;
}
.ai-banner-top-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.ai-active-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.ai-active-status-badge.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.ai-active-status-badge.badge-neutral {
  background: rgba(100, 116, 139, 0.15);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.ai-banner-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-family: var(--font-serif);
}
.ai-banner-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.ai-banner-desc code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}
:root[data-theme="dark"] .ai-banner-desc code {
  background: rgba(255, 255, 255, 0.08);
}
.ai-banner-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ai-global-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 14px;
}
.ai-global-toggle-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.25s ease;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s ease;
}
.ai-global-toggle-label input:checked + .toggle-switch {
  background: var(--teal, #1f6f78);
}
.ai-global-toggle-label input:checked + .toggle-switch::after {
  transform: translateX(22px);
}

/* Profiles Grid & Cards */
.ai-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.ai-profile-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-btn);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.ai-profile-card.is-active {
  border-color: var(--teal, #1f6f78);
  border-width: 2px;
  background: linear-gradient(180deg, rgba(31, 111, 120, 0.04), var(--paper));
  box-shadow: 0 4px 14px rgba(31, 111, 120, 0.12);
}
.ai-profile-card-header {
  margin-bottom: 14px;
}
.ai-profile-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.ai-profile-name {
  margin: 0;
  font-size: 16px;
  font-family: var(--font-serif);
  color: var(--ink);
}
.ai-active-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--teal, #1f6f78);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-family: var(--font-mono);
}
.ai-profile-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-provider-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.badge-gemini {
  background: rgba(66, 133, 244, 0.14);
  color: #1a73e8;
  border: 1px solid rgba(66, 133, 244, 0.25);
}
:root[data-theme="dark"] .badge-gemini {
  color: #8ab4f8;
}
.badge-openai {
  background: rgba(16, 163, 127, 0.14);
  color: #0d8a68;
  border: 1px solid rgba(16, 163, 127, 0.25);
}
:root[data-theme="dark"] .badge-openai {
  color: #34d399;
}
.ai-profile-details {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin-bottom: 12px;
}
.ai-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.detail-label {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.detail-val {
  color: var(--ink);
  text-align: right;
  word-break: break-all;
}
.detail-val.truncate {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-profile-status-text {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.ai-profile-status-text.status-ok {
  color: #059669;
}
.ai-profile-status-text.status-err {
  color: #dc2626;
}
.ai-profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.ai-profile-tool-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.activate-profile-btn {
  font-size: 12px;
  padding: 6px 12px;
}
.active-indicator-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--teal, #1f6f78);
  font-family: var(--font-mono);
}
.text-danger {
  color: #dc2626 !important;
}

/* Presets & Chips */
.ai-preset-chips-box {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--page);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.preset-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.ai-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset-chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-chip:hover {
  border-color: var(--teal, #1f6f78);
  background: rgba(31, 111, 120, 0.08);
  color: var(--teal, #1f6f78);
}

/* Modal Dialog */
.ai-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.ai-modal-overlay[hidden] {
  display: none !important;
}
.ai-modal-dialog {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  padding: 24px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}
.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.ai-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-family: var(--font-serif);
}
.ai-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.ai-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}
.ai-profile-modal-form label {
  display: block;
  margin-bottom: 12px;
}
.ai-profile-modal-form label > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.ai-profile-modal-form .form-hint {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.ai-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Khung hiển thị bài viết tự luận khi xem lại kết quả */
.exam-review-writing-essay {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #fafafa);
  overflow: hidden;
}

:root[data-theme="dark"] .exam-review-writing-essay {
  background: rgba(255, 255, 255, 0.03);
}

.writing-essay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--paper-hover, rgba(0, 0, 0, 0.03));
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}

.writing-essay-body {
  padding: 14px 16px;
  font-family: var(--font-hanzi, "Noto Serif SC", "SimSun", serif);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow-y: auto;
}

.copy-essay-btn {
  font-size: 12px;
  padding: 4px 10px;
  height: auto;
  min-height: 28px;
}

/* ==========================================================================
   Multi-Period Leaderboard (Daily, Weekly, All-Time)
   ========================================================================== */
.leaderboard-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.leaderboard-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--paper-hover, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 0px;
  gap: 3px;
}

.leaderboard-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 0px;
  transition: all 0.1s ease;
  line-height: 1.2;
}

.leaderboard-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
}

.leaderboard-tab.is-active {
  background: var(--paper, #fff);
  color: var(--ink);
  box-shadow: var(--shadow-btn);
  border-color: var(--line);
}

:root[data-theme="dark"] .leaderboard-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .leaderboard-tab.is-active {
  background: #2a2a2a;
  color: #fafafa;
  border-color: var(--line);
}

@media (max-width: 650px) {
  .leaderboard-head-right {
    align-items: flex-start;
    width: 100%;
    margin-top: 10px;
  }
  .leaderboard-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  .leaderboard-tab {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 10px;
  }
}
