/* ─── RESET & VARS ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand & Primary ── */
  --primary:            #d4423a;
  --primary-pressed:    #b3322b;
  --primary-deep:       #8a2620;
  --brand-navy:         #0a1530;
  --brand-navy-deep:    #070f24;
  --brand-navy-mid:     #1a2a52;
  --link-blue:          #0075de;
  --link-blue-pressed:  #005bab;

  /* ── Brand Color Spectrum ── */
  --brand-orange:       #dd5b00;
  --brand-orange-deep:  #793400;
  --brand-pink:         #ff64c8;
  --brand-pink-deep:    #a02e6d;
  --brand-purple:       #7b3ff2;
  --brand-purple-300:   #d6b6f6;
  --brand-purple-800:   #391c57;
  --brand-teal:         #2a9d99;
  --brand-green:        #1aae39;
  --brand-yellow:       #f5d75e;
  --brand-brown:        #523410;

  /* ── Surface ── */
  --canvas:             #ffffff;
  --canvas-warm:        #faf7f1;
  --surface:            #f6f5f4;
  --surface-soft:       #fafaf9;
  --hairline:           #ece7dd;
  --hairline-soft:      #f3efe5;
  --hairline-strong:    #d4ccbd;

  /* ── Text ── */
  --ink-deep:           #000000;
  --ink:                #1a1a1a;
  --charcoal:           #37352f;
  --slate:              #5d5b54;
  --steel:              #787671;
  --stone:              #a4a097;
  --muted:              #bbb8b1;
  --on-dark:            #ffffff;
  --on-dark-muted:      rgba(255, 255, 255, 0.6);

  /* ── Card Tints ── */
  --tint-peach:         #ffe8d4;
  --tint-rose:          #fde0ec;
  --tint-mint:          #d9f3e1;
  --tint-lavender:      #e6e0f5;
  --tint-sky:           #dcecfa;
  --tint-yellow:        #fef7d6;
  --tint-yellow-bold:   #f9e79f;
  --tint-cream:         #f8f5e8;
  --tint-washi:         #f6efe0;

  /* ── Semantic ── */
  --green:              #1aae39;
  --red:                #e03131;
  --amber:              #f59e0b;

  /* ── Border Radius ── */
  --r-xs:               4px;
  --r-sm:               6px;
  --r-md:               8px;
  --r-lg:               12px;
  --r-xl:               16px;
  --r-xxl:              20px;
  --r-full:             9999px;

  /* ── Elevation ── */
  --shadow-1:           rgba(30,20,10,0.05) 0px 1px 3px 0px;
  --shadow-2:           rgba(30,20,10,0.09) 0px 4px 14px 0px;
  --shadow-3:           rgba(30,20,10,0.18) 0px 24px 48px -8px;
  --shadow-4:           rgba(30,20,10,0.14) 0px 16px 48px -8px;

  /* ── Typography ── */
  --font-sans:          'Noto Sans JP', Inter, -apple-system, system-ui, 'Segoe UI', sans-serif;
  --font-head:          'Noto Sans JP', Inter, -apple-system, system-ui, 'Segoe UI', sans-serif;

  /* ── Legacy aliases (backward compat) ── */
  --bg:                 var(--canvas);
  --bg2:                var(--canvas);
  --bg3:                var(--surface);
  --border:             var(--hairline);
  --navy:               #1E3A5F;
  --navy3:              #2a4a73;
  --surface2:           var(--surface);
  --accent:             var(--primary);
  --accent2:            var(--primary-pressed);
  --text:               var(--charcoal);
  --radius:             var(--r-lg);
  --radius-sm:          var(--r-md);
  --shadow:             var(--shadow-2);
  --white:              #ffffff;
  --fb:                 #1877f2;
  --teal-dark:          #0C5F5F;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--canvas-warm);
  color: var(--charcoal);
  min-height: 100dvh;
  line-height: 1.55;
  font-size: 16px;
}

