/* Structural defaults shared by all directions. Themes override look and layout. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg, #fff); color: var(--ink, #111); }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }

/* Mockup-only switcher (not part of the design) */
.mock-switcher { position: fixed; left: 12px; bottom: 12px; z-index: 100; display: flex; gap: 6px; align-items: center;
  padding: 6px 8px; border-radius: 10px; background: #111; color: #bbb; font: 12px/1.2 system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.mock-switcher a { color: #ddd; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.mock-switcher a.on { background: #fff; color: #111; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 24px; }
.topbar .spacer { flex: 1; }
.topbar .crumbs { display: flex; gap: 8px; white-space: nowrap; overflow: hidden; }
.topbar .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.progress-bar { height: 100%; width: 0; transition: width .15s linear; }

/* Layout */
.shell { margin: 0 auto; }
.outline, .rail { display: none; }
.lesson { min-width: 0; }

/* Article */
article p, .quiz p { margin: 0 0 1.05em; }
article h2, .quiz h2 { scroll-margin-top: 90px; }
.mock-note { opacity: .6; font-style: italic; }

/* Probability table */
.prob-table { margin: 1.6em 0; }
.prob-table table { border-collapse: collapse; width: 100%; }
.prob-table th, .prob-table td { text-align: left; padding: .5em .8em; }
.prob-table td:last-child { width: 55%; white-space: nowrap; }
.prob-table .bar { display: inline-block; height: .55em; width: calc(var(--p) * 1.6%); margin-right: .6em; vertical-align: middle; border-radius: 3px; }

/* Term card + highlighted terms */
.term-card { margin: 1.4em 0 1.6em; padding: 16px 18px; }
.term-card .term-def { margin: .3em 0 .8em; }
.term-add { border: 0; padding: 6px 12px; }
.term-hl { cursor: help; }
.tooltip { position: absolute; z-index: 60; max-width: 300px; padding: 10px 12px; pointer-events: none; }
.tooltip b { display: block; margin-bottom: 2px; }

/* Illustration placeholder */
.illustration-slot { margin: 1.6em 0; min-height: 180px; display: grid; place-items: center; text-align: center; padding: 20px; }

/* Selection popover */
.sel-pop { position: absolute; z-index: 70; display: flex; gap: 2px; padding: 4px; }
.sel-pop button { border: 0; background: none; padding: 7px 10px; white-space: nowrap; }

/* Drawer */
.drawer { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); padding: 20px; overflow: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-close { border: 0; background: none; font-size: 26px; line-height: 1; }
.drawer-quote { margin: 0 0 14px; padding: 10px 14px; }
.agnes-form, .fb-form { display: flex; gap: 8px; margin-top: 14px; }
.fb-form { flex-direction: column; }
.agnes-form input, .fb-form textarea { flex: 1; font: inherit; padding: 10px 12px; }
.agnes-form button, .fb-form button { border: 0; padding: 10px 14px; }
.agnes-msg.typing { opacity: .6; }
.drawer .dict-list { padding: 0; list-style: none; }
.dict-list { list-style: none; margin: 0; padding: 0; }
.dict-list li { padding: 8px 0; }
.dict-list li b { display: block; }
.dict-list li.empty { opacity: .65; }

/* Toast */
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; max-width: min(520px, 92vw); }

/* Quiz */
.quiz { margin: 3em 0 2em; }
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.quiz-options { display: grid; gap: 10px; margin: 1em 0; }
.opt { text-align: left; padding: 14px 16px; }
.quiz.answered .opt { cursor: default; }
.quiz-explain p { margin: 0 0 .5em; }
.quiz-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 1em; }
.quiz-next { border: 0; padding: 10px 16px; }
.quiz-next:disabled { opacity: .4; cursor: default; }

/* Lesson navigation */
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 3em 0 6em; flex-wrap: wrap; }
.lesson-nav .muted { opacity: .55; }
.lesson-nav .done { border: 0; padding: 12px 20px; }
