/* Legal Narrative - Premium CSS v1.0 */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --navy: #1a1f5e;
  --navy-dark: #0d1040;
  --navy-mid: #252b7a;
  --indigo: #4F46E5;
  --indigo-light: #eef2ff;
  --gold: #c9a84c;
  --gold-light: #fdf8ec;
  --cream: #faf8f5;
  --white: #ffffff;
  --text-primary: #1a1f5e;
  --text-secondary: #4b5280;
  --text-muted: #8b91b8;
  --border: #e5e8f5;
  --border-light: #f0f2fa;
  --bg-card: #ffffff;
  --bg-page: #f6f7fb;
  --shadow-sm: 0 1px 3px rgba(26,31,94,.08);
  --shadow: 0 4px 16px rgba(26,31,94,.1);
  --shadow-lg: 0 8px 32px rgba(26,31,94,.15);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: all .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; color: var(--navy); }
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.1rem; }
p { color: var(--text-secondary); }
a { color: var(--indigo); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--navy); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--border-light); }
::-webkit-scrollbar-thumb { background: #c7cae8; border-radius: 99px; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 1.25rem; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  height: 64px;
  display: flex; align-items: center;
}
.navbar-inner { max-width: 1200px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 1rem; }
.nav-brand { display: flex; align-items: center; gap: .625rem; text-decoration: none; flex-shrink: 0; }
.nav-logo { height: 36px; width: 36px; border-radius: 50%; object-fit: cover; }
.nav-brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--navy); line-height: 1.1; }
.nav-brand-text span { display: block; font-size: .65rem; font-family: var(--font-body); font-weight: 400; color: var(--text-muted); letter-spacing: .04em; }
.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav-link { padding: .5rem .75rem; border-radius: 8px; font-size: .875rem; font-weight: 500; color: var(--text-secondary); transition: var(--transition); }
.nav-link:hover, .nav-link.active { color: var(--navy); background: var(--indigo-light); }
.nav-actions { display: flex; align-items: center; gap: .5rem; margin-left: .5rem; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; cursor: pointer; border: 2px solid var(--border); overflow: hidden; }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-hamburger { display: none; background: none; border: none; cursor: pointer; padding: .5rem; color: var(--navy); }
@media(max-width:768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile-menu { display: none; position: fixed; inset: 0; top: 64px; background: #fff; z-index: 999; padding: 1.5rem 1.25rem; flex-direction: column; gap: .5rem; overflow-y: auto; }
  .nav-mobile-menu.open { display: flex; }
  .nav-mobile-link { padding: .875rem 1rem; border-radius: 10px; font-size: 1rem; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: .75rem; }
  .nav-mobile-link:hover { background: var(--indigo-light); }
  .nav-mobile-sep { height: 1px; background: var(--border); margin: .5rem 0; }
}

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .625rem 1.25rem; border-radius: 8px; font-family: var(--font-body); font-size: .875rem; font-weight: 600; cursor: pointer; transition: var(--transition); border: 1.5px solid transparent; line-height: 1; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover:not(:disabled) { background: var(--navy-mid); color: #fff; box-shadow: 0 4px 14px rgba(26,31,94,.3); transform: translateY(-1px); }
.btn-indigo { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.btn-indigo:hover:not(:disabled) { background: #4338ca; color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.35); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover:not(:disabled) { background: #b8953e; color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--border-light); color: var(--navy); }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-success { background: #059669; color: #fff; border-color: #059669; }
.btn-sm { padding: .4rem .875rem; font-size: .8rem; }
.btn-lg { padding: .875rem 2rem; font-size: 1rem; border-radius: 10px; }
.btn-icon { padding: .5rem; width: 36px; height: 36px; }
.btn-block { width: 100%; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: var(--transition); }
.card:hover { box-shadow: var(--shadow); }
.card-body { padding: 1.25rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

/* ── Quiz Card ── */
.quiz-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.125rem; transition: var(--transition); display: flex; flex-direction: column; gap: .75rem; }
.quiz-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #d0d5f0; }
.quiz-card-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .625rem; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-free { background: #d1fae5; color: #065f46; }
.badge-batch { background: var(--indigo-light); color: var(--indigo); }
.badge-live { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #fef3c7; color: #92400e; }
.quiz-card-title { font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.3; font-family: var(--font-display); }
.quiz-card-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.quiz-meta-item { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--text-muted); }
.quiz-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
@media(max-width:640px) { .quiz-grid { grid-template-columns: 1fr; } }

/* ── Forms ── */
.form-group { margin-bottom: 1.125rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text-primary); margin-bottom: .4rem; }
.form-label span { color: #ef4444; }
.form-control {
  width: 100%; padding: .625rem .875rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: var(--font-body); font-size: .875rem;
  color: var(--text-primary); background: var(--white); transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-control::placeholder { color: var(--text-muted); }
.form-control[readonly] { background: var(--bg-page); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .75rem; color: #ef4444; margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:580px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .875rem; font-weight: 500; }
.form-check input[type=checkbox], .form-check input[type=radio] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--indigo); }
.input-group { display: flex; }
.input-group .form-control { border-radius: 8px 0 0 8px; flex: 1; }
.input-group .btn { border-radius: 0 8px 8px 0; flex-shrink: 0; }
.input-addon { padding: .625rem .875rem; background: var(--border-light); border: 1.5px solid var(--border); border-right: none; border-radius: 8px 0 0 8px; font-size: .875rem; color: var(--text-muted); display: flex; align-items: center; }

/* ── Alerts ── */
.alert { display: flex; align-items: flex-start; gap: .75rem; padding: .875rem 1rem; border-radius: 10px; font-size: .875rem; margin-bottom: 1rem; }
.alert i, .alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--indigo-light); color: var(--navy); border: 1px solid #c7d2fe; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--bg-card); }
thead { background: var(--bg-page); }
th { padding: .75rem 1rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border); }
td { padding: .875rem 1rem; font-size: .875rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-page); }

/* ── Dashboard Layout ── */
.dash-layout { display: flex; min-height: 100vh; }
.dash-sidebar { width: 240px; flex-shrink: 0; background: var(--navy-dark); min-height: 100vh; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; transition: var(--transition); }
.dash-main { flex: 1; min-width: 0; padding: 1.5rem 1.25rem; }
@media(min-width:1024px) { .dash-main { padding: 1.75rem 2rem; } }
.dash-sidebar-brand { padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .625rem; }
.dash-sidebar-brand img { width: 34px; height: 34px; border-radius: 50%; }
.dash-sidebar-brand-txt { font-family: var(--font-display); font-size: .95rem; font-weight: 700; color: #fff; line-height: 1.1; }
.dash-sidebar-brand-txt small { display: block; font-family: var(--font-body); font-size: .6rem; color: rgba(255,255,255,.4); font-weight: 400; }
.dash-nav { padding: 1rem 0; flex: 1; }
.dash-nav-section { padding: .5rem 1rem .25rem; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.3); font-weight: 700; }
.dash-nav-item { display: flex; align-items: center; gap: .625rem; padding: .6rem 1rem; margin: 1px .5rem; border-radius: 8px; font-size: .83rem; font-weight: 500; color: rgba(255,255,255,.65); cursor: pointer; transition: var(--transition); text-decoration: none; }
.dash-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.dash-nav-item.active { background: rgba(79,70,229,.35); color: #fff; }
.dash-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dash-nav-badge { margin-left: auto; background: var(--gold); color: #fff; font-size: .6rem; font-weight: 700; padding: .15rem .4rem; border-radius: 99px; }
.dash-sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }
@media(max-width:1023px) {
  .dash-sidebar { position: fixed; left: -260px; z-index: 100; width: 240px; height: 100vh; top: 0; }
  .dash-sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .dash-main { padding: 1rem; }
}
.dash-topbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.dash-toggle-btn { display: flex; align-items: center; background: none; border: none; cursor: pointer; color: var(--navy); padding: .375rem; border-radius: 6px; }
.dash-toggle-btn:hover { background: var(--border-light); }
@media(min-width:1024px) { .dash-toggle-btn { display: none; } }
.dash-page-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); font-family: var(--font-display); }

/* ── Hero Banner ── */
.dash-hero { border-radius: var(--radius-xl); padding: 1.5rem; margin-bottom: 1.5rem; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-mid) 50%, #2d3494 100%); }
.dash-hero::after { content: ''; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px; background: radial-gradient(circle, rgba(201,168,76,.2), transparent 70%); pointer-events: none; }
.dash-hero-inner { position: relative; z-index: 1; }
.dash-hero h2 { color: #fff; font-size: 1.2rem; margin-bottom: .25rem; }
.dash-hero p { color: rgba(255,255,255,.65); font-size: .875rem; margin: 0; }
.dash-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.5rem; }
@media(min-width:480px) { .dash-stats { grid-template-columns: repeat(3, 1fr); } }
@media(min-width:1024px) { .dash-stats { grid-template-columns: repeat(6, 1fr); } }
.dash-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem .875rem; text-align: center; }
.dash-stat-val { font-size: 1.5rem; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: .25rem; font-family: var(--font-display); }
.dash-stat-lbl { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Section heading ── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: .75rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }

/* ── Pagination ── */
.pagination { display: flex; flex-wrap: wrap; gap: .375rem; justify-content: center; padding: 1rem 0; }
.page-btn { padding: .4rem .75rem; border-radius: 7px; font-size: .8rem; font-weight: 600; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); transition: var(--transition); }
.page-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Chips / Tabs ── */
.chip-tabs { display: flex; gap: .375rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip { padding: .35rem .875rem; border-radius: 99px; font-size: .8rem; font-weight: 600; cursor: pointer; transition: var(--transition); border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text-secondary); }
.chip:hover { border-color: var(--indigo); color: var(--indigo); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Search bar ── */
.search-bar { display: flex; gap: .625rem; margin-bottom: 1.25rem; }
.search-bar .form-control { flex: 1; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; color: var(--text-muted); }
.empty-state h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.empty-state p { font-size: .875rem; color: var(--text-muted); max-width: 320px; margin: 0 auto 1.25rem; }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(10,12,50,.5); z-index: 500; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(4px); }
.modal-backdrop.open { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-xl); width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: slideUp .2s ease; }
.modal-lg { max-width: 780px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: .375rem; border-radius: 6px; display: flex; align-items: center; transition: var(--transition); }
.modal-close:hover { background: var(--border-light); color: var(--navy); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .625rem; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Toast ── */
#toast-wrap { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .75rem 1.125rem; border-radius: 10px; font-size: .875rem; font-weight: 500; color: #fff; box-shadow: var(--shadow-lg); animation: slideIn .25s ease; display: flex; align-items: center; gap: .625rem; max-width: 340px; }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-info { background: var(--navy); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Progress bar ── */
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--indigo); border-radius: 99px; transition: width .4s ease; }
.progress-bar.gold { background: var(--gold); }
.progress-bar.green { background: #059669; }
.progress-bar.red { background: #ef4444; }

/* ── Attempt Interface ── */
.attempt-layout { display: flex; height: 100vh; overflow: hidden; }
.attempt-questions { flex: 1; overflow-y: auto; padding: 1.5rem; }
.attempt-panel { width: 260px; flex-shrink: 0; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
@media(max-width:900px) {
  .attempt-layout { flex-direction: column; height: auto; }
  .attempt-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: 45vh; }
}
.attempt-topbar { background: var(--navy-dark); color: #fff; padding: .875rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.attempt-timer { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: .5rem; }
.attempt-timer.warn { color: #fbbf24; }
.attempt-timer.danger { color: #f87171; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.6} }
.q-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem; }
.q-number { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: .5rem; letter-spacing: .05em; }
.q-text { font-size: 1rem; font-weight: 500; color: var(--navy); line-height: 1.65; margin-bottom: 1.125rem; }
.q-options { display: flex; flex-direction: column; gap: .5rem; }
.q-option { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem 1rem; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; transition: var(--transition); }
.q-option:hover { border-color: var(--indigo); background: var(--indigo-light); }
.q-option.selected { border-color: var(--indigo); background: var(--indigo-light); }
.q-option.correct { border-color: #059669; background: #d1fae5; }
.q-option.wrong { border-color: #ef4444; background: #fee2e2; }
.q-opt-key { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg-page); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; color: var(--text-secondary); transition: var(--transition); }
.q-option.selected .q-opt-key { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.q-option.correct .q-opt-key { background: #059669; border-color: #059669; color: #fff; }
.q-option.wrong .q-opt-key { background: #ef4444; border-color: #ef4444; color: #fff; }
.q-opt-text { flex: 1; font-size: .9rem; line-height: 1.55; color: var(--text-primary); padding-top: 1px; }
.q-actions { display: flex; gap: .625rem; justify-content: space-between; flex-wrap: wrap; }
.panel-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.panel-title { font-size: .875rem; font-weight: 700; color: var(--navy); margin-bottom: .625rem; }
.panel-legend { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .7rem; }
.legend-item { display: flex; align-items: center; gap: .3rem; color: var(--text-muted); font-weight: 500; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .375rem; padding: 1rem; }
.nav-btn { aspect-ratio: 1; border-radius: 6px; border: 1.5px solid var(--border); background: var(--bg-card); font-size: .75rem; font-weight: 700; cursor: pointer; color: var(--text-secondary); transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.nav-btn:hover { border-color: var(--indigo); }
.nav-btn.answered { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.nav-btn.marked { background: var(--gold); border-color: var(--gold); color: #fff; }
.nav-btn.marked-answered { background: var(--gold); border-color: var(--gold); color: #fff; position: relative; }
.nav-btn.marked-answered::after { content: ''; position: absolute; bottom: 2px; right: 2px; width: 5px; height: 5px; background: #fff; border-radius: 50%; }
.nav-btn.current { outline: 2px solid var(--navy); outline-offset: 1px; }

/* ── Result page ── */
.result-hero { border-radius: var(--radius-xl); background: linear-gradient(135deg, var(--navy-dark), var(--navy-mid)); padding: 2rem; text-align: center; margin-bottom: 1.5rem; color: #fff; }
.result-score { font-family: var(--font-display); font-size: clamp(3rem, 8vw, 5rem); font-weight: 900; line-height: 1; color: var(--gold); }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin: 1.5rem 0; }
@media(min-width:500px) { .result-stats { grid-template-columns: repeat(4, 1fr); } }
.result-stat { background: rgba(255,255,255,.08); border-radius: 10px; padding: 1rem; text-align: center; }
.result-stat-val { font-size: 1.5rem; font-weight: 800; color: #fff; line-height: 1; }
.result-stat-lbl { font-size: .7rem; color: rgba(255,255,255,.6); margin-top: .25rem; }

/* ── Leaderboard ── */
.lb-row { display: flex; align-items: center; gap: .875rem; padding: .875rem 1rem; border-bottom: 1px solid var(--border-light); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 32px; height: 32px; border-radius: 50%; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: var(--text-muted); flex-shrink: 0; }
.lb-rank.top1 { background: var(--gold); color: #fff; }
.lb-rank.top2 { background: #9ca3af; color: #fff; }
.lb-rank.top3 { background: #b45309; color: #fff; }
.lb-name { flex: 1; font-size: .9rem; font-weight: 600; }
.lb-score { font-size: .9rem; font-weight: 700; color: var(--navy); }

/* ── Home page ── */
.hero-section { background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-mid) 50%, #2a3090 100%); padding: 5rem 1.25rem 4rem; position: relative; overflow: hidden; }
.hero-section::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23fff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E"); }
.hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; text-align: center; }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem 1rem; background: rgba(201,168,76,.15); border: 1px solid rgba(201,168,76,.35); border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--gold); margin-bottom: 1.5rem; }
.hero-inner h1 { color: #fff; margin-bottom: 1rem; }
.hero-inner p { color: rgba(255,255,255,.7); font-size: 1.1rem; max-width: 520px; margin: 0 auto 2rem; }
.hero-btns { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid rgba(255,255,255,.1); flex-wrap: wrap; gap: 1.5rem; }
.hero-stat-val { font-family: var(--font-display); font-size: 2rem; font-weight: 900; color: var(--gold); }
.hero-stat-lbl { font-size: .8rem; color: rgba(255,255,255,.55); margin-top: .15rem; }

/* ── Footer ── */
.footer { background: var(--navy-dark); color: rgba(255,255,255,.6); padding: 3rem 1.25rem 1.5rem; margin-top: 4rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media(max-width:768px) { .footer-top { grid-template-columns: 1fr 1fr; } }
@media(max-width:480px) { .footer-top { grid-template-columns: 1fr; } }
.footer-brand { display: flex; align-items: center; gap: .625rem; margin-bottom: .875rem; }
.footer-brand img { width: 36px; height: 36px; border-radius: 50%; }
.footer-brand-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: #fff; }
.footer-desc { font-size: .875rem; line-height: 1.7; max-width: 260px; }
.footer-col h4 { font-size: .875rem; font-weight: 700; color: #fff; margin-bottom: .875rem; font-family: var(--font-body); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { font-size: .875rem; color: rgba(255,255,255,.55); transition: var(--transition); }
.footer-links a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; font-size: .8rem; }
.footer-bottom a { color: var(--gold); }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 24px; height: 24px; border: 2.5px solid var(--border); border-top-color: var(--indigo); border-radius: 50%; animation: spin .7s linear infinite; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: #059669 !important; }
.text-danger { color: #ef4444 !important; }
.text-gold { color: var(--gold) !important; }
.text-navy { color: var(--navy) !important; }
.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }
.fs-sm { font-size: .8rem; }
.fs-xs { font-size: .72rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: .5rem; }
.gap { gap: .875rem; }
.gap-lg { gap: 1.5rem; }
.mt-sm { margin-top: .5rem; }
.mt { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mb-sm { margin-bottom: .5rem; }
.mb { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
