:root {
  color-scheme: light;
  --page: #f5f7fb;
  --header-bg: rgba(245, 247, 251, .88);
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f8f9fd;
  --input: #ffffff;
  --text: #1b1e2a;
  --muted: #6d7485;
  --faint: #a4aabb;
  --line: #e2e6ef;
  --line-strong: #cfd6e3;
  --primary: #5262d8;
  --primary-strong: #3e4fc3;
  --primary-soft: #eef0ff;
  --purple: #7c3aed;
  --purple-strong: #6d28d9;
  --good: #2dbd70;
  --good-strong: #128a4b;
  --good-line: #43c980;
  --good-soft: #f4fff8;
  --bad: #ec5b66;
  --bad-strong: #c43b48;
  --bad-line: #f07d86;
  --bad-soft: #fff7f8;
  --pending: #6978df;
  --pending-line: #9aa5ed;
  --pending-soft: #f2f4ff;
  --good-glow: rgba(42, 192, 107, .23);
  --bad-glow: rgba(236, 86, 97, .22);
  --shadow: 0 14px 34px rgba(27, 34, 58, .08);
  --shadow-small: 0 4px 12px rgba(27, 34, 58, .07);
  --input-shadow: 0 2px 7px rgba(27, 34, 58, .05), inset 0 1px 0 rgba(255,255,255,.95);
  --focus-ring: rgba(82, 98, 216, .22);
  --scan-good-top: #a8efc5;
  --scan-good-mid: #64d795;
  --scan-good-bottom: #39bd73;
  --scan-bad-top: #ffbec3;
  --scan-bad-mid: #fb8b94;
  --scan-bad-bottom: #e86570;
  --scan-text: #ffffff;
  --tooltip-bg: #202333;
  --tooltip-text: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #080809;
  --header-bg: rgba(8, 8, 9, .9);
  --surface: #111113;
  --surface-raised: #141416;
  --surface-soft: #18181b;
  --input: #101012;
  --text: #f5f5f7;
  --muted: #a7a7b0;
  --faint: #72727c;
  --line: #29292e;
  --line-strong: #39393f;
  --primary: #aab2ff;
  --primary-strong: #c1c7ff;
  --primary-soft: #202137;
  --purple: #b998ff;
  --purple-strong: #cdb5ff;
  --good: #55d78a;
  --good-strong: #91eeb4;
  --good-line: #42b876;
  --good-soft: #121b15;
  --bad: #ff878f;
  --bad-strong: #ffb2b7;
  --bad-line: #cf636c;
  --bad-soft: #201518;
  --pending: #b4bcff;
  --pending-line: #6068ad;
  --pending-soft: #1c1d2b;
  --good-glow: rgba(52, 203, 116, .18);
  --bad-glow: rgba(255, 105, 115, .17);
  --shadow: 0 18px 44px rgba(0, 0, 0, .4);
  --shadow-small: 0 4px 12px rgba(0, 0, 0, .32);
  --input-shadow: 0 3px 9px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.025);
  --focus-ring: rgba(170, 178, 255, .24);
  --scan-good-top: #95eab8;
  --scan-good-mid: #55ca87;
  --scan-good-bottom: #2cae69;
  --scan-bad-top: #ffb0b6;
  --scan-bad-mid: #f77a85;
  --scan-bad-bottom: #df5664;
  --scan-text: #ffffff;
  --tooltip-bg: #f2f2f5;
  --tooltip-text: #17171a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--page); scroll-behavior: smooth; scrollbar-color: var(--line-strong) var(--page); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Tahoma, "Noto Naskh Arabic", "Arial Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.018em; }
h1 { font-size: 1.1rem; line-height: 1.2; }
h2 { font-size: 1.08rem; line-height: 1.2; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { width: min(1580px, calc(100% - 42px)); margin: 0 auto; padding: 14px 0 40px; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  margin-bottom: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { display: block; width: 42px; height: 42px; filter: drop-shadow(0 6px 11px rgba(27, 30, 42, .16)); }
:root[data-theme="dark"] .brand-mark { filter: brightness(1.18) saturate(1.04) drop-shadow(0 5px 10px rgba(0,0,0,.48)); }
.brand-name { direction: rtl; unicode-bidi: plaintext; display: inline-block; font-family: "Noto Kufi Arabic", "Amiri", serif; font-size: clamp(2rem, 2.45vw, 2.42rem); font-weight: 700; line-height: 1.04; letter-spacing: 0; color: #6d28d9; text-shadow: 0 1px 0 rgba(255,255,255,.86), 0 3px 14px rgba(109,40,217,.16); transform: translateY(1px); }
.header-actions { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 7px; }

/* Header controls intentionally use one neutral text colour. The example is the sole accent. */
.meter-control, .button, .theme-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-small);
  transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.meter-control { display: inline-flex; align-items: center; padding: 0 10px; }
.meter-control select { min-width: 142px; padding: 0; border: 0; outline: 0; background: transparent; color: inherit; font-size: .82rem; font-weight: 800; }
.meter-control:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; font-size: .82rem; font-weight: 900; }
.theme-button { display: inline-grid; width: 38px; padding: 0; place-items: center; }
.theme-button .icon { width: 18px; height: 18px; }
.button:hover, .theme-button:hover, .meter-control:hover { transform: translateY(-1px); border-color: var(--primary); }
.button-clear:hover { background: var(--surface-soft); }
.button-example { border-color: var(--purple); background: var(--purple); color: #fff; box-shadow: 0 7px 16px rgba(124, 58, 237, .22); }
.button-example:hover { border-color: var(--purple-strong); background: var(--purple-strong); box-shadow: 0 9px 20px rgba(124, 58, 237, .28); }
:root[data-theme="dark"] .button-example { color: #fff; }

.workspace { direction: ltr; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "analysis poem"; align-items: start; gap: 16px; }
.analysis-pane { grid-area: analysis; direction: rtl; min-width: 0; position: sticky; top: 78px; }
.poem-pane {
  grid-area: poem;
  direction: rtl;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - 116px);
}
.analysis-card, .poem-pane { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.analysis-card { padding: 16px; }
.poem-pane { padding: 17px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 49px; padding: 1px 2px 13px; border-bottom: 1px solid var(--line); }
.section-kicker, .score-label, .meter-label, .pattern-label, .hemistich-label { color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .025em; line-height: 1.2; }
.score-block { display: grid; min-width: 70px; gap: 3px; justify-items: center; }
.score-badge { display: inline-grid; min-width: 66px; min-height: 30px; padding: 3px 8px; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-soft); color: var(--text); font-family: Arial, sans-serif; font-size: .88rem; font-variant-numeric: tabular-nums; line-height: 1; }
.score-badge.good { border-color: var(--good-line); color: var(--good-strong); box-shadow: 0 0 0 1px var(--good-line), 0 0 13px var(--good-glow); }
.score-badge.warn, .score-badge.pending { border-color: var(--pending-line); color: var(--pending); }
.score-badge.bad { border-color: var(--bad-line); color: var(--bad-strong); box-shadow: 0 0 0 1px var(--bad-line), 0 0 13px var(--bad-glow); }

.empty-state { display: grid; min-height: 154px; gap: 8px; margin-top: 13px; padding: 18px; place-content: center; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); font-size: .86rem; text-align: center; }
.empty-state.is-error { border-color: var(--bad-line); color: var(--bad); box-shadow: 0 0 14px var(--bad-glow); }
.empty-symbol { color: var(--primary); font-size: 1.22rem; line-height: 1; }
.empty-state.is-error .empty-symbol { color: var(--bad); }
.live-state { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.live-state::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.live-state.pending { color: var(--pending); }
.analysis-result { display: grid; gap: 10px; margin-top: 13px; }
.meter-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-raised); }
.meter-banner > div { display: grid; gap: 3px; }
.meter-banner strong { color: var(--text); font-size: 1rem; }
.verdict { display: inline-grid; min-height: 24px; padding: 2px 8px; place-items: center; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: .7rem; font-weight: 900; line-height: 1; }
.meter-banner.good { border-color: var(--good-line); box-shadow: 0 0 0 1px var(--good-line), 0 0 14px var(--good-glow); }
.meter-banner.good .verdict { border-color: var(--good-line); color: var(--good-strong); }
.meter-banner.warn { border-color: var(--pending-line); }
.meter-banner.warn .verdict { border-color: var(--pending-line); color: var(--pending); }
.meter-banner.bad { border-color: var(--bad-line); box-shadow: 0 0 0 1px var(--bad-line), 0 0 14px var(--bad-glow); }
.meter-banner.bad .verdict { border-color: var(--bad-line); color: var(--bad-strong); }

