:root { --fg: #1a1a1a; --muted: #666; --line: #ddd; --accent: #0b57d0; --bg: #fff; --hl: #fff3b0; }
@media (prefers-color-scheme: dark) {
  :root { --fg: #e8e8e8; --muted: #9a9a9a; --line: #333; --accent: #8ab4f8; --bg: #121212; --hl: #4a4220; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.6 system-ui, -apple-system, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 24px 18px 160px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 4px 0 12px; }
h2 { font-size: 1.05rem; margin: 28px 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: .9rem; }
.passage p { margin: 0 0 14px; }
.w { cursor: pointer; border-radius: 3px; -webkit-tap-highlight-color: transparent; }
.w.sel { background: var(--hl); }
ul, ol { padding-left: 22px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
form { display: grid; gap: 10px; max-width: 320px; margin-top: 24px; }
input, button { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
button { cursor: pointer; background: var(--accent); color: #fff; border: 0; }
.error { color: #c5221f; min-height: 1.5em; }
#panel { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
#panel .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-start; }
#panel .word { font-weight: 700; font-size: 1.15rem; }
#panel .close { margin-left: auto; background: none; color: var(--muted); padding: 0 4px; font-size: 1.4rem; line-height: 1; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.linkbtn { background: none; color: var(--muted); padding: 0; font-size: .9rem; text-decoration: underline; }