/* ─── NAVBAR ─────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  padding: 0 32px;
  height: 64px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hairline-strong);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); flex-shrink: 0;
}
.logo-img {
  width: 34px; height: 34px; object-fit: contain; flex-shrink: 0;
  border-radius: var(--r-md); padding: 3px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
}
.logo-text {
  font-family: var(--font-head);
  font-size: 17px; font-weight: 700; color: var(--ink);
  letter-spacing: 0; line-height: 1;
  display: flex; align-items: center;
}
.logo-flag {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; width: 1em; height: 1em;
}
.logo-flag::before {
  content: "日"; color: var(--ink); font-weight: 700;
  font-family: var(--font-sans); font-size: inherit;
}
.logo-flag::after {
  content: "";
  position: absolute;
  width: .36em; height: .36em;
  background: #cc0000; border-radius: 50%;
  pointer-events: none;
}

.nav-links {
  display: flex; gap: 2px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav-links a {
  color: var(--slate); text-decoration: none;
  padding: 6px 14px;
  font-size: 14px; font-weight: 500;
  background: none; border: none;
  transition: color .15s, background .12s;
  border-radius: var(--r-sm);
}
.nav-links a:hover { color: var(--ink); background: var(--surface); }
.nav-links a.active { color: var(--ink); font-weight: 600; background: var(--surface); }

.nav-auth { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ─── NAV DROPDOWN ───────────────────────────────────── */
.nav-dropdown-wrap { position: relative; display: flex; align-items: center; }
.nav-dropdown-btn {
  display: flex; align-items: center; gap: 6px;
  color: var(--slate); text-decoration: none;
  padding: 6px 14px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  background: none; border: none;
  transition: color .15s, background .12s;
  cursor: pointer; font-family: var(--font-sans); line-height: 1;
}
.nav-dropdown-btn:hover,
.nav-dropdown-btn.active { background: var(--surface); color: var(--ink); }
.nav-dropdown-btn svg { transition: transform .2s; flex-shrink: 0; }
.nav-dropdown-wrap.open .nav-dropdown-btn svg { transform: rotate(180deg); }

.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 6px;
  white-space: nowrap; z-index: 200;
  box-shadow: var(--shadow-4);
  animation: dropdownFadeIn .15s ease;
}
.nav-dropdown-wrap.open .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
  display: block; padding: 7px 12px;
  color: var(--charcoal); text-decoration: none;
  font-size: 14px; font-weight: 400;
  border-radius: var(--r-sm);
  transition: background .12s; white-space: nowrap;
  background: none; border: none;
  cursor: pointer; font-family: var(--font-sans);
}
.nav-dropdown-item:hover { background: var(--surface); color: var(--ink); }
.nav-dropdown-item.active { color: var(--ink); font-weight: 600; }

.btn-nav-register {
  padding: 7px 16px; border-radius: var(--r-md);
  background: transparent; border: 1px solid var(--hairline-strong); color: var(--charcoal);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn-nav-register:hover { background: var(--surface); }

.btn-nav-login {
  padding: 7px 16px; border-radius: var(--r-md);
  background: var(--brand-navy); border: 1px solid var(--brand-navy); color: var(--on-dark);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, border-color .15s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn-nav-login:hover { background: var(--brand-navy-mid); border-color: var(--brand-navy-mid); }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-full);
}
.user-pill img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.user-pill span { font-size: 13px; font-weight: 500; color: var(--charcoal); }

/* ─── USER DROPDOWN ─────────────────────────────────────── */
.user-menu { position: relative; }
.user-avatar-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.user-avatar-btn img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--hairline);
}
.avatar-caret {
  width: 10px; height: 6px; color: var(--steel);
  transition: transform .2s ease;
}
.user-menu.open .avatar-caret { transform: rotate(180deg); }
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 6px; min-width: 186px;
  box-shadow: var(--shadow-4);
  z-index: 1000;
  animation: dropdownFadeIn .15s ease;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-menu.open .user-dropdown { display: block; }
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; color: var(--charcoal); text-decoration: none;
  font-size: 14px; font-weight: 400; border-radius: var(--r-sm);
  cursor: pointer; transition: background .12s;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font-sans); gap: 8px;
}
.dropdown-item:hover { background: var(--surface); }
.dropdown-item span:first-child { flex: 1; }
.dropdown-icon {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; background: var(--surface);
  border-radius: var(--r-sm); flex-shrink: 0;
  transition: background .12s;
}
.dropdown-item:hover .dropdown-icon { background: var(--hairline-soft); }
.user-name-hidden { display: none; }

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; white-space: nowrap;
  font-family: var(--font-sans);
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary {
  background: var(--brand-navy);
  color: var(--on-dark); border-color: var(--brand-navy);
}
.btn-primary:hover { background: var(--brand-navy-mid); border-color: var(--brand-navy-mid); }

