/* Alwafaa Quran Classroom · the school's design language ("the illuminated notebook"): paper and iron-gall ink, madder red, the Mushaf green,
   a dark spine with a gold lattice, ruled square panels and hairlines instead of cards and blur.
   Tokens and fonts are the website's own (css/base.css), copied here so the classroom stands on its own. Day/night follows the website. */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/fraunces.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400 700; font-display: swap; src: url(/fonts/fraunces-italic.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/atkinson.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/atkinson-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF; }
@font-face { font-family: "Reem Kufi"; font-weight: 700; font-display: swap; src: url(/fonts/reem-kufi-700.woff2) format("woff2"); }
@font-face { font-family: "Aref Ruqaa"; font-weight: 700; font-display: swap; src: url(/fonts/ruqaa-700.woff2) format("woff2"); }
@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap; src: url(/fonts/amiri.woff2?v=2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(/fonts/plex-ar-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600 700; font-display: swap; src: url(/fonts/plex-ar-600.woff2) format("woff2"); }
@font-face { font-family: "KFGQPC Hafs"; src: url("/fonts/hafs.18.woff2") format("woff2"); font-display: block; }
:root {
  /* Paper & ink: a warm unbleached page and an iron-gall black */
  --paper: #EFE6D0; --paper-2: #E6DBBF; --panel: #F8F2E2; --ink: #17161D; --ink-2: #3D3B46; --mute: #655F50;
  --hair: rgb(23 22 29 / .2); --rule: #17161D;
  /* The tajweed palette: each subject carries one colour of the colour-coded Mushaf */
  --green: #1D6B49; --green-soft: #D5E3CC;   /* Quran: ghunnah */
  --madder: #A23623; --madder-soft: #F0D5C3; /* Islamic Studies: madd */
  --blue: #2A5CA8; --blue-soft: #D2DDEC;     /* Arabic: qalqalah */
  --gold: #A9791A; --gold-soft: #EBD9A4; --gold-ink: #6B4A07;
  --night: #17161D; --night-2: #23212D; --on-night: #EFE6D0; --on-night-2: #BDB5A0; --night-gold: #E2B85B;
  --on-madder: #FFF9EE;
  --f-hand: "Aref Ruqaa", "Noto Naskh Arabic", serif;
  --f-naskh: "Amiri", "Noto Naskh Arabic", "Times New Roman", serif;
  --f-kufi: "Reem Kufi", "Noto Kufi Arabic", sans-serif;
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-quran: "KFGQPC Hafs", "Amiri", serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
  --m-star: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cpath%20d%3D%22M50.0%202.0L61.5%2022.3L83.9%2016.1L77.7%2038.5L98.0%2050.0L77.7%2061.5L83.9%2083.9L61.5%2077.7L50.0%2098.0L38.5%2077.7L16.1%2083.9L22.3%2061.5L2.0%2050.0L22.3%2038.5L16.1%2016.1L38.5%2022.3Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E");
  --m-lattice: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221%22%3E%3Cpath%20d%3D%22M32.0%2012.8L36.4%2021.4L45.6%2018.4L42.6%2027.6L51.2%2032.0L42.6%2036.4L45.6%2045.6L36.4%2042.6L32.0%2051.2L27.6%2042.6L18.4%2045.6L21.4%2036.4L12.8%2032.0L21.4%2027.6L18.4%2018.4L27.6%2021.4Z%22%2F%3E%3Cpath%20d%3D%22M32%200V8M32%2056V64M0%2032H8M56%2032H64%22%2F%3E%3Ccircle%20cx%3D%220%22%20cy%3D%220%22%20r%3D%229%22%2F%3E%3Ccircle%20cx%3D%2264%22%20cy%3D%220%22%20r%3D%229%22%2F%3E%3Ccircle%20cx%3D%220%22%20cy%3D%2264%22%20r%3D%229%22%2F%3E%3Ccircle%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%229%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
}
:root[lang="ar"] {
  --f-display: "Reem Kufi", "Noto Kufi Arabic", "Segoe UI", sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Atkinson Hyperlegible Next", "Segoe UI", Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15141B; --paper-2: #1D1C26; --panel: #1F1E29; --ink: #EDE5D0; --ink-2: #CFC7B2; --mute: #A29B86;
    --hair: rgb(237 229 208 / .18); --rule: #EDE5D0;
    --green: #5FBB8C; --green-soft: #1C3328; --madder: #E57B5D; --madder-soft: #3D2119; --blue: #7BA3E6; --blue-soft: #1C2A44;
    --gold: #DDB451; --gold-soft: #3A2F13; --gold-ink: #EBCB7E;
    --night: #0D0C12; --night-2: #17161F; --on-madder: #1B0C07;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15141B; --paper-2: #1D1C26; --panel: #1F1E29; --ink: #EDE5D0; --ink-2: #CFC7B2; --mute: #A29B86;
  --hair: rgb(237 229 208 / .18); --rule: #EDE5D0;
  --green: #5FBB8C; --green-soft: #1C3328; --madder: #E57B5D; --madder-soft: #3D2119; --blue: #7BA3E6; --blue-soft: #1C2A44;
  --gold: #DDB451; --gold-soft: #3A2F13; --gold-ink: #EBCB7E;
  --night: #0D0C12; --night-2: #17161F; --on-madder: #1B0C07;
  color-scheme: dark;
}
/* ---------------------------------------------------------------- base */
:root {
  --hdr: 40px; --gap: 8px; --pad: 10px;
  --page: #FBF6E8; --page-ink: #17161D; --page-rule: #B8913A; --page-soft: #EFE4C4;
  --shadow: 3px 3px 0 var(--hair);
  --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,1 59.4,27.3 85.6,14.4 72.7,40.6 99,50 72.7,59.4 85.6,85.6 59.4,72.7 50,99 40.6,72.7 14.4,85.6 27.3,59.4 1,50 27.3,40.6 14.4,14.4 40.6,27.3' fill='%23E2B85B'/%3E%3Cpath d='M35 73V52C35 42 43 35 50 27C57 35 65 42 65 52V73Z' fill='%2317161D'/%3E%3Ccircle cx='50' cy='57' r='4.5' fill='%23E2B85B'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --page: #262430; --page-ink: #EDE5D0; --page-rule: #8F7433; --page-soft: #302D3B; } }
:root[data-theme="dark"] { --page: #262430; --page-ink: #EDE5D0; --page-rule: #8F7433; --page-soft: #302D3B; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.45 var(--f-body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--blue); text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .4em; color: var(--ink); font-family: var(--f-display); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(20px, 2.4vw, 26px); letter-spacing: -.01em; } h2 { font-size: 17px; } h3 { font-size: 14.5px; }
h4 { font: 700 11px/1.3 var(--f-body); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); margin: .9em 0 .4em; }
:root[lang="ar"] h4 { letter-spacing: 0; font-size: 12.5px; text-transform: none; }
.muted { color: var(--mute); } .small { font-size: 12.5px; } .center { text-align: center; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip:focus { position: fixed; top: 6px; inset-inline-start: 6px; z-index: 100; background: var(--ink); color: var(--paper); padding: 6px 12px; }
:focus-visible { outline: 2px solid var(--madder); outline-offset: 2px; }
.loading { padding: 32px; text-align: center; color: var(--mute); }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 0 11px; border: 1px solid var(--ink); background: var(--panel); color: var(--ink); font: 700 13px/1.15 var(--f-body); cursor: pointer; text-decoration: none; white-space: nowrap; border-radius: 0; transition: background .12s, color .12s; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--madder); border-color: var(--madder); color: var(--on-madder); box-shadow: 2px 2px 0 var(--night-gold); } .btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.danger { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: 2px 2px 0 var(--madder); } .btn.danger:hover { background: var(--madder); border-color: var(--madder); color: var(--on-madder); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 26px; padding: 0 9px; font-size: 12.5px; } .btn.tiny { min-height: 22px; padding: 0 7px; font-size: 11.5px; } .btn.big { min-height: 38px; padding: 0 18px; font-size: 15px; } .btn.block { width: 100%; }
.btn.on, .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--ink); border-radius: 0; padding: 5px 8px; background: var(--paper); max-width: 100%; min-height: 30px; }
textarea { min-height: 0; }
input[type="checkbox"], input[type="radio"] { min-height: 0; padding: 0; border-radius: 0; accent-color: var(--madder); }
input[type="file"] { padding: 3px 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--madder); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--mute); opacity: 1; }
label { display: grid; gap: 3px; font-weight: 700; font-size: 12.5px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.switch input { width: 16px; height: 16px; min-height: 0; accent-color: var(--madder); }
.switch.inline { margin-inline-start: 8px; }
.form-error { color: var(--madder); font-weight: 700; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border: 1px solid var(--ink); font: 700 11.5px/1.5 var(--f-body); background: var(--panel); color: var(--ink); white-space: nowrap; text-decoration: none; }
.pill.live { background: var(--madder); border-color: var(--madder); color: var(--on-madder); } .pill.live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
.pill.ok { background: var(--green-soft); border-color: var(--green); color: var(--green); } .pill.warn { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); } .pill.free { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pill.live i { animation: none; } }
.tag { display: inline-block; font: 700 11px/1.5 var(--f-body); padding: 0 6px; border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink-2); }
.tag.gold { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--gold); } .tag.blue { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); } .tag.green { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.count { font: 700 11.5px/1.5 var(--f-body); background: var(--ink); color: var(--paper); padding: 0 6px; }
.badge { display: inline-block; min-width: 16px; padding: 0 4px; background: var(--madder); color: var(--on-madder); font-size: 10.5px; margin-inline-start: 4px; text-align: center; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--paper-2); border: 1px solid var(--ink); color: var(--ink); font: 700 12px var(--f-body); flex: none; }
.avatar.t { background: var(--night); border-color: var(--night-gold); color: var(--night-gold); }