.hemistich-analysis { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); }
.hemistich-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.hemistich-copy { min-width: 0; }
.arudi-line { margin-top: 3px; color: var(--text); font-size: .88rem; line-height: 1.55; }
.icon-only-button { position: relative; display: inline-grid; width: 32px; height: 32px; padding: 0; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-small); transition: transform .16s ease, border-color .16s ease, color .16s ease, background .16s ease, box-shadow .16s ease; }
.icon-only-button:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--primary); }
.icon-only-button .icon { width: 16px; height: 16px; }
.icon-only-button[data-tooltip]::after { position: absolute; z-index: 50; right: 50%; bottom: calc(100% + 8px); min-width: max-content; max-width: 180px; padding: 5px 7px; border-radius: 6px; background: var(--tooltip-bg); color: var(--tooltip-text); content: attr(data-tooltip); font-size: .68rem; font-weight: 800; line-height: 1; opacity: 0; pointer-events: none; transform: translateX(50%) translateY(2px); transition: opacity .12s ease, transform .12s ease; white-space: nowrap; }
.icon-only-button[data-tooltip]:hover::after, .icon-only-button[data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(50%) translateY(0); }
.copy-button { flex: 0 0 auto; }
.copy-button.is-copied { border-color: var(--good-line); color: var(--good-strong); box-shadow: 0 0 12px var(--good-glow); }

.pattern-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pattern-label { white-space: nowrap; }
/*
  Alignment is deliberate:
  - the lower tafʿīlah cards are RTL (the first foot is on the right);
  - the upper scansion row is LTR because /٠ must read naturally inside each group;
  - app.js reverses the upper row DOM order, so each glossy group sits over its card.
*/
.pattern-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 6px;
  direction: ltr !important;
  unicode-bidi: isolate;
}
/* Fully coloured, lighter glossy arūḍ groups. */
.pattern-foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  gap: 1px;
  overflow: hidden;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--scan-text);
  direction: ltr;
  unicode-bidi: isolate;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58), inset 0 -1px 0 rgba(0,0,0,.12);
}
.pattern-foot::before { position: absolute; top: 0; right: 7%; left: 7%; height: 45%; border-radius: 0 0 12px 12px; background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,0)); content: ""; pointer-events: none; }
.pattern-foot.ok { border-color: rgba(20, 146, 76, .48); background: linear-gradient(154deg, var(--scan-good-top) 0%, var(--scan-good-mid) 54%, var(--scan-good-bottom) 100%); box-shadow: 0 5px 12px rgba(40, 191, 105, .18), inset 0 1px 0 rgba(255,255,255,.62), inset 0 -1px 0 rgba(8,87,42,.18); }
.pattern-foot.issue { border-color: rgba(209, 67, 78, .46); background: linear-gradient(154deg, var(--scan-bad-top) 0%, var(--scan-bad-mid) 54%, var(--scan-bad-bottom) 100%); box-shadow: 0 5px 12px rgba(239, 86, 96, .18), inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(111,20,28,.17); }
.bit { position: relative; z-index: 1; display: inline-grid; min-width: .6em; place-items: center; color: var(--scan-text); font-family: "Courier New", ui-monospace, monospace; font-size: .84rem; font-weight: 900; line-height: 1; text-shadow: 0 1px 2px rgba(4, 41, 21, .55); }
.pattern-foot.issue .bit { text-shadow: 0 1px 2px rgba(71, 12, 18, .5); }
.bit.ok, .bit.missing, .bit.extra, .bit.issue { color: var(--scan-text); }

