:root { --demo-toolbar-height: 62px; }
.demo-toolbar, .demo-dialog, .demo-toast { font-family: system-ui, sans-serif; }
.demo-toolbar { box-sizing: border-box; position: fixed; inset: 0 0 auto; z-index: 3000; min-height: var(--demo-toolbar-height); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: #225b88; color: #fff; border-bottom: 1px solid #ffffff40; font-size: 13px; }
.demo-toolbar-brand, .demo-toolbar-actions, .demo-toolbar-extra { display: flex; align-items: center; gap: 10px; }
.demo-toolbar-brand > a { font-size: 22px; font-weight: 650; letter-spacing: -.05em; }
.demo-toolbar a { color: inherit; text-decoration: none; }
.demo-toolbar-extra > a { padding: 8px; }
.demo-badge { border: 1px solid #b5d4e9; padding: 3px 7px; border-radius: 3px; color: #e1f1fb; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.demo-toolbar select, .demo-toolbar button { box-sizing: border-box; font: inherit; min-height: 34px; border: 1px solid #a6c7de; border-radius: 5px; padding: 6px 10px; color: #fff; background: #1b4c72; cursor: pointer; }
.demo-toolbar #demo-vocabulary { appearance: auto; width: 170px; max-width: 170px; height: 34px; line-height: normal; background-image: none; }
.demo-toolbar #demo-toolbar-more { display: none; }
.demo-toolbar option { color: #fff; background: #1b4c72; }
.demo-toolbar button:hover, .demo-toolbar select:hover { background: #3273a2; }
.demo-toolbar :focus-visible, .demo-dialog :focus-visible { outline: 3px solid #d7efff; outline-offset: 3px; }
.demo-toolbar button:disabled { opacity: .6; }
[data-demo-card-count] { display: inline-grid; place-items: center; min-width: 17px; height: 17px; background: #ffffff35; border-radius: 3px; margin-left: 3px; }
body[data-demo-page="reader"] { padding-top: var(--demo-toolbar-height); height: calc(100dvh - var(--demo-toolbar-height)); }
body[data-demo-page="reader"] #sidebar-toggle, body[data-demo-page="reader"] #nav-home-btn, body[data-demo-page="reader"] #seg-toggle, body[data-demo-page="reader"] #stats-btn { top: calc(var(--demo-toolbar-height) + 10px); }
.demo-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 110000; box-sizing: border-box; max-width: min(540px, calc(100vw - 24px)); width: max-content; padding: 12px 18px; color: #fff; background: #252525; border: 1px solid #777; border-radius: 8px; box-shadow: 0 5px 25px #0002; font-size: 13px; line-height: 1.6; }
.demo-toast[hidden] { display: none; }
.demo-dialog { box-sizing: border-box; color: var(--text-body); background: var(--bg-base); border: 1px solid var(--border); border-radius: 12px; padding: 26px; width: min(540px, calc(100vw - 32px)); max-height: 80dvh; line-height: 1.65; }
.demo-dialog::backdrop { background: #171717c2; }
.demo-dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.demo-dialog-heading h2 { font-size: 21px; margin: 0; }
.demo-dialog-heading button { border: 0; background: transparent; font-size: 26px; cursor: pointer; color: inherit; padding: 0 8px; }
.demo-dialog a { color: var(--accent-interactive); }
.demo-saved-card { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 20px; }
.demo-saved-card h3 { margin: 0; font-size: 26px; }
.demo-saved-card p { margin: 6px 0; }
.demo-card-pinyin { color: var(--accent-primary); }
/* Only make room for the toolbar; Mogao owns all application styling. */
body[data-demo-page="library"], body[data-demo-page="video-library"], body[data-demo-page="known-words"] { border-top: var(--demo-toolbar-height) solid transparent; }
body[data-demo-page="video"] { padding-top: var(--demo-toolbar-height); height: calc(100dvh - var(--demo-toolbar-height)); }
@media (max-width: 768px) {
  :root { --demo-toolbar-height: 58px; }
  .demo-toolbar { padding: 8px 12px; gap: 8px; }
  .demo-toolbar-brand { flex: none; }
  .demo-toolbar-brand > a { font-size: 20px; }
  .demo-badge { display: none; }
  .demo-toolbar-actions { flex: none; gap: 6px; }
  .demo-toolbar #demo-vocabulary { flex: none; width: 170px; max-width: 170px; }
  .demo-toolbar button, .demo-toolbar select { font-size: 12px; padding: 6px 8px; }
  .demo-toolbar #demo-toolbar-more { display: flex; align-items: center; justify-content: center; width: 36px; padding: 6px; }
  .demo-toolbar-extra { display: none; position: absolute; top: calc(100% + 4px); right: 12px; width: 170px; padding: 6px; background: #225b88; border: 1px solid #a6c7de; border-radius: 8px; box-shadow: 0 8px 20px #0005; }
  .demo-toolbar-extra[data-open] { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
  .demo-toolbar-extra > button, .demo-toolbar-extra > a { width: 100%; text-align: left; }
  .demo-toolbar-extra > a { box-sizing: border-box; padding: 9px 8px; border-radius: 5px; }
  .demo-toolbar-extra > a:hover { background: #3273a2; }
  body[data-demo-page="reader"] #sidebar { top: var(--demo-toolbar-height); height: calc(100dvh - var(--demo-toolbar-height)); }
}
@media (max-width: 360px) {
  .demo-toolbar { padding-inline: 8px; gap: 4px; }
  .demo-toolbar-brand > a { font-size: 18px; }
  .demo-toolbar-actions { gap: 4px; }
  .demo-toolbar #demo-vocabulary { width: 144px; max-width: 144px; font-size: 11px; padding-inline: 5px; }
  .demo-toolbar #demo-vocabulary-info { padding-inline: 5px; }
  .demo-toolbar #demo-toolbar-more { width: 34px; }
}