/* ---------------------------------------------------------------- header: a slim dark spine with the school mark */
.app-header { background: var(--night); color: var(--on-night); position: sticky; top: 0; z-index: 30; border-bottom: 2px solid var(--night-gold); }
.app-header::before { content: ""; position: absolute; inset: 0; background: var(--night-gold); opacity: .07; -webkit-mask: var(--m-lattice) 0 0 / 64px 64px; mask: var(--m-lattice) 0 0 / 64px 64px; pointer-events: none; }
.bar { position: relative; display: flex; align-items: center; gap: 14px; height: var(--hdr); padding: 0 clamp(10px, 2vw, 18px); max-width: 1680px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--on-night); text-decoration: none; min-width: 0; }
.brand-mark, .login-mark { width: 26px; height: 26px; flex: none; background: var(--mark) center / contain no-repeat; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand b { font: 600 14px/1 var(--f-display); letter-spacing: .01em; white-space: nowrap; }
.brand small { font: 700 15px/1 var(--f-hand); color: var(--night-gold); white-space: nowrap; }
.top-nav { display: flex; gap: 0; align-items: stretch; height: 100%; }
.top-nav a { display: flex; align-items: center; padding: 0 10px; color: var(--on-night-2); text-decoration: none; font: 700 11.5px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -2px; }
:root[lang="ar"] .top-nav a { letter-spacing: 0; font-size: 13px; text-transform: none; }
.top-nav a:hover { color: var(--on-night); border-bottom-color: var(--night-gold); }
.bar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.app-header .btn.ghost { color: var(--on-night); border-color: rgb(239 230 208 / .45); min-height: 24px; padding: 0 8px; font-size: 12px; background: transparent; }
.app-header .btn.ghost:hover { background: var(--night-gold); color: var(--night); border-color: var(--night-gold); }
.who { display: flex; align-items: center; gap: 6px; color: var(--on-night); text-decoration: none; font: 700 12.5px var(--f-body); }
.who .avatar { width: 22px; height: 22px; font-size: 11px; }
.app-main { max-width: 1240px; margin: 0 auto; padding: 14px clamp(10px, 2vw, 18px) 40px; outline: none; }
body.in-room .app-main { max-width: none; padding: 0; }
body.in-room .top-nav, body.in-room .who-name { display: none; }

/* ---------------------------------------------------------------- panels and pages (compact, ruled, no blur) */
.card { background: var(--panel); border: 1px solid var(--ink); padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.narrow { max-width: 380px; margin: 28px auto; }
.card h2, .card h3 { padding-bottom: 5px; margin-bottom: 8px; border-bottom: 3px double var(--ink); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { border: 0; padding: 0; margin: 0; }
.login { display: grid; gap: 10px; text-align: start; padding-top: 38px; position: relative; border-width: 2px; outline: 1px solid var(--night-gold); outline-offset: 4px; }
.login .login-mark { position: absolute; top: -26px; inset-inline-start: 50%; width: 52px; height: 52px; margin-inline-start: -26px; }
.login h1 { text-align: center; margin: 0; font-size: 22px; } .login p { margin: 0; text-align: center; }
.back-link { display: inline-block; margin-bottom: 8px; font-weight: 700; font-size: 12.5px; }
.hello { padding: 12px 16px; background: var(--night); color: var(--on-night); margin-bottom: 12px; position: relative; overflow: hidden; border-bottom: 3px double var(--night-gold); }
.hello::after { content: ""; position: absolute; inset: 0; background: var(--night-gold); opacity: .07; -webkit-mask: var(--m-lattice) 0 0 / 64px 64px; mask: var(--m-lattice) 0 0 / 64px 64px; pointer-events: none; }
.hello h1 { color: var(--on-night); margin: 0 0 2px; font-size: 20px; } .hello .muted { color: var(--on-night-2); margin: 0; position: relative; z-index: 1; }
.live-strip { display: grid; gap: 8px; margin-bottom: 12px; }
.live-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border: 2px solid var(--madder); text-decoration: none; color: var(--ink); }
.live-chip .btn { margin-inline-start: auto; }
.sec { margin-top: 6px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.course-card { background: var(--panel); border: 1px solid var(--ink); padding: 10px 12px; box-shadow: var(--shadow); display: grid; gap: 6px; align-content: start; }
.course-card.is-live { border: 2px solid var(--madder); }
.cc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; } .cc-top h3 { margin: 0; font-size: 15px; }
.inst { display: flex; align-items: center; gap: 8px; margin: 0; } .inst small { display: block; color: var(--mute); font-size: 11px; line-height: 1.2; }
.cc-actions { display: grid; gap: 6px; margin-top: 2px; grid-template-columns: 1fr 1fr; } .cc-actions > :first-child, .cc-actions > .start-form { grid-column: 1 / -1; }
.start-form { display: grid; gap: 6px; padding: 8px; background: var(--paper); border: 1px dashed var(--ink-2); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.course-head { margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--panel); border: 1px solid var(--ink); padding: 8px 10px; display: grid; }
.stat b { font: 600 22px/1.1 var(--f-display); color: var(--madder); } .stat span { color: var(--mute); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: start; padding: 4px 8px; border-bottom: 1px solid var(--hair); vertical-align: top; }
th { font: 700 10.5px/1.3 var(--f-body); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); border-bottom: 2px solid var(--ink); white-space: nowrap; }
:root[lang="ar"] th { letter-spacing: 0; text-transform: none; font-size: 12px; }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 10%, transparent); }
tr.off td { opacity: .5; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0 12px; align-items: end; }
.grid-form .full { grid-column: 1 / -1; } .grid-form h4 { margin: 6px 0 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.inline-form input[name="url"] { flex: 1 1 180px; }
.mat-list, .rec-list, .assign-list, .assess-list, .log, .members, .notes, .mem-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.mat-list li, .rec-list li, .assign-list li, .assess-list li, .log li { padding: 6px 9px; border: 1px solid var(--hair); background: var(--paper); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: space-between; }
.assess-list li { display: grid; } .assign-list li.done { opacity: .6; }
.scores { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; } .score b { color: var(--madder); }
.comment { background: var(--gold-soft); color: var(--gold-ink); border-inline-start: 3px solid var(--gold); padding: 5px 8px; font-size: 12.5px; }
.mem-bars li { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.pbar { height: 8px; background: var(--paper-2); border: 1px solid var(--ink); overflow: hidden; } .pbar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--green) 0 6px, var(--gold) 6px 8px); }
.admin-course { border-top: 1px solid var(--hair); padding: 10px 0; }
.members li { display: flex; gap: 5px; align-items: center; }

