/* Fischietto: design system shared by the portal and the management panel */

@font-face {
  font-family: 'Stack Sans Notch';
  src: url('/fonts/StackSansNotch.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #14264A;
  --blue: #2F6FD0;
  --blue-strong: #2459AD;
  --blue-soft: #E6EEFB;
  --amber: #F6BB42;
  --amber-strong: #B57A0C;
  --amber-soft: #FDF3DC;
  --green: #1F8A5B;
  --green-soft: #E3F4EC;
  --red: #C8412F;
  --red-soft: #FBE7E4;

  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --inset: #EBEFF5;
  --text: #14264A;
  --text-2: #4B5B78;
  --text-3: #7A879E;
  --line: #DCE2EC;
  --line-soft: #E8ECF3;
  --focus: #2F6FD0;
  --on-primary: #FFFFFF;
  --hero: #14264A;
  --on-hero: #F3F5F9;

  --src-rg: #2F6FD0;
  --src-cas: #7B55C7;
  --src-it: #0E8C8C;
  --src-nf: #C2562B;
  --src-vad: #B57A0C;

  --shadow-1: 0 1px 2px rgba(20, 38, 74, .06);
  --shadow-2: 0 2px 6px rgba(20, 38, 74, .06), 0 10px 24px -12px rgba(20, 38, 74, .18);
  --shadow-3: 0 18px 50px -12px rgba(20, 38, 74, .35);

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-score: 'Barlow Semi Condensed', 'Inter', system-ui, sans-serif;
  --font-brand: 'Stack Sans Notch', 'Inter', sans-serif;

  --topbar-h: 64px;
  --bottomnav-h: 64px;
  --page-w: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E7ECF5;
    --blue: #6AA1EE;
    --blue-strong: #8DB7F3;
    --blue-soft: #18294A;
    --amber: #F6BB42;
    --amber-strong: #F6BB42;
    --amber-soft: #33290F;
    --green: #4CC08A;
    --green-soft: #133126;
    --red: #F0806F;
    --red-soft: #3A1B17;
    --bg: #0C1524;
    --surface: #142036;
    --surface-2: #17253D;
    --inset: #0F1A2D;
    --text: #E7ECF5;
    --text-2: #A9B5CA;
    --text-3: #75839C;
    --line: #26354F;
    --line-soft: #1D2B43;
    --focus: #8DB7F3;
    --on-primary: #0C1524;
    --hero: #1C3260;
    --on-hero: #EEF2F9;
    --src-rg: #6AA1EE; --src-cas: #A88BEA; --src-it: #3EC1BE; --src-nf: #EE8E62; --src-vad: #F6BB42;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 28px -12px rgba(0, 0, 0, .6);
    --shadow-3: 0 18px 50px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E7ECF5;
  --blue: #6AA1EE;
  --blue-strong: #8DB7F3;
  --blue-soft: #18294A;
  --amber: #F6BB42;
  --amber-strong: #F6BB42;
  --amber-soft: #33290F;
  --green: #4CC08A;
  --green-soft: #133126;
  --red: #F0806F;
  --red-soft: #3A1B17;
  --bg: #0C1524;
  --surface: #142036;
  --surface-2: #17253D;
  --inset: #0F1A2D;
  --text: #E7ECF5;
  --text-2: #A9B5CA;
  --text-3: #75839C;
  --line: #26354F;
  --line-soft: #1D2B43;
  --focus: #8DB7F3;
  --on-primary: #0C1524;
  --hero: #1C3260;
  --on-hero: #EEF2F9;
  --src-rg: #6AA1EE; --src-cas: #A88BEA; --src-it: #3EC1BE; --src-nf: #EE8E62; --src-vad: #F6BB42;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 28px -12px rgba(0, 0, 0, .6);
  --shadow-3: 0 18px 50px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'cv11', 'ss01';
  accent-color: var(--blue);
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, select, textarea, label, [role=button], [role=checkbox] { touch-action: manipulation; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
svg { flex-shrink: 0; }
.scoreboard { font-family: var(--font-score); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.green { color: var(--green) !important; }
.red { color: var(--red) !important; }
.gold { color: var(--amber-strong) !important; }
.center { text-align: center; }
.spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 600; font-size: .92rem; line-height: 1; white-space: nowrap;
  text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--on-primary); box-shadow: var(--shadow-1); }
.btn-primary:hover:not(:disabled) { background: var(--blue-strong); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--inset); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.95); }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: transparent; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--red-soft); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .84rem; border-radius: var(--r-xs); }
.btn-lg { min-height: 50px; font-size: 1rem; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; font-size: .85rem;
}
.btn-link:hover { text-decoration: underline; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-xs); color: var(--text-3);
}
.icon-btn:hover:not(:disabled) { background: var(--inset); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Form ---------- */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.form-field > label, .label-row label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.form-input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea.form-input { min-height: 0; resize: vertical; line-height: 1.5; }
.form-input:hover { border-color: var(--text-3); }
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.form-hint { font-size: .8rem; color: var(--text-3); }
.form-msg { border-radius: var(--r-sm); padding: 10px 12px; font-size: .88rem; margin-bottom: 16px; border: 1px solid; }
.form-msg.error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red); }
.form-msg.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--text); }
.form-msg.success { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); }

.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 36px; border: 0; background: transparent; border-radius: var(--r-xs); color: var(--text-3);
  display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--text); background: var(--inset); }
