/* VocabSRS 1.0 — calm study UI */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Vazirmatn:wght@400;500;600;700&display=swap');

:root,
[data-theme="light"] {
  --font: 'Vazirmatn', 'DM Sans', system-ui, sans-serif;
  --font-en: 'DM Sans', 'Vazirmatn', system-ui, sans-serif;
  --bg: #eef6f4;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: rgba(15, 23, 42, 0.1);
  --border-focus: #0d9488;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-soft: rgba(13, 148, 136, 0.12);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(15, 118, 110, 0.08);
  --transition: 0.22s ease;
}
[dir="ltr"] body { font-family: var(--font-en); }

[data-theme="dark"] {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #1e2a3a;
  --bg-input: #243044;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger-soft: rgba(239, 68, 68, 0.15);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(13, 148, 136, 0.14), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(14, 165, 233, 0.1), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg-elevated); border-inline-start: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; inset-inline-end: 0; bottom: 0; z-index: 100;
}
[dir="ltr"] .sidebar { inset-inline-end: auto; inset-inline-start: 0; border-inline-start: none; border-inline-end: 1px solid var(--border); }
.sidebar-brand { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.75rem; }
.sidebar-brand .logo {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 0.85rem;
}
.sidebar-brand h1 { font-size: 1.05rem; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav-section { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); padding: 0.75rem 1rem 0.35rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; margin-bottom: 2px; transition: all var(--transition);
}
.nav-link:hover { background: rgba(59, 130, 246, 0.06); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link .icon { font-size: 1.1rem; width: 1.5rem; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }

.main-area { flex: 1; margin-inline-end: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
[dir="ltr"] .main-area { margin-inline-end: 0; margin-inline-start: var(--sidebar-w); }
.topbar {
  height: var(--topbar-h); background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50;
}
.page-content { flex: 1; padding: 1.5rem; max-width: 1100px; width: 100%; }

.auth-layout {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #dbeafe 0%, var(--bg) 45%); padding: 2rem;
}
[data-theme="dark"] .auth-layout { background: radial-gradient(ellipse at top, #1e3a5f 0%, var(--bg) 60%); }
.auth-card {
  width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.landing-page { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.landing-hero { text-align: center; padding: 3rem 0 2rem; }
.landing-hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.4; }
.landing-hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; margin: 0 auto 1.5rem; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.card-title { font-size: 1rem; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; inset-inline-end: 0; width: 4px; height: 100%;
  background: var(--accent, var(--primary)); border-radius: 4px 0 0 4px;
}
[dir="ltr"] .stat-card::before { inset-inline-end: auto; inset-inline-start: 0; border-radius: 0 4px 4px 0; }
.stat-card.accent-green { --accent: var(--success); }
.stat-card.accent-red { --accent: var(--danger); }
.stat-card.accent-amber { --accent: var(--warning); }
.stat-card.accent-purple { --accent: #8b5cf6; }
.stat-card.accent-blue { --accent: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.hero-card {
  background: linear-gradient(135deg, var(--primary-soft), var(--bg-card));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem;
}
.hero-card h2 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.hero-card p { color: var(--text-muted); font-size: 0.95rem; }

.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.path-tile {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; cursor: pointer; transition: all var(--transition); display: block; color: inherit;
}
.path-tile:hover, .path-tile:has(input:checked) { border-color: var(--primary); box-shadow: var(--shadow); }
.path-tile input { margin-inline-end: 0.5rem; }
.path-tile h3 { font-size: 1rem; margin: 0.5rem 0 0.35rem; }
.path-tile p { font-size: 0.85rem; color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.95rem; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: all var(--transition);
}
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; font-weight: 600; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-danger-soft { background: var(--danger-soft); border: 1px solid rgba(239,68,68,0.25); color: var(--danger); }
.btn-warning-soft { background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.25); color: #b45309; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.35rem; }
input, textarea {
  width: 100%; padding: 0.65rem 0.85rem; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 0.9rem;
}
input:focus, textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h2 { font-size: 1.4rem; font-weight: 600; }

.user-pill { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.75rem; background: var(--bg-input); border-radius: 20px; font-size: 0.85rem; color: var(--text-muted); }
.avatar { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary), #8b5cf6); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; color: #fff; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.messages { list-style: none; margin-bottom: 1rem; }
.messages li { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; background: var(--bg-card); border: 1px solid var(--border); border-inline-start: 4px solid var(--success); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); }
th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-dim); background: var(--bg-input); }

/* Flashcard quiz */
.quiz-wrap { max-width: 520px; margin: 0 auto; }
.quiz-progress { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.flashcard {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 2.5rem 2rem; text-align: center; box-shadow: var(--shadow); min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 1.25rem;
}
.flashcard-word { font-size: 2.25rem; font-weight: 700; margin-bottom: 0.5rem; direction: ltr; }
.flashcard-word-row {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem; flex-wrap: wrap;
  width: 100%;
}
.flashcard-word-row .flashcard-word { margin-bottom: 0; }
.flashcard-hint { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }
.flashcard-answer { font-size: 1.15rem; color: var(--text); line-height: 1.7; margin-top: 0.5rem; }
.flashcard-example { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.75rem; font-style: italic; direction: ltr; }
.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.rate-grid form { display: contents; }
.rate-btn { padding: 0.85rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); font-family: var(--font); font-size: 0.95rem; cursor: pointer; transition: all var(--transition); }
.rate-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.rate-btn.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.rate-btn.warning { background: var(--warning-soft); color: #b45309; }
.rate-btn.success { background: var(--success-soft); color: #047857; }
.rate-btn.primary { background: var(--primary-soft); color: var(--primary); }

.mcq-options { display: flex; flex-direction: column; gap: 0.55rem; width: 100%; margin-top: 1rem; text-align: start; }
.mcq-option {
  display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); cursor: pointer;
}
.mcq-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.mcq-option input { width: auto; margin-top: 0.15rem; }

.study-sheet-header { align-items: flex-start; }
.study-sheet-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.study-table .example-cell { font-size: 0.85rem; color: var(--text-muted); max-width: 280px; direction: ltr; }
.muted { color: var(--text-dim); font-weight: 400; font-size: 0.9em; }

.lesson-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.45rem;
  max-height: 280px; overflow-y: auto; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.lesson-chip {
  display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; cursor: pointer;
}
.lesson-chip input { width: auto; }
.lesson-quick-picks { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1.25rem; }
.custom-study-form .form-row { margin-bottom: 1.25rem; }
.card-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }

.leitner-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5rem; }
.leitner-box { text-align: center; padding: 0.65rem 0.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.leitner-box-hot { border-color: var(--amber); background: #fffbeb; }
.leitner-box small { display: block; color: var(--text-dim); font-size: 0.7rem; }

/* Styled native selects */
select,
.form-select {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 14px;
}
[dir="ltr"] select,
[dir="ltr"] .form-select {
  padding: 0.65rem 0.85rem 0.65rem 2.25rem;
  background-position: right 0.75rem center;
}
select:hover,
.form-select:hover { border-color: var(--primary); }
select:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
select option {
  background: var(--bg-card);
  color: var(--text);
  padding: 0.5rem;
}
.lang-select {
  width: auto;
  min-width: 4.5rem;
  padding: 0.4rem 1.75rem 0.4rem 0.65rem;
  font-size: 0.85rem;
}
[dir="ltr"] .lang-select { padding: 0.4rem 0.65rem 0.4rem 1.75rem; }

/* Custom study builder */
.custom-study-page { max-width: 1180px; }
.custom-study-intro { align-items: flex-end; }
.custom-study-intro h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.35rem; }
.selection-summary {
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
  padding: 0.65rem 1rem; background: var(--primary-soft); border-radius: 999px;
  font-size: 0.9rem; color: var(--primary); font-weight: 600;
}
.summary-count, .summary-words { font-size: 1.1rem; }
.summary-sep { opacity: 0.5; }
.custom-study-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 1.25rem; align-items: start;
}
.study-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h2 { margin-bottom: 0; }
.range-tools { display: flex; align-items: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.range-field { display: flex; flex-direction: column; gap: 0.2rem; }
.range-field span { font-size: 0.75rem; color: var(--text-dim); }
.form-input-sm {
  width: 4.5rem; padding: 0.45rem 0.55rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input); font-family: var(--font);
}
.quick-picks { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip-btn {
  padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-muted); font-family: var(--font);
  font-size: 0.82rem; cursor: pointer; transition: all var(--transition);
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chip-muted { color: var(--text-dim); }
.lesson-blocks { display: flex; flex-direction: column; gap: 1rem; }
.lesson-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.85rem; background: var(--bg-input); }
.block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.65rem; }
.block-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.btn-text {
  border: none; background: none; color: var(--primary); font-family: var(--font);
  font-size: 0.8rem; cursor: pointer; padding: 0.2rem 0.4rem;
}
.btn-text:hover { text-decoration: underline; }
.lesson-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 0.45rem; }
.lesson-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 58px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); cursor: pointer; transition: all var(--transition); font-family: var(--font);
}
.lesson-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.lesson-tile.is-selected {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.lesson-num { font-size: 1.1rem; font-weight: 700; line-height: 1; }
.lesson-label { font-size: 0.62rem; color: var(--text-dim); margin-top: 0.15rem; }
.lesson-tile.is-selected .lesson-label { color: var(--primary); }
#lessonHiddenInputs { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
#lessonHiddenInputs ul { list-style: none; margin: 0; padding: 0; }
#lessonHiddenInputs li { margin: 0; padding: 0; }

.study-sheet-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1rem;
}
.toolbar-search { flex: 1; min-width: 220px; }
.toolbar-filter { min-width: 160px; }
.toolbar-speed { min-width: 180px; }
.speed-control { display: flex; align-items: center; gap: 0.65rem; }
.speed-control input[type="range"] {
  flex: 1; min-width: 100px; accent-color: var(--primary); cursor: pointer;
}
.speed-control output {
  font-size: 0.85rem; font-weight: 600; color: var(--primary);
  min-width: 3rem; text-align: center; font-variant-numeric: tabular-nums;
}
.toolbar-search label, .toolbar-filter label, .toolbar-speed label {
  display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.35rem;
}
.study-table .example-fa { direction: rtl; text-align: right; max-width: 300px; font-size: 0.85rem; }
.study-table .example-en { direction: ltr; }
.study-table .meaning-fa { direction: rtl; }
.sheet-empty-msg { padding: 1rem 0 0; text-align: center; }
.print-only { display: none; }
.sheet-print-header h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.sheet-print-header p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.word-with-speak { display: inline-flex; align-items: center; gap: 0.35rem; direction: ltr; }
.speak-col { width: 5.5rem; text-align: center; white-space: nowrap; }
.speak-group { display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; flex-wrap: wrap; }
.speak-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.85rem; height: 1.85rem; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: var(--bg-input); color: var(--primary); cursor: pointer;
  font-size: 0.7rem; font-weight: 700; line-height: 1; transition: all var(--transition); flex-shrink: 0;
}
.speak-btn-sub { width: 1.55rem; height: 1.55rem; border-radius: 6px; color: var(--text-muted); }
.speak-mini-label { font-size: 0.58rem; letter-spacing: 0.02em; }
.speak-icon { width: 1rem; height: 1rem; }
.speak-btn:hover { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.05); color: var(--primary); }
.speak-btn--active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.speak-btn--error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.speak-btn-lg { width: 2.35rem; height: 2.35rem; }
.speak-btn-lg .speak-icon { width: 1.2rem; height: 1.2rem; }

