/* Byzantine Dots: "psaltic manuscript" palette.
   Parchment and iron-gall ink, cinnabar for actions (the red ink of Byzantine
   codices), gold for ornament only, lapis for focus and selection.
   Every text pair is checked against WCAG (tools/check_contrast.py). */

/* GFS Didot (Greek Font Society, SIL OFL 1.1): one regular face for Latin, Greek and
   polytonic Greek; bold is drawn by the browser. */
@font-face {
  font-family: "GFS Didot";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/gfs-didot.woff2) format("woff2");
}
@font-face {
  font-family: "Dots Braille";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/noto-symbols2-braille.woff2) format("woff2");
  unicode-range: U+2800-28FF;
}

/* tokens:light. Owner's palette: cinnabar #8B1E1E (initials and martyriae
   in chant books), icon gold #C9A227, ink #1D1B18, parchment #F6F4EF. */
:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffefb;
  --surface-2: #ede9df;
  --ink: #1d1b18;
  --muted: #5a544b;
  --line: #ddd6c9;
  --line-strong: #857c6d;
  --accent: #8b1e1e;
  --accent-hover: #6f1717;
  --accent-ink: #ffffff;
  /* light header: parchment with the colour logo, as on the brand board */
  --header-1: #fffdf8;
  --header-2: #f1ebdf;
  --header-ink: #1d1b18;
  --header-rule: #8b1e1e;
  --gold: #c9a227;
  --focus: #1d4f9e;
  --hl: rgba(29, 79, 158, 0.2);
  /* overlay on the scanned page, which stays white paper in both themes */
  --page-box: #3c5a8a;
  --page-low: #b45309;
  --page-focus: #1d4f9e;
  --page-hl: rgba(29, 79, 158, 0.22);
  --page-edit: #1d7a3a;
  --low: #a14a07;
  --error: #8b1e1e;
  --notice: #f9f1da;
  --shadow: 0 1px 2px rgba(29, 27, 24, 0.06), 0 8px 24px rgba(29, 27, 24, 0.07);
}
/* tokens:dark (chosen in the accessibility panel) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161412;
  --surface: #201d1a;
  --surface-2: #2a2622;
  --ink: #f3efe7;
  --muted: #c3bbae;
  --line: #3b3630;
  --line-strong: #8a8173;
  --accent: #ef8a7a;
  --accent-hover: #f5a89c;
  --accent-ink: #1d0b0b;
  --header-1: #240a0a;
  --header-2: #561414;
  --header-ink: #fff6e8;
  --header-rule: #d9b443;
  --gold: #d9b443;
  --focus: #93b6ff;
  --hl: rgba(147, 182, 255, 0.26);
  --low: #f6a92b;
  --error: #ff8f84;
  --notice: #2f2818;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* tokens:contrast. For low vision: pure black, white and yellow. */