.pw-toggle::before {
  content: ''; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
}
.pw-toggle.on::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.9 17.9A10 10 0 0112 19c-7 0-11-7-11-7a18 18 0 015.1-5.9M9.9 4.2A9 9 0 0112 4c7 0 11 7 11 7a18 18 0 01-2.2 3.2M14.1 14.1a3 3 0 01-4.2-4.2M1 1l22 22'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.9 17.9A10 10 0 0112 19c-7 0-11-7-11-7a18 18 0 015.1-5.9M9.9 4.2A9 9 0 0112 4c7 0 11 7 11 7a18 18 0 01-2.2 3.2M14.1 14.1a3 3 0 01-4.2-4.2M1 1l22 22'/%3E%3C/svg%3E");
}
.pw-strength { display: none; font-size: .8rem; color: var(--text-3); }
.pw-strength.show { display: block; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 2px 0 6px; }
.pw-meter span { height: 4px; border-radius: 2px; background: var(--inset); }
.pw-meter[data-level="1"] span:nth-child(-n+1) { background: var(--red); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--amber); }
.pw-meter[data-level="3"] span:nth-child(-n+3) { background: var(--blue); }
.pw-meter[data-level="4"] span { background: var(--green); }
.pw-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: var(--green); }
.pw-rules li.ok::before { content: '✓ '; }

/* Segmented control */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--inset); border-radius: var(--r-sm);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented > button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text-2);
  padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: .88rem; white-space: nowrap;
  transition: background .15s, color .15s;
}
.segmented > button:hover { color: var(--text); }
.segmented > button.active, .segmented > button[aria-checked="true"], .segmented > button[aria-selected="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-1);
}
.segmented-sm > button { padding: 5px 10px; font-size: .8rem; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--line); color: var(--text-2);
  font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.sub-tab.active .badge { background: var(--amber); color: #3A2A05; }

/* Switch */
.toggle-row {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none;
  font-size: .92rem;
}
.toggle-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-track {
  position: relative; flex-shrink: 0; width: 38px; height: 22px; margin-top: 1px;
  background: var(--line); border-radius: var(--r-pill); transition: background .18s;
}
.toggle-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s;
}
.toggle-row input:checked + .toggle-track { background: var(--blue); }
.toggle-row input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-row input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle-row strong { display: block; font-weight: 600; }
.toggle-row small { display: block; color: var(--text-3); font-size: .8rem; line-height: 1.4; }
.toggle-compact { align-items: center; white-space: nowrap; }
.toggle-compact .toggle-track { margin-top: 0; }

/* Chip */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip, .chip-check, .q-count-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: .88rem; font-weight: 600; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
@media (hover: hover) {
  .filter-chip:hover, .chip-check:hover, .q-count-chip:hover { border-color: var(--text-3); color: var(--text); }
}
.filter-chip.active, .q-count-chip.active {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}
.chip-check.checked { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 55%, transparent); color: var(--blue-strong); }
.checkbox-grid .chip-check::before { content: ''; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--surface); }
.checkbox-grid .chip-check.checked::before {
  border-color: var(--blue);
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/10px no-repeat;
}
.filter-chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Source labels */
.ref-source-tag {
  display: inline-grid; place-items: center; min-width: 40px; height: 22px; padding: 0 7px;
  border-radius: 5px; font-size: .7rem; font-weight: 700; letter-spacing: .02em;
  color: var(--src, var(--src-rg)); background: color-mix(in srgb, var(--src, var(--src-rg)) 14%, transparent);
}
.rg { --src: var(--src-rg); }
.cas { --src: var(--src-cas); }
.it { --src: var(--src-it); }
.nf { --src: var(--src-nf); }
.vad { --src: var(--src-vad); }

.role-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 700; background: var(--inset); color: var(--text-2);
}
.role-badge.editor { background: color-mix(in srgb, var(--src-it) 16%, transparent); color: var(--src-it); }
.role-badge.admin { background: var(--blue-soft); color: var(--blue); }
.role-badge.master { background: var(--amber-soft); color: var(--amber-strong); }

/* ---------- Startup ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg); color: var(--text-2); padding: 24px; text-align: center;
}
.boot-ball { animation: spin 1.6s cubic-bezier(.5,.1,.5,.9) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sign in ---------- */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-screen.overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); overflow: auto; }
.auth-screen.overlay .auth-side { display: none; }
.auth-layout {
  flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 48px 20px 24px;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center;
}
.auth-screen.overlay .auth-layout { grid-template-columns: minmax(0, 420px); justify-content: center; }
.auth-ball { display: block; margin-bottom: 26px; }
.auth-heading { font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 700; color: var(--ink); }
.auth-tagline { margin-top: 6px; font-weight: 600; color: var(--text-2); font-size: 1.05rem; }
.auth-pitch { margin-top: 14px; font-size: 1.05rem; color: var(--text-2); max-width: 42ch; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; color: var(--text-2); font-size: .93rem; max-width: 46ch; }
.auth-points li { position: relative; padding-left: 26px; }
.auth-points li::before {
  content: ''; position: absolute; left: 0; top: .45em; width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(var(--amber) 0 33%, #5D9CEC 0 66%, #FFCE54 0);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; box-shadow: var(--shadow-2); width: 100%;
}
.auth-tabs { width: 100%; margin-bottom: 22px; }
.auth-tabs > button { flex: 1; justify-content: center; }
.auth-panel { text-align: left; }
.auth-panel h2 { font-size: 1.3rem; letter-spacing: -.01em; margin-bottom: 8px; }
.auth-panel > p { color: var(--text-2); margin-bottom: 20px; font-size: .93rem; }
.auth-panel .btn + .btn { margin-top: 8px; }
.auth-panel-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 16px;
  background: var(--blue-soft); color: var(--blue);
}
.auth-panel-icon.warn { background: var(--amber-soft); color: var(--amber-strong); }

