:root {
    --bg: #190f12;
    --bg-raised: #241318;
    --bg-card: #2b161c;
    --bg-card-hi: #331a21;
    --ink: #eef2f6;
    --ink-dim: #8b95a3;
    --ink-faint: #5b6675;
    --juice: #ff4256;
    --juice-deep: #c91f33;
    --juice-glow: rgba(255,66,86,0.35);
    --rind: #4dffa0;
    --rind-dim: #1fa05c;
    --rind-glow: rgba(77,255,160,0.28);
    --line: #2a323e;
    --line-soft: #232a35;
    --gold: #ffd34d;
    --radius: 16px;
    --radius-lg: 22px;
    /* hand-drawn easing curves */
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --ease-out: cubic-bezier(.22,1,.36,1);
    --ease-soft: cubic-bezier(.4,0,.2,1);
    /* layered, slightly-offset shadows for a sketched depth feel */
    --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 18px 48px rgba(0,0,0,.5);
    --shadow-glow: 0 0 0 1px var(--line), 0 8px 28px rgba(0,0,0,.45);
  }

  /* ============ HAND-DRAWN AESTHETIC HELPERS ============ */
  /* paper-grain noise overlay on the whole page */
  body::before {
    content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
  /* soft ambient glow blobs behind content */
  body::after {
    content: ''; position: fixed; z-index: 0; pointer-events: none;
    top: -200px; left: 50%; transform: translateX(-50%);
    width: 700px; height: 500px; opacity: 0.07;
    background: radial-gradient(circle at 30% 30%, var(--juice), transparent 60%),
                radial-gradient(circle at 70% 50%, var(--rind), transparent 55%);
    filter: blur(60px);
  }
  /* keep all real content above the texture layers */
  body > * { position: relative; z-index: 1; }

  /* sketchy hand-drawn underline used on headings */
  .sketch-underline { position: relative; display: inline-block; }
  .sketch-underline::after {
    content: ''; position: absolute; left: -2%; right: -2%; bottom: -6px; height: 7px;
    background: no-repeat center/100% 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='8' viewBox='0 0 200 8'%3E%3Cpath d='M2 5 Q 30 2 55 4.5 T 110 4 T 165 5 T 198 3.5' stroke='%23ff4256' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    opacity: 0.9;
  }

  /* ============ SMOOTH ANIMATIONS ============ */
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
  }
  @keyframes scaleIn {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
  }
  @keyframes slideInRight {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes popIn {
    0%   { opacity: 0; transform: scale(.75); }
    65%  { transform: scale(1.06); }
    85%  { transform: scale(.97); }
    100% { opacity: 1; transform: scale(1); }
  }
  @keyframes floatY {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-6px); }
  }
  @keyframes floatX {
    0%,100% { transform: translateX(0); }
    50%     { transform: translateX(5px); }
  }
  @keyframes drawIn {
    from { stroke-dashoffset: var(--dash, 300); }
    to   { stroke-dashoffset: 0; }
  }
  @keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
  @keyframes glowPulse {
    0%,100% { box-shadow: 0 0 0 0 var(--juice-glow); }
    50%     { box-shadow: 0 0 0 10px transparent; }
  }
  @keyframes spinOnce {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
  @keyframes juiceDrop {
    0%   { opacity: 0; transform: scale(0.4) translateY(-18px); }
    60%  { transform: scale(1.1) translateY(3px); }
    80%  { transform: scale(0.95) translateY(-1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes ripple {
    0%   { transform: scale(1);   opacity: 0.5; }
    100% { transform: scale(2.4); opacity: 0; }
  }
  @keyframes starBurst {
    0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
    60%  { transform: scale(1.2) rotate(8deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
  }
  @keyframes dash {
    to { stroke-dashoffset: 0; }
  }
  @keyframes orbits {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
  @keyframes breathe {
    0%,100% { transform: scale(1);    opacity: 1; }
    50%     { transform: scale(1.04); opacity: 0.85; }
  }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes neonFlicker {
    0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1; }
    20%,24%,55%                      { opacity: 0.5; }
  }

  /* screens fade/slide in smoothly when shown */
  .screen.show { animation: fadeInUp 0.42s var(--ease-out) both; }

  /* respect reduced-motion preferences */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
    }
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    padding: 20px 16px 40px;
  }

  header {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 10px;
  }
  .logo { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
  .logo .melon-mark {
    position: relative;
    width: 22px; height: 22px;
    flex-shrink: 0;
    animation: floatY 3s var(--ease-soft) infinite;
  }
  .logo:hover .melon-mark { animation-duration: 1.2s; }
  .logo .melon-mark svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 8px var(--juice-glow)); }
  .logo .melon-drip {
    position: absolute;
    width: 3.5px; height: 3.5px;
    border-radius: 50% 50% 50% 50%;
    background: linear-gradient(180deg, var(--juice), var(--juice-deep));
    box-shadow: 0 0 3px var(--juice-glow);
    opacity: 0;
    animation: melonDrip 2.6s ease-in infinite;
  }
  .logo .melon-drip:nth-child(2) { left: 5px;  bottom: -1px; animation-delay: 0.2s; }
  .logo .melon-drip:nth-child(3) { left: 11px; bottom: -3px; animation-delay: 1.1s; }
  .logo .melon-drip:nth-child(4) { left: 17px; bottom: -1px; animation-delay: 1.9s; }
  @keyframes melonDrip {
    0%   { opacity: 0; transform: translateY(0) scaleY(0.6); }
    8%   { opacity: 1; }
    70%  { opacity: 0.9; transform: translateY(9px) scaleY(1.15); }
    100% { opacity: 0; transform: translateY(13px) scaleY(1.3); }
  }
  .header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .stat-pill {
    font-family: 'JetBrains Mono', monospace; font-size: 0.76rem; font-weight: 600;
    padding: 5px 11px 5px 8px; border-radius: 999px;
    background: var(--bg-raised); border: 1px solid var(--line);
    display: inline-flex; align-items: center; gap: 5px;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-soft);
  }
  .stat-pill .pill-ico { width: 14px; height: 14px; flex-shrink: 0; }
  .stat-pill.fire { color: #ff9d3b; }
  .stat-pill.fire:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(255,157,59,.25); }
  .stat-pill.xp { color: var(--rind); }
  .stat-pill.xp:hover { transform: translateY(-1px); box-shadow: 0 3px 10px var(--rind-glow); }
  .stat-pill.level { color: #c9a3ff; }
  .stat-pill.level:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(124,92,255,.3); }
  .reset-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem; color: var(--ink-dim);
    background: none; border: 1px solid var(--line);
    border-radius: 8px; padding: 5px 9px; cursor: pointer;
  }
  .reset-btn:hover { color: var(--juice); border-color: var(--juice); }

  .vial-wrap { width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  .vial {
    flex: 1; height: 18px;
    background: var(--bg-raised);
    border: 2px solid var(--rind-dim);
    border-radius: 999px; overflow: hidden;
  }
  .vial-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--juice-deep), var(--juice));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(.22,1,.36,1);
    position: relative;
  }
  .vial-fill::after {
    content: ''; position: absolute; top: 2px; left: 4px; right: 4px; height: 4px;
    background: rgba(255,255,255,0.28); border-radius: 999px;
  }
  /* animated shimmer travelling along the fill */
  .vial-fill::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    background-size: 200% 100%;
    animation: shimmer 2.5s var(--ease-soft) infinite;
  }
  .vial-label { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--rind); min-width: 60px; text-align: right; }

  .daily-goal-wrap { width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 22px; margin-top: -10px; }
  .daily-goal-bar {
    flex: 1; height: 10px;
    background: var(--bg-raised);
    border: 1.5px solid #4a3a7a;
    border-radius: 999px; overflow: hidden;
  }
  .daily-goal-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #7c5cff, #c9a3ff);
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(.22,1,.36,1);
  }
  .daily-goal-fill.done { background: linear-gradient(90deg, var(--rind-dim), var(--rind)); }
  .daily-goal-label { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: #c9a3ff; white-space: nowrap; }

  /* ===== ONBOARDING / COURSE SELECT (shared card style) ===== */
  /* course search */
#courseSearchWrap {
  padding: 0 0 12px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg, #190f12);
}
.course-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised, #241318);
  border: 1.5px solid var(--bg-card-hi, #331a21);
  border-radius: 12px;
  padding: 8px 12px;
}
.course-search-inner svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--ink-dim, #8b95a3);
}
#courseSearch {
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--ink, #eef2f6);
  width: 100%;
  font-family: inherit;
}
#courseSearch::placeholder { color: var(--ink-faint, #5b6675); }
#courseSearch::-webkit-search-cancel-button { -webkit-appearance: none; }

