/* bearstudy XI v3 - Clean Duolingo Dark & Light Theme (Zero Emoji, Zero Slop) */

/* ===== LIGHT THEME ===== */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;
  --surface-tint: #EEF2F5;
  --border: #E0E5E9;
  --border-strong: #C9D1D8;

  --ink: #374147;
  --ink-dark: #1A2328;
  --ink-muted: #5C6B73;
  --ink-light: #7D8C94;

  --duo-green: #58CC02;
  --duo-green-hover: #62DF04;
  --duo-green-lip: #45A100;
  --duo-green-btn-ink: #FFFFFF;
  --duo-green-tint: #D7FFB8;
  --duo-green-soft: #ECFCE0;
  --duo-green-ink: #2D6A00;

  --duo-blue: #1CB0F6;
  --duo-blue-hover: #33BAFA;
  --duo-blue-lip: #148FC9;
  --duo-blue-btn-ink: #FFFFFF;
  --duo-blue-tint: #DDF4FF;
  --duo-blue-border: #7AD4FF;
  --duo-blue-ink: #0B5D86;

  --duo-teal: #00B894;
  --duo-teal-lip: #00896E;
  --duo-teal-tint: #D9FBF2;
  --duo-teal-ink: #006652;

  --duo-gold: #FFC800;
  --duo-gold-hover: #FFD32D;
  --duo-gold-lip: #D99B00;
  --duo-gold-tint: #FFF4C7;
  --duo-gold-ink: #7A4F00;

  --duo-orange: #FF9600;
  --duo-orange-lip: #D47400;
  --duo-orange-tint: #FFF0D9;
  --duo-orange-ink: #8C4700;

  --duo-red: #FF4B4B;
  --duo-red-hover: #FF6262;
  --duo-red-lip: #D13030;
  --duo-red-tint: #FFDFE0;
  --duo-red-ink: #92181E;

  --duo-purple: #9C51E0;
  --duo-purple-lip: #7633B5;
  --duo-purple-tint: #F3E8FF;
  --duo-purple-ink: #5A2091;

  --splash-bg: #58CC02;
  --splash-ink: #FFFFFF;
  --splash-muted: rgba(255, 255, 255, 0.88);
  --splash-rule: rgba(255, 255, 255, 0.34);
  --splash-btn-bg: #FFFFFF;
  --splash-btn-ink: #2D6A00;
  --splash-btn-lip: #3C8E00;
  --splash-ctrl-bg: rgba(16, 52, 0, 0.22);
  --splash-ctrl-bdr: rgba(255, 255, 255, 0.42);

  --ob-art-bg: #EEF7EA;
  --ob-art-border: #D6E4D1;

  --mission-bg: #6F3AD4;
  --mission-lip: #4F23A3;
  --mission-bdr: #8D5CEB;

  --sym-fill: #FFFFFF;
  --sym-stroke: #1D272C;
  --sym-active-fill: #DDF4FF;
  --sym-active-text: #0B5D86;

  --xls-hdr-bg: #E9EEF2;
  --xls-hdr-bdr: #CFD7DE;
  --xls-cell-bdr: #DCE2E8;
  --xls-formula-bg: #EBFAE0;
  --xls-formula-ink: #235900;
  --xls-bug-bg: #FFE1E2;
  --xls-bug-ink: #8E161C;
  --xls-fixed-bg: #D7FFB8;
  --xls-fixed-ink: #1F5200;
  --xls-helper-bg: #FFF3C7;
  --xls-helper-ink: #6D4600;
  --xls-title-bg: #EEF2F5;

  --code-bg: #182329;
  --code-ink: #EFF5F9;
  --code-comment: #8FA4B0;

  --topbar-bg: #FFFFFF;
  --shadow-elev: 0 10px 26px rgba(24, 36, 44, 0.08);
  --art-drop: drop-shadow(0 6px 12px rgba(24, 36, 44, 0.14));
  --emblem-bg: #FFFFFF;
  --emblem-done-bg: #FFF9DF;
}

/* ===== AUTHENTIC DUOLINGO DARK MODE (#131F24) ===== */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131F24;
  --surface: #1A2B32;
  --surface-2: #20343D;
  --surface-tint: #16242B;
  --border: #37464F;
  --border-strong: #4B606C;

  --ink: #E5EFF4;
  --ink-dark: #F4F9FC;
  --ink-muted: #9CB0BC;
  --ink-light: #728895;

  --duo-green: #93D333;
  --duo-green-hover: #A2DF45;
  --duo-green-lip: #5E9C0C;
  --duo-green-btn-ink: #131F24;
  --duo-green-tint: #1B331A;
  --duo-green-soft: #1B321C;
  --duo-green-ink: #A5E847;

  --duo-blue: #49C0F8;
  --duo-blue-hover: #63CBFA;
  --duo-blue-lip: #1B8CC4;
  --duo-blue-btn-ink: #131F24;
  --duo-blue-tint: #173444;
  --duo-blue-border: #3B9CD0;
  --duo-blue-ink: #72D3FF;

  --duo-teal: #2AD1A3;
  --duo-teal-lip: #149674;
  --duo-teal-tint: #13362E;
  --duo-teal-ink: #57E8BF;

  --duo-gold: #FFC800;
  --duo-gold-hover: #FFD333;
  --duo-gold-lip: #C48F00;
  --duo-gold-tint: #342B12;
  --duo-gold-ink: #FFD94A;

  --duo-orange: #FF9600;
  --duo-orange-lip: #C26C00;
  --duo-orange-tint: #352411;
  --duo-orange-ink: #FFB347;

  --duo-red: #FF5C5C;
  --duo-red-hover: #FF7575;
  --duo-red-lip: #C23232;
  --duo-red-tint: #361C20;
  --duo-red-ink: #FF8C8E;

  --duo-purple: #CE82FF;
  --duo-purple-lip: #9548C9;
  --duo-purple-tint: #2B1E3B;
  --duo-purple-ink: #DFA9FF;

  --splash-bg: #131F24;
  --splash-ink: #F4F9FC;
  --splash-muted: #9CB0BC;
  --splash-rule: #2D3E47;
  --splash-btn-bg: #93D333;
  --splash-btn-ink: #131F24;
  --splash-btn-lip: #5E9C0C;
  --splash-ctrl-bg: #1A2B32;
  --splash-ctrl-bdr: #37464F;

  --ob-art-bg: #16252C;
  --ob-art-border: #37464F;

  --mission-bg: #512DA8;
  --mission-lip: #371C78;
  --mission-bdr: #8D5CEB;

  --sym-fill: #20343D;
  --sym-stroke: #EAF3F8;
  --sym-active-fill: #183A4E;
  --sym-active-text: #72D3FF;

  --xls-hdr-bg: #142228;
  --xls-hdr-bdr: #2F414B;
  --xls-cell-bdr: #2A3A43;
  --xls-formula-bg: #1A311D;
  --xls-formula-ink: #9FE446;
  --xls-bug-bg: #3C1D22;
  --xls-bug-ink: #FF8C8E;
  --xls-fixed-bg: #1E3D20;
  --xls-fixed-ink: #ADF056;
  --xls-helper-bg: #322A14;
  --xls-helper-ink: #FFD94A;
  --xls-title-bg: #1E313A;

  --code-bg: #0D161A;
  --code-ink: #ECF4F8;
  --code-comment: #859BA8;

  --topbar-bg: #131F24;
  --shadow-elev: 0 14px 32px rgba(0, 0, 0, 0.36);
  --art-drop: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  --emblem-bg: #F6FAFC;
  --emblem-done-bg: #FFF7D4;
}

:root {
  --sidebar-w: 244px;
  --topbar-h: 62px;
  --bottom-h: 66px;
  --font-display: 'Nunito', 'Segoe UI Rounded', ui-rounded, 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.52;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle native scrollbar styling for both Dark & Light modes */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink-dark);
  line-height: 1.22;
  letter-spacing: -0.012em;
}

p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, textarea { font-family: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; }
code, pre, .mono { font-family: var(--font-mono); }