/* ---------------------------------------------------------------- toasts and dialogs */
.toasts { position: fixed; bottom: 12px; inset-inline-end: 12px; display: grid; gap: 6px; z-index: 200; max-width: min(360px, calc(100vw - 24px)); }
.toast { background: var(--night); color: var(--on-night); padding: 8px 12px; border: 1px solid var(--night-gold); font-weight: 700; font-size: 13px; box-shadow: 3px 3px 0 var(--night-gold); transition: opacity .3s, transform .3s; border-inline-start: 5px solid var(--night-gold); }
.toast.ok { border-inline-start-color: #6FD3A0; } .toast.warn { border-inline-start-color: #F0B44C; } .toast.error { border-inline-start-color: #F08A78; } .toast.out { opacity: 0; transform: translateY(8px); }
.modal { border: 2px solid var(--ink); border-radius: 0; padding: 0; width: min(540px, calc(100vw - 20px)); max-height: calc(100vh - 28px); background: var(--panel); color: var(--ink); box-shadow: 6px 6px 0 var(--night-gold); }
.modal::backdrop { background: rgb(13 12 18 / .6); }
.modal-body { padding: 14px 16px; display: grid; gap: 10px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.note-text { font-size: 15px; white-space: pre-wrap; }

/* ---------------------------------------------------------------- the live classroom: one 40px bar, three working columns */
.room { height: calc(100vh - var(--hdr)); height: calc(100dvh - var(--hdr)); min-height: 520px; display: flex; flex-direction: column; background: var(--paper); }
.room-top { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 40px; background: var(--panel); border-bottom: 3px double var(--ink); flex-wrap: nowrap; overflow: hidden; }
.room-top .back { font-size: 18px; text-decoration: none; color: var(--ink); padding: 0 4px; }
.room-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; } .room-title b, .room-title h1 { font: 600 15px/1.2 var(--f-display); color: var(--ink); white-space: nowrap; margin: 0; letter-spacing: 0; }
.room-title span, .room-title small { color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-title small { display: none; }
.room-status { display: flex; gap: 5px; flex-wrap: nowrap; align-items: center; }
.room-status .linkish { font-size: 12px; }
.room-actions { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: nowrap; }
.room-grid { flex: 1; display: grid; grid-template-columns: 252px minmax(0, 1fr) 300px; gap: var(--gap); padding: var(--gap) }
.col-left { display: grid; grid-template-rows: auto 1fr; gap: var(--gap) }
.panel { background: var(--panel); border: 1px solid var(--ink); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 8px; min-height: 30px; background: var(--paper-2); border-bottom: 1px solid var(--ink); }
.panel-head h2, .panel-head h3 { margin: 0; font: 600 13px/1.2 var(--f-display); letter-spacing: .01em; }
.video-box { aspect-ratio: 16 / 11; background: var(--night); display: grid; position: relative; }
.video-box iframe { width: 100%; height: 100%; border: 0; }
.vtools { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.vtools .btn { min-height: 22px; padding: 0 6px; font-size: 11px; }
.video-alt { position: absolute; bottom: 6px; inset-inline-end: 6px; }
.video-off { display: grid; place-content: center; text-align: center; color: var(--on-night); padding: 14px; gap: 4px; } .video-off .muted { color: var(--on-night-2); }
.people { list-style: none; margin: 0; padding: 3px; overflow-y: auto; }
.person { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; padding: 4px 6px; border-bottom: 1px solid var(--hair); }
.person.hand { background: var(--gold-soft); }
.pname { display: grid; min-width: 0; } .pname b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pname small { color: var(--mute); font-size: 11px; line-height: 1.2; }
.pflags { display: flex; gap: 5px; align-items: center; }
.syncdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .syncdot.ok { background: var(--green); } .syncdot.warn { background: var(--gold); }
.pactions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 3px; padding-inline-start: 34px; }
.pad { padding: 0 10px; }

.mushaf-panel { position: relative; }
.mtools { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--ink); background: var(--paper-2); }
.mtools .btn { min-height: 26px; padding: 0 8px; font-size: 12px; }
.seg { display: inline-flex; } .seg .btn + .btn { margin-inline-start: -1px; }
.swatches { display: inline-flex; gap: 3px; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ink); cursor: pointer; padding: 0 }
.sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.sw[data-color="gold"] { background: #F2D27A; } .sw[data-color="green"] { background: #9ED9B8; } .sw[data-color="blue"] { background: #A9CBF2; } .sw[data-color="rose"] { background: #F2AFB6; } .sw[data-color="violet"] { background: #CDB8F0; }
.where { padding: 4px 12px; font: 700 12.5px var(--f-body); color: var(--gold-ink); background: var(--gold-soft); border-bottom: 1px solid var(--gold); }
.recite-bar, .share-bar { padding: 4px 12px; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-bottom: 1px solid var(--hair); }
.recite-bar { background: var(--blue-soft); color: var(--blue); } .recite-bar.mine { background: var(--green-soft); color: var(--green); font-weight: 700; }
.recite-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.share-bar { background: var(--paper-2); }
.mushaf-scroll { flex: 1; min-height: 0; overflow-y: auto; position: relative; padding: clamp(6px, 1.4vw, 14px); background: var(--paper-2); }
.mushaf-panel:fullscreen { background: var(--paper); } .mushaf-panel:fullscreen .mushaf-scroll { padding: 3vh 8vw; }

/* the Mushaf page: ruled in gold like a printed page */
.mushaf-page { --qscale: 1; max-width: 860px; margin: 0 auto; background: var(--page); color: var(--page-ink); border: 1px solid var(--page-rule); padding: clamp(10px, 2vw, 20px) clamp(12px, 3vw, 30px);
  box-shadow: 0 0 0 3px var(--page), 0 0 0 4px var(--page-rule), 0 0 0 7px var(--page), 0 0 0 8px var(--page-rule); margin-block: 9px; }
.page-head, .page-foot { display: flex; justify-content: space-between; font: 700 11.5px var(--f-body); color: var(--gold-ink); }
.page-head { border-bottom: 1px solid var(--page-rule); padding-bottom: 4px; margin-bottom: 6px; } .page-surah { font-family: var(--f-quran); font-size: 16px; }
.page-foot { justify-content: center; border-top: 1px solid var(--page-rule); padding-top: 4px; margin-top: 8px; }
.surah-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 10px 0 4px; padding: 4px 12px; background: var(--night); color: var(--night-gold); border-block: 3px double var(--night-gold); }
.sh-name { font-family: var(--f-quran); font-size: calc(clamp(26px, 2vw, 32px) * var(--qscale)); text-align: center; color: var(--on-night); line-height: 1.6; }
.sh-meta { font: 700 11.5px var(--f-body); } .sh-meta:last-child { text-align: end; }
.basmala { font-family: var(--f-quran); font-size: calc(clamp(30px, 2.3vw, 38px) * var(--qscale)); text-align: center; color: var(--page-ink); margin: 4px 0 2px; }
.flow { font-family: var(--f-quran); font-size: calc(clamp(30px, 2.3vw, 38px) * var(--qscale)); line-height: 2.1; text-align: justify; text-align-last: center; color: var(--page-ink); word-spacing: .04em; }
.ayah { padding: 0 1px; transition: background-color .2s; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ayah:hover { background: color-mix(in srgb, var(--green) 9%, transparent); }
.ayah.in-range { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.ayah.focus { background: color-mix(in srgb, var(--green) 18%, transparent); box-shadow: 0 2px 0 var(--green); }
.ayah.sel { outline: 2px dashed var(--green); }
.hl[data-color="gold"] { background: rgb(242 210 122 / .62); } .hl[data-color="green"] { background: rgb(158 217 184 / .62); } .hl[data-color="blue"] { background: rgb(169 203 242 / .62); }
.hl[data-color="rose"] { background: rgb(242 175 182 / .62); } .hl[data-color="violet"] { background: rgb(205 184 240 / .62); }
:root[data-theme="dark"] .hl[data-color] { color: #17161D; }
.w.hl { box-shadow: 0 0 0 2px rgb(0 0 0 / .1); }
.end { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .12em; margin: 0 .1em; font-size: .62em; line-height: 1; vertical-align: .18em;
  color: var(--page-ink); border-radius: 50%; background: radial-gradient(circle, var(--page) 52%, transparent 54%), conic-gradient(var(--page-rule) 0 12.5%, var(--gold-soft) 0 25%, var(--page-rule) 0 37.5%, var(--gold-soft) 0 50%, var(--page-rule) 0 62.5%, var(--gold-soft) 0 75%, var(--page-rule) 0 87.5%, var(--gold-soft) 0); }
.hizb-mark { color: var(--gold); }
.w.note-word { text-decoration: underline wavy var(--gold); text-underline-offset: .35em; text-decoration-thickness: 2px; }
.note-pin { font: 700 12px var(--f-body); background: var(--gold); color: var(--page); border: 0; border-radius: 50%; width: 20px; height: 20px; vertical-align: super; cursor: pointer; margin: 0 2px; padding: 0 }
.q-name { font-family: var(--f-quran); font-size: 1.15em; font-weight: 400; } .q-inline { font-family: var(--f-quran); font-size: 1.3em; font-weight: 400; }
.ayah-menu { position: absolute; z-index: 60; width: 250px; background: var(--panel); border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--night-gold); padding: 3px; display: grid; }
.mi-head { padding: 4px 8px; font: 700 11px var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.mi { text-align: start; background: none; border: 0; padding: 6px 8px; font: 700 13px var(--f-body); color: var(--ink); cursor: pointer }
.mi:hover, .mi:focus-visible { background: var(--ink); color: var(--paper); }

/* side panel */
.side-tabs { display: flex; border-bottom: 1px solid var(--ink); background: var(--paper-2); }
.side-tabs button { flex: 1; background: none; border: 0; padding: 7px 4px; font: 700 12px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
:root[lang="ar"] .side-tabs button { letter-spacing: 0; text-transform: none; font-size: 13px; }
.side-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--madder); background: var(--panel); }
.side-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px }
.chat-settings { font-size: 12.5px; background: var(--paper); border: 1px solid var(--hair); padding: 4px 8px; display: grid; gap: 6px; } .chat-settings summary { font-weight: 700; cursor: pointer; }
.chat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; flex: 1; align-content: start; overflow-y: auto; min-height: 120px; }
.msg { background: var(--paper); border: 1px solid var(--hair); padding: 4px 8px; font-size: 13px; }
.msg.mine { background: var(--green-soft); border-color: var(--green); } .msg.from-teacher { border-inline-start: 3px solid var(--green); }
.msg.k-announcement { background: var(--gold-soft); border-inline-start: 3px solid var(--gold); } .msg.k-private { background: var(--blue-soft); } .msg.k-question { border-inline-start: 3px solid var(--blue); }
.msg.system { background: none; border: 0; text-align: center; color: var(--mute); font-size: 12px; }
.mhead { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; } .mhead time { margin-inline-start: auto; color: var(--mute); font-size: 11px; }
.mbody { white-space: pre-wrap; overflow-wrap: anywhere; } .quote { font-size: 11.5px; color: var(--mute); border-inline-start: 2px solid var(--hair); padding-inline-start: 6px; }
.chat-form { display: grid; gap: 5px; border-top: 1px solid var(--ink); padding-top: 6px; }
.chat-opts { display: flex; gap: 5px; flex-wrap: wrap; } .chat-opts select { padding: 2px 6px; font-size: 12px; min-height: 26px; }
.chat-send { display: flex; gap: 5px; } .chat-send textarea { flex: 1; resize: none; }
.replying { font-size: 12px; color: var(--mute); }
.lesson input { width: 100%; }

