/* Black and white like a modern chat app (no orange); one accent colour can be picked in settings. */
:root {
  --paper: #ffffff; --side: #f7f7f8; --card: #ffffff; --raise: #f0f0f1;
  --ink: #0d0d0d; --muted: #6b6b70; --line: #e5e5e7;
  --accent-base: #0d0d0d; --accent: var(--accent-base); --accent-2: #2b6fd6; --on-accent: #ffffff; --danger: #d33a2f;
  --au1: rgb(90 120 255 / .10); --au2: rgb(120 120 140 / .07); --au3: rgb(60 170 255 / .08);
  --display: "Geist", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "Geist", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
:root[data-theme="dark"] {
    --paper: #0f0f0f; --side: #090909; --card: #1a1a1a; --raise: #262626;
    --ink: #ececec; --muted: #9a9a9f; --line: #2a2a2a;
    --accent: color-mix(in oklab, var(--accent-base) 80%, white); --accent-2: #8ab4ff; --on-accent: #0d0d0d; --danger: #ff6b5e;
    --au1: rgb(92 110 255 / .20); --au2: rgb(170 170 190 / .10); --au3: rgb(70 160 255 / .12);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f0f0f; --side: #090909; --card: #1a1a1a; --raise: #262626;
    --ink: #ececec; --muted: #9a9a9f; --line: #2a2a2a;
    --accent: color-mix(in oklab, var(--accent-base) 80%, white); --accent-2: #8ab4ff; --on-accent: #0d0d0d; --danger: #ff6b5e;
    --au1: rgb(92 110 255 / .20); --au2: rgb(170 170 190 / .10); --au3: rgb(70 160 255 / .12);
    color-scheme: dark;
  }
}
:root { --size: 16.5px; --chat: 760px; color-scheme: light; }
:root[data-accent="mono"] { --accent-base: var(--ink); }
:root[data-accent="teal"] { --accent-base: #1f8f86; }
:root[data-accent="blue"] { --accent-base: #3a6fd8; }
:root[data-accent="violet"] { --accent-base: #7a5af0; }
:root[data-accent="green"] { --accent-base: #3f9a4a; }
:root[data-accent="rose"] { --accent-base: #d0457a; }
:root[data-font="tajawal"] { --body: "Tajawal", "Segoe UI", Tahoma, sans-serif; --display: "Tajawal", sans-serif; }
:root[data-font="cairo"] { --body: "Cairo", "Segoe UI", Tahoma, sans-serif; --display: "Cairo", sans-serif; }
:root[data-font="kufi"] { --body: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif; --display: "Noto Kufi Arabic", sans-serif; }
:root[data-font="almarai"] { --body: "Almarai", "Segoe UI", Tahoma, sans-serif; --display: "Almarai", sans-serif; }
:root[data-width="wide"] { --chat: 1040px; }
:root[data-size="s"] { --size: 15px; }
:root[data-size="l"] { --size: 18.5px; }

/* Scrollbars in the site's own colors instead of the browser's white default. */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-button { display: none; }

body {
  margin: 0; height: 100dvh; overflow: hidden;
  display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-areas: "side main";
  font: var(--size)/1.8 var(--body); color: var(--ink); background: var(--paper);
}
a { color: var(--accent-2); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.35; margin: 0 0 .4em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.katex, pre, code { direction: ltr; unicode-bidi: isolate; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 4px; margin-block: .6em; }
.mark { color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }

/* sidebar */
.side { background: var(--side); border-inline-end: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { font: 700 1.6rem var(--display); color: var(--ink); text-decoration: none; padding: 0 8px 10px; }
.side-link { display: block; padding: 7px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.side-link:hover, .side-link[aria-current] { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.side-link.primary { border: 1px solid var(--line); background: var(--card); font-weight: 600; transition: background .2s, transform .2s; }
.side-link.primary:hover { transform: translateY(-1px); }
.side h2 { font: 600 .8rem var(--body); color: var(--muted); margin: 18px 12px 4px; }
#chats { list-style: none; margin: 0; padding: 0; }
#chats li { display: flex; align-items: center; border-radius: 10px; }
#chats li:hover, #chats li:has([aria-current]) { background: color-mix(in srgb, var(--ink) 9%, transparent); }
#chats a { flex: 1; min-width: 0; padding: 6px 12px; color: var(--ink); text-decoration: none; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chats button { border: 0; background: none; color: var(--muted); padding: 2px 10px; font-size: 1.1rem; border-radius: 8px; opacity: 0; }
#chats li:hover button, #chats button:focus-visible { opacity: 1; }
#chats button:hover { color: var(--accent); }
#chats .none { padding: 6px 12px; font-size: .9rem; }
#chats li { position: relative; }
#chats li.cat { font-size: .75rem; font-weight: 600; color: var(--muted); padding: 12px 12px 2px; background: none !important; }
#chats .more { font-size: 1rem; letter-spacing: 1px; padding: 2px 8px; }
#chats li[data-id] { cursor: grab; }
#chats li.cat.drop { color: var(--ink); background: color-mix(in srgb, var(--accent-2) 18%, transparent) !important; border-radius: 8px; }
.pop-menu { position: fixed; min-width: 210px; z-index: 70; max-height: calc(100dvh - 16px); overflow-y: auto; }
.pop-menu .danger { color: var(--danger); }
.pop-menu .submenu { padding-inline-start: 14px; max-height: 290px; overflow-y: auto; }
/* a big answer's plan: a checklist that ticks off as Burhan works through it */
.steps { list-style: none; margin: 0 0 1em; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); display: grid; gap: 10px; }
.steps li { position: relative; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .93rem; transition: color .3s; }
.steps li::before { content: ""; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 50%; box-sizing: border-box; background: var(--card); z-index: 1; }
.steps li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 8.25px; top: 20px; height: calc(100% - 8px); width: 1.5px; background: var(--line); } /* the thread joining the steps */
.steps li.done:not(:last-child)::after { background: #3f9b4b; }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now::before { border-color: color-mix(in srgb, var(--accent-2) 25%, transparent); border-top-color: var(--accent-2); animation: spin .8s linear infinite; }
.steps li.done { color: var(--ink); }
.steps li.done::before { border: 0; background: #3f9b4b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center/12px no-repeat; animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.4); } }
/* a bigger task Burhan works through (research, a quiz): a heading, a progress bar, then its steps */
.task { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 12px 16px 4px; max-width: 520px; }
.task header { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: .92rem; }
.task header small { color: var(--muted); font-weight: 400; }
.task-bar { display: block; height: 4px; border-radius: 4px; background: var(--raise); margin: 10px 0 4px; overflow: hidden; }
.task-bar::after { content: ""; display: block; height: 100%; width: var(--v); border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), #3f9b4b); transition: width .5s; }
.task .steps { border: 0; padding: 8px 0; margin: 0; background: none; }
/* under the answer; while it is being written it stays pinned just above the box, so the steps go down with you */
.task-slot .task { margin: 14px 0 0; }
.body[aria-busy="true"] .task-slot { position: sticky; bottom: 10px; z-index: 4; }
.body[aria-busy="true"] .task-slot .task { box-shadow: 0 10px 30px rgb(0 0 0 / .28); }
/* a quiz played in the chat: choices to pick, then each marked right or wrong with the score */
.quiz-play { margin-top: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); padding: 14px 16px; max-width: 720px; }
.quiz-play header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.quiz-play ol { margin: 0; padding: 0; list-style: none; counter-reset: q; display: grid; gap: 12px; }
.quiz-play li { counter-increment: q; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: border-color .3s, background .3s; }
.quiz-play li.sec { counter-increment: none; border: 0; padding: 6px 2px 0; font-weight: 700; color: var(--accent-2); }
.quiz-play li.sec.blk { color: var(--ink); font-size: 1.08em; padding-top: 10px; } /* the test section («القسم 1: لفظي وكمي») */
.quiz-play .passage { margin: 0 0 10px; padding: 10px 14px; border-inline-start: 3px solid var(--accent-2); border-radius: 10px; background: var(--raise); font-weight: 400; line-height: 1.8; }
.quiz-play .passage p { margin: 0; }
.quiz-play .why { margin-top: 8px; color: var(--muted); font-size: .88rem; }
.quiz-play.partial .check { opacity: .55; }
.quiz-play [hidden] { display: none !important; } /* the parts not open, and "Check" before the last part (.btn sets a display) */
.quiz-pages { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 4px; }
.quiz-pages span { color: var(--muted); font-size: .9rem; font-weight: 600; }
.quiz-pages .btn:disabled { opacity: .4; cursor: default; }
.quiz-play .q { display: flex; gap: 10px; font-weight: 600; }
.quiz-play .q::before { content: counter(q); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: .78rem; display: grid; place-items: center; margin-top: 2px; }
.quiz-play .q p { margin: 0; }
/* A computer: the four choices as a 2×2 square of big boxes. A phone: one under the other, as it was. */
.quiz-play .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.quiz-play .opts .opt { min-height: 60px; padding: 12px 16px; font-size: 1.02rem; }
@media (max-width: 560px) {
  .quiz-play .opts { grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
  .quiz-play .opts .opt { min-height: 0; padding: 8px 12px; font-size: inherit; }
}
.quiz-play .opt { display: flex; align-items: center; gap: 10px; text-align: start; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: none; color: var(--ink); font: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
.quiz-play .opt p { margin: 0; }
.quiz-play .opt i { flex: none; font-style: normal; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--muted); }
.quiz-play .opt:hover { border-color: var(--accent-2); }
.quiz-play .opt[aria-checked="true"] { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.quiz-play .opt[aria-checked="true"] i { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.quiz-play.graded .opt { cursor: default; }
.quiz-play .opt.right { border-color: #3f9b4b; background: color-mix(in srgb, #3f9b4b 12%, transparent); }
.quiz-play .opt.right i { background: #3f9b4b; border-color: #3f9b4b; color: #fff; }
.quiz-play .opt.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.quiz-play .opt.wrong i { background: var(--danger); border-color: var(--danger); color: #fff; }
.quiz-play li.ok { border-color: color-mix(in srgb, #3f9b4b 50%, var(--line)); }
.quiz-play li.no { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.quiz-play li .input { margin-top: 10px; width: 100%; }
.quiz-play .key { margin-top: 8px; color: #3f9b4b; font-weight: 600; }
.quiz-play .key p { display: inline; margin: 0; }
.quiz-play footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.quiz-play footer .btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; }
.quiz-play footer .btn .ic { width: 16px; height: 16px; }
.quiz-play footer .btn:not(.check) { background: var(--raise); color: var(--ink); }
.q-body { flex: 1; min-width: 0; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; max-width: 460px; }
.cmp > div { display: grid; gap: 4px; justify-items: center; padding: 12px 10px; border: 1px solid var(--line, #8884); border-radius: 10px; text-align: center; }
.cmp small { opacity: .7; font-size: .8rem; }
.cmp span { font-size: 1.1rem; font-weight: 600; }
.cmp span p { margin: 0; }
.cmp span .katex { font-size: 1.15em; font-weight: 400; line-height: 1.6; } /* bold made the fraction bars and digits smudge */
.quiz-kinds { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border: 1px solid var(--line, #8884); border-radius: 12px; }
.quiz-kinds > b { font-size: .95rem; }
.quiz-kinds .qk { display: grid; grid-template-columns: minmax(90px, 9em) 1fr 3.2em; align-items: center; gap: 10px; font-size: .9rem; }
.quiz-kinds .qk-bar { height: 8px; border-radius: 99px; background: var(--raise, #8882); overflow: hidden; }
.quiz-kinds .qk-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ok, #2f8f4e); }
.quiz-kinds .qk.weak .qk-bar i { background: #d9822b; }
.quiz-kinds .qk small { text-align: end; opacity: .75; }
.quiz-kinds .btn { justify-self: start; margin-top: 4px; }
.quiz-score { display: flex; align-items: baseline; gap: 10px; margin-inline-start: auto; }
.quiz-score b { font-size: 1.4rem; color: var(--accent); direction: ltr; }
.quiz-score span { color: var(--muted); font-size: .88rem; }
/* pictures of what a search found */
.pics { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.pics img { display: block; height: 130px; max-width: 220px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--raise); }
/* "How is Burhan doing in this chat?" */
.rate { width: min(var(--chat), 100%); margin: 0 auto 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: .85rem; }
.rate span { margin-inline-end: auto; }
.rate button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 2px 14px; font-size: .85rem; }
.rate button:hover { color: var(--ink); border-color: var(--ink); }
.rate button:last-child { border: 0; background: none; padding: 2px 8px; }

/* main column */
.main { display: flex; flex-direction: column; height: 100dvh; min-width: 0; }
.bar { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 16px; color: var(--muted); font-size: .93rem; }
#chatTitle { border: 0; background: none; color: inherit; font: inherit; padding: 4px 10px; border-radius: 8px; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#chatTitle:empty { display: none; }
#chatTitle:hover, #chatTitle:focus-visible { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
#menu { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); padding: 0; border-radius: 9px; }
#menu:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
/* the sidebar folded away: the page takes the whole width (the button on top brings it back) */
@media (min-width: 721px) {
  [data-side="closed"] body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
  [data-side="closed"] .side { display: none; }
}
.side-search { margin: 8px 0 0; padding: 7px 14px !important; font-size: .9rem !important; background: var(--paper) !important; }
/* a temporary chat: its switch at the end of the top bar, a tag by the name, a dashed box to write in */
#tempBtn { margin-inline-start: auto; width: 34px; height: 34px; }
#tempBtn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.temp-tag { display: none; align-items: center; padding: 0 10px; border: 1px dashed var(--muted); border-radius: 99px; font-size: .78rem; color: var(--ink); }
.main.temp .temp-tag { display: inline-flex; }
.main.temp .composer { border-style: dashed; border-color: var(--muted); }
/* how long the answer has been in the writing */
.took { display: block; margin-top: 6px; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
[aria-busy="true"] .took::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: var(--accent-2); animation: pulse .7s infinite alternate; }
/* "switch to Euler?" above the box */
.suggest { display: flex; align-items: center; gap: 10px; margin: 0 6px 8px; padding: 7px 8px 7px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: .88rem; animation: rise .2s ease-out; }
[dir="rtl"] .suggest { padding: 7px 14px 7px 8px; }
.suggest[hidden] { display: none; }
.suggest span { flex: 1; min-width: 0; }
.suggest .btn { border-radius: 99px; }
.suggest-x { border: 0; background: none; color: var(--muted); width: 26px; height: 26px; border-radius: 50%; font-size: 1.1rem; line-height: 1; padding: 0; }
.suggest-x:hover { background: var(--raise); color: var(--ink); }
/* the quick commands, listed above the box while the message starts with "/" */
.slash-menu { inset-inline: 0; max-height: min(340px, 50vh); overflow-y: auto; }
.slash-menu[hidden] { display: none; }
.slash-menu button { gap: 12px; }
.slash-menu b { font: 600 .88rem ui-monospace, Consolas, monospace; min-width: 92px; text-align: start; color: var(--accent-2); }
.slash-menu button > span { color: var(--ink); }
.slash-menu button[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.pop-menu small { margin-inline-start: auto; }
.pop-menu .ic { color: var(--muted); }
/* "think deeper", lit while it is on */
#deepBtn[aria-pressed="true"] { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); }

/* chat */
.thread { flex: 1; overflow-y: auto; padding: 8px 16px 24px; }
.msg { width: min(var(--chat), 100%); margin: 0 auto 22px; display: flex; gap: 12px; }
.msg.user { justify-content: flex-start; }
.msg.user .body { background: var(--raise); border-radius: 22px; padding: 8px 18px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
/* A message sent while an answer is still being written: waiting its turn (chat.js queue). */
.msg.waiting .body { background: none; border: 1px dashed var(--line); }
.msg.waiting .body > div { opacity: .75; }
.wait-note { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted); font-size: .8em; white-space: normal; }
.wait-x { border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.wait-x:hover { color: var(--ink); }
.msg.bot .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar { flex: none; margin-top: 2px; }
/* "Burhan is thinking…" with a light sweeping across the words */
[aria-busy="true"] .prose:empty::after { content: attr(data-wait); color: transparent; background: linear-gradient(100deg, var(--muted) 40%, var(--ink) 50%, var(--muted) 60%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 1.6s linear infinite; }
[aria-busy="true"] .prose.slow:empty::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-inline-end: 8px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes pulse { to { opacity: .3; } }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { font-size: 1.15rem; margin-top: 1.1em; }
.prose pre { background: var(--side); padding: 12px; border-radius: 10px; overflow-x: auto; }
.code-file { margin: 1em 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; direction: ltr; text-align: left; }
.code-file pre { margin: 0; border-radius: 0; background: #0d1117; color: #e6edf3; }
.code-file pre code.hljs { padding: 0; background: none; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 12px; background: var(--raise); font-size: .85rem; }
.code-name { display: inline-flex; align-items: center; gap: 6px; font-family: ui-monospace, Consolas, monospace; min-width: 0; overflow: hidden; white-space: nowrap; }
.code-name > span { overflow: hidden; text-overflow: ellipsis; }
.code-lines { color: var(--muted); font-size: .76rem; margin-inline-end: auto; white-space: nowrap; }
.code-file.folded .code-head { cursor: pointer; }
.code-file.folded pre { display: none; }
.code-file.folded.open pre { display: block; }
.code-tools { display: inline-flex; flex: none; }
.code-btn { display: inline-flex; padding: 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.code-btn:hover, .code-btn:focus-visible { color: var(--ink); background: var(--side); }
.prose table { border-collapse: collapse; } .prose td, .prose th { border: 1px solid var(--line); padding: 4px 12px; }

.dock { width: min(calc(var(--chat) + 32px), 100%); margin-inline: auto; padding: 0 16px 10px; }
.composer { position: relative; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 8px; box-shadow: 0 8px 30px rgb(0 0 0 / .12); }
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); box-shadow: 0 10px 40px rgb(0 0 0 / .18); }
/* a thin light that travels around the box while you type */
@property --spin { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.composer::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: conic-gradient(from var(--spin), transparent 0 72%, color-mix(in srgb, var(--ink) 60%, transparent) 86%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: orbit 3.5s linear infinite; }
.composer:focus-within::before { opacity: 1; }
[data-anim="off"] .composer::before { display: none; }
@keyframes orbit { to { --spin: 360deg; } }
.composer .row { display: flex; align-items: flex-end; gap: 4px; }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; font: inherit; color: var(--ink); padding: 8px 6px; min-height: 38px; max-height: 45dvh; overflow-y: hidden; scrollbar-width: thin; line-height: 1.45; }
#send { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 1.15rem; font-weight: 700; transition: transform .15s; }
#send:hover { transform: scale(1.06); }
#send:active { transform: scale(.94); }
.fine { text-align: center; color: var(--muted); font-size: .78rem; margin: 6px 0 0; }
.fine a { color: inherit; text-decoration: none; } /* the same quiet grey as the line beside it, still a link */
.fine a:hover, .fine a:focus-visible { text-decoration: underline; }
.welcome, #chips { display: none; }
.chat.empty .thread { display: none; }
.chat.empty .dock { margin-block: auto; padding-bottom: 12vh; }
.chat.empty .welcome { display: block; text-align: center; margin-bottom: 22px; }
.chat.empty #chips { display: flex; justify-content: center; }
.welcome h1 { font-size: clamp(1.8rem, 4.4vw, 2.7rem); font-weight: 600; }
.welcome .logo.big { margin-bottom: 10px; }
.welcome p { margin: 0; }

/* shared controls */
.chips { flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 0; list-style: none; }
.chip { font-size: .88rem; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px 14px; }
.chip:hover, .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.btn { font-weight: 600; border: 0; border-radius: 10px; padding: 8px 20px; background: var(--accent); color: var(--on-accent); text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: none; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { padding: 3px 14px; font-size: .88rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.tag { font-size: .8rem; border-radius: 6px; padding: 1px 9px; background: var(--side); white-space: nowrap; }
.tag.topic { background: var(--accent-2); color: var(--paper); }
input[type="search"] { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 9px 18px; width: 100%; }
input[type="search"]:focus { border-color: var(--accent-2); outline: 0; }

/* data center */
.scroll { overflow-y: auto; }
.page { width: min(980px, 100%); margin-inline: auto; padding: 0 20px 60px; }
.page > h1 { font-size: 2.3rem; margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-block: 18px; }
.tabs button { border: 0; background: none; padding: 8px 18px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.chips.filter { display: flex; margin-block: 12px 4px; }
.group h3 { font-size: 1.35rem; margin: 30px 0 12px; }
.group h3 small { font: 400 .85rem var(--body); color: var(--muted); }
.formulas { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.formula { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.formula h4 { font: 600 1rem var(--body); margin: 0; }
.formula .tex { flex: 1; display: grid; align-items: center; font-size: .95em; min-width: 0; }
.formula .note { font-size: .85rem; margin: 0; }
.formula .chip { align-self: flex-start; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-block: 14px; }
.tile b { display: block; font: 700 2rem/1.3 var(--display); color: var(--accent); }
.tile span { color: var(--muted); font-size: .9rem; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.goal-row { grid-template-columns: 1fr 1fr; margin-block: 14px; }
.welcome p.aim { display: block; margin-top: 8px; } /* days left · expected score · goal, under the welcome */
.score-big { font: 700 3.4rem/1.1 var(--display); color: var(--accent); margin-block: 6px; }
.share-url { display: block; width: 100%; margin-top: 10px; font: inherit; font-size: .85rem; color: inherit; background: transparent; border: 1px solid var(--line, #8884); border-radius: 8px; padding: 6px 10px; }
.share-url[hidden] { display: none; }
.goal-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-block: 8px; }
.goal-form input { font: inherit; color: inherit; background: transparent; border: 1px solid var(--line, #8884); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 2.2em; gap: 10px; align-items: center; font-size: .92rem; margin-block: 6px; }
.bar-row i { display: block; height: 12px; border-radius: 6px; background: var(--accent-2); min-width: 4px; }
.bar-row.hard i { background: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-block: 14px; }
.record { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-block: 8px; }
.record summary { cursor: pointer; padding: 10px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.record summary strong { flex: 1; min-width: 160px; }
.record .inside { padding: 4px 16px 16px; border-top: 1px dashed var(--line); }
.record .q { white-space: pre-wrap; background: var(--side); border-radius: 8px; padding: 8px 14px; }
.empty-state { text-align: center; padding: 48px 16px; }
.gap { margin-block: 14px; }

/* settings */
.page.narrow { width: min(680px, 100%); }
.page.narrow h2 { font-size: 1.25rem; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.field.check { justify-content: flex-start; border: 0; }
.field select, .field input[type="number"] { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; min-width: 150px; }
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { font-size: .88rem; margin: 4px 0 0; }

/* ---------- the logo: three dots (∴) in a circle that breathe, and spin while Burhan thinks */
.logo { --s: 32px; position: relative; display: inline-block; flex: none; width: var(--s); height: var(--s); border-radius: 50%; background: var(--accent); vertical-align: middle; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.logo i { position: absolute; width: 22%; height: 22%; border-radius: 50%; background: var(--on-accent); }
.logo i:nth-child(1) { top: 20%; left: 39%; }
.logo i:nth-child(2) { top: 55%; left: 19%; }
.logo i:nth-child(3) { top: 55%; left: 59%; }
.brand .logo { --s: 30px; margin-inline-end: 4px; }
.logo.big { --s: 60px; }
[data-anim="on"] .logo i { animation: breathe 2.4s ease-in-out infinite; }
[data-anim="on"] .logo i:nth-child(2) { animation-delay: .3s; }
[data-anim="on"] .logo i:nth-child(3) { animation-delay: .6s; }
[data-anim="on"] .logo.busy { animation: spin 1.1s linear infinite; }
[data-anim="on"] .logo.busy i { animation-duration: .7s; }
@keyframes breathe { 50% { transform: scale(.55); opacity: .7; } }
/* while the user types, the three dots hop one after another */
[data-anim="on"] body.typing .logo:not(.busy) i { animation: hop .45s ease-in-out infinite; }
[data-anim="on"] body.typing .logo:not(.busy) i:nth-child(2) { animation-delay: .1s; }
[data-anim="on"] body.typing .logo:not(.busy) i:nth-child(3) { animation-delay: .2s; }
@keyframes hop { 50% { transform: translateY(-40%) scale(1.2); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the account at the bottom of the sidebar */
.account { position: sticky; bottom: -14px; margin: auto -12px -14px; padding: 8px 10px 12px; background: var(--side); border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 12px; text-align: start; }
.me:hover, .me[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.ini { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--accent); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.me-text b { font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: .76rem; }
.ring { width: 30px; height: 30px; transform: rotate(-90deg); flex: none; }
[dir="rtl"] .ring { transform: rotate(-90deg) scaleY(-1); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: color-mix(in srgb, var(--ink) 12%, transparent); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .6s; }
.ring.low .fill { stroke: #d99a1c; }
.ring.out .fill { stroke: #d2453b; }

/* menus (account, language, model picker) */
.menu { position: absolute; z-index: 20; min-width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 40px rgb(0 0 0 / .18); }
.menu.up { bottom: calc(100% + 6px); }
.account .menu { inset-inline: 10px; }
.menu-head { color: var(--muted); font-size: .82rem; padding: 6px 10px 8px; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ink); text-decoration: none; font-size: .93rem; text-align: start; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.menu a > span, .menu button > span { flex: 1; }
.menu small { color: var(--muted); font-size: .8rem; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.submenu { padding-inline-start: 30px; }
.ic { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .ic.chev { transform: scaleX(-1); }
[aria-expanded="true"] > .ic.chev { transform: rotate(90deg); }

/* composer toolbar */
.tool { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); padding: 6px 9px; border-radius: 10px; font-size: .88rem; }
.tool:hover, .tool[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.tool.round { width: 38px; height: 38px; justify-content: center; border-radius: 50%; padding: 0; flex: none; }
#attachBtn { border: 1px solid var(--line); }
#micBtn[aria-pressed="true"] { background: #d2453b; color: #fff; box-shadow: 0 0 0 calc(3px + var(--lvl, 0) * 16px) rgb(210 69 59 / .35); transition: box-shadow .1s; } /* the ring grows with the voice */
#micBtn.writing { animation: pulse .5s infinite alternate; }

/* the control strip under the box: starts at the reading side's edge (the right in Arabic) */
.statusline { display: flex; align-items: center; flex-wrap: wrap; gap: 1px; margin: 6px 10px 0; font-size: .8rem; color: var(--muted); }
.statusline .pick { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: inherit; padding: 3px 7px; border-radius: 8px; font: inherit; }
.statusline button.pick:hover, .statusline .pick[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.statusline .pick .ic { width: 14px; height: 14px; }
.statusline .sep { opacity: .5; }
.statusline .mode-menu { inset-inline-start: 0; inset-inline-end: auto; }
.pick .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; transition: background .2s; }
#learnBtn[aria-pressed="true"] { color: var(--ink); }
#learnBtn[aria-pressed="true"] .dot { background: var(--accent-2); border-color: var(--accent-2); }
.usage-pop { inset-inline-end: 0; width: 280px; padding: 14px 16px; display: grid; gap: 10px; font-size: .85rem; color: var(--ink); border-radius: 16px; }
.usage-pop header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-pop header span { font-variant-numeric: tabular-nums; color: var(--muted); }
.usage-pop .meter { height: 6px; }
.usage-pop .meter.warm i { background: #d99a1c; }
.usage-pop .btn { display: flex; align-items: center; justify-content: center; padding-block: 6px; border-width: 1px; border-radius: 99px; font-weight: 500; }
.usage-pop .btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); filter: none; }
.usage-pop hr { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--line); }
/* the line in a tidied chat: what is above it is held as a summary */
.cut-line { display: flex; align-items: center; gap: 12px; margin: 10px auto; width: min(var(--chat), 100%); padding-inline: 16px; color: var(--muted); font-size: .78rem; }
.cut-line::before, .cut-line::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.usage-pop[hidden] { display: none; }
.usage-pop .use-line { display: flex; align-items: baseline; gap: 8px; }
.usage-pop .use-line small { margin-inline-start: auto; color: var(--muted); }
.usage-pop p { margin: 0; font-size: .78rem; line-height: 1.6; }
.ring.mini { width: 14px; height: 14px; }
.ring.mini circle { stroke-width: 5; }

/* an answer's search step, and folded practice answers */
.tool-use { width: fit-content; max-width: 100%; margin-bottom: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: .87rem; }
.tool-use summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.tool-use summary::-webkit-details-marker { display: none; }
.tool-use .ic { width: 16px; height: 16px; }
.tool-use.running summary { cursor: default; }
.tool-use.running .ic { color: var(--accent); animation: pulse .7s infinite alternate; }
.tool-use ol { margin: 6px 0 2px; padding-inline-start: 24px; }
/* the steps of an answer: the line names the step it is on (a light sweeping across it); opened, it lists them all */
.trail summary::after { content: ""; flex: none; width: 6px; height: 6px; margin-inline-start: 2px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; opacity: .7; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.trail[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.trail.running summary { cursor: pointer; }
.trail.running summary span { color: transparent; background: linear-gradient(100deg, var(--muted) 40%, var(--ink) 50%, var(--muted) 60%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 1.6s linear infinite; }
.trail .steps { border: 0; padding: 10px 0 4px; margin: 0; background: none; }
.trail .steps > li { flex-wrap: wrap; font-size: .87rem; }
.trail .steps > li > small, .trail .steps > li > ol { flex-basis: 100%; margin: 2px 0 0; padding-inline-start: 30px; color: var(--muted); font-weight: 400; }
.trail .steps > li > ol { padding-inline-start: 48px; }
.trail .steps ol li { display: list-item; font-size: inherit; }
.trail .steps ol li::before, .trail .steps ol li::after { content: none; }
@media (prefers-reduced-motion: reduce) { .trail.running summary span { animation: none; color: inherit; background: none; } }
.prose details { border: 1px dashed var(--line); border-radius: 12px; padding: 6px 14px; margin-block: 10px; }
.prose summary { cursor: pointer; font-weight: 600; color: var(--accent-2); }
.mode { position: relative; }
.mode-menu { inset-inline-end: 0; width: 300px; }
.mode-menu button span { display: flex; flex-direction: column; line-height: 1.4; }
.mode-menu b { font-weight: 600; }
.mode-menu .ic { color: var(--accent); }
#send:disabled { opacity: .5; }
.attach-preview { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 8px 2px; }
.attach-preview[hidden] { display: none; }
.attach-preview .to-quiz { align-self: center; }
.thumb { position: relative; }
.thumb img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
#attachBtn:disabled { opacity: .4; cursor: not-allowed; }
.x { position: absolute; top: -8px; inset-inline-end: -8px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); line-height: 1; padding: 0; }
.shots { display: grid; gap: 6px; margin: 4px 0 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 360px; }
.shots.n1 { grid-template-columns: 1fr; max-width: min(320px, 100%); }
.shots.n2, .shots.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.msg.user .shot { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; }
.shots:not(.n1) .shot { aspect-ratio: 1; }

/* notices */
.toasts { position: fixed; z-index: 50; bottom: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); animation: rise .25s ease-out; }
.toast p { margin: 0; flex: 1 1 200px; font-size: .92rem; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------- sign-in dialog */
.login { width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 24px; padding: 34px 28px 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgb(0 0 0 / .35); text-align: center; overflow-y: auto; }
.login::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(3px); }
.login[open] { animation: rise .22s ease-out; }
.login h2 { font-size: 1.55rem; margin: 0 0 8px; }
.login > section > .muted { margin: 0 auto 20px; max-width: 330px; font-size: .95rem; line-height: 1.7; }
.login .close { position: absolute; top: 14px; inset-inline-start: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.login .close:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.login form { display: grid; gap: 12px; }
.login .error:empty { display: none; }
.login .error { margin: 12px 0 0; font-size: .9rem; }
.login .back { position: absolute; top: 14px; inset-inline-end: 14px; }
[dir="rtl"] .ic.back-ic { transform: none; } /* "back" points right in Arabic */
[dir="ltr"] .ic.back-ic { transform: scaleX(-1); }
.login .who { display: inline-block; margin: 0 0 18px; padding: 4px 14px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 7%, transparent); font-size: .9rem; }
.oauth { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px 16px; margin-block: 10px; border: 1px solid var(--line); border-radius: 99px; background: none; font-weight: 600; }
.oauth:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.oauth svg { width: 20px; height: 20px; flex: none; }
.g-wrap { display: flex; justify-content: center; }
.g-wrap:empty { display: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.input { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; width: 100%; }
.input.pill { border-radius: 99px; padding: 12px 20px; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.wide { width: 100%; padding: 11px; border-radius: 99px; }
.btn.invert { background: var(--ink); color: var(--paper); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.seg button { border: 0; background: none; padding: 6px 16px; border-radius: 9px; font-size: .9rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); font-weight: 600; }

/* ---------- the site's own dialogs (rename, new category, "are you sure?"), instead of the browser's grey boxes */
.dlg { width: min(400px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 22px; padding: 26px 24px 20px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgb(0 0 0 / .4); text-align: start; }
.dlg::backdrop { background: rgb(0 0 0 / .5); backdrop-filter: blur(4px); }
.dlg[open] { animation: dlg-in .2s cubic-bezier(.2, .9, .3, 1.2); }
.dlg[open]::backdrop { animation: fade .2s ease-out; }
.dlg.out { animation: dlg-out .15s ease-in forwards; }
@keyframes dlg-in { from { transform: translateY(14px) scale(.96); opacity: 0; } }
@keyframes dlg-out { to { transform: scale(.97); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dlg form { display: grid; gap: 14px; }
.dlg h2 { font-size: 1.2rem; margin: 0; padding-inline-end: 34px; }
.dlg p { margin: -6px 0 0; font-size: .93rem; line-height: 1.7; overflow-wrap: anywhere; }
.dlg .input { border-radius: 14px; padding: 11px 16px; }
.dlg-x { position: absolute; top: 14px; inset-inline-end: 14px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); padding: 0; }
.dlg-x:hover { background: var(--raise); color: var(--ink); }
.dlg-x .ic { width: 18px; height: 18px; }
.dlg-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.dlg-ic .ic { width: 22px; height: 22px; }
.dlg-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-row .btn { border-radius: 99px; padding: 8px 22px; }
.dlg-row .btn.ghost:hover { background: var(--raise); filter: none; }

/* a visitor's card at the bottom of the sidebar */
.guest-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.guest-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guest-card p { margin: 4px 0 10px; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.guest-row { display: flex; gap: 6px; align-items: center; }
.guest-row .btn { padding: 8px; }
.ini.photo { object-fit: cover; border: 0; padding: 0; background: none; }
.pass-grid { display: grid; gap: 8px; max-width: 360px; margin-top: 10px; }
.pass-grid input[hidden] { display: none; }
.set-photo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.set-photo .ini { width: 56px; height: 56px; font-size: 1.4rem; }

/* ---------- settings: section list + one section at a time */
.page.settings { width: min(980px, 100%); }
.set-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; margin-top: 18px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.set-nav a[hidden] { display: none; }
.set-nav a:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.set-nav a[aria-current] { background: color-mix(in srgb, var(--ink) 10%, transparent); font-weight: 600; }
.set-sec { display: none; }
.set-sec.on { display: block; animation: rise .2s ease-out; }
.set-sec > h2 { font-size: 1.4rem; margin-bottom: 14px; }
/* add-ons: one quiet list in three tabs; each row is a line with its button, and its details open under it */
.cz-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 6px; }
.cz-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--raise); }
.cz-tabs button { border: 0; background: none; padding: 4px 12px; border-radius: 7px; font-size: .88rem; color: var(--muted); }
.cz-tabs button:hover { color: var(--ink); }
.cz-tabs button[aria-selected="true"], .cz-tabs button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .14); }
.cz-search { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: 0 1 280px; min-width: 180px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); }
.cz-search:focus-within { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.cz-search .ic { flex: none; width: 15px; height: 15px; }
.cz-search input { all: unset; flex: 1; min-width: 0; color: var(--ink); font-size: .9rem; }
.cz-sub { margin: 6px 0 10px; font-size: .88rem; }
.cz-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.cz-list[hidden] { display: none; }
.cz-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 14px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.cz-main { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; border: 0; background: none; text-align: start; }
.cz-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--raise); color: var(--ink); }
.cz-ic .ic { width: 17px; height: 17px; }
.cz-text { display: flex; flex-direction: column; min-width: 0; }
.cz-text b { font-weight: 600; font-size: .95rem; line-height: 1.45; }
.cz-meta { overflow: hidden; color: var(--muted); font-size: .84rem; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.cz-main:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.cz-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); color: var(--ink); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.cz-btn .ic { width: 15px; height: 15px; }
.cz-btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.cz-btn.on { background: none; color: var(--muted); }
.cz-btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.cz-acts { display: inline-flex; align-items: center; gap: 4px; }
.cz-more { grid-column: 1 / -1; padding: 8px 0 4px; padding-inline-start: 46px; font-size: .9rem; }
.cz-more[hidden] { display: none; }
.cz-more p { margin: 0 0 6px; }
.cz-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cz-chips span { padding: 2px 7px; border-radius: 6px; background: var(--raise); color: var(--muted); font: .78rem ui-monospace, Consolas, monospace; }
.cz-setup { display: grid; gap: 8px; max-width: 560px; margin: 10px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.cz-setup ol { margin: 0; padding-inline-start: 20px; color: var(--muted); line-height: 1.7; }
.cz-setup .btn { justify-self: start; }
.cz-setup input { min-width: 0 !important; }
.cz-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cz-copy code { padding: 3px 8px; border-radius: 6px; background: var(--raise); font-size: .8rem; overflow-wrap: anywhere; }
.cz-alt { margin-top: 8px; }
.cz-alt summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
.cz-empty { padding: 18px 6px; }
.cz-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.cz-foot[hidden] { display: none; }
@media (max-width: 640px) { .cz-search { flex-basis: 100%; margin: 0; } .cz-more { padding-inline-start: 0; } .cz-row { grid-template-columns: minmax(0, 1fr); } }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child, .set-row > span { min-width: 0; overflow-wrap: anywhere; }
.set-row .hint { margin: 2px 0 0; }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-sec .card { margin-bottom: 16px; padding: 4px 20px; }
.set-sec .card.pad { padding: 18px 20px; }
.set-sec h3 { font: 600 1rem var(--body); margin: 16px 0 4px; }
.switch { position: relative; flex: none; width: 44px; height: 26px; appearance: none; border-radius: 99px; background: color-mix(in srgb, var(--ink) 18%, transparent); cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: inset-inline-start .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { inset-inline-start: 21px; background: var(--on-accent); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme { border: 2px solid var(--line); border-radius: 14px; padding: 8px; background: none; text-align: center; font-size: .88rem; }
.theme[aria-pressed="true"] { border-color: var(--accent); }
.theme i { display: block; height: 58px; border-radius: 9px; margin-bottom: 6px; border: 1px solid var(--line); }
.theme .light { background: linear-gradient(90deg, #f7f7f8 30%, #ffffff 30%); }
.theme .dark { background: linear-gradient(90deg, #090909 30%, #0f0f0f 30%); }
.theme .auto { background: linear-gradient(135deg, #ffffff 50%, #0f0f0f 50%); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--card); outline: 2px solid transparent; padding: 0; }
.swatch[aria-pressed="true"] { outline-color: var(--ink); }
.set-sec select, .set-sec input[type="number"], .set-sec input[type="text"], .set-sec input[type="password"] { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; min-width: 170px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stat-line { margin: 4px 0; font-size: .93rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-inline-end: 6px; }
.dot.on { background: #3f9b4b; box-shadow: 0 0 0 4px color-mix(in srgb, #3f9b4b 20%, transparent); }
.usage-big { display: flex; align-items: center; gap: 22px; }
.usage-big .ring { width: 110px; height: 110px; }
.usage-big .ring circle { stroke-width: 3.2; }
.usage-big b { display: block; font: 700 2rem/1.2 var(--display); }
.btn.danger { background: #c8473d; color: #fff; }
.msg-ok { color: #3f9b4b; font-weight: 600; }

/* the sidebar takes 270px, so the settings list moves on top well before phone width */
@media (max-width: 1040px) {
  .set-grid { grid-template-columns: 1fr; gap: 12px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .set-nav a { white-space: nowrap; }
  .set-row { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  /* a quiz on a phone (app.js marks body.in-quiz): the chat box is one quiet line until it is tapped, and no fine print */
  body.in-quiz .composer:not(:focus-within) .row, body.in-quiz .composer:not(:focus-within) .attach-preview { display: none; }
  body.in-quiz .composer:not(:focus-within) { padding: 4px 8px; border-radius: 22px; }
  body.in-quiz .fine { display: none; }
  .mode-menu { width: min(300px, calc(100vw - 40px)); }
  /* the menus under the box (model, effort, context) span the box's width: hung on the button that opened them, or on
     the strip itself (a few buttons wide in the plain look), they ran off the side of a phone */
  .statusline { position: static; }
  .statusline .mode { position: static; }
  .statusline .menu { inset-inline: 0; width: auto; }
  body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 10; transform: translateX(100%); transition: transform .2s; }
  [dir="ltr"] .side { transform: translateX(-100%); }
  .nav-open .side { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .3); }
  #chats button { opacity: 1; }
  .two { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 105px 1fr 2.2em; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- moving light behind the welcome screen (fades out once a chat starts) */
.main { position: relative; }
.main > :not(.aurora) { position: relative; z-index: 1; }
.aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; transition: opacity .8s; }
.chat:not(.empty) .aurora { opacity: 0; }
.aurora i { position: absolute; width: 48vmax; height: 48vmax; border-radius: 50%; filter: blur(90px); animation: drift 24s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--au1); top: -24vmax; inset-inline-start: -12vmax; }
.aurora i:nth-child(2) { background: var(--au2); top: -20vmax; inset-inline-end: -16vmax; animation-duration: 30s; animation-delay: -7s; }
.aurora i:nth-child(3) { background: var(--au3); bottom: -32vmax; inset-inline-start: 22%; animation-duration: 36s; animation-delay: -13s; }
[data-anim="off"] .aurora i { animation: none; }
@keyframes drift { 50% { transform: translate(6vmax, 4vmax) scale(1.1); } 100% { transform: translate(-5vmax, 8vmax) scale(.94); } }

/* ---------- voice chat */
.voice { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgb(0 0 0 / .78); backdrop-filter: blur(12px); }
.voice[hidden] { display: none; }
.voice-card { width: min(460px, calc(100vw - 32px)); display: grid; justify-items: center; gap: 10px; text-align: center; color: #f2f2f2; }
/* The wave: thin bars carrying the last moments of sound from right to left (--h 0..1 each, set from the page),
   growing up and down from the middle; a slow ripple runs through them while Burhan thinks. */
.orb { display: flex; align-items: center; justify-content: center; gap: 4px; width: min(340px, 86vw); height: 130px; padding: 0; border: 0; margin-bottom: 18px; background: none; cursor: pointer; direction: ltr; }
.orb i { flex: 1; max-width: 5px; min-height: 5px; height: calc(4% + var(--h, 0) * 96%); border-radius: 99px; background: linear-gradient(#e8f0ff, #6f9cff); opacity: calc(.45 + var(--h, 0) * .55); transition: height .09s ease-out, opacity .09s; }
.voice[data-state="thinking"] .orb i { animation: ripple 1.2s ease-in-out infinite; animation-delay: calc(var(--i) * -.07s); }
@keyframes ripple { 0%, 100% { height: 6%; opacity: .45; } 50% { height: 42%; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .voice[data-state="thinking"] .orb i { animation: none; height: 20%; } }
.voice-pick { font-size: .85rem; color: #9a9a9f; margin-bottom: 8px; }
.voice-pick select { background: #1c1c1f; color: #f2f2f2; border: 1px solid #3a3a40; border-radius: 999px; padding: 4px 12px; font: inherit; }
.voice-state { font-size: 1.35rem; font-weight: 600; margin: 0; }
.voice-text { min-height: 1.8em; margin: 0; color: #d0d0d0; overflow-wrap: anywhere; }
.voice-hint { font-size: .85rem; margin: 0 0 8px; color: #9a9a9f !important; }
.voice .btn.invert { background: #f2f2f2; color: #0d0d0d; padding-inline: 34px; }

/* ---------- a quiz Burhan made, with its PDF button */
.quiz-card { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.quiz-ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--raise); }
.quiz-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.quiz-text b { font-weight: 600; font-size: .95rem; }
.quiz-text small { color: var(--muted); font-size: .8rem; }
.quiz-card .btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; }
.quiz-card .btn .ic { width: 16px; height: 16px; }

.submenu.langs { max-height: 270px; overflow-y: auto; }

/* ---------- asking back, rating, graphs, attached files, what the vision model read */
.ask-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ask-opt { cursor: pointer; padding: 6px 14px; color: var(--ink); transition: border-color .15s, background .15s; }
.ask-opt:hover { border-color: var(--accent); background: var(--raise); }
.fb { display: flex; gap: 2px; margin-top: 6px; opacity: .5; transition: opacity .2s; }
.msg.bot:hover .fb, .fb:focus-within, .fb:has([aria-pressed="true"]) { opacity: 1; }
.fb-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.fb-btn:hover { background: var(--raise); color: var(--ink); }
.fb-btn[aria-pressed="true"] { color: var(--ink); background: var(--raise); }
.fb-btn .ic { width: 16px; height: 16px; }
/* Read aloud (voice.js): the part Burhan is on is marked like a teacher's highlighter; the pill above the box stops it. */
.prose .speaking { background: color-mix(in oklab, #f5c518 26%, transparent); box-shadow: inset 3px 0 0 #e0a800; border-radius: 6px; transition: background .25s; }
.prose li.speaking, .prose p.speaking, .prose h2.speaking, .prose h3.speaking, .prose blockquote.speaking { padding-inline: 6px; margin-inline: -6px; }
[dir="rtl"] .prose .speaking, .prose[dir="rtl"] .speaking { box-shadow: inset -3px 0 0 #e0a800; }
.voice-stop { display: flex; align-items: center; gap: 8px; margin: 0 auto 10px; padding: 7px 16px 7px 12px; border: 1px solid color-mix(in oklab, var(--accent-2) 35%, var(--line)); border-radius: 999px; background: color-mix(in oklab, var(--accent-2) 9%, var(--card)); color: var(--ink); font: inherit; font-size: .9em; cursor: pointer; box-shadow: 0 4px 14px color-mix(in oklab, var(--accent-2) 18%, transparent); transition: transform .15s, box-shadow .15s; }
.voice-stop:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in oklab, var(--accent-2) 26%, transparent); }
.voice-stop:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.voice-bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.voice-bars i { width: 3px; height: 100%; border-radius: 2px; background: var(--accent-2); animation: voice-bar .9s ease-in-out infinite; }
.voice-bars i:nth-child(2) { animation-delay: -.3s; } .voice-bars i:nth-child(3) { animation-delay: -.6s; } .voice-bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes voice-bar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .voice-bars i { animation: none; transform: scaleY(.6); } }
.voice-stop[hidden] { display: none; }
.mic[hidden] { display: none; }
.mic.on { color: #fff; background: var(--danger); animation: voice-pulse 1.2s ease-in-out infinite; }
.voice-stop .ic { width: 16px; height: 16px; animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .voice-stop .ic { animation: none; } }
.seen { white-space: pre-wrap; margin: 6px 0 2px; max-height: 260px; overflow: auto; font-size: .85rem; }
.plot { max-width: 600px; margin: 12px 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); }
.plot svg { display: block; width: 100%; height: auto; }
.plot path { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.plot .g { stroke: currentColor; opacity: .08; }
.plot .a { stroke: currentColor; opacity: .45; }
.plot text { fill: currentColor; opacity: .55; font-size: 11px; }
.plot figcaption { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: .85rem; }
.plot figcaption span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-inline-end: 6px; border-radius: 2px; background: var(--c); vertical-align: middle; }
.docs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.doc { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: .85rem; }
.doc .ic, .thumb.doc .ic { width: 16px; height: 16px; flex: none; }
.thumb.doc { display: flex; align-items: center; gap: 6px; max-width: 220px; height: 64px; padding-inline: 10px 26px; border: 1px solid var(--line); border-radius: 12px; font-size: .82rem; }
.thumb.doc bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A PDF shows its first page: small in the box while it waits, bigger in the message with its name under it. */
.thumb.pdf img { object-position: top; background: #fff; }
.thumb.pdf b { position: absolute; inset-block-end: 4px; inset-inline-start: 4px; padding: 1px 5px; border-radius: 5px; background: #d93025; color: #fff; font-size: .62rem; line-height: 1.4; }
.doc-shot { width: min(190px, 60vw); margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.doc-shot img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; background: #fff; }
.doc-shot figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); font-size: .82rem; }
.doc-shot .ic { width: 16px; height: 16px; flex: none; }
.doc-shot bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts { display: grid; gap: 6px; width: 100%; margin: 0; padding: 0; list-style: none; }
.facts li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
#style { width: 100%; resize: vertical; font: inherit; }

/* the privacy and terms page: one column, no sidebar */
body.legal { display: block; height: auto; overflow: auto; }
.legal .page { max-width: 760px; padding-block: 28px 60px; }
.legal .card { margin-block: 14px; }
.legal h2 { font-size: 1.1rem; margin-top: 1.2em; }
.legal li { margin-block: 4px; }

/* ---------- the owner's machine page: a label, a bar, a number */
.use-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.use-row:first-child { border-top: 0; }
.use-row small { color: var(--muted); white-space: nowrap; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--v, 0%); border-radius: 4px; background: var(--accent); transition: width .4s; }
.meter.hot i { background: #d2453b; }
.report { padding: 10px 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.report:first-child { border-top: 0; }
/* the privacy page shows one language: Arabic for Arabic, English for every other */
html[lang="ar"] .legal article[lang="en"], html:not([lang="ar"]) .legal article[lang="ar"] { display: none; }
.age-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; text-align: start; }

/* ---------- the live preview: the project running in a pane beside the chat (right of it by default, in Arabic too) */
.side { grid-area: side; }
.main { grid-area: main; }
.preview { grid-area: pv; }
body.pv-on { --pv: min(var(--pv-w, 44vw), 75vw); grid-template-columns: 260px minmax(0, 1fr) var(--pv); grid-template-areas: "side main pv"; }
body.pv-on.pv-flip { grid-template-columns: 260px var(--pv) minmax(0, 1fr); grid-template-areas: "side pv main"; }
@media (min-width: 721px) {
  [data-side="closed"] body.pv-on { grid-template-columns: minmax(0, 1fr) var(--pv); grid-template-areas: "main pv"; }
  [data-side="closed"] body.pv-on.pv-flip { grid-template-columns: var(--pv) minmax(0, 1fr); grid-template-areas: "pv main"; }
  /* expanded: the preview takes the chat's place (the button brings the chat back) */
  body.pv-on.pv-max, body.pv-on.pv-flip.pv-max { grid-template-columns: 270px minmax(0, 1fr); grid-template-areas: "side pv"; }
  [data-side="closed"] body.pv-on.pv-max, [data-side="closed"] body.pv-on.pv-flip.pv-max { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pv"; }
  body.pv-on.pv-max .main { display: none; }
}
.preview { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100dvh; background: var(--side); border-inline-start: 1px solid var(--line); }
body.pv-flip .preview { border-inline-start: 0; border-inline-end: 1px solid var(--line); }
.preview[hidden] { display: none; }
.pv-bar { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .pv-bar { padding: 6px 14px 6px 10px; }
.pv-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: .93rem; }
.pv-title b { font-weight: 600; flex: none; }
.pv-title small { color: var(--muted); font: .78rem ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3f9b4b; box-shadow: 0 0 0 4px color-mix(in srgb, #3f9b4b 20%, transparent); }
.pv-tools { display: flex; gap: 2px; flex: none; }
.pv-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 9px; background: none; color: var(--muted); padding: 0; }
.pv-btn:hover, .pv-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.pv-btn .ic { width: 18px; height: 18px; }
.pv-x:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pv-stage { flex: 1; min-height: 0; padding: 10px; }
.pv-stage[hidden], .pv-code[hidden] { display: none; }
.pv-tabs { display: flex; flex: none; gap: 2px; padding: 3px; border-radius: 10px; background: var(--raise); }
.pv-tab { border: 0; border-radius: 8px; padding: 4px 10px; background: none; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; }
.pv-tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
.pv-code { flex: 1; min-height: 0; margin: 10px; padding: 12px 14px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #0d1117; color: #e6edf3; font: .8rem/1.6 ui-monospace, Consolas, monospace; text-align: left; white-space: pre; tab-size: 2; }
.pv-code code.hljs { display: block; padding: 0; background: none; }
.pv-file { display: block; margin: 14px 0 6px; color: #8b949e; font-size: .74rem; }
.pv-file:first-child { margin-top: 0; }
.pv-stage iframe { display: block; width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
/* the inner edge: drag it to make the pane wider or narrower */
.pv-grip { position: absolute; z-index: 2; inset-block: 0; inset-inline-start: -5px; width: 10px; cursor: col-resize; touch-action: none; }
body.pv-flip .pv-grip { inset-inline-start: auto; inset-inline-end: -5px; }
.pv-grip::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 4px; width: 2px; transition: background .2s; }
.pv-grip:hover::after, .pv-drag .pv-grip::after { background: var(--accent-2); }
.pv-max .pv-grip { display: none; }
.pv-drag { cursor: col-resize; user-select: none; }
.pv-drag .pv-stage iframe { pointer-events: none; }
/* what the project printed (console.log) and its errors, folded under it */
.pv-console { margin: 0 10px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: .82rem; }
.pv-console[hidden] { display: none; }
.pv-console summary { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; color: var(--muted); list-style: none; }
.pv-console summary::-webkit-details-marker { display: none; }
.pv-console summary b { min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--raise); color: var(--ink); font-size: .74rem; text-align: center; }
.pv-console.bad summary b { background: var(--danger); color: #fff; }
.pv-console ol { list-style: none; margin: 0; padding: 4px 0; max-height: 28vh; overflow: auto; border-top: 1px solid var(--line); font: .8rem/1.5 ui-monospace, Consolas, monospace; text-align: left; }
.pv-console li { padding: 3px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-console li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.pv-console li.warn { color: #c98a12; background: color-mix(in srgb, #f5a524 8%, transparent); }
.pv-console li.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
/* the file reader: a PDF page by page, Markdown, code, a table or plain text, in the pane beside the chat */
.preview.doc .pv-tabs, .preview.doc #pvUp, .preview.doc #pvDown, .preview.doc #pvReload, .preview.doc .pv-console, .preview.doc .pv-dot { display: none; }
.preview:not(.doc) #pvSave { display: none; }
.preview.doc .pv-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.pv-doc { flex: 1; min-height: 0; overflow: auto; padding: 18px; scrollbar-width: thin; }
.pv-doc.pdf { display: flex; flex-direction: column; align-items: center; gap: 16px; background: color-mix(in srgb, var(--ink) 5%, var(--side)); }
.preview .pv-doc[hidden] { display: none; }
.pv-page { margin: 0; width: 100%; max-width: 900px; }
.pv-page canvas { display: block; width: 100%; height: auto; aspect-ratio: var(--page-ratio, 1 / 1.414); background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgb(0 0 0 / .22), 0 10px 28px rgb(0 0 0 / .14); }
.pv-page figcaption { margin-top: 7px; text-align: center; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.pv-doc > .prose, .pv-text { max-width: 760px; margin-inline: auto; }
.pv-text { font-size: .95rem; line-height: 1.85; }
.pv-text p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-note, .pv-wait { color: var(--muted); font-size: .85rem; text-align: center; margin: 6px auto 16px; max-width: 520px; }
.pv-src { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #0d1117; color: #e6edf3; font: .8rem/1.6 ui-monospace, Consolas, monospace; white-space: pre; overflow: auto; text-align: left; color-scheme: dark; }
.pv-src code.hljs { display: block; padding: 0; background: none; }
.pv-table { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.pv-table table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: .85rem; }
.pv-table th, .pv-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
.pv-table th { position: sticky; top: 0; background: var(--raise); font-weight: 600; }
.pv-doc > iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 10px; background: #fff; }
.pv-drag .pv-doc > iframe { pointer-events: none; }
/* their files, and the PDFs Burhan made, open in the reader */
.docs [data-doc], .quiz-card[data-id] { cursor: pointer; transition: border-color .15s, background .15s; }
.docs [data-doc]:hover, .quiz-card[data-id]:hover { border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); }
.docs [data-doc]:focus-visible, .quiz-card[data-id]:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* "Preview" on an HTML, CSS or JS card */
.code-btn.run { align-items: center; gap: 5px; margin-right: 4px; padding: 4px 11px; border-radius: 99px; font: 600 .78rem var(--body); color: var(--ink); background: color-mix(in srgb, #3f9b4b 16%, transparent); }
.code-btn.run .ic { width: 13px; height: 13px; fill: #3f9b4b; stroke: #3f9b4b; }
.code-btn.run:hover { background: color-mix(in srgb, #3f9b4b 28%, transparent); color: var(--ink); }
/* a phone: the preview covers the screen, and × brings the chat back */
@media (max-width: 720px) {
  body.pv-on, body.pv-on.pv-flip, body.pv-on.pv-max { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
  .preview { position: fixed; inset: 0; z-index: 30; border: 0 !important; }
  .pv-grip, #pvSide, #pvMax { display: none; }
}

/* ===================================================================================================================
   The plain look: calm warm greys instead of pure black, no glow behind the page, a quiet sidebar with icons, a serif
   greeting, and the message box as one soft card with its tools in a row underneath. Overrides the rules above.
   =================================================================================================================== */
:root {
  --paper: #faf9f5; --side: #f3f1ea; --card: #ffffff; --raise: #efede5;
  --ink: #1d1c1a; --muted: #6f6c64; --line: #e3e0d6;
  --serif: "Source Serif 4", "Noto Naskh Arabic", Georgia, "Times New Roman", serif;
}
:root[data-theme="dark"] {
  --paper: #262624; --side: #1f1e1d; --card: #30302e; --raise: #393937;
  --ink: #ecebe6; --muted: #a2a097; --line: #3b3a37;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #262624; --side: #1f1e1d; --card: #30302e; --raise: #393937;
    --ink: #ecebe6; --muted: #a2a097; --line: #3b3a37;
  }
}
::-webkit-scrollbar-thumb { border-color: var(--paper); }
.aurora { display: none !important; }


/* sidebar */
.side { gap: 1px; padding: 12px 10px; border-inline-end-color: transparent; }
.brand { display: flex; align-items: center; gap: 8px; font: 600 1.15rem var(--display); padding: 4px 10px 14px; }
.brand .logo { --s: 24px; box-shadow: none; margin: 0; }
.side-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px; background: none; font-size: .92rem; text-align: start; color: var(--ink); }
.side-link .ic { width: 18px; height: 18px; color: var(--muted); }
.side-link.primary { border: 0; background: none; font-weight: 500; }
.side-link.primary:hover { transform: none; }
.side-link.primary .ic { width: 20px; height: 20px; padding: 2px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.side-link:hover, .side-link[aria-current] { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.side h2 { font: 500 .75rem var(--body); margin: 18px 10px 4px; }
.side-search { margin: 4px 0 0; padding: 6px 12px !important; border-radius: 8px !important; font-size: .88rem !important; background: var(--card) !important; }
#chats a { padding: 5px 10px; font-size: .9rem; }
#chats li { border-radius: 8px; }
#chats li:hover, #chats li:has([aria-current]) { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.account { border-top: 0; padding: 6px 6px 10px; }
.me { padding: 6px; border-radius: 10px; }
.ini { width: 30px; height: 30px; font-size: .85rem; }
.me .ring-wrap { display: none; }
.guest-card { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px; border-radius: 10px; }
.guest-card .me-text { flex: 1; }
.guest-ini { background: color-mix(in srgb, var(--ink) 14%, transparent) !important; color: var(--ink) !important; }
.guest-card .btn.small { padding: 4px 12px; border-radius: 8px; font-size: .82rem; font-weight: 600; background: var(--ink); color: var(--paper); }
.guest-card .tool { padding: 5px; }

/* the top bar and the thread */
.bar { min-height: 44px; }
.msg.user .body { border-radius: 14px; padding: 8px 16px; }

/* the greeting: the logo beside a serif line, nothing else on an empty screen */
.welcome h1 { display: flex; align-items: center; justify-content: center; gap: 14px; font: 400 clamp(1.7rem, 3.6vw, 2.35rem)/1.3 var(--serif); letter-spacing: -.01em; }
.welcome .logo.big { --s: 36px; margin: 0; box-shadow: none; }
.welcome p, .chat.empty #chips, .chat.empty .fine { display: none; }
.chat.empty .dock { padding-bottom: 16vh; }
.chat.empty .welcome { margin-bottom: 26px; }

/* the message box: one soft card, the text on top, the tools in a row under it */
.composer { border-radius: 18px; padding: 10px 10px 8px; gap: 2px; box-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05); }
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 6px 22px rgb(0 0 0 / .08); }
.composer::before { display: none; }
.composer textarea { flex: none; width: 100%; padding: 6px 8px 4px; min-height: 48px; font-size: 1rem; }
.composer .row { align-items: center; gap: 2px; margin: 0; }
.composer .grow { flex: 1; }
.composer .tool.round { width: 34px; height: 34px; border-radius: 9px; }
#attachBtn { border: 1px solid var(--line); }
#send { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--ink); color: var(--paper); margin-inline-start: 4px; }
#send .ic { width: 18px; height: 18px; stroke-width: 2.2; }
#send:hover { transform: none; filter: brightness(1.12); }
.composer .statusline { margin: 0; gap: 0; font-size: .84rem; }
.statusline .pick { padding: 4px 6px; }
.statusline .pick.soft { color: var(--muted); }
#modeName { color: var(--ink); font-weight: 500; }
.statusline .mode-menu { inset-inline-start: auto; inset-inline-end: 0; }
.chips { margin-top: 12px; }
.chip { font-size: .84rem; border-radius: 8px; padding: 3px 12px; }

/* the preview's title is its files, not a word */
.pv-title b { display: none; }
.composer [hidden], .statusline [hidden] { display: none !important; }
.guest-card .me-text small, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .composer .statusline .pick.soft { display: none; }
  .welcome h1 { font-size: 1.6rem; gap: 10px; }
}
.set-sub { font-size: 1rem; margin: 26px 0 4px; }
.skill-tools { display: flex; align-items: center; gap: 4px; }
a.addon-btn { text-decoration: none; color: inherit; }

/* ---------- answers in a calm serif (Source Serif for Latin, Noto Naskh for Arabic), everything else in the plain sans */
:root:not([data-font="tajawal"]):not([data-font="cairo"]):not([data-font="kufi"]):not([data-font="almarai"]) .msg.bot .prose {
  font-family: var(--serif); font-size: 1.04em; line-height: 1.85; letter-spacing: 0;
}
.msg.bot .prose h1, .msg.bot .prose h2, .msg.bot .prose h3 { font-family: var(--serif); font-weight: 600; }
.msg.bot .prose code, .msg.bot .prose pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88em; }

/* ---------- answers still being written in another chat: a spinning ring; finished and not read yet: a dot */
#chats li.live > a::before, #chats li.unread > a::before {
  content: ""; display: inline-block; flex: none; width: 9px; height: 9px; margin-inline-end: 8px; vertical-align: middle; border-radius: 50%;
}
#chats li.live > a::before { border: 1.6px solid var(--muted); border-top-color: var(--ink); animation: spin .8s linear infinite; }
#chats li.unread > a::before { background: var(--accent-2, #4f8cff); width: 7px; height: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- threads: under their chat in the sidebar, and a note on top of the thread */
#chats li.sub > a { padding-inline-start: 26px; font-size: .92em; color: var(--muted); }
#chats li.sub > a::after { content: "↳"; position: absolute; inset-inline-start: 10px; opacity: .55; }
#chats li.sub { position: relative; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px auto 18px; padding: 10px 14px; max-width: var(--col, 760px); width: 100%;
  border: 1px solid var(--line); border-radius: 14px; color: var(--muted); font-size: .9rem; }
.thread-head .ic { width: 16px; height: 16px; }
.thread-head a { color: var(--ink); }
.thread-head blockquote { flex-basis: 100%; margin: 4px 0 0; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); white-space: pre-wrap; max-height: 6.5em; overflow: hidden; }

/* ---------- a plugin found on GitHub, with its Install button; the GitHub token form in settings */
.install-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; max-width: 560px; }
.install-card header { display: flex; align-items: center; gap: 10px; }
.install-card header a { font-weight: 600; color: var(--ink); text-decoration: none; }
.install-card header a[href]:hover { text-decoration: underline; }
.install-card .quiz-text { display: flex; flex-direction: column; min-width: 0; }
.install-card ul { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; max-height: 220px; overflow: auto; }
.install-card li { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-card li b { color: var(--ink); font-weight: 600; }
.install-card footer { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.install-card .btn { display: inline-flex; align-items: center; gap: 6px; }
.install-card .btn .ic { width: 16px; height: 16px; }
.gh-token { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gh-token input { flex: 1 1 200px; min-width: 0; }
.gh-token small { flex-basis: 100%; }
#usageMini.hot .ring .fill { stroke: currentColor; }
#usageMini.hot { color: #d99a1c; } /* nearly full: a warm nudge, not an alarm */

/* ---------- the message box, tidied so its parts match: every tool the same quiet button, the send button and the focus
   line in the accent colour, and what is attached as tiles of one size (a picture, a PDF's first page, any other file) */
.composer { border-radius: 20px; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.composer .tool.round, #send { width: 36px; height: 36px; border-radius: 10px; }
.composer .tool.round .ic { width: 19px; height: 19px; }
#attachBtn { border: 0; }
#send { background: var(--accent); color: var(--on-accent); }
.composer .statusline .pick { min-height: 36px; padding-inline: 8px; border-radius: 10px; }
.attach-preview { gap: 10px; margin: 2px 4px 6px; }
.thumb img { border-radius: 12px; }
.thumb.doc { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 10px; align-content: center; width: 190px; max-width: 100%; height: 64px; padding: 0 12px; border-radius: 12px; background: var(--raise); }
.thumb.doc .ic { grid-row: 1 / 3; align-self: center; width: 36px; height: 36px; padding: 9px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); }
.thumb.doc bdi { align-self: end; font-size: .84rem; }
.thumb.doc small { align-self: start; color: var(--muted); font-size: .68rem; letter-spacing: .05em; }
.thumb.pdf b { background: var(--ink); color: var(--paper); }
.x { top: -6px; inset-inline-end: -6px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: var(--ink); color: var(--paper); font-size: .9rem; box-shadow: 0 0 0 2px var(--card); }
.x::after { content: ""; position: absolute; inset: -8px; } /* a fingertip's worth around it */
.doc { border-radius: 12px; background: var(--raise); }

/* ---------- the code editor in the preview pane: VS Code's look, a tab per file and Run */
.pv-code { color-scheme: dark; scrollbar-color: #4a4a4a transparent; }
.pv-edit { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #1e1e1e; }
.pv-edit[hidden] { display: none; }
.pv-ftabs { display: flex; align-items: stretch; min-height: 35px; overflow-x: auto; background: #252526; scrollbar-width: none; }
.pv-ftabs [data-file] { padding: 0 14px; border: 0; border-right: 1px solid #1e1e1e; background: #2d2d2d; color: #969696; font: 13px/1 "Segoe UI", system-ui, sans-serif; white-space: nowrap; }
.pv-ftabs [data-file]:hover { color: #cccccc; }
.pv-ftabs [data-file][aria-selected="true"] { background: #1e1e1e; color: #ffffff; box-shadow: inset 0 1px 0 #0078d4; }
.pv-fgap { flex: 1; }
.pv-runit { display: inline-flex; align-items: center; gap: 6px; margin: 4px 6px; padding: 0 12px; border: 0; border-radius: 5px; background: #0078d4; color: #fff; font: 600 12.5px/1 "Segoe UI", system-ui, sans-serif; }
.pv-runit:hover { background: #026ec1; }
.pv-runit .ic { width: 13px; height: 13px; }
.pv-monaco { flex: 1; min-height: 0; }
.pv-edit.light { background: #ffffff; }
.pv-edit.light .pv-ftabs { background: #f3f3f3; }
.pv-edit.light .pv-ftabs [data-file] { background: #ececec; border-right-color: #f3f3f3; color: #616161; }
.pv-edit.light .pv-ftabs [data-file][aria-selected="true"] { background: #ffffff; color: #333333; }

/* ---------- the site's font: the system's own sans (Segoe UI on Windows, with its Arabic), plain and easy to read, for
   the page and the answers alike; a serif only for the greeting and page titles. The old pairs stay in the font menu. */
:root { --body: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif; --display: var(--body); }
:root[data-font="plex"] { --body: "Geist", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; --display: "Geist", "IBM Plex Sans Arabic", system-ui, sans-serif; }
:root:not([data-font="tajawal"]):not([data-font="cairo"]):not([data-font="kufi"]):not([data-font="almarai"]) .msg.bot .prose { font-family: var(--body); font-size: 1em; line-height: 1.8; }
.msg.bot .prose h1, .msg.bot .prose h2, .msg.bot .prose h3 { font-family: var(--body); }
.set-sec > h2, .page.settings > h1 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }

/* ---------- the owner's machine page: what the hardware allowed, and why */
.tune-why { margin: 6px 0 0; padding-inline-start: 20px; color: var(--muted); font-size: .88rem; line-height: 1.7; }
#sysTune .stat-line.warn { color: #d99a1c; }
#sysTune details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }

/* ---------- A calmer look (2026-11-16, the owner asked for a quieter style): the steps line is plain text with no box,
   the ticks are thin and grey instead of green discs, and a file's card reads as a document (red page icon, "Document · PDF"). */
.tool-use.trail { padding: 2px 0; border: 0; border-radius: 0; font-size: .9rem; }
.trail summary { width: fit-content; border-radius: 8px; transition: color .15s; }
.trail summary:hover { color: var(--ink); }
.trail .steps { margin-inline-start: 7px; padding: 8px 0 6px 0; gap: 8px; }
.trail .steps > li, .trail .steps > li.done, .trail .steps > li.now { color: var(--muted); font-weight: 400; }
.trail .steps > li.now { color: var(--ink); }
.steps li.done:not(:last-child)::after { background: var(--line); }
.steps li.done::before { border: 1.5px solid var(--line); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9f' stroke-width='3'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center/10px no-repeat; animation: none; }
.task-bar::after { background: var(--ink); opacity: .55; }
.quiz-card { gap: 14px; min-width: min(340px, 100%); padding: 12px 14px; border-radius: 14px; background: var(--raise); border-color: transparent; transition: border-color .15s; }
.quiz-card:hover { border-color: var(--line); }
.quiz-card .quiz-text { flex: 1; }
.quiz-card.paper .quiz-ic { background: color-mix(in srgb, #e5484d 16%, transparent); color: #e5484d; }

/* ---------- the steps of a job on a file, shown like a programmer's tool shows its work: the step, the call it makes
   (a line of code), what came out and how long it took. Open while it works, folded under the answer after. */
.work { margin: 0 0 12px; max-width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: .88rem; overflow: hidden; }
.work > summary { display: flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; list-style: none; color: var(--ink); }
.work > summary::-webkit-details-marker { display: none; }
.work > summary .ic { width: 16px; height: 16px; color: var(--muted); }
.work > summary small { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.work.running > summary .ic { color: var(--accent-2); animation: pulse .7s infinite alternate; }
.work ol { list-style: none; margin: 0; padding: 4px 14px 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.work li { min-width: 0; }
.w-head { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.w-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-time { margin-inline-start: auto; flex: none; color: var(--muted); font: .76rem ui-monospace, Consolas, monospace; }
.w-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.w-ok .w-dot { background: #3f9b4b; }
.w-run .w-dot { background: var(--accent-2); animation: pulse .7s infinite alternate; }
.w-fail .w-dot { background: var(--danger); }
.w-wait { opacity: .55; }
.w-run .w-head { font-weight: 600; }
.w-cmd { display: block; margin: 3px 0 0; padding-inline-start: 17px; color: var(--accent-2); font: .78rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.w-out { margin: 1px 0 0; padding-inline-start: 17px; color: var(--muted); font-size: .8rem; }
.w-fail .w-out { color: var(--danger); }

/* A file in the box while it is read (a spinner and "Page 3 of 12"), and one that could not be read (marked, not gone). */
.doc-spin { grid-row: 1 / 3; align-self: center; width: 36px; height: 36px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 9%, transparent); position: relative; }
.doc-spin::after { content: ""; position: absolute; inset: 10px; border: 2px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .8s linear infinite; }
.thumb.doc.loading small { color: var(--accent-2); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.thumb.doc.failed { border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent); }
.thumb.doc.failed .ic { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.thumb.doc.failed small { color: var(--danger); letter-spacing: 0; }
#send.waiting { animation: pulse .7s infinite alternate; }

/* ---------- answers laid out like a good study sheet (2026-11-17, from the owner's example pictures): a clear step between
   heading levels, room between items and between sections, tables with a header row and rounded edges, a quiet callout
   for a tip or a rule ("> 🔑 الحيلة: …"), and a thin rule between parts. The same in the file reader. */
:is(.msg.bot, .pv-doc) .prose h1 { font-size: 1.42rem; line-height: 1.35; margin: 1.2em 0 .55em; font-weight: 700; letter-spacing: -.005em; }
:is(.msg.bot, .pv-doc) .prose h2 { font-size: 1.2rem; line-height: 1.4; margin: 1.45em 0 .5em; font-weight: 700; }
:is(.msg.bot, .pv-doc) .prose h3 { font-size: 1.06rem; line-height: 1.45; margin: 1.25em 0 .4em; font-weight: 650; }
:is(.msg.bot, .pv-doc) .prose h4 { font-size: 1rem; line-height: 1.5; margin: 1.1em 0 .3em; font-weight: 650; }
:is(.msg.bot, .pv-doc) .prose > :first-child { margin-top: 0; }
:is(.msg.bot, .pv-doc) .prose p { margin: 0 0 .75em; }
:is(.msg.bot, .pv-doc) .prose :is(ul, ol) { margin: .25em 0 .9em; padding-inline-start: 1.55em; }
:is(.msg.bot, .pv-doc) .prose li { margin: .3em 0; padding-inline-start: .15em; }
:is(.msg.bot, .pv-doc) .prose li > :is(ul, ol) { margin: .2em 0 .3em; }
:is(.msg.bot, .pv-doc) .prose li > p { margin: 0 0 .3em; }
:is(.msg.bot, .pv-doc) .prose li::marker { color: var(--muted); }
:is(.msg.bot, .pv-doc) .prose ol > li::marker { font-variant-numeric: tabular-nums; }
:is(.msg.bot, .pv-doc) .prose strong { font-weight: 650; color: var(--ink); }
:is(.msg.bot, .pv-doc) .prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
:is(.msg.bot, .pv-doc) .prose blockquote { margin: .8em 0 1em; padding: .65em 1em; border-inline-start: 3px solid color-mix(in srgb, var(--ink) 30%, var(--line)); background: color-mix(in srgb, var(--ink) 5%, transparent); border-start-end-radius: 10px; border-end-end-radius: 10px; color: var(--ink); }
:is(.msg.bot, .pv-doc) .prose blockquote > :last-child { margin-bottom: 0; }
:is(.msg.bot, .pv-doc) .prose table { display: block; width: fit-content; max-width: 100%; overflow-x: auto; margin: .8em 0 1.1em; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 10px; font-size: .95em; }
:is(.msg.bot, .pv-doc) .prose :is(th, td) { border: 0; border-bottom: 1px solid var(--line); padding: 8px 14px; text-align: start; vertical-align: top; }
:is(.msg.bot, .pv-doc) .prose :is(th, td) + :is(th, td) { border-inline-start: 1px solid var(--line); }
:is(.msg.bot, .pv-doc) .prose th { background: color-mix(in srgb, var(--ink) 6%, transparent); font-weight: 650; white-space: nowrap; }
:is(.msg.bot, .pv-doc) .prose tr:last-child > td { border-bottom: 0; }
:is(.msg.bot, .pv-doc) .prose :not(pre) > code { padding: .08em .38em; border-radius: 6px; background: color-mix(in srgb, var(--ink) 8%, transparent); font-size: .86em; }
/* the reader names the file it shows (the page preview names its files in the small line instead) */
.preview.doc .pv-title b { display: block; }
.pv-page figcaption { direction: ltr; }

/* "deep research" while it is on: a chip next to "+", tinted like a switched-on tool; a click switches it off */
.dig-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; margin-inline-start: 4px; border: 1px solid color-mix(in srgb, var(--accent-2) 38%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--accent-2) 11%, transparent); color: var(--accent-2); font: inherit; font-size: .84rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .15s; }
.dig-chip[hidden] { display: none; }
.dig-chip:hover { background: color-mix(in srgb, var(--accent-2) 18%, transparent); }
.dig-chip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.dig-chip .ic { width: 16px; height: 16px; flex: none; }
.dig-chip .x { width: 12px; height: 12px; opacity: .65; }
.dig-chip:hover .x { opacity: 1; }

/* Tahsili in the test picker: shown, locked until it is ready */
.mode-menu button.locked { opacity: .55; cursor: not-allowed; }
.mode-menu button.locked:hover { background: transparent; }
/* «مستواي»: the last quizzes */
.recent { list-style: none; margin: 8px 0 0; padding: 0; }
.recent li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.recent li:first-child { border-top: 0; }
.bar-row > span:nth-child(2) { display: block; }

/* «الدورات»: one card a course, in order, its progress and lessons */
.courses { display: grid; gap: 14px; margin-top: 18px; }
.course { display: grid; gap: 12px; }
.course-head { display: flex; align-items: center; gap: 12px; }
.course-head h2 { font-size: 1.2rem; margin: 0; flex: 1; }
.course-no { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-2); color: #fff; font-weight: 700; }
.course-state { color: var(--muted); white-space: nowrap; }
.course p { margin: 0; }
.course-bar { display: block; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.course-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent-2); transition: width .4s; }
.course-lessons summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.course-lessons ol { margin: 8px 0 0; padding-inline-start: 22px; display: grid; gap: 4px; font-size: .92rem; }
.course-lessons li.seen { color: var(--muted); }
.course-lessons li.seen::marker { content: "✓  "; color: var(--accent-2); }
.course .btn { justify-self: start; }
.course.done { border-color: color-mix(in oklab, var(--accent-2) 45%, var(--line)); }
.course.locked { opacity: .65; }
.course.locked .course-no { background: var(--line); color: var(--ink); }
.course-state { display: inline-flex; align-items: center; gap: 5px; }
.course-state .lock { width: 15px; height: 15px; flex: none; }
.course-head { flex-wrap: wrap; row-gap: 4px; }
.course-head h2 { min-width: min(12em, 70%); }

/* the voice that reads explanations: a card a voice, picked with a click, heard with its speaker */
.voice-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.voice-opt { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--card); }
.voice-opt:has(input:checked) { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.voice-opt input { accent-color: var(--accent-2); margin: 0; }
.voice-name { font-weight: 600; flex: 1; }
.voice-try { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: color-mix(in oklab, var(--accent-2) 14%, transparent); color: var(--ink); cursor: pointer; }
.voice-try .ic { width: 16px; height: 16px; }
.voice-try.busy { animation: voice-pulse 1s ease-in-out infinite; }
.voice-try:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- speaking to Burhan (talk.js): the mic grows with their voice; the talk circle is a spoken conversation */
.mic.on { animation: none; box-shadow: 0 0 0 calc(3px + var(--lvl, 0) * 12px) color-mix(in oklab, var(--danger) 28%, transparent); transition: box-shadow .08s linear; }
.talk-open[hidden] { display: none; }
main.talking .composer, main.talking .chips, main.talking .welcome, main.talking .voice-stop { display: none; }
.talk { display: grid; justify-items: center; gap: 10px; padding: 18px 16px 14px; margin: 0 auto 8px; max-width: var(--chat); }
.talk[hidden] { display: none; }
.talk-orb { --lvl: 0; position: relative; width: 132px; height: 132px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.talk-orb::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, color-mix(in oklab, var(--accent-2) 30%, transparent) 0%, transparent 70%); transform: scale(calc(.85 + var(--lvl) * .45)); transition: transform .09s linear; }
.talk-core { position: relative; width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(from 0deg, #7ab8ff, #5a78ff, #9c7bff, #48c6ef, #7ab8ff); box-shadow: inset 0 0 28px rgb(255 255 255 / .35), 0 10px 40px color-mix(in oklab, var(--accent-2) 35%, transparent); transform: scale(calc(1 + var(--lvl) * .14)); transition: transform .09s linear; }
.talk-core::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .85), rgb(255 255 255 / 0) 60%); filter: blur(4px); }
.talk-orb[data-state="idle"] .talk-core { animation: talk-breathe 3s ease-in-out infinite; filter: saturate(.55); }
.talk-orb[data-state="think"] .talk-core { animation: talk-spin 1.6s linear infinite; }
.talk-orb[data-state="speak"] .talk-core { animation: talk-speak .9s ease-in-out infinite; }
.talk-orb:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 8px; }
@keyframes talk-breathe { 50% { transform: scale(.94); } }
@keyframes talk-spin { to { transform: rotate(1turn) scale(.92); } }
@keyframes talk-speak { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.09); } 60% { transform: scale(.97); } }
@media (prefers-reduced-motion: reduce) { .talk-orb .talk-core { animation: none !important; } }
.talk-state { margin: 4px 0 0; font-weight: 600; color: var(--ink); text-align: center; }
.talk-said { margin: 0; min-height: 1.4em; max-width: 34em; color: var(--muted); font-size: .92em; text-align: center; overflow-wrap: anywhere; }
.talk-end { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.talk-end:hover { background: var(--raise); }
.talk-end .ic { width: 16px; height: 16px; }

/* ---------- the quiz, closer to the real test: how far along (a bar and the time), a clear stem, the result as a ring */
.quiz-play { padding: 16px 18px; box-shadow: 0 6px 24px rgb(0 0 0 / .06); }
.quiz-play header { margin-bottom: 8px; }
.quiz-time { margin-inline-start: auto; padding: 4px 10px; border-radius: 99px; background: var(--raise); color: var(--muted); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; }
.quiz-time[hidden] { display: none; }
.quiz-progress { display: grid; gap: 6px; margin: 0 0 14px; }
.quiz-done { color: var(--muted); font-size: .85rem; font-weight: 600; }
.quiz-bar { height: 6px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.quiz-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), color-mix(in oklab, var(--accent-2) 60%, #7a5af0)); transition: width .3s ease; }
.quiz-play.graded .quiz-progress { display: none; }
.quiz-play li.qi { background: color-mix(in oklab, var(--raise) 35%, var(--card)); padding: 14px 16px; }
.quiz-play .q { font-size: 1.06rem; line-height: 1.7; }
.quiz-play .opt { background: var(--card); }
.quiz-play .opt[aria-checked="true"] { box-shadow: 0 0 0 1px var(--accent-2) inset; }
.quiz-play .why { padding: 8px 12px; border-radius: 10px; background: var(--raise); color: var(--ink); font-size: .9rem; line-height: 1.7; }
.quiz-play .why::before { content: attr(data-label); display: block; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.quiz-play li.no .why { box-shadow: inset 3px 0 0 var(--accent); }
.quiz-play .why.wait::after { content: attr(data-wait); display: block; color: var(--muted); animation: why-blink 1.4s ease-in-out infinite; }
@keyframes why-blink { 50% { opacity: .4; } }
.quiz-play .qtools { display: flex; justify-content: flex-end; margin-top: 8px; }
.quiz-play .qtools .btn { border-radius: 99px; background: none; border: 1px solid var(--line); color: var(--accent-2); font-size: .85rem; padding: 5px 12px; }
.quiz-play .qtools .btn:hover { background: var(--raise); }
.quiz-play footer .explain { background: color-mix(in oklab, var(--accent-2) 14%, var(--card)) !important; color: var(--ink) !important; border: 1px solid color-mix(in oklab, var(--accent-2) 35%, var(--line)); }
.quiz-score { align-items: center; gap: 12px; }
.quiz-score:empty { display: none; }
.quiz-score > span:last-child { display: grid; gap: 2px; }
.quiz-score small { color: var(--muted); font-size: .85rem; }
.quiz-ring { --p: 0; flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#3f9b4b calc(var(--p) * 1%), var(--raise) 0); }
.quiz-score.low .quiz-ring { background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--raise) 0); }
.quiz-ring b { width: 42px; height: 42px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: .8rem !important; color: var(--ink) !important; }
@media (max-width: 560px) { .quiz-play { padding: 12px; } .quiz-play li.qi { padding: 12px; } .quiz-score { margin-inline-start: 0; width: 100%; } }

/* the "listen" button over text picked in the chat (voice.js) */
.sel-voice { position: fixed; z-index: 60; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 12px; border: 0; border-radius: 99px; background: var(--ink); color: var(--paper); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgb(0 0 0 / .25); animation: sel-in .15s ease-out; }
.sel-voice[hidden] { display: none; }
.sel-voice .ic { width: 16px; height: 16px; }
@keyframes sel-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .sel-voice { animation: none; } }

/* ===================================================================================================================
   The front page's look (/home, home.css) on every page: plain black or white paper, bordered cards, bold Geist/Plex
   headings, and the chat's greeting laid out like the front page's hero. Last on purpose: it overrides the plain look.
   =================================================================================================================== */
:root { --paper: #ffffff; --side: #ffffff; --card: #ffffff; --raise: #f3f3f5; --ink: #0d0d0d; --muted: #6b6b70; --line: #e5e5e7; }
:root[data-theme="dark"] { --paper: #0f0f0f; --side: #0f0f0f; --card: #1a1a1a; --raise: #232325; --ink: #ececec; --muted: #9a9a9f; --line: #2a2a2a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #0f0f0f; --side: #0f0f0f; --card: #1a1a1a; --raise: #232325; --ink: #ececec; --muted: #9a9a9f; --line: #2a2a2a; }
}
.side { border-inline-end: 1px solid var(--line); }
.brand { font: 700 1.25rem var(--display); }
.brand .logo { --s: 28px; }
.welcome .eyebrow { display: block; color: var(--muted); font-weight: 500; margin: 0 0 12px; }
.welcome h1 { flex-direction: column; gap: 18px; font: 700 clamp(2rem, 4.8vw, 3.3rem)/1.2 var(--display); }
.welcome .logo.big { --s: 52px; }
.chat.empty #chips { display: flex; margin-top: 18px; }
.chip { padding: 8px 16px; border-radius: 10px; background: transparent; border: 1px solid var(--line); font-size: .92rem; font-weight: 600; transition: transform .15s; }
.chip:hover { transform: translateY(-1px); border-color: var(--ink); color: var(--ink); }
.composer { border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 30px rgb(0 0 0 / .12); }
.card { border-radius: 16px; }
.btn { border-radius: 10px; }
.page h1 { font: 700 clamp(1.9rem, 4vw, 2.6rem)/1.25 var(--display); }
.main.scroll .bar { border-bottom: 1px solid var(--line); }

/* ===================================================================================================================
   The installed app ([data-app="on"], boot.js): the same look, tidier. The welcome shows where they stand in three cards,
   the website-only lines go, and on a narrow window the main pages sit in a tab bar at the bottom.
   =================================================================================================================== */
.today-strip, .tabbar { display: none; }
.chat.empty .today-strip:not(:empty) { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 640px; margin: 22px auto 0; }
.today-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-align: start; border-radius: 14px; border: 1px solid var(--line); background: var(--card); transition: transform .15s, border-color .15s; }
.today-card:hover { transform: translateY(-1px); border-color: var(--ink); }
.today-card small { color: var(--muted); font-size: .8rem; }
.today-card b { font: 700 1.05rem/1.4 var(--display); }
[data-app="on"] .welcome p.aim, [data-app="on"] .fine, [data-app="on"] .chat.empty:has(.today-strip:not(:empty)) #chips { display: none; } /* the cards take the suggestions' place */
@media (max-width: 720px) {
  [data-app="on"] .tabbar { position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  [data-app="on"] .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: .72rem; color: var(--muted); text-decoration: none; }
  [data-app="on"] .tabbar a[aria-current] { color: var(--ink); font-weight: 600; }
  [data-app="on"] .tabbar .ic { width: 22px; height: 22px; }
  [data-app="on"] .main { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .chat.empty .today-strip:not(:empty) { gap: 8px; }
  .today-card { padding: 10px; }
  .today-card b { font-size: .9rem; }
  [data-app="on"] .welcome .logo.big { --s: 40px; }
}

/* ===================================================================================================================
   The Windows app ([data-desktop="on"], boot.js draws its title bar): like Claude's window, the sidebar sits on the plain
   frame and the page is a rounded panel inside it, a little in from the edges.
   =================================================================================================================== */
[data-desktop="on"] .side { background: var(--frame); border-inline-end: 0; }
[data-desktop="on"] .side .brand, [data-desktop="on"] #menu { display: none; }
[data-desktop="on"] .main { height: calc(100dvh - var(--tb) - 8px); margin: 0 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); overflow: hidden; }
[data-desktop="on"] .main.scroll { overflow-y: auto; }
@media (max-width: 720px) {
  [data-desktop="on"] .side { inset-block-start: var(--tb); }
  [data-desktop="on"] .main { margin: 0 6px 6px; }
}
/* the account box sat 2px wider than the sidebar, so the sidebar grew scrollbars (plain to see in the Windows app) */
.side { overflow-x: hidden; }
.side .account { max-width: 100%; box-sizing: border-box; margin-bottom: -12px; } /* flush with the bottom: the sidebar pads 12px now (was 14) */

/* «مستواي»: badges, a class joined with a code, a mastered kind */
.badges { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.badges .badge { padding: 4px 10px; border-radius: 99px; background: var(--raise); font-size: .85rem; }
.join-form { gap: 8px; margin-block: 10px; }
.join-form input { flex: 1; min-width: 0; font: inherit; letter-spacing: .12em; text-transform: uppercase; color: inherit; background: transparent; border: 1px solid var(--line, #8884); border-radius: 8px; padding: 6px 10px; }
.joined { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.bar-row.mastered > span:first-child { color: var(--ok, #2f8f4e); font-weight: 600; }

/* the teacher's page (teacher.html) */
.make-class { gap: 8px; align-items: center; }
.make-class input { flex: 1; min-width: 0; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line, #8884); border-radius: 8px; padding: 8px 10px; }
.class-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.class-top h2 { margin: 0; font-size: 1.2rem; flex: 1; }
.class-code { font: 700 1.1rem/1 ui-monospace, monospace; letter-spacing: .15em; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--line, #8884); background: var(--raise); color: inherit; cursor: copy; direction: ltr; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.class-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.class-table th, .class-table td { padding: 8px 6px; text-align: start; border-bottom: 1px solid var(--line, #8884); white-space: nowrap; }
.class-table th { color: var(--muted); font-weight: 500; font-size: .82rem; }
.btn[hidden] { display: none !important; } /* a hidden button stays hidden, whatever display .btn gives it */
.streak-big { font: 700 1.6rem/1.3 var(--display); margin: 4px 0; }

/* ===================================================================================================================
   Burhan's own colours (2026-11): midnight blue-black, a mint-teal accent ("burhan", the default) and a soft blue glow
   behind an empty chat. Overrides the plain look's warm greys above; the logo keeps its shape and takes the gradient.
   =================================================================================================================== */
:root {
  --paper: #f6f9fb; --side: #edf2f6; --card: #ffffff; --raise: #e8eef3;
  --ink: #0b1220; --muted: #5b6878; --line: #dae2ea; --accent-2: #2f6bff;
  --au1: rgb(8 160 135 / .10); --au2: rgb(47 107 255 / .08); --au3: rgb(8 160 135 / .06);
}
:root[data-theme="dark"] {
  --paper: #0a0e14; --side: #06090d; --card: #111722; --raise: #19212e;
  --ink: #e8eef6; --muted: #8e9aac; --line: #212b3a; --accent-2: #7ea6ff;
  --au1: rgb(34 211 176 / .13); --au2: rgb(61 123 255 / .18); --au3: rgb(34 211 176 / .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0e14; --side: #06090d; --card: #111722; --raise: #19212e;
    --ink: #e8eef6; --muted: #8e9aac; --line: #212b3a; --accent-2: #7ea6ff;
    --au1: rgb(34 211 176 / .13); --au2: rgb(61 123 255 / .18); --au3: rgb(34 211 176 / .08);
  }
}
:root[data-accent="burhan"] { --accent-base: #087a69; }
:root[data-accent="burhan"][data-theme="dark"] { --accent: #22d3b0; --on-accent: #03140f; }
@media (prefers-color-scheme: dark) { :root[data-accent="burhan"]:not([data-theme="light"]) { --accent: #22d3b0; --on-accent: #03140f; } }
:root[data-accent="burhan"] .logo { background: linear-gradient(135deg, var(--accent) 15%, var(--accent-2)); }
.aurora { display: block !important; }
#send, .guest-card .btn.small { background: var(--accent); color: var(--on-accent); }

/* ---------- the weighted-score calculator (weighted.html) and the mistakes notebook (mistakes.html) */
.seg { flex-wrap: wrap; }
.seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); font-weight: 600; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.w-grid label, .w-line { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.w-grid input, .w-line input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise, var(--card)); color: var(--ink); font: inherit; font-size: 1.05rem; }
.w-grid[hidden], .w-grid label[hidden] { display: none; }
.w-weights { padding-top: 12px; border-top: 1px dashed var(--line); }
.muted.small { font-size: .85rem; margin: 10px 0 0; }
.w-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .92rem; }
.w-table td { padding: 6px 4px; border-top: 1px solid var(--line); }
.w-table td:last-child { text-align: end; }
.w-line { margin-block: 12px; }
.w-need { margin-top: 14px; font-size: 1.05rem; }
.w-need b { font-size: 1.6rem; color: var(--accent); }
.w-need.hard { color: var(--danger); }
.mis-list { display: grid; gap: 14px; }
.mis-card .mis-kind { display: block; margin-bottom: 6px; }
.mis-card .mis-q { font-weight: 600; font-size: 1.05rem; }
.mis-card .mis-pick { font-size: .85rem; margin: 8px 0 0; }
.mis-card .mis-said { margin: 10px 0 0; font-weight: 600; }
.mis-card .opt:disabled { cursor: default; }
.mis-passage { margin-bottom: 10px; color: var(--muted); }
.mis-passage summary { cursor: pointer; }
.page .row .grow { flex: 1; }

/* Palette 4 (chosen 2026-11-22): teal for Burhan and what is selected, orange for the main action, on deep teal-black
   (dark) or a pale teal-white (light). Last in the file so it wins over the colors above. */
:root {
  --paper: #f5fafa; --side: #eaf3f3; --card: #ffffff; --raise: #e4efef;
  --ink: #0b1f20; --muted: #55706f; --line: #d3e2e2;
  --accent-2: #0b8a83; --cta: #f28c28; --on-cta: #2e1503;
  --au1: rgb(25 181 173 / .10); --au2: rgb(120 140 140 / .07); --au3: rgb(242 140 40 / .06);
}
:root[data-theme="dark"] {
  --paper: #0b1516; --side: #081011; --card: #122224; --raise: #1a2e30;
  --ink: #e6f3f3; --muted: #93b0b0; --line: #1f3638;
  --accent-2: #19b5ad;
  --au1: rgb(25 181 173 / .16); --au2: rgb(150 180 180 / .08); --au3: rgb(242 140 40 / .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1516; --side: #081011; --card: #122224; --raise: #1a2e30;
    --ink: #e6f3f3; --muted: #93b0b0; --line: #1f3638;
    --accent-2: #19b5ad;
    --au1: rgb(25 181 173 / .16); --au2: rgb(150 180 180 / .08); --au3: rgb(242 140 40 / .08);
  }
}
:root[data-accent="burhan"] { --accent-base: #0b8a83; }
:root[data-accent="burhan"][data-theme="dark"] { --accent: #19b5ad; --on-accent: #03201e; }
@media (prefers-color-scheme: dark) { :root[data-accent="burhan"]:not([data-theme="light"]) { --accent: #19b5ad; --on-accent: #03201e; } }
:root[data-accent="burhan"] .btn, :root[data-accent="burhan"] #send, :root[data-accent="burhan"] .guest-card .btn.small { background: var(--cta); color: var(--on-cta); }
:root[data-accent="burhan"] .btn.ghost { background: none; color: var(--ink); }
.theme .light { background: linear-gradient(90deg, #eaf3f3 30%, #f5fafa 30%); }
.theme .dark { background: linear-gradient(90deg, #081011 30%, #0b1516 30%); }
.theme .auto { background: linear-gradient(135deg, #f5fafa 50%, #0b1516 50%); }

/* The sign-in code: big, spaced digits; and the quiet text buttons under the forms. */
.login .code-input { text-align: center; font-size: 1.5rem; letter-spacing: .5em; font-variant-numeric: tabular-nums; }
.login .link-btn { margin-top: 12px; border: 0; background: none; color: var(--accent-2); font: inherit; font-size: .92rem; cursor: pointer; }
.login .link-btn:disabled { color: var(--muted); cursor: default; }
.login [hidden] { display: none !important; } /* the box's rows have their own display, which beat [hidden] */