.btn-dark {
  background: var(--ink-deep); color: var(--on-dark); border-color: var(--ink-deep);
}
.btn-dark:hover { background: var(--ink); border-color: var(--ink); }

.btn-outline {
  background: transparent; color: var(--charcoal); border-color: var(--hairline-strong);
}
.btn-outline:hover { background: var(--surface); }

.btn-ghost {
  background: none; border: none; font-size: 14px; color: var(--slate);
  cursor: pointer; transition: color .15s, background .12s; padding: 8px 12px;
  border-radius: var(--r-sm); font-family: var(--font-sans);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface); }

.btn-on-dark {
  background: var(--on-dark); color: var(--ink);
  border: 1px solid var(--on-dark); padding: 10px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; transition: opacity .15s;
  font-family: var(--font-sans);
}
.btn-on-dark:hover { opacity: .88; }

.btn-secondary-on-dark {
  background: transparent; color: var(--on-dark);
  border: 1px solid var(--on-dark-muted); padding: 10px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; transition: border-color .15s;
  font-family: var(--font-sans);
}
.btn-secondary-on-dark:hover { border-color: var(--on-dark); }

.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ─── TAGS ─────────────────────────────────────────── */
.tag {
  padding: 2px 8px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600;
  display: inline-block;
}
.tag-n1 { background: #ffe2dd; color: #c4554d; font-weight: 500; }
.tag-n2 { background: #d3e5ef; color: #2f80bf; font-weight: 500; }
.tag-n3 { background: #faebdd; color: #d9730d; font-weight: 500; }
.tag-n4 { background: #dbeddb; color: #448361; font-weight: 500; }
.tag-n5 { background: #e8deee; color: #9065b0; font-weight: 500; }

/* ─── CARD ─────────────────────────────────────────── */
.card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 24px;
  transition: box-shadow .2s; cursor: pointer;
  text-decoration: none; color: var(--charcoal);
  display: block;
  box-shadow: var(--shadow-1);
}
.card:hover { box-shadow: var(--shadow-2); }

/* ─── PAGE LAYOUT ─────────────────────────────────────────── */
.page-wrap { padding: 48px 64px; max-width: 1280px; margin: 0 auto; }
.page-title {
  font-family: var(--font-head);
  font-size: 28px; font-weight: 600; margin-bottom: 6px; color: var(--ink);
  letter-spacing: -0.5px; text-wrap: balance;
}
.page-subtitle { color: var(--slate); font-size: 16px; margin-bottom: 36px; }

/* ─── HERO BAND ─────────────────────────────────────────── */
.hero-band {
  background: var(--brand-navy);
  color: var(--on-dark);
  padding: 96px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-band-inner {
  max-width: 720px; margin: 0 auto; position: relative; z-index: 1;
}
.hero-display {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 600; line-height: 1.1;
  letter-spacing: -1.5px;
  color: var(--on-dark);
  margin-bottom: 20px;
  text-wrap: balance;
}
.hero-subtitle {
  font-size: 18px; font-weight: 400; color: var(--on-dark-muted);
  line-height: 1.5; margin-bottom: 36px;
}
.hero-cta-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Decorative sticky-note dots for hero band */
.hero-dot {
  position: absolute; width: 12px; height: 12px;
  border-radius: 3px; opacity: .7;
  pointer-events: none;
}

/* ─── FOOTER ─────────────────────────────────────────── */
.footer {
  text-align: center; padding: 24px 32px;
  font-size: 14px; color: var(--steel);
  border-top: 1px solid var(--hairline);
  background: var(--canvas);
}

/* ─── GRID ─────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

/* ─── QUIZ PAGE ─────────────────────────────────────────── */
.quiz-wrap { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.quiz-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px;
}
.progress-bar-track {
  height: 3px; background: var(--hairline); border-radius: 2px; margin-bottom: 4px;
}
.progress-bar-fill {
  height: 3px; background: var(--primary); border-radius: 2px;
  transition: width .4s ease;
}
.question-box {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 32px; margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.question-number { font-size: 12px; color: var(--steel); margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.question-text { font-size: 17px; line-height: 1.7; color: var(--ink); }

.choices-grid { display: flex; flex-direction: column; gap: 8px; }

.choice {
  padding: 12px 16px; border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  font-size: 14px; color: var(--charcoal);
  cursor: pointer; transition: border-color .15s, background .12s;
}
.choice:not(.answered):hover { border-color: var(--primary); background: rgba(212,66,58,.07); color: var(--ink); }
.choice.selected  { border-color: var(--primary); background: rgba(212,66,58,.07); color: var(--ink); }
.choice.answered.correct { border-color: var(--brand-green); background: #edfaf1; color: var(--brand-green); font-weight: 600; }
.choice.answered.wrong   { border-color: var(--red);         background: #fff1f1; color: var(--red); }

.explanation-box {
  background: var(--tint-lavender); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 16px;
  font-size: 14px; line-height: 1.7; margin-top: 12px;
  border-left: 4px solid var(--primary);
}

.quiz-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px;
}

/* ─── LEADERBOARD ─────────────────────────────────────────── */
.lb-table {
  width: 100%; border-collapse: collapse;
  background: var(--canvas); border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--hairline);
}
.lb-table th, .lb-table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--hairline); font-size: 14px;
}
.lb-table th { color: var(--steel); font-weight: 600; background: var(--surface); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: var(--surface-soft); }
.rank-1 .rank-num { color: #FFD700; font-weight: 800; }
.rank-2 .rank-num { color: #00D4FF; font-weight: 700; }
.rank-3 .rank-num { color: #00C96A; font-weight: 700; }

.score-pill {
  display: inline-block; padding: 2px 10px;
  border-radius: var(--r-xs); font-size: 12px; font-weight: 700;
  background: var(--tint-mint); color: var(--brand-green);
}

/* ─── RESULT SCREEN ─────────────────────────────────────────── */
.result-wrap {
  max-width: 520px; margin: 80px auto; text-align: center; padding: 0 24px;
}
.result-circle {
  width: 140px; height: 140px; border-radius: 50%;
  border: 3px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px; flex-direction: column;
  background: var(--canvas);
  box-shadow: var(--shadow-2);
}
.result-score { font-size: 40px; font-weight: 700; font-family: var(--font-head); color: var(--ink); }
.result-total { font-size: 14px; color: var(--steel); }
.result-wrap h2 { font-size: 22px; font-weight: 600; margin-bottom: 10px; color: var(--ink); letter-spacing: -0.3px; }
.result-wrap > p { color: var(--slate); margin-bottom: 28px; }

/* ─── DASHBOARD ─────────────────────────────────────────── */
.stat-card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-1);
}
.stat-value { font-size: 32px; font-weight: 700; font-family: var(--font-head); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--steel); margin-top: 4px; }

/* ─── TOAST ─────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink-deep); color: var(--on-dark);
  border-radius: var(--r-md); padding: 10px 20px; font-size: 14px;
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none; white-space: nowrap; z-index: 1001;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── UTILITIES ─────────────────────────────────────────── */
.text-muted  { color: var(--steel); }
.text-accent { color: var(--primary); }
.text-green  { color: var(--brand-green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ─── SPINNER ─────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes gradShift {
  0%, 100% { background-position: 0% center; }
  50%       { background-position: 100% center; }
}
@keyframes shimmerBtn {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* ─── DIVIDER ─────────────────────────────────────────── */
hr.divider {
  border: none; border-top: 1px solid var(--hairline);
  margin: 32px 0;
}

/* ─── LOGIN GATE ─────────────────────────────────────────── */
.login-gate { text-align: center; padding: 80px 24px; }
.login-gate h2 { font-size: 22px; font-weight: 600; margin-bottom: 12px; color: var(--ink); }
.login-gate p { color: var(--slate); margin-bottom: 28px; }

/* ─── HAMBURGER BUTTON ───────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); cursor: pointer; padding: 8px; flex-shrink: 0;
  margin-left: auto;
}
.nav-hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--charcoal); border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── MOBILE DRAWER ─────────────────────────────────────── */
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 300;
  opacity: 0; transition: opacity .3s ease;
}
.mobile-overlay.open { display: block; opacity: 1; }

.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 280px; max-width: 85vw;
  background: var(--canvas); z-index: 400;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  border-left: 1px solid var(--hairline);
  overflow-y: auto;
  visibility: hidden;
}
.mobile-drawer.open { transform: translateX(0); visibility: visible; }

.mobile-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.mobile-drawer-header .logo-img {
  width: 42px; height: 42px;
}
.mobile-drawer-header .logo-text {
  font-size: 19px; font-weight: 800; color: #1a1a1a;
}
.mobile-drawer-close {
  width: 36px; height: 36px;
  background: none; border: none;
  border-radius: 50%; cursor: pointer; color: var(--slate);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.mobile-drawer-close:hover { background: var(--surface); color: var(--charcoal); }

.mobile-drawer-nav {
  display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; flex: 1;
}
.mobile-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  color: var(--charcoal); text-decoration: none;
  font-size: 15px; font-weight: 500;
  transition: background .12s, color .12s;
  border: none; background: none; cursor: pointer;
  font-family: var(--font-sans); width: 100%; text-align: left;
}
.mobile-nav-item:hover, .mobile-nav-item.active {
  background: var(--surface); color: var(--ink);
}
.mobile-nav-item.active { font-weight: 600; }
.mobile-nav-item svg { flex-shrink: 0; opacity: .6; }
.mobile-nav-sub { padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
.mobile-nav-sub .mobile-nav-item { font-size: 14px; padding: 8px 14px; }
.mobile-nav-levels { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 4px; }
.mobile-nav-level-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 18px;
  border-radius: var(--r-md);
  color: var(--charcoal); text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: background .12s;
}
.mobile-nav-level-item:hover { background: var(--surface); }

.mobile-drawer-footer {
  padding: 16px 8px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.mobile-user-info {
  display: none; align-items: center; gap: 12px; margin-bottom: 12px;
  padding: 10px 14px;
}
.mobile-user-info img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--hairline); flex-shrink: 0;
}
.mobile-user-info-text { display: flex; flex-direction: column; }
.mobile-user-info-name { color: var(--ink); font-weight: 600; font-size: 14px; }
.mobile-user-info-label { color: var(--steel); font-size: 12px; }
.mobile-drawer-login {
  display: flex; align-items: center; justify-content: center;
  padding: 10px; border-radius: var(--r-md);
  background: var(--primary); color: var(--on-dark);
  font-size: 14px; font-weight: 500; text-decoration: none;
  cursor: pointer; border: none; font-family: var(--font-sans); width: 100%;
  transition: background .15s;
}
.mobile-drawer-login:hover { background: var(--primary-pressed); }
.mobile-drawer-signout {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; border-radius: var(--r-md);
  background: var(--surface); color: var(--charcoal);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--hairline);
  font-family: var(--font-sans); width: 100%; margin-top: 6px;
  transition: background .15s;
}
.mobile-drawer-signout:hover { background: var(--hairline-soft); }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-wrap { padding: 32px 24px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .navbar { padding: 0 16px; gap: 12px; }
  .nav-links { display: none; }
  .nav-auth .btn-nav-login { display: none; }
  .nav-auth .user-menu { display: none !important; }
  .nav-hamburger { display: flex; }
}
@media (max-width: 480px) {
  .btn-nav-register { display: none; }
}