.feet-grid {
  display: grid;
  grid-template-columns: repeat(var(--feet-count, 2), minmax(0, 1fr));
  grid-auto-rows: 74px;
  gap: 7px;
  margin-top: 9px;
  direction: rtl;
}
.foot-card { min-width: 0; height: 74px; padding: 7px 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.foot-card.ok { border-color: var(--good-line); box-shadow: 0 0 0 1px var(--good-line), 0 0 11px var(--good-glow); }
.foot-card.issue { border-color: var(--bad-line); box-shadow: 0 0 0 1px var(--bad-line), 0 0 11px var(--bad-glow); }
.foot-card h3 { margin-bottom: 2px; overflow: hidden; color: var(--text); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.foot-card p { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 4px; color: var(--muted); font-size: .6rem; line-height: 1.18; }
.foot-card p + p { margin-top: 2px; }
.foot-card p b { overflow: hidden; color: var(--text); direction: ltr; font-family: "Courier New", monospace; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.foot-card.ok p b { color: var(--good-strong); }
.foot-card.issue p b { color: var(--bad-strong); }
.missing { display: block; margin-top: 3px; overflow: hidden; color: var(--bad-strong); direction: ltr; font-family: "Courier New", monospace; font-size: .6rem; text-overflow: ellipsis; white-space: nowrap; }
.error-message { margin-top: 8px; color: var(--bad); font-size: .76rem; font-weight: 800; }
.error-message:empty { display: none; }

.bayt-count { display: inline-grid; min-width: 54px; min-height: 26px; padding: 2px 8px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: .72rem; font-weight: 900; white-space: nowrap; }
.bayt-list { display: grid; align-content: start; gap: 9px; padding: 13px 1px; }
.bayt-item { overflow: hidden; scroll-margin-top: 82px; border: 1px solid var(--line); border-inline-start: 4px solid var(--line-strong); border-radius: 13px; background: var(--surface-raised); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.bayt-item[data-status="good"] { border-inline-start-color: var(--good); }
.bayt-item[data-status="warn"], .bayt-item[data-status="pending"] { border-inline-start-color: var(--pending); }
.bayt-item[data-status="bad"] { border-inline-start-color: var(--bad); }
.bayt-item.is-active { border-color: var(--primary); border-inline-start-color: var(--primary); box-shadow: 0 8px 22px rgba(82,98,216,.13); }
:root[data-theme="dark"] .bayt-item.is-active { box-shadow: 0 10px 26px rgba(0,0,0,.35); }
.bayt-summary { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; width: 100%; min-height: 67px; gap: 11px; padding: 10px 12px; border: 0; background: transparent; color: var(--text); text-align: right; }
.bayt-summary:hover { background: var(--surface-soft); }
.bayt-number { min-width: 50px; color: var(--muted); font-size: .72rem; font-weight: 900; white-space: nowrap; }
.bayt-preview { display: grid; min-width: 0; gap: 2px; text-align: right; }
.bayt-preview > span { overflow: hidden; color: var(--text); font-size: .9rem; line-height: 1.32; text-overflow: ellipsis; white-space: nowrap; }
.bayt-preview > span + span { color: var(--muted); font-size: .79rem; }
.meter-preview { justify-self: start; width: fit-content; max-width: 100%; padding: 3px 7px; overflow: hidden; border: 1px solid var(--primary); border-radius: 999px; color: var(--primary) !important; font-size: .66rem !important; font-weight: 900; line-height: 1.05 !important; text-overflow: ellipsis; }
.bayt-meta { display: grid; min-width: 50px; gap: 4px; justify-items: end; }
.score-preview { color: var(--text); font-family: Arial, sans-serif; font-size: .76rem; font-variant-numeric: tabular-nums; line-height: 1; }
.status-preview { display: inline-grid; min-height: 19px; padding: 1px 7px; place-items: center; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .63rem; font-weight: 900; line-height: 1; }
.status-preview.good { border-color: var(--good-line); color: var(--good-strong); }
.status-preview.warn, .status-preview.pending { border-color: var(--pending-line); color: var(--pending); }
.status-preview.bad { border-color: var(--bad-line); color: var(--bad-strong); }
.bayt-editor { display: none; padding: 14px 16px 17px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.bayt-item.is-active .bayt-summary { display: none; }
.bayt-item.is-active .bayt-editor { display: block; animation: expand-editor .18s ease-out; }
@keyframes expand-editor { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.editor-toolbar { display: flex; align-items: center; justify-content: flex-start; min-height: 31px; padding: 0 0 8px; }
.remove-bayt { color: var(--muted); }
.remove-bayt:hover { border-color: var(--bad-line); color: var(--bad); }
.verse-field { padding: 8px; border: 1px solid transparent; border-radius: 12px; background: transparent; transition: border-color .16s ease, box-shadow .16s ease; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; padding: 0 4px 6px; }
.field-heading label { color: var(--text); font-size: .84rem; font-weight: 900; }
.field-heading label::after { color: var(--faint); content: "  ✎"; font-family: Arial, sans-serif; font-size: .68rem; font-weight: 400; }
.field-status { display: inline-grid; min-width: 32px; min-height: 19px; padding: 1px 6px; place-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .64rem; font-weight: 900; line-height: 1; }
.verse-field textarea { display: block; width: 100%; min-height: 124px; padding: 13px 14px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--input); color: var(--text); box-shadow: var(--input-shadow); font-family: inherit; font-size: 1rem; line-height: 1.85; text-align: right; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.verse-field textarea::placeholder { color: var(--faint); opacity: .9; }
.verse-field textarea:hover { border-color: var(--primary); }
.verse-field textarea:focus { border-color: var(--primary); background: var(--surface-raised); box-shadow: 0 0 0 3px var(--focus-ring), var(--input-shadow); outline: none; }
.verse-field.is-pending { border-color: var(--pending-line); }
.verse-field.is-pending .field-status { border-color: var(--pending-line); color: var(--pending); }
.verse-field.is-good { border-color: var(--good-line); box-shadow: 0 0 0 1px var(--good-line), 0 0 15px var(--good-glow); }
.verse-field.is-good .field-status, .verse-field.is-good textarea { border-color: var(--good-line); color: var(--good-strong); }
.verse-field.is-good textarea { color: var(--text); }
.verse-field.is-bad { border-color: var(--bad-line); box-shadow: 0 0 0 1px var(--bad-line), 0 0 15px var(--bad-glow); }
.verse-field.is-bad .field-status, .verse-field.is-bad textarea { border-color: var(--bad-line); color: var(--bad-strong); }
.verse-field.is-bad textarea { color: var(--text); }
.field-divider { height: 1px; margin: 7px 8px; background: var(--line); }
/* Compact, text-first add control. */
.add-bayt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  width: fit-content;
  min-width: 142px;
  min-height: 40px;
  margin: 8px auto 0;
  padding: 0 15px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--primary);
  font: inherit;
  font-size: .84rem;
  font-weight: 900;
  line-height: 1;
  transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.add-bayt-button > span:first-child {
  font-family: Arial, sans-serif;
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: 0 4px 12px rgba(82, 98, 216, .10);
  outline: none;
  transform: translateY(-1px);
}
:root[data-theme="dark"] .add-bayt-button:hover,
:root[data-theme="dark"] .add-bayt-button:focus-visible {
  box-shadow: 0 5px 14px rgba(0, 0, 0, .32);
}


@media (max-width: 1060px) {
  .app-shell { width: min(960px, calc(100% - 32px)); }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-areas: "poem" "analysis"; gap: 14px; }
  .analysis-pane { position: static; }
  .feet-grid { grid-template-columns: repeat(var(--feet-count, 2), minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .app-shell { width: calc(100% - 24px); padding-top: 8px; }
  .app-header { align-items: flex-start; min-height: auto; padding: 8px 0 10px; }
  
  .brand-mark { width: 36px; height: 36px; }
  .header-actions { justify-content: flex-start; gap: 6px; }
  .meter-control { min-height: 36px; padding: 0 8px; }
  .meter-control select { min-width: 123px; font-size: .76rem; }
  .button { min-height: 36px; padding: 0 10px; font-size: .77rem; }
  .theme-button { width: 36px; min-height: 36px; }
  .analysis-card, .poem-pane { border-radius: 14px; padding: 13px; }
  .poem-pane { min-height: auto; }
  .panel-heading { min-height: 45px; padding-bottom: 11px; }
  .analysis-result { gap: 8px; margin-top: 11px; }
  .hemistich-analysis { padding: 9px; }
  .arudi-line { font-size: .83rem; }
  .pattern-wrap { grid-template-columns: 1fr; gap: 5px; }
  .pattern-line { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; }
  .pattern-foot { min-height: 30px; }
  .feet-grid { grid-template-columns: repeat(2, minmax(0,1fr)); grid-auto-rows: 72px; gap: 6px; }
  .foot-card { height: 72px; padding: 6px 7px; }
  .bayt-editor { padding: 12px; }
  .verse-field textarea { min-height: 112px; font-size: .96rem; }
}
@media (max-width: 420px) {
  .header-actions { width: calc(100% - 44px); }
  .meter-control { flex: 1 1 130px; }
  .meter-control select { width: 100%; min-width: 0; }
  .button { flex: 0 0 auto; }
  .bayt-summary { grid-template-columns: auto minmax(0,1fr); }
  .bayt-meta { grid-column: 2; grid-row: 2; grid-auto-flow: column; justify-items: start; justify-content: start; }
  .feet-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }


/* --- Readability and poem-copy update --- */
:root {
  --scan-good-top: #d8f7e2;
  --scan-good-mid: #9ee9bb;
  --scan-good-bottom: #69d996;
  --scan-bad-top: #ffd9dc;
  --scan-bad-mid: #ffb0b7;
  --scan-bad-bottom: #f58b95;
  --scan-text: #132018;
}
:root[data-theme="dark"] {
  --scan-good-top: #c5f0d2;
  --scan-good-mid: #86dcaa;
  --scan-good-bottom: #57c786;
  --scan-bad-top: #ffd0d4;
  --scan-bad-mid: #fca4ac;
  --scan-bad-bottom: #e87c87;
  --scan-text: #111914;
}

body { font-size: 17.6px; }
.app-shell { padding-bottom: 46px; }
.panel-heading { min-height: 54px; padding: 4px 5px 15px; }
.section-kicker,
.score-label,
.meter-label,
.pattern-label,
.hemistich-label {
  display: inline-block;
  padding: 3px 4px 5px;
  font-size: .7rem;
}
.score-block { gap: 4px; }
.score-badge { min-width: 72px; min-height: 33px; font-size: .94rem; }
.analysis-card { padding: 15px; }
.poem-pane { padding: 17px; }
.hemistich-analysis { padding: 11px; }
.hemistich-topline { gap: 10px; }
.arudi-line { margin-top: 5px; font-size: .96rem; line-height: 1.62; }
.icon-only-button { width: 36px; height: 36px; border-radius: 10px; }
.icon-only-button .icon { width: 18px; height: 18px; }

.pattern-wrap { gap: 10px; margin-top: 10px; padding-top: 10px; }
.pattern-foot { min-height: 38px; padding: 5px 7px; border-radius: 10px; }
.pattern-foot .bit,
.pattern-foot.issue .bit,
.bit.ok,
.bit.missing,
.bit.extra,
.bit.issue {
  color: var(--scan-text);
  font-size: .96rem;
  text-shadow: 0 1px 0 rgba(255,255,255,.56), 0 -1px 0 rgba(0,0,0,.08);
}

.feet-grid { grid-auto-rows: 88px; gap: 8px; margin-top: 10px; }
.foot-card { height: 88px; padding: 9px 10px; border-radius: 11px; }
.foot-card h3 { margin-bottom: 4px; font-size: .82rem; }
.foot-card p { gap: 6px; font-size: .71rem; line-height: 1.24; }
.foot-card p + p { margin-top: 3px; }
.foot-card p b { font-size: .81rem; }
.missing { margin-top: 4px; font-size: .68rem; }

.field-heading { min-height: 27px; padding: 4px 8px 9px; }
.field-heading label { font-size: .9rem; }
.field-status { min-height: 22px; padding: 2px 7px; font-size: .69rem; }
.verse-field { padding: 10px; }
.verse-field textarea { min-height: 128px; padding: 15px 16px; font-size: 1.08rem; line-height: 1.88; }
.bayt-summary { min-height: 72px; padding: 12px 14px; }
.bayt-number { font-size: .78rem; }
.bayt-preview > span { font-size: .96rem; }
.bayt-preview > span + span { font-size: .85rem; }
.status-preview { min-height: 21px; font-size: .68rem; }
.score-preview { font-size: .82rem; }
.meter-preview { padding: 4px 8px; font-size: .71rem !important; }
.add-bayt-button { flex-basis: 76px; min-height: 76px; padding: 12px; font-size: .86rem; }
  .add-bayt-button::before { top: 10px; right: 18%; left: 18%; }
  .add-bayt-button::after { margin-top: 14px; font-size: .64rem; }

.poem-dialog {
  width: min(680px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0,0,0,.34);
}
.poem-dialog::backdrop { background: rgba(7, 8, 12, .42); backdrop-filter: blur(3px); }
.poem-dialog-card { padding: 18px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 2px 2px 13px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 1.14rem; }
.dialog-close { flex: 0 0 auto; }
.poem-output {
  display: block;
  width: 100%;
  min-height: 235px;
  margin-top: 14px;
  padding: 15px 16px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--input);
  color: var(--text);
  box-shadow: var(--input-shadow);
  font-family: inherit;
  font-size: 1.03rem;
  line-height: 2;
  text-align: right;
}
.poem-output:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring), var(--input-shadow); outline: none; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; }
.dialog-count { color: var(--muted); font-size: .79rem; font-weight: 900; }
.dialog-copy { min-height: 38px; }
.dialog-copy:disabled { cursor: not-allowed; opacity: .48; transform: none; }

@media (max-width: 1060px) {
  .analysis-card { padding: 15px; }
}
@media (max-width: 700px) {
  body { font-size: 16.5px; }
  .app-shell { width: calc(100% - 22px); padding-top: 7px; }
  .app-header { gap: 10px; }
  .header-actions { gap: 5px; }
  .meter-control { min-height: 38px; }
  .meter-control select { min-width: 120px; font-size: .8rem; }
  .button { min-height: 38px; padding: 0 11px; font-size: .8rem; }
  .theme-button { width: 38px; min-height: 38px; }
  .analysis-card, .poem-pane { padding: 14px; }
  .panel-heading { min-height: 51px; padding-bottom: 13px; }
  .arudi-line { font-size: .91rem; }
  .pattern-foot { min-height: 36px; }
  .pattern-foot .bit { font-size: .91rem; }
  .feet-grid { grid-auto-rows: 84px; gap: 7px; }
  .foot-card { height: 84px; padding: 8px; }
  .foot-card h3 { font-size: .77rem; }
  .foot-card p { font-size: .67rem; }
  .foot-card p b { font-size: .76rem; }
  .bayt-editor { padding: 13px; }
  .verse-field textarea { min-height: 116px; font-size: 1rem; }
  .poem-dialog-card { padding: 15px; }
  .poem-output { min-height: 205px; font-size: .98rem; }
}
@media (max-width: 420px) {
  .header-actions { width: calc(100% - 44px); }
  .button { padding: 0 9px; }
  .poem-dialog { width: calc(100% - 20px); }
  .dialog-actions { align-items: stretch; flex-direction: column; }
  .dialog-copy { width: 100%; }
}


/* --- Import, tooltip layering and readable tafʿīlah update --- */
/* Tooltips intentionally escape bayt cards and sit above neighbouring panels. */
.bayt-list { isolation: isolate; }
.bayt-item { position: relative; overflow: visible; z-index: 0; }
.bayt-item:has(.icon-only-button:hover),
.bayt-item:has(.icon-only-button:focus-visible) { z-index: 30; }
.analysis-card, .poem-pane, .hemistich-analysis { overflow: visible; }
.icon-only-button { z-index: 2; }
.icon-only-button:hover, .icon-only-button:focus-visible { z-index: 100; }
.icon-only-button[data-tooltip]::after { z-index: 9999; box-shadow: 0 7px 18px rgba(0,0,0,.18); }

/* Keep the Arabic line whole; scansion belongs below it rather than splitting its words. */
.arudi-line { word-break: normal; overflow-wrap: normal; }
.feet-grid { grid-auto-rows: 96px; }
.foot-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  height: 96px;
  padding: 9px 10px;
  text-align: center;
}
.foot-card .tafila-name {
  min-height: 26px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot-card .tafila-scansion {
  direction: ltr;
  margin: 1px 0 0;
  color: var(--text);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: .98rem;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1.35;
}
.foot-card.ok .tafila-scansion { color: var(--good-strong); }
.foot-card.issue .tafila-scansion { color: var(--bad-strong); }
.foot-card .tafila-reference {
  align-self: end;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  direction: rtl;
  font-size: .69rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot-card.issue .tafila-reference { color: var(--bad-strong); }
.foot-card .missing { display: none; }

.dialog-hint {
  margin: 13px 2px 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.65;
}
.dialog-hint b { color: var(--text); font-family: Arial, sans-serif; }
.import-input { min-height: 250px; }
.button-import { background: var(--surface); }

@media (max-width: 700px) {
  .feet-grid { grid-auto-rows: 92px; }
  .foot-card { height: 92px; padding: 8px; }
  .foot-card .tafila-name { font-size: .91rem; }
  .foot-card .tafila-scansion { font-size: .91rem; }
  .foot-card .tafila-reference { font-size: .64rem; }
  .import-input { min-height: 220px; }
}


/* --- v12: reliable overlays and named tafʿīlah rendering --- */
body.modal-open { overflow: hidden; }
.modal-overlay[hidden] { display: none !important; }
.modal-overlay {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: auto;
  padding: 20px;
  background: rgba(5, 7, 12, .48);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .16s ease;
}
.modal-overlay.is-open { opacity: 1; }
.modal-overlay .poem-dialog-card {
  width: min(680px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .34);
}
.dialog-status {
  margin: 10px 2px 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.55;
}
.dialog-status.error {
  border-color: var(--bad-line);
  color: var(--bad-strong);
  box-shadow: 0 0 0 1px var(--bad-line), 0 0 12px var(--bad-glow);
}
/* Every scansion block and card uses a real tafʿīlah name; no foot numbering. */
.pattern-foot[aria-label] { cursor: default; }
@media (max-width: 700px) {
  .modal-overlay { padding: 12px; }
  .modal-overlay .poem-dialog-card { max-height: calc(100vh - 24px); padding: 15px; border-radius: 15px; }
}


/* --- Stable physical alignment for upper scansion and lower tafʿīlah cards. --- */
.pattern-line { direction: ltr !important; unicode-bidi: isolate; }
.pattern-foot { direction: ltr; unicode-bidi: isolate; }
.feet-grid { direction: rtl; }

/* --- Thin full-width add row (final override) --- */
.add-bayt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .34rem;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  margin: 4px 0 0;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
}
.add-bayt-button > span:first-child {
  font-size: .98rem;
  font-weight: 500;
  line-height: 1;
}
.add-bayt-button::before,
.add-bayt-button::after {
  content: none !important;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: none;
  outline: none;
}
@media (max-width: 700px) {
  .add-bayt-button {
    flex-basis: auto;
    min-height: 32px;
    height: 32px;
    margin-top: 4px;
    padding: 0 10px;
    font-size: .76rem;
  }
}

/* --- Dynamic poem pane + ultra-thin full-width add row. --- */
.poem-pane {
  min-height: 0;
  height: auto;
  align-self: start;
}

.add-bayt-button {
  min-height: 18px;
  height: 18px;
  margin-top: 4px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: .68rem;
  line-height: 1;
}

.add-bayt-button > span:first-child {
  font-size: .86rem;
  line-height: .7;
}

@media (max-width: 700px) {
  .poem-pane { min-height: 0; }
  .add-bayt-button {
    min-height: 18px;
    height: 18px;
    margin-top: 4px;
    padding: 0 9px;
    font-size: .67rem;
  }
}


/* --- Compact centred icon-only add row. --- */
.add-bayt-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 22px;
  height: 22px;
  margin: 5px 0 0;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}
.add-bayt-button > span { display: none; }
.add-bayt-button .add-bayt-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: none;
  outline: none;
}
@media (max-width: 700px) {
  .add-bayt-button {
    min-height: 21px;
    height: 21px;
    margin-top: 5px;
  }
}


/* --- Final compact add control + newly-added bayt marker. --- */
.add-bayt-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 16px !important;
  height: 16px !important;
  margin: 5px 0 0;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  line-height: 0;
}
.add-bayt-button .add-bayt-icon {
  width: 13px !important;
  height: 13px !important;
  stroke-width: 2.7;
  stroke-linecap: round;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: none;
}
@media (max-width: 700px) {
  .add-bayt-button {
    min-height: 16px !important;
    height: 16px !important;
    margin-top: 5px;
  }
}