:root[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --surface-2: #111111;
  --ink: #ffffff;
  --muted: #f2f2f2;
  --line: #ffffff;
  --line-strong: #ffffff;
  --accent: #ffe14d;
  --accent-hover: #fff07a;
  --accent-ink: #000000;
  --header-1: #000000;
  --header-2: #000000;
  --header-ink: #ffffff;
  --header-rule: #ffffff;
  --gold: #ffe14d;
  --focus: #5cd6ff;
  --hl: rgba(255, 225, 77, 0.3);
  --low: #ffb347;
  --error: #ff8a8a;
  --notice: #000000;
  --shadow: none;
}
:root[data-theme="contrast"] .top { border-bottom-color: #ffffff; }
:root[data-theme="contrast"] .notice { border: 2px solid #ffe14d; }
:root[data-theme="contrast"] a { text-decoration-thickness: 2px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html[data-size="125"] { font-size: 125%; }
html[data-size="150"] { font-size: 150%; }
html[data-size="200"] { font-size: 200%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "GFS Didot", "Palatino Linotype", Georgia, "Times New Roman", serif;
  /* GFS Didot's small letters are shorter than a sans serif's: a step larger reads the same */
  font-size: 1.1875rem;
  line-height: 1.6;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; }
.skip:focus {
  left: 16px; top: 8px; z-index: 10; padding: 10px 14px; border-radius: 8px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}

/* header */
.top {
  background: linear-gradient(120deg, var(--header-1), var(--header-2));
  color: var(--header-ink);
  border-bottom: 4px solid var(--header-rule);
  box-shadow: 0 3px 0 var(--gold);
  padding: 24px 0 20px;
  margin-bottom: 3px;
}
.top .wrap { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.brand-title { display: block; margin: 0; line-height: 0; border-radius: 8px; }
.brand-logo { display: block; height: 64px; width: auto; max-width: 100%; }
/* one logo per theme: colour on parchment, light on the dark header, white for high contrast */
.logo-light, .logo-white { display: none; }
:root[data-theme="dark"] .logo-color { display: none; }
:root[data-theme="dark"] .logo-light { display: block; }
:root[data-theme="contrast"] .logo-color { display: none; }
:root[data-theme="contrast"] .logo-white { display: block; }
.top a { color: inherit; }
.tag { margin: 0; color: var(--header-ink); font-size: 0.98rem; font-weight: 600; }
.view-settings { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.theme { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.theme label { margin: 0; font-weight: 700; color: var(--header-ink); }
.theme select {
  min-height: 44px; padding: 6px 10px; border-radius: 10px; font: inherit;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}

/* cards and steps */
main { padding-bottom: 8px; }
.intro { margin: 24px 0 0; }
.intro h2 { margin-bottom: 8px; }
.lead { font-size: 1.12rem; line-height: 1.65; margin: 0 0 10px; max-width: 62em; }
.who { margin: 0 0 16px; max-width: 62em; }
.intro-links { margin: 14px 0 0; font-weight: 700; }
.lang { margin-left: auto; }
.lang a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.lang a:hover { border-color: var(--accent); color: var(--accent); }
.how {
  list-style: none; counter-reset: how; margin: 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5em), 1fr));
}
.how li {
  position: relative; padding: 14px 16px 14px 48px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
/* the gold ring and cinnabar dot of the logo's Braille cell */
.how li::before {
  content: ""; position: absolute; left: 16px; top: 19px;
  width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--gold); box-sizing: border-box;
}
.how li:nth-child(2)::before { border: 0; background: var(--accent); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}
.card:focus { outline: none; }
.card:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h2 { margin: 0 0 16px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
.step {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem; font-weight: 800;
}
h3 {
  font-size: 1.06rem; font-weight: 750; margin: 1.6em 0 0.6em;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
h3::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; vertical-align: 2px; transform: rotate(45deg); background: var(--gold); }

/* elements with their own display (flex, grid) must still hide */
[hidden] { display: none !important; }

/* form */
.field { margin-bottom: 18px; }
.page-range { margin-top: 10px; }
.page-range input { margin-bottom: 10px; }
.book-pages { padding-left: 1.2em; }
.book-pages li { margin: 4px 0; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
label.check, label.inline { font-weight: 500; display: flex; gap: 10px; align-items: center; margin: 6px 0; }
input, button, select { font: inherit; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
/* 44 px tall so the slider is easy to grab with a finger */
input[type="range"] { accent-color: var(--accent); width: 160px; height: 44px; margin: 0; cursor: pointer; }
input[type="number"] { width: 7.5em; }
input[type="file"], input[type="number"] {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--ink); max-width: 100%;
}
/* file picker: native input kept for keyboards and screen readers, drawn as a Greek drop zone */
.file-input {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.file-drop {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; cursor: pointer;
  padding: 18px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2);
}
.file-drop:hover, .file-drop.dragover { border-color: var(--accent); }
.file-drop.dragover { border-style: solid; background: var(--hl); }
.file-input:focus-visible + .file-drop { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.file-button { border-color: var(--accent); color: var(--accent); font-weight: 800; pointer-events: none; }
.file-or { color: var(--muted); }
.file-name { margin: 8px 0 0; font-weight: 700; word-break: break-word; }
.file-input[aria-invalid="true"] + .file-drop { border-color: var(--error); border-style: solid; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 10px 0 14px; padding: 8px 16px 12px; }
legend { font-weight: 700; padding: 0 6px; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
summary:hover { color: var(--accent); }
.hint { color: var(--muted); font-size: 0.93rem; margin: 6px 0 0; }
.field-error { color: var(--error); font-weight: 700; margin: 8px 0 0; }
.field-error::before { content: "⚠ "; }
input[aria-invalid="true"] { border-color: var(--error); border-style: solid; }

/* buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 650; text-decoration: none; transition: background-color 0.15s, border-color 0.15s;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--ink); background: var(--surface-2); }
button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 800; padding: 12px 24px; font-size: 1.05rem;
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { border-style: dashed; }
button:disabled { opacity: 0.65; cursor: progress; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* status and notices */
.status { min-height: 1.6em; font-weight: 700; margin: 14px 0 0; }
.status:empty { margin: 0; }
.status.busy::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px; vertical-align: -2px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
.status.error { color: var(--error); }
.notice { background: var(--notice); border-left: 4px solid var(--gold); padding: 12px 14px; border-radius: 10px; }

/* results */
.downloads { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.downloads .btn { width: 100%; justify-content: flex-start; }
.btn.dl { flex-direction: column; align-items: flex-start; gap: 0; padding: 12px 16px; height: 100%; }
.dl-title { font-weight: 800; }
.dl-title::before { content: "↓ "; color: var(--accent); }
.dl-sub { font-weight: 500; font-size: 0.88rem; color: var(--muted); }
.summary { font-weight: 700; font-size: 1.05rem; margin: 0 0 12px; }
.notice { margin: 10px 0; }
.help ul { margin: 6px 0 0; padding-left: 1.3em; }
.help li { margin: 6px 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
pre.braille, pre.ascii {
  margin: 0; padding: 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); white-space: pre-wrap; word-break: break-all;
}
pre.braille {
  font-size: 28px; line-height: 1.4; color: var(--ink);
  font-family: "Dots Braille", "Segoe UI Symbol", "Apple Braille", "DejaVu Sans", sans-serif;
}
pre.ascii { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.98rem; }

.check-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 900px) { .check-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.tokens { margin: 0; padding-left: 2em; max-height: 70vh; overflow: auto; }
.tokens li { margin: 4px 0; }
.tokens li::marker { color: var(--muted); font-size: 0.85rem; }
.tokens button {
  width: 100%; text-align: left; min-height: 0; padding: 8px 12px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; font-weight: 500;
}
.tokens button[aria-pressed="true"] { border-color: var(--focus); background: var(--hl); box-shadow: inset 4px 0 0 var(--focus); }
.tokens .cells { font-size: 22px; font-family: "Dots Braille", "Segoe UI Symbol", "Apple Braille", "DejaVu Sans", sans-serif; }
.tokens .desc { font-size: 0.9rem; color: var(--muted); }
.tokens .warn { color: var(--low); font-size: 0.86rem; font-weight: 650; }
.preview { margin: 0; }
.stage { position: relative; }
.stage img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage rect { fill: none; stroke: var(--page-box); stroke-width: 3; opacity: 0.6; }
.stage rect.low { stroke: var(--page-low); stroke-dasharray: 10 6; opacity: 0.95; }
.stage rect.on { fill: var(--page-hl); stroke: var(--page-focus); stroke-width: 6; opacity: 1; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.legend-box { display: inline-block; width: 22px; height: 14px; margin: 0 6px 0 2px; vertical-align: -2px; border: 3px solid var(--page-box); border-radius: 2px; background: #fff; box-shadow: 0 0 0 2px #fff; }
.legend-box.low { border-color: var(--page-low); border-style: dashed; }
#warnings { font-size: 0.93rem; }
#warnings li { margin: 4px 0; }

.foot { color: var(--muted); font-size: 0.9rem; padding: 8px 16px 40px; border-top: 1px solid var(--line); margin-top: 8px; }
.foot p { margin: 8px 0; }
.foot-links { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-links a { display: inline-block; padding: 6px 0; min-height: 24px; }
.page-text h1 { margin: 0 0 14px; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.page-text h2 { margin: 1.6em 0 0.5em; font-size: 1.2rem; }
.page-text h3 { margin-top: 1.8em; }
.page-text code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.foot-links a[aria-current="page"] { font-weight: 800; text-decoration: none; color: var(--ink); }
.page-text li { margin: 4px 0; }
.page-text table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.page-text th, .page-text td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }

@media (max-width: 520px) {
  .top { padding: 20px 0 18px; }
  .brand-logo { height: 48px; }
  .card { padding: 18px; border-radius: 14px; }
  pre.braille { font-size: 22px; }
}
@media (forced-colors: active) {
  .step, button.primary { border: 1px solid CanvasText; }
  .stage rect.on { stroke: Highlight; }
}

/* camera, submit and cancel */
.camera-row { margin: 10px 0 0; }
.camera-button { cursor: pointer; border-color: var(--accent); color: var(--accent); font-weight: 800; }
.camera-row:focus-within .camera-button { outline: 3px solid var(--focus); outline-offset: 2px; }
.submit-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* read-aloud player */
.player { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.player-title { margin: 0 0 8px; font-weight: 800; }
.player-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.player-buttons button { min-width: 44px; }
.player-buttons button:disabled { opacity: 0.45; cursor: not-allowed; }
.player .hint:empty { display: none; }

@media (max-width: 520px) {
  /* thumb-sized controls on phones */
  .submit-row button, .downloads .btn, .player-buttons button, .camera-button { width: 100%; justify-content: center; }
  .player-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .player-buttons #say-play { grid-column: 1 / -1; }
  .toolbar > button { flex: 1 1 100%; }
  .file-drop { flex-direction: column; align-items: stretch; text-align: center; }
  .file-drop .file-button { justify-content: center; }
}

/* correction editor */
.tokens > li { display: flex; gap: 6px; align-items: stretch; }
.tokens > li > .seg-btn { flex: 1 1 auto; min-width: 0; }
.tokens .edit-btn { flex: none; align-self: center; min-height: 44px; padding: 8px 12px; font-weight: 700; border-color: var(--accent); color: var(--accent); }
.edit-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 14px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.edit-count { margin: 0; font-weight: 700; flex: 1 1 100%; }
.edit-bar .btn.dl { flex: 1 1 260px; }
.stage svg rect { pointer-events: all; cursor: pointer; }
.stage rect.edited { stroke: var(--page-edit); stroke-width: 4; opacity: 1; }
.legend-box.edited { border-color: var(--page-edit); }
.edit-dialog {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0;
  border: 2px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--ink);
}
.edit-dialog::backdrop { background: rgba(20, 16, 12, 0.55); }
.edit-dialog form { padding: 20px; }
.edit-dialog h2 { margin: 0 0 6px; font-size: 1.25rem; }
.edit-item { margin: 12px 0; padding: 10px 14px 12px; border-radius: 12px; }
.edit-item legend { font-weight: 800; }
.edit-item.to-delete { border-style: dashed; opacity: 0.8; }
.edit-body { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14em), 1fr)); }
.edit-field label { display: block; font-weight: 700; margin-bottom: 4px; }
.edit-field select, .edit-field input[type="text"] {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
}
.edit-lyric { grid-column: 1 / -1; }
.edit-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.edit-deleted { font-weight: 700; color: var(--error); margin: 6px 0; }
.edit-low { color: var(--low); font-weight: 700; margin: 0 0 6px; }
.edit-actions { position: sticky; bottom: -20px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 12px 0 4px; background: var(--surface); }
@media (max-width: 520px) {
  .edit-dialog form { padding: 14px; }
  .edit-actions button, .edit-row button { flex: 1 1 100%; }
  .tokens > li { flex-wrap: wrap; }
  .tokens .edit-btn { width: 100%; }
}

/* help page */
.toc { margin: 8px 0 18px; padding: 12px 18px; background: var(--surface-2); border-radius: 12px; }
.toc ul { margin: 0; padding-left: 1.2em; columns: 2 16em; column-gap: 24px; }
.toc li { margin: 4px 0; break-inside: avoid; }
.page-text details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.page-text details p { margin: 4px 0 10px; }

/* thesis page */
.citation { margin: 18px 0; padding: 18px 20px; border-left: 5px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0; }
.cite-title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 800; line-height: 1.4; }
.citation figcaption { color: var(--ink); font-size: 0.95rem; }
.thesis-actions { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.abstract { margin: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--gold); }

/* wider spacing (WCAG 1.4.12 text spacing), chosen in the accessibility panel */
html[data-spacing="wide"] body { line-height: 1.95; letter-spacing: 0.06em; word-spacing: 0.16em; }
html[data-spacing="wide"] p, html[data-spacing="wide"] li { margin-bottom: 0.9em; }

/* accessibility button (bottom right) and its panel */
.a11y-dock {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
.a11y-toggle {
  width: 60px; height: 60px; padding: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); border: 3px solid var(--surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.a11y-toggle:hover { background: var(--accent-hover); color: var(--accent-ink); border-color: var(--surface); }
.a11y-toggle[aria-expanded="true"] { outline: 3px solid var(--gold); outline-offset: 2px; }
.a11y-toggle:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.a11y-panel {
  width: min(360px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow: auto;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line-strong);
  border-radius: 16px; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.a11y-panel h2 { margin: 0 0 8px; font-size: 1.2rem; }
.a11y-panel h2:focus { outline: none; }
.a11y-panel fieldset { margin: 10px 0; padding: 6px 14px 10px; }
.a11y-panel label.check { margin: 4px 0; min-height: 32px; }
.a11y-panel input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.a11y-actions { display: flex; gap: 10px; justify-content: flex-end; margin: 14px 0 6px; }
.a11y-panel .hint { margin-top: 8px; }
/* keep the page's last lines clear of the floating button */
body { padding-bottom: 88px; }
@media print { .a11y-dock, .skip { display: none; } }