/* ---------- Portal layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-soft);
  padding-top: env(safe-area-inset-top, 0);
}
.topbar-inner {
  max-width: var(--page-w); margin: 0 auto; height: var(--topbar-h); padding: 0 20px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: .74rem; color: var(--text-3); }
.mainnav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .92rem;
  padding: 8px 12px; border-radius: var(--r-sm); text-decoration: none !important; position: relative;
}
.nav-link:hover { color: var(--text); background: var(--inset); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 3px; border-radius: 3px 3px 0 0; background: var(--amber);
}
.nav-admin { margin-left: auto; color: var(--blue); }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.mainnav + .topbar-right { margin-left: 0; }

.sync-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sync-indicator[data-state="saving"] .sync-dot { background: var(--amber); animation: pulse 1s infinite; }
.sync-indicator[data-state="error"] .sync-dot, .sync-indicator[data-state="auth"] .sync-dot { background: var(--red); }
.sync-indicator[data-state="error"], .sync-indicator[data-state="auth"] { color: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.settings-dropdown-wrapper { position: relative; }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: .85rem; letter-spacing: .02em;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line);
}
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--amber); }
.settings-dropdown {
  position: fixed; z-index: 80;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) - 4px);
  right: max(12px, calc((100vw - var(--page-w)) / 2 + 12px));
  width: 300px; max-height: calc(100dvh - 90px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); padding: 6px; animation: pop .15s ease-out;
}
.settings-account { padding: 12px 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.menu-avatar, .profile-avatar {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: .9rem;
}
.avatar-btn, .menu-avatar, .profile-avatar, .u-avatar, .side-avatar { overflow: hidden; }
.avatar-btn img, .menu-avatar img, .profile-avatar img, .u-avatar img, .side-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.avatar-btn.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--amber); }
.settings-account-name { font-weight: 700; }
.settings-account-meta { color: var(--text-3); font-size: .84rem; margin-bottom: 8px; word-break: break-all; }
.settings-dropdown-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.settings-group-label { font-size: .75rem; font-weight: 600; color: var(--text-3); padding: 6px 12px 2px; }
.settings-dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; background: transparent; border-radius: var(--r-xs); text-align: left;
  color: var(--text); font-size: .9rem; text-decoration: none !important;
}
.settings-dropdown-item svg { color: var(--text-3); }
.settings-dropdown-item:hover { background: var(--inset); }
.settings-dropdown-danger, .settings-dropdown-danger svg { color: var(--red); }
.settings-dropdown-danger:hover { background: var(--red-soft); }
.settings-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; font-size: .9rem; }

/* Footer always at the bottom: the content takes up the free space */
#app-root:not([hidden]) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.page { max-width: var(--page-w); width: 100%; margin: 0 auto; padding: 28px 20px 40px; flex: 1 0 auto; }
.section { display: none; }
.section.active { display: block; animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.sub-section { display: none; }
.sub-section.active { display: block; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.05rem); letter-spacing: -.025em; line-height: 1.15; font-weight: 700; color: var(--ink); }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 64ch; }
.sub-tabs { margin-bottom: 22px; }
.block-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; margin: 32px 0 12px; }
.section-intro { color: var(--text-2); margin-bottom: 16px; }
.empty-state, .refs-empty, .stats-empty {
  padding: 28px 20px; text-align: center; color: var(--text-3); font-size: .92rem;
  border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.stats-empty { padding: 18px; }

body.quiz-running #sec-quiz .page-head, body.quiz-running #quiz-sub-tabs { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--page-w); margin: 0 auto; padding: 22px 20px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--text-3); font-size: .85rem; border-top: 1px solid var(--line-soft);
  width: 100%; flex-shrink: 0;
}
.auth-screen .site-footer { border-top: 0; justify-content: center; gap: 6px 18px; width: 100%; }
.credit { color: var(--text-3); text-decoration: none !important; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credit-name {
  font-family: var(--font-brand); font-size: 1.02rem; color: var(--text); letter-spacing: .01em;
  transition: color .15s;
}
.credit:hover .credit-name { color: var(--blue); }
.credit-heart { color: #F2A27A; flex-shrink: 0; margin: 0 -1px; }
.credit:hover .credit-heart { animation: heartbeat .9s ease-in-out; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.22); } 60% { transform: scale(.95); } }
@media (prefers-reduced-motion: reduce) { .credit:hover .credit-heart { animation: none; } }
.app-version { font-variant-numeric: tabular-nums; font-size: .78rem; }

/* ---------- Mobile navigation ---------- */
.bottomnav { display: none; }

/* ---------- Toasts and modals ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: var(--r-sm);
  font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 15, 30, .5); backdrop-filter: blur(3px); animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal-box {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow-3); animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 8px; }
.modal-text { color: var(--text-2); margin-bottom: 16px; font-size: .93rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Quiz: setup ---------- */
.quiz-setup { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.setup-main { display: grid; gap: 14px; }
.setup-block {
  margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); padding: 18px 20px 20px;
}
.setup-block legend { float: left; width: 100%; padding: 0; margin-bottom: 12px; font-weight: 700; font-size: .98rem; }
.setup-block legend + * { clear: both; }
.setup-block-head { display: flex; justify-content: space-between; align-items: baseline; }
.setup-block-head legend { width: auto; }
.setup-quick { display: flex; gap: 14px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 8px; clear: both; }
.source-grid .chip-check {
  border-radius: var(--r-sm); min-height: 58px; padding: 10px 12px 10px 40px; position: relative;
  flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: 1.25;
  color: var(--text);
}
.source-grid .chip-check::before {
  content: ''; position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 5px; border: 2px solid var(--line); background: var(--surface); transition: all .15s;
}
.source-grid .chip-check.checked {
  background: color-mix(in srgb, var(--src) 9%, var(--surface)); border-color: color-mix(in srgb, var(--src) 55%, transparent); color: var(--text);
}
.source-grid .chip-check.checked::before {
  background: var(--src) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
  border-color: var(--src);
}
.chip-count { font-size: .78rem; font-weight: 500; color: var(--text-3); }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; clear: both; }
.q-count-chips { display: flex; flex-wrap: wrap; gap: 8px; clear: both; }
.q-count-chip { min-width: 52px; justify-content: center; font-variant-numeric: tabular-nums; }
.q-count-custom { border-style: dashed; }
.q-count-custom-row { display: flex; gap: 8px; margin-top: 12px; max-width: 260px; }
.num-input { min-height: 36px; padding: 6px 10px; }
.switch-list { display: grid; gap: 16px; clear: both; }