/* placement test progress bar */
.place-progress {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-card-hi, #331a21);
  overflow: hidden;
  margin: 2px 0 16px 0;
}
.place-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: #4dffa0;
  transition: width 0.4s var(--ease-out, ease-out);
}
.picker { width: 100%; display: none; flex-direction: column; text-align: center; padding-bottom: 88px; }
  .picker.show { display: flex; }
  .picker .big-drop {
    width: 52px; height: 52px; margin: 8px auto 22px;
    background: var(--juice);
    border: 4px solid var(--rind);
    border-radius: 50% 50% 50% 4px;
    transform: rotate(45deg);
    box-shadow: 0 0 24px var(--juice-glow);
    animation: floatY 3s var(--ease-soft) infinite, popIn 0.6s var(--ease-spring) both;
  }
  .picker h1 { font-size: 1.6rem; margin-bottom: 8px; }
  .picker > p { color: var(--ink-dim); margin-bottom: 26px; }
  .pick-btn {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 12px;
    cursor: pointer; text-align: left;
    color: var(--ink); font-family: inherit;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.25s var(--ease-soft),
                transform 0.28s var(--ease-spring),
                box-shadow 0.28s var(--ease-soft),
                background 0.25s var(--ease-soft);
  }
  .pick-btn:hover {
    transform: translateY(-3px);
    background: var(--bg-card-hi);
    box-shadow: var(--shadow-md);
  }
  .pick-btn:active { transform: translateY(-1px) scale(0.99); }
  .pick-btn:hover { border-color: var(--rind); transform: translateX(4px); }
  .pick-btn .emoji { font-size: 1.7rem; }
  .pick-btn .grow { flex: 1; }
  .pick-btn h3 { font-size: 1.02rem; margin-bottom: 2px; }
  .pick-btn p { font-size: 0.82rem; color: var(--ink-dim); margin: 0; }
  .pick-btn .pct { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--rind); }

  /* Challenges: recommended row, category chips, and card grid */
  .chal-section-heading {
    font-size: 0.8rem; font-weight: 700; margin: 22px 0 10px;
    color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em;
  }
  .chal-section-heading:first-child { margin-top: 0; }

  .chal-cat-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
  .chal-cat-chip {
    font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
    padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line);
    background: var(--bg-card); color: var(--ink-dim); cursor: pointer;
    transition: border-color .2s var(--ease-soft), color .2s var(--ease-soft), background .2s var(--ease-soft);
  }
  .chal-cat-chip:hover { border-color: var(--rind-dim); color: var(--ink); }
  .chal-cat-chip.active { border-color: var(--rind); color: var(--rind); background: color-mix(in srgb, var(--rind) 10%, var(--bg-card)); }

  .chal-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
  }
  .chal-rec-row {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px;
  }
  .chal-rec-row .chal-card { flex: 0 0 260px; }

  .chal-card {
    display: flex; flex-direction: column; gap: 10px;
    background: var(--bg-card); border: 1.5px solid var(--line);
    border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color .22s var(--ease-soft), transform .22s var(--ease-spring), box-shadow .22s var(--ease-soft);
    animation: fadeInUp 0.45s var(--ease-out) both;
  }
  .chal-card:hover { border-color: var(--rind-dim); transform: translateY(-3px); box-shadow: var(--shadow-md); }

  .chal-card-top { display: flex; align-items: center; gap: 10px; }
  .chal-card-icon { font-size: 1.6rem; line-height: 1; }
  .chal-card-top h3 { font-size: 1.02rem; margin: 0; }

  .chal-card-desc { font-size: 0.82rem; color: var(--ink-dim); margin: 0; line-height: 1.4; }
  .chal-card-preview {
    font-size: 0.78rem; color: var(--ink); margin: 0; line-height: 1.4;
    background: var(--bg-raised); border-radius: 8px; padding: 8px 10px;
    border: 1px solid var(--line-soft);
  }

  .chal-card-skills { display: flex; flex-wrap: wrap; gap: 6px; }
  .chal-skill-tag {
    font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
    padding: 3px 8px; border-radius: 6px; background: var(--bg-raised);
    color: var(--ink-dim); border: 1px solid var(--line-soft);
  }

  .chal-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 10px; }
  .chal-level-badge {
    font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    padding: 4px 9px; border-radius: 6px;
  }
  .chal-level-beginner { background: color-mix(in srgb, var(--rind) 16%, transparent); color: var(--rind); }
  .chal-level-intermediate { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }

  .chal-start-btn {
    font-family: 'JetBrains Mono', monospace; font-weight: 700; letter-spacing: .05em;
    background: var(--gold); color: #1a1200; border: 3px solid #1a1200;
    border-radius: 0; padding: 8px 16px; cursor: pointer;
    box-shadow: 3px 3px 0 #1a1200;
    transition: transform .1s, box-shadow .1s;
  }
  .chal-start-btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 #1a1200; }
  .chal-start-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #1a1200; }

  /* onboard back button */
  .ob-back {
    background: none; border: none; color: var(--ink-dim);
    font-family: var(--font-ui); font-size: 0.85rem; cursor: pointer;
    padding: 0 0 14px; display: block;
  }
  .ob-back:hover { color: var(--ink); }

  /* follow-up question eyebrow */
  .ob-fup-eyebrow {
    font-size: 0.78rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--rind);
    margin-bottom: 6px;
  }

  /* multi-select interest grid */
  .ob-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin: 18px 0;
  }
  .ob-card {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 4px; position: relative;
    background: var(--bg-card); border: 2px solid var(--line);
    border-radius: 14px; padding: 14px 14px 12px;
    cursor: pointer; text-align: left; color: var(--ink);
    transition: border-color 0.22s var(--ease-soft), transform 0.26s var(--ease-spring), box-shadow 0.22s var(--ease-soft), background 0.22s var(--ease-soft);
    animation: fadeInUp 0.45s var(--ease-out) both;
    font-family: inherit;
    transition: border-color .15s, background .15s, transform .1s;
  }
  .ob-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--rind-dim); }
  .ob-card:active { transform: translateY(-1px) scale(.99); }
  .ob-card:active { transform: scale(.97); }
  .ob-card.sel {
    border-color: var(--rind);
    background: color-mix(in srgb, var(--rind) 8%, var(--bg-card));
  }
  .ob-card-icon  { font-size: 1.6rem; line-height: 1; }
  .ob-card-label { font-size: 0.9rem; font-weight: 700; margin-top: 6px; }
  .ob-card-sub   { font-size: 0.73rem; color: var(--ink-dim); line-height: 1.3; }
  .ob-card-check {
    position: absolute; top: 8px; right: 10px;
    font-size: 0.75rem; font-weight: 800; color: var(--rind);
    opacity: 0; transition: opacity .15s;
  }
  .ob-card.sel .ob-card-check { opacity: 1; }

  /* continue / skip buttons */
  .ob-continue {
    display: block; width: 100%; margin-top: 4px;
    padding: 16px; border: none; border-radius: 14px; cursor: pointer;
    font-family: var(--font-ui); font-weight: 800; font-size: 1rem;
    letter-spacing: .03em;
    background: var(--rind); color: #000;
    box-shadow: 0 5px 0 0 #1a8050;
    transition: transform .1s, box-shadow .1s, opacity .15s;
  }
  .ob-continue:disabled { opacity: .35; box-shadow: none; cursor: default; }
  .ob-continue:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 0 #1a8050; }
  .ob-skip {
    display: block; width: 100%; margin-top: 12px;
    padding: 12px; border: none; background: none; cursor: pointer;
    font-family: var(--font-ui); font-size: 0.85rem;
    color: var(--ink-dim); text-align: center;
  }
  .ob-skip:hover { color: var(--ink); }

  /* interest chips on recs page */
  .ob-chips {
    font-size: 0.78rem; color: var(--rind);
    font-family: 'JetBrains Mono', monospace;
    margin: -6px 0 16px; letter-spacing: .02em;
  }

  /* recommendation course cards */
  .ob-recs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
  .ob-rec-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-card); border: 1.5px solid var(--line);
    border-radius: 14px; padding: 12px 14px;
    cursor: pointer; text-align: left; color: var(--ink);
    font-family: inherit;
    transition: border-color .15s, transform .1s;
  }
  .ob-rec-card:hover { border-color: var(--rind); }
  .ob-rec-card:active { transform: scale(.98); }
  .ob-rec-logo {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
  }
  .ob-rec-logo .lang-tile { width: 44px !important; height: 44px !important; border-radius: 0; }
  .ob-rec-logo .lang-tile svg { width: 100%; height: 100%; display: block; }
  .ob-rec-logo svg { width: 100%; height: 100%; }
  .ob-rec-info { flex: 1; min-width: 0; }
  .ob-rec-name { font-size: 0.92rem; font-weight: 700; }
  .ob-rec-tag  { font-size: 0.75rem; color: var(--ink-dim); margin-top: 2px;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ob-rec-cta  { font-size: 0.8rem; font-weight: 700; color: var(--rind);
                 flex-shrink: 0; white-space: nowrap; }
  .ob-pct      { color: var(--rind); font-family: 'JetBrains Mono', monospace; }

  /* recommended banner in course select */
  .rec-banner { margin-bottom: 18px; }
  .rec-label  { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em;
                text-transform: uppercase; color: var(--rind); margin-bottom: 6px; }
  .rec-course-btn { border-color: var(--rind) !important; }
  .continue-btn { border-color: var(--gold) !important; }
  .continue-btn .pct { color: var(--gold); }
  .ws-wrap {
    display: flex; flex-direction: column; height: 100%;
    padding: 12px 14px 0 14px; gap: 10px; box-sizing: border-box;
  }
  /* Melon is a long flowing chat page, not a fixed-height IDE panel — let the page itself scroll */
  #melonWrap { height: auto; overflow: visible; }
  #bloxnetWrap { height: auto; overflow: visible; }
  .ws-lang-row {
    position: relative; display: inline-flex; align-self: flex-start;
  }
  .ws-lang-select {
    appearance: none; -webkit-appearance: none;
    padding: 9px 38px 9px 14px; border-radius: 10px;
    background: var(--bg-raised); border: 1.5px solid var(--line);
    color: var(--ink); font-size: 0.88rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
  }
  .ws-lang-select:focus { outline: none; border-color: var(--rind); }
  .ws-lang-caret {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--ink-dim); pointer-events: none;
  }
  .ws-run-row {
    display: flex; align-items: center; gap: 12px;
  }
  .ws-status {
    font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--ink-faint);
  }
  .ws-main {
    display: flex; flex-direction: column; gap: 10px;
    flex: 1; min-height: 0; margin-bottom: 12px;
  }
  .ws-code {
    flex: 1 1 50%; min-height: 110px; resize: none; outline: none; border: none;
    background: #0d0d16; color: #d4d4d4;
    font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; line-height: 1.55;
    padding: 12px; border-radius: 12px; tab-size: 2; white-space: pre;
  }
  .ws-output-wrap {
    flex: 1 1 50%; min-height: 120px; border-radius: 12px; overflow: hidden;
    border: 1.5px solid var(--line);
  }
  .ws-frame {
    width: 100%; height: 100%; border: none; display: block; background: #fff;
  }
  @media (min-width: 768px) {
    .ws-main { flex-direction: row; }
    .ws-code, .ws-output-wrap { flex: 1 1 50%; height: 100%; }
  }