/* A slim purple rail marks a blank bayt that was added during this session. */
.bayt-item {
  position: relative;
}
.bayt-item.is-new:not(.is-active) {
  border-inline-start-color: rgba(124, 58, 237, .42);
}
.bayt-item.is-new:not(.is-active)::before {
  position: absolute;
  z-index: 2;
  inset-block: 9px;
  inset-inline-start: 6px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #A78BFA 0%, #7C3AED 100%);
  box-shadow: 0 0 8px rgba(124, 58, 237, .34);
  content: "";
  pointer-events: none;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active)::before {
  background: linear-gradient(180deg, #C4B5FD 0%, #8B5CF6 100%);
  box-shadow: 0 0 9px rgba(167, 139, 250, .24);
}


/* --- Build 24: add-bayt control, new-row marker, and logo contrast. --- */
/* Keep the poem pane only as tall as its contents; never stretch it to viewport height. */
.poem-pane {
  min-height: 0 !important;
  height: auto !important;
  align-self: start !important;
}

/* Thin full-width add row: visually present, but never oversized. */
.add-bayt-button {
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 24px !important;
  height: 24px !important;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  border: 1px dashed var(--line-strong) !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--primary) !important;
  line-height: 1 !important;
  box-shadow: none !important;
}
.add-bayt-button .add-bayt-icon {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.35 !important;
  stroke-linecap: round !important;
  vector-effect: non-scaling-stroke;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none !important;
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
  color: var(--primary-strong) !important;
  box-shadow: none !important;
  outline: none !important;
}
@media (max-width: 700px) {
  .add-bayt-button {
    min-height: 24px !important;
    height: 24px !important;
    margin-top: 6px !important;
  }
  .add-bayt-button .add-bayt-icon {
    width: 18px !important;
    height: 18px !important;
  }
}

