/* Shared additions for the public site: language switcher, book pages,
   the tap-a-word reader and the level test. Builds on legal.css tokens. */
:root { --card:#fffdf6; --hl:#e3ead9; --accent:#be6548; --ok:#2f6b45; --bad:#9b3b2a; }
@media (prefers-color-scheme:dark) { :root { --card:#203229; --hl:#3a5143; --accent:#e39a7f; --ok:#9fd3a8; --bad:#f0a593; } }
.langs a { display:inline-block; min-height:44px; padding:10px 4px; box-sizing:border-box; }
.langs { display:flex; flex-wrap:wrap; gap:0 12px; margin:-18px 0 26px; font-size:15px; }
.langs a[aria-current="page"] { font-weight:700; text-decoration:none; color:var(--ink); }
.cta { display:inline-block; margin:6px 0; padding:12px 22px; border-radius:999px; background:var(--link); color:var(--paper); font-weight:600; text-decoration:none; }
.cta:hover { filter:brightness(1.08); }
.try { padding:4px 22px 8px; border:1px solid var(--line); border-radius:20px; background:var(--card); }
.crumbs { font-size:15px; margin:-14px 0 18px; color:var(--muted); }
.lead { font-size:20px; }
.note { font-size:15px; color:var(--muted); }
.chips { display:flex; flex-wrap:wrap; gap:8px; padding:0; margin:12px 0; list-style:none; }
.chips li { margin:0; }
.chips a, .chips span { display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box; min-width:48px; min-height:44px; padding:4px 12px; border:1px solid var(--line); border-radius:999px; text-align:center; text-decoration:none; }
.chips span[aria-current] { background:var(--link); color:var(--paper); border-color:var(--link); font-weight:700; }
.book-list { list-style:none; padding:0; }
.book-list > li { display:flex; gap:18px; align-items:flex-start; margin:0 0 28px; }
.book-list img { width:96px; height:auto; border-radius:8px; flex:none; box-shadow:0 2px 8px rgb(0 0 0 / .15); }
.book-list h2 { margin:0 0 4px; font-size:22px; }
.book-list p { margin:4px 0; }
.book-head { display:flex; gap:20px; align-items:flex-start; }
.book-head img { width:132px; height:auto; border-radius:10px; flex:none; box-shadow:0 2px 10px rgb(0 0 0 / .18); }
.book-head h1 { margin-top:0; font-size:32px; }
.edition-options { margin:8px 0; }
.edition-options summary { min-height:44px; align-content:center; cursor:pointer; color:var(--link); }
@media (max-width:520px) { .book-head { gap:12px; } .book-head img { width:72px; } .book-head h1 { font-size:26px; } .book-list img { width:72px; } }
.multi p { margin:4px 0; font-size:15px; color:var(--muted); }

/* Reader */
.reader-bar { position:sticky; top:0; z-index:2; display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:24px -8px 8px; padding:10px 8px; background:var(--paper); border-bottom:1px solid var(--line); font-size:15px; }
.reader-bar button, .quiz button, .meaning button { font:inherit; color:inherit; cursor:pointer; }
.seg { display:inline-flex; flex-wrap:wrap; max-width:100%; box-sizing:border-box; border:1px solid var(--line); border-radius:999px; overflow:hidden; }
.seg button { padding:6px 11px; border:0; background:transparent; min-height:44px; }
.seg button[aria-pressed="true"] { background:var(--link); color:var(--paper); font-weight:600; }
.reader h2 { margin-top:28px; }
@media (max-width:520px) { .reader-bar .bar-label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); } .reader-bar { gap:4px 10px; } .seg button { padding:6px 9px; } }
@media (max-width:360px) { .seg { border-radius:16px; } .seg button { padding:6px 4px; } }
.reader p { font:20px/1.75 Georgia,serif; white-space:pre-line; margin:0 0 1em; }
.reader figure { margin:20px 0 26px; text-align:center; }
.reader figure img { width:auto; max-width:100%; max-height:70vh; height:auto; border-radius:12px; }
.w { cursor:pointer; border-radius:4px; transition:background .1s; -webkit-tap-highlight-color:transparent; }
.w:hover { background:var(--hl); }
.w.on { background:var(--ink); color:var(--paper); }
.w:focus { outline:none; }
.w:focus-visible { outline:3px solid var(--link); outline-offset:2px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.meaning { position:fixed; z-index:5; left:0; right:0; bottom:0; max-height:55vh; overflow:auto; padding:16px 20px calc(18px + env(safe-area-inset-bottom)); background:var(--card); border-top:1px solid var(--line); box-shadow:0 -6px 24px rgb(0 0 0 / .18); }
.meaning-inner { max-width:760px; margin:auto; position:relative; }
.meaning .word { font:700 22px Georgia,serif; margin:0 40px 2px 0; }
.meaning .tr { font-size:22px; margin:0; }
.meaning .ex { margin:4px 0 0; color:var(--muted); font-size:16px; }
.meaning .sent-text { display:block; }
.meaning .sent { margin:12px 0 0; padding-top:10px; border-top:1px solid var(--line); font-size:16px; }
.meaning p { margin:0; }
.meaning .label { margin:2px 0 6px; font-size:14px; }
.meaning .sent .sent-label { display:block; font-size:13px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.meaning .close { position:absolute; top:-4px; right:-6px; width:44px; height:44px; border:0; background:transparent; font-size:26px; line-height:1; }
body.has-meaning main { padding-bottom:60vh; }
.end { margin:36px 0; padding:22px; border:1px solid var(--line); border-radius:20px; background:var(--card); }
.end h2 { margin-top:0; }
.chapter-share button { min-height:44px; padding:6px 12px; border:1px solid var(--line); border-radius:8px; background:var(--paper); color:var(--ink); font:inherit; cursor:pointer; }
.chapter-share input { display:block; box-sizing:border-box; width:100%; margin-top:8px; padding:8px; background:var(--paper); color:var(--ink); border:1px solid var(--line); font:inherit; }
.chapter-share input[hidden] { display:none; }

/* Level test */
.quiz { margin-top:20px; }
.quiz .passage { padding:16px 18px; border-left:4px solid var(--line); background:var(--card); border-radius:0 12px 12px 0; font:18px/1.7 Georgia,serif; }
.quiz .prompt { font-weight:600; }
.quiz .options { display:grid; gap:10px; margin:16px 0; padding:0; list-style:none; }
.quiz .options li { margin:0; }
.quiz .options button { width:100%; min-height:48px; padding:10px 16px; text-align:left; border:1px solid var(--line); border-radius:14px; background:var(--card); }
.quiz .options button:hover:not(:disabled) { border-color:var(--link); }
.quiz .options button.right { border:2px solid var(--ok); }
.quiz .options button.wrong { border:2px solid var(--bad); }
.quiz .options button:disabled { cursor:default; }
.quiz .feedback { margin:8px 0 14px; }
.quiz .feedback:empty { margin:0; }
.quiz .feedback strong.ok { color:var(--ok); } .quiz .feedback strong.bad { color:var(--bad); }
.quiz .options .mark { display:block; margin-top:4px; font-size:15px; font-weight:700; }
.quiz .options .mark.ok { color:var(--ok); } .quiz .options .mark.bad { color:var(--bad); }
.quiz .options button { overflow-wrap:anywhere; }
.quiz .progress:focus { outline:none; }
.quiz .progress { font-size:15px; color:var(--muted); }
.quiz .primary { padding:12px 24px; border:0; border-radius:999px; background:var(--link); color:var(--paper); font-weight:600; min-height:48px; }
.quiz .secondary { padding:10px 20px; border:1px solid var(--line); border-radius:999px; background:transparent; min-height:44px; }
.result-level { font:700 64px/1 Georgia,serif; margin:8px 0; }
/* Visible keyboard focus on every control (links get theirs from legal.css). */
button:focus-visible { outline:3px solid var(--link); outline-offset:3px; }
.seg button:focus-visible { outline-offset:-3px; }
.result h2:focus { outline:none; }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } *, *::before, *::after { transition:none !important; animation:none !important; } }
[hidden] { display:none !important; }