:focus-visible { outline: 3px solid var(--duo-blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 9999;
  background: var(--duo-blue); color: #131F24;
  padding: 10px 16px; border-radius: 12px; font-weight: 800; text-decoration: none;
}
.skip-link:focus { left: 12px; }

/* ======================================================
   OFFICIAL VECTOR ASSET STYLING & MOTION
   ====================================================== */

.bear-art {
  display: block;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  backface-visibility: hidden;
}

.brand-bear-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vec-icon {
  display: inline-block;
  object-fit: contain;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}

.lucide-icon {
  display: inline-block;
  flex-shrink: 0;
}

.bear-stack-animated {
  will-change: transform;
  animation: bearFloat 4.4s ease-in-out infinite;
}
.bear-mood-cheer     { animation: bearCheer 0.45s var(--ease) both; }
.bear-mood-celebrate { animation: bearCheer 0.55s var(--ease) both; }
.bear-mood-encourage { animation: bearEncourage 0.48s var(--ease) both; }
.bear-mood-wave      { animation: none; }
.flame-pulse         { will-change: transform; animation: flamePop 2.4s ease-in-out infinite; transform-origin: 50% 85%; }

@keyframes bearFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -6px, 0); }
}
@keyframes bearCheer {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  45% { transform: translate3d(0, -8px, 0) scale(1.04); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes bearEncourage {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-3.5deg); }
  65% { transform: rotate(2.5deg); }
}
@keyframes flamePop {
  0%, 100% { transform: scale3d(1, 1, 1); }
  50% { transform: scale3d(1.04, 1.06, 1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ======================================================
   TACTILE 3D BUTTONS, CARDS, PROGRESS & CLEAN LABELS
   ====================================================== */

.duo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.91rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 13px 22px;
  border-radius: 14px;
  border: 2px solid transparent;
  transition: transform 0.14s var(--ease), background-color 0.14s ease, border-color 0.14s ease;
  user-select: none;
  white-space: nowrap;
}

.duo-btn:active:not(:disabled) { transform: translate3d(0, 3px, 0); }
.duo-btn:disabled {
  background: var(--border) !important;
  color: var(--ink-light) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

.duo-btn-sm     { font-size: 0.78rem; padding: 8px 13px; border-radius: 11px; }
.duo-btn-lg     { font-size: 1rem; padding: 15px 30px; border-radius: 16px; }
.duo-btn-full   { width: 100%; }
.duo-btn-normal { text-transform: none; letter-spacing: 0.01em; }

.duo-btn-green {
  background: var(--duo-green); color: var(--duo-green-btn-ink);
  box-shadow: 0 4px 0 var(--duo-green-lip);
}
.duo-btn-green:hover:not(:disabled)  { background: var(--duo-green-hover); }
.duo-btn-green:active:not(:disabled) { box-shadow: 0 1px 0 var(--duo-green-lip); }

.duo-btn-blue {
  background: var(--duo-blue); color: var(--duo-blue-btn-ink);
  box-shadow: 0 4px 0 var(--duo-blue-lip);
}
.duo-btn-blue:hover:not(:disabled)  { background: var(--duo-blue-hover); }
.duo-btn-blue:active:not(:disabled) { box-shadow: 0 1px 0 var(--duo-blue-lip); }

.duo-btn-red {
  background: var(--duo-red); color: #FFFFFF;
  box-shadow: 0 4px 0 var(--duo-red-lip);
}
.duo-btn-red:hover:not(:disabled)  { background: var(--duo-red-hover); }
.duo-btn-red:active:not(:disabled) { box-shadow: 0 1px 0 var(--duo-red-lip); }

.duo-btn-gold {
  background: var(--duo-gold); color: #2D1D00;
  box-shadow: 0 4px 0 var(--duo-gold-lip);
}
.duo-btn-gold:hover:not(:disabled)  { background: var(--duo-gold-hover); }
.duo-btn-gold:active:not(:disabled) { box-shadow: 0 1px 0 var(--duo-gold-lip); }

.duo-btn-orange {
  background: var(--duo-orange); color: #1F1200;
  box-shadow: 0 4px 0 var(--duo-orange-lip);
}
.duo-btn-orange:active:not(:disabled) { box-shadow: 0 1px 0 var(--duo-orange-lip); }

.duo-btn-white {
  background: #FFFFFF; color: #3D1D8A;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.duo-btn-white:hover:not(:disabled) { background: #F5F2FF; }
.duo-btn-white:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }

.duo-btn-splash {
  background: var(--splash-btn-bg); color: var(--splash-btn-ink);
  box-shadow: 0 5px 0 var(--splash-btn-lip);
}
.duo-btn-splash:active:not(:disabled) { box-shadow: 0 1px 0 var(--splash-btn-lip); }

.duo-btn-outline {
  background: var(--surface); color: var(--ink-dark);
  border-color: var(--border); box-shadow: 0 3px 0 var(--border);
}
.duo-btn-outline:hover:not(:disabled)  { background: var(--surface-2); border-color: var(--border-strong); }
.duo-btn-outline:active:not(:disabled) { box-shadow: 0 1px 0 var(--border); }

.duo-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--border);
}

.duo-progress-track {
  width: 100%; height: 14px;
  background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.duo-progress-track-sm { height: 9px; }

.duo-progress-fill {
  position: relative; height: 100%;
  background: var(--duo-green);
  border-radius: 999px;
  transition: width 0.36s var(--spring);
}
.duo-progress-fill::after {
  content: ''; position: absolute; top: 2px; left: 6px; right: 6px; height: 4px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.28);
}
.fill-blue   { background: var(--duo-blue); }
.fill-teal   { background: var(--duo-teal); }
.fill-gold   { background: var(--duo-gold); }
.fill-orange { background: var(--duo-orange); }
.fill-purple { background: var(--duo-purple); }
.fill-red    { background: var(--duo-red); }

/* Clean crisp rectangular status tags (no AI-slop oval kickers) */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.7rem;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; line-height: 1.4;
}
.tag-green   { background: var(--duo-green-soft);  color: var(--duo-green-ink); }
.tag-blue    { background: var(--duo-blue-tint);   color: var(--duo-blue-ink); }
.tag-teal    { background: var(--duo-teal-tint);   color: var(--duo-teal-ink); }
.tag-gold    { background: var(--duo-gold-tint);   color: var(--duo-gold-ink); }
.tag-orange  { background: var(--duo-orange-tint); color: var(--duo-orange-ink); }
.tag-red     { background: var(--duo-red-tint);    color: var(--duo-red-ink); }
.tag-purple  { background: var(--duo-purple-tint); color: var(--duo-purple-ink); }
.tag-neutral { background: var(--surface-2);       color: var(--ink-muted); }
.tag-hots    { background: var(--duo-gold);        color: #2D1D00; letter-spacing: 0.06em; }

.step-num {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; font-size: 0.78rem;
  color: #FFFFFF;
}
.sn-green  { background: #4EAE02; }
.sn-blue   { background: #1496D6; }
.sn-purple { background: #8B46C6; }
.sn-orange { background: #DC7B00; }
.sn-red    { background: #D9383A; }

.section-kicker {
  font-family: var(--font-display); font-weight: 800; font-size: 0.72rem;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted);
}
.sk-green  { color: var(--duo-green-ink); }
.sk-blue   { color: var(--duo-blue-ink); }
.sk-purple { color: var(--duo-purple-ink); }
.sk-orange { color: var(--duo-orange-ink); }
.sk-red    { color: var(--duo-red-ink); }

/* ======================================================
   SCREEN 1: SPLASH SCREEN (CLEAN, SOLID, ZERO FLOATING BOXES)
   ====================================================== */

.gate-splash {
  position: fixed; inset: 0; z-index: 400;
  background-color: var(--splash-bg);
  color: var(--splash-ink);
  display: flex; flex-direction: column;
  padding: clamp(16px, 3vh, 28px) clamp(18px, 4vw, 44px) calc(clamp(18px, 3vh, 30px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  animation: fadeIn 0.22s ease;
}

.gate-splash.leaving {
  opacity: 0; transform: scale(1.015);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.splash-top-bar {
  width: 100%; max-width: 1020px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}

.splash-eyebrow {
  font-family: var(--font-display); font-weight: 900; font-size: 0.78rem;
  letter-spacing: 0.1em; color: var(--splash-muted);
}

.splash-theme-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.8rem;
  background: var(--splash-ctrl-bg); border: 2px solid var(--splash-ctrl-bdr);
  color: var(--splash-ink); padding: 7px 14px; border-radius: 12px;
  transition: filter 0.14s ease;
}
.splash-theme-btn:hover { filter: brightness(1.08); }

.gate-splash-grid {
  flex: 1;
  width: 100%; max-width: 960px; margin: auto;
  display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  align-items: center; justify-items: center;
  gap: clamp(24px, 5.5vw, 68px);
  padding: 18px 0;
}

.gate-splash-art {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
}

.gate-splash-mascot img {
  height: clamp(240px, 48vh, 380px);
  width: auto;
}

.gate-splash-copy {
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; gap: 14px; width: 100%; max-width: 470px;
}

.gate-wordmark {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(2.8rem, 6.2vw, 4.2rem);
  letter-spacing: -0.035em; line-height: 0.96;
  color: var(--splash-ink);
}
[data-theme="dark"] .gate-wordmark { color: var(--duo-green); }

.gate-for-line {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.06rem, 2.2vw, 1.32rem);
  color: var(--splash-ink);
}

/* Clean hairline numerical spec bar (replaces emoji pill spam) */
.splash-spec-bar {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%; margin: 4px 0 6px; padding: 12px 0;
  border-top: 1.5px solid var(--splash-rule);
  border-bottom: 1.5px solid var(--splash-rule);
  gap: 8px;
}
.splash-spec-item {
  display: flex; flex-direction: column; gap: 1px;
  padding-right: 8px;
  border-right: 1px solid var(--splash-rule);
}
.splash-spec-item:last-child { border-right: none; padding-right: 0; }
.splash-spec-item dt {
  font-family: var(--font-display); font-weight: 900; font-size: 1.38rem;
  line-height: 1.05; color: var(--splash-ink);
}
[data-theme="dark"] .splash-spec-item dt { color: var(--duo-blue); }
.splash-spec-item dd {
  margin: 0; font-size: 0.74rem; font-weight: 700; color: var(--splash-muted);
  line-height: 1.25;
}

.gate-enter-btn { width: 100%; max-width: 320px; margin-top: 2px; }
.gate-splash-hint { font-size: 0.82rem; font-weight: 600; color: var(--splash-muted); }

/* ======================================================
   SCREEN 2: ONBOARDING (CLEAN SOLID CANVAS, NO OVAL TAGS)
   ====================================================== */

.gate-onboarding {
  position: fixed; inset: 0; z-index: 380;
  background-color: var(--bg);
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.ob-frame {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
}

.ob-topbar {
  flex-shrink: 0;
  width: 100%; max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px clamp(14px, 3vw, 24px) 10px;
}

.ob-icon-btn {
  width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted); background: var(--surface); border: 2px solid var(--border);
  flex-shrink: 0;
}
.ob-icon-btn:hover { background: var(--surface-2); color: var(--ink-dark); }

.ob-step-count {
  font-family: var(--font-display); font-weight: 900; font-size: 0.82rem;
  color: var(--ink-muted); min-width: 34px; text-align: center;
}

.ob-body {
  flex: 1; width: 100%; overflow-y: auto;
  padding: clamp(10px, 2.5vh, 22px) clamp(14px, 3vw, 24px);
  display: flex; align-items: center; justify-content: center;
}

.ob-stage-card {
  width: 100%; max-width: 940px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--border);
  display: grid; grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
  animation: slideUp 0.24s var(--ease);
  margin: auto;
}

.ob-art-pane {
  background: var(--ob-art-bg);
  border-right: 2px solid var(--ob-art-border);
  padding: 28px 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px;
}

.ob-art-pane img.bear-art {
  height: clamp(150px, 30vh, 242px);
  width: auto;
  flex-shrink: 0;
}

.ob-art-meta {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}

.ob-art-name {
  font-family: var(--font-display); font-weight: 900; font-size: 0.82rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-dark);
}

.ob-art-caption {
  font-size: 0.84rem; color: var(--ink-muted); max-width: 24ch; line-height: 1.44;
}

.ob-content-pane {
  padding: clamp(20px, 3.2vw, 32px);
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}

.ob-eyebrow {
  font-family: var(--font-display); font-weight: 900; font-size: 0.76rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--duo-green-ink);
}

.ob-welcome-title {
  font-size: clamp(1.55rem, 3.6vw, 2.15rem);
  font-weight: 900; color: var(--ink-dark); margin-top: -6px;
}

.ob-welcome-bubble {
  background: var(--surface-2);
  border: 2px solid var(--border-strong);
  border-left: 5px solid var(--duo-green);
  border-radius: 14px; padding: 18px 20px;
  font-size: clamp(0.98rem, 1.8vw, 1.09rem);
  font-weight: 500; line-height: 1.62;
  color: var(--ink-dark);
}

.ob-mini-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}

.ob-mini-tile {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  font-size: 0.83rem; font-weight: 700; color: var(--ink-dark);
}

.ob-heading {
  font-size: clamp(1.2rem, 2.5vw, 1.48rem);
  font-weight: 900;
}

.ob-sub { font-size: 0.88rem; color: var(--ink-muted); margin-top: -8px; }

.ob-list-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}

.ob-option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 13px; border-radius: 14px;
  background: var(--surface-2); border: 2px solid var(--border);
  box-shadow: 0 3px 0 var(--border);
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.ob-option:hover { border-color: var(--border-strong); }
.ob-option:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.ob-option.is-selected {
  background: var(--duo-blue-tint);
  border-color: var(--duo-blue-border);
  box-shadow: 0 3px 0 var(--duo-blue-lip);
}

.ob-option-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--emblem-bg); border: 2px solid var(--border);
  font-family: var(--font-display); font-weight: 900; font-size: 0.84rem; color: #FFFFFF;
}
.ob-option.is-selected .ob-option-icon { border-color: var(--duo-blue); }