/* A new manually-added bayt keeps this marker when it is later collapsed. */
.bayt-item.is-new:not(.is-active) {
  border-inline-start: 1px solid var(--line) !important;
  box-shadow: inset -7px 0 0 rgba(124, 58, 237, .18) !important;
}
.bayt-item.is-new:not(.is-active)::before {
  position: absolute !important;
  z-index: 4 !important;
  inset-block: 0 !important;
  inset-inline-start: 0 !important;
  width: 7px !important;
  border-radius: 12px 0 0 12px !important;
  background: linear-gradient(180deg, #B99AFF 0%, #7C3AED 100%) !important;
  box-shadow: 0 0 10px rgba(124, 58, 237, .28) !important;
  content: "" !important;
  pointer-events: none !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) {
  box-shadow: inset -7px 0 0 rgba(185, 154, 255, .16) !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active)::before {
  background: linear-gradient(180deg, #D7C4FF 0%, #9A6BFF 100%) !important;
  box-shadow: 0 0 10px rgba(185, 154, 255, .24) !important;
}

/* Preserve a crisp dark outer edge around the purple mark at every rendered size. */
.brand-mark {
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.78)) drop-shadow(0 4px 8px rgba(0,0,0,.18)) !important;
}
:root[data-theme="dark"] .brand-mark {
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.95)) drop-shadow(0 4px 9px rgba(0,0,0,.45)) !important;
}


/* --- Build 25: genuinely thin add row, multi-bar new-bayt marker, heavy logo outline. --- */
/* Keep the poem panel content-sized even though it is a flex column. */
.poem-pane {
  min-height: 0 !important;
  height: auto !important;
  align-self: start !important;
}

/* A wide, deliberately thin add row. `flex-basis` is overridden because it was
   the reason the earlier 24px row still displayed at roughly three times that height. */
.add-bayt-button {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 20px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 20px !important;
  height: 20px !important;
  margin: 5px 0 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  border: 1px dashed var(--line-strong) !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--primary) !important;
  line-height: 0 !important;
  box-shadow: none !important;
}
.add-bayt-button .add-bayt-icon {
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.7 !important;
  stroke-linecap: round !important;
  vector-effect: non-scaling-stroke;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none !important;
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
  color: var(--primary-strong) !important;
  box-shadow: none !important;
  outline: none !important;
}
@media (max-width: 700px) {
  .add-bayt-button {
    flex-basis: 20px !important;
    min-height: 20px !important;
    height: 20px !important;
  }
}

/* Newly added, collapsed bayts get a full-height band of multiple purple bars.
   It is intentionally a background marker rather than a status colour. */
