/* Arabian Nights for Kids. One stylesheet, no web fonts: system fonts cover all 12 scripts
   and keep the site free of third-party requests. */
:root {
  --night: #1d1b4f;
  --night-2: #2e2a72;
  --gold: #e9b44c;
  --gold-deep: #b9811f;
  --teal: #1f7a70;
  --rose: #b4473a;
  --paper: #fbf5e9;
  --paper-2: #f3e7cf;
  --ink: #2a2338;
  --muted: #6b5f73;
  --line: #e2d3b4;
  --card: #fffdf8;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17153d;
    --paper-2: #221f55;
    --ink: #f4ecdc;
    --muted: #c9bfd6;
    --line: #3b3778;
    --card: #1f1c4c;
    --teal: #4fc1b2;
    --rose: #f08a7a;
    --gold-deep: #f0c46a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html { font-size: 112.5%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.7 var(--sans); }
:lang(ar), :lang(fa) { font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; }
:lang(ur) { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Naskh Arabic", serif; line-height: 2.2; }
:lang(hi) { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", sans-serif; }
:lang(bn) { font-family: "Noto Sans Bengali", "Kohinoor Bangla", "Bangla Sangam MN", "Nirmala UI", sans-serif; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--rose); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; color: var(--ink); }
:lang(ar) :is(h1, h2, h3), :lang(fa) :is(h1, h2, h3), :lang(ur) :is(h1, h2, h3), :lang(hi) :is(h1, h2, h3), :lang(bn) :is(h1, h2, h3) { font-family: inherit; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin: .3em 0 .3em; }
h2 { font-size: 1.45rem; margin: 1.8em 0 .6em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--night); padding: .5em 1em; z-index: 10; }
.skip:focus { left: 1rem; }

/* header */
.top { background: var(--night); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .7rem max(16px, calc((100% - 1120px) / 2)); }
.logo { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.logo svg { width: 42px; height: 42px; flex: none; }
.logo:hover { color: var(--gold); }
.nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-inline-start: auto; }
.nav a { color: #f4ecdc; text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--gold); }
.langs { position: relative; }
.langs summary { cursor: pointer; list-style: none; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: .15rem .8rem; font-size: .9rem; }
.langs summary::-webkit-details-marker { display: none; }
.langs summary::before { content: "🌐 "; }
.langs ul { position: absolute; inset-inline-end: 0; top: 2.2rem; z-index: 5; list-style: none; margin: 0; padding: .4rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 12rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.langs li a { display: block; padding: .3rem .7rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.langs li a:hover, .langs li a[aria-current] { background: var(--paper-2); }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 3rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 1.2rem 0 .8rem; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-inline-end: .3rem; }
[dir="rtl"] .crumbs li + li::before { content: "‹"; }

/* home hero */
.hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 2rem; align-items: center; margin: 2rem 0 1rem; }
.hero-text p { font-size: 1.1rem; }
.hero-art { margin: 0; }
.hero-art img { border-radius: var(--radius); box-shadow: 0 14px 40px rgba(29,27,79,.25); width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.button { display: inline-block; background: var(--gold); color: var(--night); font-weight: 700; padding: .65rem 1.3rem; border-radius: 999px; text-decoration: none; border: 2px solid var(--gold); }
.button:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--gold-deep); }
.count { color: var(--muted); font-size: .95rem; }
.lead { font-size: 1.15rem; color: var(--muted); }

/* cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.card a { display: flex; flex-direction: column; gap: .35rem; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; padding-bottom: .9rem; transition: transform .15s, box-shadow .15s; }
.card a:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(29,27,79,.15); }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card .kicker, .card strong, .card span { padding: 0 .9rem; }
.card strong { font-family: var(--serif); font-size: 1.1rem; line-height: 1.3; }
.card span:last-child { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.wiki-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.wiki-card img { aspect-ratio: 1; object-fit: cover; background: var(--paper-2); }
.wiki-card strong { text-align: center; padding-top: .3rem; }
.kicker { color: var(--gold-deep); font-weight: 700; font-size: .85rem; letter-spacing: .02em; text-transform: uppercase; margin: 1rem 0 0; }
:lang(ar) .kicker, :lang(fa) .kicker, :lang(ur) .kicker { text-transform: none; letter-spacing: 0; }

/* story */
.story, .wiki, .page { max-width: 760px; margin: 0 auto; }
.story .hero-art { margin-top: .5rem; }
.byline { color: var(--muted); font-size: .92rem; }
.story-text { font-size: 1.2rem; line-height: 1.85; }
:lang(ur) .story-text { line-height: 2.4; }
.story-text p:first-child::first-letter { font-family: var(--serif); font-size: 3.2em; float: inline-start; line-height: .9; margin-inline-end: .12em; color: var(--gold-deep); }
:lang(ar) .story-text p:first-child::first-letter, :lang(fa) .story-text p:first-child::first-letter, :lang(ur) .story-text p:first-child::first-letter, :lang(hi) .story-text p:first-child::first-letter, :lang(bn) .story-text p:first-child::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; }
.player { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0 1.2rem; }
.player[hidden] { display: none; }
.player button { font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; border-radius: 999px; min-height: 44px; padding: .45rem 1.2rem; border: 2px solid var(--night); background: transparent; color: var(--ink); }
.player .play { background: var(--night); color: #fff; }
.player .play::before { content: ""; display: inline-block; width: 0; height: 0; border-style: solid; border-width: .45em 0 .45em .75em; border-color: transparent transparent transparent currentColor; margin-inline-end: .5em; vertical-align: -.05em; }
.player .play[aria-pressed="true"] { background: var(--rose); border-color: var(--rose); }
.player .play[aria-pressed="true"]::before { border-width: 0 .2em; border-style: solid; border-color: currentColor; height: .8em; width: .25em; }
.player .fx[aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
.player .note { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted); }
@media (prefers-color-scheme: dark) { .player button { border-color: var(--gold); } .player .play { background: var(--gold); color: var(--night); } }
.story-text .reading { background: color-mix(in srgb, var(--gold) 22%, transparent); border-radius: 8px; box-shadow: 0 0 0 .3rem color-mix(in srgb, var(--gold) 22%, transparent); transition: background .3s; }
.trust ul { list-style: none; padding: 0; margin: 2rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.trust li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; font-size: 1rem; line-height: 1.5; }
.trust strong { display: block; font-family: var(--serif); font-size: 1.1rem; }
.box { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1.3rem 1rem; margin: 1.6rem 0; }
.box h2 { margin-top: .8rem; font-size: 1.2rem; }
.lesson { border-inline-start: 6px solid var(--gold); }
.words dl, .facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.words dt, .facts dt { font-weight: 700; }
.words dd, .facts dd { margin: 0; }
.faq details { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: .5rem 0 0; }
.source { font-size: .95rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2rem 0; font-weight: 700; }
.pager .soon { color: var(--muted); font-weight: 400; }
[dir="rtl"] .pager a { unicode-bidi: plaintext; }

/* wiki */
.wiki-head { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.wiki-head figure { margin: 1rem 0 0; }
.wiki-head img { border-radius: var(--radius); background: var(--paper-2); }
.facts { font-size: .95rem; margin-top: 1rem; }
.prose { font-size: 1.08rem; }
.prose blockquote { margin: 1.2rem 0; padding: .2rem 1.2rem; border-inline-start: 4px solid var(--gold); color: var(--muted); }

.lost { text-align: center; padding: 4rem 0; }

/* footer */
.foot { background: var(--night); color: #e8e0f0; padding: 2rem max(16px, calc((100% - 1120px) / 2)); font-size: .92rem; }
.foot a { color: var(--gold); }
.foot nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 1rem 0; }
.foot .small { font-size: .82rem; opacity: .85; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .nav { margin-inline-start: 0; width: 100%; order: 3; }
  .wiki-head { grid-template-columns: 1fr; }
  .wiki-head figure { max-width: 240px; }
  .story-text { font-size: 1.12rem; }
  .words dl, .facts { grid-template-columns: 1fr; }
  .words dd, .facts dd { margin-bottom: .5rem; }
}
@media (prefers-reduced-motion: reduce) { .card a { transition: none; } .card a:hover { transform: none; } }
@media print { .top, .foot, .player, .pager, .langs { display: none; } body { background: #fff; color: #000; } }

/* ===== Comic panels: storybook text, comic frames and bubbles, manga close-ups ===== */
:root { --comic: "Chalkboard SE", "Comic Sans MS", "Comic Neue", "Segoe Print", system-ui, sans-serif; --inkline: #1b1210; }
.panel { margin: 1.6rem 0; }
.panel .frame { position: relative; container: panel / inline-size; background: #fff; border: 4px solid var(--inkline); border-radius: 6px; overflow: hidden; box-shadow: 6px 6px 0 rgba(29, 27, 79, .28); }
.panel img { width: 100%; }
.strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.6rem 0; }
.strip .panel { margin: 0; }
.strip .panel:nth-child(2) .frame { transform: rotate(.5deg); }
.strip .panel:nth-child(1) .frame { transform: rotate(-.4deg); }
.cap, .bubble { font-family: var(--comic); color: #1b1210; margin: 0; line-height: 1.3; }
:lang(ar) :is(.cap, .bubble), :lang(fa) :is(.cap, .bubble) { font-family: "Noto Naskh Arabic", "Geeza Pro", Tahoma, sans-serif; }
:lang(ur) :is(.cap, .bubble) { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif; line-height: 1.9; }
:lang(hi) :is(.cap, .bubble) { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif; }
:lang(bn) :is(.cap, .bubble) { font-family: "Noto Sans Bengali", "Kohinoor Bangla", sans-serif; }
.cap { background: #ffe9a6; border: 2.5px solid var(--inkline); padding: .35em .7em; font-weight: 700; }
.bubble { background: #fff; border: 2.5px solid var(--inkline); border-radius: 1.3em; padding: .45em .8em; text-align: center; font-weight: 600; }
.bubble .who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bubble.shout { border-width: 3.5px; border-radius: .5em; background: #fffbe8; font-weight: 800; transform: rotate(-1deg); }
:is(:lang(en), :lang(es), :lang(fr), :lang(de), :lang(pt), :lang(id), :lang(tr)) .bubble.shout { text-transform: uppercase; letter-spacing: .02em; }
.bubble.thought { border-radius: 2em; border-style: dashed; background: #f6f2ff; font-style: italic; }
.bubble.whisper { border-style: dashed; }
.sfx { position: absolute; margin: 0; font: 900 clamp(22px, 7cqw, 64px)/1 var(--comic); color: #ffd34d; -webkit-text-stroke: 2px var(--inkline); text-shadow: 3px 3px 0 var(--inkline); transform: rotate(var(--r)) scale(var(--s)); transform-origin: left top; pointer-events: none; white-space: nowrap; }
.half .sfx { font-size: clamp(22px, 12cqw, 64px); }

/* Phones and narrow strips: the dialogue sits under the picture, with the speaker named. */
.panel .cap, .panel .bubble { position: relative; margin: .5rem .6rem; font-size: 15px; }
.panel .bubble { text-align: start; }
.panel .bubble .who { position: static; width: auto; height: auto; clip: auto; font-weight: 800; }
.panel .cap { margin-top: .6rem; }
.panel .frame > .bubble:last-child, .panel .frame > .cap:last-child { margin-bottom: .7rem; }

/* Wide enough: bubbles float over the art, like a comic page. */
@container panel (min-width: 560px) {
  .wide .bubble, .wide .cap { position: absolute; margin: 0; font-size: 2.15cqw; }
  .wide .bubble { text-align: center; }
  .wide .bubble .who { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); overflow: hidden; }
  .wide .cap { width: auto; max-width: 42%; }
  .wide .cap.tl { left: 0; top: 0; } .wide .cap.tr { right: 0; top: 0; } .wide .cap.bl { left: 0; bottom: 0; } .wide .cap.br { right: 0; bottom: 0; }
}
@container panel (min-width: 330px) {
  .half .bubble, .half .cap { position: absolute; margin: 0; font-size: 4.3cqw; }
  .half .bubble { text-align: center; }
  .half .bubble .who { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); overflow: hidden; }
  .half .cap { max-width: 80%; }
  .half .cap.tl { left: 0; top: 0; } .half .cap.tr { right: 0; top: 0; } .half .cap.bl { left: 0; bottom: 0; } .half .cap.br { right: 0; bottom: 0; }
}
/* Bubble tails (only when the bubble floats over the art) */
@container panel (min-width: 330px) {
  .half .bubble::after, .half .bubble::before { content: ""; position: absolute; }
}
@container panel (min-width: 560px) {
  .wide .bubble::after, .wide .bubble::before { content: ""; position: absolute; }
}
.bubble::before { border: 13px solid transparent; }
.bubble::after { border: 10px solid transparent; }
.bubble.tail-b::before { top: 100%; left: calc(var(--tx) - 13px); border-top-color: var(--inkline); }
.bubble.tail-b::after { top: calc(100% - 1px); left: calc(var(--tx) - 10px); border-top-color: #fff; }
.bubble.tail-t::before { bottom: 100%; left: calc(var(--tx) - 13px); border-bottom-color: var(--inkline); }
.bubble.tail-t::after { bottom: calc(100% - 1px); left: calc(var(--tx) - 10px); border-bottom-color: #fff; }
.bubble.tail-r::before { left: 100%; top: calc(var(--tx) - 13px); border-left-color: var(--inkline); }
.bubble.tail-r::after { left: calc(100% - 1px); top: calc(var(--tx) - 10px); border-left-color: #fff; }
.bubble.tail-l::before { right: 100%; top: calc(var(--tx) - 13px); border-right-color: var(--inkline); }
.bubble.tail-l::after { right: calc(100% - 1px); top: calc(var(--tx) - 10px); border-right-color: #fff; }
.bubble.shout.tail-b::after { border-top-color: #fffbe8; } .bubble.shout.tail-t::after { border-bottom-color: #fffbe8; }
.bubble.shout.tail-r::after { border-left-color: #fffbe8; } .bubble.shout.tail-l::after { border-right-color: #fffbe8; }
.bubble.thought::before { width: 16px; height: 16px; border: 2.5px solid var(--inkline); border-radius: 50%; background: #f6f2ff; top: calc(100% + 4px); left: calc(var(--tx) - 8px); }
.bubble.thought::after { width: 9px; height: 9px; border: 2px solid var(--inkline); border-radius: 50%; background: #f6f2ff; top: calc(100% + 24px); left: calc(var(--tx) - 2px); }
@media (prefers-color-scheme: dark) { .panel .frame { box-shadow: 6px 6px 0 rgba(0, 0, 0, .45); } }
@media (max-width: 560px) { .strip { grid-template-columns: 1fr; } .strip .panel .frame { transform: none; } }
.player .play:disabled { opacity: .45; cursor: not-allowed; }
.player.no-voice .fx { display: none; }
.player.no-voice .note { color: var(--ink); }

/* ===== Comic Quest theme (chosen 25 Oct 2026): thick ink outlines, hard shadows, bold display type.
   System fonts only, so the site still makes no third-party requests. ===== */
:root {
  --paper: #fff7e0; --paper-2: #ffefc2; --card: #ffffff; --ink: #1b1638; --muted: #514a6b; --line: #1b1638;
  --night: #1b1638; --night-2: #2b2370; --gold: #ffd23f; --gold-deep: #c2410c; --teal: #0b6e8a; --rose: #e8501f;
  --pop: #e8501f; --edge: 3px solid var(--line); --shadow: 5px 5px 0 var(--line); --radius: 16px;
  --display: "Arial Black", "Segoe UI Black", "Helvetica Neue", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #15122e; --paper-2: #221d4a; --card: #1f1a45; --ink: #fff7e0; --muted: #d6cff2; --line: #000; --teal: #7fd3ff; --gold-deep: #ffb36b; }
  .card a, .trust li, .box, .player button:not(.play) { border-color: #000; }
}
body { font-weight: 500; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; letter-spacing: .01em; }
:is(:lang(en), :lang(es), :lang(fr), :lang(de), :lang(pt), :lang(id), :lang(tr)) :is(h1, h2) { text-transform: uppercase; }
h1 { font-size: clamp(2rem, 5.5vw, 3.6rem); line-height: 1.02; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
a { color: var(--teal); }
a:hover { color: var(--pop); }

/* header */
.top { background: var(--night); border-bottom: 6px solid var(--pop); }
.logo span { font-family: var(--display); font-weight: 900; letter-spacing: .02em; }
:is(:lang(en), :lang(es), :lang(fr), :lang(de), :lang(pt), :lang(id), :lang(tr)) .logo span { text-transform: uppercase; }
.nav { gap: .4rem; }
.nav a { font-weight: 800; padding: .5rem .9rem; border-radius: 10px; background: rgba(255,255,255,.08); min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { background: rgba(255,255,255,.16); color: var(--gold); }
.nav a:last-child { background: var(--gold); color: var(--night); border: 3px solid #000; }
.nav a:last-child:hover { color: var(--night); background: #ffe27a; }
.langs summary { border: 2px solid rgba(255,255,255,.5); font-weight: 800; padding: .35rem .9rem; }
.langs ul { border: var(--edge); box-shadow: var(--shadow); }

/* buttons */
.button { background: var(--gold); color: var(--night); border: 3px solid #000; border-radius: 14px; box-shadow: 5px 5px 0 #000; font-weight: 900; font-size: 1.1rem; padding: .8rem 1.5rem; min-height: 52px; display: inline-flex; align-items: center; transition: transform .1s, box-shadow .1s; }
.button:hover { background: #ffe27a; border-color: #000; color: var(--night); transform: translate(-2px, -2px); box-shadow: 7px 7px 0 #000; }
.button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000; }
.button.ghost { background: #fff; color: var(--night); border-color: #000; }

/* home hero */
.hero { margin: 2.2rem 0 1.5rem; gap: 2.2rem; }
.hero h1 { text-shadow: 4px 4px 0 var(--gold); }
@media (prefers-color-scheme: dark) { .hero h1 { text-shadow: 4px 4px 0 var(--pop); } }
.badge { display: inline-block; font-family: var(--display); font-weight: 900; font-size: 1rem; background: var(--pop); color: #fff; text-decoration: none; padding: .35rem .9rem; border: 3px solid #000; box-shadow: 4px 4px 0 #000; transform: rotate(-2deg); }
:is(:lang(en), :lang(es), :lang(fr), :lang(de), :lang(pt), :lang(id), :lang(tr)) .badge { text-transform: uppercase; }
.badge:hover { color: #fff; transform: rotate(0); }
.hero-art img, .story > .hero-art img { border: 5px solid #000; border-radius: 20px; box-shadow: 10px 10px 0 #000; }
.count { font-weight: 700; }

/* cards */
.card a { border: var(--edge); border-radius: 18px; box-shadow: var(--shadow); padding-bottom: 1rem; }
.card a:hover { transform: translate(-2px, -3px); box-shadow: 8px 8px 0 var(--line); }
.card img { border-bottom: var(--edge); }
.card strong { font-family: var(--display); font-weight: 900; font-size: 1.12rem; }
.card .kicker { color: var(--pop); }
.wiki-card img { background: var(--gold); }
.wiki-card:nth-child(3n+2) img { background: #8fd3ff; }
.wiki-card:nth-child(3n) img { background: #ffb3a1; }

/* trust strip, boxes, questions */
.trust li { border: var(--edge); box-shadow: var(--shadow); border-radius: 16px; background: var(--card); }
.trust strong { font-family: var(--display); font-weight: 900; }
.box { border: var(--edge); box-shadow: var(--shadow); border-radius: 16px; background: var(--paper-2); }
.lesson { border-inline-start: var(--edge); background: #fff0b3; }
@media (prefers-color-scheme: dark) { .lesson { background: #3a2f12; } }
.faq details { border: var(--edge); border-radius: 14px; padding: .7rem 1rem; margin: .6rem 0; background: var(--card); }
.faq summary { font-weight: 800; }
.kicker { color: var(--pop); }
.pager a { display: inline-flex; align-items: center; min-height: 48px; padding: .5rem 1rem; border: var(--edge); border-radius: 14px; box-shadow: 4px 4px 0 var(--line); background: var(--card); text-decoration: none; color: var(--ink); }
.pager a:hover { background: var(--gold); color: var(--night); }

/* narrator player: a comic control bar */
.player { background: var(--night); color: #fff; border: 4px solid #000; border-radius: 20px; box-shadow: 6px 6px 0 #000; padding: .8rem 1rem; gap: .6rem; }
.player button { border: 3px solid #000; color: #fff; background: rgba(255,255,255,.1); border-radius: 12px; font-weight: 900; }
.player .play { background: var(--gold); color: var(--night); font-size: 1.05rem; padding-inline: 1.3rem; }
.player .play[aria-pressed="true"] { background: var(--pop); color: #fff; border-color: #000; }
.player .fx[aria-pressed="true"] { border-color: var(--gold); }
.player .note { color: #d9d2ff; }
.player.no-voice .note { color: #fff; }
@media (prefers-color-scheme: dark) { .player button { border-color: #000; } .player .play { background: var(--gold); color: var(--night); } }
.story-text .reading { background: color-mix(in srgb, var(--gold) 40%, transparent); box-shadow: 0 0 0 .3rem color-mix(in srgb, var(--gold) 40%, transparent); }

/* footer */
.foot { border-top: 6px solid var(--pop); }
.foot nav a { font-weight: 700; }

@media (max-width: 760px) {
  .nav a { padding: .4rem .7rem; font-size: .9rem; }
  .hero h1 { text-shadow: 3px 3px 0 var(--gold); }
  .button { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .button, .card a { transition: none; } .button:hover, .card a:hover { transform: none; } }

/* contrast fixes from the audit: orange text needs a darker shade on cream (4.5:1 or more) */
:root { --pop-text: #b03a0a; }
@media (prefers-color-scheme: dark) { :root { --pop-text: #ffb38a; } }
.kicker, .card .kicker { color: var(--pop-text); }
.badge { background: #b03a0a; }

/* screen-reader-only text */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header tools: music and accessibility */
.music-btn, .a11y-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .35rem .9rem; font: inherit; font-size: .9rem; font-weight: 800; color: #fff; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.5); border-radius: 999px; cursor: pointer; }
html:not(.js) .music-btn { display: none; }
.music-btn:hover, .a11y-btn:hover { background: rgba(255,255,255,.18); }
.music-btn[aria-pressed="true"] { background: var(--gold); color: var(--night); border-color: #000; }
.a11y-btn[aria-expanded="true"] { background: #fff; color: var(--night); }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 3px; box-shadow: 0 0 0 6px #fff; }

/* accessibility panel */
.top { position: relative; }
.a11y { position: absolute; inset-inline-end: max(16px, calc((100% - 1120px) / 2)); top: 100%; z-index: 20; width: min(420px, calc(100% - 32px)); margin-top: 8px; background: var(--card); color: var(--ink); border: 4px solid #000; border-radius: 18px; box-shadow: 8px 8px 0 #000; padding: 1rem 1.2rem 1.1rem; display: grid; gap: .55rem; }
.a11y[hidden] { display: none; }
.a11y h2 { margin: 0 0 .2rem; font-size: 1.3rem; text-transform: none; }
.a11y-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.a11y-row span { flex-basis: 100%; font-weight: 800; }
.a11y-row button, .a11y-actions button { min-height: 44px; min-width: 44px; padding: .3rem .8rem; font: inherit; font-weight: 800; color: var(--ink); background: var(--paper-2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; }
.a11y-row button[aria-pressed="true"], .a11y-actions .a11y-read[aria-pressed="true"] { background: var(--night); color: #fff; }
.a11y-check { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 700; cursor: pointer; }
.a11y-check input { width: 24px; height: 24px; accent-color: var(--night); flex: none; }
.a11y-range { display: grid; gap: .2rem; font-weight: 800; }
.a11y-range input { width: 100%; accent-color: var(--night); min-height: 32px; }
.a11y-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 0; }
.a11y-actions .a11y-read { background: var(--gold); color: var(--night); }
@media (prefers-color-scheme: dark) { .a11y-check input, .a11y-range input { accent-color: var(--gold); } }

/* report a problem */
.report { font-size: .95rem; color: var(--muted); border-top: 3px dashed var(--line); padding-top: 1rem; margin-top: 2rem; }

/* ===== reader settings (accessibility menu) ===== */
html[data-text="1"] { font-size: 125%; }
html[data-text="2"] { font-size: 140%; }
html[data-text="3"] { font-size: 160%; }

/* high contrast: pure black on white (or white on black in dark mode), no decorative shadows */
html[data-contrast] { --paper: #fff; --paper-2: #fff; --card: #fff; --ink: #000; --muted: #000; --line: #000; --teal: #0000c8; --pop-text: #000; --gold-deep: #000; }
html[data-contrast] body { background: #fff; color: #000; }
html[data-contrast] a { color: #0000c8; text-decoration: underline; }
html[data-contrast] .hero h1 { text-shadow: none; }
html[data-contrast] :is(.card a, .trust li, .box, .faq details) { box-shadow: none; }
@media (prefers-color-scheme: dark) {
  html[data-contrast] { --paper: #000; --paper-2: #000; --card: #000; --ink: #fff; --muted: #fff; --line: #fff; --teal: #ffff00; --pop-text: #fff; }
  html[data-contrast] body { background: #000; color: #fff; }
  html[data-contrast] a { color: #ffff00; }
}

/* colour-blind friendly: Okabe-Ito blue and orange, which stay distinct for protanopia, deuteranopia and
   tritanopia; links are always underlined so colour is never the only clue */
html[data-coloursafe] { --pop: #0072b2; --pop-text: #005a8c; --teal: #0057a8; --gold: #e69f00; --rose: #0072b2; }
html[data-coloursafe] .badge { background: #005a8c; }
html[data-coloursafe] .top, html[data-coloursafe] .foot { border-color: #e69f00; }
html[data-coloursafe] a { text-decoration: underline; }
html[data-coloursafe] .story-text .reading { background: rgba(86, 180, 233, .3); box-shadow: 0 0 0 .3rem rgba(86, 180, 233, .3); outline: 2px dashed #0072b2; }
@media (prefers-color-scheme: dark) { html[data-coloursafe] { --pop-text: #56b4e9; --teal: #56b4e9; } }

/* easy-to-read font: plain, wide letters, more space between letters and words, no capitals-only headings */
html[data-easyfont] body, html[data-easyfont] :is(h1, h2, h3, .cap, .bubble, .card strong, .logo span, .button, .badge) { font-family: Verdana, Tahoma, "Trebuchet MS", system-ui, sans-serif; }
html[data-easyfont] body { letter-spacing: .03em; word-spacing: .12em; }
html[data-easyfont] :is(h1, h2, .badge, .logo span) { text-transform: none !important; letter-spacing: .01em; }
html[data-easyfont] .story-text p:first-child::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; }

html[data-spacing] :is(p, li, dd, summary) { line-height: 2.1; }
html[data-spacing] :is(p, li) { margin-bottom: 1.2em; }
html[data-underline] a { text-decoration: underline !important; }
html[data-calm] *, html[data-calm] *::before, html[data-calm] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html[data-calm] :is(.badge, .strip .panel .frame, .bubble.shout) { transform: none !important; }
html[data-calm] :is(.button, .card a):hover { transform: none; }
@media (prefers-reduced-motion: reduce) { .badge, .strip .panel .frame { transform: none; } }

@media (max-width: 760px) {
  .music-btn span, .a11y-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .music-btn, .a11y-btn { padding: .35rem .7rem; }
}
@media print { .music-btn, .a11y-btn, .a11y, .report { display: none !important; } }
html[data-contrast] :is(.top, .foot) { background: #000; }
html[data-contrast] :is(.top, .foot) a, html[data-contrast] .logo { color: #fff; }
html[data-contrast] .foot a { color: #ffff00; }
html[data-contrast] .nav a { background: #000; border: 2px solid #fff; }
html[data-contrast] .nav a:last-child { background: #ffff00; color: #000; }
html[data-contrast] .a11y a { color: #0000c8; }
html[data-contrast] .badge { background: #000; color: #fff; }