.setup-summary {
  position: sticky; top: calc(var(--topbar-h) + 20px);
  background: var(--hero); color: var(--on-hero); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow-2); overflow: hidden; isolation: isolate;
}
.setup-summary::after {
  content: ''; position: absolute; z-index: -1; right: -60px; bottom: -60px; width: 190px; height: 190px; opacity: .1;
  background: url('icons/icon.svg') center/contain no-repeat;
}
.summary-title { font-weight: 600; opacity: .8; font-size: .9rem; }
.summary-score { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.summary-score .scoreboard { font-size: 4.2rem; line-height: 1; color: var(--amber); }
.summary-unit { font-size: 1rem; font-weight: 600; opacity: .85; }
.summary-avail { font-size: .86rem; opacity: .75; margin-top: 4px; }
.summary-sources { list-style: none; padding: 0; margin: 16px 0 20px; display: flex; flex-wrap: wrap; gap: 6px; }
.summary-sources li {
  font-size: .76rem; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--on-hero) 14%, transparent);
}
.summary-sources li.none { background: transparent; padding-left: 0; opacity: .7; font-weight: 500; }
.setup-summary .btn-primary { background: var(--amber); color: #2A1E04; box-shadow: none; }
.setup-summary .btn-primary:hover:not(:disabled) { background: #FFCE54; }
.summary-toggle { margin: 0 0 14px; }
.summary-toggle small { color: inherit; opacity: .7; }
.summary-toggle .toggle-track { background: color-mix(in srgb, var(--on-hero) 25%, transparent); }
.summary-toggle input:checked + .toggle-track { background: var(--amber); }
.sheet-backdrop { display: none; }
.summary-keys { font-size: .76rem; opacity: .6; margin-top: 14px; line-height: 1.45; }

/* Suspended quizzes */
#suspended-list:not(:empty) { display: grid; gap: 10px; margin-bottom: 18px; }
.suspended-more { justify-self: start; }
.suspended-card {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); border-radius: var(--r-md);
}
.suspended-card-body { flex: 1; min-width: 0; }
.suspended-card-title { font-size: .93rem; }
.suspended-card-meta { font-size: .8rem; color: var(--text-2); }
.suspended-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.suspended-progress { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--amber) 25%, transparent); margin-top: 8px; overflow: hidden; }
.suspended-progress span { display: block; height: 100%; background: var(--amber-strong); }

/* ---------- Quiz in progress ---------- */
.quiz-active { display: none; max-width: 780px; margin: 0 auto; }
.quiz-active.visible { display: block; animation: enter .2s ease-out; }
.quiz-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quiz-bar-left { display: flex; align-items: center; gap: 10px; }
.quiz-counter { font-size: 1.7rem; line-height: 1; color: var(--ink); white-space: nowrap; }
.quiz-nav-arrows { display: inline-flex; gap: 2px; }
.quiz-nav-btn {
  width: 30px; height: 30px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2);
}
.quiz-nav-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-3); }
.quiz-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.quiz-timer { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: .9rem; font-weight: 500; }
.quiz-session-actions { display: flex; gap: 2px; }
.quiz-session-actions .btn { gap: 6px; }
.quiz-progress-bar { height: 6px; background: var(--inset); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.quiz-progress-fill { height: 100%; width: 0; background: var(--amber); border-radius: 3px; transition: width .35s ease; }

.question-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px 24px 22px; box-shadow: var(--shadow-1);
}
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.quiz-type-badge, .quiz-diff-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 600; background: var(--inset); color: var(--text-2);
}
.quiz-diff-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: currentColor; }
.diff-e { color: var(--green); background: var(--green-soft); }
.diff-m { color: var(--blue); background: var(--blue-soft); }
.diff-d { color: var(--amber-strong); background: var(--amber-soft); }
.diff-dd { color: var(--red); background: var(--red-soft); }
.quiz-stats-label { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-3); }
.stats-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.stats-dot.on { background: var(--green); }
.question-text { font-size: clamp(1.08rem, 2.2vw, 1.22rem); line-height: 1.5; font-weight: 600; letter-spacing: -.005em; margin-bottom: 18px; white-space: pre-line; }
.multi-hint { font-size: .85rem; color: var(--text-2); background: var(--blue-soft); padding: 8px 12px; border-radius: var(--r-sm); margin: -6px 0 14px; }
.answers-list { display: grid; gap: 8px; }
.answer-btn {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; min-height: 52px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md);
  font-size: .97rem; line-height: 1.45; color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