.ob-option-title {
  font-family: var(--font-display); font-weight: 800; font-size: 0.91rem;
  color: var(--ink-dark); display: block; line-height: 1.25;
}
.ob-option.is-selected .ob-option-title { color: var(--duo-blue-ink); }
.ob-option-sub { font-size: 0.76rem; color: var(--ink-muted); display: block; margin-top: 2px; line-height: 1.3; }

.ob-footer {
  flex-shrink: 0; border-top: 2px solid var(--border);
  padding: 13px clamp(14px, 3vw, 24px) calc(15px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
}
.ob-footer-inner { width: 100%; max-width: 940px; margin: 0 auto; display: flex; justify-content: flex-end; }
.ob-footer-inner .duo-btn { max-width: 320px; }

/* ======================================================
   SCREEN 3: MAIN APP SHELL + GPU-SMOOTH HIDEABLE SIDEBAR
   ====================================================== */

.app-shell { display: block; min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 2px solid var(--border);
  padding: 16px 13px; display: flex; flex-direction: column; gap: 12px; z-index: 40;
  overflow-y: auto;
  contain: layout style paint;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: transform 0.28s var(--ease), visibility 0.28s ease;
}

.side-brand {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 8px; border-radius: 12px; text-align: left;
  transition: background-color 0.14s ease;
}
.side-brand:hover { background: var(--surface-2); }
.side-brand-icon { width: 34px; height: 42px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.side-brand-text { display: flex; flex-direction: column; min-width: 0; }
.side-brand-word {
  font-family: var(--font-display); font-weight: 900; font-size: 1.38rem;
  letter-spacing: -0.03em; color: var(--duo-green); line-height: 1;
}
.side-brand-sub { font-size: 0.73rem; font-weight: 700; color: var(--ink-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { display: flex; flex-direction: column; gap: 5px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border-radius: 13px; border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 800; font-size: 0.84rem;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); text-align: left;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink-dark); }
.nav-item.active {
  background: var(--duo-blue-tint);
  border-color: var(--duo-blue-border);
  color: var(--duo-blue-ink);
}

.nav-item-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--emblem-bg); border: 1.5px solid var(--border); flex-shrink: 0;
}
.nav-item.active .nav-item-icon { border-color: var(--duo-blue); }

.sidebar-footer {
  border-top: 2px solid var(--border); padding-top: 10px;
  display: flex; flex-direction: column; gap: 2px;
}

.side-util-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border-radius: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.79rem;
  color: var(--ink-muted);
  transition: background-color 0.14s ease, color 0.14s ease;
}
.side-util-btn:hover { background: var(--surface-2); color: var(--ink-dark); }
.side-util-danger:hover { background: var(--duo-red-tint); color: var(--duo-red-ink); }

.workspace {
  width: 100%;
  min-height: 100vh;
  display: flex; flex-direction: column; min-width: 0;
  overflow-x: clip;
}

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 2px solid var(--border);
  padding: 0 clamp(10px, 2.4vw, 26px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: nowrap;
  contain: layout style;
}

/* Pure GPU translate3d shift — ZERO layout reflow when toggling sidebar! */
.topbar-left {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto;
  will-change: transform;
  transform: translate3d(var(--sidebar-w), 0, 0);
  transition: transform 0.28s var(--ease);
}

.topbar-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* Single unified sidebar toggle button on desktop (no duplicate inside sidebar!) */
.top-sidebar-btn { display: inline-flex; }

.topbar-page-label {
  font-family: var(--font-display); font-weight: 900; font-size: 1rem;
  color: var(--ink-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Inline quick nav fades in ONLY when sidebar is hidden */
.topbar-inline-nav {
  display: none; align-items: center; gap: 4px; margin-left: 4px;
  animation: fadeIn 0.2s var(--ease);
}
.tbin-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 10px; border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 800; font-size: 0.78rem;
  color: var(--ink-muted); white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.tbin-btn:hover { background: var(--surface); color: var(--ink-dark); }
.tbin-btn.active {
  background: var(--duo-blue-tint); border-color: var(--duo-blue-border);
  color: var(--duo-blue-ink);
}

/* Pure GPU desktop sidebar-hidden state */
html.sidebar-is-hidden .sidebar {
  transform: translate3d(-100%, 0, 0);
  visibility: hidden;
  pointer-events: none;
}
html.sidebar-is-hidden .topbar-left {
  transform: translate3d(0, 0, 0);
}
html.sidebar-is-hidden .topbar-page-label {
  display: none;
}
html.sidebar-is-hidden .topbar-inline-nav {
  display: inline-flex;
}
html.sidebar-is-hidden .topbar-quick-actions {
  display: inline-flex;
}
html.sidebar-is-hidden .main-view {
  transform: translate3d(0, 0, 0);
}

.course-chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 4px 10px 4px 6px; border-radius: 11px;
  border: 2px solid var(--border); background: var(--surface);
  font-family: var(--font-display); font-weight: 900; font-size: 0.78rem;
  color: var(--ink-dark); white-space: nowrap;
}
.course-chip:hover { background: var(--surface-2); }
.course-chip-icon { width: 20px; height: 24px; display: inline-flex; flex-shrink: 0; }

.topbar-stats { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.duo-stat-btn {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 900; font-size: 0.85rem;
  padding: 5px 10px; border-radius: 11px;
  background: var(--surface); border: 2px solid var(--border);
  white-space: nowrap;
}
.duo-stat-btn:hover { background: var(--surface-2); }
.stat-streak { color: var(--duo-orange); }
.stat-xp     { color: var(--duo-blue); }
.stat-ready  { color: var(--duo-green-ink); }

.topbar-quick-actions { display: none; align-items: center; gap: 6px; flex-shrink: 0; }
.top-icon-btn {
  width: 35px; height: 35px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted); background: var(--surface); border: 2px solid var(--border);
}
.top-icon-btn:hover { background: var(--surface-2); color: var(--ink-dark); }

.main-view {
  width: 100%;
  max-width: min(1140px, calc(100% - var(--sidebar-w)));
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 24px) clamp(12px, 2.4vw, 26px) 56px;
  outline: none;
  will-change: transform;
  transform: translate3d(calc(var(--sidebar-w) / 2), 0, 0);
  transition: transform 0.28s var(--ease);
}

.view-enter { animation: slideUp 0.18s var(--ease); }

.mobile-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 2px solid var(--border);
  padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around; align-items: center;
}

.mnav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 8px; border-radius: 11px; border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 800; font-size: 0.64rem;
  color: var(--ink-muted); min-width: 54px;
}
.mnav-btn.active {
  background: var(--duo-blue-tint);
  border-color: var(--duo-blue-border);
  color: var(--duo-blue-ink);
}

