/*
 * Dark Code — Programming Language Hub · Premium Redesign
 * Page-specific stylesheet (extracted from programming_language.html)
 * Mobile responsiveness fixes included at the bottom of this file.
 */

    /* ══════════════════════════════════════════════════════
           Dark Code — Programming Language Hub · Premium Redesign
        ══════════════════════════════════════════════════════ */
    :root {
      /* Core palette */
      --bg: #060810;
      --bg-raised: #0b0e18;
      --bg-panel: #0f1220;
      --surface: rgba(255, 255, 255, 0.035);
      --surface-h: rgba(255, 255, 255, 0.060);
      --surface-hh: rgba(255, 255, 255, 0.090);
      --border: rgba(255, 255, 255, 0.072);
      --border-h: rgba(108, 99, 255, 0.45);
      --border-s: rgba(108, 99, 255, 0.22);

      /* Brand colours */
      --indigo: #6c63ff;
      --indigo-dim: rgba(108, 99, 255, 0.15);
      --indigo-glow: rgba(108, 99, 255, 0.35);
      --pink: #f72585;
      --pink-dim: rgba(247, 37, 133, 0.12);
      --teal: #00d4aa;
      --teal-dim: rgba(0, 212, 170, 0.12);
      --amber: #fbbf24;

      /* Text */
      --text: #ebedf5;
      --text-2: #a9b0c5;
      --text-3: #616a82;

      /* Semantic */
      --success: #00d4aa;
      --error: #ff5d73;

      /* Gradients */
      --grad: linear-gradient(135deg, #6c63ff 0%, #f72585 100%);
      --grad-teal: linear-gradient(135deg, #6c63ff 0%, #00d4aa 100%);
      --grad-soft: linear-gradient(135deg, rgba(108, 99, 255, 0.18) 0%, rgba(247, 37, 133, 0.10) 100%);

      /* Shape */
      --r: 20px;
      --r-sm: 12px;
      --r-xs: 8px;

      /* Shadow */
      --sh: 0 8px 32px rgba(0, 0, 0, 0.5);
      --sh-lg: 0 24px 72px rgba(0, 0, 0, 0.6);
      --sh-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
      --sh-glow: 0 0 40px rgba(108, 99, 255, 0.18);

      /* Motion */
      --ease: cubic-bezier(0.22, 1, 0.36, 1);
      --ease-out: cubic-bezier(0.0, 0, 0.2, 1);
      --t-fast: 0.15s;
      --t-med: 0.28s;
      --t-slow: 0.5s;

      /* Type */
      --font: 'Inter', system-ui, -apple-system, sans-serif;
      --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    }

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--font);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
    }

    /* ══ Static ambient background — no animation, no filter ══ */
    .pl-orb {
      position: absolute;
      border-radius: 50%;
      pointer-events: none;
      z-index: 0;
    }

    .pl-orb-1 {
      width: 700px;
      height: 700px;
      background: radial-gradient(circle, rgba(108, 99, 255, 0.055) 0%, transparent 65%);
      top: -250px;
      right: -220px;
    }

    .pl-orb-2 {
      width: 500px;
      height: 500px;
      background: radial-gradient(circle, rgba(247, 37, 133, 0.04) 0%, transparent 65%);
      top: 55%;
      left: -180px;
    }

    .pl-orb-3 {
      display: none;
    }

    @media (prefers-reduced-motion: reduce) {
      .pl-hero-dot {
        animation: none !important;
      }
    }

    /* ══ Layout ══ */
    .pl-page-wrapper {
      position: relative;
      z-index: 1;
      contain: paint;
    }

    .pl-container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 24px;
    }

    /* ══════════════════════════════════════════
           HERO SECTION
        ══════════════════════════════════════════ */
    .pl-hero {
      /* --pl-header-h: adjust this to match your fixed header's real height
         (check ../style.css or components/header.html for its height/padding) */
      padding: calc(80px + var(--pl-header-h, 72px)) 0 48px;
      text-align: center;
      position: relative;
    }

    /* Subtle grid texture behind hero */
    .pl-hero::before {
      content: '';
      position: absolute;
      inset: 0;
      background-image:
        linear-gradient(rgba(108, 99, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 99, 255, 0.04) 1px, transparent 1px);
      background-size: 40px 40px;
      mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 100%);
      -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 100%);
      pointer-events: none;
    }

    .pl-hero-inner {
      position: relative;
      z-index: 1;
    }

    .pl-hero-badge {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      padding: 8px 18px;
      border-radius: 999px;
      background: rgba(108, 99, 255, 0.1);
      border: 1px solid rgba(108, 99, 255, 0.28);
      color: var(--teal);
      font-size: 12.5px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      margin-bottom: 28px;
      box-shadow: 0 0 0 1px rgba(108, 99, 255, 0.1) inset;
    }

    .pl-hero-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--teal);
      flex-shrink: 0;
      box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.55);
      animation: heroPulse 2s ease-out infinite;
    }

    @keyframes heroPulse {
      0% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.55);
      }

      70% {
        box-shadow: 0 0 0 9px rgba(0, 212, 170, 0);
      }

      100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0);
      }
    }

    .pl-hero-title {
      font-size: clamp(2.4rem, 5.5vw, 3.8rem);
      line-height: 1.08;
      font-weight: 900;
      letter-spacing: -0.03em;
      color: var(--text);
      margin: 0 0 20px;
    }

    .pl-hero-grad {
      background: var(--grad);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      color: transparent;
      display: inline-block;
    }

    .pl-hero-subtitle {
      font-size: clamp(1rem, 2vw, 1.12rem);
      line-height: 1.7;
      color: var(--text-2);
      max-width: 560px;
      margin: 0 auto 40px;
      font-weight: 400;
    }

    /* Hero stats strip */
    .pl-hero-stats {
      display: inline-flex;
      align-items: center;
      gap: 0;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
    }

    .pl-hero-stat {
      padding: 12px 24px;
      text-align: center;
      position: relative;
    }

    .pl-hero-stat+.pl-hero-stat::before {
      content: '';
      position: absolute;
      left: 0;
      top: 20%;
      bottom: 20%;
      width: 1px;
      background: var(--border);
    }

    .pl-hero-stat-val {
      font-size: 1.25rem;
      font-weight: 800;
      color: var(--text);
      font-family: var(--mono);
      letter-spacing: -0.02em;
    }

    .pl-hero-stat-val span {
      background: var(--grad);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .pl-hero-stat-label {
      font-size: 11px;
      color: var(--text-3);
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-top: 2px;
    }

    /* ══════════════════════════════════════════
           SECTION HEADER
        ══════════════════════════════════════════ */
    .pl-section-head {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 0 0 24px;
    }

    .pl-section-line {
      flex: 1;
      height: 1px;
      background: linear-gradient(to right, var(--border), transparent);
    }

    .pl-section-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--text-3);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      white-space: nowrap;
    }

    /* ══════════════════════════════════════════
           LANGUAGE GRID + CARDS
        ══════════════════════════════════════════ */
    .pl-grid-section {
      padding: 8px 0 96px;
      content-visibility: auto;
    }

    .pl-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
      gap: 20px;
    }

    .pl-card {
      background: linear-gradient(160deg, rgba(255, 255, 255, 0.042) 0%, rgba(255, 255, 255, 0.016) 100%);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 26px;
      cursor: pointer;
      transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.18s ease;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      min-height: 220px;
      outline: none;
    }

    /* Top accent line */
    .pl-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 20px;
      right: 20px;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--card-accent, var(--indigo)), transparent);
      opacity: 0;
      transition: opacity var(--t-med) var(--ease);
    }

    /* Radial glow on hover */
    .pl-card::after {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse 70% 55% at 80% -5%, var(--card-accent, rgba(108, 99, 255, 0.18)) 0%, transparent 60%);
      opacity: 0;
      transition: opacity var(--t-med) var(--ease);
      pointer-events: none;
    }

    .pl-card:hover {
      border-color: var(--border-s);
      transform: translateY(-5px);
      box-shadow: var(--sh-card), 0 0 0 1px var(--border-s), var(--sh-glow);
      background: linear-gradient(160deg, rgba(255, 255, 255, 0.060) 0%, rgba(255, 255, 255, 0.024) 100%);
    }

    .pl-card:hover::before {
      opacity: 1;
    }

    .pl-card:hover::after {
      opacity: 1;
    }

    .pl-card:focus-visible {
      outline: 2px solid var(--indigo);
      outline-offset: 3px;
    }

    /* Card icon */
    .pl-card-icon {
      width: 54px;
      height: 54px;
      border-radius: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.45rem;
      margin-bottom: 20px;
      background: rgba(255, 255, 255, 0.045);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--card-accent, var(--indigo));
      flex-shrink: 0;
      position: relative;
      z-index: 1;
      transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
      box-shadow: 0 0 0 0 transparent;
    }

    .pl-card:hover .pl-card-icon {
      transform: scale(1.06);
      box-shadow: 0 0 20px var(--card-accent, rgba(108, 99, 255, 0.3));
    }

    .pl-card-name {
      font-size: 1.15rem;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 8px;
      position: relative;
      z-index: 1;
      letter-spacing: -0.01em;
    }

    .pl-card-desc {
      font-size: 0.84rem;
      line-height: 1.6;
      color: var(--text-2);
      flex: 1;
      margin-bottom: 20px;
      position: relative;
      z-index: 1;
    }

    .pl-card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      position: relative;
      z-index: 1;
    }

    .pl-card-count {
      font-size: 11.5px;
      color: var(--text-3);
      font-family: var(--mono);
      display: flex;
      align-items: center;
      gap: 6px;
      font-weight: 500;
    }

    .pl-card-count i {
      color: var(--card-accent, var(--indigo));
      opacity: 0.8;
    }

    .pl-card-progress-pct {
      font-size: 12px;
      font-weight: 800;
      color: var(--card-accent, var(--indigo));
      font-family: var(--mono);
      background: rgba(108, 99, 255, 0.1);
      padding: 2px 8px;
      border-radius: 6px;
      border: 1px solid rgba(108, 99, 255, 0.2);
    }

    /* Progress bar */
    .pl-card-bar-wrap {
      height: 3px;
      border-radius: 99px;
      background: rgba(255, 255, 255, 0.055);
      overflow: hidden;
      margin-top: 14px;
      position: relative;
      z-index: 1;
    }

    .pl-card-bar-fill {
      height: 100%;
      border-radius: 99px;
      background: var(--card-accent, var(--indigo));
      width: 0%;
      transition: width 0.7s var(--ease);
      box-shadow: 0 0 8px var(--card-accent, var(--indigo));
    }

    /* Completed badge */
    .pl-card-done-badge {
      font-size: 11px;
      font-weight: 700;
      color: var(--success);
      background: rgba(0, 212, 170, 0.1);
      border: 1px solid rgba(0, 212, 170, 0.22);
      border-radius: 99px;
      padding: 3px 10px;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      letter-spacing: 0.01em;
    }

    /* Skeleton cards */
    .pl-card-skel {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 26px;
      min-height: 220px;
    }

    .pl-skel-block {
      background: rgba(255, 255, 255, 0.048);
      border-radius: var(--r-xs);
      animation: skelPulse 1.6s ease-in-out infinite;
    }

    @keyframes skelPulse {

      0%,
      100% {
        opacity: .35
      }

      50% {
        opacity: .75
      }
    }

    /* Card reveal on load */
    .pl-card {
      opacity: 0;
      transform: translateY(16px);
    }

    .pl-card.visible {
      opacity: 1;
      transform: translateY(0);
      transition: opacity 0.35s ease, transform 0.35s ease;
    }

    .pl-empty-state {
      text-align: center;
      padding: 72px 24px;
      color: var(--text-2);
      grid-column: 1 / -1;
    }

    .pl-empty-state i {
      font-size: 2.4rem;
      color: rgba(108, 99, 255, 0.22);
      margin-bottom: 16px;
      display: block;
    }

    .pl-empty-state p {
      font-size: 0.94rem;
      color: var(--text-3);
    }

    /* ══════════════════════════════════════════
           SKILL PATH — how to go from lessons to real skill
        ══════════════════════════════════════════ */
    .pl-path-section {
      padding: 8px 0 100px;
    }

    .pl-path-intro {
      max-width: 620px;
      margin: 0 0 40px;
    }

    .pl-path-intro p {
      font-size: 0.95rem;
      line-height: 1.7;
      color: var(--text-2);
    }

    .pl-path-rail {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .pl-path-rail::before {
      content: '';
      position: absolute;
      left: 27px;
      top: 30px;
      bottom: 30px;
      width: 2px;
      background: linear-gradient(to bottom, var(--indigo) 0%, var(--pink) 50%, var(--teal) 100%);
      opacity: 0.28;
    }

    .pl-path-step {
      position: relative;
      display: flex;
      gap: 20px;
      padding: 18px 16px;
      border-radius: var(--r-sm);
      transition: background var(--t-med) var(--ease);
    }

    .pl-path-step:hover {
      background: var(--surface);
    }

    .pl-path-num {
      flex-shrink: 0;
      width: 56px;
      height: 56px;
      border-radius: 16px;
      background: var(--bg-panel);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.3rem;
      color: var(--step-c, var(--indigo));
      position: relative;
      z-index: 1;
      box-shadow: 0 0 0 6px var(--bg), 0 0 0 1px var(--border) inset;
    }

    .pl-path-body {
      flex: 1;
      padding-top: 2px;
    }

    .pl-path-title-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 6px;
      flex-wrap: wrap;
    }

    .pl-path-title {
      font-size: 1.02rem;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
    }

    .pl-path-tag {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--step-c, var(--indigo));
      background: color-mix(in srgb, var(--step-c, var(--indigo)) 14%, transparent);
      border: 1px solid color-mix(in srgb, var(--step-c, var(--indigo)) 28%, transparent);
      padding: 2px 8px;
      border-radius: 999px;
    }

    .pl-path-desc {
      font-size: 0.88rem;
      line-height: 1.65;
      color: var(--text-2);
      max-width: 620px;
    }

    .pl-path-desc code {
      font-family: var(--mono);
      font-size: 0.82em;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid var(--border);
      padding: 1px 6px;
      border-radius: 6px;
      color: var(--text);
    }

    /* Quiz CTA — sits as the final "step" in the rail */
    .pl-path-cta {
      position: relative;
      margin-top: 18px;
      padding: 28px 26px;
      border-radius: var(--r);
      background: linear-gradient(160deg, rgba(108, 99, 255, 0.10) 0%, rgba(247, 37, 133, 0.06) 100%);
      border: 1px solid var(--border-s);
      display: flex;
      align-items: center;
      gap: 20px;
      flex-wrap: wrap;
      justify-content: space-between;
      overflow: hidden;
    }

    .pl-path-cta::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(0, 212, 170, 0.12) 0%, transparent 60%);
      pointer-events: none;
    }

    .pl-path-cta-text {
      position: relative;
      z-index: 1;
      max-width: 420px;
    }

    .pl-path-cta-eyebrow {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--teal);
      margin-bottom: 6px;
    }

    .pl-path-cta-title {
      font-size: 1.15rem;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 6px;
      letter-spacing: -0.01em;
    }

    .pl-path-cta-desc {
      font-size: 0.86rem;
      line-height: 1.6;
      color: var(--text-2);
    }

    .pl-path-cta-btn {
      position: relative;
      z-index: 1;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 14px 26px;
      border-radius: 999px;
      background: var(--grad);
      color: #fff;
      font-size: 0.92rem;
      font-weight: 700;
      text-decoration: none;
      box-shadow: var(--sh-glow);
      transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
      white-space: nowrap;
    }

    .pl-path-cta-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 0 50px rgba(108, 99, 255, 0.32);
    }

    .pl-path-cta-btn i {
      font-size: 0.85rem;
    }

    @media (max-width: 640px) {
      .pl-path-rail::before {
        left: 25px;
      }

      .pl-path-num {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
      }

      .pl-path-step {
        gap: 14px;
        padding: 14px 10px;
      }

      .pl-path-cta {
        padding: 22px 20px;
      }

      .pl-path-cta-btn {
        width: 100%;
        justify-content: center;
      }
    }

    /* ══════════════════════════════════════════
           MODAL — Overlay
        ══════════════════════════════════════════ */
    .pl-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(2, 3, 8, 0.82);

      /* Must stay above the shared site chrome (mobile-topbar / mobile-bottom-nav
         are z-index:1100, the mobile menu sheet + toast are 1200, the install
         popup is 1300 — see /components/components.css). Otherwise the fixed
         topbar/bottom-nav render on top of this full-screen modal and clip the
         modal's own header and the last topic(s) in the sidebar / lesson list. */
      z-index: 1400;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    .pl-modal-overlay.open {
      display: flex;
      animation: overlayIn var(--t-fast) var(--ease-out);
    }

    @keyframes overlayIn {
      from {
        opacity: 0
      }

      to {
        opacity: 1
      }
    }

    /* ══ Modal shell ══ */
    .pl-modal {
      background: linear-gradient(160deg, #0d1020 0%, #090b14 100%);
      border: 1px solid rgba(108, 99, 255, 0.22);
      border-radius: 24px;
      width: 100%;
      max-width: 780px;
      max-height: min(88vh, 840px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-shadow:
        0 40px 100px -20px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
      animation: modalIn 0.32s var(--ease);
    }

    @keyframes modalIn {
      from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    /* ══ Modal header ══ */
    .pl-modal-head {
      display: flex;
      align-items: center;
      gap: 13px;
      padding: 18px 20px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.014);
      position: relative;
    }

    /* Thin top gradient accent in modal header */
    .pl-modal-head::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--modal-accent, var(--indigo)), transparent);
      opacity: 0.5;
    }

    .pl-modal-back,
    .pl-modal-close {
      width: 36px;
      height: 36px;
      border-radius: var(--r-sm);
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-3);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
      font-size: 13px;
    }

    .pl-modal-back {
      display: none;
    }

    .pl-modal-back.show {
      display: flex;
    }

    .pl-modal-back:hover {
      color: var(--text);
      border-color: var(--border-s);
      background: var(--surface-h);
    }

    .pl-modal-close:hover {
      color: var(--error);
      border-color: rgba(255, 93, 115, 0.4);
      background: rgba(255, 93, 115, 0.07);
    }

    .pl-modal-icon {
      width: 42px;
      height: 42px;
      border-radius: 13px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--modal-accent, var(--indigo));
      flex-shrink: 0;
      box-shadow: 0 0 16px var(--modal-accent, transparent);
    }

    .pl-modal-title-block {
      flex: 1;
      min-width: 0;
    }

    .pl-modal-title {
      font-size: 1rem;
      font-weight: 800;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      letter-spacing: -0.01em;
    }

    .pl-modal-subtitle {
      font-size: 12px;
      color: var(--text-3);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-weight: 500;
    }

    /* ══ Modal body ══ */
    .pl-modal-body {
      flex: 1;
      overflow-y: auto;
      padding: 22px 22px 28px;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }

    .pl-modal-body::-webkit-scrollbar {
      width: 5px;
    }

    .pl-modal-body::-webkit-scrollbar-track {
      background: transparent;
    }

    .pl-modal-body::-webkit-scrollbar-thumb {
      background: rgba(108, 99, 255, 0.3);
      border-radius: 99px;
    }

    /* ══ Skeleton inside modal ══ */
    .pl-modal-skel {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .pl-modal-skel .pl-skel-block {
      height: 62px;
    }

    /* ══════════════════════════════════════════
           TOPIC LIST
        ══════════════════════════════════════════ */
    .pl-topic-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .pl-topic-row {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px 14px 14px 16px;
      cursor: pointer;
      transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
      text-align: left;
      width: 100%;
      position: relative;
      overflow: hidden;
      box-sizing: border-box;
    }

    .pl-topic-row::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 3px;
      border-radius: 0 3px 3px 0;
      background: var(--modal-accent, var(--indigo));
      opacity: 0;
      transition: opacity var(--t-fast) var(--ease);
    }

    .pl-topic-row:hover {
      border-color: var(--border-s);
      background: var(--surface-h);
      transform: translateX(3px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }

    .pl-topic-row:hover::before {
      opacity: 1;
    }

    .pl-topic-row.is-done {
      background: rgba(0, 212, 170, 0.04);
      border-color: rgba(0, 212, 170, 0.15);
    }

    .pl-topic-row.is-done::before {
      background: var(--success);
      opacity: 1;
    }

    .pl-topic-num {
      width: 30px;
      height: 30px;
      min-width: 30px;
      border-radius: 9px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11.5px;
      font-weight: 700;
      font-family: var(--mono);
      color: var(--text-3);
      flex-shrink: 0;
      margin-top: 1px;
      transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
    }

    .pl-topic-row.is-done .pl-topic-num {
      background: rgba(0, 212, 170, 0.12);
      border-color: rgba(0, 212, 170, 0.3);
      color: var(--success);
    }

    .pl-topic-row:not(.is-done):hover .pl-topic-num {
      background: var(--indigo-dim);
      border-color: var(--border-h);
      color: var(--indigo);
    }

    .pl-topic-row-body {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .pl-topic-row-title {
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.4;
      word-break: break-word;
      overflow-wrap: break-word;
      white-space: normal;
      letter-spacing: -0.005em;
    }

    .pl-topic-row-summary {
      font-size: 12px;
      color: var(--text-3);
      line-height: 1.5;
      font-weight: 400;
      word-break: break-word;
      overflow-wrap: break-word;
      white-space: normal;
    }

    .pl-topic-row-arrow {
      color: var(--text-3);
      flex-shrink: 0;
      font-size: 11px;
      margin-top: 9px;
      transition: transform var(--t-fast) var(--ease), color var(--t-fast);
    }

    .pl-topic-row:hover .pl-topic-row-arrow {
      transform: translateX(2px);
      color: var(--indigo);
    }

    .pl-topic-row.is-done .pl-topic-row-arrow {
      color: var(--success);
    }

    /* ══════════════════════════════════════════
           TOPIC CONTENT
        ══════════════════════════════════════════ */
    .pl-topic-content {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .pl-topic-content-header {
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border);
    }

    .pl-topic-content-title {
      font-size: 1.3rem;
      font-weight: 900;
      color: var(--text);
      line-height: 1.25;
      letter-spacing: -0.02em;
      margin-bottom: 8px;
    }

    .pl-topic-content-summary {
      font-size: 0.9rem;
      color: var(--text-2);
      line-height: 1.65;
      font-weight: 400;
    }

    .pl-content-block p {
      font-size: 0.9rem;
      line-height: 1.75;
      color: #c4c8d8;
      margin: 0 0 4px;
    }

    .pl-content-subheading {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--modal-accent, var(--indigo));
      margin: 6px 0 4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .pl-content-subheading::after {
      content: '';
      flex: 1;
      height: 1px;
      background: linear-gradient(to right, var(--border), transparent);
    }

    .pl-content-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 2px 0 4px;
      padding: 0;
    }

    .pl-content-list li {
      font-size: 0.88rem;
      line-height: 1.65;
      color: #c4c8d8;
      padding-left: 24px;
      position: relative;
    }

    .pl-content-list li::before {
      content: '';
      position: absolute;
      left: 6px;
      top: 10px;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--modal-accent, var(--indigo));
      opacity: 0.75;
    }

    /* ══ Code blocks ══ */
    .pl-code-block {
      background: #080a10;
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    }

    .pl-code-block-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.022);
    }

    .pl-code-block-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--text-3);
      display: flex;
      align-items: center;
      gap: 7px;
    }

    .pl-code-block-label i {
      color: var(--modal-accent, var(--indigo));
    }

    .pl-code-copy-btn {
      background: none;
      border: none;
      color: var(--text-3);
      font-size: 11.5px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 4px 9px;
      border-radius: var(--r-xs);
      transition: color var(--t-fast), background var(--t-fast);
      font-family: var(--mono);
      font-weight: 600;
    }

    .pl-code-copy-btn:hover {
      color: var(--text);
      background: rgba(255, 255, 255, 0.07);
    }

    .pl-code-block pre {
      margin: 0;
      padding: 18px;
      overflow-x: auto;
      font-family: var(--mono);
      font-size: 0.83rem;
      line-height: 1.65;
      color: #dde1f0;
      white-space: pre;
    }

    .pl-output-block {
      background: rgba(0, 212, 170, 0.03);
    }

    .pl-output-block .pl-code-block-head {
      background: rgba(0, 212, 170, 0.05);
    }

    .pl-output-block pre {
      color: #7ddfc8;
    }

    /* ══ Status badges ══ */
    .pl-status-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 6px 14px;
      border-radius: 99px;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      width: fit-content;
    }

    .pl-status-badge.right {
      background: rgba(0, 212, 170, 0.1);
      border: 1px solid rgba(0, 212, 170, 0.28);
      color: var(--success);
    }

    .pl-status-badge.wrong {
      background: rgba(255, 93, 115, 0.1);
      border: 1px solid rgba(255, 93, 115, 0.28);
      color: var(--error);
    }

    /* ══ Try Your Skill (quiz link) ══ */
    .pl-try-skill-wrap {
      padding: 16px 0 0;
      border-top: 1px solid var(--border);
      margin-top: 4px;
    }

    .pl-try-skill-btn {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      padding: 12px 24px;
      border-radius: 13px;
      border: 1px solid rgba(251, 191, 36, 0.32);
      font-size: 0.88rem;
      font-weight: 800;
      cursor: pointer;
      transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
      background: rgba(251, 191, 36, 0.1);
      color: var(--amber);
      letter-spacing: -0.005em;
      font-family: var(--font);
      text-decoration: none;
    }

    .pl-try-skill-btn:hover {
      transform: translateY(-2px);
      background: rgba(251, 191, 36, 0.18);
      box-shadow: 0 10px 28px rgba(251, 191, 36, 0.22);
    }

    .pl-try-skill-btn:active {
      transform: translateY(0);
    }

    /* ══ Mark Done ══ */
    .pl-mark-done-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      padding: 16px 0 0;
      border-top: 1px solid var(--border);
      margin-top: 4px;
    }

    .pl-mark-done-btn {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      padding: 12px 24px;
      border-radius: 13px;
      border: none;
      font-size: 0.88rem;
      font-weight: 800;
      cursor: pointer;
      transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), opacity var(--t-fast);
      background: var(--grad);
      color: #fff;
      box-shadow: 0 6px 24px rgba(108, 99, 255, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
      letter-spacing: -0.005em;
      font-family: var(--font);
    }

    .pl-mark-done-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 32px rgba(108, 99, 255, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }

    .pl-mark-done-btn:active {
      transform: translateY(0);
    }

    .pl-mark-done-btn:disabled {
      opacity: .55;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .pl-mark-done-btn.is-done {
      background: rgba(0, 212, 170, 0.1);
      color: var(--success);
      border: 1px solid rgba(0, 212, 170, 0.28);
      box-shadow: none;
    }

    .pl-mark-done-note {
      font-size: 12.5px;
      color: var(--text-3);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .pl-mark-done-note a {
      color: var(--teal);
      font-weight: 700;
      text-decoration: none;
      border-bottom: 1px solid rgba(0, 212, 170, 0.3);
      transition: border-color var(--t-fast);
    }

    .pl-mark-done-note a:hover {
      border-color: var(--teal);
    }

    /* ══ Topic nav ══ */
    .pl-topic-nav {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin-top: 4px;
    }

    .pl-topic-nav-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 10px 18px;
      border-radius: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-2);
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      transition: border-color var(--t-fast) var(--ease), color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease);
      font-family: var(--font);
      letter-spacing: -0.005em;
    }

    .pl-topic-nav-btn:hover:not(:disabled) {
      border-color: var(--border-s);
      color: var(--text);
      background: var(--surface-h);
      transform: translateY(-1px);
    }

    .pl-topic-nav-btn:disabled {
      opacity: .3;
      cursor: not-allowed;
    }

    /* ══════════════════════════════════════════
           RESPONSIVE
        ══════════════════════════════════════════ */
    @media (max-width: 960px) {
      .pl-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
      }

      .pl-hero {
        padding: calc(60px + var(--pl-header-h, 72px)) 0 40px;
      }
    }

    /* Matches the real breakpoint where /components/components.css swaps the
       fixed desktop .site-header for the fixed .mobile-topbar + .mobile-bottom-nav
       (that swap happens at max-width:880px, with main{padding-top:82px} as the
       calibrated clearance sitewide). Kept in sync so the hero title never sits
       under the floating mobile topbar. */
    @media (max-width: 880px) {
      .pl-hero {
        padding-top: 82px;
      }
    }

    @media (max-width: 640px) {
      .pl-container {
        padding: 0 14px;
      }

      .pl-hero {
        padding: calc(48px + var(--pl-header-h, 64px)) 0 32px;
      }

      .pl-hero-title {
        letter-spacing: -0.025em;
      }

      .pl-hero-stats {
        flex-direction: row;
      }

      .pl-hero-stat {
        padding: 10px 16px;
      }

      .pl-hero-stat-val {
        font-size: 1.1rem;
      }

      .pl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px;
      }

      .pl-card {
        padding: 18px;
        min-height: 190px;
      }

      .pl-card-icon {
        width: 46px;
        height: 46px;
        font-size: 1.2rem;
        margin-bottom: 16px;
        border-radius: 13px;
      }

      .pl-card-name {
        font-size: 1.02rem;
        margin-bottom: 6px;
      }

      .pl-card-desc {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 16px;
      }

      /* Mobile bottom-sheet modal */
      .pl-modal-overlay {
        padding: 0;
        align-items: flex-end;
      }

      .pl-modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        animation: modalInMobile 0.32s var(--ease);
      }

      @keyframes modalInMobile {
        from {
          transform: translateY(100%);
          opacity: 0.8;
        }

        to {
          transform: translateY(0);
          opacity: 1;
        }
      }

      /* Bottom handle bar on mobile */
      .pl-modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 99px;
        background: rgba(255, 255, 255, 0.12);
        margin: 10px auto 0;
        flex-shrink: 0;
      }

      .pl-modal-head {
        padding: 14px 16px;
      }

      .pl-modal-body {
        padding: 14px 12px 28px;
      }

      .pl-modal-title {
        font-size: 0.92rem;
      }

      .pl-topic-content-title {
        font-size: 1.12rem;
      }

      .pl-code-block pre {
        font-size: 0.78rem;
        padding: 14px;
      }

      .pl-mark-done-wrap {
        flex-direction: column;
        align-items: stretch;
      }

      .pl-mark-done-btn {
        justify-content: center;
        width: 100%;
        padding: 13px 24px;
      }

      .pl-try-skill-btn {
        justify-content: center;
        width: 100%;
        padding: 13px 24px;
      }

      .pl-topic-nav-btn {
        padding: 10px 14px;
        font-size: 12.5px;
      }

      .pl-grid-section {
        padding-bottom: 72px;
      }

      /* Topic list — mobile: text wraps fully, no translateX overflow */
      .pl-topic-list {
        gap: 7px;
      }

      .pl-topic-row {
        padding: 12px 12px 12px 14px;
        gap: 10px;
        border-radius: 12px;
        transform: none !important;
      }

      .pl-topic-row:hover {
        transform: none !important;
      }

      .pl-topic-num {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 11px;
        border-radius: 8px;
        margin-top: 2px;
      }

      .pl-topic-row-title {
        font-size: 0.87rem;
        line-height: 1.38;
      }

      .pl-topic-row-summary {
        font-size: 11.5px;
        line-height: 1.45;
      }

      .pl-topic-row-arrow {
        font-size: 10px;
        margin-top: 7px;
      }
    }

    @media (max-width: 400px) {
      .pl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
      }

      .pl-hero-stats {
        width: 100%;
      }

      .pl-card {
        padding: 14px;
        min-height: 170px;
      }

      .pl-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        margin-bottom: 12px;
      }

      .pl-card-name {
        font-size: 0.9rem;
      }
    }

    @media (min-width: 1200px) {
      .pl-grid {
        grid-template-columns: repeat(4, 1fr);
      }
    }

    /* ══════════════════════════════════════════
           TOAST
        ══════════════════════════════════════════ */
    .pl-toast {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%) translateY(12px);
      background: #10131e;
      border: 1px solid rgba(108, 99, 255, 0.3);
      border-radius: 14px;
      padding: 12px 20px;
      font-size: 13.5px;
      font-weight: 500;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 10px;
      box-shadow: 0 16px 48px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
      z-index: 1200;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.24s ease, transform 0.24s var(--ease);
      max-width: min(92vw, 400px);
      font-family: var(--font);
    }

    .pl-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
      pointer-events: auto;
    }

    .pl-toast i.success {
      color: var(--success);
    }

    .pl-toast i.info {
      color: var(--teal);
    }

    .pl-toast i.error {
      color: var(--error);
    }

    /* ══════════════════════════════════════════
           CONTINUE LEARNING + DASHBOARD
        ══════════════════════════════════════════ */
    .pl-status-section {
      padding: 0 0 12px;
      display: none;
    }

    .pl-status-section.is-active {
      display: block;
    }

    .pl-status-grid {
      display: grid;
      grid-template-columns: 1.3fr 1fr;
      gap: 20px;
      margin-bottom: 40px;
    }

    @media (max-width: 860px) {
      .pl-status-grid {
        grid-template-columns: 1fr;
      }
    }

    .pl-continue-card {
      background: linear-gradient(160deg, rgba(108, 99, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 100%);
      border: 1px solid var(--border-s);
      border-radius: var(--r);
      padding: 28px;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .pl-continue-card::after {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse 60% 80% at 100% 0%, rgba(108, 99, 255, 0.18), transparent 65%);
      pointer-events: none;
    }

    .pl-continue-eyebrow {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11.5px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      color: var(--teal);
      position: relative;
      z-index: 1;
    }

    .pl-continue-main {
      display: flex;
      align-items: center;
      gap: 18px;
      position: relative;
      z-index: 1;
    }

    .pl-continue-icon {
      width: 54px;
      height: 54px;
      border-radius: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.4rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--continue-accent, var(--indigo));
      flex-shrink: 0;
    }

    .pl-continue-lang {
      font-size: 1.2rem;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
    }

    .pl-continue-topic {
      font-size: 0.86rem;
      color: var(--text-2);
      margin-top: 2px;
    }

    .pl-continue-meta {
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
      position: relative;
      z-index: 1;
      font-size: 0.8rem;
      color: var(--text-3);
    }

    .pl-continue-meta span {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .pl-continue-bar-wrap {
      height: 6px;
      border-radius: 99px;
      background: rgba(255, 255, 255, 0.06);
      overflow: hidden;
      position: relative;
      z-index: 1;
    }

    .pl-continue-bar-fill {
      height: 100%;
      border-radius: 99px;
      background: var(--grad-teal);
      transition: width 0.7s var(--ease);
    }

    .pl-continue-btn {
      align-self: flex-start;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 11px 22px;
      border-radius: var(--r-sm);
      background: var(--grad);
      color: #fff;
      font-weight: 700;
      font-size: 0.88rem;
      border: none;
      cursor: pointer;
      transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
      position: relative;
      z-index: 1;
      text-decoration: none;
    }

    .pl-continue-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 28px rgba(108, 99, 255, 0.35);
    }

    .pl-dash-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .pl-dash-top {
      display: flex;
      align-items: center;
      gap: 18px;
    }

    .pl-dash-ring {
      width: 76px;
      height: 76px;
      border-radius: 50%;
      flex-shrink: 0;
      background: conic-gradient(var(--indigo) calc(var(--pct, 0) * 1%), rgba(255, 255, 255, 0.07) 0);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      transition: background 0.8s var(--ease);
    }

    .pl-dash-ring::before {
      content: '';
      position: absolute;
      inset: 7px;
      border-radius: 50%;
      background: var(--bg-panel);
    }

    .pl-dash-ring-val {
      position: relative;
      z-index: 1;
      font-family: var(--mono);
      font-weight: 800;
      font-size: 1.02rem;
      color: var(--text);
    }

    .pl-dash-stats {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .pl-dash-stats-title {
      font-size: 0.95rem;
      font-weight: 700;
      color: var(--text);
    }

    .pl-dash-stats-sub {
      font-size: 0.78rem;
      color: var(--text-3);
    }

    .pl-dash-mini {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }

    .pl-dash-mini-item {
      text-align: center;
      padding: 10px 6px;
      border-radius: var(--r-xs);
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
    }

    .pl-dash-mini-val {
      font-family: var(--mono);
      font-weight: 800;
      font-size: 1.02rem;
      color: var(--text);
    }

    .pl-dash-mini-label {
      font-size: 10px;
      color: var(--text-3);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-top: 2px;
    }

    .pl-ach-row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .pl-ach-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 7px 13px;
      border-radius: 99px;
      font-size: 0.78rem;
      font-weight: 700;
      background: rgba(0, 212, 170, 0.1);
      border: 1px solid rgba(0, 212, 170, 0.22);
      color: var(--success);
    }

    .pl-ach-badge.locked {
      background: rgba(255, 255, 255, 0.03);
      border-color: var(--border);
      color: var(--text-3);
      opacity: 0.6;
    }

    /* ══════════════════════════════════════════
           SEARCH & FILTER BAR
        ══════════════════════════════════════════ */
    .pl-filter-bar {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 24px;
    }

    .pl-search-wrap {
      position: relative;
      flex: 1 1 240px;
      min-width: 220px;
    }

    .pl-search-wrap i {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-3);
      font-size: 0.85rem;
    }

    .pl-search-input {
      width: 100%;
      padding: 12px 16px 12px 40px;
      border-radius: var(--r-sm);
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.88rem;
      font-family: var(--font);
      outline: none;
      transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
    }

    .pl-search-input::placeholder {
      color: var(--text-3);
    }

    .pl-search-input:focus {
      border-color: var(--border-h);
      background: var(--surface-h);
    }

    .pl-filter-chips {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .pl-filter-chip {
      padding: 9px 16px;
      border-radius: 99px;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-2);
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all var(--t-fast) var(--ease);
      white-space: nowrap;
      user-select: none;
    }

    .pl-filter-chip:hover {
      border-color: var(--border-s);
      color: var(--text);
    }

    .pl-filter-chip.active {
      background: var(--indigo-dim);
      border-color: var(--border-h);
      color: var(--text);
    }

    .pl-grid .pl-card[data-hidden="true"] {
      display: none;
    }

    /* ══════════════════════════════════════════
           APP-SHELL (sidebar + main lesson pane)
        ══════════════════════════════════════════ */
    .pl-modal.pl-modal--app {
      max-width: 1180px;
      max-height: min(92vh, 920px);
      width: 100%;
    }

    .pl-modal-body.pl-modal-body--app {
      padding: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .pl-lang-switch {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 12px 18px;
      border-bottom: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.014);
      flex-shrink: 0;
      scrollbar-width: none;
    }

    .pl-lang-switch::-webkit-scrollbar {
      display: none;
    }

    .pl-lang-pill {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 7px 13px;
      border-radius: 99px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text-2);
      font-size: 12.5px;
      font-weight: 700;
      white-space: nowrap;
      cursor: pointer;
      transition: all var(--t-fast) var(--ease);
      flex-shrink: 0;
    }

    .pl-lang-pill i {
      font-size: 13px;
    }

    .pl-lang-pill:hover {
      border-color: var(--border-s);
      background: var(--surface-h);
      color: var(--text);
      transform: translateY(-1px);
    }

    .pl-lang-pill.active {
      background: var(--pill-accent, var(--indigo-dim));
      border-color: var(--pill-accent, var(--border-h));
      color: var(--text);
      box-shadow: 0 0 0 1px var(--pill-accent, transparent) inset;
    }

    .pl-lang-pill.active i {
      color: var(--pill-accent, var(--indigo));
    }

    .pl-appshell-body {
      flex: 1;
      display: flex;
      min-height: 0;
      overflow: hidden;
      position: relative;
    }

    .pl-sidebar {
      width: 270px;
      flex-shrink: 0;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      background: rgba(255, 255, 255, 0.012);
      overflow: hidden;
    }

    .pl-sidebar-search {
      padding: 14px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .pl-sidebar-search i {
      color: var(--text-3);
      font-size: 12px;
    }

    .pl-sidebar-search input {
      width: 100%;
      box-sizing: border-box;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r-xs);
      padding: 9px 12px;
      color: var(--text);
      font-size: 12.5px;
      font-family: inherit;
    }

    .pl-sidebar-search input:focus {
      outline: none;
      border-color: var(--border-h);
    }

    .pl-sidebar-list {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
      -webkit-overflow-scrolling: touch;
    }

    .pl-sidebar-list::-webkit-scrollbar {
      width: 5px;
    }

    .pl-sidebar-list::-webkit-scrollbar-thumb {
      background: rgba(108, 99, 255, 0.3);
      border-radius: 99px;
    }

    .pl-sidebar-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      text-align: left;
      padding: 9px 10px;
      border-radius: 10px;
      border: none;
      background: transparent;
      color: var(--text-2);
      cursor: pointer;
      font-size: 12.5px;
      font-weight: 600;
      margin-bottom: 2px;
      transition: background 0.15s ease, color 0.15s ease;
      font-family: inherit;
    }

    .pl-sidebar-item:hover {
      background: var(--surface-h);
      color: var(--text);
    }

    .pl-sidebar-item.active {
      background: var(--indigo-dim);
      color: var(--text);
      box-shadow: inset 2px 0 0 var(--modal-accent, var(--indigo));
    }

    .pl-sidebar-num {
      width: 20px;
      height: 20px;
      min-width: 20px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 9.5px;
      font-family: var(--mono);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      color: var(--text-3);
    }

    .pl-sidebar-item.is-done .pl-sidebar-num {
      background: rgba(0, 212, 170, 0.14);
      border-color: rgba(0, 212, 170, 0.3);
      color: var(--success);
    }

    .pl-sidebar-item-title {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .pl-sidebar-empty {
      padding: 20px 14px;
      color: var(--text-3);
      font-size: 12px;
      text-align: center;
    }

    .pl-sidebar-toggle {
      display: none;
      align-items: center;
      gap: 8px;
      background: linear-gradient(160deg, #14172a 0%, #0b0d18 100%);
      border: 1px solid rgba(108, 99, 255, 0.35);
      color: var(--text);
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.01em;
      padding: 8px 16px 8px 8px;
      border-radius: 99px;
      cursor: pointer;
      flex-shrink: 0;
      box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(108, 99, 255, 0.08) inset;
      transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    }

    .pl-sidebar-toggle .pl-sidebar-toggle-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      flex-shrink: 0;
      background: var(--grad-teal);
      color: #04140f;
      font-size: 11px;
    }

    .pl-sidebar-toggle:hover {
      border-color: rgba(108, 99, 255, 0.6);
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(108, 99, 255, 0.16) inset, var(--sh-glow);
    }

    .pl-sidebar-toggle:active {
      transform: scale(0.96);
    }

    .pl-main-pane {
      flex: 1;
      min-width: 0;
      overflow-y: auto;
      padding: 24px 26px 32px;
      -webkit-overflow-scrolling: touch;
    }

    .pl-main-pane::-webkit-scrollbar {
      width: 5px;
    }

    .pl-main-pane::-webkit-scrollbar-thumb {
      background: rgba(108, 99, 255, 0.3);
      border-radius: 99px;
    }

    .pl-overview {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .pl-overview-title {
      font-size: 1.2rem;
      font-weight: 900;
      color: var(--text);
    }

    .pl-overview-desc {
      font-size: 0.88rem;
      color: var(--text-2);
      line-height: 1.65;
    }

    .pl-overview-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 6px;
    }

    /* Semantic content-block cards (notes, mistakes, best practice, etc.) */
    .pl-note-card,
    .pl-mistake-card,
    .pl-practice-card,
    .pl-bestpractice-card,
    .pl-realworld-card,
    .pl-interview-card,
    .pl-related-card {
      border-radius: 14px;
      border: 1px solid var(--border);
      padding: 14px 16px;
      background: var(--surface);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .pl-block-label {
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      display: flex;
      align-items: center;
      gap: 7px;
    }

    .pl-block-body {
      font-size: 0.85rem;
      color: #c4c8d8;
      line-height: 1.65;
    }

    .pl-note-card {
      border-color: rgba(56, 189, 248, 0.25);
      background: rgba(56, 189, 248, 0.045);
    }

    .pl-note-card .pl-block-label {
      color: #38bdf8;
    }

    .pl-mistake-card {
      border-color: rgba(255, 93, 115, 0.25);
      background: rgba(255, 93, 115, 0.045);
    }

    .pl-mistake-card .pl-block-label {
      color: var(--error);
    }

    .pl-bestpractice-card {
      border-color: rgba(0, 212, 170, 0.25);
      background: rgba(0, 212, 170, 0.045);
    }

    .pl-bestpractice-card .pl-block-label {
      color: var(--success);
    }

    .pl-realworld-card {
      border-color: rgba(251, 191, 36, 0.25);
      background: rgba(251, 191, 36, 0.045);
    }

    .pl-realworld-card .pl-block-label {
      color: var(--amber);
    }

    .pl-interview-card {
      border-color: rgba(247, 37, 133, 0.25);
      background: rgba(247, 37, 133, 0.045);
    }

    .pl-interview-card .pl-block-label {
      color: var(--pink);
    }

    .pl-practice-card {
      border-color: rgba(108, 99, 255, 0.25);
      background: rgba(108, 99, 255, 0.045);
    }

    .pl-practice-card .pl-block-label {
      color: var(--indigo);
    }

    .pl-practice-card ol {
      margin: 0;
      padding-left: 18px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .pl-practice-card li {
      font-size: 0.85rem;
      color: #c4c8d8;
      line-height: 1.6;
    }

    /* ══════════════════════════════════════════
           VISUALIZATION BLOCKS
           (flow diagram, comparison table, stat grid,
           timeline, tree diagram, bar chart) — all
           built from plain HTML/CSS so they scale to
           any screen without images or canvas.
        ══════════════════════════════════════════ */
    .pl-viz-card {
      border: 1px solid var(--border);
      border-radius: var(--r-sm);
      background: linear-gradient(160deg, rgba(255, 255, 255, 0.032) 0%, rgba(255, 255, 255, 0.012) 100%);
      padding: 18px 18px 20px;
      margin: 4px 0 4px;
      overflow: hidden;
    }

    .pl-viz-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--text-3);
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 16px;
    }

    .pl-viz-title i {
      color: var(--modal-accent, var(--indigo));
    }

    /* ── Flow diagram ── */
    .pl-flow {
      display: flex;
      align-items: stretch;
      flex-wrap: wrap;
      gap: 10px 0;
    }

    .pl-flow-step {
      flex: 1 1 140px;
      min-width: 120px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r-xs);
      padding: 14px 12px;
      text-align: center;
      position: relative;
    }

    .pl-flow-num {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--modal-accent, var(--indigo));
      color: #060810;
      font-size: 11px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 8px;
    }

    .pl-flow-label {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.4;
    }

    .pl-flow-desc {
      font-size: 0.74rem;
      color: var(--text-2);
      margin-top: 4px;
      line-height: 1.5;
    }

    .pl-flow-arrow {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      color: var(--text-3);
      font-size: 0.85rem;
    }

    @media (max-width: 640px) {
      .pl-flow {
        flex-direction: column;
      }

      .pl-flow-step {
        width: 100%;
        flex: 1 1 auto;
      }

      .pl-flow-arrow {
        width: 100%;
        height: 22px;
        transform: rotate(90deg);
      }
    }

    /* ── Comparison table ── */
    .pl-cmp-scroll {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .pl-cmp-table {
      width: 100%;
      min-width: 420px;
      border-collapse: collapse;
    }

    .pl-cmp-table th,
    .pl-cmp-table td {
      text-align: left;
      padding: 10px 14px;
      font-size: 0.82rem;
      border-bottom: 1px solid var(--border);
      color: #c4c8d8;
      white-space: normal;
    }

    .pl-cmp-table th {
      color: var(--modal-accent, var(--indigo));
      font-weight: 700;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      background: rgba(255, 255, 255, 0.025);
    }

    .pl-cmp-table tbody tr:hover {
      background: rgba(255, 255, 255, 0.025);
    }

    .pl-cmp-table td:first-child,
    .pl-cmp-table th:first-child {
      font-weight: 700;
      color: var(--text);
    }

    @media (max-width: 560px) {
      .pl-cmp-scroll {
        overflow-x: visible;
      }

      .pl-cmp-table {
        min-width: 0;
      }

      .pl-cmp-table thead {
        display: none;
      }

      .pl-cmp-table,
      .pl-cmp-table tbody,
      .pl-cmp-table tr,
      .pl-cmp-table td {
        display: block;
        width: 100%;
      }

      .pl-cmp-table tr {
        border: 1px solid var(--border);
        border-radius: var(--r-xs);
        margin-bottom: 10px;
        padding: 6px 4px;
      }

      .pl-cmp-table td {
        border-bottom: none;
        padding: 6px 10px;
        display: flex;
        justify-content: space-between;
        gap: 12px;
      }

      .pl-cmp-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-3);
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
      }
    }

    /* ── Stat grid ── */
    .pl-stat-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
      gap: 10px;
    }

    .pl-stat-cell {
      background: var(--surface);
      border: 1px solid var(--border);
      border-top: 2px solid var(--stat-c, var(--indigo));
      border-radius: var(--r-xs);
      padding: 14px 10px;
      text-align: center;
    }

    .pl-stat-val {
      font-family: var(--mono);
      font-size: 1.3rem;
      font-weight: 800;
      color: var(--stat-c, var(--indigo));
      line-height: 1.2;
    }

    .pl-stat-label {
      font-size: 0.72rem;
      color: var(--text-2);
      margin-top: 4px;
      line-height: 1.4;
    }

    /* ── Timeline ── */
    .pl-tline {
      display: flex;
      flex-direction: column;
      gap: 4px;
      position: relative;
    }

    .pl-tline-item {
      display: flex;
      gap: 14px;
      padding: 0 0 18px 2px;
      position: relative;
    }

    .pl-tline-item::before {
      content: '';
      position: absolute;
      left: 5px;
      top: 14px;
      bottom: -4px;
      width: 1px;
      background: var(--border);
    }

    .pl-tline-item:last-child::before {
      display: none;
    }

    .pl-tline-dot {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      background: var(--tline-c, var(--indigo));
      flex-shrink: 0;
      margin-top: 3px;
      box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
    }

    .pl-tline-label {
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--text);
    }

    .pl-tline-text {
      font-size: 0.8rem;
      color: var(--text-2);
      line-height: 1.6;
      margin-top: 2px;
    }

    /* ── Tree diagram ── */
    .pl-tree {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
    }

    .pl-tree-root {
      background: var(--modal-accent, var(--indigo));
      color: #060810;
      font-weight: 800;
      font-size: 0.85rem;
      padding: 9px 20px;
      border-radius: 99px;
    }

    .pl-tree-branches {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 10px;
      width: 100%;
    }

    .pl-tree-branch {
      border: 1px solid var(--border);
      border-top: 2px solid var(--branch-c, var(--indigo));
      background: var(--surface);
      border-radius: var(--r-xs);
      padding: 12px;
    }

    .pl-tree-branch-label {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--branch-c, var(--indigo));
      margin-bottom: 6px;
    }

    .pl-tree-leaf-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .pl-tree-leaf-list li {
      font-size: 0.76rem;
      color: var(--text-2);
      padding-left: 12px;
      position: relative;
      line-height: 1.5;
    }

    .pl-tree-leaf-list li::before {
      content: '';
      position: absolute;
      left: 0;
      top: 8px;
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: var(--branch-c, var(--indigo));
    }

    /* ── Bar chart ── */
    .pl-bars {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .pl-bar-row {
      display: grid;
      grid-template-columns: 96px 1fr 56px;
      align-items: center;
      gap: 10px;
    }

    .pl-bar-label {
      font-size: 0.76rem;
      color: var(--text-2);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .pl-bar-track {
      height: 9px;
      border-radius: 99px;
      background: rgba(255, 255, 255, 0.06);
      overflow: hidden;
    }

    .pl-bar-fill {
      height: 100%;
      border-radius: 99px;
      background: var(--bar-c, var(--indigo));
    }

    .pl-bar-val {
      font-family: var(--mono);
      font-size: 0.74rem;
      font-weight: 700;
      color: var(--text);
      text-align: right;
    }

    @media (max-width: 480px) {
      .pl-bar-row {
        grid-template-columns: 78px 1fr 46px;
        gap: 6px;
      }

      .pl-bar-label {
        font-size: 0.7rem;
      }
    }

    .pl-related-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .pl-related-chip {
      padding: 7px 12px;
      border-radius: 99px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text-2);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: inherit;
    }

    .pl-related-chip:hover {
      border-color: var(--border-h);
      color: var(--text);
      background: var(--surface-h);
    }

    /* ══ Live code editor ══ */
    .pl-editor {
      background: #080a10;
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    }

    .pl-editor-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.022);
      flex-wrap: wrap;
      gap: 8px;
    }

    .pl-editor-actions {
      display: flex;
      gap: 6px;
    }

    .pl-editor-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-2);
      font-size: 11.5px;
      font-weight: 700;
      padding: 6px 11px;
      border-radius: var(--r-xs);
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: var(--mono);
    }

    .pl-editor-btn:hover {
      color: var(--text);
      border-color: var(--border-s);
      background: var(--surface-h);
    }

    .pl-editor-btn.run {
      color: #0a0d14;
      background: var(--success);
      border-color: var(--success);
    }

    .pl-editor-btn.run:hover {
      filter: brightness(1.08);
    }

    .pl-editor-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .pl-editor-textarea {
      width: 100%;
      box-sizing: border-box;
      background: transparent;
      border: none;
      resize: vertical;
      color: #dde1f0;
      font-family: var(--mono);
      font-size: 0.83rem;
      line-height: 1.65;
      padding: 18px;
      min-height: 120px;
      display: block;
    }

    .pl-editor-textarea:focus {
      outline: none;
    }

    .pl-console {
      background: #05070c;
      border-top: 1px solid var(--border);
    }

    .pl-console-head {
      padding: 8px 14px;
      font-size: 10.5px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--text-3);
      border-bottom: 1px solid var(--border);
    }

    .pl-console pre {
      margin: 0;
      padding: 14px 18px;
      font-family: var(--mono);
      font-size: 0.8rem;
      line-height: 1.6;
      color: #7ddfc8;
      white-space: pre-wrap;
      word-break: break-word;
      min-height: 20px;
    }

    .pl-console pre.is-error {
      color: #ff9aa8;
    }

    .pl-console-note {
      padding: 0 18px 14px;
      font-size: 11px;
      color: var(--text-3);
      font-style: italic;
    }

    @media (max-width: 860px) {
      .pl-modal.pl-modal--app {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
      }

      .pl-sidebar {
        position: absolute;
        inset: 0 auto 0 0;
        width: 82%;
        max-width: 320px;
        z-index: 20;
        transform: translateX(-104%);
        transition: transform 0.25s var(--ease);
        box-shadow: 20px 0 40px rgba(0, 0, 0, 0.5);
      }

      .pl-sidebar.open {
        transform: translateX(0);
      }

      .pl-sidebar-scrim {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 19;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
      }

      .pl-sidebar-scrim.show {
        opacity: 1;
        pointer-events: auto;
      }

      .pl-sidebar-toggle {
        display: flex;
      }

      .pl-main-pane {
        padding: 18px 16px 28px;
      }
    }