/* Fehres: the index of the Mushaf */
.fx-modal { width: min(740px, calc(100vw - 14px)); }
.fehres { display: grid; gap: 8px; }
.fx-tabs { display: flex; gap: 0; border: 1px solid var(--ink); }
.fx-tabs button { flex: 1; border: 0; background: none; padding: 5px 6px; font: 700 12.5px var(--f-body); cursor: pointer; color: var(--ink) } .fx-tabs button + button { border-inline-start: 1px solid var(--ink); }
.fx-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.fx-search { width: 100%; }
.fx-list { max-height: min(60vh, 560px); overflow-y: auto; display: grid; grid-auto-rows: max-content; gap: 0; border: 1px solid var(--ink); }
.fx-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center; text-align: start; background: var(--panel); border: 0; border-bottom: 1px solid var(--hair); padding: 3px 8px; cursor: pointer; font: inherit; color: var(--ink) }
.fx-row:hover, .fx-row.cur { background: var(--gold-soft); }
.fx-n { width: 30px; height: 30px; display: grid; place-items: center; font: 800 11px var(--f-body); color: #17161D; position: relative; isolation: isolate; }
.fx-n::before { content: ""; position: absolute; inset: 0; background: var(--night-gold); -webkit-mask: var(--m-star) center / contain no-repeat; mask: var(--m-star) center / contain no-repeat; z-index: -1; }
.fx-name { display: grid; line-height: 1.25; } .fx-name small { color: var(--mute); } .fx-meta { font-size: 11px; color: var(--mute); text-align: end; }
.fx-hizb { display: grid; grid-template-columns: 36px 1fr; gap: 4px 8px; align-items: center; padding: 5px; border-bottom: 1px solid var(--hair); }
.fx-quarters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.fx-quarters button { display: grid; border: 1px solid var(--ink); background: var(--panel); padding: 3px 6px; font: 700 12px var(--f-body); cursor: pointer; text-align: start; color: var(--ink) }
.fx-quarters button small { color: var(--mute); font-weight: 400; }
.fx-quarters button:hover { background: var(--gold-soft); }
.fx-picker h3 { margin-top: 6px; } .fx-range { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .fx-range input { width: 90px; }
.fx-ayahs { display: grid; grid-auto-rows: max-content; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 3px; max-height: min(240px, 30vh); overflow-y: auto; margin: 6px 0; }
.fx-ayahs button { border: 1px solid var(--ink); background: var(--panel); padding: 3px 0; cursor: pointer; font: 700 12px var(--f-body); color: var(--ink) }
.fx-ayahs button.on { background: var(--madder); color: var(--on-madder); border-color: var(--madder); }
.fx-pagepick { display: flex; gap: 8px; align-items: end; padding: 8px; }
.fx-picker .modal-actions { position: sticky; bottom: 0; z-index: 1; background: var(--panel); padding: 8px 2px 2px; margin-top: 4px; border-top: 1px solid var(--ink); }
.reader { min-height: 70vh; }
.source-note { margin-top: 8px; }
.mobile-tabs { display: none; }

/* ---------------------------------------------------------------- built-in class video */
.video-off.demo { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 14px; color: var(--on-night); }
.video-off.demo .muted { color: var(--on-night-2); }
.demo-cam { width: 52px; height: 52px; border-radius: 50%; background: var(--night-gold); display: grid; place-items: center; font: 700 24px var(--f-display); color: var(--night); }
.invite { display: grid; gap: 6px; } .invite-text { width: 100%; font: 13px/1.5 var(--f-body); padding: 8px; border: 1px solid var(--ink); background: var(--paper); resize: vertical; }
.video-box.builtin { display: block; background: var(--night); overflow-y: auto; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; padding: 4px; }
.vtile { position: relative; margin: 0; aspect-ratio: 16 / 10; overflow: hidden; background: #26242F; border: 1px solid rgb(226 184 91 / .35); }
.vtile.teacher { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #26242F; }
.vtile.self video { transform: scaleX(-1); }
.vtile figcaption { position: absolute; left: 4px; right: 4px; bottom: 3px; display: flex; gap: 4px; align-items: center; color: #fff; font: 700 11px var(--f-body); text-shadow: 0 1px 3px rgb(0 0 0 / .9); white-space: nowrap; overflow: hidden; }
.vtile .vname { overflow: hidden; text-overflow: ellipsis; }
.vtile.cam-off video { opacity: 0; } .vtile.cam-off::before { content: "🎥 ✕"; position: absolute; inset: 0; display: grid; place-items: center; color: #9C95A8; font-size: 16px; }
.vtile.waiting::after { content: "…"; position: absolute; top: 4px; right: 6px; color: var(--night-gold); font: 800 16px var(--f-body); animation: vpulse 1.2s ease-in-out infinite; }
.vtile.failed::after { content: "⚠"; animation: none; }
@keyframes vpulse { 50% { opacity: .3; } }
.vhint { font-size: 11px; color: var(--mute); align-self: center; }
.vtile.cam-blocked video { opacity: 0; } .vtile.cam-blocked::before { content: "📷🚫"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; color: #9C95A8; }
.cam-hint { white-space: nowrap; } .cam-flag { font-size: .85em; }
.vtile.sharing { grid-column: 1 / -1; aspect-ratio: 16 / 9; order: -1; box-shadow: 0 0 0 2px var(--night-gold); }
.vtile.sharing video { object-fit: contain; background: #000; transform: none !important; }
.vtile.sharing figcaption::after { content: " · 🖥"; }
.room .vgrid .vtile.sharing { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.room[data-stage="video"] .vgrid:has(.vtile.sharing) { align-content: start; }
.video-panel .panel-head { flex-wrap: wrap; gap: 3px; padding: 3px 5px; align-items: flex-start; } .video-panel .panel-head h3 { padding-top: 3px; } .video-panel .vtools { flex: 1 1 auto; } .vtools .vhint { flex-basis: 100%; text-align: end; font-size: 11px; }
.cams-btn.danger, .vtools .btn.danger { background: var(--madder); color: var(--on-madder); border-color: var(--madder); box-shadow: none; }
.warn-btn { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }

/* meeting view: the video fills the class screen until the teacher shows the Holy Quran */
.stage-btn { font-weight: 800; } .stage-btn.primary { box-shadow: 0 0 0 2px var(--night-gold); }
@media (min-width: 761px) {
  .room[data-stage="video"] .mushaf-panel { display: none; }
  .room[data-stage="video"] .room-grid { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
  .room[data-stage="video"] .col-left { grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1fr) 232px; grid-template-rows: minmax(0, 1fr); }
  .room[data-stage="video"] .side-panel { grid-column: 2; grid-row: 1; }
  .room[data-stage="video"] .video-panel { }
  .room[data-stage="video"] .video-box { aspect-ratio: auto; flex: 1; min-height: 320px; }
  .room[data-stage="video"] .people-panel { max-height: none; }
  .room[data-stage="video"] .vgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-content: center; min-height: 100%; }
  .room[data-stage="video"] .vtile.teacher { grid-column: auto; }
}

/* the teacher's Mushaf tools */
.tools-seg .btn.on { background: var(--ink); color: var(--paper); }
.room[data-teacher="true"] .mushaf-scroll .ayah { cursor: pointer; }
.ayah.drag-sel { background: rgb(242 210 122 / .55); }
.ayah.in-mark { background: color-mix(in srgb, var(--green) 9%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--green) 45%, transparent); }
.ayah.mark-start, .ayah.mark-end, .ayah.mark-pending { position: relative; }
.ayah.mark-start::before, .ayah.mark-end::after, .ayah.mark-pending::before { position: relative; top: -0.55em; display: inline-block; margin: 0 2px; padding: 0 6px; font: 700 11px/1.6 var(--f-body); vertical-align: super; color: #fff; white-space: nowrap; }
.ayah.mark-start::before { content: "▶ " var(--mark-start, "Start"); background: var(--green); }
.ayah.mark-end::after { content: "■ " var(--mark-end, "End"); background: var(--madder); color: var(--on-madder); }
.ayah.mark-pending::before { content: "▶ " var(--mark-start, "Start"); background: var(--night-gold); color: var(--night); animation: vpulse 1.2s ease-in-out infinite; }
.pass-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 10px; background: var(--green-soft); border-bottom: 1px solid var(--green); font-size: 12.5px; }
.pass-actions { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-inline-start: auto; }
.pass-actions select { padding: 2px 6px; min-height: 26px; font-size: 12px; }
.recite-bar .guide { display: inline-flex; gap: 5px; margin-inline-start: auto; }

/* invitations, waiting room, guests */
.invite-row { display: flex; gap: 6px; } .invite-link { flex: 1; min-width: 0; font: 13px var(--f-body); padding: 7px 8px; border: 1px solid var(--ink); background: var(--paper); direction: ltr; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.danger-text { color: var(--madder) !important; }
.lobby-bar { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 4px 12px; background: var(--gold-soft); color: var(--gold-ink); border-bottom: 1px solid var(--gold); font-size: 12.5px; }
.lobby-bar ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.lobby-bar li { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--gold); padding: 1px 3px 1px 8px; color: var(--ink); }
.guest-tag { display: inline-block; margin-inline-start: 5px; padding: 0 6px; border: 1px solid var(--blue); background: var(--blue-soft); color: var(--blue); font: 700 10.5px/1.6 var(--f-body); vertical-align: middle; }
.join-card { max-width: 440px; } .join-card h2 { margin: 4px 0 2px; } .join-lesson { font-size: 15px; margin: 0 0 4px; }
.join-badge { display: inline-flex; gap: 5px; align-items: center; background: var(--madder); color: var(--on-madder); font: 700 11.5px var(--f-body); padding: 1px 8px; }
.join-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: vpulse 1.2s ease-in-out infinite; }
.join-form { display: grid; gap: 8px; text-align: start; margin-top: 8px; } .join-intro { margin-top: 8px; }
.join-wait { display: flex; gap: 6px; justify-content: center; margin: 14px 0 4px; }
.join-wait span { width: 10px; height: 10px; border-radius: 50%; background: var(--madder); animation: vpulse 1.2s ease-in-out infinite; }
.join-wait span:nth-child(2) { animation-delay: .2s; } .join-wait span:nth-child(3) { animation-delay: .4s; }

/* recitation by a reciter */
.hus-btn.on { background: var(--green); color: var(--page); border-color: var(--green); }
.hus-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .7rem; padding: .25rem .6rem; margin: .3rem 0; background: var(--green-soft); border: 1px solid var(--green); font-size: 12.5px; }
.hus-bar .hus-hint { opacity: .8; } .hus-bar .hus-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-inline-start: auto; } .hus-bar .hus-cont { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.ayah.playing { background: color-mix(in srgb, var(--green) 24%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 60%, transparent); }
.reciter-pick { display: inline-flex; align-items: stretch; } .reciter-pick .hus-btn { border-inline-end: 0; }
.reciter-select { font: inherit; font-size: 12px; max-width: 220px; padding: 0 6px; min-height: 26px; border: 1px solid var(--ink); background: var(--panel); color: inherit; cursor: pointer; }
.hus-reciter { font-weight: 700; opacity: .85; }

/* ---------------------------------------------------------------- rewards: stickers, badges, crowns (the artwork keeps its colour) */
.rw { --s: 56px; position: relative; display: inline-grid; place-items: center; width: var(--s); height: var(--s); flex: none; }
.rw-sm { --s: 26px; } .rw-md { --s: 56px; } .rw-lg { --s: 80px; } .rw-xl { --s: 120px; }
.rw-emoji { font-size: calc(var(--s) * .5); line-height: 1; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .25)); position: relative; z-index: 1; }
.rw-sticker { border-radius: 50%; background: radial-gradient(circle at 30% 25%, #fff6, transparent 45%), linear-gradient(145deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); box-shadow: 0 0 0 calc(var(--s) * .05) #fff, 0 0 0 calc(var(--s) * .06 + 1px) rgb(23 22 29 / .55); transform: rotate(-6deg); }
.rw-emotion { border-radius: 30%; background: linear-gradient(145deg, color-mix(in srgb, var(--c) 35%, #fff), color-mix(in srgb, var(--c) 75%, #fff)); box-shadow: 0 0 0 calc(var(--s) * .04) #fff, 0 0 0 calc(var(--s) * .05 + 1px) rgb(23 22 29 / .5); transform: rotate(4deg); }
.rw-badge, .rw-excellence, .rw-participation, .rw-improvement, .rw-behavior { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8, transparent 40%), conic-gradient(from 0deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff), var(--c)); box-shadow: inset 0 0 0 calc(var(--s) * .07) color-mix(in srgb, var(--c) 40%, #fff), 0 0 0 1px rgb(23 22 29 / .6); margin-bottom: calc(var(--s) * .14); }
.rw-badge::before, .rw-badge::after, .rw-excellence::before, .rw-excellence::after, .rw-participation::before, .rw-participation::after, .rw-improvement::before, .rw-improvement::after, .rw-behavior::before, .rw-behavior::after {
  content: ""; position: absolute; bottom: calc(var(--s) * -.22); width: calc(var(--s) * .22); height: calc(var(--s) * .38); background: color-mix(in srgb, var(--c) 80%, #000); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); z-index: 0; }
.rw-badge::before, .rw-excellence::before, .rw-participation::before, .rw-improvement::before, .rw-behavior::before { left: 22%; transform: rotate(14deg); }
.rw-badge::after, .rw-excellence::after, .rw-participation::after, .rw-improvement::after, .rw-behavior::after { right: 22%; transform: rotate(-14deg); }
.rw-sm::before, .rw-sm::after { display: none; }
.rw-sm.rw-badge, .rw-sm.rw-excellence, .rw-sm.rw-participation, .rw-sm.rw-improvement, .rw-sm.rw-behavior { margin-bottom: 0; }
.rw-crown svg { width: 100%; height: auto; filter: drop-shadow(0 2px 3px rgb(120 80 0 / .35)); }
.rw-crown::after { content: ""; position: absolute; inset: 8% -6%; border-radius: 50%; background: radial-gradient(circle, rgb(255 215 100 / .4), transparent 65%); z-index: -1; }
.rw-crown.queen::after { background: radial-gradient(circle, rgb(244 114 182 / .32), transparent 65%); }

.rw-dialog { width: min(780px, 96vw); max-height: 92vh; }
.rw-body { display: grid; gap: 10px; }
.rw-body fieldset { border: 1px solid var(--ink); padding: 8px 10px; margin: 0; min-width: 0; }
.rw-body legend { font: 700 12px var(--f-body); padding: 0 5px; text-transform: uppercase; letter-spacing: .08em; }
.rw-whole { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.rw-to-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; } .rw-to-tools { display: flex; gap: 5px; width: 100%; }
.rw-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid var(--ink); cursor: pointer; font-size: 12.5px; background: var(--panel); }
.rw-chip.on { background: var(--gold-soft); border-color: var(--gold); } .rw-chip input { accent-color: var(--madder) }
.rw-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.rw-tab { --c: #64748B; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 10%, var(--panel)); color: var(--ink); padding: 2px 9px; font: 700 12px var(--f-body); cursor: pointer }
.rw-tab.on { background: var(--c); color: #fff; }
.rw-grid { display: grid; grid-auto-rows: max-content; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 280px; overflow: auto; padding: 3px; }
.rw-grid.compact { max-height: 240px; }
.rw-tile { display: grid; justify-items: center; gap: 5px; padding: 8px 4px 6px; border: 1px solid var(--hair); background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); transition: background .12s, border-color .12s }
.rw-tile:hover { background: var(--panel); border-color: var(--ink); }
.rw-tile.on { border: 2px solid var(--madder); background: var(--gold-soft); }
.rw-name { font: 700 11.5px/1.25 var(--f-body); text-align: center; }
.rw-msg-label { display: grid; gap: 4px; font-weight: 700; } .rw-msg { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--ink); resize: vertical; background: var(--paper); }
.rw-prev-wrap { display: grid; gap: 4px; }
.rw-preview { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--gold-soft); border: 1px solid var(--gold); color: var(--ink); }
.rw-preview b { font: 600 16px var(--f-display); display: block; } .rw-preview small { color: var(--mute); } .rw-preview p { margin: 4px 0 0; }
.rw-err { color: var(--madder); font-weight: 700; min-height: 1em; margin: 0; }

/* celebration */
.rw-celebrate { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: rgb(13 12 18 / .6); animation: rwFade .3s ease both; }
.rw-celebrate.out { animation: rwFade .5s ease reverse both; }
.rw-cel-card { position: relative; z-index: 1; width: min(380px, 92vw); text-align: center; display: grid; justify-items: center; gap: 8px; padding: 22px 20px 18px; background: var(--panel); color: var(--ink); border: 2px solid var(--ink); outline: 1px solid var(--night-gold); outline-offset: 5px; box-shadow: 8px 8px 0 var(--night-gold); animation: rwPop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.rw-cel-card h2 { margin: 0; font-size: 24px; border: 0; }
.rw-cel-title { margin: 0; font: 700 12px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--madder); }
.rw-cel-card .rw { animation: rwBounce 1.6s ease-in-out .4s infinite; }
.rw-cel-msg { font-size: 15px; margin: 0; }
.rw-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.rw-confetti i { position: absolute; top: -12px; left: var(--x); width: 8px; height: 12px; background: hsl(var(--h) 85% 55%); animation: rwFall 2.8s linear var(--d) infinite; }
@keyframes rwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rwPop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rwBounce { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes rwFall { to { transform: translateY(105vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .rw-cel-card, .rw-cel-card .rw, .rw-confetti i, .rw-celebrate { animation: none !important; } }

/* student: achievements */
.rw-hero { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--night); color: var(--on-night); border-bottom: 3px double var(--night-gold); position: relative; overflow: hidden; }
.rw-hero::after { content: ""; position: absolute; inset: 0; background: var(--night-gold); opacity: .07; -webkit-mask: var(--m-lattice) 0 0 / 64px 64px; mask: var(--m-lattice) 0 0 / 64px 64px; pointer-events: none; }
.rw-hero > * { position: relative; z-index: 1; } .rw-hero h1 { margin: 0 0 8px; color: var(--on-night); font-size: 22px; }
.rw-hero-actions { display: flex; flex-wrap: wrap; gap: 6px; } .rw-hero .btn { background: transparent; color: var(--on-night); border-color: var(--on-night-2); } .rw-hero .btn:hover { background: var(--night-gold); color: var(--night); }
.rw-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.rw-stat { display: grid; justify-items: center; min-width: 78px; padding: 6px 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--night-gold); }
.rw-stat b { font: 600 22px/1.1 var(--f-display); } .rw-stat span:last-child { font: 700 11px var(--f-body); color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.rw-stat-e { font-size: 1.2rem; }
.rw-latest { display: grid; justify-items: center; align-content: center; gap: 4px; text-align: center; min-width: 200px; max-width: 300px; padding: 8px 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--night-gold); }
.rw-latest p { margin: 0; font-size: 13px; }
.rw-privacy { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; border: 1px solid var(--ink); padding: 6px 12px; margin: 0 0 12px; background: var(--panel); }
.rw-privacy legend { font: 700 12px var(--f-body); padding: 0 5px; } .rw-privacy label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 600; }
.rw-pagetabs { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 10px; border-bottom: 2px solid var(--ink); }
.rw-ptab { border: 0; padding: 7px 16px; font: 700 12.5px var(--f-body); background: transparent; color: var(--mute); cursor: pointer; border-bottom: 4px solid transparent; margin-bottom: -2px; letter-spacing: .06em; text-transform: uppercase; }
:root[lang="ar"] .rw-ptab { letter-spacing: 0; text-transform: none; font-size: 13.5px; }
.rw-ptab.on { color: var(--ink); border-bottom-color: var(--madder); }
.rw-filters { display: grid; gap: 6px; margin-bottom: 10px; } .rw-filter-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.rw-filter { display: inline-flex; align-items: center; gap: 6px; font: 700 12px var(--f-body); color: var(--mute); } .rw-filter select { font: inherit; padding: 2px 8px; min-height: 26px; }
.rw-shelf { margin-bottom: 12px; padding: 10px 12px; background: color-mix(in srgb, var(--c) 7%, var(--panel)); border: 1px solid var(--c); }
.rw-shelf h2, .rw-shelf h3 { margin: 0 0 8px; font-size: 14.5px; color: var(--ink); border: 0; padding: 0; } .rw-shelf h2 small, .rw-shelf h3 small { font-weight: 700; color: var(--mute); font-size: 11.5px; }
.rw-shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.rw-card { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 8px 6px 7px; background: var(--panel); border: 1px solid var(--hair); }
.rw-card b { font: 700 12px/1.25 var(--f-body); }
.rw-card.locked { background: transparent; border: 1px dashed var(--mute); } .rw-card.locked .rw { filter: grayscale(1) opacity(.35); } .rw-card.locked b { color: var(--mute); }
.rw-count { font: 800 11px var(--f-body); color: var(--madder); } .rw-card.locked .rw-count { color: var(--mute); font-weight: 600; }
.rw-month h2, .rw-month h3 { font: 700 11px var(--f-body); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); margin: 12px 0 6px; border: 0; padding: 0; }
.rw-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rw-entry { display: flex; gap: 10px; align-items: center; padding: 7px 10px; background: var(--panel); border: 1px solid var(--hair); border-inline-start: 4px solid var(--c); }
.rw-entry p { margin: 2px 0; }
.rw-cat { display: inline-block; margin-inline-start: 5px; padding: 0 6px; font: 700 10.5px var(--f-body); border: 1px solid var(--c, #64748B); background: color-mix(in srgb, var(--c, #64748B) 14%, var(--panel)); color: var(--ink); }
.rw-tag { margin-inline-start: 5px; padding: 0 6px; font: 700 10.5px var(--f-body); background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue); }
.rw-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 22px 10px; color: var(--mute); }
.rw-note { padding: 8px 12px; background: var(--paper-2); color: var(--mute); border-inline-start: 3px solid var(--hair); }
.rw-wall { margin-bottom: 12px; } .rw-wall h2, .rw-wall h3 { margin: 0 0 6px; font-size: 14.5px; }
.rw-wall-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.rw-wall-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--hair); } .rw-wall-list li.me { outline: 2px solid var(--madder); }
.rw-mini { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; } .rw-wcount { margin-inline-start: auto; font: 800 12.5px var(--f-body); color: var(--madder); }
/* teacher: rewards page */
.rw-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.rw-student { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--ink); background: var(--panel); flex-wrap: wrap; }
.rw-s-info { display: grid; gap: 1px; flex: 1; min-width: 110px; } .rw-s-actions { display: flex; gap: 4px; }
.rw-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.rw-hrow { display: flex; gap: 10px; align-items: flex-start; padding: 6px 10px; border: 1px solid var(--hair); background: var(--panel); }
.rw-hrow.revoked { opacity: .6; } .rw-hrow.revoked .rw { filter: grayscale(1); }
.rw-h-main { flex: 1; min-width: 0; } .rw-h-main p { margin: 2px 0 0; } .rw-h-who { font-size: 12px; color: var(--mute); margin-top: 1px; }
.rw-revoked { color: var(--madder); font-weight: 700; } .rw-h-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.course-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rw-link, .rw-give { background: var(--gold-soft); border-color: var(--gold) !important; color: var(--gold-ink); }
.rw-class-btn { margin-inline-start: auto; background: var(--madder); color: var(--on-madder); border-color: var(--madder); }
.rw-link:hover, .rw-give:hover { color: var(--paper); border-color: var(--ink) !important; }

/* ---------------------------------------------------------------- Tafsir drawer */
.tafsir-drawer { --tf-scale: 1; position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 9000; width: min(440px, 100vw); display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--panel); color: var(--ink); border-inline-start: 2px solid var(--ink); box-shadow: -6px 0 0 var(--night-gold); animation: tfIn .2s ease both; outline: none; }
[dir="rtl"].tafsir-drawer { box-shadow: 6px 0 0 var(--night-gold); }
@keyframes tfIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tf-top { display: flex; align-items: center; gap: 6px; } .tf-top h2 { margin: 0; font-size: 17px; flex: 1; border: 0; padding: 0; }
.tf-size { display: inline-flex; gap: 0; } .tf-size .btn + .btn { margin-inline-start: -1px; }
.tf-ref { display: grid; gap: 3px; padding: 6px 10px; background: var(--page); border: 1px solid var(--page-rule); color: var(--page-ink); }
.tf-where { font: 700 12px var(--f-body); color: var(--gold); }
.tf-ayah { font-family: var(--f-quran); font-size: 1.45rem; line-height: 1.95; margin: 0; color: var(--page-ink); text-align: right; max-height: 9em; overflow: auto; }
.tf-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--ink); }
.tf-tab { font: 700 12.5px/1.25 var(--f-body); padding: 6px 6px; border: 0; cursor: pointer; background: var(--paper-2); color: var(--ink) } .tf-tab + .tf-tab { border-inline-start: 1px solid var(--ink); }
.tf-tab.on { background: var(--ink); color: var(--paper); }
.tf-sub:empty { display: none; }
.tf-lang .btn.on { background: var(--ink); color: var(--paper); }
.tf-body { flex: 1; overflow: auto; padding: 2px; }
.tf-text { font-size: calc(.98rem * var(--tf-scale)); line-height: 1.8; }
.tf-text[lang="ar"] { font-size: calc(1.1rem * var(--tf-scale)); line-height: 2; font-family: var(--f-naskh); }
.tf-text p { margin: 0 0 .7em; }
.tafsir-drawer[data-level="simple"] .tf-body { background: var(--gold-soft); padding: 10px 12px; border: 1px solid var(--gold); }
.tafsir-drawer[data-level="saadi"] .tf-body { background: var(--page); color: var(--page-ink); padding: 10px 12px; border: 1px solid var(--page-rule); }
.tf-num { display: inline-block; margin-inline-end: 5px; font-family: var(--f-quran); color: var(--green); font-weight: 700; }
.tf-q { font-family: var(--f-quran); font-size: 1.14em; color: var(--green); }
.tf-text p.tf-here { background: var(--gold-soft); box-shadow: 0 0 0 5px var(--gold-soft); }
.tf-note { margin: 0 0 8px; padding: 5px 10px; background: var(--blue-soft); color: var(--blue); font-size: 12.5px; border-inline-start: 3px solid var(--blue); }
.tf-note.error { background: var(--madder-soft); color: var(--madder); border-color: var(--madder); }
.tf-source { margin: 10px 0 0; font-size: 11.5px; color: var(--mute); }
.tf-nav { display: flex; justify-content: space-between; gap: 6px; }
.ayah.tf-sel { background: color-mix(in srgb, var(--gold) 26%, transparent); box-shadow: 0 2px 0 var(--gold); }
.tafsir-tip { align-self: center; }
@media (prefers-reduced-motion: reduce) { .tafsir-drawer { animation: none; } }

/* ---------------------------------------------------------------- Qaida recorder (teachers) */
.rq-head h1 { margin: 0 0 4px; } .rq-head p { margin: 0 0 8px; color: var(--mute); max-width: 820px; }
.rq-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.rq-filter { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; } .rq-filter select { font: inherit; padding: 2px 8px; min-height: 26px; }
.rq-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.rq-bar { flex: 1 1 240px; max-width: 520px; height: 10px; background: var(--paper-2); border: 1px solid var(--ink); overflow: hidden; } .rq-bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--green) 0 6px, var(--gold) 6px 8px); }
.rq-done { color: var(--green); font-weight: 800; }
.rq-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px; align-items: start; }
.rq-studio { background: var(--panel); border: 1px solid var(--ink); padding: 12px; box-shadow: var(--shadow); display: grid; gap: 8px; justify-items: center; text-align: center; }
.rq-where { font-weight: 700; color: var(--mute); }
.rq-card { width: 100%; padding: 10px; background: var(--page); color: var(--page-ink); border: 1px solid var(--page-rule); display: grid; gap: 2px; }
.rq-text { font-family: var(--f-naskh); font-size: clamp(52px, 8vw, 84px); line-height: 1.55; white-space: pre; }
.rq-card.quran .rq-text { font-family: var(--f-quran); font-size: clamp(46px, 7vw, 72px); }
.rq-state { margin: 0; font-weight: 700; color: var(--mute); } .rq-state.ok { color: var(--green); } .rq-state.draft { color: var(--gold); }
.rq-meter { width: min(340px, 100%); height: 8px; background: var(--paper-2); border: 1px solid var(--ink); overflow: hidden; } .rq-meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .05s; }
.rq-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.rec-on { animation: rqPulse 1s ease-in-out infinite; } @keyframes rqPulse { 50% { box-shadow: 0 0 0 6px rgb(162 54 35 / .25); } }
.rq-nav { display: flex; gap: 6px; } .rq-keys { margin: 0; }
.rq-side { background: var(--panel); border: 1px solid var(--ink); padding: 8px; max-height: 70vh; overflow: auto; }
.rq-chips { display: flex; flex-wrap: wrap; gap: 4px; direction: rtl; }
.rq-chip { font: 400 19px var(--f-naskh); min-width: 40px; padding: 0 6px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer }
.rq-chip.ok { background: var(--green-soft); border-color: var(--green); } .rq-chip.cur { outline: 2px solid var(--madder); outline-offset: 1px; }