/* ======================================================
   HOME: VARIED MULTI-COLOR DUOLINGO PATH + RIGHT RAIL
   ====================================================== */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 326px;
  gap: 22px;
  align-items: start;
}

.home-welcome-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px; margin-bottom: 18px;
  border-left: 5px solid var(--duo-green);
}
.home-wb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-wb-left img.bear-art { height: 50px; width: auto; flex-shrink: 0; }
.home-wb-title { font-family: var(--font-display); font-weight: 900; font-size: 1rem; color: var(--ink-dark); }
.home-wb-sub   { font-size: 0.81rem; color: var(--ink-muted); }

.unit-block {
  margin-bottom: 22px;
  contain: layout style;
}
.unit-block:nth-of-type(n+2) {
  content-visibility: auto;
  contain-intrinsic-size: auto 460px;
}

.unit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; border-radius: 18px 18px 0 0; color: #FFFFFF;
}
.ub-green  { background: #4EAE02; }
.ub-blue   { background: #1496D6; }
.ub-orange { background: #D97706; }
.ub-purple { background: #7E3AF2; }

.unit-kicker {
  font-family: var(--font-display); font-weight: 800; font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.92;
}
.unit-heading { font-family: var(--font-display); font-weight: 900; font-size: 1.18rem; color: #FFFFFF; margin-top: 1px; }
.unit-sub { font-size: 0.81rem; opacity: 0.92; margin-top: 2px; }

.unit-guide-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 11px;
  border: 2px solid rgba(255, 255, 255, 0.36);
  background: rgba(0, 0, 0, 0.14);
  font-family: var(--font-display); font-weight: 800; font-size: 0.75rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: #FFFFFF;
  flex-shrink: 0;
}
.unit-guide-btn:hover { background: rgba(255, 255, 255, 0.2); }

/* Clean framed stage — NO dashed vertical line cutting through labels */
.path-stage {
  background: var(--surface);
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 4px 0 var(--border);
  overflow: hidden;
}

.path-rows {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px;
  padding: 26px 20px 24px;
}

.path-row-single {
  display: flex; justify-content: center; align-items: center;
  width: 100%;
}

.path-row-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 190px));
  justify-content: center;
  gap: clamp(16px, 4vw, 52px);
  width: 100%;
  align-items: start;
}

.path-node-slot {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center;
}

.start-bubble {
  font-family: var(--font-display); font-weight: 900; font-size: 0.7rem;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--duo-green-btn-ink); background: var(--duo-green);
  border-radius: 8px; padding: 3px 11px; margin-bottom: 1px;
  box-shadow: 0 2px 0 var(--duo-green-lip);
}

.stone-ring {
  position: relative;
  padding: 6px;
  border-radius: 50%;
  border: 4px solid var(--border);
  background: var(--surface-tint);
  transition: border-color 0.2s ease;
}
.stone-ring.is-current { border-color: var(--duo-green); }
.stone-ring.is-done    { border-color: var(--duo-gold); }

.stone-btn {
  position: relative;
  width: 74px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.16s var(--ease);
}
.stone-btn:hover { transform: translate3d(0, -2px, 0) scale(1.04); }
.stone-btn:active { transform: translate3d(0, 4px, 0) scale(0.97); }

/* Bright emblem pad makes every multi-color cartoon-outlined vector crisp on dark & light */
.stone-emblem {
  width: 50px; height: 48px; border-radius: 50%;
  background: var(--emblem-bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.09);
}
.stone-ring.is-done .stone-emblem {
  background: var(--emblem-done-bg);
}