@media (hover: hover) {
  .answer-btn:hover:not(.disabled) { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent); }
}
.answer-btn:active:not(.disabled) { background: var(--surface-2); transform: scale(.995); }
.answer-letter {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--inset); color: var(--text-2); font-family: var(--font-score); font-weight: 700; font-size: .95rem;
}
.answer-btn > span:last-child { padding-top: 3px; }
.answer-btn.selected { border-color: var(--blue); background: var(--blue-soft); }
.answer-btn.selected .answer-letter { background: var(--blue); color: var(--on-primary); }
.answer-btn.disabled { cursor: default; }
.answer-btn.correct { border-color: var(--green); background: var(--green-soft); }
.answer-btn.correct .answer-letter { background: var(--green); color: #fff; }
.answer-btn.wrong { border-color: var(--red); background: var(--red-soft); }
.answer-btn.wrong .answer-letter { background: var(--red); color: #fff; }
.answer-btn.missed { border-color: var(--green); border-style: dashed; }
.answer-btn.missed .answer-letter { color: var(--green); background: var(--green-soft); }
.answer-btn.skipped { opacity: .55; }
.answer-btn.disabled:not(.correct):not(.wrong):not(.missed) { opacity: .7; }
.multi-confirm-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.multi-legend { font-size: .84rem; color: var(--text-2); }
.btn-confirm-multi { }

.ref-reveal { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 16px; animation: enter .2s ease-out; }
.ref-reveal-title { font-size: .85rem; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
.ref-reveal-item {
  padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-soft);
  font-size: .92rem; color: var(--text-2);
}
.ref-reveal-item + .ref-reveal-item { margin-top: 8px; }
.ref-reveal-header { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ref-reveal-header .ref-src { font-size: .78rem; color: var(--text-3); }
.ref-code-tag { font-weight: 700; color: var(--text); }
.ref-reveal-bm, .ref-bm-btn, .ref-edit-note-btn {
  margin-left: auto; width: 30px; height: 30px; border-radius: var(--r-xs); border: 0; background: transparent;
  color: var(--text-3); display: grid; place-items: center; flex-shrink: 0;
}
.ref-edit-note-btn { margin-left: 0; }
.ref-reveal-bm:hover, .ref-bm-btn:hover, .ref-edit-note-btn:hover { background: var(--inset); color: var(--text); }
.ref-reveal-bm.bookmarked, .ref-bm-btn.bookmarked { color: var(--amber-strong); }
.ref-fulltext-wrapper { margin-top: 8px; }
.ref-fulltext-toggle { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; font-size: .84rem; }
.ref-fulltext-toggle:hover { text-decoration: underline; }
.ref-fulltext-content {
  margin-top: 8px; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--surface);
  border-radius: 0 var(--r-xs) var(--r-xs) 0; font-size: .9rem; color: var(--text); line-height: 1.6;
}
.ref-fulltext-same { font-size: .8rem; color: var(--text-3); font-style: italic; }
.ref-doc-link { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; font-weight: 600; margin-top: 8px; }

.question-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px;
}
.qa-left { display: flex; gap: 4px; flex-wrap: wrap; }
.qa-right { display: flex; gap: 8px; margin-left: auto; }
.btn-tool {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--text-2);
  font-weight: 600; font-size: .86rem;
}
.btn-tool:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ref-peek.open { color: var(--blue); }
.btn-bookmark.bookmarked { color: var(--amber-strong); }
.btn-bookmark.bookmarked svg { fill: currentColor; }
.btn-flag.flagged { color: var(--red); }
.btn-next, .btn-skip { min-width: 120px; min-height: 44px; }

/* Results */
.quiz-result-summary { max-width: 780px; margin: 0 auto; }
.result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--hero); color: var(--on-hero); border-radius: var(--r-lg); padding: 24px 28px;
}
.result-label { font-weight: 600; opacity: .8; }
.result-score { font-size: clamp(4rem, 12vw, 6rem); line-height: 1; color: var(--amber); }
.result-ring, .stats-ring {
  --p: 0; width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--amber) calc(var(--p) * 1%), color-mix(in srgb, currentColor 16%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%); mask: radial-gradient(circle, transparent 58%, #000 59%);
}
.ring-wrap { position: relative; display: grid; place-items: center; flex-shrink: 0; }
.ring-label { position: absolute; font-size: 1.6rem; line-height: 1; }
.stats-hero .ring-label { color: var(--text); }
.result-head .ring-label { color: var(--on-hero); font-size: 1.3rem; }
.more-row { display: flex; justify-content: center; margin-top: 14px; }
/* Infinite scroll: shown at the end of a list while more items are loading */
.list-sentinel { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 0 6px; color: var(--text-3); font-size: .85rem; }
.list-sentinel[hidden] { display: none; }
.list-sentinel::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent, currentColor); animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .list-sentinel::before { animation: none; } }
.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.result-stat-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.result-stat-num { font-size: 2rem; line-height: 1.1; }
.result-stat-label { font-size: .8rem; color: var(--text-3); }
.result-review { margin-top: 22px; display: grid; gap: 6px; }
.result-review:empty { display: none; }
.review-title { font-weight: 700; margin-bottom: 4px; }
.review-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-soft); font-size: .9rem;
}
.review-mark { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; background: var(--red); }
.review-mark.ok { background: var(--green); }
.review-mark.skip { background: var(--text-3); }
.review-text { flex: 1; min-width: 0; }
.review-refs { display: block; font-size: .8rem; color: var(--text-3); margin-top: 2px; }
.review-refs button { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; font-size: inherit; }
.result-actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Saved / reported questions ---------- */
#saved-questions-list, #flagged-questions-list, #theory-saved-refs-list { display: grid; gap: 10px; }
.saved-q-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px;
}
.saved-q-card.flag-resolved { opacity: .75; }
.saved-q-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.saved-q-code { font-family: var(--font-score); font-weight: 700; font-size: 1.05rem; }
.saved-q-type { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--inset); color: var(--text-2); }
.saved-q-edit-note, .saved-q-remove {
  width: 30px; height: 30px; border-radius: var(--r-xs); border: 0; background: transparent; color: var(--text-3);
  display: grid; place-items: center;
}
.saved-q-edit-note { margin-left: auto; }
.saved-q-remove { color: var(--amber-strong); }
.saved-q-edit-note:hover, .saved-q-remove:hover { background: var(--inset); }
.saved-q-note, .flag-note {
  font-size: .86rem; background: var(--amber-soft); border-radius: var(--r-xs); padding: 8px 10px; margin-bottom: 10px; color: var(--text);
}
.saved-q-text { font-weight: 600; margin-bottom: 8px; }
.saved-q-answers { display: grid; gap: 2px; margin-bottom: 8px; }
.saved-q-answer { font-size: .9rem; color: var(--text-3); padding-left: 2px; }
.saved-q-answer.is-correct { color: var(--green); font-weight: 600; }
.saved-q-refs { font-size: .82rem; color: var(--text-3); }
.flag-meta { display: flex; gap: 14px; font-size: .78rem; color: var(--text-3); margin-bottom: 8px; flex-wrap: wrap; }
.flag-actions { margin-left: auto; display: flex; gap: 2px; }
.flag-action-btn {
  width: 32px; height: 32px; border-radius: var(--r-xs); border: 0; background: transparent; color: var(--text-3);
  display: grid; place-items: center;
}
.flag-action-btn:hover { background: var(--inset); color: var(--text); }
.flag-resolve-btn:hover { color: var(--green); }
.flag-delete-btn:hover { color: var(--red); }
.flag-status-badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); }
.flag-status-badge.open { background: var(--red-soft); color: var(--red); }
.flag-status-badge.resolved { background: var(--green-soft); color: var(--green); }
.list-heading { font-weight: 700; margin: 8px 0 2px; }
.list-heading:not(:first-child) { margin-top: 18px; }