.row-correct { background: var(--success-soft); }
.row-wrong { background: var(--danger-soft); }
.review-detail td { font-size: 0.85rem; padding-top: 0 !important; }
.review-explain { padding: 0.35rem 0 0.75rem; }
.report-dialog { border: none; border-radius: var(--radius); padding: 1.25rem; max-width: 420px; width: 92%; }
.report-dialog textarea { width: 100%; margin-top: 0.5rem; }

.option-tiles { display: flex; flex-direction: column; gap: 0.55rem; }
.option-tile {
  display: block; padding: 0.85rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); cursor: pointer; transition: all var(--transition); position: relative;
}
.option-tile input { position: absolute; opacity: 0; pointer-events: none; }
.option-tile.is-selected,
.option-tile:has(input:checked) {
  border-color: var(--primary); background: var(--primary-soft);
}
.option-title { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.15rem; }
.option-desc { display: block; font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; }
.btn-block { width: 100%; margin-top: 0.5rem; }
.custom-study-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--topbar-h) + 1rem); }
.form-errors { list-style: none; color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }

@media (max-width: 960px) {
  .custom-study-layout { grid-template-columns: 1fr; }
  .custom-study-sidebar { position: static; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); transition: transform var(--transition); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-inline: 0 !important; }
  .rate-grid { grid-template-columns: 1fr; }
}