/* 12 distinct vibrant node colors so neighboring skills never look monotonous */
.disc-green   { background: #58CC02; box-shadow: 0 7px 0 #3D8F00; }
.disc-teal    { background: #00B894; box-shadow: 0 7px 0 #008067; }
.disc-emerald { background: #10B981; box-shadow: 0 7px 0 #058159; }
.disc-sky     { background: #0EA5E9; box-shadow: 0 7px 0 #0873A4; }
.disc-blue    { background: #1CB0F6; box-shadow: 0 7px 0 #127FB3; }
.disc-cyan    { background: #06B6D4; box-shadow: 0 7px 0 #048096; }
.disc-indigo  { background: #6366F1; box-shadow: 0 7px 0 #4345B8; }
.disc-violet  { background: #8B5CF6; box-shadow: 0 7px 0 #6235C4; }
.disc-amber   { background: #F59E0B; box-shadow: 0 7px 0 #BA7404; }
.disc-orange  { background: #FF9600; box-shadow: 0 7px 0 #C26C00; }
.disc-coral   { background: #F45D5D; box-shadow: 0 7px 0 #BD3333; }
.disc-purple  { background: #A855F7; box-shadow: 0 7px 0 #792AC4; }
.disc-magenta { background: #EC4899; box-shadow: 0 7px 0 #B5286E; }

/* Small gold crown corner pip (keeps unique topic icon visible when completed!) */
.stone-crown-pip {
  position: absolute; bottom: -4px; right: -4px; z-index: 4;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--duo-gold);
  border: 2.5px solid var(--surface);
  box-shadow: 0 2px 0 var(--duo-gold-lip);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

/* Treasure chest checkpoint card */
.stone-chest-card {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 11px 20px; border-radius: 16px;
  background: var(--surface-2); border: 2px solid var(--border-strong);
  box-shadow: 0 4px 0 var(--border);
  text-align: left;
  transition: transform 0.12s var(--spring), border-color 0.14s ease;
}
.stone-chest-card:hover { transform: translateY(-2px); border-color: var(--duo-gold); }
.stone-chest-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.stone-chest-card.is-opened {
  background: var(--duo-gold-tint); border-color: var(--duo-gold-lip);
}
.chest-copy { display: flex; flex-direction: column; gap: 1px; }
.chest-title { font-family: var(--font-display); font-weight: 900; font-size: 0.88rem; color: var(--ink-dark); }
.chest-sub   { font-size: 0.75rem; font-weight: 700; color: var(--duo-gold-ink); }

/* Final Boss Exam Node (Unit 4) */
.stone-boss-btn {
  display: flex; align-items: center; gap: 16px; width: 100%; max-width: 420px;
  padding: 15px 20px; border-radius: 18px; text-align: left;
  background: linear-gradient(135deg, #4C2F9C 0%, #6D3ED4 100%);
  border: 2px solid #966DF2;
  box-shadow: 0 5px 0 #311B6E;
  color: #FFFFFF;
  transition: transform 0.1s var(--spring), box-shadow 0.1s ease;
}
.stone-boss-btn:hover { transform: translateY(-2px); }
.stone-boss-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #311B6E; }
.stone-boss-btn.is-done {
  border-color: var(--duo-gold);
  box-shadow: 0 5px 0 var(--duo-gold-lip);
}
.boss-emblem {
  width: 56px; height: 56px; border-radius: 15px; flex-shrink: 0;
  background: #FFFFFF; display: flex; align-items: center; justify-content: center;
}
.boss-copy {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.boss-kicker { display: block; font-family: var(--font-display); font-weight: 800; font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.88; }
.boss-title { display: block; font-family: var(--font-display); font-weight: 900; font-size: 1.05rem; line-height: 1.22; }
.boss-sub   { display: block; font-size: 0.77rem; opacity: 0.9; line-height: 1.3; }

.stone-label {
  font-family: var(--font-display); font-weight: 800; font-size: 0.82rem;
  color: var(--ink-dark); text-align: center; max-width: 170px; line-height: 1.22;
  margin-top: 3px;
}
.stone-sub { font-size: 0.71rem; color: var(--ink-muted); margin-top: -4px; line-height: 1.25; }

/* Integrated Companion & Tip Footer Strip (NEVER overlaps nodes on any viewport!) */
.unit-companion-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-top: 2px solid var(--border);
}
.unit-companion-strip.is-rev { flex-direction: row-reverse; text-align: right; }
.unit-comp-art {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0;
  width: 78px;
}
.unit-comp-art img.bear-art { height: 74px; width: auto; }
.bear-name-caption {
  font-family: var(--font-display); font-weight: 800; font-size: 0.68rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted);
}
.unit-comp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.unit-comp-head {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 900; font-size: 0.82rem;
  color: var(--ink-dark);
}
.unit-companion-strip.is-rev .unit-comp-head { justify-content: flex-end; }
.unit-comp-text { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.42; }

/* Right Rail (Duolingo Dark Challenge Card + Goal + Progress + Badges) */
.home-rail {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column; gap: 14px;
}
.rail-card { padding: 16px 18px; }
.rail-title {
  font-family: var(--font-display); font-weight: 900; font-size: 0.95rem;
  color: var(--ink-dark); display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 9px;
}

.daily-goal-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.daily-goal-meta { display: flex; justify-content: space-between; font-size: 0.77rem; font-weight: 700; color: var(--ink-muted); }

/* Featured Purple Mission Card (inspired by Duolingo dark ref bottom-center) */
.mission-card {
  background: var(--mission-bg);
  border: 2px solid var(--mission-bdr);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--mission-lip);
  padding: 16px 18px;
  color: #FFFFFF;
}
.mission-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.mission-kicker {
  font-family: var(--font-display); font-weight: 900; font-size: 0.68rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18); padding: 2px 7px; border-radius: 5px;
  display: inline-block; margin-bottom: 6px;
}
.mission-card h3 { color: #FFFFFF; font-size: 1rem; font-weight: 900; line-height: 1.25; }
.mission-card p  { font-size: 0.78rem; color: rgba(255, 255, 255, 0.88); margin-top: 3px; line-height: 1.35; }
.mission-top img.bear-art { height: 74px; width: auto; flex-shrink: 0; }
.mission-track { background: rgba(0, 0, 0, 0.28); margin: 12px 0 6px; }
.mission-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.74rem; font-weight: 800; color: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
}

.meter-row { margin-bottom: 10px; }
.meter-row:last-child { margin-bottom: 0; }
.meter-head {
  display: flex; justify-content: space-between;
  font-size: 0.79rem; font-weight: 700; color: var(--ink-muted); margin-bottom: 4px;
}

.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.award-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 10px 6px; border-radius: 13px;
  border: 2px solid var(--border); background: var(--surface-2);
  opacity: 0.44; filter: grayscale(0.75);
  transition: transform 0.14s var(--spring), opacity 0.2s ease;
}
.award-tile.unlocked {
  opacity: 1; filter: none;
  background: var(--duo-gold-tint); border-color: var(--duo-gold-lip);
}
.award-tile.unlocked:hover { transform: translateY(-2px); }
.award-icon-wrap {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--emblem-bg);
  display: flex; align-items: center; justify-content: center;
}
.award-name { font-family: var(--font-display); font-weight: 800; font-size: 0.66rem; line-height: 1.15; color: var(--ink-dark); }

/* ======================================================
   SCREEN 4: FOCUSED LESSON / QUIZ OVERLAY
   ====================================================== */

.lesson-overlay {
  position: fixed; inset: 0; z-index: 320;
  background-color: var(--bg);
  display: flex; flex-direction: column;
  animation: fadeIn 0.16s ease;
}

.ls-topbar {
  flex-shrink: 0; width: 100%; max-width: 980px; margin: 0 auto;
  padding: 14px clamp(12px, 3vw, 22px) 10px;
  display: flex; align-items: center; gap: 12px;
}

.ls-close-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted); background: var(--surface); border: 2px solid var(--border);
  flex-shrink: 0;
}
.ls-close-btn:hover { background: var(--surface-2); color: var(--ink-dark); }

.ls-counter { font-family: var(--font-display); font-weight: 900; font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }

.ls-timer {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem;
  padding: 5px 10px; border-radius: 9px;
  background: var(--duo-gold-tint); color: var(--duo-gold-ink); border: 1.5px solid var(--duo-gold-lip);
  white-space: nowrap;
}
.ls-timer.is-low { background: var(--duo-red-tint); color: var(--duo-red-ink); border-color: var(--duo-red); }

.ls-combo {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-display); font-weight: 900; font-size: 0.78rem;
  color: var(--duo-orange-ink); background: var(--duo-orange-tint);
  border: 1.5px solid var(--duo-orange-lip); padding: 4px 10px; border-radius: 8px; white-space: nowrap;
}

.ls-body {
  flex: 1; width: 100%; overflow-y: auto;
  padding: 10px clamp(12px, 3vw, 22px) 22px;
}

.ls-stage {
  width: 100%; max-width: 860px; margin: 0 auto;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 20px; box-shadow: 0 4px 0 var(--border);
  padding: clamp(16px, 2.8vw, 28px);
}

.ls-exam-layout {
  width: 100%; max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 268px;
  gap: 18px; align-items: start;
}

.ls-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 900; font-size: 0.74rem;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--duo-purple-ink); margin-bottom: 8px;
}

.ls-title {
  font-size: clamp(1.12rem, 2.5vw, 1.38rem);
  font-weight: 900; color: var(--ink-dark); line-height: 1.4; margin-bottom: 16px;
}

.ls-mascot-inline { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ls-mascot-inline img.bear-art { height: 74px; width: auto; flex-shrink: 0; }

.ls-word-hint {
  font-family: var(--font-display); font-weight: 800; font-size: 0.92rem;
  color: var(--duo-purple-ink); background: var(--duo-purple-tint);
  border-left: 4px solid var(--duo-purple); padding: 8px 14px; border-radius: 8px;
}

/* 2x2 Visual Grid */
.visual-grid-2x2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.vcard-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 132px; padding: 16px 12px; border-radius: 15px;
  background: var(--surface-2); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border);
  text-align: center; transition: transform 0.08s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.vcard-opt:hover:not(:disabled) { border-color: var(--border-strong); }
.vcard-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--border); }
.vcard-opt.is-selected { background: var(--duo-blue-tint); border-color: var(--duo-blue-border); box-shadow: 0 4px 0 var(--duo-blue-lip); }
.vcard-opt.is-correct  { background: var(--duo-green-soft); border-color: var(--duo-green); box-shadow: 0 4px 0 var(--duo-green-lip); }
.vcard-opt.is-wrong    { background: var(--duo-red-tint); border-color: var(--duo-red); box-shadow: 0 4px 0 var(--duo-red-lip); }
.vcard-svg { transform: scale(1.24); }
.vcard-label { font-family: var(--font-display); font-weight: 800; font-size: 0.88rem; color: var(--ink-dark); }

/* MCQ Options */
.mcq-list { display: flex; flex-direction: column; gap: 9px; }

.mcq-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 15px; border-radius: 14px;
  background: var(--surface-2); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border);
  font-size: 0.94rem; line-height: 1.44; color: var(--ink-dark);
  transition: transform 0.08s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.mcq-opt:hover:not(:disabled) { border-color: var(--border-strong); }
.mcq-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.mcq-opt.is-selected { background: var(--duo-blue-tint); border-color: var(--duo-blue-border); box-shadow: 0 3px 0 var(--duo-blue-lip); color: var(--duo-blue-ink); font-weight: 600; }
.mcq-opt.is-correct  { background: var(--duo-green-soft); border-color: var(--duo-green); box-shadow: 0 3px 0 var(--duo-green-lip); color: var(--duo-green-ink); font-weight: 600; }
.mcq-opt.is-wrong    { background: var(--duo-red-tint); border-color: var(--duo-red); box-shadow: 0 3px 0 var(--duo-red-lip); color: var(--duo-red-ink); }

.opt-key {
  width: 29px; height: 29px; border-radius: 8px;
  border: 2px solid var(--border-strong); background: var(--surface);
  font-family: var(--font-display); font-weight: 900; font-size: 0.79rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--ink-muted);
}
.mcq-opt.is-selected .opt-key { border-color: var(--duo-blue); background: var(--duo-blue); color: var(--duo-blue-btn-ink); }
.mcq-opt.is-correct  .opt-key { border-color: var(--duo-green); background: var(--duo-green); color: var(--duo-green-btn-ink); }
.mcq-opt.is-wrong    .opt-key { border-color: var(--duo-red); background: var(--duo-red); color: #FFFFFF; }

/* Bottom Feedback Dock */
.ls-dock {
  flex-shrink: 0; border-top: 2px solid var(--border); background: var(--surface);
  padding: 14px clamp(12px, 3vw, 22px) calc(16px + env(safe-area-inset-bottom, 0px));
}
.ls-dock.state-ok  { background: var(--duo-green-tint); border-top-color: var(--duo-green-lip); }
.ls-dock.state-err { background: var(--duo-red-tint); border-top-color: var(--duo-red-lip); }

.ls-dock-inner { width: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 11px; }
.ls-fb-row { display: flex; align-items: center; gap: 12px; }
.ls-fb-badge {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); flex-shrink: 0;
}
.state-ok  .ls-fb-badge { color: var(--duo-green-ink); }
.state-err .ls-fb-badge { color: var(--duo-red-ink); }
.ls-fb-title { font-family: var(--font-display); font-weight: 900; font-size: 1.06rem; }
.state-ok  .ls-fb-title { color: var(--duo-green-ink); }
.state-err .ls-fb-title { color: var(--duo-red-ink); }
.ls-fb-text { font-size: 0.87rem; line-height: 1.46; margin-top: 2px; color: var(--ink-dark); }
.ls-fb-bear img.bear-art { height: 60px; width: auto; flex-shrink: 0; }
.ls-dock-actions { display: flex; gap: 10px; }

/* Milestone & Lesson Complete (matching Duolingo Dark ref) */
.milestone-box {
  width: 100%; max-width: 560px; margin: 24px auto;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 22px; box-shadow: 0 5px 0 var(--border);
  padding: 36px 26px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: slideUp 0.3s var(--spring);
}
.milestone-title-green { font-size: 2rem; font-weight: 900; color: var(--duo-green); }
.milestone-title-gold  { font-size: 2rem; font-weight: 900; color: var(--duo-gold); }
.milestone-bears { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 6px 0; }
.milestone-bears img.bear-art { height: 152px; width: auto; }

.xp-breakdown-list {
  width: 100%; max-width: 420px; margin: 12px auto 6px;
  display: flex; flex-direction: column; gap: 8px;
}
.xp-row-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-radius: 13px;
  background: var(--surface-2); border: 2px solid var(--border);
  font-family: var(--font-display); font-weight: 900; font-size: 0.85rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-dark);
}
.xp-row-val { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; color: var(--duo-gold); }
[data-theme="light"] .xp-row-val { color: var(--duo-gold-ink); }

.exam-palette {
  padding: 15px;
  position: sticky; top: 12px; align-self: start;
}
.num-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.num-dot {
  height: 34px; border-radius: 8px;
  border: 2px solid var(--border); background: var(--surface-2);
  font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; color: var(--ink-muted);
}
.num-dot.is-answered { background: var(--duo-blue-tint); border-color: var(--duo-blue-border); color: var(--duo-blue-ink); }
.num-dot.is-current  { background: var(--duo-green); border-color: var(--duo-green-lip); color: var(--duo-green-btn-ink); }