/* ---------- Review ---------- */
.theory-controls { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; min-height: 44px; padding: 10px 14px 10px 38px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text);
}
.search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.refs-count { font-size: .82rem; color: var(--text-3); margin: 14px 0 8px; }
.refs-list { display: grid; gap: 6px; }
.ref-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.ref-card-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; min-height: 52px; }
.ref-card-header:hover { background: var(--surface-2); }
.ref-card-code { font-family: var(--font-score); font-weight: 700; font-size: 1rem; white-space: nowrap; }
.ref-card-preview { flex: 1; min-width: 0; color: var(--text-2); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ref-expand-icon { width: 24px; text-align: center; color: var(--text-3); font-size: .7rem; transition: transform .2s; }
.ref-card.expanded .ref-expand-icon { transform: rotate(180deg); }
.ref-card-body { display: none; padding: 4px 14px 16px; border-top: 1px solid var(--line-soft); }
.ref-card.expanded .ref-card-body { display: block; }
.ref-card.expanded .ref-card-preview { white-space: normal; color: var(--text); font-weight: 600; }
.ref-summary-text { padding-top: 12px; color: var(--text); white-space: pre-line; }
.ref-card > .saved-q-note { margin: 0 12px 10px; }

.overview-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 190px; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; cursor: pointer;
}
.overview-card + .overview-card { margin-top: 8px; }
.overview-card:hover { border-color: var(--text-3); }
.overview-rank { font-family: var(--font-score); font-weight: 700; font-size: 1.4rem; color: var(--text-3); width: 28px; text-align: center; }
.overview-ref-code { font-weight: 700; }
.overview-ref-source { font-size: .78rem; color: var(--text-3); }
.overview-ref-preview { font-size: .86rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-bar-wrap { display: grid; gap: 4px; }
.overview-bar { height: 8px; border-radius: 4px; background: var(--inset); overflow: hidden; }
.overview-bar-fill { height: 100%; border-radius: 4px; }
.overview-bar-fill.bad { background: var(--red); }
.overview-bar-fill.ok { background: var(--amber); }
.overview-bar-fill.good { background: var(--green); }
.overview-pct { font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Installable web app ---------- */
.install-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.install-banner-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.install-banner-text span { font-size: .82rem; color: var(--text-2); }
.install-steps { margin: 4px 0 0; padding-left: 22px; display: grid; gap: 10px; color: var(--text); }

/* ---------- New or changed rules ---------- */
.change-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0;
  background: var(--inset); color: var(--text-2);
}
.change-badge.current { background: var(--amber); color: #3A2A05; }
.change-badge.past { background: var(--inset); color: var(--text-3); }
.change-note {
  margin-top: 8px; padding: 8px 10px; border-radius: var(--r-xs); font-size: .88rem; color: var(--text);
  background: var(--amber-soft); border-left: 3px solid var(--amber);
}
.ref-card-body .change-note { margin-top: 12px; }
.chip-changes .dot { background: var(--amber); }
.chip-changes .chip-num { font-variant-numeric: tabular-nums; opacity: .7; }
.chip-changes.active .chip-num { opacity: .85; }
.toggle-row.disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Documents ---------- */
.docs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.doc-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px;
  position: relative; overflow: hidden;
}
.doc-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--src, var(--text-3)); }
.doc-head { display: flex; gap: 14px; align-items: flex-start; }
.doc-icon {
  width: 44px; height: 52px; border-radius: 6px 14px 6px 6px; flex-shrink: 0; display: grid; place-items: end center; padding-bottom: 7px;
  background: color-mix(in srgb, var(--src, var(--text-3)) 13%, transparent); color: var(--src, var(--text-3));
  font-size: .62rem; font-weight: 800; letter-spacing: .04em;
}
.doc-title { font-weight: 700; line-height: 1.3; }
.doc-edition { font-size: .84rem; color: var(--text-2); margin-top: 2px; }
.doc-desc { font-size: .88rem; color: var(--text-2); }
.doc-meta { font-size: .8rem; color: var(--text-3); display: flex; gap: 12px; flex-wrap: wrap; }
.doc-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.doc-missing + .doc-actions { margin-top: 0; }
.doc-consult { color: var(--blue); }
.doc-consult:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue-strong); }
.doc-missing { font-size: .84rem; color: var(--text-3); background: var(--surface-2); border-radius: var(--r-xs); padding: 8px 10px; }

