@import url("/static/vendor/fonts/fonts.css");

/* Approved design: ink background, ivory text, muted gold accent. */
:root {
  --bg: #0b0b0e;
  --card: #15151b;
  --card-raised: #1b1a17;
  --text: #f4efe6;
  --muted: #a9a4b2;
  --accent: #c9a46a;
  --accent-dark: #e3c58f;
  --accent-soft: #2a2418;
  --on-accent: #0b0b0e;
  --ok: #e3c58f;
  --ok-soft: #2a2418;
  --warn: #e2b86b;
  --warn-soft: #2b2212;
  --bad: #f4efe6;
  --bad-soft: #2a2418;
  --border: #2a2a33;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --page-bg: url("../img/page-bg-dark.svg");
  color-scheme: dark;
}
/* Light theme: the same tokens on a warm paper background. Chosen from the header toggle. */
:root[data-theme="light"] {
  --bg: #f7f3ea;
  --card: #ffffff;
  --card-raised: #fbf7ee;
  --text: #1d1a14;
  --muted: #6b6558;
  --accent: #a8781f;
  --accent-dark: #7d5612;
  --accent-soft: #f5ecd6;
  --on-accent: #ffffff;
  --ok: #7d5612;
  --ok-soft: #f5ecd6;
  --warn: #9a6a10;
  --warn-soft: #fbf1dc;
  --bad: #1d1a14;
  --bad-soft: #f5ecd6;
  --border: #e3dccb;
  --shadow: 0 18px 48px rgba(60, 45, 15, 0.12);
  --page-bg: url("../img/page-bg-light.svg");
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
a { color: inherit; }
a:hover { color: var(--accent-dark); }
/* The background picture sits behind every page, in both themes */
body {
  background: var(--bg) var(--page-bg) center top / cover no-repeat;
  color: var(--text);
  font-family: "Vazirmatn", system-ui, sans-serif;
  line-height: 1.9;
  font-size: 14.5px;
  /* Header on top, page content in the middle, footer at the bottom of the screen */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-main { flex: 1 0 auto; display: flex; flex-direction: column; }
.site-main > * { flex-shrink: 0; }
[hidden] { display: none !important; }
h1 { font-size: 21.5px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }

/* Buttons and fields */
button, .btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--on-accent);
  transition: background 0.15s, opacity 0.15s;
}
button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.ghost:hover:not(:disabled) { background: var(--accent-soft); }
button.danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-dark); }
button.wide { width: 100%; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
/* Browser autofill paints fields with its own colour (yellow or olive in Firefox). Keep the normal field colours in every browser. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
input:autofill, textarea:autofill, select:autofill { background-color: var(--bg) !important; color: var(--text) !important; }
input:-moz-autofill, textarea:-moz-autofill, select:-moz-autofill { background-color: var(--bg) !important; color: var(--text) !important; }
.ltr-field { direction: ltr; text-align: left; }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 13.5px; }
.inline input { width: auto; margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 160px; }
.row > button { flex: 0 0 auto; min-width: 0; }
.error { color: var(--text); background: var(--bad-soft); border: 1px solid var(--accent); padding: 10px 12px; border-radius: 10px; }
.notice { color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.ok-msg { color: var(--ok); background: var(--ok-soft); padding: 10px 12px; border-radius: 10px; }

/* Public pages (landing and login) */
.hero {
  min-height: 0;
  flex: 1 0 auto;
  background: transparent;
  color: var(--text);
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
}
.hero > * { position: relative; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.lang-toggle { display: inline-flex; gap: 2px; padding: 3px; height: 40px; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.lang-toggle span { padding: 0 11px; display: inline-flex; align-items: center; border-radius: 999px; }
.lang-toggle span.is-active { background: var(--accent); color: var(--on-accent); }
.lang-toggle:hover:not(:disabled) { background: var(--accent-soft); }
.hero-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  text-align: center;
}
.hero-content h1 { font-family: "Cormorant Garamond", "Vazirmatn", serif; font-weight: 500; font-size: clamp(38px, 6vw, 72px); line-height: 1.05; margin: 0 0 18px; }
.hero-content .lead { font-size: clamp(16px, 2.2vw, 20px); opacity: 0.92; max-width: 640px; margin: 0 auto 36px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 760px; margin: 0 auto; }
.choice {
  display: block;
  text-decoration: none;
  color: var(--text);
  text-align: right;
  padding: 26px 26px 22px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.choice:hover, .choice:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
.choice strong { display: block; font-size: 20px; margin-bottom: 6px; }
.choice span { opacity: 0.85; font-size: 13.5px; }
.auth-wrap { display: grid; place-items: center; padding: 56px 24px 72px; }
.auth-card {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  color: var(--text);
  border-radius: 24px;
  padding: 40px 48px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.auth-card.auth-wide { max-width: 900px; }
.auth-card h1 { margin-bottom: 10px; }
.auth-card label:not(.inline) { margin-top: 18px; }
.auth-card .links { margin-top: 24px; }
/* The submit button sits below the last field, with the same room as the gap between fields */
.auth-card > button[type="submit"] { margin-top: 24px; }
/* A field with a button beside it: the button sits on the same line as the input, with room around it */
.field-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; margin-top: 4px; }
.field-action button { white-space: nowrap; padding: 12px 22px; }
/* The send button's place while a new code cannot be asked for yet: a countdown instead of the button */
.send-slot { display: flex; }
.resend-wait { align-self: center; padding: 12px 22px; }
button.secondary { background: var(--accent-soft); color: var(--accent); }
button.secondary:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
/* Two columns on wide screens, one on phones */
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.auth-grid .full { grid-column: 1 / -1; }
.auth-grid > button.full { margin-top: 28px; padding: 14px 18px; }
/* Each consent line takes the full width, with its checkbox at the start */
.auth-grid .full > label.inline { display: flex; width: 100%; margin-top: 18px; }
.auth-grid .full > label.inline + label.inline { margin-top: 14px; }
.auth-card .back { display: inline-block; margin-bottom: 8px; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.hero .auth-card .lang-row { display: flex; justify-content: flex-end; }
.hero .auth-card .lang-toggle { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* App shell */
.app-top { background: var(--card); border-bottom: 1px solid var(--border); max-width: none; }
.app-top .brand { color: var(--accent); }
.who { color: var(--muted); font-size: 12.5px; flex: 1; text-align: center; }
.tabs { display: flex; gap: 8px; max-width: 1100px; margin: 16px auto 0; padding: 0 16px; }
.tab { background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 16px; border: 1px solid var(--border); }
.tab.is-active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.two-col { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Lesson: status on top, chat in the middle, composer at the bottom */
.lesson { display: grid; gap: 12px; }
.lesson-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lesson-top .chip { flex: 1; min-width: 220px; }
/* The three buttons form one group: on a computer they sit in the top row as before. */
.lesson-actions { display: contents; }
/* On a phone: the status and the timer are the top row, and end, cancel and "did not understand" share the row below. */
@media (max-width: 767.98px) {
  .lesson-top { gap: 6px; }
  .lesson-top .chip { flex: 1 1 auto; min-width: 0; }
  .lesson-actions { display: flex; flex: 1 1 100%; gap: 6px; }
  .lesson-actions .ghost { flex: 1 1 0; min-width: 0; padding: 6px 8px; font-size: 12.5px; white-space: nowrap; }
}
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.chip.turn-you { background: var(--ok-soft); color: var(--ok); }
.chip.turn-recording { background: var(--accent-soft); color: var(--accent-dark); }
.chip.turn-recording::before { animation: blink 1s infinite; }
.chip.turn-niko { background: var(--accent-soft); color: var(--accent); }
.chip.turn-ended { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
@keyframes blink { 50% { opacity: 0.2; } }
/* On a computer the lesson card fills the screen below the header: only the chat scrolls, and the buttons, the microphone and the options stay in view. */
@media (min-width: 761px) {
  #lessonBox.lesson { height: calc(100vh - var(--header-h) - 48px); min-height: 520px; grid-template-rows: auto minmax(0, 1fr); }
  #lessonBox .chat { height: auto; min-height: 0; }
}
.chat {
  height: min(52vh, 480px);
  min-height: 260px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  margin: 5px 0;
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  word-break: break-word;
}
.bubble .who-label { display: block; font-size: 11px; opacity: 0.75; direction: rtl; text-align: right; }
.bubble.user { background: var(--accent); color: var(--on-accent); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.assistant { background: var(--card); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.thinking { opacity: 1; }
/* Three dots that rise in turn while the teacher is writing. */
.typing-dots { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; }
.typing-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: 0.7; } }
.bubble.note { align-self: center; max-width: 100%; background: none; color: var(--muted); font-size: 12.5px; text-align: center; }
.composer { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { margin: 0; flex: 1; min-height: 52px; max-height: 160px; resize: vertical; }
.composer .send { padding: 12px 22px; height: 52px; }
/* The message box holds the microphone inside it, on the right, like the free talk topic box. */
.msg-field { position: relative; flex: 1; display: flex; min-width: 0; }
.msg-field textarea { flex: 1; width: 100%; margin: 0; padding-inline-end: 42px; min-height: 58px; }
/* The microphone sits on the right of the box in Persian and on the left in English. The text keeps clear of it. */
html[dir="rtl"] .topic-voice { inset-inline: auto; right: 4px; left: auto; }
html[dir="ltr"] .topic-voice { inset-inline: auto; left: 4px; right: auto; }
html[dir="rtl"] .topic-field input, html[dir="rtl"] .msg-field textarea { padding-left: 12px; padding-right: 42px; }
html[dir="ltr"] .topic-field input, html[dir="ltr"] .msg-field textarea { padding-right: 12px; padding-left: 42px; }
.topic-voice .mic { width: 32px; height: 32px; }
.topic-voice .mic svg { width: 18px; height: 18px; }
.mic {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
}
.mic svg { width: 26px; height: 26px; fill: currentColor; }
/* The microphone is blue while it listens, on every page that takes speech (free talk, lesson, self-test). */
:root { --listen: #2f6fdb; }
.mic.is-recording, .topic-mic.is-recording { background: var(--listen); color: #fff; animation: pulse-listen 1.2s infinite; }
/* The lesson and self-test microphone is only the icon, like the free talk one: no circle, and the site's hover does not paint it. */
.mic:not(.is-recording), .mic:not(.is-recording):hover, .mic:not(.is-recording):focus { background: transparent !important; box-shadow: none !important; color: var(--accent); }
.mic:not(.is-recording):hover { color: var(--accent-dark); }
.topic-mic.is-recording { border-radius: 50%; }
@keyframes pulse-listen {
  0% { box-shadow: 0 0 0 0 rgba(47, 111, 219, 0.45); }
  70% { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.lesson-help { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.lesson-row { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 6px 0; }
.lesson-row.lesson-current { border-color: var(--accent); background: var(--accent-soft); }
.lesson-row.lesson-upcoming { opacity: 0.6; }
/* Live level bars shown while the microphone is listening. */
.voice-meter { display: flex; align-items: center; justify-content: center; gap: 4px; height: 34px; margin: 6px 0; }
.voice-meter span { display: block; width: 5px; height: 6px; border-radius: 3px; background: var(--listen); transition: height 0.06s linear; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.45); }
  70% { box-shadow: 0 0 0 16px rgba(180, 35, 24, 0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0); }
}
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }
.options { display: flex; gap: 18px; flex-wrap: wrap; }

/* Reports */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.stat .label { color: var(--muted); font-size: 11.5px; }
.stat .value { font-size: 18px; font-weight: 700; }
.bar-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.bar { height: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar > span.planned { background: var(--muted); }
.suggestion { background: var(--accent-soft); color: var(--text); padding: 12px 14px; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: right; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }

/* Parent */
.student-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.student-card { text-align: right; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 16px; padding: 16px; }
.student-card:hover, .student-card.is-selected { border-color: var(--accent); }
.student-card strong { display: block; font-size: 15.5px; }
.detail-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.danger-zone { border-color: var(--bad-soft); }

/* Shared header and footer, the same on every page */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--border); }
.site-header-inner, .site-footer-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
/* Theme and language sit at the start of the line (right in Persian, left in English), then the logo. */
.site-header-inner { justify-content: flex-start; }
.site-tools { display: flex; gap: 6px; align-items: center; }
/* Compact theme and language controls, so the header keeps its room for the menu */
.site-tools .icon-btn { width: 34px; height: 34px; }
.site-tools .icon-btn svg { width: 16px; height: 16px; }
.site-tools .lang-toggle { height: 34px; font-size: 11.5px; padding: 2px; }
.site-tools .lang-toggle span { padding: 0 9px; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 50%; }
.icon-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }
.site-brand { display: inline-flex; align-items: center; direction: ltr; text-decoration: none; color: var(--text); }
.site-brand svg { display: block; flex: none; height: 40px; width: auto; }
.brand-mark { fill: var(--accent); }
.brand-z { fill: #1A1A1F; }
.brand-word { fill: var(--text); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; font-size: 13.5px; margin-inline: auto; }
/* Row one: logo, theme and language, the main menu in the middle, and sign-in at the end.
   Row two (only after sign-in): the signed-in person's own items. */
.site-header-inner { justify-content: space-between; }
.site-brand { margin-inline: 0; }
.site-nav { margin-inline: auto; }
.site-nav a { text-decoration: none; color: var(--muted); padding: 8px 16px; border-radius: 999px; transition: background .2s, color .2s; }
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.site-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill { padding: 10px 18px; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; color: var(--text); text-decoration: none; }
.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.gold { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.pill.gold:hover { background: var(--accent-dark); color: var(--on-accent); }
/* Until the visitor is known, the header actions stay hidden, so the sign-in buttons do not flash on a member page. */
.site-actions[data-state="loading"] { visibility: hidden; }
.site-greeting { color: var(--muted); font-size: 13.5px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
/* Profile photo in the header and the menu that opens from it */
.account-menu { position: relative; }
button.avatar-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
button.avatar-btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
button.avatar-btn[aria-expanded="true"] { border-color: var(--accent); }
.avatar-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-menu-list { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30; min-width: 240px; display: grid; gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
/* The profile menu opens and closes with a soft fade and slide. */
.account-menu-list { opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .3s ease, transform .3s ease, visibility .3s; }
.account-menu-list.is-open { opacity: 1; visibility: visible; transform: none; }
button.account-item { display: block; width: 100%; text-align: start; background: transparent; color: var(--text); border: 0; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 400; }
.account-menu-list button.account-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-dark); }
button.account-item.danger { color: var(--bad); }
.account-menu-list .account-item.danger:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); }
.account-sep { height: 1px; margin: 6px 4px; background: var(--border); }
/* Account dialogs: personal details and password */
dialog.account-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
dialog.account-dialog.account-dialog-wide { width: min(720px, calc(100% - 32px)); }
dialog.account-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.account-dialog form { display: block; }
dialog.account-dialog h2 { margin-bottom: 4px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.dialog-actions button { margin: 0; }

/* The reports list: a filter row, then one row per report. A row opens its details in the dialog. */
.report-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.report-filter button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.report-rows { display: flex; flex-direction: column; gap: 8px; }
.report-row { box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.report-open { margin-top: 8px; }
/* The report page: each part is its own box, with its title in bold and the text around it in normal weight. */
.report-stack { display: flex; flex-direction: column; gap: 24px; }
.report-top { display: flex; justify-content: flex-start; }
.report-block { display: flex; flex-direction: column; gap: 12px; }
.report-stack > .report-block + .report-block { padding-top: 24px; border-top: 1px solid var(--border); }
.report-block > h2 { margin: 0; font-weight: 700; color: var(--accent); }
.report-block strong { font-weight: 400; }
.report-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.report-bar { flex-wrap: nowrap; }
.report-bar .report-date { flex: 1 1 0; min-width: 0; }
.report-bar .report-input input { font-size: 13px; padding-inline: 8px 64px; }
.report-bar .report-size { flex: 0 0 auto; }
.report-bar .report-size select { width: 96px; }
.report-calendar .report-cal-day.is-in-range { background: var(--accent-soft); }

.report-date-clear { position: absolute; inset-inline-end: 40px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.report-date-clear:hover { background: var(--accent-soft); color: var(--accent-dark); }
.report-list { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
:root:not([data-theme="light"]) .report-list .btn-close { filter: invert(1); }
.report-date, .report-size { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.report-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px; margin-top: 8px; }
.report-date { position: relative; }
.report-input { position: relative; display: flex; align-items: center; }
.report-input input { width: 100%; padding-inline-end: 74px; }
.report-range input[type="date"] { flex: 1 1 130px; min-width: 0; width: auto; }
.report-cal-btn { position: absolute; inset-inline-end: 4px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.report-cal-btn:hover { background: var(--accent-soft); color: var(--accent-dark); }
.report-cal-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.report-calendar { position: absolute; top: 100%; inset-inline-start: 0; z-index: 20; width: 280px; margin-top: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.report-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.report-cal-nav { padding: 4px 10px; font-size: 14.5px; line-height: 1; }
.report-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.report-cal-week { font-size: 11px; color: var(--muted); }
.report-cal-day { padding: 6px 0; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 12.5px; cursor: pointer; }
.report-cal-day:hover { background: var(--accent-soft); }
.report-cal-day[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.report-size { margin-inline-start: auto; }
.report-size select { width: auto; }
.report-status-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.level-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.level-item { border: 1px solid var(--border); border-radius: 14px; background: var(--card); min-width: 0; }
.level-item.level-speaking { grid-column: 1 / -1; }
.level-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.level-row .skill-icon { width: 36px; height: 36px; border-radius: 10px; }
.level-row .skill-icon svg { width: 20px; height: 20px; }
.level-name { flex: 1; min-width: 0; }
.level-sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 0 14px 14px; }
.level-sub .level-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-raised); }
@media (max-width: 560px) { .level-list { grid-template-columns: minmax(0, 1fr); } }
.evaluation { display: flex; flex-direction: column; gap: 6px; }
.evaluation p { margin: 0; }
.evaluation-heading { margin: 14px 0 2px; font-size: 14.5px; color: var(--accent-dark); }
.evaluation-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.report-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.report-row-top strong { font-weight: 700; }
.report-type { flex: 0 0 auto; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; }

/* ---- Dashboard: the learner's cards in a grid of two columns, one column on a phone ---- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-card { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; box-sizing: border-box; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--card-raised); color: var(--text); }
.dash-card > .dash-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--accent); }
.dash-card > button { align-self: flex-start; margin: 0; }
/* A card that is a link to another page: the whole card is the target. */
.dash-card.dash-plan { text-decoration: none; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.dash-card.dash-plan:hover, .dash-card.dash-plan:focus-visible { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, .06); color: var(--text); outline: none; }
.dash-card.dash-wide { grid-column: 1 / -1; }
.dash-date { margin: 0; font-size: 12.5px; color: var(--muted); }
.dash-label { margin: 0; font-size: 12.5px; color: var(--muted); }
.dash-meta { margin: 0; font-size: 13px; color: var(--text); }
/* The ring: one circle for the track and one for the filled part, with the percent in the middle. */
.dash-donut { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin: 2px auto; }
.dash-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dash-donut .donut-track { fill: none; stroke: var(--border); }
.dash-donut .donut-fill { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.donut-value { position: absolute; font-size: 21px; font-weight: 700; color: var(--accent-dark); }
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-card { padding: 16px; }
}
.avatar-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.avatar-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-edit-actions button { margin: 0; padding: 8px 14px; }
.avatar-preview { width: 88px; height: 88px; flex: none; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.avatar-preview svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.accent-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.accent-card { border: 1px solid var(--border); background: var(--card-raised); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.accent-card.is-selected { border-color: var(--accent); }
.accent-card strong { font-size: 15.5px; }
.accent-card .sample { font-style: italic; color: var(--muted); direction: ltr; text-align: left; margin: 0; }
.accent-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-actions { display: flex; justify-content: flex-end; margin: 16px 0 0; }
.site-menu { position: relative; }
.site-menu > summary { list-style: none; cursor: pointer; }
.site-menu > summary::-webkit-details-marker { display: none; }
.site-menu[open] > summary { border-color: var(--accent); }
.site-menu-list { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 20; min-width: 220px; display: grid; gap: 4px; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.site-menu-list a { padding: 10px 14px; border-radius: 10px; text-decoration: none; color: var(--text); }
.site-menu-list a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.site-footer { border-top: 1px solid var(--border); background: var(--card); font-size: 12.5px; color: var(--muted); }
.site-footer-inner { padding: 14px 24px 16px; justify-content: flex-start; text-align: start; }
.site-footer .site-nav { gap: 24px; font-size: 12.5px; margin-inline: 0; }
.site-footer .site-nav a { padding: 0; }
.site-footer .site-nav a:hover { background: none; }

/* The header links and switches sit in a drawer on desktop, so the drawer is transparent there. */
.site-drawer { display: contents; }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  /* One row: profile and name, logo, and the ☰ button. The links and switches open below it. */
  .site-header-inner { flex-wrap: nowrap; justify-content: space-between; padding: 10px 14px; gap: 10px; }
  .site-brand { order: 2; margin: 0; }
  .site-brand svg { height: 32px; }
  .site-actions { order: 1; flex-wrap: nowrap; gap: 8px; min-width: 0; margin: 0; }
  .site-greeting { max-width: 96px; }
  .site-actions .pill { padding: 8px 12px; font-size: 12.5px; }
  .menu-toggle { display: inline-flex; order: 3; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text); flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
  .menu-toggle span { display: block; width: 16px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .3s ease, opacity .3s ease; }
  .site-header.nav-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .site-header.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .site-header.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  /* The drawer opens and closes with a soft fade and slide. */
  .site-drawer { display: flex; flex-direction: column; gap: 14px; position: fixed; top: 64px; inset-inline: 0; z-index: 25; max-height: calc(100vh - 64px); overflow-y: auto; padding: 12px 14px 18px; background: var(--card); border-bottom: 0.5px solid var(--border); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .3s ease, transform .3s ease, visibility .3s; }
  .site-header.nav-open .site-drawer { opacity: 1; visibility: visible; transform: none; }
  .site-nav { flex-direction: column; align-items: stretch; gap: 2px; margin: 0; font-size: 14.5px; }
  .site-nav a { padding: 12px 14px; border-radius: 12px; }
  .site-tools { justify-content: center; }
  .site-tools .icon-btn { width: 40px; height: 40px; }
  .site-tools .lang-toggle { height: 40px; font-size: 12.5px; }
  .account-menu-list { position: fixed; top: 64px; inset-inline: 12px; min-width: 0; }
}

@media (max-width: 560px) {
  .composer .send { padding: 12px 14px; }
  .mic { width: 54px; height: 54px; }
  .chat { height: 46vh; }
  .hero-content { padding-top: 36px; }
  .choice { text-align: center; }
}

/* Learner tools: progress bars, help cards, self-test chat bubbles */
.bar { height: 10px; background: var(--border); border-radius: 6px; overflow: hidden; margin: 8px 0 16px; }
.bar .progress-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.stage { border-bottom: 1px solid var(--border); padding: 8px 0; }
.help-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.help-item audio, .help-item video { width: 100%; margin: 6px 0; }
.help-video { max-height: 260px; }
.help-image { display: block; max-width: 100%; border-radius: 12px; margin: 6px 0; }
.help-filter-field { display: grid; gap: 4px; margin: 10px 0; }
.help-filter-field select { width: 100%; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px; margin: 6px 0; white-space: pre-wrap; }
.bubble.niko { background: var(--card-raised); }
.bubble.me { background: var(--ok-soft); margin-inline-start: auto; }
.tool-section .row { gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .tool-section .row > * { flex: 1 1 100%; }
}

/* Learning path: done, current and next lessons */
.program-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.plan-item { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.plan-item.is-done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.plan-item.is-current { color: var(--accent-dark); background: var(--accent-soft); border: 1px solid var(--accent); font-weight: 700; }
.plan-item.is-next { color: var(--muted); opacity: 0.6; }
.legend { font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-start: 6px; background: var(--muted); }
.legend-dot.is-done { background: var(--ok); }
.legend-dot.is-current { background: var(--accent); }
.legend-dot.is-next { background: var(--muted); opacity: 0.6; }

/* Category tabs for the help content (separate from the main tabs) */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.filter-tab { background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.filter-tab.is-active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.filter-tab:hover:not(.is-active) { background: var(--accent-soft); color: var(--accent); }

/* Admin: the start prompt of one learner, part by part */
.prompt-part { direction: ltr; text-align: left; white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12.5px; line-height: 1.6; margin: 8px 0 14px; }
#promptPreview summary { cursor: pointer; font-weight: 600; margin-top: 10px; }

/* Public pages (about, contact) */
.public { padding: 64px 0 96px; }
.public-wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.public h1 { font-family: "Cormorant Garamond", "Vazirmatn", serif; font-weight: 500; font-size: clamp(30px, 4vw, 44px); line-height: 1.3; margin: 12px 0 18px; }
.public .eyebrow { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--accent); font-size: 16px; letter-spacing: 1px; }
.public .lead { font-size: 15.5px; line-height: 1.95; color: var(--muted); max-width: 640px; margin: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 44px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 28px; }
.feature-card .num { display: block; font-family: "Cormorant Garamond", serif; font-size: 30.5px; color: var(--accent); margin-bottom: 10px; }
.feature-card h2 { font-size: 18px; margin: 0 0 10px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.9; font-size: 13.5px; }
.public-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 36px; }
.contact-details { display: grid; gap: 12px; margin-top: 28px; }
.contact-row { display: flex; gap: 16px; align-items: baseline; margin: 0; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.contact-row span { color: var(--muted); font-size: 12.5px; min-width: 90px; }
.contact-row a { color: var(--text); font-size: 16px; text-decoration: none; direction: ltr; unicode-bidi: isolate; }
.contact-row a:hover { color: var(--accent); }
@media (max-width: 820px) { .feature-grid { grid-template-columns: 1fr; } }

/* Motion: blocks rise in as they scroll into view. Reduced motion turns it off. */
/* A plain fade only. Moving text with transforms left it looking blurry while it settled. */
.reveal { opacity: 0; transition: opacity .8s ease; }
.reveal.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transition: none; }
}

/* Shared layout for demo, consult, cooperation, about and contact */
.eyebrow { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--accent); font-size: 16px; letter-spacing: 1px; }
.page-main { padding: 40px 0 96px; }
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-top { display: flex; align-items: center; margin-bottom: 32px; }
.home-link { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); text-decoration: none; }
.home-link:hover { color: var(--accent); border-color: var(--accent); }
.home-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html[dir="ltr"] .home-link .arrow { transform: scaleX(-1); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.page-title { font-family: "Cormorant Garamond", "Vazirmatn", serif; font-weight: 500; font-size: clamp(30px, 4vw, 44px); line-height: 1.25; margin: 10px 0 18px; }
.page-text { color: var(--muted); font-size: 15.5px; line-height: 1.95; margin: 0; }
.page-card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 36px; box-shadow: var(--shadow); }
.page-card h2 { font-size: 21.5px; margin: 0 0 8px; }
.table-wrap { overflow-x: auto; }
.list-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.list-table th, .list-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: start; white-space: nowrap; }
.list-table th { color: var(--muted); font-weight: 600; }
.page-card input, .page-card select, .page-card textarea { width: 100%; }
.plan-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.plan-facts div { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.plan-facts dt { color: var(--muted); font-size: 12.5px; }
.plan-facts dd { margin: 6px 0 0; font-size: 16px; font-weight: 700; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 24px; border: 1px solid var(--border); background: linear-gradient(90deg, rgba(8, 8, 10, 0.92) 0%, rgba(8, 8, 10, 0.6) 55%, rgba(8, 8, 10, 0.85) 100%), url("/static/img/demo-photo.webp") center / cover no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-decoration: none; color: var(--text); overflow: hidden; box-shadow: var(--shadow); transition: border-color 0.3s ease; }
.video-frame:hover { border-color: var(--accent); }
.video-frame .play { width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 23.5px; background: rgba(8, 8, 10, 0.35); }
.video-frame .label { background: rgba(8, 8, 10, 0.6); color: #f4efe6; padding: 6px 16px; border-radius: 999px; font-size: 12.5px; }
.about-art { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.about-points { list-style: none; padding: 0; margin: 28px 0 0; }
.about-point { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-top: 1px solid var(--border); }
.about-point .num { font-family: "Cormorant Garamond", serif; font-size: 25px; color: var(--accent); }
.about-point h3 { font-size: 16px; margin: 0 0 6px; }
.about-point p { margin: 0; color: var(--muted); line-height: 1.85; font-size: 13.5px; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
  .page-card { padding: 24px; }
  .about-art { aspect-ratio: 16 / 10; }
}

/* Full-width stacked pages: text across the whole width, then the form below it */
.page-stack { display: flex; flex-direction: column; gap: 44px; }
.page-stack .page-title { max-width: none; }
.page-stack .page-text { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .page-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.form-grid .page-submit button { min-width: 220px; }
.form-grid label { margin-top: 16px; }
.form-grid .inline { margin-top: 18px; }
.page-banner { width: 100%; aspect-ratio: 21 / 8; object-fit: cover; object-position: center 40%; border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.page-stack .feature-grid { margin-top: 0; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .page-submit { justify-content: stretch; }
  .form-grid .page-submit button { width: 100%; }
  .page-banner { aspect-ratio: 16 / 9; }
}

/* Consent line: checkbox and text on one full line, aligned to the reading direction */
.form-grid .inline { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 18px; }
.form-grid .inline input[type="checkbox"] { width: auto; flex: none; margin: 0; }
/* Contact details appear as cards in a row */
.contact-details { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Section title inside a full-width page */
.page-card-title { font-family: "Cormorant Garamond", "Vazirmatn", serif; font-weight: 500; font-size: clamp(24px, 3vw, 34px); margin: 0 0 14px; }

/* Page titles in the theme's accent colour, and calmer select options that keep the theme colours */
.accent-title { color: var(--accent); }
.page-card select option { background: var(--card); color: var(--text); }
.page-card select option:checked { background: var(--accent-soft); color: var(--accent); }
/* Dropdown lists use the theme too: the hovered and focused option gets the soft accent, not the system blue */
select { color-scheme: dark; }
/* A read-only select only shows its value: no arrow, and it looks like plain text in a box. */
select:disabled { appearance: none; -webkit-appearance: none; opacity: 1; cursor: default; }
:root[data-theme="light"] select { color-scheme: light; }
select option, select optgroup { background: var(--card); color: var(--text); }
/* The theme's own colours for the controls: no browser blue on focus, selection or the select box. */
:root { accent-color: var(--accent); }
select, select:focus, select:active { background-color: var(--card); color: var(--text); }
::selection { background: var(--accent-soft); color: var(--accent-dark); }
select option:hover, select option:focus, select option:checked { background: var(--accent-soft); color: var(--accent); }
/* More space between the consent line and the submit button, and between the button and the field above */
.form-grid .inline { margin-bottom: 8px; }
.form-grid .page-submit { margin-top: 28px; }

/* Sign-in and sign-up cards: one column and smaller padding on phones */
@media (max-width: 760px) {
  .auth-wrap { padding: 32px 16px 48px; }
  .auth-card { padding: 28px 22px; border-radius: 20px; }
  .auth-grid { grid-template-columns: 1fr; }
  .field-action { grid-template-columns: 1fr; }
  .field-action button { width: 100%; }
}

/* App layout: the side menu for signed-in people. Desktop: a column beside the content. Phone: a bar at the bottom. */
:root { --header-h: 72px; }
/* ---- Side menu (signed-in area). One set of rules. Only the current page is filled; nothing else has a background. ---- */
.app-layout { display: flex; align-items: stretch; flex: 1 0 auto; min-width: 0; width: 100%; }
.app-layout > .site-main { flex: 1 1 auto; min-width: 0; }
/* On a computer the sheet is part of the column; on a phone it is a panel above the bar. */
.side-sheet { display: contents; }
.side-more-btn { display: none; }
/* The side menu stays in view below the header while the page scrolls. Its own items scroll inside it. */
.app-side { position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); width: 100%; box-sizing: border-box; background: transparent; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: thin; }
.app-side[hidden] { display: none; }
.side-group { position: relative; display: flex; flex-direction: column; gap: 4px; }
/* Every entry is a link or a button with the same look. The global button colour does not apply here. */
.side-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; box-sizing: border-box; margin: 0; padding: 10px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: start; text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.side-item:hover, .side-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--text); }
.side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-item[aria-current="page"], .side-item[aria-current="page"]:hover { background: var(--accent); color: var(--on-accent); font-weight: 700; }
/* A line between the groups of the side menu, with room above and below. */
.side-divider { height: 1px; margin: 12px 14px; background: var(--border); }
#appView > .tabs { display: none; }

@media (max-width: 760px) {
  :root { --header-h: 0px; }
  .app-layout { display: block; }
  /* Phone: the side menu is a bar at the bottom. */
  .app-side { position: fixed; inset: auto 0 0 0; flex: none; align-self: auto; flex-direction: row; justify-content: space-around; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-inline-start: 0; border-top: 0.5px solid var(--border); z-index: 15; }
  .app-side { height: auto; top: auto; overflow: visible; }
  .side-group { flex: 1 1 0; min-width: 0; gap: 0; position: static; }
  .side-divider { width: 1px; height: auto; align-self: stretch; margin: 8px 4px; }
  .side-more-btn { display: flex; flex: 1 1 0; min-width: 0; align-items: center; justify-content: center; margin: 0; padding: 8px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; }
  .side-more-btn[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
  .side-more-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .side-sheet { display: none; position: fixed; bottom: calc(68px + env(safe-area-inset-bottom)); inset-inline-end: 10px; z-index: 16; flex-direction: column; gap: 2px; width: max-content; min-width: 210px; max-width: calc(100vw - 20px); max-height: 60vh; overflow-y: auto; padding: 8px; background: var(--card); border: 0.5px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
  .side-sheet .side-item { justify-content: flex-start; text-align: start; padding: 10px 14px; font-size: 14px; white-space: normal; }
  .app-side.is-more-open .side-sheet { display: flex; }
  .side-sheet .side-group { flex: none; }
  .side-sheet .side-divider { width: auto; height: 1px; align-self: stretch; margin: 6px 10px; }
  .side-item { justify-content: center; text-align: center; min-width: 0; padding: 8px 2px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .site-main { padding-bottom: 84px; }
  .site-footer { display: none; }
}

@media (max-width: 760px) {
  /* Header on a phone: [profile and name] [logo] [language and theme] [☰ for guests]. */
  .site-header-inner { gap: 8px; padding: 10px 12px; }
  .site-brand { margin: 0; }
  .site-brand svg { height: 28px; }
  .site-actions { order: 1; min-width: 0; }
  .site-greeting { max-width: 64px; font-size: 12.5px; }
  .site-brand { order: 2; }
  .site-tools { order: 3; display: flex; gap: 4px; justify-content: flex-end; }
  .site-tools .icon-btn { width: 32px; height: 32px; }
  .site-tools .icon-btn svg { width: 15px; height: 15px; }
  .site-tools .lang-toggle { height: 32px; font-size: 11px; }
  .site-tools .lang-toggle span { padding: 0 7px; }
  .menu-toggle { order: 4; width: 34px; height: 34px; gap: 3px; }
  .menu-toggle span { width: 14px; }
  .site-header[data-member="true"] .menu-toggle { display: none; }
  .site-drawer { top: 60px; padding: 8px 10px 14px; max-height: calc(100vh - 60px); }
  .site-nav { font-size: 13.5px; }
  .site-header.nav-open .site-drawer { opacity: 1; visibility: visible; transform: none; }
  .site-tools { display: flex; }
}
@media (max-width: 760px) and (min-width: 0px) {
  .site-header-inner > .site-tools { position: static; opacity: 1; visibility: visible; transform: none; }
}

/* ---- Phone fit: compact header row and bottom bar (later rules win) ---- */
@media (max-width: 760px) {
  .site-brand svg { height: 26px; }
  .site-greeting { max-width: 76px; font-size: 12.5px; }
  button.avatar-btn { width: 36px; height: 36px; }
  .site-actions { gap: 6px; }
  .site-tools { gap: 4px; }
  .site-tools .lang-toggle span { padding: 0 6px; }
  .site-header-inner { gap: 6px; }
}

/* ---- Public links on phones: a row right under the header, not a drawer or the bottom bar ---- */
@media (max-width: 760px) {
  .menu-toggle { display: none; }
  .site-drawer { display: contents; position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; background: none; border: 0; padding: 0; max-height: none; }
  .site-header-inner { flex-wrap: wrap; row-gap: 6px; }
  .site-nav { order: 5; flex: 0 0 100%; width: 100%; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 2px; margin: 0; padding: 6px 0 0; border-top: 0.5px solid var(--border); font-size: 12.5px; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
}
/* ---- Admin console in the side menu (desktop) ---- */
.app-side .admin-tabs { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.app-side .admin-tabs .tab { display: block; width: 100%; text-align: start; border: 0; border-radius: 12px; padding: 9px 14px; background: transparent; color: var(--text); font-size: 12.5px; cursor: pointer; }
.app-side .admin-tabs .tab:hover { background: var(--accent-soft); }
.app-side .admin-tabs .tab.is-active { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ---- Active sign-ins in the admin console ---- */
.session-toolbar { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; margin: 12px 0; text-align: start; }
.session-toolbar > * { margin: 0; width: auto; }
.session-toolbar label.inline { margin: 0; }
.session-toolbar #sesCount { margin-inline-end: auto; }
.session-group { padding: 12px 16px; margin-bottom: 10px; }
.session-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.session-info { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.session-badge { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.session-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0 4px; border-top: 1px solid var(--border); margin-top: 10px; cursor: pointer; }
.session-text { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; min-width: 0; }

/* ---- Prompt generator ---- */
.placeholder-help { margin: 8px 0 16px; font-size: 12.5px; }
.placeholder-help li { padding: 3px 0; }
#genTemplate, #genOutput { width: 100%; font-family: inherit; direction: rtl; }

/* ---- Token meter on the plan page ---- */
.plan-meter { margin: 8px 0 16px; }
.meter { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s ease; }


/* ---- The personal details dialog also holds the learning details ---- */
dialog.account-dialog { overflow-y: auto; }
#accLearnerBox h3 { margin: 22px 0 0; font-size: 15.5px; }

/* ---- Level page: one row per skill, and the test card ---- */
/* Four boxes in one row on a wide screen, two per row on a laptop, one per row on a phone. */
/* Two skill boxes side by side; one box per row on a phone. Each box ends with the set-level button. */
.skill-rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 900px) { .skill-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .skill-rows { grid-template-columns: minmax(0, 1fr); } }
/* All skill boxes share the site's card colours and the site's accent colour for icons. */
.skill-card { --tint: var(--card-raised); --tint-line: var(--border); --tint-icon: var(--accent); border: 1px solid var(--tint-line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; min-width: 0; background: var(--tint); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); transition: border-color 0.2s, box-shadow 0.2s; }
.skill-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06); }
.skill-head { display: flex; flex-direction: row; align-items: center; gap: 12px; min-width: 0; width: 100%; }
.skill-icon { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--card); color: var(--tint-icon); border: 1px solid var(--tint-line); }
.skill-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skill-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.level-chip { flex: 0 0 auto; font-weight: 700; font-size: 11.5px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.skill-set { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-width: 0; width: 100%; }
.skill-set select { flex: 1 1 140px; width: auto; min-width: 0; padding: 8px 10px; font-size: 12.5px; }
/* Compact buttons: the page should not stretch them to fill the space. */
.skill-btn { padding: 9px 14px; font-size: 12.5px; white-space: nowrap; margin: 0; }
.skill-set .skill-btn { flex: 0 0 auto; }
.skill-test { width: 100%; margin-top: 0; padding: 13px 16px; font-size: 13.5px; font-weight: 700; }
.skill-note { font-size: 11.5px; margin: 0; padding: 12px; border-radius: 12px; background: var(--card); width: 100%; }
.test-text { font-size: 16px; line-height: 1.8; }
.test-options { display: grid; gap: 8px; margin: 12px 0; }
.test-option { text-align: start; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.test-option:hover { background: var(--accent-soft); }

/* ---- Phone bottom bar: every item sits in the middle of its own cell ---- */
@media (max-width: 760px) {
  .app-side { justify-content: space-between; }
}


/* ---- Responsive safety: no sideways scroll on a phone ---- */
.site-header, .site-header-inner, .site-main, .app-layout { max-width: 100%; min-width: 0; }
.site-header-inner > * { min-width: 0; max-width: 100%; }
@media (max-width: 760px) {
  .site-header-inner { width: 100%; box-sizing: border-box; }
  .site-nav { max-width: 100%; box-sizing: border-box; }
}
.plan-meta { font-size: 11.5px; }
/* Admin: a lesson row can be dragged to a new place in the program */
.admin-table tr.drag-row { cursor: grab; }
.admin-table tr.drag-row:active { cursor: grabbing; }

/* ---- Learner progress: the lesson path, one step per lesson, and the picked lesson's details ---- */
.progress-page { display: flex; flex-direction: column; gap: 18px; }
.progress-top { display: grid; gap: 8px; }
.progress-headline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress-step { font-size: 20px; }
.progress-percent { font-weight: 700; font-size: 16px; color: var(--accent-dark); }
.progress-top p { margin: 0; }
.progress-howto { font-size: 11.5px; }

.path-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.path-nav { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.path-track { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; overflow: hidden; padding: 12px 8px 16px; }
.path-step { position: relative; flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; scroll-snap-align: center; }
/* The line between two steps is coloured once the earlier lesson is finished. */
.path-step:not(:last-child)::after { content: ""; position: absolute; top: 21px; inset-inline-start: calc(50% + 24px); width: calc(100% - 48px); height: 2px; background: var(--border); }
.path-step.link-done:not(:last-child)::after { background: var(--accent); }
.path-node { width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; position: relative; z-index: 1; background: var(--card); color: var(--muted); border: 2px solid var(--border); }
.path-step.done .path-node { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.path-step.current .path-node { border: 3px solid var(--accent); color: var(--accent-dark); box-shadow: 0 0 0 5px var(--accent-soft); }
/* Lessons not reached yet are grey. */
.path-step.upcoming .path-node { background: var(--border); border-color: var(--border); color: var(--muted); }
.path-node:hover { border-color: var(--accent); }
.path-node[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 3px; }
.path-label { max-width: 96px; font-size: 11px; line-height: 1.4; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.path-step.current .path-label { color: var(--text); font-weight: 700; }
.path-counts { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11.5px; }

.lesson-detail { border: 1px solid var(--border); border-radius: 18px; padding: 18px; display: grid; gap: 12px; background: var(--card-raised); min-width: 0; }
.lesson-detail h3 { margin: 0; }
.lesson-detail p { margin: 0; }
.lesson-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lesson-no { font-size: 11.5px; color: var(--muted); }
.lesson-chip { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.lesson-chip.upcoming { background: var(--border); color: var(--muted); }
.lesson-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lesson-action { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lesson-action button { padding: 9px 14px; font-size: 12.5px; margin: 0; }
.attempt { border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 4px; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .lesson-stats { grid-template-columns: 1fr; }
  .path-step { flex-basis: 84px; }
  .path-label { max-width: 84px; }
}

/* ---- My students: one box per student, and the profile dialog with two views ---- */
.students-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .students-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .students-grid { grid-template-columns: minmax(0, 1fr); } }
.student-card { border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; background: var(--card-raised); }
.student-name { font-size: 15.5px; overflow-wrap: anywhere; min-width: 0; }
.student-card button { padding: 9px 14px; font-size: 12.5px; margin: 0; }
.student-tabs { display: flex; gap: 8px; margin: 12px 0 6px; flex-wrap: wrap; }
.student-tabs button { padding: 8px 16px; font-size: 12.5px; margin: 0; }
.student-tabs button.is-current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.student-sessions { display: grid; gap: 10px; }

/* The plan alert at the top of the learner page: it must not be missed, so it is a clear box and not a small line. */
.plan-alert { max-width: 1100px; margin: 16px auto 0; padding: 14px 18px; border: 2px solid var(--warn); border-radius: 14px; background: var(--warn-soft); color: var(--text); display: grid; gap: 8px; }
.plan-alert[hidden] { display: none; }
.plan-alert p { margin: 0; font-weight: 600; }
.plan-alert a.pill { justify-self: start; }

/* The self-test evaluation keeps its headings and bullet lines. */
#testResult { white-space: pre-line; }
.topic-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topic-row input { flex: 1 1 220px; min-width: 0; }
.topic-field { position: relative; flex: 1 1 220px; min-width: 0; display: flex; }
.topic-field input { width: 100%; padding-inline-end: 42px; min-height: 58px; }
/* The microphone and its level bars stand one above the other, centred in the box. */
.topic-voice { position: absolute; inset-inline-end: 4px; top: 0; bottom: 0; width: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.topic-mic { position: relative; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
/* Only the microphone icon shows: no box behind it or around it, except the blue circle while it records. */
.topic-mic, .topic-mic:hover, .topic-mic:focus, .topic-mic:active { background: transparent; border: 0; outline: none; box-shadow: none; }
.topic-mic:hover { color: var(--accent-dark); }
.topic-mic.is-recording, .topic-mic.is-recording:hover, .topic-mic.is-recording:focus { background: var(--listen); color: #fff; }
/* The site's button hover paints a gold square; the microphone keeps its own look, so these win over it. */
.topic-field .topic-mic:not(.is-recording) { background: transparent !important; box-shadow: none !important; }
.topic-field .topic-mic.is-recording { background: var(--listen) !important; color: #fff !important; }
/* Small level bars under the microphone, inside the box: they only show that the microphone is recording. */
.topic-meter { display: flex; align-items: flex-end; gap: 1px; height: 12px; pointer-events: none; }
/* Hidden keeps its place, so the microphone does not move when the bars appear. */
.topic-meter[hidden] { display: flex !important; visibility: hidden; }
.topic-meter span { display: block; width: 2px; height: 3px; border-radius: 1px; background: var(--listen); transition: height 0.06s linear; }
.topic-mic.is-recording:hover { background: var(--listen); color: #fff; }
.topic-mic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The shell: the header and the side menu stay in place, and each member page opens in the frame below them. */
html.shell, html.shell body { height: 100%; overflow: hidden; }
.shell-frame { display: block; width: 100%; height: calc(100vh - var(--header-h)); border: 0; background: var(--bg); }
/* A page inside the frame does not show its own header and side menu. */
html.framed .site-header, html.framed .app-side, html.framed .app-side-col, html.framed .site-drawer, html.framed .site-footer { display: none; }
@media (max-width: 760px) { .shell-frame { height: calc(100vh - 128px); } }
@media (min-width: 761px) { html.framed #lessonBox.lesson { height: calc(100vh - 48px); } }

/* ---- Side menu column: the column has the menu's colour and is as tall as the page column, so it meets the footer
   without overlap. The menu itself sticks to the top while the page scrolls. ---- */
.app-side-col { flex: 0 0 220px; align-self: stretch; background: var(--card); border-inline-start: 0.5px solid var(--border); min-width: 0; }
/* The account block (profile photo, then name) sits at the start of the header line, on a computer. */
@media (min-width: 761px) { .site-actions { order: -1; } }
/* A small gap above the footer at the end of the page, on a computer. The member shell has its own frame, so it has none. */
@media (min-width: 761px) {
  .app-layout { padding-bottom: var(--side-gap, 24px); }
  html.shell .app-layout { padding-bottom: 0; }
}
/* On a phone the menu is the fixed bottom bar, so the column adds no box of its own. */
@media (max-width: 760px) {
  .app-side-col { display: contents; }
  .app-layout { padding-bottom: 0; }
}

/* ---- Header order (desktop and phone): profile photo, name, menu, language, logo, site name. ----
   The bar always runs left to right, so the place of each item is the same in both languages.
   The menu links read in the language's own direction: Persian from the right, English from the left. */
.site-header-inner { direction: ltr; justify-content: flex-start; gap: 14px; }
.site-header-inner > * { order: 0; }
html[dir="rtl"] .site-nav { direction: rtl; }
html[dir="ltr"] .site-nav { direction: ltr; }
.site-header .site-nav { margin-inline: auto; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; margin-inline-start: 0; margin-inline-end: 0; text-decoration: none; color: var(--text); }
.site-brand svg { height: 40px; width: auto; }
.site-name { font-family: "Cormorant Garamond", "Vazirmatn", serif; font-size: 20px; white-space: nowrap; }
/* Phone: the menu is a bar at the bottom of the screen (guests). Signed-in members use their own bottom bar. */
@media (max-width: 760px) {
  .site-header-inner { flex-wrap: nowrap; padding: 10px 12px; gap: 8px; }
  .site-header-inner > .site-nav { display: none; }
  .site-drawer { display: contents; }
  .site-brand svg { height: 32px; }
  .site-name { font-size: 17px; }
  .site-header[data-member="true"] .site-drawer { display: none; }
  .site-header:not([data-member="true"]) .site-nav { display: flex; position: fixed; inset: auto 0 0 0; z-index: 15; justify-content: space-around; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); margin: 0; background: var(--card); border-top: 0.5px solid var(--border); font-size: 12px; }
  .site-header:not([data-member="true"]) .site-nav a { padding: 6px 4px; }
  .site-main { padding-bottom: 84px; }
}

/* A visitor who is not signed in has no side menu, so its column is not drawn either. */
.app-side-col:has(> .app-side[hidden]) { display: none; }

/* ---- Member shell: the page fills the screen, and the frame takes the space left under the header and above the bottom bar.
   The page inside the frame scrolls on its own, on a phone as well. Nothing here depends on a fixed screen height. ---- */
html.shell body { display: flex; flex-direction: column; }
html.shell .app-layout { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: row; }
html.shell .site-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
html.shell .shell-frame { flex: 1 1 auto; min-height: 0; height: auto; }
/* A page in the frame fills the frame's width and scrolls inside it. */
html.framed .page-wrap { max-width: none; }
@media (max-width: 760px) {
  html.shell .app-layout { display: flex; flex-direction: column; }
  html.shell .shell-frame { height: auto; }
}
/* The shell's own footer sits at the very end of the screen, below the frame, like the header sits at the top. */
html.shell .site-footer { flex: none; }


/* ---- Phone header: the profile and name stay on the left in both languages. The language, theme, logo and site name
   sit on the right. The menu is a row directly under the bar, for every visitor, signed in or not. ---- */
@media (max-width: 760px) {
  .site-header-inner { flex-wrap: wrap; justify-content: flex-start; row-gap: 8px; }
  .site-actions { margin-inline-end: auto; }
  .site-header .site-drawer { display: contents; position: static; opacity: 1; visibility: visible; transform: none; background: none; border: 0; box-shadow: none; padding: 0; max-height: none; }
  .site-header .site-nav { display: flex; order: 10; width: 100%; position: static; inset: auto; justify-content: space-around; gap: 4px; padding: 0 0 4px; margin: 0; background: none; border: 0; font-size: 12.5px; }
}

/* ---- Phone: the header and the shell fit the width of the screen, so nothing is cut off on the right. ---- */
@media (max-width: 760px) {
  .site-header-inner { gap: 6px; padding: 10px; }
  .site-greeting { max-width: 84px; font-size: 12.5px; }
  button.avatar-btn { width: 36px; height: 36px; }
  .site-tools .icon-btn, .site-tools .lang-toggle { height: 30px; width: auto; }
  .site-tools .icon-btn { width: 30px; }
  .site-brand svg { height: 28px; }
  .site-name { font-size: 15px; }
  .site-brand { gap: 6px; }
  html.shell .site-main, html.shell .shell-frame { max-width: 100%; min-width: 0; box-sizing: border-box; }
}

/* On a phone the member shell scrolls with the page, so the content is never cut off at the bottom. */
@media (max-width: 760px) {
  html.shell, html.shell body { height: auto; overflow: visible; }
}

/* ---- Bootstrap follows the palette of this site: the same background, text, accent and borders as before. ---- */
:root {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-primary: var(--accent);
  --bs-link-color: var(--accent);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
}
/* The header's menu row sits below the bar on a phone and beside the controls on a computer. */
.header-nav { min-width: 0; }
@media (min-width: 768px) { .header-nav { width: auto !important; } }
#themeToggle .icon-moon { display: none; }
:root[data-theme="light"] #themeToggle .icon-sun { display: none; }
:root[data-theme="light"] #themeToggle .icon-moon { display: inline-block; }


/* The account block sits on the side of the sidebar's opposite: on the left in Persian (the sidebar is on the right),
   and on the right in English (the sidebar is on the left). Its menu opens from the button toward the page. */
/* The header runs left to right in both languages, and each language lays it out from its own side.
   Persian (sidebar on the right): profile, menu, controls, logo and name.
   English (sidebar on the left): logo and name, controls, menu, profile. */
html[dir="rtl"] #siteActions { order: 0 !important; }
html[dir="rtl"] .header-nav { order: 1 !important; }
html[dir="rtl"] #siteTools { order: 2 !important; }
html[dir="rtl"] .navbar-brand { order: 3 !important; }
html[dir="ltr"] .navbar-brand { order: 0 !important; }
html[dir="ltr"] #siteTools { order: 1 !important; }
html[dir="ltr"] .header-nav { order: 2 !important; }
html[dir="ltr"] #siteActions { order: 3 !important; }
html[dir="rtl"] .account-menu-list { inset-inline-start: 0; inset-inline-end: auto; }
html[dir="ltr"] .account-menu-list { inset-inline-end: 0; inset-inline-start: auto; }

/* In English the account block is the mirror of Persian: the name comes first from the left, and the photo sits at the right edge.
   Only the signed-in block is reversed; the sign-in buttons of a visitor keep their order. */
html[dir="ltr"] #siteActions[data-state="member"] { flex-direction: row-reverse; }

/* Header menu direction: Persian starts from the right (خانه), English from the left (Home). */
html[dir="rtl"] .header-nav { direction: rtl; }
html[dir="ltr"] .header-nav { direction: ltr; }
/* Phone header: the same single row as a computer. The menu is replaced by one button, and its list opens below it. */
#menuRow { order: 1; }
html[dir="ltr"] #menuRow { order: 2; }
@media (max-width: 767.98px) {
  /* The three-line button sits right beside the profile photo, not in the middle of the row. */
  #menuRow { position: relative; flex: 0 0 auto; }
  html[dir="rtl"] #siteTools { margin-left: auto !important; }
  html[dir="ltr"] #menuRow { margin-left: auto !important; }
  .header-nav.is-open {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: calc(100% + 8px);
    min-width: 200px;
    z-index: 25;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
  .header-nav.is-open[data-side="left"] { left: 0; right: auto; }
  .header-nav.is-open[data-side="right"] { right: 0; left: auto; }
  .header-nav.is-open .nav-link { padding: 10px 12px; border-radius: 10px; }
}
/* The profile menu items follow the language: right-aligned in Persian, left-aligned in English. */
html[dir="rtl"] .account-menu-list button.account-item { text-align: right; }
html[dir="ltr"] .account-menu-list button.account-item { text-align: left; }
/* The profile menu opens from the side of its button and into the page: a button on the left opens to the right. */
.account-menu-list[data-side="left"] { left: 0; right: auto; }
.account-menu-list[data-side="right"] { right: 0; left: auto; }
@media (max-width: 760px) {
  .account-menu-list { position: absolute; top: calc(100% + 8px); min-width: 240px; background: var(--card); color: var(--text); }
}

/* The language switch: the two names sit inside the switch, and the one in use sits on the knob. */
.lang-switch .form-check-input { width: 3.6em; height: 1.8em; margin: 0; float: none; cursor: pointer; }
.lang-switch-label { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; font-size: 11px; font-weight: 700; color: var(--muted); pointer-events: none; }
.lang-switch-label[data-lang-label="en"] { left: 0.6em; }
.lang-switch-label[data-lang-label="fa"] { right: 0.6em; }
.lang-switch-label.is-current { color: var(--on-accent); }


/* Drop-down lists: the menu uses the site's colours in both themes, and its items use the accent. */
.select-menu { --bs-dropdown-bg: var(--card); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--accent-soft); --bs-dropdown-link-hover-color: var(--accent); --bs-dropdown-link-active-bg: var(--accent-soft); --bs-dropdown-link-active-color: var(--accent); max-height: 280px; overflow-y: auto; }
.select-menu .dropdown-item { text-align: start; }
.dropdown:has(> .select-menu) > .btn-outline-secondary { color: var(--text); }

/* The language switch is a plain switch: a knob, no tick, and the site's accent when it is on. */
.lang-switch .form-check-input { background-color: var(--border); border-color: var(--border); }
.lang-switch .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.lang-switch .form-check-input:focus { box-shadow: 0 0 0 0.2rem var(--accent-soft); }
/* Drop-down button: the site's surface and text, and the accent only as a soft background when it is open or focused. */
.dropdown > .btn-outline-secondary { background: var(--bg) !important; color: var(--text) !important; border-color: var(--muted) !important; border-radius: 10px; padding: 10px 12px; text-align: start; }
/* The arrow on the right of a drop-down: the accent colour, so the box reads as a combo box like the text fields. */
.dropdown > .btn-outline-secondary > span:last-child { color: var(--accent); font-size: 13px; margin-inline-start: 10px; }
.dropdown > .btn-outline-secondary:hover, .dropdown > .btn-outline-secondary:focus, .dropdown > .btn-outline-secondary[aria-expanded="true"] { background: var(--accent-soft) !important; border-color: var(--accent) !important; color: var(--text) !important; }
/* Drop-down items: the item under the pointer or the keyboard, and the chosen item, get a soft background; the chosen one is bold. */
.select-menu .dropdown-item:hover, .select-menu .dropdown-item:focus { background: var(--accent-soft); color: var(--text); }
.select-menu .dropdown-item.active { background: var(--accent-soft); color: var(--text); font-weight: 700; }

/* The language list opens from its button, on the side of the button, like the profile menu. */
.lang-menu-list { min-width: 150px; z-index: 30; padding: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); top: calc(100% + 8px); }
.lang-menu-list.show { display: grid; gap: 2px; }
.lang-menu-list[data-side="left"] { left: 0; right: auto; }
.lang-menu-list[data-side="right"] { right: 0; left: auto; }
.lang-menu-list .dropdown-item { text-align: start; border-radius: 10px; }
.lang-menu-list .dropdown-item:hover, .lang-menu-list .dropdown-item:focus { background: var(--accent-soft); color: var(--text); }
.lang-menu-list .dropdown-item.active { background: var(--accent-soft); color: var(--text); font-weight: 700; }

/* The phone menu button shows three lines when the list is closed and a cross when it is open. */
#menuToggle .icon-close { display: none; }
#menuToggle[aria-expanded="true"] .icon-bars { display: none; }
#menuToggle[aria-expanded="true"] .icon-close { display: inline-block; }


/* On a computer the menu wrapper takes no box of its own, so the menu sits in the header row with the other items.
   (Bootstrap 5.3 has no display class for this, so it is set here.) */
@media (min-width: 768px) {
  #menuRow { display: contents !important; }
}

/* On a phone the header has no room for the name beside the photo. The name shows in the personal details instead. */
@media (max-width: 767.98px) {
  .site-greeting { display: none !important; }
}

/* The buttons of a report row are compact, so more of the list fits on the screen */
.report-open { padding: 4px 12px; font-size: 13px; line-height: 1.4; }
/* A dialog holds the reader's attention: the page behind it does not scroll, on a computer or a phone */
body:has(dialog[open]) { overflow: hidden; }
dialog[open] { overscroll-behavior: contain; }
/* The item count menu stays as wide as its box */
.report-bar .dropdown-menu { min-width: 100%; }
/* The window that waits before a talk begins: it sits in the middle of the screen, over the chat. */
dialog.ready-dialog { width: min(420px, calc(100% - 32px)); margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
dialog.ready-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.ready-dialog h2 { margin-bottom: 8px; }
dialog.ready-dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
/* On phones the level bars under the microphone are not drawn at all, so the microphone sits in the middle of its box, in portrait too */
@media (max-width: 560px), (pointer: coarse) {
  .topic-meter[hidden] { display: none !important; }
}