.review-item { padding: 14px 16px; margin-bottom: 10px; border-left: 5px solid var(--duo-green); }
.review-item.is-wrong { border-left-color: var(--duo-red); }

/* ======================================================
   SCREEN 5: STREAK CELEBRATION OVERLAY
   ====================================================== */

.streak-overlay {
  position: fixed; inset: 0; z-index: 360;
  background-color: var(--bg);
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.streak-scroll {
  flex: 1; overflow-y: auto; display: flex; align-items: center; justify-content: center;
  padding: 20px 16px;
}

.streak-card {
  width: 100%; max-width: 560px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 22px; box-shadow: 0 5px 0 var(--border);
  padding: clamp(22px, 4vw, 34px); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: slideUp 0.34s var(--spring);
}

.streak-hero-row { display: flex; align-items: flex-end; justify-content: center; gap: 18px; }
.streak-hero-row img.bear-art { height: 96px; width: auto; }
.streak-fire-img { width: 106px; height: 106px; object-fit: contain; }

.streak-big-num { font-family: var(--font-display); font-weight: 900; font-size: 4rem; line-height: 0.92; color: var(--duo-orange); }
.streak-big-label { font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; color: var(--duo-orange); margin-bottom: 6px; }

.streak-week-card {
  width: 100%; padding: 16px 14px; border-radius: 15px;
  border: 2px solid var(--border); background: var(--surface-2); margin: 4px 0 8px;
}
.streak-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.sday-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sday-lbl { font-family: var(--font-display); font-weight: 800; font-size: 0.72rem; color: var(--ink-light); }
.sday-col.is-active .sday-lbl { color: var(--duo-orange); }
.sday-dot {
  width: 32px; height: 32px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center; color: #FFFFFF;
}
.sday-col.is-active .sday-dot { background: var(--duo-orange); box-shadow: 0 3px 0 var(--duo-orange-lip); }
.streak-note { font-size: 0.86rem; color: var(--ink-muted); border-top: 1.5px solid var(--border); padding-top: 10px; }

.streak-xp-summary {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 900; font-size: 0.88rem;
  color: var(--duo-gold-ink); background: var(--duo-gold-tint);
  border: 1.5px solid var(--duo-gold-lip); padding: 6px 14px; border-radius: 10px;
}

/* ======================================================
   INNER VIEWS: MATERI, FLASHCARDS, QUIZ HUB, LAB EXCEL
   ====================================================== */

.page-head-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px; margin-bottom: 16px;
  border-radius: 18px; border: 2px solid var(--border);
  border-left: 6px solid var(--duo-blue);
  background: var(--surface); box-shadow: 0 3px 0 var(--border);
}
.phr-green  { border-left-color: var(--duo-green); }
.phr-purple { border-left-color: var(--duo-purple); }
.phr-orange { border-left-color: var(--duo-orange); }
.phr-blue   { border-left-color: var(--duo-blue); }

.page-head-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-head-emblem {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
  background: var(--emblem-bg); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.page-head-row h1 { font-size: clamp(1.2rem, 2.5vw, 1.52rem); font-weight: 900; margin-bottom: 2px; }
.page-head-row p  { font-size: 0.87rem; color: var(--ink-muted); }
.page-head-bear img.bear-art { height: 78px; width: auto; flex-shrink: 0; }

.pill-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pill-tab {
  font-family: var(--font-display); font-weight: 800; font-size: 0.82rem;
  padding: 9px 14px; border-radius: 11px;
  background: var(--surface); border: 2px solid var(--border); box-shadow: 0 2px 0 var(--border);
  color: var(--ink-muted);
}
.pill-tab:hover { background: var(--surface-2); color: var(--ink-dark); }
.pill-tab.active        { background: var(--duo-blue-tint); border-color: var(--duo-blue-border); box-shadow: 0 2px 0 var(--duo-blue-lip); color: var(--duo-blue-ink); }
.pill-tab.active-green  { background: var(--duo-green-soft); border-color: var(--duo-green); box-shadow: 0 2px 0 var(--duo-green-lip); color: var(--duo-green-ink); }
.pill-tab.active-orange { background: var(--duo-orange-tint); border-color: var(--duo-orange); box-shadow: 0 2px 0 var(--duo-orange-lip); color: var(--duo-orange-ink); }
.pill-tab.active-purple { background: var(--duo-purple-tint); border-color: var(--duo-purple); box-shadow: 0 2px 0 var(--duo-purple-lip); color: var(--duo-purple-ink); }

.lesson-stack { display: flex; flex-direction: column; gap: 16px; }
.lesson-card  { padding: clamp(16px, 2.4vw, 22px); border-top: 4px solid var(--border-strong); }
.lc-green  { border-top-color: var(--duo-green); }
.lc-blue   { border-top-color: var(--duo-blue); }
.lc-purple { border-top-color: var(--duo-purple); }
.lc-orange { border-top-color: var(--duo-orange); }
.lc-red    { border-top-color: var(--duo-red); }

.lesson-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lesson-card-head h2 { font-size: 1.14rem; font-weight: 900; margin-top: 3px; }
.lesson-lead { font-size: 0.93rem; color: var(--ink); line-height: 1.62; margin-bottom: 14px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.info-box {
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: 13px; padding: 13px 15px;
}
.ib-green  { border-left: 4px solid var(--duo-green); }
.ib-blue   { border-left: 4px solid var(--duo-blue); }
.ib-teal   { border-left: 4px solid var(--duo-teal); }
.ib-purple { border-left: 4px solid var(--duo-purple); }
.ib-orange { border-left: 4px solid var(--duo-orange); }
.ib-red    { border-left: 4px solid var(--duo-red); }
.ib-gold   { border-left: 4px solid var(--duo-gold); }

.info-box-title {
  font-family: var(--font-display); font-weight: 900; font-size: 0.9rem;
  color: var(--ink-dark); margin-bottom: 5px; display: flex; align-items: center; gap: 8px;
}
.info-box p { font-size: 0.85rem; color: var(--ink-muted); line-height: 1.48; }

.lang-box-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.lang-logo-pad {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--emblem-bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}

.clean-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.88rem; color: var(--ink); }

.callout { padding: 14px 16px; border-radius: 13px; border: 2px solid; margin-top: 12px; font-size: 0.87rem; line-height: 1.56; }
.callout-green { background: var(--duo-green-soft); border-color: var(--duo-green-lip); color: var(--ink-dark); }
.callout-blue  { background: var(--duo-blue-tint);  border-color: var(--duo-blue-border); color: var(--ink-dark); }
.callout-gold  { background: var(--duo-gold-tint);  border-color: var(--duo-gold-lip); color: var(--ink-dark); }
.callout-red   { background: var(--duo-red-tint);   border-color: var(--duo-red-lip); color: var(--ink-dark); }
.callout-title {
  font-family: var(--font-display); font-weight: 900; font-size: 0.9rem;
  margin-bottom: 4px; display: flex; align-items: center; gap: 7px;
}
.callout-green .callout-title { color: var(--duo-green-ink); }
.callout-blue  .callout-title { color: var(--duo-blue-ink); }
.callout-gold  .callout-title { color: var(--duo-gold-ink); }
.callout-red   .callout-title { color: var(--duo-red-ink); }

.compare-wrap { overflow-x: auto; border: 2px solid var(--border); border-radius: 13px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: var(--surface); }
.compare-table th {
  text-align: left; font-family: var(--font-display); font-weight: 900;
  background: var(--surface-2); padding: 10px 13px; border-bottom: 2px solid var(--border); color: var(--ink-dark);
}
.compare-table td { padding: 10px 13px; border-bottom: 1.5px solid var(--border); vertical-align: top; }
.compare-table tr:last-child td { border-bottom: none; }

.symbol-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.symbol-card {
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px;
  padding: 13px 11px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px;
  transition: border-color 0.14s ease, transform 0.12s ease;
}
.symbol-card:hover { border-color: var(--duo-blue-border); transform: translateY(-2px); }
.symbol-svg-box {
  width: 96px; height: 58px; display: flex; align-items: center; justify-content: center;
  background: var(--duo-blue-tint); border-radius: 10px; padding: 5px;
}
.symbol-name { font-family: var(--font-display); font-weight: 900; font-size: 0.81rem; color: var(--ink-dark); line-height: 1.2; }
.symbol-desc { font-size: 0.74rem; color: var(--ink-muted); line-height: 1.38; }

.sim-grid { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 18px; align-items: start; }
.flowchart-stage {
  background: var(--surface-2);
  border: 2px solid var(--duo-blue-border); border-radius: 15px;
  padding: 14px; display: flex; justify-content: center;
}
.code-panel {
  background: var(--code-bg); color: var(--code-ink);
  border-radius: 14px; padding: 15px; font-family: var(--font-mono); font-size: 0.83rem; line-height: 1.74;
  border: 2px solid var(--border); overflow-x: auto;
}
.code-line { padding: 2px 10px; border-radius: 6px; white-space: pre; }
.code-line.is-comment { color: var(--code-comment); }
.code-line.is-active  { background: var(--duo-blue); color: #131F24; font-weight: 700; }

.sim-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label { font-family: var(--font-display); font-weight: 800; font-size: 0.77rem; color: var(--ink-muted); }
.num-input, .text-input {
  background: var(--surface-2); border: 2px solid var(--border-strong);
  border-radius: 11px; padding: 8px 12px; font-weight: 700; font-size: 0.9rem; color: var(--ink-dark);
}
.num-input { width: 90px; }
.sim-output {
  margin-top: 10px; padding: 11px 14px; border-radius: 11px;
  background: var(--duo-green-soft); border: 2px solid var(--duo-green-lip);
  color: var(--duo-green-ink); font-family: var(--font-mono); font-size: 0.83rem; font-weight: 700;
}

/* Flashcards 2-column layout with category color strip */
.fc-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start;
}
.fc-meta-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fc-counter { font-family: var(--font-display); font-weight: 900; font-size: 0.9rem; color: var(--ink-muted); }

.flip-scene { perspective: 1200px; margin: 14px 0 18px; }
.flip-card {
  position: relative; width: 100%; min-height: 312px;
  transform-style: preserve-3d; transition: transform 0.5s var(--spring); cursor: pointer;
}
.flip-card.is-flipped { transform: rotateY(180deg); }

.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 2.5px solid var(--border-strong);
  border-top-width: 6px;
  border-radius: 20px; box-shadow: 0 5px 0 var(--border);
  padding: 52px 26px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px;
}
.flip-cat-bab2  { border-top-color: var(--duo-blue); }
.flip-cat-flow  { border-top-color: var(--duo-purple); }
.flip-cat-excel { border-top-color: var(--duo-orange); }

