/* Accessibility options. a11y.js sets <html data-a11y="calm quick plain contrast large targets">.
   Overrides use !important because the pages' own rules (some keyed on ids) would otherwise win. */

/* ---- The opener and the dialog: always readable, whatever the page looks like ---- */
#a11y-open { position: fixed; right: 12px; bottom: 12px; z-index: 100; display: inline-flex; align-items: center; gap: 8px;
  min-height: 50px; padding: 4px 14px 4px 6px; cursor: pointer; font: 600 11pt system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #efe4c6; background: #0e0e10; border: 2px solid #efe4c6; border-radius: 999px; }
#a11y-open:hover { background: #efe4c6; color: #16120a; }
#a11y-open:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }
#a11y-open img { flex: none; width: 44px; height: 44px; margin: -3px; /* 15% larger than 38px, layout size unchanged */ object-fit: contain; }
#a11y-open span { display: inline-block; max-width: 9em; overflow: hidden; white-space: nowrap; }
#a11y-open { transition: padding 3s ease, gap 3s ease, background-color .3s, color .3s, opacity 3s ease; }
#a11y-open span { transition: max-width 3s ease, opacity 2s ease; }
/* Collapsed: a circle around the icon, slightly faded; hover or keyboard focus brings the label back. */
#a11y-open.a11y-mini { gap: 0; padding: 4px; opacity: .75; }
#a11y-open.a11y-mini span { max-width: 0; opacity: 0; }
#a11y-open.a11y-mini:hover, #a11y-open.a11y-mini:focus-visible { opacity: 1; gap: 8px; padding: 4px 14px 4px 6px; transition-duration: .25s; }
#a11y-open.a11y-mini:hover span, #a11y-open.a11y-mini:focus-visible span { max-width: 9em; opacity: 1; transition-duration: .25s; }

#a11y-dialog { width: min(92vw, 540px); max-height: 88vh; padding: 0; color: #ece9f2; background: #0e0e10;
  border: 2px solid #efe4c6; border-radius: 12px; font: 12pt/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
#a11y-dialog::backdrop { background: rgba(0, 0, 0, .75); }
#a11y-dialog form { padding: 20px 22px 18px; }
#a11y-dialog h2 { margin: 0 0 4px; font: 700 18pt/1.2 system-ui, sans-serif; color: #efe4c6; letter-spacing: normal; text-shadow: none; }
#a11y-dialog .a11y-note { margin: 0 0 14px; color: #c9c5d4; font-size: 11pt; }
#a11y-dialog fieldset { margin: 0 0 14px; padding: 0; border: 0; }
#a11y-dialog legend { padding: 0; margin-bottom: 4px; font-weight: 700; color: #9cb58a; }
#a11y-dialog .a11y-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
#a11y-dialog .a11y-row:hover { background: rgba(239, 228, 198, .1); }
#a11y-dialog .a11y-row[hidden] { display: none; }
#a11y-dialog input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: #9cb58a; cursor: pointer; }
#a11y-dialog input:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
#a11y-dialog .a11y-row b { display: block; font-weight: 600; }
#a11y-dialog .a11y-row small { display: block; font-size: 10.5pt; color: #c9c5d4; }
#a11y-dialog .a11y-actions { display: flex; justify-content: flex-end; position: sticky; bottom: 0; padding-top: 10px; background: #0e0e10; }
#a11y-dialog .a11y-done { min-height: 44px; padding: 0 28px; cursor: pointer; font: 600 12pt system-ui, sans-serif; color: #16200f;
  background: #9cb58a; border: 2px solid #9cb58a; border-radius: 8px; }
#a11y-dialog .a11y-done:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }

/* ---- Reduce motion and effects ---- */
html[data-a11y~=calm] *, html[data-a11y~=calm] *::before, html[data-a11y~=calm] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important; text-shadow: none !important; }
html[data-a11y~=calm] .bubble-pop, html[data-a11y~=calm] .token-pop, html[data-a11y~=calm] .spark-pop,
html[data-a11y~=calm] .storm { display: none !important; }
html[data-a11y~=calm] .choice, html[data-a11y~=calm] .back .cauldron, html[data-a11y~=calm] .choice img,
html[data-a11y~=calm] .tool > img { transform: none !important; }
html[data-a11y~=calm] .choice.heart, html[data-a11y~=calm] .choice.grin { transform: none !important; }
html[data-a11y~=calm] #reset:hover img, html[data-a11y~=calm] #reset:focus-visible img,
html[data-a11y~=calm] .team li.blink { filter: none !important; }
html[data-a11y~=calm] .char-pop button:hover, html[data-a11y~=calm] .char-pop button:focus-visible { transform: none !important; }
html[data-a11y~=calm] button:hover, html[data-a11y~=calm] a:hover { box-shadow: none !important; }
/* The About genie is centred by its animation's keyframes; with them off it needs its resting pose set directly,
   or it lands offset to the right and runs off the window. */
html[data-a11y~=calm] .amne { transform: translateX(-50%) rotate(-16deg) !important; opacity: 1; }
/* Without its animation the brewing screen would just sit there; the pot stays still. */
html[data-a11y~=calm] #bubbling { color: var(--cream) !important; }