.avatar-row { display: flex; gap: 16px; align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.profile-avatar.avatar-preview { width: 64px; height: 64px; font-size: 1.3rem; background: var(--hero); color: var(--amber); }
.avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Release notes ---------- */
.release-list { position: relative; display: grid; gap: 16px; max-width: 760px; }
.release {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px;
}
.release.current { border-color: color-mix(in srgb, var(--amber) 70%, transparent); box-shadow: var(--shadow-2); }
.release-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.release-version { font-size: 1.7rem; line-height: 1; color: var(--ink); }
.release.current .release-version { color: var(--amber-strong); }
.pill-current { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); background: var(--amber-soft); color: var(--amber-strong); }
.release-date { margin-left: auto; font-size: .84rem; color: var(--text-3); }
.release-title { font-size: 1.08rem; font-weight: 700; margin: 8px 0 4px; letter-spacing: -.01em; }
.release-group { font-size: .88rem; font-weight: 700; color: var(--text-2); margin: 16px 0 6px; }
.release-items { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text); font-size: .93rem; }
.release-items li::marker { color: var(--amber-strong); }
a.app-version { color: var(--text-3); text-decoration: none; padding: 4px 8px; margin: -4px -8px; border-radius: var(--r-xs); }
a.app-version:hover { color: var(--blue); background: var(--inset); text-decoration: none; }

