/* QUIZ-WORLD shared header: one navigation for the home page, quiz library, quiz creator and join pages. */
.qw-header {
  --qw-bg: var(--bg); --qw-text: var(--text); --qw-muted: var(--text-muted); --qw-border: var(--border); --qw-hover: var(--surface);
  --qw-primary: var(--accent); --qw-primary-hover: var(--accent); --qw-on-primary: var(--accent);
  position: sticky; top: 0; z-index: 200; width: 100%; box-sizing: border-box;
  background: var(--qw-bg); color: var(--qw-text); border-bottom: 1px solid var(--qw-border);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  font: 500 15px/1.2 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
html[data-theme="dark"] .qw-header {
  --qw-bg: var(--surface); --qw-text: var(--text); --qw-muted: var(--text-muted); --qw-border: var(--border); --qw-hover: var(--surface);
  --qw-primary: var(--accent); --qw-primary-hover: var(--accent); --qw-on-primary: var(--accent);
}
.qw-header *, .qw-header *::before, .qw-header *::after { box-sizing: border-box; }
.qw-header-inner { display: flex; align-items: center; gap: 8px; max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); min-height: 64px; }
.qw-brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight:600; font-size: 18px; letter-spacing: -.02em; margin-right: 12px; flex: 0 0 auto; }
.qw-brand img { width: 36px; height: 36px; object-fit: contain; display: block; }
.qw-brand .qw-logo-dark { display: none; }
html[data-theme="dark"] .qw-brand .qw-logo-light { display: none; }
html[data-theme="dark"] .qw-brand .qw-logo-dark { display: block; }
.qw-menu { display: flex; align-items: center; flex: 1 1 auto; gap: 8px; min-width: 0; }
.qw-links { display: flex; align-items: center; gap: 2px; }
.qw-links a {
  position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-input);
  color: var(--qw-muted); text-decoration: none; font-weight: 600; white-space: nowrap; transition: color .15s, background .15s;
}
.qw-links a:hover { color: var(--qw-text); background: var(--qw-hover); }
.qw-links a[aria-current="page"] { color: var(--qw-text); }
.qw-links a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius:2px; background: var(--qw-primary); }
.qw-links-site { margin-left: auto; padding-left: 14px; border-left: 1px solid var(--qw-border); }
.qw-links-site a { font-weight:600; font-size: 14px; }
.qw-actions { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
/* The theme toggle, Sign-in pill and burger are buttons: qw-buttons.css styles them. Only layout lives here. */
.qw-theme { display: inline-grid; place-items: center; }
.qw-theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* the icon shows the current theme: sun = light, cup = sepia, moon = dark */
.qw-theme :is(.qw-sun, .qw-cup, .qw-moon) { display: none; }
html:not([data-theme="dark"]):not([data-theme="sepia"]) .qw-theme .qw-sun { display: block; }
html[data-theme="sepia"] .qw-theme .qw-cup { display: block; }
html[data-theme="dark"] .qw-theme .qw-moon { display: block; }
.qw-header a:focus-visible, .qw-header button:focus-visible { outline: 3px solid var(--qw-primary); outline-offset: 2px; }
.qw-burger { display: none; margin-left: auto; }
.qw-burger span { display: block; width: 22px; height: 2px; margin: 5px auto; border-radius:2px; background: var(--qw-text); transition: transform .2s, opacity .2s; }
.qw-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.qw-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.qw-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1100px) {
  .qw-header-inner { min-height: 58px; flex-wrap: wrap; }
  .qw-burger { display: block; }
  .qw-menu { display: none; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 14px; padding: 8px 0 18px; border-top: 1px solid var(--qw-border); margin-top: 4px; }
  .qw-menu.is-open { display: flex; }
  .qw-links { flex-direction: column; align-items: stretch; gap: 2px; }
  .qw-links a { min-height: 48px; font-size: 16px; padding: 0 12px; }
  .qw-links a[aria-current="page"]::after { left: 12px; right: auto; width: 24px; bottom: 6px; }
  .qw-links-site { margin: 0; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--qw-border); }
  .qw-actions { margin: 0; justify-content: space-between; }
  .qw-cta { flex: 1 1 auto; min-height: 48px; font-size: 16px; }
  .qw-theme { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .qw-header * { transition: none !important; } }
@media print { .qw-header { display: none; } }

/* Pages that keep their own tools (library search, quiz creator) lose only the duplicate brand, chips and theme button. */
.qw-has-nav .menu-brand, .qw-has-nav #menuThemeBtn, .qw-has-nav .app-topbar { display: none !important; }
.qw-has-nav .menu-toolbar { position: static; }

/* With the dock on screen the page links live in the dock; the header stays slim. */
.qw-header.is-compact .qw-links:not(.qw-links-site) { display: none; }