.bayt-item.is-new:not(.is-active) {
  border-inline-start: 1px solid var(--line) !important;
  box-shadow: none !important;
}
.bayt-item.is-new:not(.is-active)::before {
  position: absolute !important;
  z-index: 4 !important;
  inset-block: 0 !important;
  inset-inline-start: 0 !important;
  width: 20px !important;
  border-start-start-radius: 12px !important;
  border-end-start-radius: 12px !important;
  background: repeating-linear-gradient(
    90deg,
    rgba(124, 58, 237, .62) 0 2px,
    rgba(167, 139, 250, .27) 2px 4px,
    transparent 4px 6px
  ) !important;
  box-shadow: inset -1px 0 0 rgba(124, 58, 237, .24) !important;
  content: "" !important;
  pointer-events: none !important;
}
.bayt-item.is-new:not(.is-active) .bayt-summary {
  padding-inline-start: 30px !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active)::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(196, 181, 253, .68) 0 2px,
    rgba(167, 139, 250, .30) 2px 4px,
    transparent 4px 6px
  ) !important;
  box-shadow: inset -1px 0 0 rgba(196, 181, 253, .26) !important;
}

/* Extra-thick near-black edge makes the logo legible at favicon and header sizes. */
.brand-mark {
  filter: drop-shadow(0 0 0 #07070A) drop-shadow(0 2px 2px rgba(0,0,0,.33)) !important;
}
:root[data-theme="dark"] .brand-mark {
  filter: drop-shadow(0 0 0 #000) drop-shadow(0 2px 3px rgba(0,0,0,.62)) !important;
}

/* --- Build 26: balanced add strip and full-row new-bayt stripes. --- */
/* The control is intentionally wide and only one compact row high. */
.add-bayt-button {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 40px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 40px !important;
  height: 40px !important;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  border: 1px dashed var(--line-strong) !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--primary) !important;
  line-height: 0 !important;
  box-shadow: none !important;
}
.add-bayt-button .add-bayt-icon {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.45 !important;
  stroke-linecap: round !important;
  vector-effect: non-scaling-stroke;
}
.add-bayt-button:hover,
.add-bayt-button:focus-visible {
  transform: none !important;
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
  color: var(--primary-strong) !important;
  box-shadow: none !important;
  outline: none !important;
}
@media (max-width: 700px) {
  .add-bayt-button {
    flex-basis: 38px !important;
    min-height: 38px !important;
    height: 38px !important;
  }
  .add-bayt-button .add-bayt-icon {
    width: 21px !important;
    height: 21px !important;
  }
}

/* A new collapsed bayt is marked by soft diagonal purple hatching across
   the full summary surface—not by a rail at the start. */
.bayt-item.is-new:not(.is-active) {
  border-inline-start: 0 !important;
  box-shadow: none !important;
}
.bayt-item.is-new:not(.is-active)::before {
  display: none !important;
  content: none !important;
}
.bayt-item.is-new:not(.is-active) .bayt-summary {
  padding-inline-start: 12px !important;
  background-color: var(--surface) !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(124, 58, 237, .13) 0 2px,
    transparent 2px 9px
  ) !important;
}
.bayt-item.is-new:not(.is-active) .bayt-summary:hover,
.bayt-item.is-new:not(.is-active) .bayt-summary:focus-visible {
  background-color: var(--surface-soft) !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(124, 58, 237, .20) 0 2px,
    transparent 2px 9px
  ) !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary {
  background-color: var(--surface) !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(196, 181, 253, .16) 0 2px,
    transparent 2px 9px
  ) !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary:hover,
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary:focus-visible {
  background-color: var(--surface-soft) !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(196, 181, 253, .23) 0 2px,
    transparent 2px 9px
  ) !important;
}



/* Header title: one connected purple Arabic word. */
.brand {
  gap: 0;
}
.brand-mark {
  display: none !important;
}
.brand-name {
  direction: rtl;
  unicode-bidi: plaintext;
  display: inline-block;
  color: #6d28d9 !important;
  font-family: "Noto Kufi Arabic", "Amiri", serif;
  font-size: clamp(2rem, 2.45vw, 2.42rem) !important;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255,255,255,.86), 0 3px 14px rgba(109,40,217,.16) !important;
  transform: translateY(1px);
}
:root[data-theme="dark"] .brand-name {
  color: #e9ddff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.96), 0 3px 18px rgba(233,221,255,.24) !important;
}
@media (max-width: 720px) {
  .brand-name { font-size: clamp(1.56rem, 6.6vw, 2rem) !important; }
}
@media (max-width: 420px) {
  .brand-name { font-size: 1.42rem !important; }
}

/* Avoid a visible fallback-to-Arabic-font jump. */
html.fonts-loading * {
  transition: none !important;
  animation: none !important;
}
html.fonts-ready .brand-name {
  font-synthesis: none;
}


/* v31: Brand colour and example-button contrast. */
.brand,
.brand:visited,
.brand:hover,
.brand:focus-visible,
.brand-name {
  color: #7c3aed !important;
}
:root[data-theme="dark"] .brand,
:root[data-theme="dark"] .brand:visited,
:root[data-theme="dark"] .brand:hover,
:root[data-theme="dark"] .brand:focus-visible,
:root[data-theme="dark"] .brand-name {
  color: #e9ddff !important;
}
:root[data-theme="dark"] .button-example,
:root[data-theme="dark"] .button-example:hover,
:root[data-theme="dark"] .button-example:focus-visible {
  color: #111114 !important;
}


/* Legacy title-colour override. */
.brand-name, .brand-name * {
  color: #7c3aed !important;
  background: none !important;
  -webkit-text-fill-color: #7c3aed !important;
  font-family: "Noto Kufi Arabic", "Amiri", serif !important;
  font-palette: normal;
}
:root[data-theme="dark"] .brand-name,
:root[data-theme="dark"] .brand-name * {
  color: #e9ddff !important;
  -webkit-text-fill-color: #e9ddff !important;
}


/* v33: Use a monochrome Arabic display font only. This prevents embedded multi-colour glyph palettes. */
.brand-name, .brand-name *, .brand:visited .brand-name {
  font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif !important;
  font-weight: 900 !important;
  font-style: normal !important;
  font-variant-emoji: text;
  font-palette: normal;
  color: #7c3aed !important;
  -webkit-text-fill-color: #7c3aed !important;
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  text-shadow: 0 1px 0 rgba(255,255,255,.84), 0 3px 14px rgba(124,58,237,.16) !important;
}
:root[data-theme="dark"] .brand-name,
:root[data-theme="dark"] .brand-name *,
:root[data-theme="dark"] .brand:visited .brand-name {
  color: #ede9fe !important;
  -webkit-text-fill-color: #ede9fe !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.92), 0 0 16px rgba(221,214,254,.16) !important;
}


/* Final brand title: original Aref Ruqaa (monochrome), never Aref Ruqaa Ink. */
.brand-name,
.brand-name *,
.brand:visited .brand-name {
  direction: rtl;
  unicode-bidi: plaintext;
  display: inline-block;
  font-family: "Aref Ruqaa", "Amiri", serif !important;
  font-size: clamp(2.2rem, 3vw, 2.88rem) !important;
  font-weight: 700 !important;
  font-style: normal !important;
  line-height: 1.04;
  letter-spacing: 0;
  color: #7c3aed !important;
  -webkit-text-fill-color: #7c3aed !important;
  text-shadow: 0 1px 0 rgba(255,255,255,.8), 0 4px 16px rgba(124,58,237,.15);
  font-palette: normal;
}
:root[data-theme="dark"] .brand-name,
:root[data-theme="dark"] .brand-name *,
:root[data-theme="dark"] .brand:visited .brand-name {
  color: #e9ddff !important;
  -webkit-text-fill-color: #e9ddff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.85), 0 0 18px rgba(185,152,255,.16);
}
@media (max-width: 560px) {
  .brand-name, .brand-name *, .brand:visited .brand-name { font-size: clamp(1.75rem, 8vw, 2.2rem) !important; }
}