.kbd-hint {
    text-align: center; font-size: 0.7rem; color: var(--ink-faint);
    margin-top: 4px; font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
  }
  .rec-icon { width: 40px; height: 40px; border-radius: 10px;
              display: flex; align-items: center; justify-content: center;
              font-size: 1.3rem; flex-shrink: 0; }

  /* category section headers in the course picker */
  .cat-label {
    text-align: left;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin: 18px 2px 8px;
  }
  .cat-label:first-child { margin-top: 4px; }

  /* Duolingo-style language tiles */
  .lang-tile {
    width: 52px; height: 52px; flex-shrink: 0;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .lang-tile svg { width: 78%; height: 78%; display: block; }
  .lang-tile.full svg { width: 100%; height: 100%; }
  .lang-tile.sm { width: 30px; height: 30px; border-radius: 8px; }
  .map h1 { display: flex; align-items: center; gap: 10px; }

  /* ===== STAGE MAP ===== */
  .map { width: 100%; display: none; flex-direction: column; gap: 12px; padding-bottom: 88px; }
  .map.show { display: flex; }
  .map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; }
  .map h1 { font-size: 1.4rem; }
  .menu-btn {
    font-family: inherit; font-size: 1.3rem; font-weight: 700;
    color: var(--ink-dim); background: var(--bg-raised);
    border: 1.5px solid var(--line); border-radius: 999px;
    width: 42px; height: 42px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 0; padding-bottom: 10px;
  }
  .menu-btn:hover { color: var(--ink); border-color: var(--rind-dim); }
  .menu-drop {
    position: absolute; top: 50px; right: 0; z-index: 50;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 38px rgba(0,0,0,0.55);
    min-width: 220px;
    overflow: hidden;
    display: none;
    flex-direction: column;
  }
  .menu-drop.open { display: flex; }
  .menu-item {
    text-align: left;
    background: none; border: none;
    font-family: inherit; font-size: 0.92rem; color: var(--ink);
    padding: 13px 16px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--line);
  }
  .menu-item:last-child { border-bottom: none; }
  .menu-item:hover { background: var(--bg-raised); }
  .menu-item.danger { color: var(--juice); }
  .map .sub { color: var(--ink-dim); font-size: 0.9rem; margin-bottom: 10px; }
  .map .sub .goal-pill {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
    color: var(--rind); border: 1px solid var(--rind-dim);
    border-radius: 999px; padding: 2px 10px; margin-left: 6px;
  }

  .trophy-banner {
    background: linear-gradient(135deg, rgba(255,211,77,0.12), rgba(255,59,79,0.10));
    border: 1.5px solid var(--gold);
    border-radius: var(--radius);
    padding: 20px 22px;
    text-align: center;
    margin-bottom: 4px;
  }
  .trophy-banner .t { font-size: 2rem; }
  .trophy-banner h3 { margin: 4px 0 2px; }
  .trophy-banner p { font-size: 0.85rem; color: var(--ink-dim); }

  .review-card {
    display: flex; align-items: center; gap: 16px;
    width: 100%; text-align: left; cursor: pointer;
    background: linear-gradient(135deg, rgba(61,255,143,0.13), rgba(255,59,79,0.10));
    border: 1.5px solid var(--rind); border-radius: var(--radius);
    padding: 15px 18px; margin-bottom: 12px; color: var(--ink);
    font-family: inherit; transition: transform .12s, box-shadow .12s;
  }
  .review-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(61,255,143,0.18); }
  .review-card .rev-ico svg { width: 100%; height: 100%; display: block; }
  .rev-ico {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
    background: rgba(61,255,143,0.16); border: 1px solid var(--rind);
  }
  .review-card h3 { margin: 0 0 2px; font-size: 1.02rem; }
  .review-card p { margin: 0; font-size: 0.82rem; color: var(--ink-dim); }
  .review-card .stage-badge { margin-left: auto; color: var(--rind); font-size: 1.1rem; }
  .review-card.dim { opacity: 0.6; }

  /* bottom tab bar */
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: none; justify-content: center; gap: 10px;
    background: rgba(22,27,35,0.96);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
  }
  .bottom-nav.show { display: flex; }
  .nav-tab {
    flex: 1; max-width: 240px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; cursor: pointer; font: inherit;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
    color: var(--ink-dim); padding: 5px 4px; border-radius: 12px;
    transition: color 0.22s var(--ease-soft), transform 0.22s var(--ease-spring), background 0.15s;
  }
  .nav-tab:hover { transform: translateY(-2px); }
  .nav-tab svg, .nav-tab .nav-ico { transition: transform 0.25s var(--ease-spring); }
  .nav-tab.active svg, .nav-tab.active .nav-ico { transform: scale(1.12); }
  .nav-tab .nav-ico { font-size: 1.3rem; line-height: 1; display: block; }
  .nav-ico svg { width: 22px; height: 22px; display: block; margin: 0 auto 1px; }
  .nav-tab:hover { color: var(--ink); }
  .nav-tab.active { color: var(--rind); background: rgba(61,255,143,0.08); }
  body.has-nav { padding-bottom: 74px; }

  /* ─── STAGE PATH MAP ─────────────────────────────────── */
  .section-banner {
    background: var(--rind); color: #0a120d;
    border-radius: var(--radius); padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    box-sizing: border-box; width: 100%;
  }
  .sb-left { display: flex; flex-direction: column; gap: 3px; }
  .sb-meta { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; }
  .sb-title { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
  .sb-ico { font-size: 2rem; line-height: 1; }

  .path-wrap {
    display: flex; flex-direction: column; align-items: center;
    gap: 28px; padding: 16px 0 8px; width: 100%;
  }

  /* ── 3-D PATH NODES ─────────────────────────────────────
     box-shadow gives the thick raised-platform depth.
     On :active the whole button drops down (translateY)
     AND the depth shadow shrinks — exactly like pressing
     a physical button into the surface.                  */
  .path-node {
    width: 68px; height: 68px; border-radius: 50%;
    border: none; cursor: pointer; position: relative;
    flex-shrink: 0; color: rgba(255,255,255,.2);
    background: var(--nd, #0d1420);
    box-shadow:
      0 0 0 3.5px var(--nr, #1e2a3e),
      0 10px 0 0  var(--nd, #060a10);
    transform: translateX(var(--xoff,0px)) translateY(0px);
    transition: transform .09s cubic-bezier(.2,.8,.3,1),
                box-shadow .09s cubic-bezier(.2,.8,.3,1),
                opacity .15s;
  }
  .path-node:not(.locked):hover {
    transform: translateX(var(--xoff,0px)) translateY(-3px);
    box-shadow:
      0 0 0 3.5px var(--nr, #1e2a3e),
      0 13px 0 0  var(--nd, #060a10);
  }
  .path-node:not(.locked):active {
    transform: translateX(var(--xoff,0px)) translateY(7px);
    box-shadow:
      0 0 0 3.5px var(--nr, #1e2a3e),
      0 3px  0 0  var(--nd, #060a10);
  }
  /* the next-to-do node gently breathes to draw the eye */
  .path-node.current {
    animation: floatY 2.4s var(--ease-soft) infinite;
  }
  .path-node.current .node-face {
    animation: breathe 2.5s ease-in-out infinite;
  }
  .node-face-icon svg {
    width: 55%; height: 55%;
    display: block; margin: auto;
    opacity: 0.92;
  }
  .node-face-icon span { font-size: 1.3rem; line-height: 1; }
  .node-sm .node-face-icon svg { width: 60%; height: 60%; }
  .node-cp .node-face-icon svg { width: 58%; height: 58%; }
  .node-face {
    position: absolute; inset: 3px; border-radius: 50%;
    background: linear-gradient(148deg, var(--nfh,#1e2a3a) 0%, var(--nfl,#111720) 100%);
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
  }
  .node-face::before {
    content: ''; position: absolute;
    top: 14%; left: 18%; width: 36%; height: 24%;
    border-radius: 50%;
    background: rgba(255,255,255,.14); filter: blur(4px);
    pointer-events: none;
  }

  .path-node.node-sm {
    width: 54px; height: 54px;
    box-shadow: 0 0 0 2.5px var(--nr,#1e2a3e), 0 8px 0 0 var(--nd,#060a10);
  }
  .path-node.node-sm:not(.locked):active {
    transform: translateX(var(--xoff,0px)) translateY(6px);
    box-shadow: 0 0 0 2.5px var(--nr,#1e2a3e), 0 2px 0 0 var(--nd,#060a10);
  }
  .path-node.node-sm .node-face { inset: 2.5px; }

  .path-node.node-cp {
    width: 76px; height: 76px;
    box-shadow: 0 0 0 4px var(--nr,#1e2a3e), 0 12px 0 0 var(--nd,#060a10);
  }
  .path-node.node-cp:not(.locked):active {
    transform: translateX(var(--xoff,0px)) translateY(8px);
    box-shadow: 0 0 0 4px var(--nr,#1e2a3e), 0 4px 0 0 var(--nd,#060a10);
  }
  .path-node.node-cp .node-face { inset: 3.5px; }

  .path-node.locked { opacity: 0.18; cursor: default; filter: grayscale(.75); }

  .path-node.done {
    box-shadow: 0 0 0 3.5px var(--nr,#3a7060), 0 10px 0 0 var(--nd,#060a10);
    color: #fff;
  }
  .path-node.done .node-face {
    background: linear-gradient(148deg, var(--nfh,#285044) 0%, var(--nfl,#142c26) 100%);
    filter: brightness(.52);
  }
  .path-node.node-sm.done { box-shadow: 0 0 0 2.5px var(--nr,#3a7060), 0 8px  0 0 var(--nd,#060a10); }
  .path-node.node-cp.done { box-shadow: 0 0 0 4px   var(--nr,#3a7060), 0 12px 0 0 var(--nd,#060a10); }

  .path-node.current {
    box-shadow: 0 10px 0 0 var(--nd,#060a10);
    color: #fff; animation: nodebeat 2.2s ease-in-out infinite;
  }

  .path-node.current:active {
    box-shadow: 0 3px 0 0 var(--nd,#060a10);
  }
  .path-node.current .node-face {
    background: linear-gradient(148deg, var(--nfh,#4a8870) 0%, var(--nfl,#2a5848) 100%);
    filter: brightness(1.1);
  }
  .path-node.node-sm.current { box-shadow: 0 8px  0 0 var(--nd,#060a10); }
  .path-node.node-cp.current { box-shadow: 0 12px 0 0 var(--nd,#060a10); }
  @keyframes nodebeat {
    0%,100% { filter: brightness(1);    }
    50%      { filter: brightness(1.2); }
  }

  .path-node.perfect {
    background: #5a3c00;
    box-shadow: 0 0 0 3.5px #b88c20, 0 10px 0 0 #362200;
    color: #2e1c00;
  }
  .path-node.perfect:active { box-shadow: 0 0 0 3.5px #b88c20, 0 3px 0 0 #362200; }
  .path-node.perfect .node-face { background: linear-gradient(148deg, #d8be58 0%, #a87e18 100%); filter: none; }
  .path-node.node-sm.perfect { box-shadow: 0 0 0 2.5px #b88c20, 0 8px  0 0 #362200; }
  .path-node.node-cp.perfect { box-shadow: 0 0 0 4px   #b88c20, 0 12px 0 0 #362200; }

  .node-star { width: 30px; height: 30px; pointer-events: none; flex-shrink: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
  .path-node.node-sm .node-star { width: 22px; height: 22px; }
  .path-node.node-cp .node-star { width: 34px; height: 34px; }

  .node-stars {
    position: absolute; bottom: -10px; z-index: 2;
    font-size: 0.5rem; font-weight: 800; letter-spacing: 1.5px;
    color: var(--gold); background: var(--bg);
    border-radius: 99px; padding: 1px 5px; line-height: 1.7;
    pointer-events: none;
  }
  .path-node.perfect .node-stars { color: #2e1c00; background: #c8a030; }
  .node-tested-badge {
    position: absolute; bottom: -10px; z-index: 2;
    font-size: 0.5rem; color: var(--ink-dim); background: var(--bg);
    border-radius: 99px; padding: 1px 5px; line-height: 1.7;
    pointer-events: none;
  }  .path-unit-head {
    width: 100%; text-align: center; padding: 6px 0 2px;
    font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-dim);
    border-top: 1px solid var(--line); margin-top: 4px;
  }

  .stage-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
    text-align: left; color: var(--ink); font-family: inherit;
  }
  .stage-card:not(.locked):hover { border-color: var(--rind); transform: translateX(4px); }
  .stage-card.locked { opacity: 0.45; cursor: not-allowed; }
  .stage-card.done { border-color: var(--rind-dim); }
  .stage-num {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 12px;
    background: var(--bg-raised);
    border: 2px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
  }
  .stage-card.done .stage-num { background: var(--juice); border-color: var(--rind); }
  .stage-info { flex: 1; }
  .stage-info h3 { font-size: 1.02rem; margin-bottom: 2px; }
  .stage-info p { font-size: 0.82rem; color: var(--ink-dim); }
  .stage-badge { font-size: 1.1rem; }
  .stars { font-size: 0.85rem; letter-spacing: 2px; }

  /* ===== LESSON / QUIZ SCREEN ===== */
  .screen { width: 100%; display: none; flex-direction: column; }
  .screen.show { display: flex; }
  .screen-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
  .back-btn { background: none; border: none; color: var(--ink-dim); font-family: inherit; font-size: 0.88rem; cursor: pointer; padding: 4px; }
  .back-btn:hover { color: var(--ink); }
  .screen-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--ink-dim); }
  .hearts { font-size: 0.95rem; letter-spacing: 2px; }

  .panel {
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 30px 28px;
    box-shadow: var(--shadow-lg);
    min-height: 320px;
    display: flex; flex-direction: column;
    animation: scaleIn 0.4s var(--ease-out) both;
  }
  .panel .eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--juice); margin-bottom: 16px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(255,66,86,0.08);
    border: 1px solid rgba(255,66,86,0.2);
    align-self: flex-start;
  }
  .panel .eyebrow::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: var(--juice); box-shadow: 0 0 6px var(--juice);
  }
  .panel.quiz-mode .eyebrow { color: var(--rind); }
  .panel h2 { font-size: 1.35rem; margin-bottom: 14px; }
  .panel .body { flex: 1; font-size: 1.02rem; line-height: 1.65; color: #d8dfe8; }
  .panel .body p { margin-bottom: 12px; }
  .panel .body strong { color: var(--ink); }

  .panel code, .panel pre {
    font-family: 'JetBrains Mono', monospace;
    background: #0b0e13; border: 1px solid var(--line-soft); border-radius: 11px;
    border-left: 3px solid var(--rind-dim);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
  }
  .panel code { padding: 1px 7px; font-size: 0.86em; color: var(--rind); }
  .panel pre { padding: 13px 15px; font-size: 0.85rem; line-height: 1.6; overflow-x: auto; color: #d7e2ee; margin: 10px 0 14px; }
  .panel pre code { background: none; border: none; padding: 0; color: inherit; }
  .out { color: var(--ink-dim); }

  .try-zone {
    margin-top: 16px;
    border: 1.5px dashed var(--rind-dim);
    border-radius: 12px;
    padding: 14px;
    background: rgba(61,255,143,0.03);
  }
  .try-zone .try-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--rind); margin-bottom: 10px;
  }
  .try-out {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem; line-height: 1.6;
    background: #0b0e13;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 10px;
    color: var(--rind);
    white-space: pre-wrap;
    min-height: 20px;
  }
  .try-out.err { color: var(--gold); }
  .btn-run { padding: 10px 20px; margin-top: 10px; font-size: 0.9rem; }

  .panel-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; }
  .dots { display: flex; gap: 6px; }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
  .dot.on { background: var(--juice); border: 1px solid var(--rind); }

  .btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.98rem; font-weight: 700;
    padding: 13px 26px; border-radius: 13px;
    border: 2px solid transparent; cursor: pointer;
    position: relative; overflow: hidden;
    transition: transform 0.18s var(--ease-spring),
                filter 0.2s var(--ease-soft),
                box-shadow 0.2s var(--ease-soft),
                background 0.2s var(--ease-soft);
  }
  /* subtle sheen sweep on hover */
  .btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.16) 50%, transparent 70%);
    background-size: 220% 100%; background-position: -120% 0;
    transition: background-position 0.6s var(--ease-soft);
    pointer-events: none;
  }
  .btn:hover::after { background-position: 220% 0; }
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: translateY(1px) scale(0.98); transition-duration: 0.08s; }
  .btn-go { background: var(--juice); border-color: var(--rind); color: #fff; box-shadow: 0 4px 14px var(--juice-glow); }
  .btn-go:hover { box-shadow: 0 8px 22px var(--juice-glow); }
  .btn-go:hover { filter: brightness(1.12); }
  .btn-quiet { background: var(--bg-raised); border-color: var(--line); color: var(--ink-dim); }
  .btn-quiet:hover { color: var(--ink); border-color: var(--ink-dim); }

  .opts { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
  .opt {
    text-align: left;
    background: var(--bg-raised);
    border: 1.5px solid var(--line);
    border-radius: 13px;
    padding: 14px 16px;
    font-family: inherit; font-size: 0.95rem; color: var(--ink);
    cursor: pointer;
    transition: border-color 0.18s var(--ease-soft),
                background 0.18s var(--ease-soft),
                transform 0.2s var(--ease-spring),
                box-shadow 0.2s var(--ease-soft);
  }
  .opt:hover:not(:disabled) {
    transform: translateX(3px);
    box-shadow: -3px 3px 0 0 var(--rind-dim);
  }
  .opt code { font-size: 0.85em; }
  .opt:hover:not(:disabled) { border-color: var(--rind-dim); }
  .opt:disabled { cursor: default; }
  .opt.correct {
    border-color: var(--rind); background: rgba(77,255,160,0.1);
    box-shadow: 0 0 0 1px var(--rind), 0 4px 16px var(--rind-glow);
    animation: popIn 0.34s var(--ease-spring);
  }
  .opt.wrong {
    border-color: var(--juice); background: rgba(255,66,86,0.1);
    box-shadow: 0 0 0 1px var(--juice), 0 4px 16px var(--juice-glow);
    animation: shake 0.4s var(--ease-soft);
  }
  .opt:disabled:hover { transform: none; box-shadow: none; }

  /* fill in the blank */
  .blank-sentence { font-size: 1.25rem; line-height: 1.9; margin: 4px 0 20px; font-weight: 500; }
  .blank-slot {
    display: inline-block; min-width: 74px; text-align: center;
    border-bottom: 2.5px solid var(--ink-dim); padding: 0 10px 2px;
    color: var(--ink-dim); font-weight: 600;
  }
  .blank-slot.ok  { color: var(--rind); border-color: var(--rind); }
  .blank-slot.bad { color: var(--juice); border-color: var(--juice); }

  /* tap the matching pairs */
  .match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 6px 0 4px; }
  .match-tile {
    text-align: center; background: var(--bg-raised);
    border: 1.5px solid var(--line); border-radius: 12px;
    padding: 16px 10px; font-family: inherit; font-size: 1rem; color: var(--ink);
    cursor: pointer; transition: border-color .12s, background .12s, opacity .25s;
  }
  .match-tile:hover:not(.matched) { border-color: var(--rind-dim); }
  .match-tile.sel { border-color: var(--rind); background: rgba(61,255,143,0.14); }
  .match-tile.matched { border-color: var(--rind-dim); background: rgba(61,255,143,0.10); opacity: 0.4; pointer-events: none; }
  .match-tile.wrong { border-color: var(--juice); background: rgba(255,59,79,0.14); animation: shake .35s; }
  @keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(3px)} }
  .match-tile.correct { animation: popIn .3s var(--ease-spring) both; }

  /* ── ARRANGE question type ── */
  .arr-prompt {
    font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; line-height: 1.4;
    color: var(--ink);
  }
  .arr-built {
    min-height: 58px;
    border: 2px solid var(--line); border-radius: 14px;
    padding: 10px 12px; margin-bottom: 16px;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    background: var(--bg); transition: border-color .2s;
  }
  .arr-built.ok-flash  { border-color: var(--rind); }
  .arr-built.bad-flash { border-color: var(--juice); animation: shake .35s; }
  .arr-placeholder { color: var(--ink-dim); font-size: 0.85rem; font-style: italic; }
  .arr-pool {
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: center; padding: 8px 0 4px;
  }
  .arr-tile {
    background: var(--bg-card);
    border: 2.5px solid var(--line);
    border-bottom-width: 4px;            /* tiny 3-d lift */
    border-radius: 10px;
    padding: 8px 15px;
    font-family: inherit; font-size: 1rem; font-weight: 700;
    color: var(--ink); cursor: pointer;
    transition: transform .08s, border-color .1s, opacity .1s;
    -webkit-tap-highlight-color: transparent;
  }
  .arr-tile:active { transform: translateY(2px); border-bottom-width: 2px; }
  .arr-tile.placed {
    background: var(--bg-raised);
    border-color: var(--rind); border-bottom-color: #218a50;
    color: var(--rind);
  }
  .arr-tile.placed:active { border-color: var(--rind); }
  .arr-tile.used { opacity: 0; pointer-events: none; }  /* ghost slot in pool */

  .code-zone { margin-top: 6px; }
  .code-input {
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
    background: #0b0e13;
    color: #d7e2ee;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.15s ease;
  }
  .code-input:focus { border-color: var(--rind-dim); }
  .code-input.good { border-color: var(--rind); }
  .code-input.bad { border-color: var(--juice); }
  textarea.code-input { min-height: 130px; resize: vertical; line-height: 1.6; }
  textarea.try-input { min-height: 90px; }
  .code-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
  .btn-check { padding: 11px 22px; }

  .feedback { margin-top: 14px; font-size: 0.92rem; line-height: 1.55; display: none; }
  .feedback.show { display: block; }
  .feedback .yes { color: var(--rind); font-weight: 700; }
  .feedback .no { color: var(--juice); font-weight: 700; }
  .feedback .hint { color: var(--gold); }
  .feedback ul { margin: 6px 0 0 20px; }
  .feedback li { margin-bottom: 3px; }

  .result { text-align: center; padding: 20px 0; }
  .result .big { font-size: 3rem; margin-bottom: 8px; }
  .result-art {
    width: 88px; height: 88px; display: block; margin: 0 auto 10px;
    animation: juiceDrop 0.65s var(--ease-spring) both;
    filter: drop-shadow(0 0 14px rgba(77,255,160,0.22));
  }
  .result h2 { animation: fadeInUp 0.4s var(--ease-out) 0.12s both; }
  .result .stars-big { animation: fadeInUp 0.4s var(--ease-out) 0.2s both; }
  .result .xp-gain { animation: fadeInUp 0.4s var(--ease-out) 0.28s both; }
  .result p { animation: fadeInUp 0.4s var(--ease-out) 0.34s both; }
  .result-actions { animation: fadeInUp 0.4s var(--ease-out) 0.42s both; }
  .result h2 { margin-bottom: 6px; }
  .result p { color: var(--ink-dim); margin-bottom: 22px; }
  .result .stars-big { font-size: 1.6rem; letter-spacing: 6px; margin-bottom: 12px; }
  .result .xp-gain { font-family: 'JetBrains Mono', monospace; color: var(--rind); margin-bottom: 18px; }
  .result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

  .save-note {
    width: 100%;
    margin-top: 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem; color: var(--ink-dim);
    text-align: center;
  }

  @media (prefers-reduced-motion: reduce) { .vial-fill, .stage-card, .pick-btn { transition: none; } }
  @media (max-width: 480px) {
    .panel { padding: 22px 18px; }
    .stage-card, .pick-btn { padding: 15px 16px; gap: 12px; }
  }

  /* ===================== WIRESHARK SIMULATOR ===================== */
  .ws-root { margin: 14px 0 4px; font-family: 'JetBrains Mono', monospace; }
  .ws-win {
    background: #f4f5f7; color: #1b1f24;
    border: 1px solid #b8bdc6; border-radius: 8px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .ws-titlebar {
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(#3a4a66, #2d3a52); color: #eef2f8;
    padding: 7px 11px; font-size: 0.78rem; font-weight: 600;
  }
  .ws-dots { display: flex; gap: 5px; }
  .ws-dots i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
  .ws-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 10px; background: #e7e9ee; border-bottom: 1px solid #cdd2db; }
  .ws-tab {
    font-family: inherit; font-size: 0.72rem; font-weight: 600;
    border: 1px solid #c2c8d2; background: #fbfcfe; color: #2a3340;
    padding: 6px 10px; border-radius: 6px; cursor: pointer;
  }
  .ws-tab.on { background: #1f6feb; border-color: #1f6feb; color: #fff; }
  .ws-mission {
    padding: 10px 12px; font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem; line-height: 1.4; background: #fff8e6;
    border-bottom: 1px solid #e8dcb0; color: #4a3d12;
  }
  .ws-mission.solved { background: #e6f7ea; border-color: #b6e2c2; color: #14502a; }
  .ws-mission b { font-weight: 700; }
  .ws-filter { display: flex; align-items: center; gap: 0; border-bottom: 1px solid #cdd2db; }
  .ws-filter input {
    flex: 1; border: none; outline: none; padding: 8px 11px;
    font-family: inherit; font-size: 0.78rem; background: #fff; color: #15532a;
  }
  .ws-filter .ws-clear { background: #eceef2; border: none; border-left: 1px solid #cdd2db; padding: 8px 12px; cursor: pointer; color: #555; font-family: inherit; }
  .ws-list-wrap { max-height: 218px; overflow: auto; background: #fff; }
  table.ws-list { border-collapse: collapse; width: 100%; font-size: 0.72rem; white-space: nowrap; }
  table.ws-list th {
    position: sticky; top: 0; background: #eceef2; color: #3a424e;
    text-align: left; padding: 6px 9px; border-bottom: 1px solid #cdd2db; font-weight: 700;
  }
  table.ws-list td { padding: 4px 9px; border-bottom: 1px solid #eef0f3; }
  table.ws-list tr { cursor: pointer; }
  tr.ws-dns  td { background: #d6ecff; }
  tr.ws-udp  td { background: #d6ecff; }
  tr.ws-tcp  td { background: #e9e4ff; }
  tr.ws-http td { background: #e6ffd9; }
  tr.ws-tls  td { background: #c9f5da; }
  tr.ws-info td { background: #ffffff; }
  tr.ws-sel td { background: #1f6feb !important; color: #fff; }
  .ws-panes { display: flex; flex-direction: column; border-top: 1px solid #cdd2db; }
  .ws-detail { background: #fbfcfe; max-height: 196px; overflow: auto; padding: 6px 0; font-size: 0.74rem; }
  .ws-node > .ws-node-h { padding: 3px 10px; cursor: pointer; user-select: none; white-space: nowrap; }
  .ws-node > .ws-node-h:hover { background: #eef1f6; }
  .ws-node-h .tw { display: inline-block; width: 12px; color: #6b7480; }
  .ws-fields { padding: 1px 0 4px 26px; }
  .ws-fields div { padding: 2px 0; white-space: nowrap; }
  .ws-fields .k { color: #6b7480; }
  .ws-fields .v { color: #14304d; font-weight: 600; }
  .ws-fields .flag { color: #c0392b; font-weight: 700; }
  .ws-hex {
    background: #1b1f24; color: #cfd6df; max-height: 150px; overflow: auto;
    padding: 8px 10px; font-size: 0.72rem; line-height: 1.5; white-space: pre;
  }
  .ws-hex .off { color: #6b7480; }
  .ws-hex .asc { color: #7fd1a0; }
  .ws-hint { padding: 12px; color: #6b7480; font-size: 0.76rem; text-align: center; }
  .ws-toast {
    margin-top: 10px; padding: 11px 13px; border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif; font-size: 0.86rem; line-height: 1.45;
    background: rgba(61,255,143,0.12); border: 1px solid var(--rind); color: var(--ink);
  }
  .ws-toast.miss { background: rgba(255,59,79,0.1); border-color: var(--juice); }
  .no-flag {
    display: inline-block;
    width: 22px; height: 16px;
    background: 
      linear-gradient(to right, transparent 6px, #fff 6px, #fff 7px, #00205b 7px, #00205b 9px, #fff 9px, #fff 10px, transparent 10px),
      linear-gradient(to bottom, #ba0c2f 6px, #fff 6px, #fff 7px, #00205b 7px, #00205b 9px, #fff 9px, #fff 10px, #ba0c2f 10px);
    vertical-align: -2px;
    margin-left: 6px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }

  /* ── Node bottom sheet ────────────────────────────── */
  .ns-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0);
    pointer-events: none;
    transition: background .28s;
    display: flex; align-items: flex-end;
  }
  .ns-overlay.open {
    background: rgba(0,0,0,.55);
    pointer-events: all;
  }
  .ns-sheet {
    width: 100%; max-height: 82vh; overflow-y: auto;
    background: #141c24;
    border-radius: 22px 22px 0 0;
    padding: 12px 22px 52px;
    transform: translateY(105%);
    transition: transform .35s cubic-bezier(.22,.68,0,1.15);
    box-shadow: 0 -4px 32px rgba(0,0,0,.45);
  }
  .ns-overlay.open .ns-sheet {
    transform: translateY(0);
  }
  .ns-handle {
    width: 38px; height: 4px;
    background: rgba(255,255,255,.18);
    border-radius: 99px;
    margin: 0 auto 18px;
  }
  .ns-head {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 16px;
  }
  .ns-icon-wrap {
    width: 58px; height: 58px; flex-shrink: 0;
    border-radius: 16px;
    background: var(--ns-fh, #2a5848);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 0 0 var(--ns-d, #060a10);
  }
  .ns-icon-wrap svg { width: 60%; height: 60%; display: block; }
  .ns-icon-wrap span { font-size: 1.75rem; line-height: 1; }
  .ns-meta { flex: 1; min-width: 0; }
  .ns-eyebrow {
    font-size: 0.7rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--ink-dim);
    margin-bottom: 4px;
  }
  .ns-title {
    font-size: 1.2rem; font-weight: 800;
    color: var(--ink); line-height: 1.2; margin: 0 0 5px;
  }
  .ns-desc {
    font-size: 0.85rem; color: var(--ink-dim);
    margin: 0; line-height: 1.4;
  }
  .ns-lessons {
    list-style: none; margin: 0 0 6px; padding: 0;
    display: flex; flex-direction: column; gap: 7px;
  }
  .ns-lessons li {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.85rem; color: var(--ink-dim);
  }
  .ns-lessons li::before {
    content: '';
    width: 6px; height: 6px; flex-shrink: 0;
    border-radius: 50%;
    background: var(--ns-r, #3dff8f);
  }
  /* 3-D start button */
  .ns-start-btn {
    display: block; width: 100%;
    margin-top: 22px;
    padding: 17px 0;
    background: linear-gradient(160deg, var(--ns-fh,#4a8870) 0%, var(--ns-fl,#2a5848) 100%);
    color: #fff;
    font-family: var(--font-ui); font-weight: 800; font-size: 1.05rem;
    letter-spacing: .04em; text-transform: uppercase;
    border: none; border-radius: 16px; cursor: pointer;
    box-shadow: 0 7px 0 0 var(--ns-d,#060a10),
                inset 0 1px 0 rgba(255,255,255,.2);
    transition: transform .1s cubic-bezier(.2,.8,.3,1),
                box-shadow .1s cubic-bezier(.2,.8,.3,1);
    position: relative;
  }
  .ns-start-btn:active {
    transform: translateY(5px);
    box-shadow: 0 2px 0 0 var(--ns-d,#060a10),
                inset 0 1px 0 rgba(255,255,255,.2);
  }


  /* ── Practice home improvements ─────────────────────────────────────── */
  .prac-course-wrap { margin-bottom: 14px; border-radius: 18px; overflow: hidden;
    border: 1.5px solid var(--line); background: var(--bg-card); }
  .prac-course-head { display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; cursor: pointer; }
  .prac-course-head:hover { background: rgba(255,255,255,.03); }
  .prac-course-info { flex: 1; min-width: 0; }
  .prac-course-info h3 { margin: 0 0 2px; font-size: 1rem; font-weight: 700; }
  .prac-course-info p { margin: 0; font-size: 0.78rem; color: var(--ink-dim); }
  .prac-course-chevron { color: var(--rind); font-size: 1rem; transition: transform .2s; }
  .prac-course-wrap.open .prac-course-chevron { transform: rotate(90deg); }
  .prac-modes { display: none; border-top: 1px solid var(--line); }
  .prac-course-wrap.open .prac-modes { display: grid; grid-template-columns: 1fr 1fr; }
  .prac-mode-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 16px 8px; border: none; cursor: pointer;
    background: transparent; color: var(--ink); font-family: inherit;
    border-right: 1px solid var(--line);
    transition: background .15s;
  }
  .prac-mode-btn:last-child { border-right: none; }
  .prac-mode-btn:hover { background: rgba(61,255,143,.07); }
  .prac-mode-btn.dim { opacity: .4; cursor: default; }
  .prac-mode-btn svg { width: 26px; height: 26px; color: var(--rind); }
  .prac-mode-btn .pm-label { font-size: 0.78rem; font-weight: 700; }
  .prac-mode-btn .pm-sub { font-size: 0.68rem; color: var(--ink-dim); }
  .prac-stats-strip { display: flex; gap: 12px; padding: 6px 16px 14px;
    font-size: 0.72rem; color: var(--ink-dim); font-family: 'JetBrains Mono', monospace; }
  .prac-stats-strip span { color: var(--rind); }

  /* ── Flashcard ───────────────────────────────────────────────────────── */
  #flashcardScreen { display: flex; flex-direction: column; overflow: hidden; }
  .fc-progress-wrap { height: 3px; background: var(--line); flex-shrink: 0; }
  .fc-progress-bar { height: 100%; background: var(--rind); transition: width .3s; width: 0; }
  .fc-counter { font-size: 0.8rem; color: var(--ink-dim); font-family: 'JetBrains Mono', monospace; }
  .fc-mode-label { font-size: 0.72rem; color: var(--rind); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .fc-body { flex: 1; display: flex; flex-direction: column; padding: 16px 18px 24px; overflow-y: auto; }

  /* the flip card */
  .fc-card-wrap { perspective: 1200px; flex: 1; min-height: 220px; max-height: 360px; margin-bottom: 18px; cursor: pointer; }
  .fc-card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d;
    transition: transform .42s cubic-bezier(.4,0,.2,1); border-radius: 20px; }
  .fc-card.flipped { transform: rotateY(180deg); }
  .fc-face { position: absolute; inset: 0; backface-visibility: hidden;
    border-radius: 20px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 24px 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.35); }
  .fc-front { background: var(--bg-card); border: 1.5px solid var(--line); }
  .fc-back  { background: color-mix(in srgb, var(--rind) 8%, var(--bg-card));
    border: 1.5px solid var(--rind); transform: rotateY(180deg); }
  .fc-tag { font-size: 0.68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-dim); margin-bottom: 12px; }
  .fc-front .fc-tag { color: var(--rind); }
  .fc-q { font-size: 1.05rem; font-weight: 600; text-align: center; line-height: 1.45;
    color: var(--ink); }
  .fc-a { font-size: 1.1rem; font-weight: 700; text-align: center; color: var(--rind);
    margin-bottom: 10px; }
  .fc-why { font-size: 0.8rem; color: var(--ink-dim); text-align: center; line-height: 1.5; }
  .fc-tap-hint { font-size: 0.72rem; color: var(--ink-dim); margin-top: 14px;
    display: flex; align-items: center; gap: 5px; }
  .fc-tap-hint svg { width: 14px; height: 14px; }

  /* rating buttons */
  .fc-ratings { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .fc-rate-btn { padding: 12px 6px; border: none; border-radius: 14px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.82rem;
    transition: transform .1s, opacity .2s; opacity: 0; pointer-events: none; }
  .fc-rate-btn.visible { opacity: 1; pointer-events: all; }
  .fc-rate-btn:active { transform: scale(.96); }
  .fc-rate-easy  { background: color-mix(in srgb, var(--rind) 18%, var(--bg-card));
    color: var(--rind); border: 1.5px solid var(--rind); }
  .fc-rate-hard  { background: color-mix(in srgb, #ffd34d 12%, var(--bg-card));
    color: #ffd34d; border: 1.5px solid #ffd34d44; }
  .fc-rate-miss  { background: color-mix(in srgb, var(--juice) 12%, var(--bg-card));
    color: var(--juice); border: 1.5px solid var(--juice-dim,#6a1020); }
  .fc-session-end { text-align: center; padding: 20px 0; }
  .fc-session-end h2 { font-size: 1.3rem; margin: 12px 0 6px; }
  .fc-session-end p { color: var(--ink-dim); font-size: 0.88rem; margin: 0 0 20px; }
  .fc-stat-row { display: flex; justify-content: center; gap: 20px; margin: 16px 0;
    font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }
  .fc-stat-row .easy { color: var(--rind); }
  .fc-stat-row .hard { color: #ffd34d; }
  .fc-stat-row .miss { color: var(--juice); }

  /* ── Study Notes ─────────────────────────────────────────────────────── */
  #notesScreen { display: flex; flex-direction: column; }
  .notes-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
  .notes-stage { margin-bottom: 28px; }
  .notes-stage-title { display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .notes-stage-title .ns-icon { width: 28px; height: 28px; flex-shrink: 0; }
  .notes-stage-title .ns-icon svg { width: 100%; height: 100%; }
  .notes-stage-title h3 { margin: 0; font-size: 0.95rem; color: var(--ink); }
  .notes-lesson { margin-bottom: 16px; }
  .notes-lesson h4 { font-size: 0.85rem; font-weight: 700; color: var(--rind);
    margin: 0 0 6px; text-transform: uppercase; letter-spacing: .05em; }
  .notes-lesson-body { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.6; }
  .notes-lesson-body pre { background: rgba(0,0,0,.3); border-radius: 8px;
    padding: 10px 12px; margin: 8px 0; overflow-x: auto; }
  .notes-lesson-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
  .notes-lesson-body p { margin: 0 0 8px; }
  .notes-vocab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
  .notes-vocab-pair { background: rgba(255,255,255,.04); border-radius: 8px;
    padding: 8px 10px; font-size: 0.8rem; }
  .notes-vocab-pair .nv-term { font-weight: 700; color: var(--ink); }
  .notes-vocab-pair .nv-def { color: var(--ink-dim); margin-top: 2px; }

  /* ── Speech panel ────────────────────────────────────────────────── */
  .speech-panel {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: flex-end;
    background: rgba(0,0,0,0);
    pointer-events: none;
    transition: background .25s;
  }
  .speech-panel.open {
    background: rgba(0,0,0,.55);
    pointer-events: all;
  }
  .speech-panel-inner {
    width: 100%; background: #141c24;
    border-radius: 22px 22px 0 0;
    padding: 18px 22px 48px;
    transform: translateY(105%);
    transition: transform .32s cubic-bezier(.22,.68,0,1.15);
    box-shadow: 0 -4px 32px rgba(0,0,0,.4);
  }
  .speech-panel.open .speech-panel-inner { transform: translateY(0); }
  .sp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .sp-title { font-weight: 800; font-size: 1.05rem; }
  .sp-close { background: rgba(255,255,255,.1); border: none; color: var(--ink);
    width: 30px; height: 30px; border-radius: 50%; font-size: 0.85rem; cursor: pointer; }
  .sp-lang-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .sp-lang-label { font-size: 0.78rem; color: var(--ink-dim); white-space: nowrap; }
  .sp-lang-select { flex: 1; background: rgba(255,255,255,.08); border: 1px solid var(--line);
    border-radius: 10px; color: var(--ink); font-family: inherit; font-size: 0.85rem;
    padding: 8px 10px; cursor: pointer; }
  .sp-transcript-box {
    min-height: 90px; background: rgba(0,0,0,.3); border-radius: 14px;
    padding: 14px 16px; margin-bottom: 8px;
    font-size: 1rem; line-height: 1.5; color: var(--ink);
    border: 1.5px solid var(--line);
    transition: border-color .2s;
  }
  .sp-transcript-box.listening { border-color: var(--juice); }
  .sp-transcript-box.got-result { border-color: var(--rind); }
  .sp-placeholder { color: var(--ink-dim); font-size: 0.88rem; }
  .sp-interim { color: var(--ink-dim); font-style: italic; }
  .sp-final { color: var(--ink); }
  .sp-confidence { font-size: 0.72rem; color: var(--ink-dim); margin-bottom: 16px;
    font-family: 'JetBrains Mono', monospace; min-height: 16px; }
  .sp-mic-btn {
    display: block; width: 72px; height: 72px; margin: 0 auto 10px;
    border-radius: 50%; border: none; cursor: pointer;
    background: var(--bg-card); border: 2.5px solid var(--line);
    color: var(--ink-dim);
    transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 4px 0 0 rgba(0,0,0,.4);
  }
  .sp-mic-btn svg { width: 32px; height: 32px; display: block; margin: auto; }
  .sp-mic-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 0 rgba(0,0,0,.4); }
  .sp-mic-btn.listening {
    background: color-mix(in srgb, var(--juice) 18%, var(--bg-card));
    border-color: var(--juice); color: var(--juice);
    animation: sp-pulse 1.2s ease-in-out infinite;
  }
  .sp-mic-btn.got-result { background: color-mix(in srgb, var(--rind) 15%, var(--bg-card));
    border-color: var(--rind); color: var(--rind); }
  @keyframes sp-pulse {
    0%,100% { box-shadow: 0 4px 0 0 rgba(0,0,0,.4), 0 0 0 0 rgba(255,59,79,.35); }
    50%      { box-shadow: 0 4px 0 0 rgba(0,0,0,.4), 0 0 0 12px rgba(255,59,79,0); }
  }
  .sp-status { text-align: center; font-size: 0.78rem; color: var(--ink-dim); margin: 0 0 12px; }
  .sp-note { font-size: 0.68rem; color: rgba(255,255,255,.25); text-align: center; margin: 0; line-height: 1.5; }

  /* ── TTS (Text-to-Speech) buttons ──────────────────────────────── */
  .tts-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--ink-dim); padding: 2px 4px; border-radius: 6px;
    vertical-align: middle; margin-left: 4px;
    transition: color .15s, background .15s, transform .1s;
  }
  .tts-btn:hover { color: var(--rind); background: rgba(61,255,143,.1); }
  .tts-btn:active { transform: scale(.88); }
  .tts-icon { width: 16px; height: 16px; display: block; pointer-events: none; }
  /* larger in flashcard and notes contexts */
  .fc-q .tts-btn .tts-icon,
  .fc-a .tts-btn .tts-icon { width: 20px; height: 20px; }
  .nv-term .tts-btn .tts-icon,
  .nv-def  .tts-btn .tts-icon { width: 15px; height: 15px; }

  /* word-by-word transcript row */
  .sp-word-row { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
  .sp-word-wrap {
    display: inline-flex; align-items: center;
    background: rgba(255,255,255,.06); border-radius: 8px;
    padding: 4px 8px 4px 10px; font-size: 1rem;
  }
  .sp-word-wrap .tts-btn { margin-left: 2px; }
  .tts-word-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--ink-dim); padding: 2px; margin-left: 2px;
    transition: color .15s, transform .1s;
  }
  .tts-word-btn:hover { color: var(--rind); }
  .tts-word-btn:active { transform: scale(.85); }
  .tts-word-btn svg { width: 14px; height: 14px; pointer-events: none; }

  /* ── Word-by-word TTS buttons ────────────────────────────────────── */
  .sp-word-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-start; }
  .sp-word-wrap {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.05); border-radius: 8px;
    padding: 5px 8px 5px 10px; line-height: 1.2;
  }
  .sp-word-text { font-size: 1rem; font-weight: 600; color: var(--ink); }
  .tts-word-btn {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex-shrink: 0;
    background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
    border-radius: 7px; cursor: pointer; color: var(--ink-dim);
    transition: background .12s, color .12s, transform .1s;
    padding: 0;
  }
  .tts-word-btn svg { width: 14px; height: 14px; display: block; }
  .tts-word-btn:hover { background: rgba(61,255,143,.15); color: var(--rind); border-color: var(--rind); }
  .tts-word-btn:active { transform: scale(.9); }
  .tts-word-btn.speaking {
    background: color-mix(in srgb, var(--rind) 20%, transparent);
    color: var(--rind); border-color: var(--rind);
    animation: tts-ping .5s ease-in-out infinite alternate;
  }
  @keyframes tts-ping {
    from { opacity: .7; } to { opacity: 1; }
  }


  /* ── Chess screen ────────────────────────────────────────────── */
  #chessScreen { display: none; flex-direction: column; padding: 0; }
  #chessScreen.show { display: flex; height: calc(100vh - 60px); }
  .chess-screen-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 8px; flex-shrink: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .chess-screen-title {
    font-weight: 800; font-size: 1rem; color: var(--rind);
  }
  .chess-iframe {
    flex: 1; border: none; width: 100%;
    background: #1a1410;
    min-height: 0;
  }


  .map-chess-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: color-mix(in srgb, var(--rind) 15%, var(--bg-card));
    border: 1.5px solid var(--rind); color: var(--rind);
    border-radius: 12px; padding: 7px 14px;
    font-family: inherit; font-weight: 700; font-size: .8rem;
    cursor: pointer; flex-shrink: 0;
    box-shadow: 0 3px 0 0 color-mix(in srgb, var(--rind) 30%, black);
    transition: transform .1s;
  }
  .map-chess-btn:active { transform: translateY(2px); box-shadow: none; }
  .map-chess-btn svg { width: 16px; height: 16px; }


  /* ── Jim Bob teacher ─────────────────────────────────── */
  .jimBob-wrap {
    position: fixed; bottom: 72px; left: 0; right: 0;
    z-index: 200; pointer-events: none;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0 12px;
  }
  .jimBob-bubble {
    pointer-events: all;
    display: flex; align-items: flex-end; gap: 12px;
    background: #1a1a2e;
    border: 2px solid #3dff8f;
    border-radius: 20px 20px 20px 4px;
    padding: 12px 14px 12px 12px;
    max-width: 420px; width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(61,255,143,.15);
    transform: translateY(120%);
    transition: transform .35s cubic-bezier(.22,.68,0,1.2);
    opacity: 0;
    position: relative;
  }
  .jimBob-bubble.show {
    transform: translateY(0);
    opacity: 1;
  }
  .jimBob-sprite {
    width: 64px; height: 64px; flex-shrink: 0;
    border-radius: 50%;
    border: 2.5px solid #3dff8f;
    object-fit: cover;
    image-rendering: pixelated;
    box-shadow: 0 0 12px rgba(61,255,143,.4);
    animation: jibbob 2.5s ease-in-out infinite;
  }
  @keyframes jibbob {
    0%,100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-4px) rotate(1deg); }
  }
  .jimBob-text-col { flex: 1; min-width: 0; }
  .jimBob-name {
    font-size: .65rem; font-weight: 900; letter-spacing: .12em;
    color: #3dff8f; text-transform: uppercase; margin-bottom: 4px;
  }
  .jimBob-text {
    font-size: .85rem; line-height: 1.45; color: #e8e0d8;
    font-style: italic;
  }
  .jimBob-actions {
    display: flex; gap: 6px; margin-top: 8px;
  }
  .jb-btn {
    background: rgba(61,255,143,.12); border: 1px solid rgba(61,255,143,.3);
    color: #3dff8f; border-radius: 8px; padding: 4px 12px;
    font-family: inherit; font-size: .72rem; font-weight: 700;
    cursor: pointer; transition: background .12s;
  }
  .jb-btn:hover { background: rgba(61,255,143,.22); }
  .jb-btn.dismiss { background: transparent; color: #8a8076;
    border-color: rgba(255,255,255,.1); }
  .jb-btn.dismiss:hover { color: #e8e0d8; }
  /* exclamation pip */
  .jimBob-pip {
    position: absolute; top: -8px; right: -8px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #ff3b4f; color: white;
    font-size: .65rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #1a1a2e;
    display: none;
  }
  .jimBob-pip.show { display: flex; }


  

  /* ── Exercise screen ─────────────────────────────────────────── */
  #exerciseScreen{position:fixed;inset:0;z-index:600;display:none;flex-direction:column;background:#0a0a0f;color:var(--ink)}
  #exerciseScreen.open{display:flex}
  .ex-top{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#111118;border-bottom:1px solid #1e1e2e;flex-shrink:0}
  #exBack{background:none;border:1px solid #2a2a3a;color:var(--ink-dim);border-radius:8px;padding:5px 12px;font-family:inherit;font-size:.78rem;cursor:pointer}
  #exBack:hover{border-color:var(--rind);color:var(--rind)}
  .ex-titlewrap{flex:1;min-width:0}
  .ex-titlewrap h2{font-size:.9rem;font-weight:800;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ex-difftag{font-size:.65rem;color:var(--ink-dim)}
  .ex-topbtns{display:flex;gap:6px;flex-shrink:0}
  #exHint{background:none;border:1px solid #2a2a3a;color:#f59e0b;border-radius:8px;padding:5px 10px;font-family:inherit;font-size:.78rem;cursor:pointer}
  #exRun{background:var(--rind);border:none;color:#000;border-radius:8px;padding:5px 14px;font-family:inherit;font-size:.78rem;font-weight:800;cursor:pointer}
  .ex-tabbar{display:flex;background:#111118;border-bottom:1px solid #1e1e2e;flex-shrink:0}
  .ex-tb{flex:1;padding:8px 4px;background:none;border:none;color:var(--ink-dim);font-family:inherit;font-size:.74rem;cursor:pointer;border-bottom:2px solid transparent;transition:color .12s,border-color .12s}
  .ex-tb.on{color:var(--rind);border-bottom-color:var(--rind)}
  .ex-body{flex:1;display:grid;grid-template-columns:1fr;min-height:0;overflow:hidden}
  @media(min-width:700px){.ex-body{grid-template-columns:280px 1fr 1fr}.ex-tabbar{display:none}.ex-pnl{display:flex!important}}
  .ex-pnl{display:none;flex-direction:column;min-height:0;overflow:hidden;border-right:1px solid #1a1a2a}
  .ex-pnl.on{display:flex}
  .ex-pnl-head{background:#111118;border-bottom:1px solid #1a1a2a;padding:5px 12px;font-size:.67rem;color:var(--ink-dim);flex-shrink:0;display:flex;align-items:center;justify-content:space-between}
  .ex-lang{background:#2a2a3a;border-radius:4px;padding:2px 7px;font-size:.62rem;color:var(--ink-dim)}
  .ex-inst-inner{flex:1;overflow-y:auto;padding:14px;font-size:.81rem;line-height:1.6}
  .ex-inst-inner h3{font-size:.82rem;color:var(--rind);margin:12px 0 6px}
  .ex-inst-inner ol,.ex-inst-inner ul{padding-left:18px}
  .ex-inst-inner li{margin-bottom:4px}
  .ex-inst-inner pre{background:#111118;border:1px solid #2a2a3a;border-radius:8px;padding:10px;overflow-x:auto;font-size:.72rem;margin:8px 0}
  .ex-goal{background:color-mix(in srgb,var(--rind) 8%,#0a0a0f);border:1px solid color-mix(in srgb,var(--rind) 28%,transparent);border-radius:10px;padding:10px 12px;margin-bottom:10px}
  .ex-hintbox{background:color-mix(in srgb,#f59e0b 8%,#0a0a0f);border:1px solid color-mix(in srgb,#f59e0b 28%,transparent);border-radius:10px;padding:10px 12px;margin-top:10px;font-size:.78rem;display:none}
  .ex-hintbox.on{display:block}
  #exCode{flex:1;background:#0d0d16;color:#d4d4d4;border:none;outline:none;resize:none;font-family:'JetBrains Mono',monospace;font-size:.76rem;line-height:1.58;padding:12px;tab-size:2;white-space:pre}
  #exFrame{flex:1;border:none;background:#fff;width:100%;min-height:0}
  #exCheckOut{flex:1;overflow-y:auto;padding:14px;font-size:.81rem;display:none}
  #exCheckOut.on{display:block}
  .ex-pass{background:color-mix(in srgb,var(--rind) 10%,transparent);border:1px solid color-mix(in srgb,var(--rind) 35%,transparent);border-radius:10px;padding:12px;margin-bottom:8px}
  .ex-fail{background:color-mix(in srgb,var(--juice) 10%,transparent);border:1px solid color-mix(in srgb,var(--juice) 35%,transparent);border-radius:10px;padding:12px;margin-bottom:8px}
  .ex-practice-wrap{margin-top:4px}
  .ex-practice-hd{font-size:.68rem;font-weight:900;letter-spacing:.1em;color:var(--ink-dim);text-transform:uppercase;padding:14px 0 8px}
  .ex-clist{display:flex;flex-direction:column;gap:8px;padding-bottom:24px}
  .ex-crd{background:var(--bg-card);border:1px solid var(--line);border-radius:14px;padding:12px 14px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:border-color .15s}
  .ex-crd:hover{border-color:var(--rind)}
  .ex-crd-ico{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:1.15rem;flex-shrink:0}
  .ex-crd-info{flex:1;min-width:0}
  .ex-crd-name{font-size:.85rem;font-weight:700}
  .ex-crd-sub{font-size:.68rem;color:var(--ink-dim);margin-top:2px}

  /* ============ STAGGERED ENTRANCES ============ */
  .pick-btn { animation: fadeInUp 0.5s var(--ease-out) both; }
  #courseList .pick-btn:nth-child(1) { animation-delay: 0.04s; }
  #courseList .pick-btn:nth-child(2) { animation-delay: 0.09s; }
  #courseList .pick-btn:nth-child(3) { animation-delay: 0.14s; }
  #courseList .pick-btn:nth-child(4) { animation-delay: 0.19s; }
  #courseList .pick-btn:nth-child(5) { animation-delay: 0.24s; }
  #courseList .pick-btn:nth-child(6) { animation-delay: 0.29s; }
  #courseList .pick-btn:nth-child(n+7) { animation-delay: 0.33s; }

  /* quiz options cascade in */
  .opts .opt { animation: fadeInUp 0.4s var(--ease-out) both; }
  .opts .opt:nth-child(1) { animation-delay: 0.05s; }
  .opts .opt:nth-child(2) { animation-delay: 0.11s; }
  .opts .opt:nth-child(3) { animation-delay: 0.17s; }
  .opts .opt:nth-child(4) { animation-delay: 0.23s; }
  .opts .opt:nth-child(5) { animation-delay: 0.29s; }

  /* cat-label headers fade in */
  .cat-label { animation: fadeIn 0.5s var(--ease-out) both; }


/* ═══ LIBRARY ════════════════════════════════════════════════════════════ */
.lib-screen{position:fixed;inset:0;background:#0d0d18;display:none;flex-direction:column;overflow:hidden;z-index:10;padding-bottom:64px}
  #workspacesScreen {
    max-width: none; position: fixed; inset: 0; z-index: 10;
    background: var(--bg); padding-bottom: 64px;
  }
.lib-screen.show{display:flex}
.lib-top{background:#0a2020;padding:14px 14px 10px;border-bottom:1px solid #1a3030;flex-shrink:0}
.lib-top-title{font-size:20px;font-weight:700;color:#4dd6a8;margin-bottom:10px;display:flex;align-items:center;gap:8px}
.lib-search-wrap{position:relative;display:flex;align-items:center}
#libSearch{width:100%;padding:9px 36px 9px 36px;border-radius:10px;background:#0d0d18;border:1.5px solid #1a3030;color:#e8e8f0;font-size:15px;outline:none;box-sizing:border-box;transition:border-color .2s}
#libSearch:focus{border-color:#4dd6a8}
#libSearch::placeholder{color:#4a5568}
.lib-search-icon{position:absolute;left:10px;color:#4dd6a8;pointer-events:none;display:flex}
#libClearBtn{position:absolute;right:8px;background:none;border:none;color:#4a5568;font-size:16px;cursor:pointer;padding:4px 6px;line-height:1;display:none}
#libClearBtn.vis{display:block}
.lib-body{flex:1;overflow-y:auto;padding:14px 14px 8px}
.lib-back{display:flex;align-items:center;gap:6px;background:none;border:none;color:#4dd6a8;font-size:14px;cursor:pointer;padding:0 0 12px;font-weight:600}
.lib-back svg{width:16px;height:16px}
.lib-cats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:18px}
.lib-cat-card{background:#111120;border:1.5px solid #1e1e2e;border-radius:12px;padding:13px 12px;cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:10px}
.lib-cat-card:active{transform:scale(.97)}
.lib-cat-icon{font-size:22px;flex-shrink:0}
.lib-cat-name{font-size:13px;font-weight:700;color:#e8e8f0}
.lib-cat-count{font-size:11px;color:#4a5568;margin-top:1px}
.lib-section-header{font-size:12px;font-weight:700;color:#4a5568;letter-spacing:.08em;text-transform:uppercase;margin:4px 0 10px}
.lib-article-list{display:flex;flex-direction:column;gap:8px}
.lib-article-card{background:#111120;border:1.5px solid #1e1e2e;border-radius:12px;padding:12px 14px;cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:12px;border-left:3px solid var(--cat-color,#4dd6a8)}
.lib-article-card:active{transform:scale(.98)}
.lib-article-icon{font-size:20px;flex-shrink:0}
.lib-article-info{flex:1;min-width:0}
.lib-article-title{font-size:15px;font-weight:700;color:#e8e8f0}
.lib-article-sub{font-size:12px;color:#6b7280;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lib-article-ext{background:#1e1e2e;color:#4dd6a8;font-size:10px;font-weight:600;padding:2px 6px;border-radius:5px;font-family:monospace;flex-shrink:0}
.lib-article-header{display:flex;align-items:flex-start;gap:14px;margin-bottom:16px}
.lib-article-big-icon{font-size:44px;line-height:1;flex-shrink:0}
.lib-article-meta{flex:1}
.lib-article-name{font-size:26px;font-weight:800;color:#e8e8f0;line-height:1.1}
.lib-article-subtitle{font-size:14px;color:#6b7280;margin-top:3px}
.lib-article-badges{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}
.lib-badge{background:#1e1e2e;color:#9ca3af;font-size:11px;padding:3px 8px;border-radius:6px;font-family:monospace}
.lib-badge.year{color:#a78bfa;background:#1e1a2e}
.lib-badge.creator{color:#fbbf24;background:#2a200a;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lib-quick-fact{background:#0a2020;border:1px solid #1a3030;border-radius:10px;padding:10px 12px;color:#9ca3af;font-size:13px;margin-bottom:16px;line-height:1.5}
.lib-section{margin-bottom:18px}
.lib-section-title{font-size:14px;font-weight:700;color:#4dd6a8;margin-bottom:8px;padding-bottom:5px;border-bottom:1px solid #1a3030}
.lib-section-body{font-size:14px;color:#9ca3af;line-height:1.7}
.lib-section-body p{margin:0 0 8px}
.lib-section-body p:last-child{margin-bottom:0}
.lib-section-body ul{margin:0 0 8px;padding-left:20px}
.lib-section-body li{margin-bottom:4px}
.lib-section-body strong{color:#e8e8f0}
.lib-section-body code{background:#1e1e2e;color:#4dd6a8;padding:1px 5px;border-radius:4px;font-size:12px;font-family:monospace}
.lib-section-body pre{background:#0d1117;border:1px solid #1e1e2e;border-radius:8px;padding:10px 12px;overflow-x:auto;margin:6px 0 10px}
.lib-section-body pre code{background:none;padding:0;font-size:12px;color:#e8e8f0}
.lib-section-body table{width:100%;border-collapse:collapse;font-size:12px}
.lib-section-body th{text-align:left;padding:4px 8px;color:#6b7280}
.lib-section-body td{padding:4px 8px;border-top:1px solid #1e1e2e}
.lib-related{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.lib-related-pill{background:#1e1e2e;border:1px solid #2e2e3e;color:#a78bfa;font-size:12px;padding:4px 10px;border-radius:20px;cursor:pointer;transition:all .15s}
.lib-related-pill:active{background:#2e2e4e}
.lib-search-count{font-size:12px;color:#4a5568;margin-bottom:10px}
.lib-no-results{text-align:center;color:#4a5568;padding:40px 0;font-size:14px}


/* ── Library section cards ── */
.lib-sec-list { display:flex; flex-direction:column; gap:10px; margin-bottom:8px; }
.lib-sec-list { display:flex; flex-direction:column; gap:12px; margin-bottom:8px; }
.lib-sec-card {
  background: linear-gradient(135deg, #111120 70%, #0d1020);
  border: 1.5px solid #1e1e2e;
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform .18s var(--ease-spring), box-shadow .18s, border-color .18s;
  border-top: 3px solid var(--sec, #4dd6a8);
  position: relative;
  overflow: hidden;
  animation: fadeInUp .4s var(--ease-out) both;
}
.lib-sec-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 10% 50%, rgba(var(--sec-rgb,77,255,160),.05) 0%, transparent 65%);
  pointer-events: none;
}
.lib-sec-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.45); border-color: var(--sec,#4dd6a8); }
.lib-sec-card:active { transform: scale(.97); }
.lib-sec-card-top { display:flex; align-items:flex-start; gap:14px; }
.lib-sec-big-icon {
  font-size: 32px; flex-shrink: 0; line-height: 1; padding-top: 2px;
  animation: floatY 3.5s ease-in-out infinite;
}
.lib-sec-info { flex:1; }
.lib-sec-name { font-size: 18px; font-weight: 800; color: #e8e8f0; letter-spacing: -.01em; }
.lib-sec-desc { font-size: 12px; color: #6b7280; margin-top: 3px; line-height: 1.5; }
.lib-sec-meta { font-size: 11px; color: #4a5568; margin-top: 5px; }
.lib-sec-pills { display:flex; flex-wrap:wrap; gap:5px; margin-top:12px; }
.lib-sec-pill {
  border: 1px solid;
  font-size: 10px; padding: 3px 8px;
  border-radius: 20px; font-weight: 700; letter-spacing: .03em;
  transition: opacity .15s;
}
.lib-sec-card:hover .lib-sec-pill { opacity: .9; }

/* My Courses */
.lib-mycourses-card { border-color: color-mix(in srgb, var(--sec) 45%, var(--line)); }
.lib-demo-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-dim); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 6px; margin-left: 6px; vertical-align: middle;
}
.lib-empty-note { font-size: 13px; color: var(--ink-dim); margin: 8px 0 18px; }
.lib-course-preview-head { display: flex; align-items: flex-start; gap: 14px; margin: 4px 0 18px; }
.lib-course-stages { display: flex; flex-direction: column; gap: 10px; }
.lib-course-stage { display: flex; gap: 12px; background: #111120; border: 1.5px solid #1e1e2e; border-radius: 12px; padding: 13px 14px; }
.lib-course-stage-num {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  color: #ffd34d; background: rgba(255,211,77,0.12); border-radius: 8px;
  width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.lib-course-stage-title { font-size: 14px; font-weight: 700; color: #e8e8f0; margin-bottom: 4px; }
.lib-course-stage-body { font-size: 12.5px; color: #8b95a3; line-height: 1.5; }

/* Bloxnet — course maker */
.bloxnet-step-label {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim);
  margin: 0 0 6px;
}
.bloxnet-icon-preview {
  width: 88px; height: 88px; border-radius: 14px; border: 1.5px dashed var(--line);
  background: var(--bg-card); display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.bloxnet-icon-preview svg { max-width: 56px; max-height: 56px; }
.bloxnet-draft-list { display: flex; flex-direction: column; gap: 10px; }
.bloxnet-draft-card {
  display: flex; align-items: center; gap: 12px;
  background: #111120; border: 1.5px solid #1e1e2e; border-radius: 12px; padding: 13px 14px;
}
.bloxnet-draft-icon { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.bloxnet-draft-icon svg { width: 32px; height: 32px; }
.bloxnet-draft-title { font-size: 14px; font-weight: 700; color: #e8e8f0; }
.bloxnet-draft-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.bloxnet-draft-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.bloxnet-draft-card:hover { border-color: #ffd34d; transform: translateY(-2px); }
.bloxnet-draft-card:active { transform: scale(.98); }
.bloxnet-draft-card > .grow { flex: 1; }

/* Bloxnet — level builder */
.bloxnet-level-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.bloxnet-level-card { display: flex; align-items: flex-start; gap: 12px; background: #111120; border: 1.5px solid #1e1e2e; border-radius: 12px; padding: 13px 14px; }
.bloxnet-level-text { flex: 1; min-width: 0; }
.bloxnet-level-actions { display: flex; gap: 6px; flex-shrink: 0; }
.bloxnet-icon-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--bg-card); color: var(--ink-dim); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.bloxnet-icon-btn:hover:not(:disabled) { border-color: #ffd34d; color: var(--ink); }
.bloxnet-icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.bloxnet-icon-btn-danger:hover:not(:disabled) { border-color: var(--juice); color: var(--juice); }
.bloxnet-add-level-btn {
  display: block; width: 100%; box-sizing: border-box;
  padding: 12px; border-radius: 10px; border: 1.5px dashed var(--line);
  background: transparent; color: var(--ink-dim); cursor: pointer;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  transition: border-color .15s, color .15s;
}
.bloxnet-add-level-btn:hover { border-color: #ffd34d; color: var(--ink); }

/* category cards */
.lib-cat-card {
  background: #0e0e1c;
  border: 1.5px solid #1e1e2e;
  border-radius: 14px;
  padding: 14px 13px;
  cursor: pointer;
  transition: transform .18s var(--ease-spring), box-shadow .15s, border-color .15s;
  display: flex; align-items: center; gap: 12px;
  animation: scaleIn .3s var(--ease-out) both;
}
.lib-cat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.4); border-color: var(--cat-color,#4dd6a8); }
.lib-cat-card:active { transform: scale(.96); }
.lib-cat-icon { font-size: 24px; flex-shrink: 0; transition: transform .2s var(--ease-spring); }
.lib-cat-card:hover .lib-cat-icon { transform: scale(1.15) rotate(-4deg); }

/* article cards */
.lib-article-card {
  background: #0e0e1c;
  border: 1.5px solid #1e1e2e;
  border-left: 3px solid var(--cat-color, #4dd6a8);
  border-radius: 12px;
  padding: 13px 15px;
  cursor: pointer;
  transition: transform .18s var(--ease-spring), box-shadow .15s, background .15s;
  display: flex; align-items: center; gap: 13px;
  animation: slideInLeft .3s var(--ease-out) both;
}
.lib-article-card:hover { transform: translateX(3px); box-shadow: 0 4px 16px rgba(0,0,0,.4); background: #111124; }
.lib-article-card:active { transform: scale(.97); }
.lib-article-icon { font-size: 22px; flex-shrink: 0; transition: transform .2s var(--ease-spring); }
.lib-article-card:hover .lib-article-icon { transform: scale(1.2); }

/* article view */
.lib-article-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 18px;
  animation: fadeInDown .35s var(--ease-out) both;
}
.lib-article-big-icon {
  font-size: 48px; line-height: 1; flex-shrink: 0;
  animation: juiceDrop .5s var(--ease-spring) both;
}
.lib-article-name { font-size: 28px; font-weight: 800; color: #e8e8f0; line-height: 1.1; letter-spacing: -.02em; }
.lib-article-subtitle { font-size: 14px; color: #6b7280; margin-top: 4px; }
.lib-article-badges { display:flex; flex-wrap:wrap; gap:5px; margin-top:10px; }
.lib-badge { background:#1e1e2e; color:#9ca3af; font-size:11px; padding:3px 8px; border-radius:6px; font-family:monospace; }
.lib-badge.year { color:#a78bfa; background:#1e1a2e; }
.lib-badge.creator { color:#fbbf24; background:#2a200a; max-width:180px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lib-quick-fact {
  background: linear-gradient(135deg, #0a1a1a, #0a1020);
  border: 1px solid #1a3040;
  border-radius: 12px;
  padding: 12px 14px;
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
  animation: fadeIn .4s var(--ease-out) .1s both;
}
.lib-quick-fact::before {
  content: '💡';
  position: absolute; right: 12px; top: 10px;
  font-size: 18px; opacity: .25;
}
.lib-section { margin-bottom: 20px; animation: fadeInUp .35s var(--ease-out) both; }
.lib-section-title {
  font-size: 14px; font-weight: 700; color: #4dd6a8;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1.5px solid #1a3030;
  display: flex; align-items: center; gap: 6px;
}
.lib-section-title::before { content: '▸'; color: #4dffa0; opacity: .7; font-size: 12px; }
.lib-section-body { font-size: 14px; color: #9ca3af; line-height: 1.75; }
.lib-section-body p { margin: 0 0 10px; }
.lib-section-body p:last-child { margin-bottom: 0; }
.lib-section-body ul { margin: 0 0 10px; padding-left: 20px; }
.lib-section-body li { margin-bottom: 5px; }
.lib-section-body strong { color: #e0e8f0; }
.lib-section-body code {
  background: #1a1a2e; color: #4dffa0;
  padding: 2px 6px; border-radius: 5px;
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
  border: 1px solid #2a2a3e;
}
.lib-section-body pre {
  background: #080d14;
  border: 1px solid #1e2535;
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0 12px;
  position: relative;
}
.lib-section-body pre::before {
  content: '// ';
  color: #2a3850;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  position: absolute;
  top: 8px; right: 10px;
}
.lib-section-body pre code {
  background: none; padding: 0; font-size: 12px;
  color: #c8d8f0; border: none; border-radius: 0;
}
.lib-section-body table { width:100%; border-collapse:collapse; font-size:12px; }
.lib-section-body th { text-align:left; padding:5px 9px; color:#6b7280; border-bottom: 1px solid #1e2535; }
.lib-section-body td { padding:5px 9px; border-top:1px solid #1e1e2e; }
.lib-related { display:flex; flex-wrap:wrap; gap:7px; margin-top:7px; }
.lib-related-pill {
  background: #1a1a2e; border: 1px solid #2e2e4e;
  color: #a78bfa; font-size: 12px; padding: 4px 12px;
  border-radius: 20px; cursor: pointer;
  transition: all .15s var(--ease-spring);
}
.lib-related-pill:hover { background: #252540; transform: scale(1.05); }
.lib-related-pill:active { transform: scale(.96); }
.lib-search-count { font-size:12px; color:#4a5568; margin-bottom:10px; }
.lib-no-results { text-align:center; color:#4a5568; padding:40px 0; font-size:14px; }

.lib-sec-header-banner {
  cursor: default; display: flex; align-items: center; gap: 14px;
  border-top: 3px solid var(--sec, #4dd6a8);
  background: linear-gradient(135deg, #0e0e1c 70%, #0a0a16);
}
.lib-sec-header-banner:active { transform: none; }
