:root {
  color-scheme: light;
  /* === Design System: ArabChinese — Minimalism & Swiss Style === */
  /* Source: design-system/arabchinese/MASTER.md  |  Pattern: Hero + Features + CTA */
  --color-primary: #1e3a8a;
  --color-on-primary: #ffffff;
  --color-secondary: #3b82f6;
  --color-accent: #7c3aed;
  --color-accent-strong: #6d28d9;
  --color-on-accent: #ffffff;
  --color-background: #f8fafc;
  --color-foreground: #1e293b;
  --color-card: #ffffff;
  --color-muted: #e9eef5;
  --color-muted-fg: #475569;
  --color-border: #bfdbfe;
  --color-ring: #1e3a8a;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.08), 0 4px 6px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 25px rgba(15, 23, 42, 0.1), 0 8px 10px rgba(15, 23, 42, 0.06);
  /* === Backward-compat aliases (existing components use --bg/--surface/--primary etc.) === */
  --bg: var(--color-background);
  --surface: var(--color-card);
  --surface-soft: var(--color-muted);
  --text: var(--color-foreground);
  --muted: var(--color-muted-fg);
  --border: var(--color-border);
  --primary: var(--color-primary);
  --primary-strong: #1e40af;
  --primary-soft: #eef2ff;
  --accent: var(--color-accent);
  --accent-soft: #f5f3ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --shadow: var(--shadow-md);
  --ring: var(--color-ring);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-background: #0f172a;
  --color-foreground: #e2e8f0;
  --color-card: #1e293b;
  --color-muted: #1e293b;
  --color-muted-fg: #94a3b8;
  --color-border: #334155;
  --color-primary: #60a5fa;
  --color-accent: #a78bfa;
  --bg: var(--color-background);
  --surface: var(--color-card);
  --surface-soft: #162032;
  --text: var(--color-foreground);
  --muted: var(--color-muted-fg);
  --border: var(--color-border);
  --primary: var(--color-primary);
  --primary-strong: #3b82f6;
  --primary-soft: #1e3a5f;
  --accent: var(--color-accent);
  --accent-soft: #1e1b4b;
  --danger: #f87171;
  --danger-soft: #3f1a1a;
  --warning: #fbbf24;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", "Work Sans", "Cairo", "Noto Naskh Arabic", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 200ms ease;
}

a:hover {
  color: var(--color-secondary, var(--primary-strong));
  text-decoration: none;
}

/* === Focus ring — design system: visible + accessible === */
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

button,
input,
select {
  font: inherit;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 9px;
  color: var(--text);
  font-family: "Outfit", "Cairo", sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: "Noto Sans SC", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-family: "Outfit", "Cairo", sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 4px;
  color: var(--muted);
  font-family: "Work Sans", "Cairo", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 8px;
  transition: color 200ms ease, background 200ms ease;
  cursor: pointer;
}