/* --- v35: refined dark palette, readable summaries, and modal actions. --- */
/* Keep the title and مثال in one restrained purple family in dark mode. */
:root[data-theme="dark"] .brand-name,
:root[data-theme="dark"] .brand-name *,
:root[data-theme="dark"] .brand:visited .brand-name {
  color: #b69ae3 !important;
  -webkit-text-fill-color: #b69ae3 !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.86), 0 0 14px rgba(182,154,227,.13) !important;
}
:root[data-theme="dark"] .button-example,
:root[data-theme="dark"] .button-example:hover,
:root[data-theme="dark"] .button-example:focus-visible {
  border-color: #b69ae3 !important;
  background: #b69ae3 !important;
  color: #17111f !important;
  box-shadow: 0 7px 16px rgba(182,154,227,.16) !important;
}

/* Filled match states: legible at a glance without relying on outlines alone. */
.score-badge.good {
  border-color: #5bcf8a !important;
  background: #d8f8e5 !important;
  color: #125b35 !important;
  box-shadow: 0 3px 10px rgba(45,189,112,.13) !important;
}
.score-badge.warn,
.score-badge.pending {
  border-color: #a9b3f0 !important;
  background: #edf0ff !important;
  color: #424fbd !important;
  box-shadow: 0 3px 10px rgba(105,120,223,.10) !important;
}
.score-badge.bad {
  border-color: #f18a92 !important;
  background: #ffe0e3 !important;
  color: #8f2732 !important;
  box-shadow: 0 3px 10px rgba(236,91,102,.13) !important;
}
.meter-banner.good {
  border-color: #5bcf8a !important;
  background: #d8f8e5 !important;
  box-shadow: none !important;
}
.meter-banner.good strong,
.meter-banner.good .meter-label,
.meter-banner.good .verdict { color: #125b35 !important; }
.meter-banner.good .verdict { border-color: rgba(18,91,53,.32) !important; background: rgba(255,255,255,.45) !important; }
.meter-banner.warn {
  border-color: #a9b3f0 !important;
  background: #edf0ff !important;
  box-shadow: none !important;
}
.meter-banner.warn strong,
.meter-banner.warn .meter-label,
.meter-banner.warn .verdict { color: #424fbd !important; }
.meter-banner.warn .verdict { border-color: rgba(66,79,189,.28) !important; background: rgba(255,255,255,.44) !important; }
.meter-banner.bad {
  border-color: #f18a92 !important;
  background: #ffe0e3 !important;
  box-shadow: none !important;
}
.meter-banner.bad strong,
.meter-banner.bad .meter-label,
.meter-banner.bad .verdict { color: #8f2732 !important; }
.meter-banner.bad .verdict { border-color: rgba(143,39,50,.28) !important; background: rgba(255,255,255,.44) !important; }
:root[data-theme="dark"] .score-badge.good,
:root[data-theme="dark"] .meter-banner.good { border-color: #54c781 !important; background: #235f3d !important; color: #edfff4 !important; }
:root[data-theme="dark"] .score-badge.good,
:root[data-theme="dark"] .meter-banner.good strong,
:root[data-theme="dark"] .meter-banner.good .meter-label,
:root[data-theme="dark"] .meter-banner.good .verdict { color: #edfff4 !important; }
:root[data-theme="dark"] .meter-banner.good .verdict { border-color: rgba(237,255,244,.34) !important; background: rgba(0,0,0,.14) !important; }
:root[data-theme="dark"] .score-badge.warn,
:root[data-theme="dark"] .meter-banner.warn { border-color: #7f89d8 !important; background: #333864 !important; color: #f3f4ff !important; }
:root[data-theme="dark"] .score-badge.warn,
:root[data-theme="dark"] .score-badge.pending,
:root[data-theme="dark"] .meter-banner.warn strong,
:root[data-theme="dark"] .meter-banner.warn .meter-label,
:root[data-theme="dark"] .meter-banner.warn .verdict { color: #f3f4ff !important; }
:root[data-theme="dark"] .meter-banner.warn .verdict { border-color: rgba(243,244,255,.32) !important; background: rgba(0,0,0,.14) !important; }
:root[data-theme="dark"] .score-badge.bad,
:root[data-theme="dark"] .meter-banner.bad { border-color: #e87880 !important; background: #7a3038 !important; color: #fff0f1 !important; }
:root[data-theme="dark"] .score-badge.bad,
:root[data-theme="dark"] .meter-banner.bad strong,
:root[data-theme="dark"] .meter-banner.bad .meter-label,
:root[data-theme="dark"] .meter-banner.bad .verdict { color: #fff0f1 !important; }
:root[data-theme="dark"] .meter-banner.bad .verdict { border-color: rgba(255,240,241,.30) !important; background: rgba(0,0,0,.14) !important; }

/* Larger collapsed poem previews: readable without opening the bayt. */
.bayt-summary { min-height: 106px !important; padding-block: 15px !important; }
.bayt-preview { gap: 5px !important; }
.bayt-preview > span { font-size: clamp(1.32rem, 1.65vw, 1.58rem) !important; line-height: 1.36 !important; font-weight: 700; }
.bayt-preview > span + span { font-size: clamp(1.12rem, 1.4vw, 1.34rem) !important; line-height: 1.34 !important; }
.bayt-number { align-self: start; padding-top: 7px; }
.bayt-meta { align-self: center; }
.meter-preview { margin-top: 2px; font-size: .74rem !important; }
@media (max-width: 700px) {
  .bayt-summary { min-height: 90px !important; padding-block: 12px !important; }
  .bayt-preview > span { font-size: 1.16rem !important; }
  .bayt-preview > span + span { font-size: 1.02rem !important; }
}

/* Dialog action buttons get clear inline icons. */
.dialog-action-button { display: inline-flex !important; align-items: center; justify-content: center; gap: 8px; }
.dialog-action-icon { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Tooltips in overlays stay above the dialog card and are never clipped. */
.modal-overlay { overflow: auto visible !important; }
.modal-overlay .poem-dialog-card { position: relative; overflow: visible !important; }
.dialog-action-button,
.modal-overlay .icon-only-button { position: relative; z-index: 3; }
.dialog-action-button[data-tooltip]::after,
.modal-overlay .icon-only-button[data-tooltip]::after {
  position: absolute !important;
  z-index: 20001 !important;
  right: 50% !important;
  min-width: max-content !important;
  max-width: 220px !important;
  padding: 6px 8px !important;
  border-radius: 7px !important;
  background: var(--tooltip-bg) !important;
  color: var(--tooltip-text) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,.22) !important;
  content: attr(data-tooltip) !important;
  font-size: .7rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  opacity: 0;
  pointer-events: none;
  transform: translateX(50%) translateY(2px) !important;
  transition: opacity .12s ease, transform .12s ease;
  white-space: nowrap;
}
.dialog-action-button[data-tooltip]::after { bottom: calc(100% + 9px) !important; top: auto !important; }
.modal-overlay .dialog-close[data-tooltip]::after { top: calc(100% + 9px) !important; bottom: auto !important; }
.dialog-action-button[data-tooltip]:hover::after,
.dialog-action-button[data-tooltip]:focus-visible::after,
.modal-overlay .icon-only-button[data-tooltip]:hover::after,
.modal-overlay .icon-only-button[data-tooltip]:focus-visible::after { opacity: 1 !important; transform: translateX(50%) translateY(0) !important; }

/* The new-bayt hatch is intentionally quiet. */
.bayt-item.is-new:not(.is-active) .bayt-summary {
  background-image: repeating-linear-gradient(135deg, rgba(124,58,237,.055) 0 2px, transparent 2px 10px) !important;
}
.bayt-item.is-new:not(.is-active) .bayt-summary:hover,
.bayt-item.is-new:not(.is-active) .bayt-summary:focus-visible {
  background-image: repeating-linear-gradient(135deg, rgba(124,58,237,.095) 0 2px, transparent 2px 10px) !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary {
  background-image: repeating-linear-gradient(135deg, rgba(182,154,227,.07) 0 2px, transparent 2px 10px) !important;
}
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary:hover,
:root[data-theme="dark"] .bayt-item.is-new:not(.is-active) .bayt-summary:focus-visible {
  background-image: repeating-linear-gradient(135deg, rgba(182,154,227,.12) 0 2px, transparent 2px 10px) !important;
}


/* Build 36 — move the readability emphasis into the active editor. */
/* Collapsed bayts return to their compact overview treatment. */
.bayt-summary {
  min-height: 72px !important;
  padding-block: 12px !important;
}
.bayt-preview {
  gap: 2px !important;
}
.bayt-preview > span {
  font-size: .96rem !important;
  font-weight: 700;
  line-height: 1.34 !important;
}
.bayt-preview > span + span {
  font-size: .85rem !important;
  line-height: 1.3 !important;
}
.bayt-number {
  align-self: center;
  padding-top: 0;
}
.meter-preview {
  margin-top: 0;
  font-size: .71rem !important;
}

/* The selected bayt is the reading/editor surface: large Arabic type. */
.bayt-item.is-active .verse-field textarea {
  min-height: 176px;
  padding: 19px 20px;
  font-size: clamp(.96rem, 1.35vw, 1.2rem) !important;
  font-weight: 500;
  line-height: 1.74;
  letter-spacing: 0;
}
.bayt-item.is-active .field-heading {
  min-height: 31px;
  padding: 5px 8px 10px;
}
.bayt-item.is-active .field-heading label {
  font-size: 1rem;
}

/* Light mode needs enough contrast to make newly-added bayts noticeable. */
:root:not([data-theme="dark"]) .bayt-item.is-new:not(.is-active) .bayt-summary {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(124, 58, 237, .12) 0 2px,
    transparent 2px 10px
  ) !important;
}
:root:not([data-theme="dark"]) .bayt-item.is-new:not(.is-active) .bayt-summary:hover,
:root:not([data-theme="dark"]) .bayt-item.is-new:not(.is-active) .bayt-summary:focus-visible {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(124, 58, 237, .18) 0 2px,
    transparent 2px 10px
  ) !important;
}

@media (max-width: 700px) {
  .bayt-summary {
    min-height: 66px !important;
    padding-block: 10px !important;
  }
  .bayt-preview > span { font-size: .9rem !important; }
  .bayt-preview > span + span { font-size: .8rem !important; }

  .bayt-item.is-active .verse-field textarea {
    min-height: 148px;
    padding: 16px;
    font-size: clamp(.94rem, 4vw, 1.08rem) !important;
    line-height: 1.7;
  }
}


/* Build 37 — modest increase for the active bayt editor only. */
.bayt-item.is-active .verse-field textarea {
  font-size: clamp(1.2rem, 1.69vw, 1.5rem) !important;
}
@media (max-width: 700px) {
  .bayt-item.is-active .verse-field textarea {
    font-size: clamp(1.18rem, 5vw, 1.35rem) !important;
  }
}

/* --- v38: locally timed first-visit theme + dimmer dark-mode analysis state. --- */
/* The pending score uses a restrained indigo in dark mode so its ellipsis does not glare. */
.score-badge.pending {
  letter-spacing: .075em;
  font-weight: 800;
}
:root[data-theme="dark"] .score-badge.pending {
  border-color: #4f5685 !important;
  background: #21243a !important;
  color: #a7aed6 !important;
  box-shadow: none !important;
}


/* --- v39: calmer dark-mode pending state and a clean mobile header grid. --- */
/* The pending ellipsis remains visible without looking like a white flash in dark mode. */
:root[data-theme="dark"] .score-badge.pending {
  border-color: #3f435f !important;
  background: #171824 !important;
  color: #7e839d !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

/* iPhone layout: title on its own right-aligned row, controls on a predictable grid below. */
@media (max-width: 700px) {
  .app-shell {
    width: calc(100% - 20px) !important;
    padding-top: 7px !important;
  }

  .app-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "brand"
      "actions" !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 0 !important;
    padding: 8px 0 12px !important;
  }

  .brand {
    grid-area: brand;
    display: flex !important;
    width: 100%;
    min-height: 52px;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: right;
  }

  .brand-name,
  .brand-name *,
  .brand:visited .brand-name {
    display: block;
    margin: 0;
    font-size: clamp(1.75rem, 8vw, 2.15rem) !important;
    line-height: 1 !important;
    transform: none !important;
  }

  .header-actions {
    grid-area: actions;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    gap: 7px !important;
  }

  .header-actions > * {
    min-width: 0 !important;
  }

  .meter-control {
    grid-column: 1 / span 2;
    grid-row: 1;
    display: flex !important;
    width: 100%;
    min-height: 42px !important;
    padding-inline: 10px !important;
  }

  .meter-control select {
    width: 100% !important;
    min-width: 0 !important;
    font-size: .82rem !important;
  }

  .theme-button {
    grid-column: 3;
    grid-row: 1;
    width: 100% !important;
    min-height: 42px !important;
  }

  .button {
    display: inline-flex !important;
    width: 100%;
    min-height: 42px !important;
    padding-inline: 6px !important;
    font-size: .76rem !important;
    line-height: 1.15;
    white-space: nowrap;
  }

  .button-example { grid-column: 1; grid-row: 2; }
  .button-import { grid-column: 2; grid-row: 2; }
  .button-export { grid-column: 3; grid-row: 2; }
  .button-clear {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 38px !important;
  }
}

@media (max-width: 360px) {
  .header-actions { gap: 6px !important; }
  .brand { min-height: 48px; }
  .brand-name,
  .brand-name *,
  .brand:visited .brand-name { font-size: 1.7rem !important; }
  .button { padding-inline: 4px !important; font-size: .71rem !important; }
}


/* --- v40: score thresholds + unmirrored required scansion. --- */
/* A score under 90% is red, 90–99% is amber, and only 100% is green. */
.score-badge.warn {
  border-color: #d7aa45 !important;
  background: #fff3cf !important;
  color: #806019 !important;
  box-shadow: 0 3px 10px rgba(197,145,31,.14) !important;
}
.meter-banner.warn {
  border-color: #d7aa45 !important;
  background: #fff3cf !important;
}
.meter-banner.warn strong,
.meter-banner.warn .meter-label,
.meter-banner.warn .verdict { color: #806019 !important; }
.meter-banner.warn .verdict {
  border-color: rgba(128,96,25,.30) !important;
  background: rgba(255,255,255,.45) !important;
}
:root[data-theme="dark"] .score-badge.warn,
:root[data-theme="dark"] .meter-banner.warn {
  border-color: #a87b27 !important;
  background: #4b3b1b !important;
  color: #ffe8a6 !important;
}
:root[data-theme="dark"] .score-badge.warn,
:root[data-theme="dark"] .meter-banner.warn strong,
:root[data-theme="dark"] .meter-banner.warn .meter-label,
:root[data-theme="dark"] .meter-banner.warn .verdict { color: #ffe8a6 !important; }
:root[data-theme="dark"] .meter-banner.warn .verdict {
  border-color: rgba(255,232,166,.30) !important;
  background: rgba(0,0,0,.14) !important;
}

/* Preserve the true left-to-right order of / and ٠ inside Arabic reference text. */
.foot-card .tafila-reference {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .28rem;
  direction: rtl;
  unicode-bidi: plaintext;
}
.inline-scansion {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 900;
  letter-spacing: .05em;
  white-space: nowrap;
}
.foot-card .missing {
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: center;
}
.foot-card .missing .inline-scansion { color: inherit; }