/* ---- Plain style ---- */
html[data-a11y~=plain], html[data-a11y~=plain] body { background: #000 !important; }
html[data-a11y~=plain] body::before, html[data-a11y~=plain] .vignette, html[data-a11y~=plain] .storm { display: none !important; }
html[data-a11y~=plain] *, html[data-a11y~=plain] *::before, html[data-a11y~=plain] *::after { filter: none !important; text-shadow: none !important; }
html[data-a11y~=plain] h1, html[data-a11y~=plain] h2, html[data-a11y~=plain] .corner a, html[data-a11y~=plain] .alert,
html[data-a11y~=plain] #bubbling, html[data-a11y~=plain] .clear-tip, html[data-a11y~=plain] .bubble, html[data-a11y~=plain] .back-word,
html[data-a11y~=plain] .tool-word, html[data-a11y~=plain] .choice .mark, html[data-a11y~=plain] .team-rail button,
html[data-a11y~=plain] #msg {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif !important; letter-spacing: normal !important; text-transform: none !important; }
html[data-a11y~=plain] h1 { font-size: 30pt !important; line-height: 1.2 !important; font-weight: 700 !important; margin-top: 0 !important; }
html[data-a11y~=plain] .tall { transform: none !important; display: inline !important; }
html[data-a11y~=plain] .corner a { font-size: 14pt !important; font-weight: 600; text-decoration: underline; padding: 6px 4px; }
html[data-a11y~=plain] .title-n img, html[data-a11y~=plain] .amne, html[data-a11y~=plain] .toy-sep,
html[data-a11y~=plain] .warn-ico, html[data-a11y~=plain] .back .cauldron, html[data-a11y~=plain] .tool > img,
html[data-a11y~=plain] #brew-icon { display: none !important; }
/* Hand-drawn borders and drips become ordinary rules. */
html[data-a11y~=plain] .panel::after, html[data-a11y~=plain] .sheet::after, html[data-a11y~=plain] .char-pop::after,
html[data-a11y~=plain] .char-pop .thick, html[data-a11y~=plain] .drip-rule::after, html[data-a11y~=plain] .bubble::before,
html[data-a11y~=plain] .bubble::after { display: none !important; }
html[data-a11y~=plain] .panel, html[data-a11y~=plain] .sheet { background: #000 !important; border-radius: 8px !important; }
html[data-a11y~=plain] .panel::before, html[data-a11y~=plain] .sheet::before { border: 2px solid #8a8696 !important; border-radius: 8px !important; }
html[data-a11y~=plain] .sheet { padding-top: 28px !important; }
html[data-a11y~=plain] .char-pop { border-radius: 10px !important; background: #000 !important; }
html[data-a11y~=plain] .char-pop::before { border: 2px solid #8a8696 !important; border-radius: 10px !important; }
html[data-a11y~=plain] .drip-rule { height: 0 !important; margin: 28px auto !important; border-top: 2px solid #8a8696; }
html[data-a11y~=plain] .drip-rule::before { display: none !important; }
html[data-a11y~=plain] button.brass, html[data-a11y~=plain] button.primary { border-radius: 8px !important; }
/* Anything that only said what it was on hover now always says it. */
html[data-a11y~=plain] .back { display: inline-block !important; padding: 8px 4px; }
html[data-a11y~=plain] .back-word, html[data-a11y~=plain] .tool-word { position: static !important; opacity: 1 !important;
  transform: none !important; font-size: 13pt !important; color: var(--cream); text-decoration: underline; pointer-events: auto; }
html[data-a11y~=plain] .back-word::before { content: "← "; }
html[data-a11y~=plain] .back-word { font-size: 14pt !important; }
html[data-a11y~=plain] .rail { position: static !important; margin: 0 0 12px !important; align-items: flex-start !important; }
html[data-a11y~=plain] .tools { gap: 24px !important; margin-top: 40px !important; }
html[data-a11y~=plain] .tool, html[data-a11y~=plain] .suggest { width: auto !important; height: auto !important; padding: 8px 4px; }
html[data-a11y~=plain] .bubble { position: static !important; opacity: 1 !important; transform: none !important; border: 0 !important;
  background: none !important; color: var(--cream) !important; font-size: 13pt !important; padding: 0 !important; text-decoration: underline; }
html[data-a11y~=plain] .choice .mark { opacity: 1 !important; transform: none !important; font-size: 13pt !important; white-space: normal !important; }
html[data-a11y~=plain] .choice img { filter: none !important; }
html[data-a11y~=plain] .team li .ability { font-size: 10pt !important; line-height: 1.25 !important; }
/* Clear becomes a text button styled like Download JSON and the other export buttons; the Vortox art goes. */
html[data-a11y~=plain] #reset { position: static !important; flex: none; width: auto !important; height: auto !important; min-height: 42px;
  margin: 0 !important; padding: 0 24px !important; display: inline-flex; align-items: center; justify-content: center;
  font: 600 13pt system-ui, -apple-system, sans-serif; letter-spacing: .02em; color: var(--sage); background: transparent !important;
  border: 2px solid var(--sage) !important; border-radius: 8px !important; }
html[data-a11y~=plain] #reset:hover { background: var(--sage) !important; color: var(--sage-dark); }
html[data-a11y~=plain] #reset img { display: none !important; }
html[data-a11y~=plain] #reset .clear-tip { position: static !important; opacity: 1 !important; transform: none !important;
  font: inherit !important; letter-spacing: inherit !important; text-transform: capitalize !important; color: inherit !important; }
html[data-a11y~=plain] #msg { margin-left: 0 !important; left: 0 !important; width: 100% !important; font-size: 13pt !important; }
html[data-a11y~=plain] #bubbling { font-size: 20pt !important; }
html[data-a11y~=plain] .alert { white-space: normal !important; font-size: 13pt !important; }
html[data-a11y~=plain] .glow-toggle input:checked { background: var(--sage) !important; border-color: var(--sage) !important; box-shadow: none !important; }
html[data-a11y~=plain] .glow-toggle:has(input:checked) { color: var(--cream) !important; }

/* ---- High contrast ---- */
html[data-a11y~=contrast] {
  --bg: #000; --panel: #000; --line: #fff; --text: #fff; --muted: #ececec; --sage: #bfe69a; --sage-dark: #000; --cream: #fff4cc;
  --error: #ffb0b0; --townsfolk: #7db4ff; --outsider: #b8e4ff; --minion: #ff8a8e; --demon: #ff6e73;
  --gold: #ffd166; --gold-dim: #ffd166; --field: #000; --brew-start: #fff4cc; --brew-end: #fff4cc; }
html[data-a11y~=contrast], html[data-a11y~=contrast] body { background: #000 !important; color: #fff; }
html[data-a11y~=contrast] body::before, html[data-a11y~=contrast] .vignette, html[data-a11y~=contrast] .storm { display: none !important; }
html[data-a11y~=contrast] a { text-decoration: underline; }
html[data-a11y~=contrast] .panel, html[data-a11y~=contrast] .sheet, html[data-a11y~=contrast] .char-pop { background: #000 !important; }
html[data-a11y~=contrast] .panel::before, html[data-a11y~=contrast] .sheet::before, html[data-a11y~=contrast] .char-pop::before { border-color: #fff !important; }
html[data-a11y~=contrast] .team li .ability, html[data-a11y~=contrast] .jx-tip { color: #f0f0f0 !important; font-weight: 400 !important; }
html[data-a11y~=contrast] .jx-tip { background: #000 !important; border: 1px solid #fff !important; backdrop-filter: none !important; }
html[data-a11y~=contrast] .warn, html[data-a11y~=contrast] .script-warnings { color: #ffe08a !important; }
html[data-a11y~=contrast] .credit { opacity: 1 !important; }
html[data-a11y~=contrast] footer, html[data-a11y~=contrast] .lede { color: #ececec !important; }
html[data-a11y~=contrast] ::placeholder { color: #d6d6d6 !important; opacity: 1 !important; }
html[data-a11y~=contrast] input[type=text], html[data-a11y~=contrast] textarea, html[data-a11y~=contrast] select,
html[data-a11y~=contrast] .seg, html[data-a11y~=contrast] .seg label { border-color: #fff !important; }
html[data-a11y~=contrast] .seg label { color: #fff !important; }
html[data-a11y~=contrast] .seg input:checked + label { background: #bfe69a !important; color: #000 !important; }
html[data-a11y~=contrast] button.brass, html[data-a11y~=contrast] button.ghost { border-color: #fff !important; color: #fff !important; }
html[data-a11y~=contrast] button.primary { background: #bfe69a !important; border-color: #bfe69a !important; color: #000 !important; }
html[data-a11y~=contrast] .chip.out { color: #ececec !important; border-color: #ececec !important; }
html[data-a11y~=contrast] *:focus-visible { outline: 3px solid #ffd54a !important; outline-offset: 3px !important; }
html[data-a11y~=contrast] #a11y-open { border-color: #fff; color: #fff; background: #000; }

/* ---- Larger text ---- */
html[data-a11y~=large] body { font-size: 16pt !important; }
html[data-a11y~=large] button, html[data-a11y~=large] .seg label, html[data-a11y~=large] input[type=text],
html[data-a11y~=large] select, html[data-a11y~=large] textarea { font-size: 15pt !important; }
html[data-a11y~=large] .desc .lead { font-size: 20pt !important; }
html[data-a11y~=large] .desc .sub, html[data-a11y~=large] .lede, html[data-a11y~=large] .label small,
html[data-a11y~=large] .warn, html[data-a11y~=large] .script-warnings, html[data-a11y~=large] .more,
html[data-a11y~=large] footer, html[data-a11y~=large] .credit, html[data-a11y~=large] .alert,
html[data-a11y~=large] #msg { font-size: 14pt !important; }
html[data-a11y~=large] .team li { font-size: 16pt !important; }
html[data-a11y~=large] .team h2 { font-size: 19pt !important; }
html[data-a11y~=large] .team li .ability, html[data-a11y~=large] .jx-tip { font-size: 13pt !important; line-height: 1.25 !important; }
html[data-a11y~=large] .team li > img { width: 64px !important; height: 64px !important; }
html[data-a11y~=large] .jinxes { height: 26px !important; }
html[data-a11y~=large] .jinxes .jx { width: 26px !important; height: 26px !important; margin-right: 4pt !important; }
html[data-a11y~=large] .jinxes .jx img { width: 38px !important; height: 38px !important; margin: -6px !important; }
html[data-a11y~=large] #bubbling { font-size: 24pt !important; }
html[data-a11y~=large] h1 { font-size: 36pt !important; }
html[data-a11y~=large] .corner a { font-size: 18pt !important; }

/* ---- Larger click targets ---- */
html[data-a11y~=targets] button, html[data-a11y~=targets] .seg label, html[data-a11y~=targets] select,
html[data-a11y~=targets] input[type=text], html[data-a11y~=targets] textarea, html[data-a11y~=targets] .more { min-height: 48px; }
html[data-a11y~=targets] .seg label { display: inline-flex; align-items: center; padding: 8px 22px !important; }
html[data-a11y~=targets] .seg { gap: 0; }
html[data-a11y~=targets] .field { margin-bottom: 30px !important; }
html[data-a11y~=targets] .chips { gap: 10px !important; }
html[data-a11y~=targets] .chip button { min-width: 44px; min-height: 44px; font-size: 16pt !important; }
html[data-a11y~=targets] .glow-toggle { min-height: 48px; }
html[data-a11y~=targets] .glow-toggle input { width: 32px !important; height: 32px !important; }
html[data-a11y~=targets] .combo-list li { min-height: 52px; padding-top: 6px !important; padding-bottom: 6px !important; }
html[data-a11y~=targets] .actions { gap: 18px !important; }
html[data-a11y~=targets] .export { gap: 16px !important; }
html[data-a11y~=targets] .export button { height: auto !important; min-height: 52px; }
html[data-a11y~=targets] .corner a, html[data-a11y~=targets] .back { padding: 10px 8px; }
html[data-a11y~=targets] .team li { padding: 6px 0 !important; }
html[data-a11y~=targets] .jinxes { height: 34px !important; }
html[data-a11y~=targets] .jinxes .jx { width: 34px !important; height: 34px !important; margin-right: 10px !important; }
html[data-a11y~=targets] .jinxes .jx img { width: 40px !important; height: 40px !important; margin: -3px !important; }
/* The pop-up is scaled up as a whole (1.82x, the same 68:44 shape), drip and border weight included, so the big drop still
   meets the blob's lower-left curve. Resizing it to some other shape would leave the drip floating off the edge. */
html[data-a11y~=targets] .char-pop { width: 124px !important; height: 80px !important; gap: 8px !important; }
html[data-a11y~=targets] .char-pop::before { border-width: 5px 5px 11px !important; }
html[data-a11y~=targets] .char-pop::after { top: calc(100% - 22px) !important; height: 58px !important; background-size: 124px 58px !important; }
html[data-a11y~=targets] .char-pop .thick { inset: -4px !important; border-width: 9px !important; }
html[data-a11y~=targets] .char-pop button { width: 52px !important; height: 52px !important; }
html[data-a11y~=targets] .char-pop button svg { width: 32px !important; height: 32px !important; }
html[data-a11y~=targets] #reset { min-width: 88px; min-height: 88px; }
/* The letter rail has to be dragged along a thin strip; a normal scrollbar is easier to use. */
html[data-a11y~=targets] .team-rail { display: none !important; }
html[data-a11y~=targets] .combo-list { scrollbar-width: auto !important; }
html[data-a11y~=targets] .combo-list::-webkit-scrollbar { display: block !important; width: 16px; }
html[data-a11y~=targets] .combo-list.has-rail li { padding-right: 10px !important; }
html[data-a11y~=targets] #a11y-open { min-height: 54px; }
html[data-a11y~=targets] #a11y-open.a11y-mini { min-width: 54px; justify-content: center; }



/* The accessibility button's own fade is exempt from Calm: it is the control that turns Calm on and off. */
html[data-a11y~=calm] #a11y-open { transition: padding 3s ease, gap 3s ease, background-color .3s, color .3s, opacity 3s ease !important; }
html[data-a11y~=calm] #a11y-open span { transition: max-width 3s ease, opacity 2s ease !important; }
html[data-a11y~=calm] #a11y-open.a11y-mini:hover, html[data-a11y~=calm] #a11y-open.a11y-mini:focus-visible { transition-duration: .25s !important; }
html[data-a11y~=calm] #a11y-open.a11y-mini:hover span, html[data-a11y~=calm] #a11y-open.a11y-mini:focus-visible span { transition-duration: .25s !important; }