.flip-face-back {
  transform: rotateY(180deg);
  background: var(--duo-green-soft); border-color: var(--duo-green);
  border-top-width: 6px;
  box-shadow: 0 5px 0 var(--duo-green-lip);
}
.flip-top-badges { position: absolute; top: 14px; left: 18px; right: 18px; display: flex; justify-content: space-between; gap: 8px; }
.flip-prompt { font-family: var(--font-display); font-weight: 900; font-size: clamp(1.18rem, 2.6vw, 1.54rem); color: var(--ink-dark); line-height: 1.32; max-width: 30ch; }
.flip-answer { font-size: 1rem; line-height: 1.6; color: var(--ink-dark); max-width: 48ch; font-weight: 500; }
.flip-answer code { background: var(--surface); padding: 2px 7px; border-radius: 6px; border: 1.5px solid var(--duo-green-lip); font-size: 0.87rem; color: var(--duo-blue-ink); }
.flip-hint { position: absolute; bottom: 13px; font-size: 0.75rem; font-weight: 700; color: var(--ink-muted); }
.fc-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.fc-side-card { padding: 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fc-side-card img.bear-art { height: 118px; width: auto; }
.fc-stat-trio {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%;
}
.fc-stat-cell {
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 7px 4px;
}
.fc-stat-num { font-family: var(--font-display); font-weight: 900; font-size: 1.05rem; color: var(--ink-dark); line-height: 1.1; }
.fc-stat-lbl { font-size: 0.67rem; font-weight: 700; color: var(--ink-muted); }

/* Quiz Hub (varied color top bars + dedicated flat vector icons) */
.pack-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack-card {
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  border-top: 5px solid var(--border-strong);
  transition: transform 0.12s ease;
}
.pack-card:hover { transform: translateY(-2px); }
.pk-green  { border-top-color: var(--duo-green); }
.pk-blue   { border-top-color: var(--duo-blue); }
.pk-orange { border-top-color: var(--duo-orange); }
.pk-purple { border-top-color: var(--duo-purple); }
.pk-gold   { border-top-color: var(--duo-gold); }
.pk-teal   { border-top-color: var(--duo-teal); }
.pk-red    { border-top-color: var(--duo-red); border-color: var(--duo-red); }

.pack-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pack-icon-box {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--emblem-bg); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pack-meta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.pack-card h3 { font-size: 1.02rem; font-weight: 900; }
.pack-card p  { font-size: 0.83rem; color: var(--ink-muted); line-height: 1.46; }
.pack-actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 7px; }

.switch-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 16px; margin-bottom: 14px;
}
.switch-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.83rem; color: var(--ink-dark); cursor: pointer;
}
.switch-label input { width: 17px; height: 17px; accent-color: var(--duo-green); }

/* Essays (2-col on desktop) */
.essay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.essay-card { padding: 18px; display: flex; flex-direction: column; border-top: 4px solid var(--duo-blue); }
.essay-card.is-excel { border-top-color: var(--duo-orange); }
.essay-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.essay-question { font-family: var(--font-display); font-weight: 800; font-size: 0.97rem; line-height: 1.45; margin-bottom: 10px; color: var(--ink-dark); }
.essay-textarea {
  width: 100%; min-height: 92px; padding: 11px 13px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface-2);
  font-size: 0.9rem; line-height: 1.52; color: var(--ink-dark); resize: vertical;
}
.essay-textarea:focus { border-color: var(--duo-blue); background: var(--surface); }
.kw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 9px 0; }
.kw-label { font-size: 0.74rem; font-weight: 700; color: var(--ink-muted); }
.kw-chip {
  font-family: var(--font-display); font-weight: 800; font-size: 0.7rem;
  padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-muted); border: 1.5px solid var(--border);
}
.kw-chip.hit { background: var(--duo-green-soft); color: var(--duo-green-ink); border-color: var(--duo-green); }
.essay-answer-box {
  margin-top: 10px; padding: 13px 14px; border-radius: 12px;
  background: var(--duo-green-soft); border: 2px solid var(--duo-green-lip);
  font-size: 0.85rem; line-height: 1.58; white-space: pre-line; color: var(--ink-dark);
}
.essay-actions { margin-top: auto; padding-top: 11px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.rating-group { display: flex; flex-wrap: wrap; gap: 5px; }
.rate-btn {
  font-family: var(--font-display); font-weight: 800; font-size: 0.74rem;
  padding: 5px 10px; border-radius: 8px; border: 2px solid var(--border);
  background: var(--surface-2); color: var(--ink-muted);
}
.rate-btn.active-retry  { background: var(--duo-red-tint);   border-color: var(--duo-red);   color: var(--duo-red-ink); }
.rate-btn.active-almost { background: var(--duo-gold-tint);  border-color: var(--duo-gold);  color: var(--duo-gold-ink); }
.rate-btn.active-master { background: var(--duo-green-soft); border-color: var(--duo-green); color: var(--duo-green-ink); }

/* Lab Excel */
.formula-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: var(--surface); border: 2px solid var(--border);
  border-radius: 13px; margin-bottom: 11px; box-shadow: 0 2px 0 var(--border);
}
.fb-ref {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.83rem; min-width: 50px; text-align: center;
  padding: 4px 8px; border-radius: 7px;
  background: var(--duo-blue-tint); color: var(--duo-blue-ink); border: 1.5px solid var(--duo-blue-border);
}
.fb-fx { font-family: var(--font-mono); font-style: italic; font-weight: 700; color: var(--ink-muted); }
.fb-expr { font-family: var(--font-mono); font-size: 0.85rem; overflow-x: auto; white-space: nowrap; flex: 1; color: var(--ink-dark); }

.excel-wrap {
  overflow-x: auto; border: 2px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: 0 3px 0 var(--border); margin-bottom: 13px;
}
.excel-grid { border-collapse: collapse; width: 100%; min-width: 580px; font-size: 0.81rem; }
.excel-grid th.col-hdr, .excel-grid th.row-hdr {
  background: var(--xls-hdr-bg); color: var(--ink-muted);
  font-family: var(--font-mono); font-weight: 700; font-size: 0.72rem;
  border: 1px solid var(--xls-hdr-bdr); padding: 5px 8px; text-align: center;
}
.excel-grid th.row-hdr { width: 32px; }
.excel-grid td {
  border: 1px solid var(--xls-cell-bdr); padding: 6px 9px;
  position: relative; cursor: pointer; white-space: nowrap; color: var(--ink);
}
.excel-grid td:hover { background: var(--surface-2); }
.excel-grid td.is-title      { background: var(--xls-title-bg); font-family: var(--font-display); font-weight: 900; text-align: center; color: var(--ink-dark); }
.excel-grid td.is-header     { background: var(--duo-green-soft); font-family: var(--font-display); font-weight: 800; color: var(--duo-green-ink); text-align: center; }
.excel-grid td.is-helper-hdr { background: var(--xls-helper-bg); font-family: var(--font-display); font-weight: 800; color: var(--xls-helper-ink); text-align: center; }
.excel-grid td.is-num        { text-align: right; font-family: var(--font-mono); font-size: 0.79rem; }
.excel-grid td.is-center     { text-align: center; }
.excel-grid td.is-formula    { background: var(--xls-formula-bg); color: var(--xls-formula-ink); font-weight: 700; }
.excel-grid td.is-formula::after {
  content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 8px solid var(--duo-green); border-left: 8px solid transparent;
}
.excel-grid td.is-bug        { background: var(--xls-bug-bg); color: var(--xls-bug-ink); font-weight: 700; }
.excel-grid td.is-bug::after {
  content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 9px solid var(--duo-red); border-left: 9px solid transparent;
}
.excel-grid td.is-fixed      { background: var(--xls-fixed-bg); color: var(--xls-fixed-ink); font-weight: 700; }
.excel-grid td.is-challenge  { background: var(--duo-blue-tint); border: 2px dashed var(--duo-blue); color: var(--duo-blue-ink); font-weight: 700; text-align: center; }
.excel-grid td.is-challenge.solved { background: var(--duo-green-soft); border: 2px solid var(--duo-green); color: var(--duo-green-ink); }
.excel-grid td.is-active     { outline: 2.5px solid var(--duo-blue); outline-offset: -2px; z-index: 2; }
.excel-grid td.is-ref-lookup { box-shadow: inset 0 0 0 2px var(--duo-blue); background: var(--duo-blue-tint) !important; }
.excel-grid td.is-ref-table  { box-shadow: inset 0 0 0 2px var(--duo-orange); background: var(--duo-gold-tint) !important; }