.main-nav a:hover {
  color: var(--color-primary);
  background: var(--primary-soft);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.lang-select,
.icon-btn {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  cursor: pointer;
}
.icon-btn:hover, .lang-select:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.lang-select {
  max-width: 190px;
  padding: 0 34px 0 10px;
}

.icon-btn {
  width: 44px;
  padding: 0;
  cursor: pointer;
}

.site-main {
  min-height: calc(100vh - 160px);
}

.hero {
  padding: 72px 0 56px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 860px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: "Outfit", "Cairo", "Noto Naskh Arabic", sans-serif;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}
.hero-accent { color: var(--color-accent); }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.hero p {
  max-width: 720px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.search-wrap {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

#site-search {
  width: 100%;
  min-height: 54px;
  padding: 0 18px 0 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
#site-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

[dir="rtl"] #site-search {
  padding: 0 48px 0 18px;
}

.section {
  padding: 48px 0;
}

.section-muted {
  background: var(--surface-soft);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.section-heading h2,
.related-categories h2,
.related-banks h2,
.related-course h2 {
  margin: 0;
  font-family: "Outfit", "Cairo", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-heading p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 4px 0 0;
}

.category-grid,
.bank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.category-card,
.bank-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
  cursor: pointer;
}

.category-card:hover,
.bank-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.category-card-icon,
.bank-card-icon,
.category-icon,
.bank-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 1.45rem;
}

.category-card-text,
.bank-card-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.category-card-name,
.bank-card-name {
  font-family: "Outfit", "Cairo", sans-serif;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.category-card-desc,
.bank-card-desc {
  color: var(--muted);
  font-size: 0.94rem;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.bank-card-meta {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.course-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
  cursor: pointer;
}

.course-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.course-card-icon,
.course-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 1.45rem;
}

.course-card-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.course-card-name {
  font-family: "Outfit", "Cairo", sans-serif;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.course-card-desc {
  color: var(--muted);
  font-size: 0.94rem;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.course-card-meta {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.course-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.course-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.2;
}

.course-header p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.course-progress-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.course-progress {
  display: grid;
  grid-template-columns: auto minmax(140px, 300px) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.course-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.course-overview > div {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.course-overview h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.course-overview ul {
  margin: 0;
  padding-inline-start: 20px;
  color: var(--muted);
}

.course-lessons {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.course-lesson {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.course-lesson-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.course-lesson-header h2 {
  margin: 0;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.course-lesson-header h2 span {
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 800;
}

.course-complete[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.course-lesson-content {
  overflow-wrap: anywhere;
}

.course-lesson-content h3,
.course-example h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.course-example {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.course-practice {
  margin-top: 16px;
}

.course-next {
  margin: 26px 0;
  text-align: end;
}

[dir="rtl"] .course-example {
  border-left: 0;
  border-right: 4px solid var(--primary);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 24px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
}

.crumb-sep {
  color: var(--border);
}

.category-hero,
.bank-header,
.page-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.category-hero h1,
.bank-header h1,
.page-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.2;
}

.category-hero p,
.bank-header p,
.page-header p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.bank-count {
  margin-top: 10px !important;
  color: var(--accent) !important;
  font-weight: 700;
}

.bank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.bank-meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.quiz-instructions {
  margin: 0 0 20px;
  padding: 16px 18px;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--text);
}

.site-notice {
  margin: 0 0 20px;
  padding: 11px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.92rem;
}

.quiz-practice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.control-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.control-field select {
  min-width: 150px;
  min-height: 44px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.control-field input {
  min-width: 180px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.quiz-saved-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.quiz-saved-state #quiz-streak {
  color: var(--accent);
  font-weight: 700;
}

.quiz-retention {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quiz-daily-status,
.quiz-review-reminder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.9rem;
}

.quiz-daily-status[hidden],
.quiz-review-reminder[hidden] {
  display: none;
}

.quiz-daily-status {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.quiz-daily-status.done {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-review-reminder .text-button {
  flex: 0 0 auto;
  min-height: 44px;
  white-space: normal;
}

.text-button {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.quiz-timer {
  margin: -8px 0 18px;
  color: var(--warning);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.quiz-empty {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.question-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
}

.question-action[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.question-action[data-action="wrong"][aria-pressed="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.quiz-toolbar {
  position: sticky;
  top: 64px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quiz-progress {
  display: grid;
  grid-template-columns: auto minmax(120px, 260px) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.quiz-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}

.button-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-sm);
}

.button-primary:hover {
  background: var(--color-accent-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.quiz-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-question {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-question-number {
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 800;
}

.quiz-prompt {
  margin: 8px 0 16px;
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.quiz-options {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-options legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
}

.quiz-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quiz-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.quiz-option.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-fill-wrap,
.quiz-match {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.quiz-fill,
.quiz-match select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.quiz-matching {
  display: grid;
  gap: 10px;
}

.quiz-explanation {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.quiz-explanation p {
  margin: 0;
}

.quiz-score {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.related-categories,
.related-banks,
.related-course {
  margin-top: 34px;
}

.ad-slot {
  min-height: 90px;
  margin: 30px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.ad-leaderboard {
  min-height: 120px;
}
.quiz-mid-ad {
  margin: 8px 0 16px;
}
.ad-inline {
  min-height: 90px;
  margin: 24px 0;
}

.static-page {
  max-width: 760px;
  margin: 40px auto;
}

.static-page h1 {
  font-size: 2rem;
}

.static-page h2 {
  margin-top: 28px;
}

.site-footer {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
  font-weight: 700;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
}

.footer-note {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.notfound .container {
  padding-top: 70px;
  text-align: center;
}

.lang-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

[dir="rtl"] .quiz-instructions,
[dir="rtl"] .site-notice,
[dir="rtl"] .quiz-explanation {
  border-left: 0;
  border-right: 4px solid var(--primary);
}

[dir="rtl"] .site-notice {
  border-right-color: var(--accent);
}

[dir="rtl"] .quiz-explanation {
  border-right-color: var(--accent);
}

[dir="rtl"] .crumb-sep {
  transform: scaleX(-1);
}

@media (max-width: 860px) {
  .header-inner {
    gap: 14px;
  }

  .main-nav {
    gap: 12px;
  }

  .header-inner {
    flex-wrap: wrap;
    min-height: auto;
    padding: 10px 0;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .category-grid,
  .bank-grid,
  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-overview {
    grid-template-columns: 1fr;
  }

  .course-progress-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-practice-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .control-field select,
  .control-field input {
    width: 100%;
    min-width: 0;
  }

  .quiz-toolbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-progress {
    grid-template-columns: 1fr;
  }

  .quiz-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .quiz-actions .button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 10px;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 1180px);
  }

  .header-inner {
    flex-wrap: wrap;
    min-height: auto;
    padding: 12px 0;
  }

  .brand {
    flex: 1 1 auto;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    overflow-x: auto;
  }

  .header-actions {
    margin-inline-start: auto;
  }

  .lang-select {
    max-width: 142px;
  }

  .hero {
    padding: 48px 0 38px;
  }

  .category-grid,
  .bank-grid,
  .course-grid {
    grid-template-columns: 1fr;
  }

  .category-card,
  .bank-card,
  .course-card {
    min-height: 0;
  }

  .course-header {
    flex-direction: column;
  }

  .course-progress {
    grid-template-columns: 1fr;
  }

  .course-lesson-header {
    flex-direction: column;
  }

  .category-hero,
  .bank-header,
  .page-header {
    flex-direction: column;
  }

  .quiz-daily-status,
  .quiz-review-reminder {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-review-reminder .text-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .category-hero > div,
  .bank-header > div,
  .page-header > div {
    min-width: 0;
    width: 100%;
  }

  .bank-meta span {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.progress-page {
  padding: 28px 0 40px;
}
.progress-header {
  margin-bottom: 22px;
}
.progress-header h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
}
.progress-header p {
  margin: 0 0 6px;
  color: var(--muted);
}
.progress-local {
  font-size: 0.85rem;
}
.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card span:first-child {
  font-size: 1.5rem;
  font-weight: 800;
}
.stat-card span:last-child {
  font-size: 0.85rem;
  color: var(--muted);
}
.progress-section {
  margin-bottom: 28px;
}
.progress-section h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}
.progress-list {
  display: grid;
  gap: 10px;
}
.progress-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  min-height: 48px;
}
.progress-item:hover {
  border-color: var(--primary);
}
.progress-item-name {
  font-weight: 700;
}
.progress-item-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .progress-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .progress-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .progress-item-meta {
    white-space: normal;
  }
}

.faq-section {
  margin: 34px 0 28px;
}
.faq-section h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}
.faq-list {
  display: grid;
  gap: 10px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
}
/* ===== ArabChinese — Arabic-first World-class Extensions ===== */
body{
  font-family: "Cairo", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}
html[dir="rtl"] body{ letter-spacing: 0; }

.brand-text{ display:flex; flex-direction:column; line-height:1.05; gap:1px; }
.brand-name{ font-family:"Cairo",sans-serif; font-weight:800; font-size:1.08rem; letter-spacing:0; }
.brand-tagline{ font-size:.72rem; color:var(--muted); font-weight:600; }
.brand-mark{ font-family:"Noto Sans SC",sans-serif; font-weight:700; font-size:1.05rem; color:var(--primary); }
.footer-title{ font-weight:800; }
.footer-desc{ color:var(--muted); font-size:.92rem; line-height:1.7; max-width:520px; }

.search-bar{ border-top:1px solid var(--border); background:var(--surface); padding:12px 0 16px; box-shadow:0 4px 12px rgba(0,0,0,.04); }
.search-bar .container{ display:flex; flex-direction:column; gap:10px; }
#site-search, #hero-search{ width:100%; min-height:52px; padding:0 16px; border:1px solid var(--border); border-radius:12px; background:var(--surface); color:var(--text); font-size:.98rem; }
#site-search:focus, #hero-search:focus{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.search-results{ display:grid; gap:8px; }

/* Hero — ArabChinese */
.hero{ background: linear-gradient(180deg, #e8eef8 0%, #f3f6fb 55%, var(--bg) 100%); padding:64px 0 44px; text-align:center; position:relative; overflow:hidden; }
.hero::before{ content:""; position:absolute; inset:0; background: radial-gradient(ellipse 700px 260px at 50% -40px, rgba(37,99,235,.14), transparent 70%); pointer-events:none; }
.hero-badge{ display:inline-flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:7px 14px; font-size:.86rem; color:var(--muted); font-weight:600; box-shadow:var(--shadow); margin-bottom:18px; }
.hero h1{ font-family:"Cairo",sans-serif; font-weight:800; font-size:clamp(1.95rem, 4.8vw, 3.2rem); line-height:1.22; margin:0 0 14px; }
.hero-accent{ color:var(--primary); }
.hero-sub{ max-width:720px; margin:0 auto 22px; color:var(--muted); font-size:1.06rem; line-height:1.8; }
.hero-actions{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; margin-bottom:22px; }
.btn{ display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:0 22px; border-radius:999px; font-weight:700; border:1px solid transparent; cursor:pointer; text-decoration:none; transition:all .16s; }
.btn:hover{ text-decoration:none; transform:translateY(-1px); }
.btn-primary{ background:var(--primary); color:#fff; box-shadow:0 6px 18px rgba(37,99,235,.22); }
.btn-primary:hover{ background:var(--primary-strong); }
.btn-ghost{ background:var(--surface); border-color:var(--border); color:var(--text); }
.btn-ghost:hover{ border-color:var(--primary); }
.btn-small{ min-height:36px; padding:0 14px; font-size:.88rem; border-radius:8px; }
.hero-search{ display:flex; gap:8px; max-width:640px; margin:0 auto 18px; }
.hero-search input{ flex:1; }
.btn-search{ border-radius:12px; }
.hero-stats{ display:flex; gap:18px; justify-content:center; flex-wrap:wrap; margin-bottom:12px; }
.stat{ display:flex; flex-direction:column; align-items:center; min-width:70px; }
.stat-num{ font-weight:800; font-size:1.35rem; color:var(--primary); }
.stat-label{ font-size:.82rem; color:var(--muted); }
.hero-trust{ display:flex; gap:8px; justify-content:center; align-items:center; flex-wrap:wrap; color:var(--muted); font-size:.84rem; }
.trust-dots{ opacity:.5; }

/* Grids */
.word-grid, .phrase-grid, .grammar-grid, .char-grid, .conv-grid, .hsk-grid, .tools-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.word-grid{ grid-template-columns:repeat(4, minmax(0,1fr)); }
@media(max-width:980px){ .word-grid{ grid-template-columns:repeat(3,1fr);} .phrase-grid, .grammar-grid{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:640px){ .word-grid, .phrase-grid, .grammar-grid, .char-grid, .conv-grid{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:420px){ .word-grid, .phrase-grid{ grid-template-columns:1fr;} }

/* Cards */
.word-card, .phrase-card, .grammar-card, .char-card, .conv-card{ display:flex; flex-direction:column; gap:6px; padding:14px 14px 12px; border:1px solid var(--border); border-radius:14px; background:var(--surface); color:var(--text); text-decoration:none; transition:all .16s; }
.word-card:hover, .phrase-card:hover, .grammar-card:hover, .char-card:hover, .conv-card:hover{ border-color:color-mix(in srgb, var(--primary) 40%, var(--border)); transform:translateY(-1px); box-shadow:0 6px 18px rgba(25,34,45,.06); text-decoration:none; }
.word-card-chinese, .phrase-card-zh{ font-family:"Noto Sans SC",sans-serif; font-weight:700; font-size:1.25rem; line-height:1.1; }
.word-card-pinyin, .phrase-card-py, .char-card-py{ font-family:ui-monospace, monospace; font-size:.82rem; color:var(--muted); direction:ltr; }
.word-card-ar, .phrase-card-ar, .char-card-ar{ font-size:.92rem; color:var(--text); font-weight:600; }
.word-card-meta, .phrase-card .badge{ display:flex; gap:6px; flex-wrap:wrap; margin-top:2px; }
.badge{ display:inline-flex; align-items:center; min-height:22px; padding:0 8px; border-radius:999px; font-size:.74rem; font-weight:700; background:var(--primary-soft); color:var(--primary); border:1px solid color-mix(in srgb, var(--primary) 14%, transparent); }
.badge.hsk-badge{ background:#fef2f2; color:#b42318; border-color:#fecaca; }
[data-theme="dark"] .badge.hsk-badge{ background:#3a1f1f; color:#fca5a5; border-color:#7f1d1d; }
.grammar-card-title{ font-weight:700; font-size:.98rem; }
.grammar-card-desc{ color:var(--muted); font-size:.88rem; line-height:1.6; }
.char-card{ align-items:center; text-align:center; }
.char-card-big{ font-family:"Noto Sans SC",sans-serif; font-size:2rem; font-weight:700; line-height:1; }
.conv-card-title{ font-weight:700; }
.conv-card-desc{ color:var(--muted); font-size:.88rem; }
.category-grid{ gap:14px; }
.category-card{ border-radius:14px; }

/* Filter bar */
.filter-bar{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:18px; }
#filter-input, #hsk-filter, #dict-input{ flex:1; min-width:220px; min-height:44px; padding:0 14px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); }
.filter-count{ color:var(--muted); font-size:.88rem; font-weight:600; white-space:nowrap; }

/* Detail pages */
.breadcrumb-wrap{ background:var(--surface-soft); border-bottom:1px solid var(--border); padding:10px 0; }
.breadcrumb{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; color:var(--muted); font-size:.88rem; }
.breadcrumb a{ color:var(--muted); font-weight:600; }
.breadcrumb a:hover{ color:var(--primary); }
.breadcrumb .sep{ opacity:.4; }
.word-page, .phrase-page, .grammar-page, .char-page, .conv-page, .static-page, .tool-page{ max-width:820px; margin:0 auto; padding:28px 0 12px; }
.word-hero{ display:grid; grid-template-columns:1fr 280px; gap:18px; align-items:start; margin-bottom:22px; }
@media(max-width:860px){ .word-hero{ grid-template-columns:1fr; } }
.word-main-card{ background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:22px 20px; box-shadow:var(--shadow); }
.word-chinese-wrap{ display:flex; gap:10px; align-items:center; justify-content:center; }
.word-chinese, .phrase-chinese{ font-family:"Noto Sans SC",sans-serif; font-size: clamp(2.2rem, 8vw, 3.4rem); font-weight:700; line-height:1; margin:0; }
.phrase-hero{ text-align:center; padding:18px 0 8px; }
.phrase-hero .phrase-chinese{ font-size: clamp(1.8rem, 6vw, 2.8rem); }
.word-pinyin, .phrase-pinyin, .char-pinyin{ font-family:ui-monospace, monospace; color:var(--muted); font-size:1.02rem; text-align:center; margin:8px 0 4px; direction:ltr; }
.word-arabic, .phrase-arabic, .char-arabic{ text-align:center; font-size:1.28rem; font-weight:700; color:var(--text); margin-bottom:10px; }
.word-meta, .phrase-meta{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:14px; }
.word-actions{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.word-side .char-breakdown{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:14px; margin-bottom:12px; }
.word-side .char-breakdown h3{ margin:0 0 10px; font-size:.98rem; }
.chars-grid{ display:flex; gap:8px; flex-wrap:wrap; }
.char-chip{ display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); font-family:"Noto Sans SC",sans-serif; font-weight:700; font-size:1.2rem; text-decoration:none; color:var(--text); }
.char-chip:hover{ border-color:var(--primary); }
.word-section, .phrase-section, .grammar-section, .char-section, .conv-section, .static-content{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:18px 16px; margin-bottom:16px; }
.word-section h2, .phrase-section h2, .grammar-section h2, .char-section h2, .conv-section h2{ margin:0 0 12px; font-family:"Cairo",sans-serif; font-weight:800; font-size:1.12rem; }
.lead{ color:var(--muted); line-height:1.8; margin:0 0 14px; }
.mnemonic-box, .mistake-box{ border-radius:10px; padding:12px 14px; margin:12px 0; }
.mnemonic-box{ background:var(--accent-soft); border:1px solid color-mix(in srgb, var(--accent) 18%, var(--border)); }
.mnemonic-box h3{ color:var(--accent); margin:0 0 6px; font-size:.92rem; }
.mistake-box{ background:var(--danger-soft); border:1px solid color-mix(in srgb, var(--danger) 14%, var(--border)); }
.mistake-box h3{ color:var(--danger); margin:0 0 6px; font-size:.92rem; }
.examples{ display:grid; gap:10px; }
.example, .dialog-line{ border:1px solid var(--border); border-radius:10px; padding:12px 14px; background:var(--surface-soft); }
.example .ex-zh, .dialog-line .zh{ font-family:"Noto Sans SC",sans-serif; font-weight:600; font-size:1.02rem; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.example .ex-py, .dialog-line .py{ font-family:ui-monospace, monospace; color:var(--muted); font-size:.88rem; direction:ltr; }
.example .ex-ar, .dialog-line .ar{ color:var(--text); font-weight:600; font-size:.93rem; }
.examples-controls, .dialogue-controls{ display:flex; gap:14px; align-items:center; flex-wrap:wrap; margin-top:10px; font-size:.88rem; color:var(--muted); }
.quiz-card{ border:1px solid var(--border); border-radius:12px; padding:16px; background:var(--surface-soft); }
.quiz-context{ display:grid; gap:4px; margin:10px 0 14px; }
.cloze{ display:inline-block; min-width:72px; border-bottom:2px dashed var(--primary); color:var(--primary); font-weight:800; }
.quiz-q{ margin:0 0 12px; font-weight:700; }
.quiz-options{ display:grid; gap:8px; }
.quiz-opt{ min-height:44px; padding:0 14px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); cursor:pointer; text-align:start; font-weight:600; transition:all .14s; }
.quiz-opt:hover{ border-color:var(--primary); }
.quiz-opt.correct{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent); }
.quiz-opt.wrong{ background:var(--danger-soft); border-color:var(--danger); color:var(--danger); }
.quiz-feedback{ margin:12px 0 0; padding:10px 12px; border-radius:8px; font-weight:700; }
.quiz-feedback.ok{ background:var(--accent-soft); color:var(--accent); }
.quiz-feedback.err{ background:var(--danger-soft); color:var(--danger); }
.audio-btn{ display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border); background:var(--surface); border-radius:999px; min-width:44px; min-height:44px; padding:0 12px; cursor:pointer; font-weight:700; }
.audio-btn.small{ display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; padding:0 10px; font-size:.82rem; }
.audio-btn.playing{ background:var(--primary-soft); border-color:var(--primary); }
.related-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; }
@media(max-width:720px){ .related-grid{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:480px){ .related-grid{ grid-template-columns:1fr;} }
.prev-next{ display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:22px 0 8px; }
.prev-next a{ display:inline-flex; align-items:center; min-height:44px; padding:0 14px; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--text); font-weight:700; text-decoration:none; }
.prev-next a:hover{ border-color:var(--primary); }

.char-hero{ display:grid; place-items:center; gap:14px; padding:12px 0 6px; text-align:center; }
.char-display{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.char-big{ font-family:"Noto Sans SC",sans-serif; font-size:5rem; font-weight:700; line-height:1; border:1px solid var(--border); border-radius:18px; width:140px; height:140px; display:grid; place-items:center; background:var(--surface); box-shadow:var(--shadow); }
.char-meta{ display:flex; gap:12px; flex-wrap:wrap; justify-content:center; }
.meta-item{ display:flex; flex-direction:column; align-items:center; min-width:84px; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.meta-label{ font-size:.78rem; color:var(--muted); font-weight:600; }
.meta-value{ font-weight:800; }
.stroke-box{ display:grid; gap:12px; }
.hanzi-canvas{ min-height:180px; border:1px dashed var(--border); border-radius:12px; display:grid; place-items:center; background:var(--surface-soft); color:var(--muted); font-weight:600; }
.stroke-controls{ display:flex; gap:8px; flex-wrap:wrap; }

.conv-page .dialogue{ display:grid; gap:10px; }
.dialog-line{ display:grid; gap:4px; }
.dialog-line .speaker{ font-weight:800; color:var(--primary); font-size:.88rem; }
.static-page .static-content{ line-height:1.9; }
.contact-form{ display:grid; gap:12px; max-width:520px; }
.contact-form input, .contact-form textarea{ min-height:44px; padding:10px 14px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); }

/* HSK */
.hsk-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
@media(max-width:720px){ .hsk-grid{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:480px){ .hsk-grid{ grid-template-columns:1fr;} }
.hsk-card, .tool-card-large{ display:flex; flex-direction:column; gap:6px; padding:18px 16px; border:1px solid var(--border); border-radius:14px; background:var(--surface); text-decoration:none; color:var(--text); transition:all .16s; }
.hsk-card:hover, .tool-card-large:hover{ border-color:var(--primary); transform:translateY(-1px); box-shadow:0 6px 18px rgba(0,0,0,.06); text-decoration:none; }
.hsk-level{ font-weight:800; font-size:1.15rem; color:var(--primary); }
.hsk-count{ color:var(--muted); font-size:.86rem; font-weight:600; }
.hsk-desc{ color:var(--muted); font-size:.88rem; }
.tools-grid{ grid-template-columns:repeat(4, minmax(0,1fr)); }
@media(max-width:980px){ .tools-grid{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:480px){ .tools-grid{ grid-template-columns:1fr;} }
.tool-card-large .tool-icon{ font-size:1.6rem; }
.tool-card-large h3{ margin:4px 0 0; font-size:1rem; }
.tool-card-large p{ margin:0; color:var(--muted); font-size:.88rem; line-height:1.6; }

/* Tool page */
.tool-ui{ display:grid; gap:14px; }
.tool-ui input[type="text"], .tool-ui input[type="number"], .tool-ui input[type="search"], .tool-ui textarea, .tool-ui select{ width:100%; min-height:44px; padding:10px 14px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); }
.tool-output{ min-height:56px; border:1px dashed var(--border); border-radius:12px; padding:14px; background:var(--surface-soft); }
.pinyin-result, .num-result, .name-result{ display:flex; flex-direction:column; gap:6px; align-items:center; text-align:center; }
.num-big, .name-zh{ font-family:"Noto Sans SC",sans-serif; font-size:1.8rem; font-weight:700; }
.flashcard{ min-height:160px; border:1px solid var(--border); border-radius:14px; display:grid; place-items:center; background:var(--surface-soft); font-weight:700; font-size:1.15rem; cursor:pointer; transition:transform .18s; }
.flashcard.flipped{ transform:rotateY(6deg); }
.flash-controls{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.numbers-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:8px; text-align:center; font-family:"Noto Sans SC",sans-serif; }
.numbers-grid span{ padding:8px; border:1px solid var(--border); border-radius:8px; background:var(--surface); }

/* Ad slots — quiet reserved bands for the ad network */
.ad-slot{ position:relative; min-height:90px; border:1px dashed color-mix(in srgb, var(--border) 88%, var(--muted)); border-radius:12px; background: color-mix(in srgb, var(--surface-soft) 78%, transparent); display:grid; place-items:center; margin:18px 0; overflow:hidden; }
.ad-slot:empty{ display:none; }
.ad-label{ position:absolute; top:6px; inset-inline-start:8px; font-size:.68rem; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:2px 7px; font-weight:700; }
.ad-slot.ad-sidebar{ min-height:250px; }
.ad-slot.ad-leaderboard{ min-height:110px; }
.ad-slot.ad-inarticle{ min-height:180px; }
.ad-slot.ad-infeed{ min-height:160px; }
.ad-slot.ad-unfilled{ display:none !important; }
.ad-slot.ad-filled{ display:block; min-height:0; margin:14px 0; border:0; background:none; }
.ad-slot.ad-active .ad-label{ display:none; }
.ad-slot.ad-filled .ad-label{ display:none; }
.ad-slot iframe{ display:block; margin-inline:auto; max-width:100%; }

/* Two-col, tips */
.two-col{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:14px; }
@media(max-width:720px){ .two-col{ grid-template-columns:1fr;} }
.card-highlight{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:18px 16px; box-shadow:0 2px 10px rgba(0,0,0,.03); }
.card-highlight h3{ margin:0 0 8px; }
.card-highlight p{ color:var(--muted); line-height:1.7; margin:0 0 12px; }
.tips-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
@media(max-width:820px){ .tips-grid{ grid-template-columns:1fr;} }
.tip-card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px 14px; }
.tip-card h3{ margin:0 0 6px; font-size:.98rem; }
.tip-card p{ margin:0; color:var(--muted); line-height:1.7; font-size:.92rem; }
.tip-card a{ display:inline-flex; align-items:center; min-height:44px; font-weight:700; }
.section-cta{ background: linear-gradient(180deg, var(--primary-soft), transparent); border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.tools-preview{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; margin:16px 0; }
@media(max-width:980px){ .tools-preview{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:480px){ .tools-preview{ grid-template-columns:1fr;} }
.tool-card{ display:flex; flex-direction:column; gap:4px; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--surface); text-decoration:none; color:var(--text); }
.tool-card:hover{ border-color:var(--primary); text-decoration:none; }
.tool-card .tool-icon{ font-size:1.3rem; }
.tool-card .tool-name{ font-weight:700; }
.tool-card .tool-desc{ color:var(--muted); font-size:.86rem; line-height:1.5; }
.cta-inner{ text-align:center; }
.cta-inner h2{ margin:0 0 10px; font-family:"Cairo",sans-serif; font-weight:800; }

.tool-chip{ display:inline-flex; align-items:center; min-height:44px; padding:0 14px; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--text); font-weight:600; text-decoration:none; }

/* Footer */
.site-footer{ margin-top:40px; border-top:1px solid var(--border); background:var(--surface); }
.footer-inner{ display:grid; grid-template-columns:1.2fr 1fr; gap:28px; padding:28px 0 18px; }
@media(max-width:820px){ .footer-inner{ grid-template-columns:1fr; } }
.footer-brand{ display:flex; gap:10px; align-items:start; flex-direction:column; }
.footer-brand .brand-mark{ background:var(--primary-soft); }
.footer-links{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
@media(max-width:520px){ .footer-links{ grid-template-columns:1fr 1fr; } }
.footer-col{ display:flex; flex-direction:column; gap:8px; }
.footer-col h4{ margin:0 0 4px; font-size:.95rem; }
.footer-col a{ display:flex; align-items:center; min-height:44px; color:var(--muted); font-size:.92rem; }
.footer-col a:hover{ color:var(--primary); }
.footer-bottom{ border-top:1px solid var(--border); padding:14px 0; }
.footer-bottom-inner{ display:flex; flex-direction:column; gap:4px; text-align:center; color:var(--muted); font-size:.84rem; }
.notfound{ text-align:center; padding:60px 0 40px; }

/* RTL polish */
[dir="rtl"] .hero-search{ direction:rtl; }
[dir="rtl"] .word-card, [dir="rtl"] .phrase-card{ text-align:right; }
.flash-zh{ font-family:"Noto Sans SC",sans-serif; font-size:1.9rem; font-weight:700; }
.flash-py{ font-family:ui-monospace,monospace; color:var(--muted); direction:ltr; }
.flash-ar{ font-size:1.25rem; font-weight:700; }
.flash-hint{ font-size:.82rem; color:var(--muted); margin-top:6px; }
.flash-front, .flash-back{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.flash-progress{ text-align:center; color:var(--muted); font-size:.84rem; font-weight:700; margin-top:8px; }
.pinyin-main{ font-family:ui-monospace,monospace; font-size:1.15rem; font-weight:700; direction:ltr; }
.pinyin-chars{ font-family:ui-monospace,monospace; color:var(--muted); direction:ltr; font-size:.92rem; }
.pinyin-actions{ display:flex; gap:8px; justify-content:center; margin-top:8px; }
.pinyin-result{ display:flex; flex-direction:column; gap:8px; align-items:center; text-align:center; }
.hanzi-canvas:empty::before{ content:"جاري التحميل…"; color:var(--muted); }
.skip-link{ position:absolute; top:-100px; inset-inline-start:8px; display:inline-flex; align-items:center; min-height:44px; background:var(--primary); color:#fff; padding:8px 12px; border-radius:8px; z-index:100; font-weight:700; text-decoration:none; }
.skip-link:focus{ top:8px; }
@media (prefers-reduced-motion: reduce){ *{ animation-duration:.01ms !important; transition-duration:.01ms !important; } }

/* ===== Wide-screen gutter fix — world-class reading experience ===== */
.breadcrumb-wrap{ padding-inline: 0; }
.breadcrumb-wrap .container{ padding: 0; }
.page-header{ padding: 18px 0 14px; }
.page-header .container{ display:flex; flex-direction:column; gap:10px; }
.page-header-main{ display:flex; gap:12px; align-items:start; }
.page-header-main .page-icon{ font-size:1.6rem; flex:0 0 auto; width:44px; height:44px; display:grid; place-items:center; border-radius:12px; background:var(--primary-soft); }

/* Detail pages: ensure gutters on wide screens — override bare max-width */
.word-page, .phrase-page, .grammar-page, .char-page, .conv-page, .static-page, .tool-page{
  width: min(820px, calc(100% - 32px));
  margin-inline: auto;
  padding-inline: 0;
}
@media (max-width: 640px){
  .word-page, .phrase-page, .grammar-page, .char-page, .conv-page, .static-page, .tool-page{
    width: min(100% - 24px, 820px);
  }
}
/* Ad slots inside detail pages should not touch edges */
.word-page .ad-slot, .phrase-page .ad-slot, .grammar-page .ad-slot, .char-page .ad-slot, .conv-page .ad-slot, .tool-page .ad-slot, .static-page .ad-slot{
  margin-inline: 0;
}
/* Breadcrumb in wide screens: ensure not sticking to edge */
.breadcrumb{ padding-inline: 0; }

/* ===== HSK/Tools gutter & ad layout polish — 宽屏边距+广告横放 ===== */
.hsk-index, .tools-index, .hsk-page{ padding:0; }
.hsk-index .static-hero, .tools-index .static-hero, .hsk-page .hsk-hero{ width:100%; }
.hsk-section{ padding:18px 0; }
.hsk-section .container{ display:flex; flex-direction:column; gap:14px; }
/* 广告横放：通栏，不挤网格，居中在 container 宽度内 */
.ad-slot.ad-leaderboard, .ad-slot.ad-inarticle, .ad-slot.ad-infeed{ width:100%; max-width:100%; }
/* 顶部索引页的 hero 在 container 内已受 1180px 约束，不再额外撑满 */

/* ===== Tones trainer */
.tones-tool{display:flex;flex-direction:column;gap:14px}
.tones-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
@media(max-width:860px){.tones-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:480px){.tones-grid{grid-template-columns:1fr}}
.tone-btn{display:flex;flex-direction:column;align-items:center;gap:6px;padding:16px 12px;border:2px solid var(--border);border-radius:14px;background:var(--surface);cursor:pointer;transition:all .15s;min-height:110px}
.tone-btn:hover{border-color:var(--primary);transform:translateY(-1px);box-shadow:0 6px 18px rgba(0,0,0,.06)}
.tone-btn.playing{border-color:var(--primary);background:var(--primary-soft);transform:scale(1.02)}
.tone-mark{font-family:ui-monospace,monospace;font-size:1.35rem;font-weight:800;direction:ltr}
.tone-name{font-size:.82rem;color:var(--muted);font-weight:700}
.tone-hanzi{font-family:'Noto Sans SC',sans-serif;font-size:1.4rem;font-weight:700}
.tone-play{font-size:1.1rem;opacity:.6}
.tone-1{border-top:3px solid #3b82f6} .tone-2{border-top:3px solid #10b981} .tone-3{border-top:3px solid #f59e0b} .tone-4{border-top:3px solid #ef4444}
.tone-status{text-align:center;color:var(--primary);font-weight:700;font-size:.92rem;min-height:1.2em}
.tones-compare{border:1px solid var(--border);border-radius:14px;padding:16px;background:var(--surface-soft)}
.tones-compare h3{margin:0 0 10px;font-size:1rem}
.tones-quiz{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
@media(max-width:480px){.tones-quiz{grid-template-columns:repeat(2,1fr)}}
.tone-feedback{min-height:1.4em;text-align:center;font-weight:700;color:var(--primary);margin-top:8px}
/* ===== Topic editorial — business/travel/culture depth ===== */
.topic-editorial{max-width:820px;margin:0 auto}
.topic-editorial h2{font-size:1.35rem;margin:0 0 10px}
.topic-editorial h3{font-size:1.05rem;margin:18px 0 8px}
.topic-editorial p{line-height:1.85;color:var(--text)}
.topic-editorial ol,.topic-editorial ul{padding-inline-start:22px;line-height:1.85}
.topic-editorial a{color:var(--primary);text-underline-offset:3px}
.topic-editorial a:hover{color:var(--primary-hover)}
.topic-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:14px 0}
@media(max-width:900px){.topic-grid{grid-template-columns:1fr}}
.prose .hint{color:var(--muted);font-size:.92rem}

/* ===== Swiss 2.0 — ui-ux-pro-max implementation layer ===== */
/* Source: ui-ux-pro-max Language Learning App palette + Minimalism & Swiss layout */
:root{
  --color-primary:#4f46e5;
  --color-on-primary:#ffffff;
  --color-secondary:#818cf8;
  --color-accent:#16a34a;
  --color-on-accent:#000000;
  --color-background:#eef2ff;
  --color-foreground:#312e81;
  --color-card:#ffffff;
  --color-muted:#ebeef8;
  --color-muted-fg:#475569;
  --color-border:#c7d2fe;
  --color-ring:#4f46e5;
  --bg:var(--color-background);
  --surface:var(--color-card);
  --surface-soft:#e8ecfb;
  --text:#1e293b;
  --muted:var(--color-muted-fg);
  --border:var(--color-border);
  --primary:var(--color-primary);
  --primary-strong:#4338ca;
  --primary-hover:#4338ca;
  --primary-soft:#e0e7ff;
  --accent:var(--color-accent);
  --accent-soft:#dcfce7;
  --radius:14px;
  --radius-lg:22px;
  --radius-pill:999px;
  --shadow-sm:0 1px 2px rgba(15,23,42,.06);
  --shadow-md:0 8px 24px rgba(15,23,42,.08);
  --shadow-lg:0 20px 48px rgba(15,23,42,.12);
  --shadow:var(--shadow-md);
}
[data-theme="dark"]{
  --color-primary:#818cf8;
  --color-secondary:#a5b4fc;
  --color-accent:#4ade80;
  --color-background:#0b1120;
  --color-foreground:#e2e8f0;
  --color-card:#111827;
  --color-muted:#162032;
  --color-muted-fg:#94a3b8;
  --color-border:#293548;
  --bg:var(--color-background);
  --surface:var(--color-card);
  --surface-soft:#131c2d;
  --text:#e5eaf3;
  --border:var(--color-border);
  --primary:var(--color-primary);
  --primary-strong:#a5b4fc;
  --primary-hover:#a5b4fc;
  --primary-soft:#182136;
}

body{
  background:
    linear-gradient(180deg,#ffffff 0%,var(--bg) 320px, var(--bg) 100%);
  color:var(--text);
  letter-spacing:0;
}

.container{
  width:min(1240px,calc(100% - clamp(32px,6vw,96px)));
  margin-inline:auto;
}

.site-header{
  background:color-mix(in srgb,var(--surface) 88%,transparent);
  backdrop-filter:blur(18px);
  border-bottom:1px solid color-mix(in srgb,var(--border) 72%,transparent);
  box-shadow:none;
}
.header-inner{gap:clamp(16px,2vw,36px);}
.brand-mark{
  width:42px;height:42px;border-radius:14px;
  background:linear-gradient(145deg,var(--primary),#7c3aed);
  color:#fff;font-size:1.15rem;box-shadow:0 10px 24px rgba(79,70,229,.22);
}
.brand-name{font-size:1.12rem;}
.main-nav{gap:6px;padding:5px;border:1px solid color-mix(in srgb,var(--border) 58%,transparent);border-radius:999px;background:color-mix(in srgb,var(--surface) 68%,transparent);}
.main-nav a{padding:0 14px;border-radius:999px;color:var(--muted);font-weight:700;}
.main-nav a:hover{background:var(--primary-soft);color:var(--primary);}
.icon-btn,.lang-select{border-radius:14px;}

.site-main{overflow-x:clip;}

/* Hero: editorial split layout */
.hero{
  position:relative;
  padding:clamp(52px,7vw,98px) 0 clamp(44px,6vw,76px);
  background:transparent;border-bottom:0;overflow:visible;
}
.hero::before{
  content:"";position:absolute;inset:auto 0 0;height:1px;
  background:linear-gradient(90deg,transparent,var(--border) 18%,var(--border) 82%,transparent);
}
.hero-shell{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(340px,460px);
  align-items:center;gap:clamp(32px,5vw,72px);
}
.hero-copy{text-align:start;max-width:760px;}
.hero-badge{
  gap:9px;padding:8px 14px;margin-bottom:22px;border-radius:999px;
  background:color-mix(in srgb,#fff 78%,transparent);border-color:color-mix(in srgb,var(--primary) 22%,var(--border));
  color:var(--primary);box-shadow:var(--shadow-sm);backdrop-filter:blur(10px);
}
[data-theme="dark"] .hero-badge{background:color-mix(in srgb,var(--surface) 74%,transparent);}
.hero h1{
  margin:0 0 20px;font-family:"Cairo","Outfit",sans-serif;
  font-size:clamp(2.45rem,6vw,4.55rem);line-height:1.05;font-weight:800;
  letter-spacing:0;color:var(--text);
}
.hero-accent{
  position:relative;display:inline-block;color:var(--primary);
}
.hero-accent::after{
  content:"";display:block;height:7px;margin-top:6px;border-radius:99px;
  background:linear-gradient(90deg,var(--primary),var(--color-accent));
}
.hero-sub{max-width:640px;margin:0 0 30px;font-size:clamp(1.02rem,1.4vw,1.18rem);line-height:1.85;color:var(--muted);}
.hero-actions{justify-content:flex-start;margin-bottom:26px;}
.btn{
  min-height:52px;padding:0 25px;border-radius:16px;font-weight:800;
  transition:transform .2s ease,box-shadow .2s ease,background .2s ease,border-color .2s ease,color .2s ease;
}
.btn:hover{transform:translateY(-3px);}
.btn-primary{background:var(--primary);box-shadow:0 14px 30px rgba(79,70,229,.25);}
.btn-primary:hover{background:var(--primary-strong);box-shadow:0 20px 38px rgba(79,70,229,.28);}
.btn-outline,.btn-ghost{
  background:transparent;border:2px solid color-mix(in srgb,var(--primary) 35%,var(--border));
  color:var(--primary);
}
.btn-outline:hover,.btn-ghost:hover{border-color:var(--primary);background:color-mix(in srgb,var(--primary) 7%,transparent);}
.btn-search{min-width:106px;gap:8px;border-radius:16px;background:var(--primary);color:#fff;}
.btn-search svg{flex:0 0 auto;}
.hero-search{max-width:640px;margin:0 0 34px;}
.hero-search input{
  min-height:62px;padding:0 22px;border:0;border-radius:18px;
  background:var(--surface);color:var(--text);box-shadow:0 12px 36px rgba(15,23,42,.09);
}
.hero-stats{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:0;
  padding-top:22px;border-top:1px solid color-mix(in srgb,var(--border) 65%,transparent);
}
.stat{align-items:flex-start;text-align:start;min-width:0;}
.stat-num{font-size:clamp(1.55rem,2.5vw,2.1rem);line-height:1;font-weight:900;color:var(--primary);}
.stat-label{margin-top:6px;font-size:.83rem;line-height:1.3;color:var(--muted);}

/* Hero learning artifact */
.hero-stage{
  min-height:430px;padding:28px;border:1px solid color-mix(in srgb,var(--border) 78%,transparent);
  border-radius:30px;background:
    linear-gradient(145deg,#fff 0%,#f4f6ff 52%,#e8edff 100%);
  box-shadow:0 30px 70px rgba(15,23,42,.13);
  display:grid;align-content:center;gap:8px;justify-items:center;text-align:center;
}
[data-theme="dark"] .hero-stage{background:linear-gradient(145deg,#151e31,#101827);}
.stage-top{
  width:100%;display:flex;justify-content:space-between;align-items:center;
  color:var(--muted);font-size:.8rem;font-weight:800;letter-spacing:.04em;text-transform:uppercase;
}
.stage-top span:first-child{padding:4px 9px;border-radius:99px;background:var(--primary-soft);color:var(--primary);}
.stage-character{
  min-height:180px;display:grid;place-items:center;width:100%;
  font-family:"Noto Sans SC",sans-serif;font-size:clamp(7.5rem,11vw,9.5rem);
  line-height:1;color:#111827;
}
[data-theme="dark"] .stage-character{color:#f8fafc;}
.stage-pinyin{font-size:1.5rem;font-weight:800;color:var(--primary);}
.stage-meaning{font-size:.97rem;font-weight:700;color:var(--muted);}
.tone-scale{width:100%;display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:24px 0 0;padding:0;list-style:none;}
.tone-scale li{display:grid;gap:8px;justify-items:center;}
.tone-scale i{width:100%;height:7px;border-radius:99px;background:var(--primary-soft);}
.tone-scale li:nth-child(1) i{background:#60a5fa;clip-path:polygon(0 55%,100% 25%,100% 75%,0 75%);}
.tone-scale li:nth-child(2) i{background:#34d399;clip-path:polygon(0 75%,50% 20%,100% 75%,100% 75%,0 75%);}
.tone-scale li:nth-child(3) i{background:#f59e0b;clip-path:polygon(0 30%,50% 75%,100% 30%,100% 45%,50% 90%,0 45%);}
.tone-scale li:nth-child(4) i{background:#f87171;clip-path:polygon(0 25%,100% 75%,100% 75%,0 75%);}
.tone-scale span{font-family:ui-monospace,monospace;font-size:.78rem;color:var(--muted);}

/* Sections & cards */
.section{padding:clamp(48px,6vw,86px) 0;}
.section-muted{
  position:relative;background:#fff;
  border-top:1px solid color-mix(in srgb,var(--border) 58%,transparent);
  border-bottom:1px solid color-mix(in srgb,var(--border) 58%,transparent);
}
[data-theme="dark"] .section-muted{background:color-mix(in srgb,var(--surface) 58%,transparent);}
.section-heading{align-items:end;gap:24px;margin-bottom:clamp(26px,3vw,40px);}
.section-heading h2{font-size:clamp(1.65rem,3vw,2.3rem);line-height:1.2;letter-spacing:0;color:var(--text);}
.section-heading p{margin:7px 0 0;font-size:.98rem;}
.link-more{display:inline-flex;align-items:center;min-height:44px;white-space:nowrap;font-weight:800;}

.category-grid,.bank-grid,.course-grid{
  grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:clamp(18px,2.2vw,26px);
}
.category-card,.bank-card,.course-card{
  position:relative;min-height:150px;padding:26px 24px;border-radius:var(--radius-lg);
  border:1px solid color-mix(in srgb,var(--border) 76%,transparent);overflow:hidden;
  transition:transform .22s ease,box-shadow .22s ease,border-color .22s ease,background .22s ease;
}
.category-card::after,.bank-card::after,.course-card::after{
  content:"";position:absolute;inset-inline-start:0;top:0;width:4px;height:0;
  background:linear-gradient(var(--primary),var(--accent));transition:height .22s ease;
}
.category-card:hover,.bank-card:hover,.course-card:hover{
  transform:translateY(-5px);border-color:color-mix(in srgb,var(--primary) 38%,var(--border));
  box-shadow:0 24px 52px rgba(15,23,42,.12);
}
.category-card:hover::after,.bank-card:hover::after,.course-card:hover::after{height:100%;}
.category-card-icon,.bank-card-icon,.category-icon,.bank-icon,.course-card-icon,.course-icon{
  width:56px;height:56px;border-radius:18px;background:var(--primary-soft);color:var(--primary);
}
.category-card-name,.bank-card-name,.course-card-name{font-size:1.12rem;}
.category-card-desc,.bank-card-desc,.course-card-desc{font-size:.94rem;line-height:1.65;}

.word-grid,.phrase-grid,.grammar-grid,.char-grid,.conv-grid,.hsk-grid,.tools-grid,.related-grid{
  grid-template-columns:repeat(auto-fit,minmax(235px,1fr));gap:clamp(16px,2vw,24px);
}
.word-card,.phrase-card,.grammar-card,.char-card,.conv-card,.hsk-card,.tool-card-large,.tool-card,.tip-card,.card-highlight{
  padding:22px 21px;border-radius:20px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);
  transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}
.word-card:hover,.phrase-card:hover,.grammar-card:hover,.char-card:hover,.conv-card:hover,.hsk-card:hover,.tool-card-large:hover,.tool-card:hover,.tip-card:hover,.card-highlight:hover{
  transform:translateY(-4px);border-color:color-mix(in srgb,var(--primary) 34%,var(--border));
  box-shadow:0 18px 40px rgba(15,23,42,.11);
}
.word-card-chinese,.phrase-card-zh,.char-card-big{font-size:1.42rem;}
.word-card-ar,.phrase-card-ar,.char-card-ar{line-height:1.55;}
.tool-card-large .tool-icon,.tool-card .tool-icon{
  display:grid;place-items:center;width:48px;height:48px;border-radius:16px;background:var(--primary-soft);color:var(--primary);
}
.tool-card-large .tool-icon svg,.tool-card .tool-icon svg{width:24px;height:24px;}
.hsk-level{font-size:1.22rem;}

.two-col,.tips-grid{gap:clamp(18px,2vw,26px);}
.tip-card,.card-highlight{padding:27px;}
.tip-card h3,.card-highlight h3{font-size:1.08rem;}
.section-cta{
  background:linear-gradient(135deg,#fff,#f1f5ff 58%,#e9efff);border-top:0;border-bottom:0;
}
[data-theme="dark"] .section-cta{background:linear-gradient(135deg,#111827,#151f33);}
.cta-inner h2{font-size:clamp(1.6rem,3vw,2.15rem);}

/* Index/detail rhythm and wide-screen safety */
.breadcrumb-wrap{background:transparent;border-bottom:0;padding:22px 0 0;}
.breadcrumb-wrap .container,.page-header .container{width:min(1240px,calc(100% - clamp(32px,6vw,96px)));}
.page-header{padding:8px 0 12px;}
.page-header .container{gap:14px;}
.page-header h1,.static-hero h1,.hsk-hero h1,.tool-hero h1{letter-spacing:0;line-height:1.15;}
.static-hero,.hsk-hero,.tool-hero{width:100%;max-width:920px;margin-inline:auto;text-align:start;}
.hsk-index,.tools-index,.hsk-page{width:100%;}
.hsk-section .container,.tools-index .container,.hsk-index .container{width:min(1240px,calc(100% - clamp(32px,6vw,96px)));}
.filter-bar{margin-bottom:24px;}
#filter-input,#hsk-filter,#dict-input{min-height:50px;border-radius:14px;}

/* Ads stay as quiet horizontal bands, never squeeze content */
.ad-slot{
  min-height:92px;margin:28px auto;border:0;border-radius:18px;
  background:color-mix(in srgb,var(--surface) 68%,transparent);
  border:1px dashed color-mix(in srgb,var(--border) 82%,transparent);
}
.ad-slot.ad-leaderboard,.ad-slot.ad-inarticle,.ad-slot.ad-infeed{width:min(1080px,100%);margin-inline:auto;}
.ad-slot.ad-leaderboard{min-height:100px;}
.ad-slot.ad-inarticle,.ad-slot.ad-infeed{min-height:110px;}
.ad-label{top:-11px;inset-inline-start:18px;background:var(--bg);border:0;padding:0 8px;color:var(--muted);}

/* Responsive */
@media(max-width:1080px){
  .hero-shell{grid-template-columns:1fr;gap:40px;}
  .hero-stage{max-width:520px;margin-inline:auto;order:-1;min-height:380px;}
  .hero-copy{max-width:720px;}
}
@media(max-width:720px){
  .container,.breadcrumb-wrap .container,.page-header .container,
  .hsk-index .container,.tools-index .container,.hsk-section .container{
    width:min(100% - 28px,1240px);
  }
  .main-nav{width:100%;justify-content:flex-start;overflow-x:auto;scrollbar-width:none;}
  .main-nav::-webkit-scrollbar{display:none;}
  .hero h1{font-size:clamp(2.15rem,10vw,3rem);}
  .hero-actions .btn{width:100%;}
  .hero-search{grid-template-columns:1fr;}
  .btn-search{width:100%;min-height:52px;}
  .hero-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 16px;}
  .stage-character{min-height:145px;font-size:6.5rem;}
  .tone-scale{gap:6px;}
}
@media(prefers-reduced-motion:reduce){
  .category-card:hover,.bank-card:hover,.course-card:hover,
  .word-card:hover,.phrase-card:hover,.grammar-card:hover,.char-card:hover,.conv-card:hover,
  .hsk-card:hover,.tool-card-large:hover,.tool-card:hover,.tip-card:hover,.card-highlight:hover,.btn:hover{transform:none;}
}

/* ===== HSK mock test — interactive static quiz ===== */
.hsk-test-ui{gap:20px;}
.test-controls{display:grid;grid-template-columns:minmax(180px,260px) minmax(220px,1fr);gap:12px;align-items:center;}
.test-controls select,.hsk-test-ui select{
  min-height:52px;padding:0 16px;border:1px solid var(--border);border-radius:14px;
  background:var(--surface);color:var(--text);font-weight:700;
}
.hsk-progress{display:grid;gap:9px;margin-bottom:18px;}
.hsk-progress-text{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-weight:800;font-size:.92rem;}
.progress-bar{height:8px;border-radius:999px;background:color-mix(in srgb,var(--border) 45%,transparent);overflow:hidden;}
.progress-bar i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--accent));transition:width .25s ease;}
.question-card,.result-card{
  padding:clamp(22px,4vw,34px);border:1px solid color-mix(in srgb,var(--border) 72%,transparent);
  border-radius:24px;background:var(--surface);box-shadow:0 20px 50px rgba(15,23,42,.08);
}
.question-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px;}
.question-chinese{font-family:"Noto Sans SC",sans-serif;font-size:clamp(3rem,8vw,4.7rem);line-height:1.05;font-weight:800;color:var(--text);}
.question-pinyin{margin:6px 0 10px;color:var(--primary);font-family:ui-monospace,monospace;font-weight:700;font-size:1.08rem;}
.question-prompt{margin:0 0 20px;color:var(--muted);font-weight:700;}
.hsk-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;}
.hsk-option{
  min-height:54px;padding:13px 16px;border:2px solid var(--border);border-radius:15px;
  background:var(--surface);color:var(--text);font:inherit;font-weight:800;text-align:start;
  cursor:pointer;transition:border-color .18s ease,transform .18s ease,background .18s ease,box-shadow .18s ease;
}
.hsk-option:hover:not(:disabled){border-color:var(--primary);transform:translateY(-2px);box-shadow:var(--shadow-md);}
.hsk-option.correct{border-color:#16a34a;background:#dcfce7;color:#166534;}
[data-theme="dark"] .hsk-option.correct{background:#14321f;color:#86efac;}
.hsk-option.wrong{border-color:#dc2626;background:#fee2e2;color:#991b1b;}
[data-theme="dark"] .hsk-option.wrong{background:#3a1a1a;color:#fca5a5;}
.hsk-actions{display:flex;justify-content:flex-end;margin-top:20px;}
.hsk-tool-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
.hsk-tool-actions .btn{flex:0 1 auto;}
.hsk-tool-actions .btn-ghost{min-width:min(240px,100%);}
.result-score{font-size:clamp(3rem,8vw,4.5rem);font-weight:900;line-height:1;color:var(--primary);margin:14px 0;}
.result-percent{color:var(--muted);font-weight:800;margin:0 0 8px;}
@media(max-width:640px){
  .test-controls{grid-template-columns:1fr;}
  .hsk-options{grid-template-columns:1fr;}
  .hsk-actions .btn{width:100%;}
  .hsk-tool-actions .btn{flex:1 1 100%;}
}

/* ===== HSK full exam simulator ===== */
.hsk-exam-ui{gap:18px;}
.exam-controls{grid-template-columns:minmax(190px,260px) minmax(240px,1fr);}
.exam-meta{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);
  border-radius:var(--radius);background:var(--surface-soft);color:var(--muted);font-weight:700;
}
.exam-best{color:var(--accent);}
.exam-shell{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(250px,310px);
  grid-template-areas:"top top" "main side";gap:20px;align-items:start;
}
.exam-topbar{
  grid-area:top;display:flex;justify-content:space-between;gap:16px;align-items:center;
  padding:14px;border:1px solid color-mix(in srgb,var(--border) 68%,transparent);
  border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm);
}
.exam-progress{flex:1;min-width:0;display:grid;gap:8px;}
.exam-progress-text{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-weight:800;font-size:.92rem;}
.exam-progress-fill{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--accent));transition:width .25s ease;}
.exam-timer{margin:0;font-size:1.05rem;color:var(--warning);}
.exam-timer.is-warning{color:var(--danger);}
.exam-side{
  display:grid;grid-area:side;gap:14px;padding:16px;
  border:1px solid color-mix(in srgb,var(--border) 68%,transparent);
  border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm);
}
.exam-side h2,.exam-question-heading{font-size:1.05rem;margin:0;line-height:1.35;}
.palette-legend{display:flex;gap:14px;color:var(--muted);font-size:.86rem;font-weight:700;}
.palette-legend span{display:inline-flex;align-items:center;gap:6px;}
.dot{width:9px;height:9px;border-radius:50%;background:var(--border);}
.dot.answered{background:#16a34a;}
.dot.marked{background:var(--warning);}
.answer-palette{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;}
.palette-item{
  min-width:44px;min-height:44px;padding:0;border:2px solid var(--border);border-radius:10px;
  background:var(--surface);color:var(--text);font:inherit;font-weight:800;cursor:pointer;
  transition:border-color .18s ease,background .18s ease,box-shadow .18s ease;
}
.palette-item:hover{border-color:var(--primary);}
.palette-item.answered{background:color-mix(in srgb,#16a34a 13%,var(--surface));border-color:#16a34a;}
.palette-item.marked{background:color-mix(in srgb,var(--warning) 15%,var(--surface));border-color:var(--warning);}
.palette-item.active{box-shadow:0 0 0 3px color-mix(in srgb,var(--ring) 28%,transparent);border-color:var(--primary);}
.exam-submit-inline{width:100%;min-height:48px;}
.exam-main{grid-area:main;min-width:0;}
.exam-question-card{scroll-margin-top:88px;}
.exam-question-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;}
.exam-mark{
  flex:0 0 auto;min-height:44px;padding:0 12px;border:2px solid var(--border);border-radius:var(--radius);
  background:var(--surface);color:var(--primary);font:inherit;font-size:.9rem;font-weight:800;cursor:pointer;
}
.exam-mark[aria-pressed="true"]{border-color:var(--warning);color:#92400e;background:var(--danger-soft);}
[data-theme="dark"] .exam-mark[aria-pressed="true"]{color:#fde68a;background:#332311;}
.exam-context{margin-bottom:12px;}
.exam-chinese{font-size:clamp(2.2rem,6vw,3.7rem);}
.exam-sound{min-height:48px;}
.exam-passage{
  margin:0 0 16px;padding:12px 14px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);
  border-radius:var(--radius);background:var(--surface-soft);
}
.exam-passage summary{
  display:grid;gap:3px;min-height:44px;cursor:pointer;color:var(--text);font-weight:800;
}
.exam-passage summary span{font-family:"Noto Sans SC",sans-serif;color:var(--primary);direction:ltr;text-align:end;font-weight:700;}
.exam-passage-lines{display:grid;gap:10px;margin-top:10px;}
.exam-passage-lines p{display:grid;gap:2px;margin:0;}
.line-zh{font-family:"Noto Sans SC",sans-serif;font-weight:700;direction:ltr;text-align:end;font-size:1.08rem;}
.line-pinyin{color:var(--primary);font-family:ui-monospace,monospace;direction:ltr;text-align:end;font-size:.92rem;}
.line-ar{color:var(--muted);font-weight:600;}
.exam-options{margin-bottom:0;}
.exam-option.selected{border-color:var(--accent);background:var(--accent-soft);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent);}
.exam-actions{display:flex;justify-content:space-between;gap:10px;margin-top:20px;}
.exam-actions .btn{flex:1 1 auto;min-height:48px;}
.exam-confirm p{color:var(--muted);font-weight:700;}
.exam-result .result-score{margin-top:10px;}
.exam-module-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:22px 0;}
.exam-module-result{padding:12px;border-radius:var(--radius);background:var(--surface-soft);display:grid;gap:8px;}
.exam-module-result h3{margin:0;font-size:.95rem;color:var(--muted);}
.exam-module-result strong{font-size:1.25rem;color:var(--text);}
.exam-module-result span{color:var(--muted);font-weight:800;}
.exam-review-list{display:grid;gap:12px;margin-top:12px;}
.exam-review{padding:14px;border:1px solid color-mix(in srgb,var(--border) 62%,transparent);border-radius:var(--radius);background:var(--surface);}
.review-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px;color:var(--muted);font-weight:800;font-size:.9rem;}
.exam-review p{margin:6px 0;}
.exam-review details{margin-top:10px;}
.exam-review .btn{margin-top:8px;min-height:44px;}
@media(max-width:900px){
  .exam-shell{grid-template-columns:1fr;grid-template-areas:"top" "main" "side";}
  .exam-topbar{grid-area:top;}
  .exam-side{position:static;}
}
@media(max-width:640px){
  .exam-controls{grid-template-columns:1fr;}
  .exam-meta{align-items:start;flex-direction:column;}
  .exam-topbar{flex-direction:column;align-items:stretch;padding:12px;}
  .exam-timer{text-align:center;}
  .exam-actions{flex-direction:column;}
  .exam-module-results{grid-template-columns:1fr;}
}
/* ===== HSK level roadmap and readiness ===== */
.hsk-roadmap-section{padding:8px 0 18px;}
.roadmap-layout{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(290px,350px);gap:22px;align-items:start;
}
.roadmap-head{
  display:flex;justify-content:space-between;align-items:flex-start;gap:18px;
  padding:18px 0 16px;
}
.roadmap-head h2,.readiness-head h2{margin:0;font-size:clamp(1.25rem,2.4vw,1.7rem);line-height:1.25;}
.roadmap-head p{margin:8px 0 0;color:var(--muted);font-weight:600;max-width:62ch;}
.roadmap-facts{display:grid;gap:8px;flex:0 0 auto;min-width:150px;}
.roadmap-facts span{
  display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:6px 12px;
  border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:999px;
  background:var(--surface-soft);color:var(--primary);font-weight:800;font-size:.9rem;
  font-variant-numeric:tabular-nums;
}
.roadmap-stages{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.roadmap-stage{
  padding:18px;border:1px solid color-mix(in srgb,var(--border) 66%,transparent);
  border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm);
}
.stage-head{display:flex;gap:12px;align-items:center;margin-bottom:12px;}
.stage-index{
  display:grid;place-items:center;width:38px;height:38px;flex:0 0 auto;border-radius:50%;
  background:color-mix(in srgb,var(--primary) 12%,var(--surface));color:var(--primary);font-weight:900;
}
.stage-head h3{margin:0;font-size:1.04rem;line-height:1.3;}
.stage-head span{display:block;color:var(--muted);font-size:.88rem;font-weight:700;}
.roadmap-stage ul{margin:0;padding-inline-start:20px;display:grid;gap:8px;color:var(--muted);font-weight:600;}
.readiness-panel{
  padding:18px;border:1px solid color-mix(in srgb,var(--accent) 24%,var(--border));
  border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-md);
}
.readiness-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;}
#readiness-percent{color:var(--accent);font-weight:900;font-size:1.2rem;font-variant-numeric:tabular-nums;}
.readiness-progress{margin-bottom:10px;}
.readiness-progress.complete i{background:#16a34a;}
#readiness-status{margin:0 0 14px;color:var(--muted);font-size:.92rem;font-weight:700;}
.readiness-list{display:grid;gap:8px;}
.readiness-item{
  display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;
  padding:7px;border:1px solid color-mix(in srgb,var(--border) 62%,transparent);
  border-radius:var(--radius);background:var(--surface-soft);
}
.readiness-main{position:relative;display:flex;align-items:center;gap:10px;min-height:44px;cursor:pointer;}
.readiness-main input{
  appearance:none;width:24px;height:24px;margin:0;flex:0 0 auto;border:2px solid var(--border);
  border-radius:7px;background:var(--surface);transition:background .18s ease,border-color .18s ease;
}
.readiness-main input:checked{background:#16a34a;border-color:#16a34a;}
.readiness-main input:checked + .check-mark::before{
  content:"";display:block;width:5px;height:10px;margin:2px auto 0;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);
}
.readiness-main input:focus-visible + .check-mark{outline:3px solid color-mix(in srgb,var(--ring) 45%,transparent);outline-offset:2px;}
.check-mark{position:absolute;width:24px;height:24px;pointer-events:none;}
.readiness-main input:checked ~ .readiness-copy strong{color:#166534;}
[data-theme="dark"] .readiness-main input:checked ~ .readiness-copy strong{color:#86efac;}
.readiness-copy{display:grid;gap:1px;min-width:0;}
.readiness-copy strong{font-size:.93rem;line-height:1.35;}
.readiness-copy small{color:var(--muted);font-size:.8rem;line-height:1.35;}
.readiness-link{
  display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;
  border-radius:10px;background:var(--surface);color:var(--primary);font-size:.88rem;font-weight:800;
}
.readiness-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:14px;}
#hsk-exam-best{color:var(--muted);font-size:.86rem;font-weight:700;}
#readiness-reset.is-danger{border-color:var(--danger);color:var(--danger);}
.topic-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 20px;}
.topic-chip{
  display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:7px 12px;
  border:2px solid var(--border);border-radius:999px;background:var(--surface);color:var(--text);
  font:inherit;font-size:.9rem;font-weight:800;cursor:pointer;
  transition:border-color .18s ease,background .18s ease,color .18s ease;
}
.topic-chip span{color:var(--muted);font-variant-numeric:tabular-nums;}
.topic-chip:hover{border-color:var(--primary);}
.topic-chip[aria-pressed="true"]{background:var(--primary);border-color:var(--primary);color:white;}
.topic-chip[aria-pressed="true"] span{color:rgba(255,255,255,.82);}
.grammar-mini-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.grammar-mini-card,.reading-mini-card{
  display:grid;gap:6px;align-content:start;min-height:150px;padding:16px;
  border:1px solid color-mix(in srgb,var(--border) 64%,transparent);border-radius:var(--radius-lg);
  background:var(--surface);color:var(--text);transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
.grammar-mini-card:hover,.reading-mini-card:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:var(--shadow-md);}
.grammar-hanzi{font-family:"Noto Sans SC",sans-serif;font-size:1.5rem;font-weight:800;color:var(--primary);line-height:1.2;}
.grammar-mini-card strong,.reading-mini-card strong{font-size:.98rem;line-height:1.35;}
.grammar-mini-card span:last-child,.reading-mini-card span:not(.reading-title-zh):not([dir="ltr"]){
  color:var(--muted);font-size:.86rem;font-weight:650;line-height:1.45;
}
.reading-mini-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.reading-title-zh{font-family:"Noto Sans SC",sans-serif;font-size:1.35rem;font-weight:800;color:var(--text);}
.reading-mini-card span[dir="ltr"]{color:var(--primary);font-family:ui-monospace,monospace;font-size:.9rem;font-weight:700;}
.reading-mini-meta{color:var(--muted);font-size:.86rem;font-weight:700;font-variant-numeric:tabular-nums;}
@media(max-width:980px){
  .roadmap-layout{grid-template-columns:1fr;}
  .roadmap-stages{grid-template-columns:1fr;}
  .grammar-mini-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:640px){
  .hsk-roadmap-section{padding-top:0;}
  .roadmap-head{flex-direction:column;padding-top:12px;}
  .roadmap-facts{grid-template-columns:1fr;width:100%;}
  .readiness-panel{padding:14px;}
  .readiness-footer{align-items:flex-start;flex-direction:column;}
  .grammar-mini-grid,.reading-mini-grid{grid-template-columns:1fr;}
}

/* ===== Scenario-based learning hubs ===== */
.topics-index .static-hero,.scenario-hero{width:100%;max-width:940px;margin-inline:auto;text-align:start;}
.scenario-hero{padding:10px 0 8px;}
.scenario-hero h1{font-size:clamp(2rem,5vw,3.3rem);line-height:1.12;margin:12px 0;}
.scenario-hero .lead{color:var(--muted);font-size:1.05rem;font-weight:600;max-width:68ch;}
.scenario-stats{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0;}
.scenario-stats span{
  display:inline-flex;align-items:center;min-height:40px;padding:6px 12px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);
  border-radius:999px;background:var(--surface-soft);color:var(--primary);font-weight:800;font-size:.9rem;font-variant-numeric:tabular-nums;
}
.scenario-actions{display:flex;flex-wrap:wrap;gap:10px;}
.scenario-actions .btn{min-height:48px;}
.scenario-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;}
.scenario-card{
  display:grid;gap:9px;align-content:start;padding:20px;border:1px solid color-mix(in srgb,var(--border) 66%,transparent);
  border-radius:var(--radius-lg);background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm);
  transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
.scenario-card:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:var(--shadow-md);}
.scenario-card-name{color:var(--accent);font-size:.86rem;font-weight:900;}
.scenario-card strong{font-size:1.05rem;line-height:1.35;}
.scenario-card span:not(.scenario-card-name):not(.scenario-step-index){color:var(--muted);font-size:.92rem;font-weight:650;line-height:1.55;}
.scenario-open{color:var(--primary)!important;font-weight:850;}
.scenario-step{position:relative;padding-top:24px;}
.scenario-step-index{
  position:absolute;top:-12px;inset-inline-start:18px;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;
  background:var(--primary);color:white;font-weight:900;box-shadow:var(--shadow-sm);
}
.scenario-step ul{margin:0;padding-inline-start:20px;display:grid;gap:7px;}
.scenario-phrase-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.scenario-phrase{
  display:grid;gap:6px;align-content:start;min-height:170px;padding:16px;border:1px solid color-mix(in srgb,var(--border) 62%,transparent);
  border-radius:var(--radius-lg);background:var(--surface);color:var(--text);
  transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
.scenario-phrase:hover{border-color:var(--accent);transform:translateY(-2px);box-shadow:var(--shadow-md);}
.phrase-zh{font-family:"Noto Sans SC",sans-serif;font-size:1.35rem;font-weight:850;color:var(--text);line-height:1.25;}
.phrase-pinyin{color:var(--primary);font-family:ui-monospace,monospace;font-size:.9rem;font-weight:700;}
.scenario-phrase strong{font-size:.98rem;line-height:1.4;}
.scenario-phrase small{color:var(--muted);font-size:.84rem;line-height:1.45;}
.phrase-level{justify-self:start;min-height:26px;padding:2px 8px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-size:.76rem;font-weight:850;}
.section-sub{margin:-6px 0 20px;color:var(--muted);font-weight:650;}
.scenario-quiz-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;}
.scenario-quiz-card{padding:18px;border:1px solid color-mix(in srgb,var(--border) 64%,transparent);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm);}
.scenario-quiz-card h3{margin:0;font-family:"Noto Sans SC",sans-serif;font-size:1.5rem;line-height:1.3;}
.scenario-quiz-pinyin{margin:5px 0 14px;color:var(--primary);font-family:ui-monospace,monospace;font-weight:700;}
.scenario-tool-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:22px;}
.scenario-tool-actions .btn{min-height:48px;}
.scenario-page .grammar-mini-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
@media(max-width:980px){
  .scenario-grid,.scenario-phrase-grid,.scenario-quiz-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .scenario-page .grammar-mini-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:640px){
  .scenario-grid,.scenario-phrase-grid,.scenario-quiz-grid{grid-template-columns:1fr;}
  .scenario-page .grammar-mini-grid{grid-template-columns:1fr;}
  .scenario-actions .btn,.scenario-tool-actions .btn{flex:1 1 100%;}
  .scenario-stats span{flex:1 1 100%;justify-content:center;}
}

/* Controlled grids prevent orphan rows on index screens */
@media(min-width:981px){
  .word-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
  .phrase-grid,.grammar-grid,.char-grid,.conv-grid,.related-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
  .hsk-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
  .tools-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
  .tools-grid .tool-card-large[href="/tools/placement/"]{
    grid-column:span 2;
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    align-items:center;
    gap:16px 20px;
    padding:24px;
  }
  .tools-grid .tool-card-large[href="/tools/placement/"] h3{margin:0;font-size:1.18rem;}
  .tools-grid .tool-card-large[href="/tools/placement/"] p{grid-column:2;font-size:.95rem;}
  .tools-grid .tool-card-large[href="/tools/time/"]{
    grid-column:1/-1;
    display:grid;
    grid-template-columns:auto minmax(0,1fr) minmax(0,.9fr);
    align-items:center;
    gap:20px;
    padding:24px;
  }
  .tools-grid .tool-card-large[href="/tools/time/"] h3{margin:0;font-size:1.18rem;}
  .tools-grid .tool-card-large[href="/tools/time/"] p{font-size:.95rem;}
  .tools-grid .tool-card-large[href="/tools/reading/"]{
    grid-column:1/-1;
    display:grid;
    grid-template-columns:auto minmax(0,1fr) minmax(0,.9fr);
    align-items:center;
    gap:20px;
    padding:24px;
  }
  .tools-grid .tool-card-large[href="/tools/reading/"] h3{margin:0;font-size:1.18rem;}
  .tools-grid .tool-card-large[href="/tools/reading/"] p{font-size:.95rem;}
}

/* ===== HSK6 contextual synonym trainer ===== */
.synonyms-ui{gap:20px;}
.synonyms-controls{grid-template-columns:minmax(220px,1fr) minmax(180px,240px);}
.synonyms-best{display:flex;align-items:center;justify-content:center;min-height:44px;padding:0 14px;border:1px solid color-mix(in srgb,var(--border) 75%,transparent);border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 68%,transparent);color:var(--muted);font-weight:800;text-align:center;}
.synonyms-count{margin:0;color:var(--muted);font-weight:700;}
.synonyms-sentence{font-size:clamp(1.65rem,4vw,2.35rem);line-height:1.6;font-weight:750;}
.synonyms-option{font-family:"Noto Sans SC",sans-serif;font-size:1.12rem;letter-spacing:.02em;}
.answer-review{display:grid;gap:10px;margin-top:18px;padding:18px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:18px;background:color-mix(in srgb,var(--surface-soft) 72%,transparent);}
.answer-review h3{margin:0;font-size:1.08rem;}
.answer-zh{font-family:"Noto Sans SC",sans-serif;font-size:1.28rem;line-height:1.65;font-weight:750;}
.answer-pinyin{color:var(--primary);font-family:ui-monospace,monospace;font-weight:700;}
.answer-review p{margin:0;line-height:1.75;}
.answer-review .audio-btn{justify-self:start;margin-top:4px;}
@media(max-width:640px){
  .synonyms-controls{grid-template-columns:1fr;}
  .synonyms-best{width:100%;}
  .answer-review{padding:15px;}
}

/* ===== Graded Chinese reading library ===== */
.reading-ui{gap:22px;}
.reading-controls{display:flex;flex-wrap:wrap;align-items:end;gap:12px;}
.reading-controls select{width:min(190px,100%);}
.reading-label{display:block;margin-bottom:6px;color:var(--muted);font-weight:800;}
.reading-toggle[aria-pressed="true"]{background:var(--primary-soft);border-color:var(--primary);color:var(--primary);}
.reading-library{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px;}
.reading-card{display:flex;flex-direction:column;gap:12px;height:100%;padding:20px;border:1px solid color-mix(in srgb,var(--border) 76%,transparent);border-radius:18px;background:var(--surface);box-shadow:var(--shadow-sm);transition:border-color .18s ease,transform .18s ease,box-shadow .18s ease;}
.reading-card:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:var(--shadow-md);}
.reading-card-top{display:grid;gap:4px;}
.reading-card-zh,.reading-title{margin:0;font-family:"Noto Sans SC",sans-serif;font-weight:850;line-height:1.35;color:var(--text);overflow-wrap:anywhere;}
.reading-card-zh{font-size:1.28rem;}
.reading-title{font-size:clamp(1.7rem,4vw,2.45rem);}
.reading-card-pinyin,.reading-subtitle{margin:0;color:var(--primary);font-weight:750;}
.reading-card-ar{margin:0;font-weight:750;}
.reading-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
.reading-footer{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:auto;}
.reading-info{margin:0;color:var(--muted);font-size:.88rem;font-weight:700;line-height:1.55;}
.reading-workspace:empty{display:none;}
.reading-article{padding:clamp(20px,4vw,34px);border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:24px;background:var(--surface);box-shadow:0 18px 44px rgba(15,23,42,.07);}
.reading-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px;flex-wrap:wrap;}
.reading-subtitle{color:var(--muted);font-size:1.05rem;}
.reading-article .reading-meta{margin:16px 0 22px;}
.reading-content{display:grid;gap:10px;margin-bottom:26px;}
.reading-line{padding:15px;border:1px solid color-mix(in srgb,var(--border) 62%,transparent);border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 58%,transparent);}
.reading-line-top{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;}
.reading-zh{margin:0;font-family:"Noto Sans SC",sans-serif;font-size:clamp(1.22rem,2.6vw,1.55rem);line-height:1.75;font-weight:750;color:var(--text);overflow-wrap:anywhere;}
.reading-pinyin{margin:6px 0 0;color:var(--primary);font-family:ui-monospace,monospace;line-height:1.65;font-weight:700;overflow-wrap:anywhere;}
.reading-translation{margin:6px 0 0;line-height:1.75;color:var(--text);}
.reading-ui[data-show-pinyin="false"] .reading-pinyin,
.reading-ui[data-show-translation="false"] .reading-translation{display:none;}
.reading-quiz{display:grid;gap:16px;}
.reading-question{margin:0;padding:18px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);border-radius:16px;background:var(--surface);}
.reading-question.is-correct{border-color:#16a34a;}
.reading-question.is-incorrect{border-color:#dc2626;}
.reading-question-prompt{margin-bottom:13px;padding:0;font-size:1.05rem;line-height:1.6;font-weight:800;}
.reading-option{min-height:50px;padding:11px 14px;line-height:1.55;}
.reading-explanation{margin-top:12px;padding:13px 14px;border-left:4px solid var(--primary);border-radius:10px;background:var(--primary-soft);color:var(--text);line-height:1.75;}
.reading-submit-area{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
.reading-result{margin-bottom:18px;padding:clamp(20px,4vw,30px);}
[data-theme="dark"] .reading-question.is-correct{border-color:#4ade80;}
[data-theme="dark"] .reading-question.is-incorrect{border-color:#f87171;}
[data-theme="dark"] .reading-explanation{background:#172033;}
@media(max-width:640px){
  .reading-controls{align-items:stretch;}
  .reading-controls .btn{flex:1 1 160px;}
  .reading-footer{flex-direction:column;align-items:stretch;}
  .reading-footer .btn{width:100%;}
  .reading-line-top{align-items:flex-start;}
  .reading-actions .btn{flex:1 1 160px;}
  .reading-submit-area .btn{flex:1 1 100%;}
}

/* ===== Chinese placement test ===== */
.number-modes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:0;padding:0;border:0;}
.number-mode{position:relative;display:flex;align-items:center;justify-content:center;min-height:54px;padding:12px 14px;border:2px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);font-weight:800;text-align:center;cursor:pointer;transition:border-color .18s ease,background .18s ease,color .18s ease;}
.number-mode input{position:absolute;opacity:0;pointer-events:none;}
.number-mode:has(input:checked){border-color:var(--primary);background:var(--primary-soft);color:var(--primary);}
.number-mode:has(input:focus-visible){outline:2px solid var(--primary);outline-offset:2px;}
.number-input-label{display:block;margin-bottom:8px;color:var(--muted);font-weight:800;}
#number-input{width:100%;min-height:58px;padding:14px 16px;border:2px solid var(--border);border-radius:16px;background:var(--surface);color:var(--text);font-size:1.12rem;font-weight:750;}
#number-input:focus{border-color:var(--primary);}
.number-examples{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.number-example{min-height:42px;padding:9px 13px;border:1px solid var(--border);border-radius:999px;background:var(--surface-soft);color:var(--text);font:inherit;font-weight:750;cursor:pointer;transition:border-color .16s ease,background .16s ease;}
.number-example:hover{border-color:var(--primary);background:var(--primary-soft);}
.number-output{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px;}
.number-result-card{padding:18px;border:1px solid color-mix(in srgb,var(--border) 74%,transparent);border-radius:16px;background:var(--surface);box-shadow:var(--shadow-sm);}
.number-result-card.primary{border-color:color-mix(in srgb,var(--primary) 42%,transparent);background:color-mix(in srgb,var(--primary-soft) 58%,var(--surface));}
.number-result-card.financial{border-color:color-mix(in srgb,var(--accent) 38%,transparent);}
.number-result-card h3{margin:0 0 8px;color:var(--muted);font-size:.9rem;}
.number-result-value{font-family:"Noto Sans SC",sans-serif;font-size:clamp(1.35rem,3vw,1.8rem);line-height:1.45;font-weight:800;color:var(--text);overflow-wrap:anywhere;}
.number-pinyin{min-height:24px;margin-top:5px;color:var(--primary);font-family:ui-monospace,monospace;font-weight:700;}
.number-result-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:13px;}
.number-reference{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:9px;margin-top:22px;}
.number-reference span{min-height:48px;display:flex;align-items:center;justify-content:center;padding:8px 10px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);border-radius:12px;background:var(--surface-soft);font-family:"Noto Sans SC",sans-serif;font-weight:750;}
[data-theme="dark"] .number-result-card.primary{background:color-mix(in srgb,var(--primary) 16%,var(--surface));}
@media(max-width:720px){
  .number-modes{grid-template-columns:1fr;}
  .number-output{grid-template-columns:1fr;}
  .number-reference{grid-template-columns:repeat(2,minmax(0,1fr));}
}

/* ===== Chinese date and time studio ===== */
.time-ui{gap:22px;}
.time-fields{display:grid;gap:16px;}
.time-field[hidden]{display:none!important;}
.time-input-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:end;}
.time-label{display:block;margin-bottom:8px;color:var(--muted);font-weight:800;}
#time-datetime,#time-parse-input{width:100%;min-height:58px;padding:14px 16px;border:2px solid var(--border);border-radius:16px;background:var(--surface);color:var(--text);font-size:1.08rem;font-weight:750;}
#time-datetime:focus,#time-parse-input:focus{border-color:var(--primary);}
#time-parse-input{font-family:"Noto Sans SC",sans-serif;line-height:1.6;}
.time-duration-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.time-output{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:14px;}
.time-details{display:grid;gap:9px;margin-top:15px;padding-top:14px;border-top:1px solid color-mix(in srgb,var(--border) 68%,transparent);}
.time-detail-row{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-size:.92rem;font-weight:750;}
.time-detail-row strong{color:var(--text);text-align:end;}
.time-help{margin:0;padding:14px;border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 68%,transparent);color:var(--muted);line-height:1.75;}
.time-help strong{color:var(--text);}
@media(max-width:720px){
  .time-input-row{grid-template-columns:1fr;}
  .time-duration-grid{grid-template-columns:1fr;}
  .time-output{grid-template-columns:1fr;}
  .time-detail-row{align-items:flex-start;flex-direction:column;gap:3px;}
}

/* ===== Vocabulary direction trainer ===== */
.vocabulary-test-ui{gap:22px;}
.vocab-controls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.vocab-label{display:block;margin-bottom:7px;color:var(--muted);font-weight:800;}
.vocab-controls select{width:100%;min-height:52px;padding:0 14px;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);font-weight:700;}
.vocab-start-row{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;}
.vocab-best{min-height:44px;display:inline-flex;align-items:center;padding:0 15px;border:1px solid color-mix(in srgb,var(--border) 75%,transparent);border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 68%,transparent);color:var(--muted);font-weight:800;}
.vocabulary-intro p{margin:8px 0 0;color:var(--muted);line-height:1.75;}
.vocab-badges{margin-bottom:16px;}
.vocab-prompt-zh{font-size:clamp(2.4rem,7vw,3.7rem);line-height:1.2;}
.vocab-prompt-ar{font-size:clamp(1.6rem,4vw,2.2rem);line-height:1.5;font-weight:850;}
.vocab-prompt-pinyin{font-size:clamp(1.5rem,4vw,2rem);color:var(--primary);font-weight:800;}
.vocab-listening{display:flex;align-items:center;min-height:96px;padding:18px;border:1px dashed color-mix(in srgb,var(--primary) 35%,transparent);border-radius:18px;background:color-mix(in srgb,var(--primary-soft) 45%,transparent);}
.vocab-options{margin-top:20px;}
.vocab-option{display:flex;align-items:center;gap:12px;min-height:60px;padding:13px 16px;line-height:1.6;}
.vocab-option-number{flex:0 0 auto;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:1px solid color-mix(in srgb,var(--border) 85%,transparent);border-radius:50%;background:var(--surface);font-size:.82rem;font-weight:900;}
.vocab-option.correct .vocab-option-number{border-color:currentColor;}
.vocab-option.wrong .vocab-option-number{border-color:currentColor;}
.vocab-review{gap:7px;}
.vocab-link{align-self:start;margin-top:4px;}
.vocab-result-actions{display:flex;gap:11px;align-items:center;flex-wrap:wrap;margin-top:20px;}
.vocab-mistakes{display:grid;gap:12px;margin-top:24px;}
.vocab-mistakes h2{margin:0;}
.vocab-mistake-card{padding:17px;border:1px solid color-mix(in srgb,#dc2626 28%,transparent);border-radius:16px;background:color-mix(in srgb,#fee2e2 34%,var(--surface));}
.vocab-chosen{margin:7px 0 0;color:var(--muted);font-weight:750;}
[data-theme="dark"] .vocab-mistake-card{background:color-mix(in srgb,#3a1a1a 52%,var(--surface));}
@media(max-width:900px){
  .vocab-controls{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:640px){
  .vocab-controls{grid-template-columns:1fr;}
  .vocab-start-row{align-items:stretch;}
  .vocab-start-row .btn{width:100%;min-height:52px;}
  .vocab-best{justify-content:center;width:100%;}
  .vocab-option{min-height:58px;}
  .vocab-result-actions .btn{flex:1 1 100%;min-height:50px;}
}

/* ===== Grammar pattern trainer ===== */
.pronunciation-ui{gap:24px;}
.pronunciation-support{padding:14px 16px;border:1px solid color-mix(in srgb,var(--border) 82%,transparent);border-left:4px solid var(--primary);border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 72%,transparent);color:var(--muted);}
.pronunciation-support strong{color:var(--text);}
.pronunciation-support.error{border-color:#fecaca;border-left-color:#dc2626;background:#fef2f2;color:#991b1b;}
[data-theme="dark"] .pronunciation-support.error{border-color:#7f1d1d;background:#3f1a1a;color:#fecaca;}
.pronunciation-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;padding:5px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:999px;background:color-mix(in srgb,var(--surface-soft) 58%,transparent);}
.pronunciation-tab{position:relative;display:block;}
.pronunciation-tab input{position:absolute;opacity:0;pointer-events:none;}
.pronunciation-tab span{display:flex;align-items:center;justify-content:center;min-height:44px;padding:8px 12px;border-radius:999px;color:var(--muted);font-weight:800;text-align:center;cursor:pointer;transition:background .18s ease,color .18s ease;}
.pronunciation-tab input:checked+span{background:var(--primary);color:#fff;box-shadow:0 8px 20px color-mix(in srgb,var(--primary) 18%,transparent);}
.pronunciation-tab input:focus-visible+span{outline:2px solid var(--ring);outline-offset:2px;}
.pronunciation-panel{display:grid;gap:20px;}
.pron-section-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center;}
.pron-section-head h2,.pron-section-head h3{margin:0 0 4px;}
.pron-section-head p{margin:0;color:var(--muted);}
.pron-speed{display:inline-flex;gap:5px;padding:4px;border:1px solid var(--border);border-radius:999px;background:var(--surface);}
.pron-speed label{position:relative;display:block;}
.pron-speed input{position:absolute;opacity:0;pointer-events:none;}
.pron-speed span{display:flex;align-items:center;min-height:44px;padding:0 13px;border-radius:999px;color:var(--muted);font-size:.9rem;font-weight:800;cursor:pointer;transition:color .18s ease,background .18s ease;}
.pron-speed input:checked+span{background:var(--primary-soft);color:var(--primary);}
.pron-speed input:focus-visible+span{outline:2px solid var(--ring);outline-offset:2px;}
.pron-tone-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.pron-tone-card{display:grid;justify-items:center;gap:7px;min-height:210px;padding:20px 14px;border:1px solid var(--border);border-radius:18px;background:var(--surface);color:var(--text);cursor:pointer;transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;}
.pron-tone-card svg{width:82px;height:44px;fill:none;stroke-width:5;stroke-linecap:round;}
.pron-tone-card[data-tone-value="1"] svg{stroke:#2563eb;}
.pron-tone-card[data-tone-value="2"] svg{stroke:#059669;}
.pron-tone-card[data-tone-value="3"] svg{stroke:#d97706;}
.pron-tone-card[data-tone-value="4"] svg{stroke:#dc2626;}
.pron-tone-card:hover,.pron-tone-card:focus-visible{border-color:var(--primary);box-shadow:var(--shadow-md);transform:translateY(-2px);}
.pron-tone-card.is-playing{border-color:var(--primary);background:var(--primary-soft);}
.pron-tone-hanzi{font-family:"Noto Sans SC",sans-serif;font-size:2.4rem;font-weight:800;line-height:1;}
.pron-tone-pinyin{font-family:ui-monospace,monospace;font-size:1.08rem;font-weight:800;}
.pron-tone-meaning{color:var(--muted);font-size:.88rem;line-height:1.5;text-align:center;}
.pron-tone-action{display:inline-flex;align-items:center;gap:7px;min-height:32px;color:var(--primary);font-size:.9rem;font-weight:800;}
.pron-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.pron-quiz-card{display:grid;gap:15px;padding:20px;border:1px solid color-mix(in srgb,var(--border) 78%,transparent);border-radius:18px;background:color-mix(in srgb,var(--surface-soft) 48%,transparent);}
.pron-score{color:var(--muted);font-weight:800;font-size:.92rem;}
.pron-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;}
.pron-option{display:grid;justify-items:center;gap:4px;min-height:82px;padding:13px;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);cursor:pointer;transition:border-color .18s ease,transform .18s ease;}
.pron-option strong{font-family:"Noto Sans SC",sans-serif;font-size:1.35rem;}
.pron-option span,.pron-option small{color:var(--muted);font-size:.88rem;font-weight:700;}
.pron-pair-option{justify-items:start;min-height:108px;text-align:left;}
.pron-controls{display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px;}
.pron-label{display:block;margin-bottom:7px;color:var(--muted);font-weight:800;}
.pron-controls select{width:100%;min-height:52px;padding:0 14px;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);font-weight:700;}
.pron-start-row{justify-content:space-between;}
.pron-question{display:grid;gap:16px;}
.pron-badges{display:flex;gap:7px;flex-wrap:wrap;}
.pron-review{display:grid;gap:7px;padding:16px;border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 62%,transparent);}
.pron-review p{margin:0;}
.pron-coach-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.pron-coach-card{padding:20px;border:1px solid var(--border);border-radius:18px;background:var(--surface);}
.pron-coach-card h3{margin:0 0 8px;font-size:1.1rem;}
.pron-coach-card p{margin:0 0 14px;color:var(--muted);}
.pron-examples{display:flex;flex-wrap:wrap;gap:8px;}
.pron-example{display:grid;gap:2px;min-height:64px;min-width:112px;padding:10px 13px;border:1px solid var(--border);border-radius:13px;background:var(--surface-soft);color:var(--text);font:inherit;cursor:pointer;transition:border-color .18s ease,background .18s ease;}
.pron-example span:last-child{color:var(--muted);font-size:.82rem;font-weight:700;}
.pron-example:hover{border-color:var(--primary);background:var(--primary-soft);}
@media(max-width:860px){
  .pronunciation-tabs{grid-template-columns:1fr;border-radius:20px;}
  .pron-section-head{grid-template-columns:1fr;align-items:start;}
  .pron-tone-grid,.pron-options{grid-template-columns:repeat(2,minmax(0,1fr));}
  .pron-controls{grid-template-columns:1fr;}
  .pron-coach-grid{grid-template-columns:1fr;}
}
@media(max-width:480px){
  .pronunciation-ui{gap:18px;}
  .pron-tone-grid,.pron-options{grid-template-columns:1fr;}
  .pron-tone-card{min-height:auto;}
  .pron-actions .btn{flex:1 1 100%;min-height:50px;}
}

.grammar-trainer-ui{gap:22px;}
.grammar-controls{display:grid;grid-template-columns:2fr 1.4fr 1fr;gap:12px;}
.grammar-label{display:block;margin-bottom:7px;color:var(--muted);font-weight:800;}
.grammar-controls select{width:100%;min-height:52px;padding:0 14px;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);font-weight:700;}
.grammar-options{margin-top:20px;}
.grammar-option{min-height:58px;font-family:"Noto Sans SC",sans-serif;font-size:1.08rem;line-height:1.6;}
.grammar-context{padding:20px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:18px;background:color-mix(in srgb,var(--surface-soft) 62%,transparent);font-family:"Noto Sans SC",sans-serif;font-size:clamp(1.5rem,4vw,2.15rem);line-height:1.75;font-weight:750;color:var(--text);overflow-wrap:anywhere;}
.grammar-blank{display:inline-flex;align-items:center;justify-content:center;min-width:96px;min-height:1.35em;padding:0 10px;border-bottom:3px solid var(--primary);border-radius:6px;background:var(--primary-soft);color:var(--primary);font-weight:900;}
.grammar-blank.correct{border-color:#16a34a;background:#dcfce7;color:#166534;}
.grammar-blank.wrong{border-color:#dc2626;background:#fee2e2;color:#991b1b;}
[data-theme="dark"] .grammar-blank.correct{background:#14321f;color:#86efac;}
[data-theme="dark"] .grammar-blank.wrong{background:#3a1a1a;color:#fca5a5;}
.grammar-order{display:grid;gap:16px;padding:18px;border:1px dashed color-mix(in srgb,var(--primary) 32%,transparent);border-radius:18px;background:color-mix(in srgb,var(--primary-soft) 34%,transparent);}
.grammar-token-bank,.grammar-token-answer{display:flex;min-height:72px;gap:9px;align-items:center;flex-wrap:wrap;padding:13px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:14px;background:var(--surface);}
.grammar-token-answer{border-style:dashed;background:color-mix(in srgb,var(--surface-soft) 68%,transparent);}
.grammar-token{min-height:48px;padding:10px 14px;border:2px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);font-family:"Noto Sans SC",sans-serif;font-size:1.08rem;font-weight:800;cursor:pointer;transition:border-color .16s ease,transform .16s ease;}
.grammar-token:hover{border-color:var(--primary);transform:translateY(-2px);}
.grammar-selected{display:inline-flex;align-items:center;gap:7px;padding:6px 7px 6px 13px;border:1px solid color-mix(in srgb,var(--primary) 34%,transparent);border-radius:999px;background:var(--primary-soft);color:var(--primary);font-family:"Noto Sans SC",sans-serif;font-size:1.05rem;font-weight:850;}
.grammar-remove{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:color-mix(in srgb,var(--primary) 18%,transparent);color:inherit;font-size:1rem;font-weight:900;cursor:pointer;}
.grammar-order-actions{display:flex;gap:11px;align-items:center;flex-wrap:wrap;}
.grammar-review-actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:10px;}
.grammar-chosen{margin:9px 0 0;color:var(--muted);font-weight:750;}
@media(max-width:860px){
  .grammar-controls{grid-template-columns:1fr;}
  .grammar-order-actions .btn{flex:1 1 100%;min-height:50px;}
  .grammar-context{padding:16px;}
}
@media(max-width:640px){
  .grammar-options{grid-template-columns:1fr;}
}

/* ===== Dictionary and spaced-repetition flashcards ===== */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.placement-ui{gap:22px;}
.placement-intro{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;align-items:center;padding:22px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:20px;background:color-mix(in srgb,var(--surface-soft) 62%,transparent);}
.placement-intro h2{margin:0 0 8px;font-size:1.35rem;}
.placement-intro p{margin:0;color:var(--muted);line-height:1.75;}
.placement-history:empty{display:none;}
.placement-history-card{padding:16px 18px;border:1px solid color-mix(in srgb,var(--primary) 22%,transparent);border-radius:16px;background:var(--primary-soft);}
.placement-history-card h3{margin:0 0 6px;font-size:1rem;}
.placement-history-level{margin:0 0 4px;font-size:1.35rem;font-weight:900;color:var(--primary);}
.placement-history-card p:last-child{margin:0;color:var(--muted);font-weight:700;}
.placement-progress{display:grid;gap:10px;}
.placement-progress-top{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-weight:800;}
.placement-badges{margin-bottom:16px;}
.placement-stem{font-size:clamp(1.7rem,5vw,2.7rem);line-height:1.45;}
.placement-options{display:grid;gap:10px;margin:20px 0 0;padding:0;border:0;}
.placement-option{min-height:56px;padding:13px 16px;line-height:1.6;font-weight:750;}
.placement-option input{width:20px;height:20px;accent-color:var(--primary);}
.field-error{margin:12px 0 0;padding:11px 13px;border-left:4px solid #dc2626;border-radius:10px;background:#fee2e2;color:#991b1b;font-weight:800;}
[data-theme="dark"] .field-error{background:#3a1a1a;color:#fca5a5;}
.placement-actions{display:flex;justify-content:space-between;gap:12px;margin-top:22px;flex-wrap:wrap;}
.placement-actions .btn{min-width:150px;}
.error-summary{margin-bottom:18px;padding:18px;border:2px solid #dc2626;border-radius:16px;background:#fee2e2;color:#991b1b;}
[data-theme="dark"] .error-summary{background:#3a1a1a;color:#fecaca;}
.error-summary h2{margin:0 0 10px;font-size:1.15rem;}
.error-summary ul{margin:0;padding-inline-start:20px;display:grid;gap:8px;}
.error-summary a{color:inherit;font-weight:850;}
.placement-result{margin-bottom:24px;}
.placement-level{margin:16px 0;font-size:clamp(2.3rem,7vw,3.6rem);font-weight:950;line-height:1.1;color:var(--primary);}
.placement-note{margin:10px 0 0;color:var(--muted);font-weight:700;line-height:1.7;}
.placement-analysis{display:grid;gap:14px;margin-top:26px;}
.placement-analysis h3{margin:8px 0 0;}
.placement-metric{display:grid;gap:7px;}
.placement-metric-top{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-weight:800;}
.placement-links{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:24px;}
.placement-links h3{flex-basis:100%;margin:0;}
.placement-result-actions{justify-content:flex-start;}
.placement-review{display:grid;gap:12px;}
.placement-review h2{margin:8px 0 0;}
.placement-review-item{padding:18px;border:1px solid color-mix(in srgb,var(--border) 72%,transparent);border-radius:16px;background:var(--surface);}
.placement-review-item.is-correct{border-color:#16a34a;}
.placement-review-item.is-incorrect{border-color:#dc2626;}
.placement-review-zh{margin:12px 0 8px;font-family:"Noto Sans SC",sans-serif;font-size:1.18rem;line-height:1.6;font-weight:750;}
.placement-review-answer{margin:0 0 8px;font-weight:800;}
.placement-review-explanation{margin:0;color:var(--muted);line-height:1.75;}
[data-theme="dark"] .placement-review-item.is-correct{border-color:#4ade80;}
[data-theme="dark"] .placement-review-item.is-incorrect{border-color:#f87171;}
@media(max-width:720px){
  .placement-intro{grid-template-columns:1fr;align-items:stretch;}
  .placement-intro .btn{width:100%;min-height:52px;}
  .placement-actions .btn,.placement-links .btn{flex:1 1 100%;}
  .placement-review-item{padding:15px;}
}

/* ===== Dictionary and spaced-repetition flashcards ===== */

/* ===== Dictionary and spaced-repetition flashcards ===== */
.dictionary-tool{gap:18px;}
#dict-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;}
#dict-results .word-card,#dict-results .phrase-card{height:100%;margin:0;}
.flashcards-ui{gap:18px;}
.flash-stats{display:flex;justify-content:space-between;gap:10px;padding:13px 15px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);border-radius:14px;background:color-mix(in srgb,var(--surface-soft) 65%,transparent);}
.flash-stats span{display:flex;flex-direction:column;align-items:center;min-width:72px;color:var(--muted);font-size:.82rem;font-weight:700;text-align:center;}
.flash-stats strong{color:var(--primary);font-size:1.12rem;line-height:1.2;}
.flashcard{min-height:230px;padding:24px;border-radius:22px;cursor:pointer;box-shadow:var(--shadow-sm);transition:border-color .2s ease,transform .2s ease,box-shadow .2s ease;}
.flashcard:hover,.flashcard:focus-visible{transform:translateY(-3px);box-shadow:0 20px 44px rgba(15,23,42,.11);}
.flash-zh.small{font-size:1.25rem;color:var(--muted);}
.flash-py.small{font-size:.94rem;font-weight:700;}
.flash-back .audio-btn{margin-top:8px;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:104px;}
.flash-controls{display:flex;gap:12px;justify-content:space-between;}
.flash-controls .btn{flex:1 1 0;min-height:52px;}
.flash-controls .btn:disabled{opacity:.45;cursor:not-allowed;transform:none;box-shadow:none;}
.hsk-card-disabled{cursor:not-allowed;opacity:.62;background:color-mix(in srgb,var(--surface-soft) 68%,transparent);box-shadow:none;}
@media(max-width:560px){
  #dict-results{grid-template-columns:1fr;}
  .flash-controls{flex-direction:column;}
}