/* Study sheet print layout */
/* Home / roadmap / XP */
.home-hero {
  display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 1.25rem; align-items: stretch;
  margin-bottom: 1.25rem; padding: 1.5rem; border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(240,253,250,0.95));
  border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: rise-in 0.45s ease both;
}
.brand-title { font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -0.03em; margin-bottom: 0.4rem; color: var(--primary-hover); }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 0.35rem; }
.home-lead { color: var(--text-muted); max-width: 38rem; margin-bottom: 1rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.xp-panel {
  background: linear-gradient(160deg, #0f766e, #0d9488 55%, #14b8a6);
  color: #fff; border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; justify-content: center; gap: 0.55rem;
  animation: rise-in 0.55s ease 0.08s both;
}
.xp-panel .hint { color: rgba(255,255,255,0.85); }
.xp-level { font-size: 1.35rem; font-weight: 700; }
.xp-bar { height: 8px; background: rgba(255,255,255,0.25); border-radius: 999px; overflow: hidden; }
.xp-bar span { display: block; height: 100%; background: #fff; border-radius: 999px; transition: width 0.4s ease; }
.alert-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.85rem 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm);
  background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.35);
}
.roadmap-section { margin: 1.25rem 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.roadmap-track {
  display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.85rem 0.35rem 1rem;
  scroll-snap-type: x mandatory;
}
.roadmap-node {
  flex: 0 0 auto; width: 44px; text-align: center; scroll-snap-align: center;
  color: var(--text-muted); position: relative; transition: transform 0.2s ease;
}
.roadmap-node:hover { transform: translateY(-2px); color: var(--text); }
.roadmap-dot {
  display: block; width: 14px; height: 14px; margin: 0 auto 0.35rem; border-radius: 50%;
  background: #cbd5e1; border: 2px solid #94a3b8;
}
.roadmap-current .roadmap-dot {
  background: var(--primary); border-color: var(--primary-hover);
  box-shadow: 0 0 0 4px var(--primary-soft); animation: pulse-dot 1.6s ease infinite;
}
.roadmap-done .roadmap-dot { background: var(--success); border-color: #059669; }
.roadmap-locked { opacity: 0.45; pointer-events: none; }
.roadmap-num { font-size: 0.72rem; font-weight: 600; }
.stat-grid.compact { margin-top: 0.5rem; }
.badge-row { margin-top: 1.25rem; }
.badge-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.badge-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.7rem;
  border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); font-size: 0.85rem;
}
.rate-grid.two { grid-template-columns: 1fr 1fr; }
.study-flash { min-height: 220px; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.study-flash.is-revealed { transform: translateY(-2px); box-shadow: var(--shadow); }
.tg-status { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.tg-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.tg-status .dot.off { background: var(--text-dim); }
.cmd-list { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; margin-top: 0.75rem; direction: ltr; text-align: left; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 4px var(--primary-soft); } 50% { box-shadow: 0 0 0 8px rgba(13,148,136,0.08); } }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; }
}

@media print {
  .sidebar,
  .topbar,
  .no-print,
  .speak-col,
  .messages { display: none !important; }
  .main-area { margin: 0 !important; }
  .page-content { padding: 0.5rem !important; }
  .study-sheet-print-area { box-shadow: none !important; border: none !important; }
  .study-table { font-size: 9pt; width: 100%; }
  .study-table th,
  .study-table td { border: 1px solid #94a3b8 !important; padding: 4px 6px !important; }
  .study-table thead th { background: #2563eb !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .study-table .meaning-fa,
  .study-table .example-fa {
    direction: rtl; text-align: right; font-family: "Vazirmatn", Tahoma, sans-serif;
    unicode-bidi: plaintext; white-space: normal; word-wrap: break-word;
  }
  .study-table .meaning-en,
  .study-table .example-en,
  .study-table .word-en { direction: ltr; text-align: left; }
  tr[hidden] { display: none !important; }
  .print-only { display: block !important; margin-bottom: 0.75rem; }
  @page { size: A4 landscape; margin: 12mm; }
}