.excel-inspector { padding: 15px 18px; display: flex; gap: 16px; align-items: center; margin-bottom: 13px; }
.excel-inspector img.bear-art { height: 80px; width: auto; flex-shrink: 0; }
.arg-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.arg-pill { padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1.5px solid var(--border); font-size: 0.78rem; }
.arg-pill code { font-weight: 700; color: var(--duo-blue-ink); }

.challenge-panel {
  padding: 16px 18px; border: 2px solid var(--duo-blue-border);
  background: var(--duo-blue-tint); border-radius: 15px; margin-bottom: 13px;
}
.challenge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1.5px solid var(--border); }
.challenge-row:last-child { border-bottom: none; padding-bottom: 0; }
.challenge-row input { flex: 1; min-width: 180px; font-family: var(--font-mono); font-size: 0.85rem; }

.legend-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.76rem; color: var(--ink-muted); margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid var(--border-strong); }
.swatch-formula { background: var(--xls-formula-bg); border-color: var(--duo-green); }
.swatch-lookup  { background: var(--duo-blue-tint); border-color: var(--duo-blue); }
.swatch-table   { background: var(--duo-gold-tint); border-color: var(--duo-orange); }
.swatch-bug     { background: var(--xls-bug-bg); border-color: var(--duo-red); }

/* Modal, Toast & Confetti */
.modal-root {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(0, 0, 0, 0.58);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-box {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 2px solid var(--border-strong); border-radius: 20px;
  box-shadow: 0 6px 0 var(--border), var(--shadow-elev);
  padding: 24px; text-align: center; animation: slideUp 0.22s var(--spring);
}
.modal-box h3 { font-size: 1.18rem; font-weight: 900; margin: 10px 0 6px; }
.modal-box p  { font-size: 0.87rem; color: var(--ink-muted); margin-bottom: 16px; line-height: 1.54; }
.modal-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.toast-root {
  position: fixed; bottom: 20px; right: 20px; z-index: 420;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  transition: bottom 0.16s ease;
}
/* Lift toast safely above fullscreen lesson/streak dock buttons */
body.has-dock-overlay .toast-root {
  bottom: 98px;
}
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); color: var(--ink-dark); border: 2px solid var(--border-strong);
  font-family: var(--font-display); font-weight: 800; font-size: 0.82rem;
  padding: 10px 15px; border-radius: 12px; box-shadow: var(--shadow-elev);
  animation: slideUp 0.22s var(--spring);
}
.toast-green { background: var(--duo-green); color: var(--duo-green-btn-ink); border-color: var(--duo-green-lip); }
.toast-gold  { background: var(--duo-gold); color: #2D1D00; border-color: var(--duo-gold-lip); }

.confetti-layer { position: fixed; inset: 0; z-index: 460; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px; width: 9px; height: 9px; border-radius: 3px;
  will-change: transform, opacity;
  animation: confettiFall 1.35s cubic-bezier(0.2, 0.7, 0.35, 1) forwards;
}
@keyframes confettiFall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate3d(0, 92vh, 0) rotate(520deg); opacity: 0; }
}

/* ======================================================
   COMPREHENSIVE MULTI-DEVICE RESPONSIVE BREAKPOINTS
   (1920, 1440, 1280, 1024, 768, 430, 390, 360 & Landscape)
   ====================================================== */

@media (max-width: 1180px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 294px; gap: 16px; }
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbin-btn span { display: none; }
  .tbin-btn { padding: 6px 8px; }
}

@media (max-width: 1040px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-rail { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ls-exam-layout { grid-template-columns: 1fr; }
  .exam-palette { position: static; }
  .num-grid { grid-template-columns: repeat(10, 1fr); }
  .symbol-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .essay-grid { grid-template-columns: 1fr; }
  .fc-layout { grid-template-columns: 1fr; }
  .fc-side-card { flex-direction: row; text-align: left; }
  .fc-side-card img.bear-art { height: 78px; }
}

@media (max-width: 900px) {
  .sidebar { display: none !important; }
  .top-sidebar-btn { display: none !important; }
  .topbar-inline-nav { display: none !important; }
  .topbar { height: 58px; padding: 0 12px; gap: 8px; }
  .topbar-left { transform: none !important; transition: none; flex: 1; }
  .topbar-page-label { display: none; }
  .topbar-quick-actions { display: inline-flex; }
  .mobile-nav { display: flex; }
  .main-view {
    max-width: 100%;
    transform: none !important;
    transition: none;
    padding-bottom: calc(var(--bottom-h) + 26px);
  }
  .toast-root { bottom: calc(var(--bottom-h) + 12px); right: 12px; left: 12px; align-items: center; }
  body.has-dock-overlay .toast-root { bottom: 96px; }
  .sim-grid { grid-template-columns: 1fr; }
  .ob-stage-card { grid-template-columns: 1fr; }
  .ob-art-pane {
    border-right: none; border-bottom: 2px solid var(--ob-art-border);
    flex-direction: row; text-align: left; padding: 14px 18px; justify-content: flex-start; gap: 14px;
  }
  .ob-art-meta { align-items: flex-start; }
  .ob-art-caption { max-width: none; }
  .ob-art-pane img.bear-art { height: 78px; }
  .ob-footer-inner .duo-btn { max-width: 100%; }
}

@media (max-width: 760px) {
  .gate-splash-grid { grid-template-columns: 1fr; text-align: center; gap: 16px; }
  .gate-splash-copy { align-items: center; text-align: center; }
  .gate-splash-mascot img { height: clamp(190px, 35vh, 276px); }
  .splash-spec-item { padding-right: 4px; align-items: center; }
  .ob-list-grid, .ob-mini-grid { grid-template-columns: 1fr; }
  .num-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (max-width: 600px) {
  .home-rail, .grid-2, .grid-3, .pack-grid { grid-template-columns: 1fr; }
  .symbol-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-welcome-bar { flex-direction: column; align-items: stretch; text-align: left; }
  .unit-guide-btn span { display: none; }
  .path-rows { padding: 22px 12px 20px; gap: 20px; }
  .path-row-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stone-btn { width: 68px; height: 62px; }
  .stone-emblem { width: 46px; height: 44px; }
  .stone-label { font-size: 0.77rem; max-width: 144px; }
  .unit-companion-strip { padding: 11px 14px; gap: 11px; }
  .unit-comp-art { width: 62px; }
  .unit-comp-art img.bear-art { height: 62px; }
  .excel-inspector { flex-direction: column; text-align: center; }
  .arg-pills { justify-content: center; }
  .page-head-row { padding: 14px 16px; }
  .page-head-emblem { display: none; }
  .page-head-bear img.bear-art { height: 60px; }
  .streak-hero-row img.bear-art { height: 68px; }
  .streak-fire-img { width: 84px; height: 84px; }
  .num-grid { grid-template-columns: repeat(5, 1fr); }
  .fc-side-card { flex-direction: column; text-align: center; }
}

/* Mobile Topbar Anti-Overlap (guarantees 0 collision at 430px, 390px & 360px even with 4-digit XP!) */
@media (max-width: 560px) {
  .topbar { padding: 0 8px; gap: 6px; }
  .topbar-left { flex: 0 0 auto; gap: 6px; }
  .topbar-right { flex: 1; justify-content: flex-end; gap: 5px; min-width: 0; }
  .course-chip { padding: 4px; width: 34px; height: 34px; justify-content: center; }
  .course-chip-label { display: none; }
  .topbar-stats { gap: 4px; }
  .duo-stat-btn { padding: 4px 6px; font-size: 0.75rem; gap: 3px; border-radius: 9px; }
  .duo-stat-btn .vec-icon { width: 15px; height: 15px; }
  .topbar-quick-actions { gap: 4px; }
  .top-icon-btn { width: 31px; height: 31px; border-radius: 9px; }
  .mnav-btn { min-width: 48px; padding: 4px 4px; font-size: 0.61rem; }
}

@media (max-width: 375px) {
  .splash-spec-bar { grid-template-columns: repeat(2, 1fr); row-gap: 10px; }
  .splash-spec-item:nth-child(2) { border-right: none; }
  .duo-stat-btn { padding: 3px 5px; font-size: 0.71rem; }
  .top-icon-btn { width: 29px; height: 29px; }
  .course-chip { width: 31px; height: 31px; }
  .stone-boss-btn { padding: 12px 14px; gap: 12px; }
  .boss-emblem { width: 46px; height: 46px; }
}

/* Short Landscape Phones (e.g. 844x390) */
@media (max-height: 480px) and (orientation: landscape) {
  .gate-splash-grid { grid-template-columns: 180px minmax(0, 1fr); gap: 22px; padding: 4px 0; }
  .gate-splash-mascot img { height: 196px; }
  .gate-wordmark { font-size: 2.2rem; }
  .splash-spec-bar { padding: 7px 0; margin: 2px 0; }
  .splash-spec-item dt { font-size: 1.05rem; }
  .gate-splash-hint { display: none; }
  .ob-topbar { padding: 8px 16px 6px; }
  .ob-body { align-items: flex-start; padding: 8px 16px; }
  .ob-art-pane { padding: 10px 14px; }
  .ob-art-pane img.bear-art { height: 62px; }
  .ob-footer { padding: 8px 16px; }
  .ls-topbar { padding: 8px 16px 6px; }
  .ls-dock { padding: 8px 16px; }
  .vcard-opt { min-height: 88px; padding: 10px; }
  .streak-scroll { align-items: flex-start; }
  .streak-big-num { font-size: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