/* ══════════════════════════════════════════════════════
       MOBILE POLISH — extra fixes for a proper mobile vibe
       (kept separate from the rules above so nothing above
       has to be touched; these simply override on small
       screens, in cascade order, using the same variables)
   ══════════════════════════════════════════════════════ */

/* Use the small svh/dvh units where supported so mobile browser
   address-bar show/hide doesn't cause layout jumps. Falls back
   silently on browsers that don't support dvh. */
@supports (height: 100dvh) {
  .pl-modal.pl-modal--app {
    max-height: min(92dvh, 920px);
  }
}

/* ── Filter bar: turn into a clean stacked control on phones,
       chips become a horizontal scroll strip instead of wrapping
       into a messy multi-row block ── */
@media (max-width: 640px) {
  .pl-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pl-search-wrap {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .pl-search-input {
    font-size: 16px;
    /* 16px stops iOS Safari from auto-zooming on focus */
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .pl-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .pl-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .pl-filter-chip {
    flex-shrink: 0;
  }

  /* Hero badge: keep it on one line and readable at narrow widths */
  .pl-hero-badge {
    font-size: 11px;
    padding: 7px 14px;
    text-align: center;
    white-space: normal;
  }

  /* Dashboard mini stats: a little tighter so 3-up never feels cramped */
  .pl-dash-mini {
    gap: 8px;
  }

  .pl-dash-mini-item {
    padding: 8px 4px;
  }

  .pl-dash-mini-val {
    font-size: 0.92rem;
  }

  .pl-dash-mini-label {
    font-size: 9px;
  }

  .pl-continue-card,
  .pl-dash-card {
    padding: 20px;
  }

  .pl-continue-main {
    gap: 14px;
  }

  .pl-continue-icon {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .pl-continue-lang {
    font-size: 1.05rem;
  }

  /* Bigger, thumb-friendly close/back buttons in the modal on touch screens */
  .pl-modal-back,
  .pl-modal-close {
    width: 40px;
    height: 40px;
  }

  /* Language switch pills: comfortable one-hand scrolling row */
  .pl-lang-switch {
    padding: 10px 14px;
  }

  .pl-lang-pill {
    padding: 8px 14px;
  }
}

/* Extra-small phones (iPhone SE / small Android) */
@media (max-width: 380px) {
  .pl-hero-stats {
    width: 100%;
    justify-content: space-between;
  }

  .pl-hero-stat {
    flex: 1;
    padding: 10px 8px;
  }

  .pl-card-name {
    font-size: 0.95rem;
  }

  .pl-card-desc {
    font-size: 0.78rem;
  }
}

/* ── App-shell (lesson sidebar + main pane) on tablets/phones ──
     Fixes the topics toggle button, which previously sat inline
     as a flex child of .pl-appshell-body and squeezed the main
     lesson pane sideways instead of floating over the content. ── */
@media (max-width: 860px) {
  .pl-modal.pl-modal--app {
    height: 100vh;
  }

  @supports (height: 100dvh) {
    .pl-modal.pl-modal--app {
      height: 100dvh;
      max-height: 100dvh;
    }
  }

  .pl-sidebar-toggle {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 14px;
    z-index: 15;
    min-height: 40px;
  }

  /* Extra clearance under the floating "All Topics" pill so it never
     sits on top of the lesson title / dashboard content underneath —
     button occupies ~40px + 14px offset, this leaves a clean gap. */
  .pl-main-pane {
    padding-top: 72px;
  }

  /* Sidebar drawer: on mobile the base desktop background
     (rgba(255,255,255,0.012) — almost fully transparent) was letting
     the lesson content underneath show straight through the drawer,
     which is what looked like an "overlap" glitch. As an overlay it
     needs a solid, opaque panel instead. */
  .pl-sidebar {
    padding-top: env(safe-area-inset-top, 0px);
    background: #0d1020;
    background: linear-gradient(160deg, #101324 0%, #0a0c16 100%);
    border-right: none;
  }

  /* Prev/Next lesson buttons never overflow when both are wide */
  .pl-topic-nav {
    flex-wrap: wrap;
  }

  .pl-topic-nav-btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 120px;
  }
}

/* Respect the home-indicator / notch area for the bottom-sheet modal */
@media (max-width: 640px) {
  .pl-modal:not(.pl-modal--app) {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}