/* inside the school website: the website shows the brand, menu and language switch */
.embedded { --hdr: 32px; }
.embedded .app-header .site-link, .embedded .app-header .bar-end > button[lang] { display: none; }
.embedded .app-header .brand { display: none; }
.embedded .app-header { border-bottom-width: 1px; }
.embedded .app-main { padding-top: 10px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) { .room-grid { grid-template-columns: 232px minmax(0, 1fr) 280px; } }
@media (max-width: 1100px) {      /* tablets: Mushaf + side, video and people stacked in the side column */
  .room { height: auto; min-height: calc(100dvh - var(--hdr)); }
  .room-top { flex-wrap: wrap; padding: 4px 10px; }
  .room-grid { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; }
  .col-left { grid-column: 2; grid-row: 1; grid-template-columns: 1fr; grid-template-rows: auto; }
  .people-panel { max-height: 190px; }
  .mushaf-panel { grid-column: 1; grid-row: 1 / span 2; height: calc(100dvh - 120px); min-height: 480px; }
  .side-panel { grid-column: 2; grid-row: 2; min-height: 320px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .room[data-stage="video"] .col-left { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(380px, 1fr) auto; }
  .room[data-stage="video"] .people-panel { max-height: 190px; }
}
@media (max-width: 760px) {       /* phones: one panel at a time, tab bar at the bottom */
  :root { --hdr: 38px; }
  .bar { gap: 8px; } .top-nav { display: none; } .brand small, .who-name { display: none; }
  .room-top { padding: 4px 8px; gap: 6px; flex-wrap: wrap; } .room-title b { font-size: 14px; } .room-status .pill { font-size: 11px; }
  .room-grid { display: block; padding: 6px 6px 60px; }
  .room .panel, .room .col-left { display: none; }
  .room { height: auto; }
  .room[data-panel="mushaf"] .mushaf-panel { display: flex; height: calc(100dvh - 150px); min-height: 360px; }
  .room[data-panel="video"] .col-left, .room[data-panel="people"] .col-left { display: grid; }
  .room[data-panel="video"] .video-panel { display: flex; } .room[data-panel="people"] .people-panel { display: flex; max-height: none; }
  .room[data-panel="chat"] .side-panel, .room[data-panel="lesson"] .side-panel, .room[data-panel="progress"] .side-panel { display: flex; height: calc(100dvh - 150px); min-height: 360px; }
  .mobile-tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--night); border-top: 2px solid var(--night-gold); padding: 3px 3px calc(3px + env(safe-area-inset-bottom)); gap: 2px; }
  .mobile-tabs button { flex: 1; background: none; border: 0; color: var(--on-night-2); font: 700 11px var(--f-body); padding: 7px 2px; letter-spacing: .06em; text-transform: uppercase }
  :root[lang="ar"] .mobile-tabs button { letter-spacing: 0; text-transform: none; font-size: 12px; }
  .mobile-tabs button[aria-current="true"] { background: var(--night-gold); color: var(--night); }
  .mtools { gap: 4px; padding: 4px 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; } .mtools::-webkit-scrollbar { display: none; } .mtools > * { flex: none; } .mtools .switch span { font-size: 12px; white-space: nowrap; }
  .flow { line-height: 2.05; text-align: right; text-align-last: auto; }
  .mushaf-page { padding: 10px; box-shadow: 0 0 0 2px var(--page), 0 0 0 3px var(--page-rule); }
  .surah-head { grid-template-columns: 1fr; text-align: center; } .sh-meta { display: none; }
  .fx-row { grid-template-columns: 32px 1fr; } .fx-meta { grid-column: 2; text-align: start; }
  .fx-quarters { grid-template-columns: repeat(2, 1fr); }
  .mem-bars li { grid-template-columns: 1fr auto; } .mem-bars .pbar { grid-column: 1 / -1; grid-row: 2; }
  .rq-layout { grid-template-columns: 1fr; }
  .tafsir-drawer { width: 100vw; padding: 10px; } .tf-ayah { font-size: 1.3rem; max-height: 6em; }
  .reciter-select { max-width: 110px; }
  .cc-actions { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .rw-hero { padding: 10px 12px; } .rw-stat { min-width: 64px; padding: 5px 8px; } .rw-stat b { font-size: 18px; }
  .rw-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } .rw-tile .rw { --s: 46px; }
  .rw-shelf-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .rw-entry { align-items: flex-start; } .rw-latest { max-width: none; width: 100%; }
}
@media (max-width: 900px) { .tafsir-tip { display: none; } }