/* ---------- Profile ---------- */
.profile-wrap { max-width: 820px; display: grid; gap: 14px; }
.profile-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 18px; align-items: center;
  background: var(--hero); color: var(--on-hero); border-radius: var(--r-lg); padding: 22px 24px;
}
.profile-avatar { width: 68px; height: 68px; font-size: 1.45rem; background: color-mix(in srgb, var(--on-hero) 12%, transparent); color: var(--amber); }
.profile-id { min-width: 0; }
.profile-id h1 { font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.025em; line-height: 1.15; }
.profile-email { opacity: .8; word-break: break-all; font-size: .92rem; }
.profile-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: .82rem; opacity: .9; }
.profile-hero .role-badge { background: color-mix(in srgb, var(--on-hero) 14%, transparent); color: var(--on-hero); }
.profile-hero .role-badge.master { background: var(--amber); color: #3A2A05; }
.profile-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.profile-stat {
  display: block; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 0; color: inherit;
  background: color-mix(in srgb, var(--on-hero) 8%, transparent); text-decoration: none !important;
}
button.profile-stat:hover, a.profile-stat:hover { background: color-mix(in srgb, var(--on-hero) 15%, transparent); }
.profile-stat .scoreboard { display: block; font-size: 1.7rem; line-height: 1.1; color: var(--amber); }
.profile-stat small { font-size: .78rem; opacity: .8; }
.profile-section {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px;
}
.profile-section-head h2 { font-size: 1rem; font-weight: 700; }
.profile-section-head p { font-size: .85rem; color: var(--text-2); margin-top: 4px; }
.profile-section-body { min-width: 0; }
.profile-section .form-field:last-of-type { margin-bottom: 14px; }
.profile-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-row + .profile-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.profile-row-text { min-width: 0; }
.profile-row-text strong { display: block; font-weight: 600; }
.profile-row-text small { display: block; font-size: .84rem; color: var(--text-2); }
.profile-row .btn { flex-shrink: 0; }
.role-perms { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.role-perms li { display: flex; gap: 10px; font-size: .92rem; }
.role-perms li::before {
  content: ''; flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  background: var(--green-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F8A5B' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/10px no-repeat;
}

/* ---------- Statistics ---------- */
.stats-hero { display: flex; align-items: center; gap: 22px; }
.stats-ring { width: 120px; height: 120px; color: var(--text-3); position: relative; }
.stats-tiles { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.stat-tile-value { font-size: 2.3rem; line-height: 1.05; }
.stat-tile-value small {
  font-size: .5em; color: var(--text-3); margin-left: .55em; padding-left: .55em;
  border-left: 2px solid var(--line); vertical-align: .18em; font-weight: 600;
}
.stat-tile-label { font-size: .82rem; color: var(--text-3); }
.source-stats { display: grid; gap: 8px; }
.source-stat {
  display: grid; grid-template-columns: 190px minmax(0, 1fr) 110px; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px;
}
.source-stat-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.source-stat-bar { height: 10px; background: var(--red-soft); border-radius: 5px; overflow: hidden; }
.source-stat-bar span { display: block; height: 100%; background: var(--green); border-radius: 5px; }
.source-stat-bar.empty { background: var(--inset); }
.source-stat-num { text-align: right; font-size: .85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.source-stat-num strong { font-family: var(--font-score); font-size: 1.15rem; color: var(--text); margin-right: 4px; }
.stats-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stats-columns > div { min-width: 0; }
.stats-ref-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; max-height: 460px; overflow: auto; padding-right: 2px; }
.stats-ref-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xs); cursor: pointer; font-size: .9rem;
}
.stats-ref-item:hover { border-color: var(--text-3); }
.stats-ref-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-ref-count { font-family: var(--font-score); font-weight: 700; font-size: 1.05rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .topbar-inner { gap: 16px; }
  .brand-sub, .sync-label { display: none; }
  .nav-link { padding: 8px 10px; }
}
@media (max-width: 900px) {
  .quiz-setup { grid-template-columns: 1fr; }
  .setup-summary {
    position: sticky; bottom: calc(env(safe-area-inset-bottom, 0) + 10px); z-index: 5;
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; padding: 12px 14px; border-radius: var(--r-md);
    box-shadow: var(--shadow-3);
  }
  .setup-summary::after { display: none; }
  .summary-title, .summary-sources, .summary-keys, .summary-toggle small { display: none; }
  .summary-toggle { grid-column: 1 / -1; grid-row: 3; margin: 8px 0 0; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--on-hero) 15%, transparent); font-size: .85rem; align-items: center; }
  .summary-toggle .toggle-track { margin-top: 0; }
  .summary-score { grid-row: 1 / 3; margin: 0; flex-direction: column; align-items: center; gap: 0; }
  .summary-score .scoreboard { font-size: 2.3rem; }
  .summary-unit { font-size: .72rem; }
  .summary-avail { grid-column: 2; grid-row: 2; font-size: .74rem; margin: 0; }
  .setup-summary .btn { grid-column: 2; grid-row: 1; min-height: 44px; }

  .stats-columns { grid-template-columns: minmax(0, 1fr); }
  .source-stat { grid-template-columns: 1fr 100px; }
  .source-stat-bar { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .mainnav, .sync-label, .brand-sub { display: none; }
  .topbar-right, .mainnav + .topbar-right { margin-left: auto; }
  .brand { min-width: 0; }
  .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-inner { height: 56px; padding: 0 16px; gap: 12px; }
  :root { --topbar-h: 56px; }
  .page { padding: 20px 16px 24px; }
  .site-footer { padding: 18px 16px calc(var(--bottomnav-h) + 24px + env(safe-area-inset-bottom, 0)); }
  .auth-screen .site-footer { padding-bottom: 24px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0)); padding-bottom: env(safe-area-inset-bottom, 0);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .bottomnav-item {
    border: 0; background: transparent; color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: .7rem; font-weight: 600; position: relative;
  }
  .bottomnav-item.active { color: var(--text); }
  .bottomnav-item.active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
  .toast { bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom, 0)); }
  body.quiz-running[data-section="quiz"] .bottomnav { display: none; }
  body.quiz-running[data-section="quiz"] .site-footer { padding-bottom: 24px; }

  .auth-layout { grid-template-columns: 1fr; gap: 24px; padding: 28px 16px 8px; }
  .auth-ball { width: 52px; height: 52px; margin-bottom: 14px; }
  .auth-points { display: none; }
  .auth-pitch { font-size: .95rem; }
  .auth-card { padding: 22px 18px; }

  .setup-block { padding: 16px; }
  .source-grid { grid-template-columns: 1fr 1fr; }
  .setup-summary { padding: 18px; }
  .setup-summary { bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0) + 10px); }

  .question-card { padding: 18px 16px; border-radius: var(--r-md); }
  .quiz-counter { font-size: 1.45rem; }
  .question-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); margin: 10px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0)); border-top: 1px solid var(--line-soft); }
  .btn-tool span { display: none; }
  .btn-tool { padding: 0 10px; }
  .btn-next, .btn-skip { min-width: 0; }

  .theory-controls { flex-direction: column; align-items: stretch; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .filter-chip { flex-shrink: 0; }
  .overview-card { grid-template-columns: auto minmax(0, 1fr); }
  .overview-bar-wrap { grid-column: 1 / -1; }

  .stats-hero { flex-direction: column; align-items: stretch; }
  .stats-hero .ring-wrap { display: none; }
  .stats-tiles { gap: 8px; }
  .stat-tile { padding: 12px; }
  .stat-tile-value { font-size: 1.8rem; }
  .result-head { padding: 20px; }
  .result-ring { width: 84px; height: 84px; }
  .result-head .ring-label { font-size: 1.05rem; }
  .docs-list { grid-template-columns: 1fr; }
  .doc-actions .btn { flex: 1 1 auto; }
  .profile-hero { padding: 18px; }
  .profile-avatar { width: 54px; height: 54px; font-size: 1.15rem; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-section { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px 16px; }
  .profile-actions .btn { flex: 1; }
  .profile-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .suspended-card { flex-direction: column; align-items: stretch; }
}

@media (max-width: 380px) {
  .source-grid { grid-template-columns: 1fr; }
  .quiz-timer { display: none; }
}


/* ---------- Touch and mobile devices ---------- */
@keyframes sheet { from { transform: translateY(100%); } }

/* Touch screens: targets of at least 44px and 16px field text (avoids the automatic zoom on iPhone) */
@media (pointer: coarse) {
  .form-input, .search-input, .admin-select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 0 14px; }
  .btn-lg { min-height: 52px; }
  .icon-btn, .quiz-nav-btn, .ref-reveal-bm, .ref-bm-btn, .ref-edit-note-btn,
  .saved-q-edit-note, .saved-q-remove, .flag-action-btn, .pw-toggle { width: 44px; height: 44px; }
  .quiz-nav-btn { width: 40px; height: 40px; }
  .filter-chip, .chip-check, .q-count-chip { min-height: 42px; }
  .segmented > button { padding: 10px 14px; }
  .segmented-sm > button { padding: 8px 12px; }
  .btn-tool { min-height: 44px; min-width: 44px; justify-content: center; }
  .avatar-btn { width: 42px; height: 42px; }
  .btn-link, .ref-fulltext-toggle, .ref-doc-link { min-height: 36px; display: inline-flex; align-items: center; }
  .settings-dropdown-item { padding: 12px; }
  .ref-card-header { min-height: 56px; }
  .toggle-row { padding: 4px 0; }
  .toggle-track { width: 44px; height: 26px; }
  .toggle-track::after { width: 20px; height: 20px; }
  .toggle-row input:checked + .toggle-track::after { transform: translateX(18px); }
}

@media (max-width: 760px) {
  /* Account menu as a bottom sheet */
  .settings-dropdown {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0));
    width: auto; max-height: 82dvh; z-index: 80; border-radius: var(--r-lg);
    box-shadow: var(--shadow-3); animation: sheet .22s ease-out;
  }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 79; background: rgba(8, 15, 30, .45); animation: fade .15s; }
  .sheet-backdrop[hidden] { display: none; }
  /* Dialogs as bottom sheets, full-width buttons */
  .modal-overlay { place-items: end stretch; padding: 0; }
  .modal-box {
    max-width: none; max-height: 92dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0)); animation: sheet .22s ease-out;
  }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .quiz-bar { gap: 8px; }
  .quiz-session-actions .btn { padding: 0 10px; }
}

@media (max-width: 420px) {
  .quiz-session-actions .btn span { display: none; }
  .quiz-session-actions .btn { width: 44px; padding: 0; }
  .quiz-counter { font-size: 1.35rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .bottomnav { --bottomnav-h: 52px; }
  .bottomnav-item span { display: none; }
  .topbar { position: static; }
}
