/* ===== GLOBAL SCALING SYSTEM ===== */

/* ===== LANDING NAV ===== */
.landing-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.landing-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 auto;
    padding: 12px 24px;
}

.landing-nav-logo {
    flex-shrink: 0;
}

.landing-nav-logo svg {
    height: 28px;
    width: auto;
    display: block;
}

.landing-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.landing-nav-cta:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: none;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.04);
}

.landing-nav-cta:active {
    transform: scale(0.98);
}

.landing-nav-cta i {
    font-size: 0.72rem;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.landing-nav-cta:hover i {
    transform: translateX(2px);
    opacity: 0.8;
}

/* Landing nav auth button */
.landing-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-auth-wrapper {
    position: relative;
    flex-shrink: 0;
}

.landing-nav-auth {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 40px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
}
.landing-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
}
.landing-avatar i {
    font-size: 11px;
}
.landing-nav-auth:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
}
/* Logged-in: just a circle, no pill, no label */
.landing-nav-auth.logged-in {
    padding: 0;
    border: none;
    background: none;
    gap: 0;
    border-radius: 50%;
}
.landing-nav-auth.logged-in .landing-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}
.landing-nav-auth.logged-in:hover .landing-avatar {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
.landing-nav-auth.logged-in #landingAuthLabel {
    display: none;
}

/* Landing auth dropdown — same as nav but anchored to landing wrapper */
.landing-auth-dropdown {
    right: 0;
    top: calc(100% + 8px);
}

/* Landing search bar (in hero) — Space-style */
.landing-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 32px;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03) 50%, rgba(255,255,255,0.08));
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 0 20px rgba(255,255,255,0.06), 0 0 40px rgba(255,255,255,0.03);
    transition: box-shadow 0.4s ease, background 0.4s ease;
    z-index: 10;
}

.landing-search-wrapper:focus-within {
    background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.12));
    box-shadow: 0 0 0 1px rgba(255,255,255,0.22), 0 0 30px rgba(255,255,255,0.10), 0 0 60px rgba(255,255,255,0.05);
}

.landing-search-input {
    width: 100%;
    padding: 18px 24px 18px 50px;
    font-size: 0.98rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 19px;
    outline: none;
    transition: background 0.3s ease;
    letter-spacing: 0.02em;
}

.landing-search-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-weight: 400;
}

.landing-search-input:focus {
    background: rgba(0, 0, 0, 0.75);
}

.landing-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 1;
    transition: color 0.3s ease;
}

.landing-search-wrapper:focus-within .landing-search-icon {
    color: rgba(255, 255, 255, 0.5);
}

.landing-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(8, 8, 8, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 200;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.6);
    padding: 6px;
}

.landing-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    border-radius: 10px;
    margin-bottom: 2px;
}

.landing-search-result:last-child {
    margin-bottom: 0;
}

.landing-search-result:hover {
    background: rgba(255, 255, 255, 0.05);
}

.landing-search-result-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.landing-search-result-id {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 6px;
}

.landing-search-result-alias {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    margin-left: 8px;
    white-space: nowrap;
}

.landing-search-noresult {
    padding: 20px 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    line-height: 1.5;
}

.landing-search-noresult i {
    display: block;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
}

/* ===== LANDING PAGE OVERLAY ===== */
.landing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: #000000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

.landing-overlay.landing-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.landing-scroll-container {
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Star field canvas — only visible in hero area */
.star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Space game canvas (hero mini-game) */
.space-game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: none;
}
.landing-hero:hover .space-game-canvas {
    cursor: none;
}
.landing-hero .landing-hero-content {
    pointer-events: none;
    z-index: 2;
}
.landing-hero .landing-hero-content * {
    pointer-events: auto;
}

/* Hero */
.landing-hero {
    position: relative;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 40px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    background: radial-gradient(ellipse 80% 50% at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
}

.landing-hero-glow {
    display: none;
}

.landing-hero-content {
    position: relative;
    z-index: 1;
    max-width: 45rem;
    width: 100%;
}

.landing-title {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.1;
    color: #ffffff;
    margin-bottom: 20px;
    letter-spacing: -0.03em;
}

.landing-accent {
    color: rgba(255, 255, 255, 0.45);
}

.landing-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.7;
    margin-bottom: 36px;
    max-width: 30rem;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.01em;
}

.landing-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #000000;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.08);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.landing-cta-btn:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.8);
    color: #000000;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.12);
}

.landing-cta-btn:active {
    transform: scale(0.98);
}

.landing-cta-btn i {
    font-size: 0.75rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.landing-cta-btn:hover i {
    transform: translateX(3px);
    opacity: 0.8;
}

.landing-scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    animation: none;
}

@keyframes landing-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* Hero badge */
.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 28px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.landing-badge i {
    font-size: 0.72rem;
    opacity: 0.5;
}

/* Hero actions (CTA + hint) */
.landing-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.landing-hero-hint {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.1);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ===== Stats Bar ===== */
.landing-stats-bar {
    padding: 0 24px;
    margin-top: -20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.landing-stats-inner {
    max-width: 48.75rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 28px 40px;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.landing-stat {
    flex: 1;
    text-align: center;
    padding: 0 20px;
}

.landing-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.landing-stat-number .stat-accent-blue {
    color: rgba(255, 255, 255, 0.6);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
}

.landing-stat-number .stat-accent-orange {
    color: rgba(255, 255, 255, 0.6);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
}

.landing-stat-number .stat-accent-purple {
    color: rgba(255, 255, 255, 0.6);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
}

.landing-stat-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.01em;
}

.landing-stat-divider {
    width: 1px;
    height: 44px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

/* ===== Floating Pills ===== */
.landing-patterns-section {
    padding: 80px 24px;
    overflow: hidden;
    background: #000000;
    position: relative;
    z-index: 1;
}

.floating-pills-field {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    max-width: 45rem;
    margin: 0 auto;
    padding: 10px 0;
}

.floating-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: default;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.floating-pill:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Color variants */
.pill-blue {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.pill-blue:hover { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

.pill-orange {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.pill-orange:hover { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

.pill-purple {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.pill-purple:hover { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

.pill-green {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.pill-green:hover { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

/* Float animations — removed for cleaner feel. Static pills with hover lift. */
.pill-float-1,
.pill-float-2,
.pill-float-3,
.pill-float-4,
.pill-float-5,
.pill-float-6 { animation: none; }

@keyframes pillFloat1 {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
@keyframes pillFloat2 {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(7px); }
}
@keyframes pillFloat3 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-6px) rotate(0.5deg); }
}
@keyframes pillFloat4 {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(9px); }
}
@keyframes pillFloat5 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-7px) rotate(-0.5deg); }
}
@keyframes pillFloat6 {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}

/* Sections */
.landing-section {
    padding: 72px 24px;
    background: #000000;
    position: relative;
    z-index: 1;
}

.landing-section-alt {
    background: #010101;
}

.landing-section-inner {
    max-width: 56.25rem;
    margin: 0 auto;
}

.landing-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* Inline AlgoFlowz logo inside headings */
.inline-logo {
    display: inline-block;
    height: 1.1em;
    vertical-align: -0.15em;
    margin-left: 4px;
}

.landing-section-desc {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.7;
    margin-bottom: 40px;
}

/* Story card */
.landing-story-card {
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.landing-story-card p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.8;
}

.landing-story-card em {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.landing-story-card strong {
    color: #ffffff;
}

/* ===== Feature sections ===== */
.landing-feature {
    max-width: 66.25rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.landing-feature-reverse {
    direction: rtl;
}

.landing-feature-reverse > * {
    direction: ltr;
}

.landing-feature-text p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.7;
    margin-top: 10px;
}

/* ===== Feature visuals (no window chrome) ===== */

/* --- Tree DFS traversal animation --- */
/*
  Real pre-order DFS on tree [3, 9, 20, 15, 7]:
  Total cycle: 12s — 10 DFS steps + 2s pause before repeat.

  Timeline (each step ~1s):
   0s  — Visit 3   (root lights up blue)
   1s  — Edge 3→9  (edge glows, then node 9 lights blue)
   2s  — 9 done    (9 turns green, edge 3→9 returns/dims)
   3s  — Edge 3→20 (edge glows, then node 20 lights blue)
   4s  — Edge 20→15 (edge glows, then node 15 lights blue)
   5s  — 15 done   (15 turns green, edge 20→15 returns/dims)
   6s  — Edge 20→7  (edge glows, then node 7 lights blue)
   7s  — 7 done    (7 turns green, edge 20→7 returns/dims)
   8s  — 20 done   (20 turns green, edge 3→20 returns/dims)
   9s  — 3 done    (3 turns green — full tree completed)
  10-12s — pause, all reset
*/

.feature-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* --- Edge animations --- */
.dfs-edge { opacity: 0; }

/* Edge 3→9:  glow at 1s (8.3%), dim at 2s (16.6%) */
.dfs-edge-3-9  { animation: dfs-e-3-9  12s ease-in-out infinite; }
@keyframes dfs-e-3-9 {
    0%, 7%     { opacity: 0; stroke: #ffffff; }
    9%, 15%    { opacity: 1; stroke: #ffffff; }
    17%        { opacity: 0.3; stroke: rgba(255,255,255,0.3); }
    22%, 100%  { opacity: 0; }
}

/* Edge 3→20: glow at 3s (25%), dim at 8s (66.6%) */
.dfs-edge-3-20 { animation: dfs-e-3-20 12s ease-in-out infinite; }
@keyframes dfs-e-3-20 {
    0%, 23%    { opacity: 0; stroke: #ffffff; }
    26%, 62%   { opacity: 1; stroke: #ffffff; }
    67%        { opacity: 0.3; stroke: rgba(255,255,255,0.3); }
    72%, 100%  { opacity: 0; }
}

/* Edge 20→15: glow at 4s (33.3%), dim at 5s (41.6%) */
.dfs-edge-20-15 { animation: dfs-e-20-15 12s ease-in-out infinite; }
@keyframes dfs-e-20-15 {
    0%, 31%    { opacity: 0; stroke: #ffffff; }
    34%, 39%   { opacity: 1; stroke: #ffffff; }
    42%        { opacity: 0.3; stroke: rgba(255,255,255,0.3); }
    47%, 100%  { opacity: 0; }
}

/* Edge 20→7: glow at 6s (50%), dim at 7s (58.3%) */
.dfs-edge-20-7 { animation: dfs-e-20-7 12s ease-in-out infinite; }
@keyframes dfs-e-20-7 {
    0%, 48%    { opacity: 0; stroke: #ffffff; }
    51%, 56%   { opacity: 1; stroke: #ffffff; }
    59%        { opacity: 0.3; stroke: rgba(255,255,255,0.3); }
    64%, 100%  { opacity: 0; }
}

/* --- Node (circle) animations --- */

/* Node 3: visit at 0s, done at 9s (75%) */
.dfs-n3 { animation: dfs-c3 12s ease-in-out infinite; }
@keyframes dfs-c3 {
    0%         { fill: #0a0a0a; stroke: #222222; }
    2%         { fill: #1a1a1a; stroke: #ffffff; }
    73%        { fill: #1a1a1a; stroke: #ffffff; }
    76%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    82%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    88%, 100%  { fill: #0a0a0a; stroke: #222222; }
}

/* Node 9: visit at 1s (8.3%), done at 2s (16.6%) */
.dfs-n9 { animation: dfs-c9 12s ease-in-out infinite; }
@keyframes dfs-c9 {
    0%, 7%     { fill: #0a0a0a; stroke: #222222; }
    10%        { fill: #1a1a1a; stroke: #ffffff; }
    15%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    22%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    28%, 100%  { fill: #0a0a0a; stroke: #222222; }
}

/* Node 20: visit at 3s (25%), done at 8s (66.6%) */
.dfs-n20 { animation: dfs-c20 12s ease-in-out infinite; }
@keyframes dfs-c20 {
    0%, 23%    { fill: #0a0a0a; stroke: #222222; }
    26%        { fill: #1a1a1a; stroke: #ffffff; }
    64%        { fill: #1a1a1a; stroke: #ffffff; }
    67%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    73%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    79%, 100%  { fill: #0a0a0a; stroke: #222222; }
}

/* Node 15: visit at 4s (33.3%), done at 5s (41.6%) */
.dfs-n15 { animation: dfs-c15 12s ease-in-out infinite; }
@keyframes dfs-c15 {
    0%, 31%    { fill: #0a0a0a; stroke: #222222; }
    34%        { fill: #1a1a1a; stroke: #ffffff; }
    39%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    45%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    51%, 100%  { fill: #0a0a0a; stroke: #222222; }
}

/* Node 7: visit at 6s (50%), done at 7s (58.3%) */
.dfs-n7 { animation: dfs-c7 12s ease-in-out infinite; }
@keyframes dfs-c7 {
    0%, 48%    { fill: #0a0a0a; stroke: #222222; }
    51%        { fill: #1a1a1a; stroke: #ffffff; }
    56%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    62%        { fill: #1a1a1a; stroke: rgba(255,255,255,0.3); }
    68%, 100%  { fill: #0a0a0a; stroke: #222222; }
}

/* --- Text color animations (mirrors node timing) --- */
.dfs-t3  { animation: dfs-txt3  12s ease-in-out infinite; }
.dfs-t9  { animation: dfs-txt9  12s ease-in-out infinite; }
.dfs-t20 { animation: dfs-txt20 12s ease-in-out infinite; }
.dfs-t15 { animation: dfs-txt15 12s ease-in-out infinite; }
.dfs-t7  { animation: dfs-txt7  12s ease-in-out infinite; }

@keyframes dfs-txt3 {
    0%         { fill: #333333; }
    2%, 82%    { fill: #ffffff; }
    88%, 100%  { fill: #333333; }
}
@keyframes dfs-txt9 {
    0%, 7%     { fill: #333333; }
    10%, 22%   { fill: #ffffff; }
    28%, 100%  { fill: #333333; }
}
@keyframes dfs-txt20 {
    0%, 23%    { fill: #333333; }
    26%, 73%   { fill: #ffffff; }
    79%, 100%  { fill: #333333; }
}
@keyframes dfs-txt15 {
    0%, 31%    { fill: #333333; }
    34%, 45%   { fill: #ffffff; }
    51%, 100%  { fill: #333333; }
}
@keyframes dfs-txt7 {
    0%, 48%    { fill: #333333; }
    51%, 62%   { fill: #ffffff; }
    68%, 100%  { fill: #333333; }
}

/* --- Code block (no window chrome) --- */
.feature-code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 2;
    padding: 24px 20px;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.feature-code-line {
    display: flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.5);
    white-space: pre;
    border-left: 2px solid transparent;
    transition: all 0.3s ease;
}

/* Scanning highlight — moves between lines */
.feature-code-scan {
    animation: code-scan 4s ease-in-out infinite;
}

@keyframes code-scan {
    0%, 20% {
        background: transparent;
        border-left-color: transparent;
        color: rgba(255, 255, 255, 0.5);
    }
    30% {
        background: rgba(255, 255, 255, 0.04);
        border-left-color: #ffffff;
        color: #ffffff;
    }
    50% {
        background: rgba(255, 255, 255, 0.04);
        border-left-color: #ffffff;
        color: #ffffff;
    }
    65%, 100% {
        background: transparent;
        border-left-color: transparent;
        color: rgba(255, 255, 255, 0.5);
    }
}

.fcode-ln {
    color: rgba(255, 255, 255, 0.1);
    margin-right: 18px;
    user-select: none;
    min-width: 16px;
    text-align: right;
    font-size: 0.7rem;
}

.fcode-kw { color: rgba(255, 255, 255, 0.6); }
.fcode-fn { color: rgba(255, 255, 255, 0.8); }
.fcode-num { color: rgba(255, 255, 255, 0.4); }

/* --- Stack frames — real LIFO push/pop behavior --- */
/*
  10s cycle. Frames are listed top-to-bottom in HTML (top of stack first).
  Push order: f1 (bottom) → f2 → f3 (top)
  Pop order:  f3 (top) → f2 → f1 (bottom)

  Timeline:
   0s   — empty
   1s   — push f1 (maxDepth(3))       — slides up from bottom
   2.5s — push f2 (maxDepth(20))      — slides up on top of f1
   4s   — push f3 (maxDepth(15))      — slides up on top of f2
   5.5s — pop  f3                     — slides out upward + fades
   6.5s — pop  f2                     — slides out upward + fades
   7.5s — pop  f1                     — slides out upward + fades
   8-10s — empty pause, repeat
*/

.feature-stack {
    padding: 0;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    overflow: hidden;
}

.feature-stack-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    margin: 0;
}

.feature-stack-frames {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 140px;
    justify-content: flex-end;
}

.feature-stack-frame {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    opacity: 0;
    transform: translateY(20px);
}

.feature-stack-frame:last-child {
    border-bottom: none;
}

.feature-stack-fn {
    color: rgba(255, 255, 255, 0.8);
}

.feature-stack-meta {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.65rem;
    font-weight: 600;
}

/* Frame 1 (bottom): push at 5%, pop at 70% */
.stk-f1 { animation: stk-push-f1 6s ease-in-out infinite; }
@keyframes stk-push-f1 {
    0%, 3%   { opacity: 0; transform: translateY(20px); background: rgba(255,255,255,0.02); }
    8%       { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.06); }
    16%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    68%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    73%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.04); }
    80%      { opacity: 0; transform: translateY(-14px); }
    100%     { opacity: 0; transform: translateY(20px); }
}

/* Frame 2 (middle): push at 18%, pop at 60% */
.stk-f2 { animation: stk-push-f2 6s ease-in-out infinite; }
@keyframes stk-push-f2 {
    0%, 15%  { opacity: 0; transform: translateY(20px); background: rgba(255,255,255,0.02); }
    20%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.06); }
    28%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    56%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    61%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.04); }
    68%      { opacity: 0; transform: translateY(-14px); }
    100%     { opacity: 0; transform: translateY(20px); }
}

/* Frame 3 (top of stack): push at 33%, pop at 48% */
.stk-f3 { animation: stk-push-f3 6s ease-in-out infinite; }
@keyframes stk-push-f3 {
    0%, 30%  { opacity: 0; transform: translateY(20px); background: rgba(255,255,255,0.02); }
    35%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.06); }
    42%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    46%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.02); }
    50%      { opacity: 1; transform: translateY(0); background: rgba(255,255,255,0.04); }
    56%      { opacity: 0; transform: translateY(-14px); }
    100%     { opacity: 0; transform: translateY(20px); }
}

/* ===== Scroll reveal animation ===== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Workflow Timeline ===== */
.landing-section-desc {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.7;
}

.landing-timeline {
    position: relative;
    max-width: 540px;
    margin: 0 auto;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Vertical track line — hidden, no longer needed */
.timeline-track {
    display: none;
}

.timeline-item {
    position: relative;
    padding: 0;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Dot — hidden */
.timeline-dot {
    display: none;
}

.timeline-dot-blue {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

.timeline-dot-orange {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

.timeline-content {
    padding: 18px 22px;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    transition: border-color 0.3s ease;
}

.timeline-item:hover .timeline-content {
    border-color: rgba(255, 255, 255, 0.15);
    background: transparent;
}

.timeline-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    opacity: 0.4;
    display: none;
    margin-bottom: 8px;
}

.timeline-item:nth-child(odd) .timeline-num {
    color: #525252;
}

.timeline-item:nth-child(even) .timeline-num {
    color: #525252;
}

.timeline-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.4;
}

.timeline-content p {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.65;
}

/* ── Landing: Notes mockup (mirrors actual app UI) ── */
.feature-notes-mock {
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

/* ─ Header ─ */
.fnote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}
.fnote-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fnote-back-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.3);
}
.fnote-icon {
    font-size: 13px;
}
.fnote-title {
    font-size: 0.82em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
}
.fnote-header-right {
    display: flex;
    align-items: center;
}
.fnote-saved {
    font-size: 0.68em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ─ Toolbar ─ */
.fnote-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 7px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}
.fnote-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}
.fnote-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: none;
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
    font-family: inherit;
    cursor: default;
    padding: 0;
}
.fnote-tool-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.04);
    margin: 0 5px;
}
.fnote-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid transparent;
}
.fnote-color-dot.fnote-color-selected {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}
.fnote-stroke-dot {
    display: inline-block;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 3px;
}
.fnote-stroke-dot.fnote-stroke-active {
    background: rgba(255, 255, 255, 0.5);
}
.fnote-tool.fnote-tool-active {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
}
.fnote-size-label {
    font-size: 0.64em;
    color: rgba(255, 255, 255, 0.2);
    padding: 3px 5px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    margin: 0 2px;
}

/* ─ Editor body ─ */
.fnote-editor-body {
    min-height: 220px;
    padding: 22px 24px;
    position: relative;
}
.fnote-wb-body {
    min-height: 260px;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.fnote-wb-canvas {
    width: 100%;
    flex: 1;
    display: block;
    padding: 8px;
}
.fnote-wb-notes {
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.fnote-wb-notes .fnote-text {
    margin: 0;
    font-size: 0.82em;
}
.fnote-text {
    font-size: 0.88em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin: 0 0 12px;
}
.fnote-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 5px;
    border-radius: 4px;
}
.fnote-cursor {
    width: 2px;
    height: 18px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
    animation: fnoteBlink 1s ease-in-out infinite;
}
@keyframes fnoteBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ─ Footer ─ */
.fnote-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.66em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 0.3px;
}

/* Bottom CTA */
.landing-section-cta {
    padding: 80px 24px 100px;
    background: #000000;
    position: relative;
    z-index: 1;
}

.landing-cta-heading {
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.landing-cta-bottom {
    margin-top: 8px;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: none;
}

.landing-cta-bottom:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: none;
}

/* Footer */
.landing-footer {
    padding: 32px 24px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
    background: #000000;
    position: relative;
    z-index: 1;
}

.landing-footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.landing-footer-text {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.15);
}

.landing-footer-sep {
    color: rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
}

.landing-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    transition: color 0.2s ease;
}

.landing-footer-link:hover {
    color: rgba(255, 255, 255, 0.4);
}

.landing-footer-link i {
    font-size: 0.9rem;
}

/* ===== LANDING PAGE RESPONSIVE ===== */
@media (max-width: 768px) {
    .landing-nav-inner {
        padding: 10px 16px;
    }

    .landing-nav-logo svg {
        height: 28px;
    }

    .landing-nav-auth {
        padding: 4px 10px 4px 4px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .landing-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .landing-nav-auth.logged-in .landing-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .landing-nav-cta {
        padding: 5px 12px;
        font-size: 0.75rem;
    }

    .landing-search-wrapper {
        max-width: 100%;
        border-radius: 14px;
    }

    .landing-search-input {
        font-size: 0.9rem;
        padding: 14px 16px 14px 40px;
        border-radius: 13px;
    }

    .landing-search-icon {
        font-size: 0.82rem;
        left: 14px;
    }

    .landing-title {
        font-size: 2.2rem;
    }

    .landing-subtitle {
        font-size: 1rem;
    }

    .landing-badge {
        font-size: 0.75rem;
        padding: 6px 14px;
        margin-bottom: 20px;
    }

    .landing-stats-inner {
        flex-direction: column;
        gap: 20px;
        padding: 24px 20px;
    }

    .landing-stat-divider {
        width: 60px;
        height: 1px;
    }

    .landing-stat {
        padding: 0;
    }

    .landing-stat-number {
        font-size: 1.7rem;
    }

    .landing-patterns-section {
        padding: 50px 16px;
    }

    .floating-pills-field {
        gap: 10px;
        max-width: 100%;
    }

    .floating-pill {
        padding: 8px 16px;
        font-size: 0.78rem;
    }

    .landing-feature {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .landing-feature-reverse {
        direction: ltr;
    }

    .landing-section {
        padding: 60px 16px;
    }

    .landing-section-title {
        font-size: 1.5rem;
    }

    .landing-story-card {
        padding: 24px;
    }

    .landing-timeline {
        padding-left: 0;
    }

    .timeline-dot {
        display: none;
    }

    .timeline-content {
        padding: 16px 18px;
    }

    .landing-cta-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .landing-cta-heading {
        font-size: 1.6rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .landing-feature {
        gap: 40px;
    }
}

/* Responsive typography base */
html {
    font-size: clamp(13px, 1vw, 20px);
}

/* Fix 100vh browser bugs */
body {
    min-height: 100vh;
    overflow: hidden;
}

:root {
    --bg-main: #000000;
    --bg-card: #0a0a0a;
    --bg-card-light: #141414;
    --text-primary: #e8e8e8;
    --text-secondary: #707070;
    --text-muted: #3a3a3a;
    --accent-blue: #4b8be0;
    --accent-orange: #e0852e;
    --accent-purple: #8878c2;
    --accent-green: #2da67a;
    --accent-red: #d45454;
    --accent-yellow: #d4922a;
    --accent-cyan: #2a9eb5;
    --bm-gold: #d4a82a;
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.10);

    /* FIXED NODE SIZE inside tree-canvas */
    --node-size: 48px;

    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: none;
    --shadow-xl: none;
}

/* Theme toggle — hidden for v1 */
.theme-toggle {
    display: none;
}


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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Global Navigation */
.global-nav {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    padding: 11px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    gap: 12px;
    width: 100%;
    max-width: 100vw;
    flex-shrink: 0;
    overflow: visible;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1 1 0%;
    overflow: visible;
}

.logo {
    display: flex;
    align-items: center;
    user-select: none;
    flex-shrink: 0;
}

.logo-svg {
    height: 28px;
    width: auto;
}

/* Keep for fallback but not used with SVG logo */
.logo-text, .logo-highlight, .logo-icon {
    display: none;
}

/* Inspired-by attribution badge (in global nav) */
.inspired-by-badge {
    display: flex;
    align-items: center;
}
.inspired-by-badge a {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    padding: 5px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.1px;
}
.inspired-by-badge a:hover {
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.problem-selector, .algorithm-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
}

/* Hide nav-bar algorithm selector on desktop — it's now in the action bar */
@media screen and (min-width: 769px) {
    .nav-right .algorithm-selector {
        display: none;
    }
}

.algorithm-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.modern-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 27px 0 11px;
    height: 34px;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 9px;
    font-weight: 500;
    min-width: 147px;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 11px;
}

.modern-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    overflow: visible;
}

.control-hint {
    display: none;
}

.nav-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.nav-home-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.nav-home-btn:active {
    transform: translateY(0);
}

/* Problem prev/next navigation group */
.problem-nav-group {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.problem-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 34px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.problem-nav-btn:first-child {
    border-radius: 7px 0 0 7px;
    border-right: none;
}

.problem-nav-btn:last-child {
    border-radius: 0 7px 7px 0;
    border-left: none;
}

.problem-nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.problem-nav-btn:hover + #problemListBtn,
#problemListBtn:has(+ .problem-nav-btn:hover) {
    border-color: rgba(255, 255, 255, 0.15);
}

.problem-nav-btn:active {
    transform: scale(0.95);
}

.problem-nav-group #problemListBtn {
    border-radius: 0 !important;
    min-width: 0;
    flex-shrink: 1;
    flex-grow: 0;
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action Bar — controls strip between viz and console */
.action-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

/* Algo pill inside action-bar (desktop) */
.algo-pill {
    display: flex;
    align-items: center;
    margin-right: 6px;
    padding-right: 8px;
    border-right: 1px solid var(--border);
}
.algo-pill .algo-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
}
.algo-pill .algo-select:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}
.algo-pill .algo-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}
@media screen and (max-width: 768px) {
    .algo-pill { display: none; }
}

/* Testcase pill inside action-bar */
.testcase-pill {
    display: flex;
    align-items: center;
    margin-right: 6px;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.10);
}

.testcase-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 600;
    padding: 5px 24px 5px 9px;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.testcase-select:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.testcase-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

/* Mobile testcase selector (inside viz module) */
.mobile-testcase-selector {
    display: none;
}

.viz-module {
    position: relative;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.control-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    background: none;
    color: var(--text-secondary);
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.control-btn span {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
}

.control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.control-btn:hover:not(:disabled) span {
    color: var(--text-primary);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.control-btn.primary {
    color: var(--text-primary);
}

.control-btn.primary span {
    color: var(--text-primary);
}

.control-btn.primary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.control-btn.secondary {
    color: var(--text-secondary);
}

/* Speed button */
.speed-btn {
    position: relative;
    padding: 6px 8px !important;
    min-width: 36px;
    justify-content: center;
}

.speed-btn .speed-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: -0.3px;
    line-height: 1;
}

.speed-btn:hover .speed-label {
    color: var(--text-primary);
}

/* YouTube btn in nav bar — icon-only button */
.youtube-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.youtube-link:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 11px;
    padding: 5px 11px;
    background: var(--bg-card);
    border-radius: 5px;
}

.speed-control span {
    font-size: 9px;
    color: var(--text-secondary);
}

.speed-select {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 3px 5px;
    border-radius: 4px;
    font-size: 9px;
}

.step-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.step-progress {
    width: 134px;
}

.progress-bar {
    height: 5px;
    background: var(--bg-card-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    width: 5%;
    transition: width 0.3s ease;
}

.step-counter {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.step-label {
    font-size: 7px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.step-numbers {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Python Syntax Highlighting (desaturated, IDE-like) ===== */
.syn-kw      { color: #b49adb; }              /* muted purple — keywords */
.syn-fn      { color: #7baed6; }              /* muted blue — function names */
.syn-builtin { color: #6cb8c4; }              /* muted teal — built-in functions */
.syn-str     { color: #7dc4a0; }              /* muted green — strings */
.syn-num     { color: #d4a373; }              /* muted warm — numbers */
.syn-comment { color: #5a6577; font-style: italic; } /* gray — comments */
.syn-self    { color: #c88da8; }              /* muted rose — self/cls */

/* Layout Grid */
.app-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 26%)
        1fr
        minmax(0, 22%);
    flex-grow: 1;
    background: var(--border);
    gap: 1px;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    z-index: 10;
}


/* Hide right panel for array problems */
.app-layout.hide-right-panel {
    grid-template-columns: 26% 1fr !important;
}
.app-layout.hide-right-panel .stack-module {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    visibility: hidden !important;
}

/* Hide code panel (collapsible) */
.app-layout.hide-code-panel {
    grid-template-columns: 0px 1fr 22%;
}
.app-layout.hide-code-panel .code-module {
    overflow: hidden !important;
    min-width: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}
.app-layout.hide-code-panel.hide-right-panel {
    grid-template-columns: 0px 1fr !important;
}

/* Module Styles */
.module {
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.module-header {
    padding: 10px 13px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.language-badge, .depth-badge {
    font-size: 8px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 13px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.tree-info {
    font-size: 9px;
    color: var(--text-secondary);
}

/* Code Module */
.code-viewport {
    flex-grow: 1;
    padding: 12px 8px;
    overflow-y: auto;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    line-height: 1.5;
    background: var(--bg-main);
    min-width: 0;
}

.line {
    padding: 3px 10px;
    margin: 1px 0;
    border-radius: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
    border-left: 2px solid transparent;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    white-space: pre;
    word-break: normal;
}

.line.active {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: none;
}

.line.base-hit {
    background: rgba(224, 133, 46, 0.06);
    border-left-color: #e0852e;
    color: var(--text-primary);
}

/* Indentation is handled by the whitespace in the code strings themselves (white-space: pre) */

.code-info {
    padding: 11px 13px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.complexity-info {
    display: flex;
    gap: 16px;
}

.complexity-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.complexity-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.complexity-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Code Toggle Button ===== */
.code-toggle-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 28px;
    height: 52px;
    padding: 0;
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    transition: all 0.2s ease;
    font-size: 10px;
    box-shadow: none;
}
.code-toggle-btn .toggle-label {
    font-size: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 1.5px;
    font-weight: 700;
}
.code-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    width: 32px;
    box-shadow: none;
}
.code-toggle-btn i {
    font-size: 10px;
    transition: transform 0.3s;
}
.app-layout.hide-code-panel .code-toggle-btn i {
    transform: rotate(180deg);
}

/* ===== Stack Toggle Button ===== */
.stack-toggle-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 28px;
    height: 52px;
    padding: 0;
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    transition: all 0.2s ease;
    font-size: 10px;
    box-shadow: none;
}
.stack-toggle-btn .toggle-label {
    font-size: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 1.5px;
    font-weight: 700;
}
.stack-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    width: 32px;
    box-shadow: none;
}
.stack-toggle-btn i {
    font-size: 10px;
    transition: transform 0.3s;
}
.stack-toggle-btn.collapsed i {
    transform: rotate(180deg);
}

/* ===== Mobile Algorithm Selector (hidden on desktop) ===== */
.mobile-algo-selector {
    display: none;
}

/* ===== Mobile More Button + Popover (hidden on desktop) ===== */
.mobile-more-btn {
    display: none;
}
.mobile-more-popover {
    display: none;
}

/* Visualization Module */
.render-engine {
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000000;
    overflow: hidden;
    z-index: 5;
}

/* Coming Soon overlay for problems still being animated */
.coming-soon-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: rgba(0, 0, 0, 0.90);
    backdrop-filter: blur(6px);
}

.coming-soon-inner {
    text-align: center;
    max-width: 340px;
    padding: 32px 24px;
}

.coming-soon-icon {
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
    opacity: 0.7;
}

.coming-soon-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    margin: 0 0 10px;
}

.coming-soon-text {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary, #9a9a9a);
    margin: 0;
}

/* Disabled play controls (greyed out for coming-soon problems) */
.action-bar.controls-disabled .control-btn,
.action-bar.controls-disabled .algo-select,
.action-bar.controls-disabled .testcase-select {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== Tree Canvas (fixed 800×600 coordinate space) ===== */
.tree-canvas {
    position: absolute;
    width: 800px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    /* transform is set dynamically by JS: translate(-50%, -50%) scale(fitScale) */
}

.nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 800px;
    height: 600px;
    z-index: 10;
}

#svgLines {
    position: absolute;
    top: 0;
    left: 0;
    width: 800px;
    height: 600px;
    pointer-events: none;
    z-index: 15;
}

#svgLines line {
    stroke: var(--border-light);
    stroke-width: 1.5;
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

#svgLines line.active {
    stroke: var(--accent-blue);
    stroke-width: 2.5;
}

#svgLines line.base-hit {
    stroke: #e0852e;
    stroke-width: 2;
}

.tree-edge {
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.tree-edge.edge-active {
    stroke: var(--accent-blue) !important;
    stroke-width: 2.5 !important;
}

.tree-edge.edge-visited {
    stroke: #e0852e !important;
    stroke-width: 2 !important;
}

.tree-edge.edge-base {
    stroke: #e0852e !important;
    stroke-width: 2.5 !important;
}

#svgLines .return-arrow {
    stroke: var(--accent-purple);
    stroke-width: 1.5;
    fill: none;
    marker-end: url(#arrowhead);
    opacity: 0.9;
}

#svgLines .return-val {
    fill: var(--accent-purple);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.node {
    width: var(--node-size);
    height: var(--node-size);
    border-radius: 50%;
    background: #000000;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    z-index: 20;
    transition: border-color 0.25s ease, background 0.25s ease;
    box-shadow: none;
}

.node:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.node.active {
    border-color: var(--accent-blue);
    background: #1a1f2a;
}

.node.visited {
    border-color: #e0852e;
    background: #1f1a16;
}

.node.is-base {
    border-color: #e0852e;
    background: #1f1a16;
}

/* Removed: pulse, celebrate animations — static state changes are cleaner */

/* Queue Visualization */
.queue-container {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: none !important;
    gap: 0;
    align-items: stretch;
    flex-direction: row;
    padding: 0;
    background: none;
    border-radius: 6px;
    border: none;
    min-width: 0;
    max-width: 90%;
    overflow-x: auto;
    z-index: 30;
    backdrop-filter: none;
    box-shadow: none;
}

.queue-container:not(:empty) {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: none;
    box-shadow: none;
    min-width: 134px;
}

.queue-item {
    min-width: 48px;
    height: auto;
    background: transparent;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
    border: none;
    border-right: 1px solid var(--border);
    transition: background 0.15s ease;
    padding: 10px 12px;
    gap: 2px;
    position: relative;
}

.queue-item:last-of-type {
    border-right: none;
}

.queue-item .qi-val {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}
.queue-item .qi-depth {
    font-size: 8px;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1;
}

/* Front of queue — being processed */
.queue-item.queue-front {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--border);
    box-shadow: none;
    transform: none;
    color: var(--accent-blue);
    border-bottom: 2px solid var(--accent-blue);
}
.queue-item.queue-front .qi-depth {
    color: rgba(59, 130, 246, 0.5);
}

.queue-item.current {
    background: rgba(249, 115, 22, 0.06);
    border-color: var(--border);
    border-bottom: 2px solid #f97316;
}

.queue-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0;
    text-transform: none;
    padding: 0 10px;
    display: flex;
    align-items: center;
}
.queue-label.queue-back-label {
    color: var(--text-muted);
    font-weight: 500;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(13px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-label {
    position: absolute;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-primary);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 5;
}

.task-label span {
    padding: 3px 7px;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.task-label span.done {
    background: rgba(249, 115, 22, 0.2);
    border-color: #f97316;
    color: #f97316;
}

.task-label span.active-task {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Removed blink animation — static state is cleaner */

/* Console Panel */
.console-panel {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 5;
}

.console-header {
    padding: 8px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.console-text {
    flex-grow: 1;
    padding: 10px 13px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    overflow-y: auto;
    line-height: 1.5;
    background: var(--bg-main);
}

.console-line {
    margin-bottom: 4px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0;
    border-left: 2px solid var(--border);
}

.console-line.console-answer {
    background: transparent;
    border-left: 2px solid #f97316;
    color: #f97316;
    font-weight: 700;
}

.console-line:last-child {
    margin-bottom: 0;
}

/* Stack Module */
.stack-module {
    background: var(--bg-main);
    position: relative;
    z-index: 5;
}

.stack-controls {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 11px;
    align-items: center;
    font-size: 9px;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stack-info {
    display: flex;
    gap: 11px;
}

.stack-stats-label {
    font-size: 9px;
    color: var(--text-secondary);
}

.stack-stats-label span {
    color: var(--text-primary);
    font-weight: 700;
    margin-left: 3px;
}

/* ===== Stack Stats Bar — compact inline ===== */
.stack-stats-bar {
    display: flex;
    gap: 0;
    padding: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.stack-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 4px;
    background: transparent;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
}

.stack-stat:last-child {
    border-right: none;
}

.stack-stat-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.stack-stat-value {
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.stack-stat-value.active-val {
    color: var(--text-primary);
}

.stack-stat-value.depth-val {
    color: var(--text-primary);
}

.stack-stat-value.max-val {
    color: var(--text-primary);
}

.stack-viewport {
    flex-grow: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.empty-stack {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: 27px 13px;
}

.empty-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.3;
}

.empty-text {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.empty-subtext {
    font-size: 9px;
    color: var(--text-muted);
}

/* Stack items — IDE call-stack style */
.stack-item {
    background: transparent;
    border-radius: 0;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    border-left: 2px solid transparent;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
    animation: none;
    position: relative;
    overflow: hidden;
}

.stack-item::before {
    display: none;
}

.stack-item.active {
    background: rgba(59, 130, 246, 0.06);
    border-left: 2px solid var(--accent-blue);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}

.stack-item.active::before {
    display: none;
}

.stack-item.completed {
    background: transparent;
    border-left: 2px solid #f97316;
    border-bottom: 1px solid var(--border);
    opacity: 0.6;
}

.stack-item.completed::before {
    display: none;
}

.stack-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.stack-function-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.stack-node-value {
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    border-radius: 0;
    font-size: 10px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    border: none;
}

.stack-details {
    display: flex;
    gap: 10px;
    margin-top: 3px;
}

.stack-detail {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
    font-family: 'JetBrains Mono', monospace;
}

.detail-value {
    font-size: 10px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.detail-value.pending {
    color: var(--text-muted);
}

.detail-value.processing {
    color: var(--accent-blue);
}

.detail-value.completed {
    color: #f97316;
}

/* Legend — minimal */
.stack-legend {
    padding: 6px 12px;
    background: transparent;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 8px;
    height: 2px;
    border-radius: 1px;
}

.legend-color.pending {
    background: var(--text-muted);
}

.legend-color.processing {
    background: var(--accent-blue);
}

.legend-color.completed {
    background: #e0852e;
}

.legend-item span {
    font-size: 9px;
    color: var(--text-muted);
}

/* Search Bar */
.search-bar-wrapper {
    position: relative;
    margin: 0;
    height: 34px;
    width: 190px;
    flex-shrink: 1;
    min-width: 120px;
}

.search-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0 27px 0 11px;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 9px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

.search-bar:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.search-bar::placeholder {
    color: var(--text-secondary);
}

.search-bar-wrapper i {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 11px;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 7px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.search-result {
    padding: 8px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 9px;
    color: var(--text-primary);
}

.search-result:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 3px;
}

.search-result-id {
    font-size: 7px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.search-result-alias {
    font-size: 7px;
    color: #ffa116;
    margin-bottom: 2px;
}

/* Problem List Modal - Full Screen */
/* ==================== PROBLEM SELECTION PAGE ==================== */

.problem-page {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: #000000;
    flex-direction: column;
    overflow: hidden;
}

.problem-page.show {
    display: flex;
    animation: pageReveal 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.problem-page-active .global-nav,
body.problem-page-active .app-layout,
body.problem-page-active .controls,
body.problem-page-active .mobile-bottom-nav,
body.problem-page-active .action-bar {
    visibility: hidden;
}

@keyframes pageReveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Problem Page Nav --- */
.problem-page-nav {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    z-index: 10;
}

.problem-page-nav::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, rgba(255, 255, 255, 0.03) 30%, rgba(255, 255, 255, 0.03) 70%, transparent 95%);
}

.problem-page-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.problem-page-logo {
    display: flex;
    align-items: center;
}

.problem-page-nav .problem-page-logo-svg {
    height: 28px;
    width: auto;
    transition: opacity 0.3s;
}

.problem-page-logo:hover .problem-page-logo-svg {
    opacity: 0.8;
}

.problem-page-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.problem-page-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.problem-page-home-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Problem page auth wrapper + dropdown */
.pp-auth-wrapper {
    position: relative;
    flex-shrink: 0;
}
.pp-auth-btn {
    border-radius: 50%;
}
.pp-auth-btn.logged-in {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}
.pp-auth-btn.logged-in:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}
.pp-auth-dropdown {
    right: 0;
    top: calc(100% + 8px);
}

/* --- Page Body (scrollable) --- */
.problem-page-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.problem-page-body::-webkit-scrollbar {
    width: 6px;
}

.problem-page-body::-webkit-scrollbar-track {
    background: transparent;
}

.problem-page-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}

/* --- Hero Section (heading + search + filters) --- */
.problem-page-hero {
    flex-shrink: 0;
    padding: 28px 32px 20px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.problem-page-heading {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.3px;
    line-height: 1.1;
}

.problem-page-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.2);
    margin: 4px 0 0;
    line-height: 1.4;
}

/* Stats strip */
.problem-page-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.problem-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    min-width: 0;
}

.problem-stat-value {
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.problem-stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.2;
}

.problem-stat-value.stat-easy { color: rgba(255, 255, 255, 0.5); }
.problem-stat-value.stat-medium { color: rgba(255, 255, 255, 0.5); }
.problem-stat-value.stat-hard { color: rgba(255, 255, 255, 0.5); }

/* Search bar */
.problem-page-hero .problem-search-bar {
    margin: 18px 0 14px;
}

.problem-search-wrapper {
    position: relative;
}

.problem-search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    transition: color 0.2s;
}

.problem-search-bar input {
    width: 100%;
    padding: 13px 18px 13px 44px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    color: #ffffff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.problem-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.problem-search-bar input:focus {
    border-color: rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.problem-search-wrapper:focus-within .search-icon {
    color: rgba(255, 255, 255, 0.4);
}

/* Filters */
.problem-page-filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-scroll-area {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.filter-scroll-area::-webkit-scrollbar {
    display: none;
}

.filter-scroll-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 10px;
    padding: 0;
}

.filter-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

.filter-scroll-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.filter-options {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    padding-bottom: 2px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-transform: capitalize;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 3px;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

.filter-btn-special {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

.filter-btn-special:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.filter-btn-special.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

/* --- Problem List Grid --- */
.problem-page-grid-wrapper {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 0 32px 120px;
    box-sizing: border-box;
}

.problem-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@media screen and (max-width: 640px) {
    .problem-list {
        gap: 8px;
    }
}

.problem-list::-webkit-scrollbar {
    width: 4px;
}

.problem-list::-webkit-scrollbar-track {
    background: transparent;
}

.problem-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* --- Problem Card --- */
.problem-card {
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.problem-card-inner {
    padding: 12px 16px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.15s ease;
}

.problem-card:hover .problem-card-inner {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.problem-card:active .problem-card-inner {
    background: rgba(255, 255, 255, 0.05);
}

.problem-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.problem-card-number {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: -0.3px;
}

.problem-card-info {
    flex: 1;
    min-width: 0;
}

.problem-card-name {
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.35;
    transition: color 0.15s;
}

.problem-card:hover .problem-card-name {
    color: rgba(255, 255, 255, 0.9);
}

.problem-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.problem-card-tags-inline {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.22);
    font-weight: 400;
    text-transform: capitalize;
}

.problem-card-algo-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
}

.problem-card-inspired {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    font-weight: 400;
}

.problem-card-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.problem-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.15s ease;
}

.problem-card:hover .problem-card-arrow {
    color: rgba(255, 255, 255, 0.35);
}

.problem-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

/* --- Tags --- */
.problem-tag {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.3);
    text-transform: capitalize;
    letter-spacing: 0;
    transition: color 0.15s;
}

.problem-card:hover .problem-tag {
    color: rgba(255, 255, 255, 0.4);
}

.problem-tag::after {
    display: none;
}

/* Per-topic tag colors — now just plain muted text */
.problem-tag.tag-tree,
.problem-tag.tag-recursion,
.problem-tag.tag-dfs,
.problem-tag.tag-bfs,
.problem-tag.tag-array,
.problem-tag.tag-two-pointers,
.problem-tag.tag-stack,
.problem-tag.tag-queue,
.problem-tag.tag-graph,
.problem-tag.blind75,
.problem-tag.interview150 {
    color: rgba(255, 255, 255, 0.3);
    background: transparent;
    border-color: transparent;
}

/* --- Difficulty Badge --- */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 0;
    border-radius: 0;
    text-transform: capitalize;
    letter-spacing: 0;
    background: transparent;
    border: none;
}

.difficulty-badge.difficulty-easy {
    color: rgba(255, 255, 255, 0.35);
    background: transparent;
    border: none;
}

.difficulty-badge.difficulty-medium {
    color: rgba(255, 255, 255, 0.35);
    background: transparent;
    border: none;
}

.difficulty-badge.difficulty-hard {
    color: rgba(255, 255, 255, 0.35);
    background: transparent;
    border: none;
}

.difficulty-badge::after {
    display: none;
}

/* --- Empty State --- */
.problem-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 8px;
}

.problem-empty-state .empty-icon {
    margin-bottom: 12px;
    opacity: 0.5;
}

.problem-empty-state p {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

.problem-empty-state span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.2);
}

/* ==================== END PROBLEM SELECTION PAGE ==================== */

/* YouTube Modal - Side Panel (nav stays visible) */
.youtube-modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.youtube-modal.show {
    display: block;
    opacity: 1;
}

.youtube-modal-content {
    background: var(--bg-card);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 46px;
    right: 0;
    width: 380px;
    max-width: 85vw;
    height: calc(100% - 46px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.youtube-modal.show .youtube-modal-content {
    transform: translateX(0);
}

.youtube-modal-header {
    padding: 24px 28px 20px;
    background: transparent;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.youtube-modal-header h3 {
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    letter-spacing: -0.3px;
}

.youtube-modal-header h3 i {
    color: #ff0000;
    font-size: 20px;
}

#youtubeModalClose {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 18px;
}

#youtubeModalClose:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.youtube-modal-body {
    flex-grow: 1;
    padding: 8px 28px 28px;
    overflow-y: auto;
}

.video-section-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 12px 0 4px;
    padding: 0;
}

.video-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.video-card {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    padding: 18px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

.video-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff0000;
    opacity: 0;
    transition: opacity 0.15s;
}

.video-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.video-card:hover::before {
    opacity: 1;
}

.video-card-left {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.video-card-icon {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-card-icon i {
    color: #ff0000;
    font-size: 11px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0 0 8px 0;
}

.video-reason {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
    margin: 0;
}

.video-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.video-tag {
    background: rgba(255, 0, 0, 0.08);
    border: none;
    color: rgba(255, 100, 100, 0.7);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.video-action {
    color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    align-self: center;
}

.video-card:hover .video-action {
    transform: translateX(3px);
    color: #ff0000;
}

/* Keyboard Hint Footer */
.keyboard-hint {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: linear-gradient(180deg, rgba(12, 12, 12, 0.95), rgba(12, 12, 12, 0.98));
    border-top: 1px solid var(--border);
    padding: 9px 16px;
    z-index: 100;
    backdrop-filter: blur(8px);
    contain: layout style paint;
    will-change: transform;
    pointer-events: auto;
    overflow: hidden;
}

.hint-content {
    max-width: 938px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    height: 100%;
    contain: content;
}

.hints-grid {
    display: flex;
    gap: 13px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    contain: content;
}

/* Array Merge Visualization */
.array-container {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 16px;
}

.array-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 24px;
    width: 100%;
    max-width: min(94%, 900px);
    margin: auto;
}

.array-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Compact layout for dual-row array problems (two array-section blocks) */
.array-inner.array-dual {
    gap: 10px;
    padding: 14px;
}
.array-inner.array-dual .array-section {
    gap: 4px;
}
.array-inner.array-dual .array-label {
    font-size: 11px;
    letter-spacing: 0.8px;
}
.array-inner.array-dual .array-visualization {
    padding: 10px 14px;
    min-height: 70px;
    gap: 8px;
    border-radius: 8px;
}
.array-inner.array-dual .array-item {
    width: 48px;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    font-size: 16px;
    border-radius: 8px;
    margin-top: 24px;
    margin-bottom: 20px;
    flex: 1 1 48px; max-width: 48px;
}
.array-inner.array-dual .array-index {
    font-size: 9px;
    bottom: -16px;
}
.array-inner.array-dual .pointer-label {
    font-size: 9px;
    top: -20px;
    padding: 1px 5px;
}
.array-inner.array-dual .pointer-info {
    padding: 10px;
    gap: 10px;
    margin-top: 0;
}
.array-inner.array-dual .pointer-detail-label {
    font-size: 10px;
}
.array-inner.array-dual .pointer-detail-value {
    font-size: 14px;
    padding: 5px 10px;
}

/* ── Compact layout for tall multi-row problems (3+ sections) ── */
/* Reduces vertical space so content fits without scrolling */
.array-inner.array-compact {
    gap: 6px;
    padding: 10px 16px;
}
.array-inner.array-compact .array-section {
    gap: 2px;
}
.array-inner.array-compact .array-label {
    font-size: 10px;
    letter-spacing: 0.6px;
    margin-bottom: 0;
}
.array-inner.array-compact .array-visualization {
    padding: 6px 10px;
    min-height: 50px;
    gap: 6px;
    border-radius: 8px;
}
.array-inner.array-compact .array-item {
    width: 48px;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    font-size: 15px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 16px;
    flex: 1 1 48px;
    max-width: 48px;
}
.array-inner.array-compact .array-index {
    font-size: 8px;
    bottom: -14px;
    padding: 1px 4px;
}
.array-inner.array-compact .pointer-label {
    font-size: 8px;
    top: -16px;
    padding: 1px 5px;
}
.array-inner.array-compact .pointer-info {
    padding: 6px 10px;
    gap: 8px;
    margin-top: 0;
}
.array-inner.array-compact .pointer-detail-label {
    font-size: 9px;
}
.array-inner.array-compact .pointer-detail-value {
    font-size: 13px;
    padding: 4px 8px;
}
.array-inner.array-compact .sum-bridge {
    padding: 4px 10px;
    margin: 0;
}
.array-inner.array-compact .sum-bridge-label {
    font-size: 10px;
}
.array-inner.array-compact .price-chart-viz {
    height: 120px !important;
    min-height: 120px !important;
    padding: 20px 14px 40px !important;
}
.array-inner.array-compact .price-chart-viz .price-bar {
    height: 100% !important;
    min-height: 20px;
}
.array-inner.array-compact .price-chart-viz .price-val {
    font-size: 9px;
}

/* Dense layout for 9+ items on desktop — smaller items so they all fit */
.array-dense .array-item {
    width: 44px;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    font-size: 16px;
    margin-top: 28px;
    margin-bottom: 24px;
    border-radius: 10px;
    flex: 1 1 44px; max-width: 44px;
}
.array-dense .array-visualization {
    gap: 8px;
    padding: 16px;
}
.array-dense .pointer-label {
    font-size: 9px;
    padding: 3px 7px;
    top: -26px;
}
.array-dense .pointer-label-pair { top: -26px; }
.array-dense .array-index {
    font-size: 8px;
    padding: 2px 6px;
    bottom: -22px;
}
.array-dual.array-dense .array-item {
    width: 36px;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    font-size: 14px;
    margin-top: 22px;
    margin-bottom: 18px;
    border-radius: 8px;
    flex: 1 1 36px; max-width: 36px;
}
.array-dual.array-dense .array-visualization {
    gap: 6px;
    padding: 10px 12px;
}
.array-dual.array-dense .pointer-label {
    font-size: 8px;
    padding: 2px 5px;
    top: -20px;
}
.array-dual.array-dense .pointer-label-pair { top: -20px; }
.array-dual.array-dense .array-index {
    font-size: 7px;
    padding: 2px 5px;
    bottom: -16px;
}

.array-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.array-visualization {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: nowrap;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    min-height: 110px;
    overflow: hidden;
}

.array-item {
    position: relative;
    width: 64px;
    min-width: 0;
    height: auto;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 34px;
    margin-bottom: 30px;
    flex: 1 1 64px; max-width: 64px;
    aspect-ratio: 1;
}

.array-item.pointer-1 {
    background: rgba(75, 139, 224, 0.15);
    border-color: var(--accent-blue);
    transform: scale(1.03);
}

.array-item.pointer-2 {
    background: rgba(224, 133, 46, 0.15);
    border-color: var(--accent-orange);
    transform: scale(1.03);
}

.array-item.pointer-merge {
    background: rgba(224, 133, 46, 0.15);
    border-color: var(--accent-orange);
    transform: scale(1.03);
}

/* Green pointer — k (write/placement target) in merge problems */
.array-item.pointer-k {
    background: rgba(45, 166, 122, 0.12);
    border-color: var(--accent-green);
    transform: scale(1.03);
}

/* Battle highlight — when two values are being compared */
.array-item.merge-battle {
    border-color: #c4a630 !important;
}

/* ── Merge Info Bridge (explanation between arrays) ── */
.merge-info-bridge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    margin: 2px 0;
    background: rgba(136, 120, 194, 0.06);
    border: 1.5px solid rgba(136, 120, 194, 0.2);
    border-radius: 8px;
    animation: bridgeFadeIn 0.25s ease;
}
.merge-info-bridge.merge-info-battle {
    background: rgba(196, 166, 48, 0.06);
    border-color: rgba(196, 166, 48, 0.25);
}
.merge-info-bridge.merge-info-done {
    background: rgba(45, 166, 122, 0.06);
    border-color: rgba(45, 166, 122, 0.25);
}
.merge-info-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
}
.merge-info-battle .merge-info-text {
    color: #c4a630;
}
.merge-info-done .merge-info-text {
    color: var(--accent-green);
}

.array-item.pointer-merge-alt {
    background: rgba(212, 84, 84, 0.12);
    border-color: var(--accent-red);
    transform: scale(1.03);
}

/* ── Value-Changed Animation (overwrite / swap / write) ── */
.array-item.val-changed {
    animation: valChanged 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes valChanged {
    0% {
        transform: scale(0.75) translateY(6px);
        opacity: 0.3;
        border-color: var(--accent-green);
        color: var(--accent-green);
    }
    40% {
        transform: scale(1.08);
        opacity: 1;
        border-color: var(--accent-green);
        color: var(--accent-green);
    }
    70% {
        transform: scale(0.97);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Merge Ghost Float Animation ── */
.merge-ghost {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--accent-green);
    animation: ghostFloat var(--ghost-duration, 0.6s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes ghostFloat {
    0% {
        transform: translate(0, 0) scale(1.15);
        opacity: 1;
    }
    20% {
        transform: translate(calc(var(--dx) * 0.15), calc(var(--dy) * 0.3 - 18px)) scale(1.2);
        opacity: 1;
    }
    70% {
        transform: translate(calc(var(--dx) * 0.85), calc(var(--dy) * 0.85)) scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(1);
        opacity: 0;
    }
}

/* Dense layout adjustments for ghost */
.array-dual.array-dense ~ .merge-ghost,
.array-dense .merge-ghost {
    width: 38px;
    height: 38px;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   Problem 4: Remove Element — Enhanced Animations
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Ghost of the Past Value (overwrite dissolve) ── */
.re4-old-val {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: inherit;
    color: var(--accent-orange);
    pointer-events: none;
    z-index: 4;
    animation: re4OldDissolve 0.65s ease forwards;
}

@keyframes re4OldDissolve {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: none;
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1) translateY(-4px);
        filter: blur(1px);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) translateY(-12px);
        filter: blur(3px);
    }
}

/* ── 3. Skip Animation — k freezes, cell pulses ── */

/* Badge goes red & still — "frozen in place" */
.pointer-label.re4-k-frozen {
    border-color: var(--accent-red) !important;
    background: rgba(255, 60, 60, 0.15) !important;
    color: var(--accent-red) !important;
    transition: all 0.3s ease;
}

/* The cell under k gets a ripple pulse — "I'm not moving" */
.array-item.re4-cell-held {
    animation: re4CellHeld 0.6s ease;
}

@keyframes re4CellHeld {
    0% { box-shadow: none; }
    40% { box-shadow: 0 0 0 4px rgba(255, 80, 80, 0.15); }
    100% { box-shadow: none; }
}

/* ── 4. Finished State — kept zone, ghost zone, scissors cut ── */

/* Kept cells: green accent */
.array-item.re4-kept {
    background: rgba(45, 166, 122, 0.1);
    border-color: var(--accent-green);
}

/* Ghost zone: dimmed irrelevant memory */
.array-item.re4-ghost {
    opacity: 0.3;
    filter: grayscale(0.5);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    animation: re4GhostFade 0.5s ease;
}

@keyframes re4GhostFade {
    0% { opacity: 0.8; filter: none; }
    100% { opacity: 0.3; filter: grayscale(0.5); }
}

/* Scissors cut — dashed left border on first ghost cell */
.array-item.re4-cut {
    border-left: 3px dashed var(--accent-red) !important;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    position: relative;
}

.array-item.re4-cut::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    z-index: 5;
    pointer-events: none;
}

/* New Length label */
.re4-newlen-label {
    text-align: center;
    font-size: 0.82em;
    color: var(--text-secondary);
    margin: 6px 0 2px;
    letter-spacing: 0.3px;
}
.re4-newlen-label strong {
    color: var(--accent-green);
}

/* Copy-transport — shows nums[k] = nums[i] copy operation (Problems 4, 5, 6) */

/* The target cell (k) — new value fades in from transparent */
.copy-target-land {
    animation: copyLand var(--copy-duration, 0.4s) cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes copyLand {
    0% {
        color: transparent;
        border-color: rgba(16, 185, 129, 0.3);
        background: rgba(16, 185, 129, 0.04);
    }
    60% {
        color: transparent;
        border-color: var(--accent-green);
        background: rgba(16, 185, 129, 0.1);
    }
    100% {
        color: inherit;
        border-color: var(--accent-green);
        background: rgba(16, 185, 129, 0.12);
    }
}

/* The source cell (i) — brief highlight pulse to show "value read from here" */
.copy-source-pulse {
    animation: copyPulse var(--copy-duration, 0.4s) ease both;
}
@keyframes copyPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    30% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* The travel indicator — small value chip that slides from i → k */
.copy-chip {
    position: absolute;
    z-index: 80;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.15);
    border: 1.5px solid var(--accent-green);
    white-space: nowrap;
    animation: copyChipSlide var(--chip-duration, 0.35s) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    box-shadow: none;
}

@keyframes copyChipSlide {
    0% {
        transform: translate(0, 0) scale(0.85);
        opacity: 0.9;
    }
    20% {
        transform: translate(calc(var(--chip-dx) * 0.1), -4px) scale(1);
        opacity: 1;
    }
    80% {
        transform: translate(calc(var(--chip-dx) * 0.9), -3px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--chip-dx), 0px) scale(0.9);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Problem 7: Boyer-Moore — Battle Arena
   ═══════════════════════════════════════════════════════════════ */

/* ── Arena layout ── */
.bm-arena {
    display: flex;
    justify-content: center;
    margin: 8px 0 14px;
}

.bm-champion-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: 2px solid var(--bm-gold);
    border-radius: 12px;
    background: rgba(212, 168, 42, 0.04);
    min-width: 100px;
    position: relative;
}

.bm-champion-title {
    font-size: 0.78em;
    font-weight: 700;
    color: var(--bm-gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Stack of blocks ── */
.bm-stack-container {
    display: flex;
    flex-direction: column-reverse; /* bottom block first */
    align-items: center;
    gap: 3px;
    min-height: 44px;
    position: relative;
}

.bm-stack-block {
    width: 44px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--bm-gold);
    background: rgba(212, 168, 42, 0.08);
    border: 1.5px solid var(--bm-gold);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.bm-stack-block.bm-victor {
    background: rgba(212, 168, 42, 0.15);
}

@keyframes bmVictorPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1); }
}

.bm-stack-overflow {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
}

.bm-throne-empty {
    width: 44px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: var(--text-muted);
    border: 1.5px dashed var(--border);
    border-radius: 6px;
    font-style: italic;
    white-space: nowrap;
    padding: 0 10px;
}

.bm-count-label {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.bm-count-label strong {
    color: var(--bm-gold);
    font-size: 1.1em;
}

/* ── Array cell battle coloring ── */
.array-item.bm-friendly {
    border-color: var(--accent-green) !important;
}

.array-item.bm-enemy {
    border-color: var(--accent-red) !important;
}

.array-item.bm-victor-cell {
    border-color: var(--bm-gold) !important;
    background: rgba(212, 168, 42, 0.06);
}

/* ── Battle ghost (flies from challenger cell to champion stack) ── */
.bm-battle-ghost {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
}

/* Reinforcement — green, lands on stack */
.bm-ghost-reinforce {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--accent-green);
    animation: bmGhostFly var(--ghost-duration, 0.5s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Clash — red, collides and explodes */
.bm-ghost-clash {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid var(--accent-red);
    animation: bmGhostClash var(--ghost-duration, 0.5s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Coronation — gold, walks to the throne */
.bm-ghost-coronation {
    color: var(--bm-gold);
    background: rgba(251, 191, 36, 0.15);
    border: 2px solid var(--bm-gold);
    animation: bmGhostFly var(--ghost-duration, 0.5s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Fly arc — used by reinforce and coronation */
@keyframes bmGhostFly {
    0% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    30% {
        transform: translate(calc(var(--dx) * 0.25), calc(var(--dy) * 0.35 - 20px)) scale(1.15);
        opacity: 1;
    }
    80% {
        transform: translate(calc(var(--dx) * 0.9), calc(var(--dy) * 0.9)) scale(1.05);
        opacity: 0.85;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(1);
        opacity: 0;
    }
}

/* Clash: fly partway then burst */
@keyframes bmGhostClash {
    0% {
        transform: translate(0, 0) scale(1.1);
        opacity: 1;
    }
    40% {
        transform: translate(calc(var(--dx) * 0.45), calc(var(--dy) * 0.5 - 10px)) scale(1.15);
        opacity: 1;
    }
    60% {
        transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.65)) scale(1.4);
        opacity: 0.9;
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.8), 0 0 60px rgba(251, 191, 36, 0.4);
    }
    100% {
        transform: translate(calc(var(--dx) * 0.65), calc(var(--dy) * 0.7)) scale(0);
        opacity: 0;
        box-shadow: 0 0 0 transparent;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Problem 8: Cycle Array — Segment-Colored Rotation
   ═══════════════════════════════════════════════════════════════ */

/* ── Segment coloring ── */

/* "Stay Back" group — Blue */
.array-item.cy-stay-back {
    border-color: var(--accent-blue) !important;
    background: rgba(59, 130, 246, 0.10);
}

/* "Move Front" group — Orange */
.array-item.cy-move-front {
    border-color: var(--accent-orange) !important;
    background: rgba(249, 115, 22, 0.10);
}

/* Out-of-scope cells (not in the current phase's range) */
.array-item.cy-out-of-scope {
    opacity: 0.4;
}

/* ── Split marker — dashed left border on the k-th cell ── */
.array-item.cy-split-right {
    border-left: 2.5px dashed var(--accent-purple) !important;
}

/* ── Blueprint: 3-step strategy legend ── */
.cy-blueprint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 2px 0 6px;
    width: 100%;
    flex-wrap: wrap;
}

.cy-bp-step {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    opacity: 0.45;
    transition: opacity 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.cy-bp-step.cy-bp-active {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.cy-bp-step.cy-bp-done {
    opacity: 0.55;
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.06);
}

.cy-bp-step.cy-bp-done .cy-bp-num {
    color: var(--accent-green);
}

.cy-bp-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.cy-bp-text {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.cy-bp-arrow {
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.4;
}

/* ── "Why" line — contextual explanation ── */
.cy-why {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: center;
    max-width: 480px;
    margin: 0 auto 8px;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

/* ── Reverse call indicator — shows reverse(lo, hi) above the array ── */
.cy-reverse-call {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 2px auto 6px;
    padding: 3px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--rev-color, var(--accent-purple));
    opacity: 0.7;
    border-bottom: 1.5px solid var(--rev-color, var(--accent-purple));
    border-radius: 0;
    width: fit-content;
    transition: opacity 0.2s ease;
}

.cy-reverse-fn {
    color: var(--rev-color, var(--accent-purple));
    opacity: 0.6;
}

.cy-reverse-args {
    color: var(--rev-color, var(--accent-purple));
    font-weight: 700;
    opacity: 1;
}

/* Fade-in when a new reverse() call starts */
.cy-reverse-call-enter {
    animation: revCallEnter 0.35s ease both;
}

@keyframes revCallEnter {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }
    100% {
        opacity: 0.7;
        transform: translateY(0);
    }
}

/* ── Insight (i) button ── */
.cy-insight-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
    line-height: 1;
    padding: 0;
}
.cy-insight-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ── Insight Modal ── */
.insight-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.insight-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.insight-modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.insight-modal.show .insight-modal-content {
    transform: scale(1) translateY(0);
}

.insight-modal-header {
    padding: 20px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.insight-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.insight-modal-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 15px;
}
.insight-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.insight-modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.insight-modal-body p {
    margin: 0 0 10px;
}
.insight-analogy {
    font-size: 14px;
    color: var(--text-primary);
}

.insight-core-idea {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.insight-example-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 14px 0 6px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.insight-example-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.insight-example-array {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.insight-step {
    display: flex;
    gap: 12px;
    margin: 14px 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.insight-step-num {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 800;
    margin-top: 1px;
}
.insight-step-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.insight-step-body strong {
    color: var(--text-primary);
    font-size: 13px;
}
.insight-step-body p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted);
}
.insight-transform {
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.insight-key {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.insight-key strong {
    color: var(--text-primary);
}

.insight-complexity {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.insight-complexity strong {
    color: var(--text-secondary);
}

/* ── Ghost target row ── */
.cy-ghost-target {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.45;
    transition: opacity 0.3s ease;
}

.cy-ghost-target:hover {
    opacity: 0.7;
}

.cy-ghost-label {
    font-size: 0.72em;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cy-ghost-cells {
    gap: 3px !important;
    min-height: 0 !important;
    padding: 2px 4px 14px !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
}

.cy-ghost-cell {
    min-width: 0 !important;
    min-height: 0 !important;
    width: 28px !important;
    height: 28px !important;
    flex: 1 1 0 !important;
    max-width: 32px !important;
    font-size: 11px !important;
    border-width: 1px !important;
    border-style: dashed !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    margin: 0 0 12px 0 !important;
}

.cy-ghost-cell .array-index {
    font-size: 7px !important;
}

.cy-ghost-cell.cy-ghost-blue {
    border-color: var(--accent-blue) !important;
}

.cy-ghost-cell.cy-ghost-orange {
    border-color: var(--accent-orange) !important;
}

/* When current value matches goal position — subtle solid glow */
.cy-ghost-cell.cy-ghost-matched {
    border-style: solid !important;
    opacity: 0.9;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
    color: var(--accent-green) !important;
}

/* ── Swap animation — clean linear glide with slight vertical offset ── */

/* Cell A glides OVER (slight lift + horizontal slide) */
.cy-swap-over {
    position: relative;
    animation: swapOver var(--swap-duration, 0.55s) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    z-index: 51;
    box-shadow: 0 0 14px color-mix(in srgb, var(--swap-color, var(--accent-blue)) 40%, transparent);
}

/* Cell B glides UNDER (slight dip + horizontal slide) */
.cy-swap-under {
    position: relative;
    animation: swapUnder var(--swap-duration, 0.55s) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    z-index: 50;
    box-shadow: 0 0 14px color-mix(in srgb, var(--swap-color, var(--accent-orange)) 40%, transparent);
}

@keyframes swapOver {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    15% {
        transform: translate(calc(var(--dx) * 0.08), var(--lift)) scale(1.06);
        opacity: 1;
    }
    85% {
        transform: translate(calc(var(--dx) * 0.92), var(--lift)) scale(1.06);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), 0) scale(1);
        opacity: 1;
    }
}

@keyframes swapUnder {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    15% {
        transform: translate(calc(var(--dx) * 0.08), var(--drop)) scale(0.95);
        opacity: 0.65;
    }
    85% {
        transform: translate(calc(var(--dx) * 0.92), var(--drop)) scale(0.95);
        opacity: 0.65;
    }
    100% {
        transform: translate(var(--dx), 0) scale(1);
        opacity: 1;
    }
}

/* Compact swap sizing adjustments */
.cy-compact .cy-swap-over,
.cy-compact .cy-swap-under {
    --lift: -40px;
    --drop: 40px;
}

/* ── Problem 8 compact layout — fits without scroll on desktop ── */
.array-inner.cy-compact {
    gap: 6px;
    padding: 14px 24px 10px;
}
.cy-compact .array-label {
    font-size: 11px;
    margin-bottom: 0;
}
.cy-compact .array-visualization {
    padding: 6px 10px;
    min-height: 60px;
    gap: 6px;
}
.cy-compact .array-item {
    width: 44px;
    height: 44px;
    min-width: 0;
    flex: 1 1 44px;
    max-width: 44px;
    font-size: 15px;
    border-radius: 10px;
    margin-top: 22px;
    margin-bottom: 20px;
}
.cy-compact .pointer-label {
    top: -20px;
    font-size: 9px;
    padding: 1px 5px;
}
.cy-compact .array-index {
    font-size: 8px;
    bottom: -16px;
}
.cy-compact .cy-blueprint {
    margin: 0 0 2px;
}
.cy-compact .cy-bp-step {
    padding: 3px 8px;
}
.cy-compact .cy-bp-num {
    font-size: 11px;
}
.cy-compact .cy-bp-text {
    font-size: 10px;
}
.cy-compact .cy-why {
    font-size: 11px;
    padding: 4px 10px;
    margin: 0 auto 4px;
}
.cy-compact .cy-reverse-call {
    font-size: 10px;
    padding: 2px 10px;
    margin: 1px auto 4px;
}
.cy-compact .cy-ghost-target {
    margin-top: 4px;
    gap: 2px;
}
.cy-compact .cy-ghost-cell {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
    margin: 0 0 10px 0 !important;
}
.cy-compact .cy-ghost-label {
    font-size: 0.65em;
}
.cy-compact .pointer-info {
    margin-top: 4px;
    padding: 6px 12px;
    gap: 12px;
}
.cy-compact .pointer-detail-label {
    font-size: 8px;
}
.cy-compact .pointer-detail-value {
    font-size: 11px;
    padding: 2px 6px;
}
.cy-compact .sum-bridge {
    margin: 4px 0 0;
    padding: 6px 12px;
}

/* ═══════════════════════════════════════════════════════════════ */

/* ── Data Structure Visual Containers ── */
.ds-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    margin: 10px 0 6px;
    flex-wrap: wrap;
}

.ds-bucket {
    border: 2px solid var(--accent-purple);
    border-radius: 12px;
    padding: 10px 14px 8px;
    background: rgba(139, 92, 246, 0.06);
    min-width: 90px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.10);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.ds-bucket.ds-set {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 2px 14px rgba(139, 92, 246, 0.12);
}

.ds-bucket.ds-map {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 2px 14px rgba(59, 130, 246, 0.12);
}

.ds-bucket-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.ds-bucket.ds-set .ds-bucket-label {
    color: var(--accent-purple);
}

.ds-bucket.ds-map .ds-bucket-label {
    color: var(--accent-blue);
}

.ds-bucket-items {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    min-height: 22px;
}

.ds-item {
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.ds-item.ds-set-item {
    background: var(--accent-purple);
    box-shadow: 0 1px 4px rgba(139, 92, 246, 0.25);
}

.ds-item.ds-map-item {
    background: var(--accent-blue);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
}

.ds-item.ds-active {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.7);
    background: var(--accent-green) !important;
    transform: scale(1.12);
}

.ds-item.ds-ping {
    animation: dsPing 0.4s ease;
}

.ds-item.ds-miss {
    background: var(--accent-red) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    opacity: 0.8;
}

.ds-brace {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.ds-bucket.ds-set .ds-brace {
    color: var(--accent-purple);
    text-shadow: none;
}

.ds-bucket.ds-map .ds-brace {
    color: var(--accent-blue);
    text-shadow: none;
}

@keyframes dsPing {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 8px rgba(45, 166, 122, 0.4); }
    100% { transform: scale(1); }
}

/* Chain bar for sequence building */
.chain-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 8px auto;
    padding: 4px 8px;
    background: rgba(139, 92, 246, 0.08);
    border: 2px solid var(--accent-purple);
    border-radius: 8px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

.chain-bar .chain-num {
    padding: 3px 10px;
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.15);
    border-radius: 4px;
}

.chain-bar .chain-num.chain-new {
    color: #fff;
    background: var(--accent-green);
}

.chain-bar .chain-num.chain-fail {
    color: #fff;
    background: var(--accent-red);
    opacity: 0.7;
}

.chain-bar .chain-arrow {
    color: var(--accent-purple);
    font-size: 14px;
    font-weight: 700;
    padding: 0 3px;
}

.array-item.empty {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed var(--border);
    color: var(--text-muted);
}

/* Visited/processed cells — dimmed */
.array-item.visited-cell {
    opacity: 0.35;
}

/* Space characters in string problems */
.array-item.space-char {
    background: rgba(255, 255, 255, 0.03);
    border-style: dashed;
    color: var(--text-muted);
    font-size: 10px;
}

/* Roman numeral character cells — slightly wider for two-char symbols */
.array-item.roman-char {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ===== Price Chart / Bar Visualization (Stock, H-Index, Candy) ===== */
.price-chart-viz {
    position: relative;
    align-items: flex-end !important;
    width: 100% !important;
    height: 200px !important;
    min-height: 200px !important;
    overflow: visible !important;
    padding: 28px 20px 56px !important;
    box-sizing: content-box;
    gap: 6px !important;
}
.price-chart-viz .price-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100% !important;
    min-height: 30px;
    transition: background 0.3s ease;
    aspect-ratio: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
    max-width: none !important;
    flex: 1 1 0 !important;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
}
.price-chart-viz .price-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 4px;
    height: var(--bar-h, 50%);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px 4px 0 0;
    z-index: 0;
    transition: height 0.3s ease, background 0.3s ease;
}
.price-chart-viz .price-bar .price-val {
    position: absolute;
    bottom: calc(var(--bar-h, 50%) + 4px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--text-secondary);
}
/* Price bars don't need the regular aspect-ratio/margin — override */
.price-chart-viz .price-bar .array-index {
    bottom: -22px;
}
.price-chart-viz .price-bar .pointer-label {
    top: auto;
    bottom: -50px;
}
/* Stock Buy/Sell highlights */
.price-bar.price-buy::before { background: rgba(16, 185, 129, 0.35); }
.price-bar.price-sell::before { background: rgba(139, 92, 246, 0.35); }
.price-bar.price-low::before { background: rgba(16, 185, 129, 0.2); }
.price-bar.price-gain::before { background: rgba(16, 185, 129, 0.25); }
.price-bar.price-gain { color: var(--accent-green) !important; }
.price-bar.price-drop::before { background: rgba(239, 68, 68, 0.15); }
.price-bar.price-drop { color: var(--accent-red) !important; }

/* Override pointer-1 blue box for price bars — keep it subtle */
.price-chart-viz .price-bar.pointer-1 {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}
.price-chart-viz .price-bar.pointer-1::before {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: -2px;
    border-radius: 4px 4px 0 0;
}
.price-floor-line {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    border-top: 2px dashed var(--accent-green);
    margin-top: 2px;
}

/* ===== Problem 9 — Stock Trade Visualization Enhancements ===== */

/* Feature 2: Profit Gap — green block inside the sell bar */
.profit-gap-block {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: var(--gap-bottom, 0%);
    height: calc(var(--gap-top, 50%) - var(--gap-bottom, 0%));
    background: rgba(16, 185, 129, 0.22);
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: 3px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: profitGapFadeIn 0.4s ease-out;
}
.profit-gap-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-green);
    text-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    white-space: nowrap;
}
@keyframes profitGapFadeIn {
    0% { opacity: 0; transform: scaleY(0.3); }
    100% { opacity: 1; transform: scaleY(1); }
}
.profit-gap-best {
    background: rgba(16, 185, 129, 0.32);
    border-color: rgba(16, 185, 129, 0.65);
}
.profit-gap-best .profit-gap-label {
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* Feature 3: Ghost outline for previous best trade */
.profit-ghost-outline {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: var(--ghost-bottom, 0%);
    height: calc(var(--ghost-top, 50%) - var(--ghost-bottom, 0%));
    border: 1.5px dashed rgba(16, 185, 129, 0.3);
    border-radius: 3px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    pointer-events: none;
}
.profit-ghost-label {
    font-size: 9px;
    font-weight: 600;
    color: rgba(16, 185, 129, 0.5);
    white-space: nowrap;
}
.stock-prev-best::after {
    content: '';
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 0;
    top: 0;
    border: 1.5px dashed rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    pointer-events: none;
    z-index: 0;
}

/* Feature 4: Trade arc SVG */
.trade-arc-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}
.trade-arc-path {
    fill: none;
    stroke: rgba(16, 185, 129, 0.45);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    stroke-linecap: round;
    animation: tradeArcDraw 0.6s ease-out;
}
@keyframes tradeArcDraw {
    0% { stroke-dashoffset: 200; opacity: 0; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}
.trade-arc-label {
    fill: rgba(16, 185, 129, 0.7);
    font-size: 9px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: auto;
}

/* Feature 1: maxProfit box flash animation */
.stock-mp-box {
    transition: all 0.3s ease;
}
.stock-mp-box.stock-mp-flash {
    animation: mpFlash 0.6s ease-out;
}
.stock-mp-box.stock-mp-flash .pointer-detail-value {
    color: var(--accent-green) !important;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
@keyframes mpFlash {
    0% { background: rgba(239, 68, 68, 0.3); transform: scale(1.05); }
    30% { background: rgba(239, 68, 68, 0.2); }
    60% { background: rgba(16, 185, 129, 0.25); transform: scale(1.08); }
    100% { background: transparent; transform: scale(1); }
}

/* Old → New value transition inside maxProfit box */
.stock-mp-old {
    color: var(--accent-red, #ef4444) !important;
    text-decoration: line-through;
    opacity: 0.6;
    margin-right: 6px;
    font-size: 0.85em;
    animation: mpOldFade 0.6s ease-out forwards;
}
.stock-mp-new {
    color: var(--accent-green) !important;
    font-weight: 800;
    animation: mpNewPop 0.6s ease-out;
}
@keyframes mpOldFade {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 0.35; }
}
@keyframes mpNewPop {
    0% { opacity: 0; transform: scale(0.7); }
    50% { opacity: 1; transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* H-Index pass/fail (legacy) */
.price-bar.hindex-pass::before { background: rgba(16, 185, 129, 0.3); }
.price-bar.hindex-fail::before { background: rgba(239, 68, 68, 0.15); }

/* ===== H-Index Durfee-Square SVG Visualization ===== */
.hindex-svg-wrap {
    width: 100%;
    max-width: 520px;
    margin: 6px auto 2px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    padding: 8px 6px 4px;
    min-height: 150px;
}
.hindex-svg {
    width: 100%;
    height: auto;
    min-height: 130px;
    aspect-ratio: 480 / 250;
    display: block;
    overflow: visible;
}
/* Axis labels */
.hindex-axis-label {
    fill: var(--text-muted, rgba(255,255,255,0.4));
    font-size: 10px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* Bars */
.hindex-bar {
    transition: fill 0.3s ease, opacity 0.3s ease;
    fill: rgba(255, 255, 255, 0.1);
}
.hindex-bar-sort {
    fill: rgba(139, 92, 246, 0.25);
}
.hindex-bar-pass {
    fill: rgba(16, 185, 129, 0.35);
}
.hindex-bar-fail {
    fill: rgba(239, 68, 68, 0.18);
}
.hindex-bar-final {
    fill: rgba(16, 185, 129, 0.5);
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
}
.hindex-bar-active {
    stroke: var(--accent-blue, #60a5fa);
    stroke-width: 2;
}
/* Value + index labels */
.hindex-bar-val {
    fill: var(--text-secondary, rgba(255,255,255,0.7));
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.hindex-bar-idx {
    fill: var(--text-muted, rgba(255,255,255,0.4));
    font-size: 10px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* Pointer i label */
.hindex-pointer-i {
    fill: var(--accent-blue, #60a5fa);
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* Durfee square overlays */
.hindex-square-pass {
    fill: rgba(16, 185, 129, 0.12);
    stroke: rgba(16, 185, 129, 0.6);
    stroke-width: 2;
    stroke-dasharray: 6, 3;
    transition: all 0.4s ease;
}
.hindex-square-fail {
    fill: rgba(239, 68, 68, 0.08);
    stroke: rgba(239, 68, 68, 0.5);
    stroke-width: 2;
    stroke-dasharray: 6, 3;
    transition: all 0.4s ease;
}
.hindex-square-label {
    fill: var(--text-secondary, rgba(255,255,255,0.7));
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* y = x diagonal */
.hindex-diagonal {
    stroke: rgba(250, 204, 21, 0.45);
    stroke-width: 1.5;
    stroke-dasharray: 6, 4;
}
.hindex-diag-label {
    fill: rgba(250, 204, 21, 0.6);
    font-size: 10px;
    font-style: italic;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* Threshold line */
.hindex-threshold {
    stroke: var(--accent-blue, #60a5fa);
    stroke-width: 1.5;
    stroke-dasharray: 8, 4;
    opacity: 0.7;
}
.hindex-threshold-label {
    fill: var(--accent-blue, #60a5fa);
    font-size: 10px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
/* Water-fill beneath threshold line */
.hindex-water-fill {
    fill: rgba(96, 165, 250, 0.06);
    transition: all 0.4s ease;
}
/* Pass/Fail icons above bars */
.hindex-pass-icon {
    fill: var(--accent-green, #10b981);
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    opacity: 0;
    animation: hindex-icon-in 0.35s ease forwards;
}
.hindex-fail-icon {
    fill: var(--accent-red, #ef4444);
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    opacity: 0;
    animation: hindex-icon-in 0.35s ease forwards;
}
@keyframes hindex-icon-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
/* H-Point diamond marker */
.hindex-hpoint-diamond {
    fill: rgba(250, 204, 21, 0.9);
    stroke: rgba(250, 204, 21, 1);
    stroke-width: 1;
    filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.6));
    opacity: 0;
    animation: hindex-hpoint-pop 0.45s ease 0.15s forwards;
}
.hindex-hpoint-final {
    fill: rgba(16, 185, 129, 0.9);
    stroke: rgba(16, 185, 129, 1);
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.5));
}
.hindex-hpoint-label {
    fill: rgba(250, 204, 21, 0.9);
    font-size: 10px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    opacity: 0;
    animation: hindex-hpoint-pop 0.45s ease 0.25s forwards;
}
.hindex-hpoint-final-label {
    fill: rgba(16, 185, 129, 0.9);
}
.hindex-hpoint-guide {
    stroke: rgba(250, 204, 21, 0.3);
    stroke-width: 1;
    stroke-dasharray: 3, 3;
    opacity: 0;
    animation: hindex-hpoint-pop 0.45s ease 0.1s forwards;
}
.hindex-hpoint-guide-final {
    stroke: rgba(16, 185, 129, 0.3);
}
@keyframes hindex-hpoint-pop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===== Jump Game I — "Safe Zone vs Darkness" ===== */
.jg1-viz {
    position: relative;
}
.jg1-cell {
    position: relative;
    transition: all 0.25s ease;
}
.jg1-safe {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.08);
}
.jg1-new-reach {
    background: rgba(16, 185, 129, 0.22) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    animation: jg1-expand-pulse 0.4s ease-out;
}
@keyframes jg1-expand-pulse {
    0% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.jg1-dark {
    border-color: rgba(255, 255, 255, 0.06) !important;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    opacity: 0.4;
}
.jg1-active {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}
.jg1-goal {
    border-color: var(--accent-purple) !important;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}
.jg1-goal-reached {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.25) !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
    animation: jg1-goal-flash 0.5s ease-out;
}
@keyframes jg1-goal-flash {
    0% { transform: scale(1.15); box-shadow: 0 0 24px rgba(16, 185, 129, 0.8); }
    100% { transform: scale(1); }
}
.jg1-blocked {
    border-color: var(--accent-red) !important;
    background: rgba(239, 68, 68, 0.2) !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
    animation: jg1-blocked-shake 0.4s ease;
    opacity: 1 !important;
}
@keyframes jg1-blocked-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}
.jg1-won {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.12) !important;
}
/* Flag at farthest — beside the index box, no border */
.jg1-flag {
    position: absolute;
    bottom: -28px;
    left: calc(50% + 18px);
    font-size: 11px;
    line-height: 1;
    padding: 3px 0;
    color: var(--accent-green);
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.5));
    z-index: 2;
    pointer-events: none;
}
.jg1-flag-moved {
    animation: jg1-flag-bounce 0.35s ease-out;
}
@keyframes jg1-flag-bounce {
    0% { transform: translateY(-4px); opacity: 0.5; }
    60% { transform: translateY(1px); }
    100% { transform: translateY(0); opacity: 1; }
}
/* Reach progress bar */
.jg1-reach-bar-wrap {
    position: relative;
    height: 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 9px;
    margin: 6px 0;
    overflow: hidden;
}
.jg1-reach-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 9px;
    transition: width 0.3s ease;
    opacity: 0.3;
}
.jg1-reach-goal {
    opacity: 0.5;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}
.jg1-reach-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
/* Reach span info */
.jg1-reach-span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px 10px;
    font-size: 11px;
    background: rgba(59, 130, 246, 0.06);
    border-radius: 5px;
    margin: 3px 0;
}
/* Reach arc */
.jg1-arc-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
}
.jg1-arc-path {
    fill: none;
    stroke: rgba(59, 130, 246, 0.5);
    stroke-width: 1.5;
    stroke-dasharray: 5 3;
}
.jg1-arc-label {
    fill: rgba(59, 130, 246, 0.8);
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ===== Jump Game II — Window / BFS Visual ===== */
.jg2-viz {
    position: relative;
    padding-top: 28px;
    padding-bottom: 40px;
    overflow: visible;
}
.jg2-cell {
    position: relative;
    transition: all 0.25s ease;
}
.jg2-goal {
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}
.jg2-done {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* ── Concept header ── */
.jg2-concept {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-muted);
}
.jg2-concept b {
    color: var(--accent-blue);
    font-weight: 700;
}
.jg2-insight-btn {
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Best launch pad pulse on jump step ── */
.jg2-best-launch {
    animation: jg2-launch-pulse 0.6s ease;
    z-index: 2;
}
@keyframes jg2-launch-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); transform: scale(1); }
    40% { box-shadow: 0 0 16px 4px rgba(16, 185, 129, 0.5); transform: scale(1.1); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); transform: scale(1); }
}

/* ── Reach highlight (cells the scanner can reach) ── */
.jg2-reach-highlight {
    box-shadow: 0 0 6px rgba(96, 165, 250, 0.25) !important;
}

/* ── L / R / i pointer labels above cells ── */
.jg2-ptr-row {
    position: absolute;
    top: -19px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    white-space: nowrap;
    z-index: 2;
}
.jg2-ptr {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    letter-spacing: 0.02em;
}
.jg2-ptr-l {
    color: #fb923c;
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.jg2-ptr-r {
    color: #f472b6;
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
}
.jg2-ptr-i {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ── Bracket zone underlines (NeetCode style) ── */
.jg2-brackets-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 36px;
    pointer-events: none;
}
.jg2-bracket {
    position: absolute;
    top: 0;
    height: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    border-left: 2.5px solid var(--bracket-color);
    border-right: 2.5px solid var(--bracket-color);
    border-bottom: 2.5px solid var(--bracket-color);
    border-radius: 0 0 6px 6px;
    transition: left 0.35s ease, width 0.35s ease;
    animation: jg2-bracket-in 0.3s ease;
}
@keyframes jg2-bracket-in {
    0% { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.jg2-bracket-new {
    animation: jg2-bracket-expand 0.5s ease;
}
@keyframes jg2-bracket-expand {
    0% { opacity: 0; transform: scaleX(0.6) translateY(-4px); }
    50% { transform: scaleX(1.04) translateY(0); }
    100% { opacity: 1; transform: scaleX(1) translateY(0); }
}
.jg2-bracket-done {
    opacity: 0.45;
}
.jg2-bracket-label {
    position: absolute;
    bottom: -14px;
    font-size: 9px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    pointer-events: auto;
}

/* ── Reach info row (i + nums[i] = reach, farthest comparison) ── */
.jg2-reach-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 14px;
    margin-top: 6px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.18);
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    animation: jg2-reach-in 0.25s ease;
    width: 100%;
}
@keyframes jg2-reach-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
.jg2-reach-calc {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
}
.jg2-reach-vs {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}
.jg2-reach-var-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.jg2-reach-var-inline {
    flex-direction: column;
}
.jg2-reach-var-name {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    opacity: 0.75;
}
.jg2-reach-var-val {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}
.jg2-reach-op {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    align-self: flex-end;
    line-height: 1.3;
}
.jg2-reach-sep {
    color: rgba(255, 255, 255, 0.12);
    font-size: 16px;
    margin: 0 2px;
    align-self: stretch;
    display: flex;
    align-items: center;
}
.jg2-new-best {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 11px;
    margin-left: 8px;
    align-self: center;
    animation: jg2-best-pop 0.4s ease;
}
@keyframes jg2-best-pop {
    0% { opacity: 0; transform: scale(0.8); }
    60% { transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
.jg2-no-change {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
    margin-left: 8px;
    align-self: center;
    opacity: 0.6;
}

/* ── Jump transition message ── */
.jg2-jump-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px;
    margin-top: 6px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    animation: jg2-jump-msg-in 0.4s ease;
    width: 100%;
}
@keyframes jg2-jump-msg-in {
    0% { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.jg2-jump-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Completion message ── */
.jg2-done-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    margin-top: 6px;
    border-radius: 8px;
    background: rgba(45, 166, 122, 0.08);
    border: 1px solid rgba(45, 166, 122, 0.2);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    animation: jg2-done-in 0.5s ease;
    width: 100%;
}
@keyframes jg2-done-in {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}
.jg2-done-check {
    font-size: 16px;
    color: var(--accent-green);
    font-weight: 800;
}

/* ── Human-mode explanation ── */
.jg2-human {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 6px;
    border-radius: 8px;
    background: rgba(136, 120, 194, 0.04);
    border: 1px solid rgba(136, 120, 194, 0.12);
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
    animation: jg2-human-in 0.25s ease;
    width: 100%;
}
@keyframes jg2-human-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
.jg2-human-icon {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    color: rgba(139, 92, 246, 0.6);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    margin-top: 2px;
}
.jg2-human-icon::before {
    content: '—';
}
.jg2-human-text {
    color: rgba(255, 255, 255, 0.88);
}

/* ── SVG overlay ── */
.jg2-wall-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
}

/* ── Reach arc ── */
.jg2-reach-arc {
    animation: jg2-arc-draw 0.35s ease forwards;
}
@keyframes jg2-arc-draw {
    0% { stroke-dashoffset: 60; opacity: 0.3; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}

/* ===== Product Without Self — Tabbed Visualization ===== */

/* ── Tab bar ── */
.pws-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.pws-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    cursor: default;
    transition: all 0.3s ease;
}
.pws-tab-label {
    font-size: 10px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.2);
}
.pws-tab-done .pws-tab-label { color: rgba(255, 255, 255, 0.35); }
.pws-tab-active.pws-tab-blue   { background: rgba(255, 255, 255, 0.06); border-bottom: 2px solid rgba(255, 255, 255, 0.5); }
.pws-tab-active.pws-tab-green  { background: rgba(255, 255, 255, 0.06); border-bottom: 2px solid rgba(255, 255, 255, 0.5); }
.pws-tab-active.pws-tab-orange { background: rgba(255, 255, 255, 0.06); border-bottom: 2px solid rgba(255, 255, 255, 0.5); }
.pws-tab-active.pws-tab-purple { background: rgba(255, 255, 255, 0.06); border-bottom: 2px solid rgba(255, 255, 255, 0.5); }
.pws-tab-active.pws-tab-blue  .pws-tab-label { color: rgba(255, 255, 255, 0.8); }
.pws-tab-active.pws-tab-green .pws-tab-label { color: rgba(255, 255, 255, 0.8); }
.pws-tab-active.pws-tab-orange .pws-tab-label { color: rgba(255, 255, 255, 0.8); }
.pws-tab-active.pws-tab-purple .pws-tab-label { color: rgba(255, 255, 255, 0.8); }
.pws-tab-done.pws-tab-blue   { background: rgba(255, 255, 255, 0.02); }
.pws-tab-done.pws-tab-green  { background: rgba(255, 255, 255, 0.02); }
.pws-tab-done.pws-tab-orange { background: rgba(255, 255, 255, 0.02); }

/* ── Human explanation ── */
.pws-human {
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(136, 120, 194, 0.04);
    border: 1px solid rgba(136, 120, 194, 0.12);
    font-size: 12.5px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
    animation: pws-fade 0.25s ease;
}
@keyframes pws-fade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ── Input / Output block (Concept tab) ── */
.pws-io-block {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px 10px 8px;
    margin: 4px 0 8px;
}
.pws-io-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pws-io-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: rgba(255, 255, 255, 0.3);
    min-width: 52px;
    text-align: right;
    flex-shrink: 0;
}
.pws-io-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 0;
}
.pws-io-arrow {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.15);
    padding-left: 60px;
}

/* ── Exclusion grid ── */
.pws-excl-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}
.pws-excl-header, .pws-excl-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pws-excl-corner { width: 56px; flex-shrink: 0; }
.pws-excl-col-head {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    padding: 8px 0;
}
.pws-excl-eq-head, .pws-excl-eq {
    width: 24px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 700;
}
.pws-excl-ans-head {
    width: 44px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: rgba(139, 92, 246, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pws-excl-row-label {
    width: 56px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue, #60a5fa);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    text-align: right;
    padding-right: 6px;
}
.pws-excl-cell {
    flex: 1;
    text-align: center;
    padding: 12px 6px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: all 0.25s ease;
}
.pws-excl-left {
    background: rgba(45, 166, 122, 0.1);
    color: var(--accent-green, #2da67a);
    border: 1.5px solid rgba(45, 166, 122, 0.22);
}
.pws-excl-right {
    background: rgba(224, 133, 46, 0.1);
    color: var(--accent-orange, #e0852e);
    border: 1.5px solid rgba(224, 133, 46, 0.22);
}
.pws-excl-skip {
    background: rgba(212, 84, 84, 0.06);
    color: rgba(212, 84, 84, 0.4);
    border: 1.5px solid rgba(212, 84, 84, 0.12);
    font-size: 14px;
    font-weight: 900;
}
.pws-excl-ans {
    width: 44px;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
    color: var(--accent-purple, #8878c2);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Key insight bar */
.pws-key-insight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(136, 120, 194, 0.04);
    border: 1px solid rgba(136, 120, 194, 0.12);
    font-size: 13px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    margin-bottom: 6px;
}
.pws-key-left { color: var(--accent-green, #2da67a); }
.pws-key-right { color: var(--accent-orange, #e0852e); }
.pws-key-times, .pws-key-eq { color: rgba(255, 255, 255, 0.25); font-size: 14px; }
.pws-key-ans { color: var(--accent-purple, #8878c2); }

/* ══════════════════════════════════════════
   STACKED BOX — two/three arrays container
   ══════════════════════════════════════════ */
.pws-stacked-box {
    position: relative;
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 8px;
    overflow: hidden;
}
.pws-result-box {
    background: rgba(136, 120, 194, 0.03);
    border-color: rgba(136, 120, 194, 0.1);
}
.pws-formula-table {
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(136, 120, 194, 0.08);
}

/* ── Scan line ── */
.pws-scan-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    transition: left 0.35s ease;
    transform: translateX(-50%);
}
.pws-scan-green {
    background: var(--accent-green, #10b981);
    box-shadow: 0 0 22px 10px rgba(16, 185, 129, 0.35),
                0 0 48px 18px rgba(16, 185, 129, 0.12);
}
.pws-scan-orange {
    background: var(--accent-orange, #f97316);
    box-shadow: 0 0 22px 10px rgba(249, 115, 22, 0.35),
                0 0 48px 18px rgba(249, 115, 22, 0.12);
}

/* ══════════════════════════════════════════
   ARRAY ROWS — big NeetCode-style cells
   ══════════════════════════════════════════ */
.pws-arr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
    animation: pws-fade 0.2s ease;
    position: relative;
    z-index: 2;
}
.pws-arr-lbl {
    font-size: 11px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}
.pws-lbl-green { color: var(--accent-green, #10b981); }
.pws-lbl-orange { color: var(--accent-orange, #f97316); }
.pws-lbl-purple { color: var(--accent-purple, #a78bfa); }
.pws-lbl-dim { color: rgba(255, 255, 255, 0.35); }

.pws-arr-cells {
    display: flex;
    gap: 6px;
    flex: 1;
}
.pws-arr-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 4px 8px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: all 0.25s ease;
    min-width: 0;
    position: relative;
}
.pws-cv {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}
.pws-ci {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.35;
    margin-top: 4px;
}

/* ── Bigger on desktop ── */
@media (min-width: 820px) {
    .pws-arr-cell {
        padding: 18px 6px 10px;
        border-radius: 12px;
    }
    .pws-cv { font-size: 28px; }
    .pws-ci { font-size: 10px; margin-top: 5px; }
    .pws-arr-cells { gap: 8px; }
    .pws-arr-lbl { font-size: 12px; min-width: 56px; }
    .pws-suf-op-row { padding-left: 64px; }
    .pws-mult-row { padding-left: 64px; }
    .pws-divider-row { padding-left: 64px; }

    .pws-excl-grid { padding: 14px 18px; gap: 5px; }
    .pws-excl-cell { padding: 14px 8px; font-size: 18px; border-radius: 10px; }
    .pws-excl-col-head { font-size: 17px; padding: 10px 0; }
    .pws-excl-ans { font-size: 18px; width: 50px; }
    .pws-excl-ans-head { width: 50px; }
    .pws-excl-corner, .pws-excl-row-label { width: 60px; }
    .pws-excl-row-label { font-size: 12px; }
    .pws-excl-header, .pws-excl-row { gap: 5px; }
    .pws-key-insight { font-size: 14px; padding: 12px 20px; gap: 12px; }
}

/* ── Cell states ── */
.pws-arr-nums {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}
.pws-arr-dim { opacity: 0.35; }
.pws-arr-empty {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px dashed rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.15);
}
.pws-arr-empty .pws-cv { font-size: 15px; }
.pws-upcoming { opacity: 0.3; }

/* Consumed / pointer states */
.pws-consumed-left {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: var(--accent-green, #34d399) !important;
}
.pws-consumed-right {
    background: rgba(249, 115, 22, 0.1) !important;
    border-color: rgba(249, 115, 22, 0.25) !important;
    color: var(--accent-orange, #fb923c) !important;
}
.pws-ptr-green {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--accent-green, #10b981) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5), 0 0 18px 5px rgba(16, 185, 129, 0.18);
    color: var(--accent-green, #34d399) !important;
    animation: pws-pulse 0.4s ease;
    z-index: 3;
}
@keyframes pws-pulse {
    0% { transform: scale(0.92); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Spotlight rings */
.pws-spotlight {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.65), 0 0 18px 5px rgba(16, 185, 129, 0.18) !important;
    position: relative;
    z-index: 3;
}
.pws-spotlight-orange {
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.65), 0 0 18px 5px rgba(249, 115, 22, 0.18) !important;
    position: relative;
    z-index: 3;
}
.pws-spotlight-cell-g {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 0 10px 2px rgba(16, 185, 129, 0.1) !important;
    position: relative;
    z-index: 3;
}

/* Filled cells */
.pws-arr-filled-green {
    background: rgba(16, 185, 129, 0.14);
    border: 1.5px solid rgba(16, 185, 129, 0.42);
    color: var(--accent-green, #34d399);
}
.pws-arr-frozen-green {
    background: rgba(16, 185, 129, 0.08);
    border: 1.5px solid rgba(16, 185, 129, 0.25);
    color: var(--accent-green, #34d399);
}
.pws-arr-filled-orange {
    background: rgba(249, 115, 22, 0.14);
    border: 1.5px solid rgba(249, 115, 22, 0.42);
    color: var(--accent-orange, #fb923c);
}
.pws-arr-frozen-orange {
    background: rgba(249, 115, 22, 0.08);
    border: 1.5px solid rgba(249, 115, 22, 0.25);
    color: var(--accent-orange, #fb923c);
}
.pws-arr-filled-purple {
    background: rgba(139, 92, 246, 0.14);
    border: 1.5px solid rgba(139, 92, 246, 0.42);
    color: var(--accent-purple, #a78bfa);
}
.pws-cell-just-filled {
    animation: pws-stamp 0.35s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}
.pws-arr-final-pop {
    animation: pws-stamp 0.4s ease;
}
@keyframes pws-stamp {
    0% { transform: scale(0.85); opacity: 0.5; }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── × operator row (suffix pass) ── */
.pws-suf-op-row {
    display: flex;
    gap: 6px;
    padding: 0 0 0 58px;
    margin: 2px 0;
    position: relative;
    z-index: 2;
}
.pws-suf-op-cell {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    line-height: 20px;
    height: 20px;
}
.pws-suf-op-active {
    color: var(--accent-orange, #f97316);
    font-size: 16px;
    font-weight: 900;
}
.pws-suf-op-done {
    color: rgba(139, 92, 246, 0.45);
    font-size: 11px;
}
.pws-suf-op-pending {
    color: rgba(255, 255, 255, 0.1);
}

/* ── × multiplication row (result tab) ── */
.pws-mult-row {
    display: flex;
    gap: 6px;
    margin: 2px 0;
    padding-left: 58px;
}
.pws-mult-sym {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.25);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    line-height: 18px;
}

/* ── Divider row (═══) ── */
.pws-divider-row {
    display: flex;
    gap: 6px;
    margin: 3px 0;
    padding-left: 58px;
}
.pws-divider-seg {
    flex: 1;
    height: 2px;
    background: rgba(136, 120, 194, 0.2);
    border-radius: 1px;
}

/* ── Running product badge ── */
.pws-running-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 6px 0;
}
.pws-run-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.pws-run-bubble {
    font-size: 24px;
    font-weight: 900;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    padding: 5px 20px;
    border-radius: 24px;
    min-width: 52px;
    text-align: center;
    transition: all 0.25s ease;
}
.pws-run-green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green, #34d399);
    border: 1.5px solid rgba(16, 185, 129, 0.32);
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.18);
}
.pws-run-orange {
    background: rgba(249, 115, 22, 0.12);
    color: var(--accent-orange, #fb923c);
    border: 1.5px solid rgba(249, 115, 22, 0.3);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.15);
}

/* ── Calc card ── */
.pws-calc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 6px 0 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.09);
    animation: pws-fade 0.2s ease;
}
.pws-calc-card-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}
.pws-calc-card-done {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-green, #10b981);
    gap: 8px;
}
.pws-cc-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 5px;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.pws-cc-tag-green  { background: rgba(45, 166, 122, 0.1); color: var(--accent-green, #2da67a); }
.pws-cc-tag-orange { background: rgba(224, 133, 46, 0.1); color: var(--accent-orange, #e0852e); }
.pws-cc-equation { flex: 1; }
.pws-cc-note { color: rgba(255, 255, 255, 0.3); font-size: 11px; }
.pws-cc-g { color: var(--accent-green, #10b981); font-weight: 700; }
.pws-cc-o { color: var(--accent-orange, #f97316); font-weight: 700; }
.pws-cc-result-g { color: var(--accent-green, #10b981); font-size: 15px; }
.pws-cc-result-p { color: var(--accent-purple, #a78bfa); font-size: 15px; }

/* ── Column equations (result phase) ── */
.pws-col-eqs {
    display: flex;
    gap: 6px;
    padding: 6px 0 2px;
    justify-content: center;
    flex-wrap: wrap;
}
.pws-col-eq {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    animation: pws-stamp 0.35s ease both;
    min-width: 46px;
}
.pws-col-eq-g {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-green, #10b981);
}
.pws-col-eq-o {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-orange, #f97316);
}
.pws-col-eq-p {
    font-size: 15px;
    font-weight: 900;
    color: var(--accent-purple, #a78bfa);
}
.pws-col-eq-op {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.22);
}

/* ── Done message ── */
.pws-done-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 4px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    animation: pws-done-in 0.4s ease;
}
@keyframes pws-done-in {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===== Shared progress bar (used by multiple problems) ===== */
.reach-bar-container {
    position: relative;
    height: 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 9px;
    margin: 6px 0;
    overflow: hidden;
}
.reach-bar {
    height: 100%;
    background: var(--accent-green);
    border-radius: 9px;
    transition: width 0.3s ease;
    opacity: 0.35;
}
.reach-bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== Candy Comparison Row ===== */
.candy-compare-row {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    margin: 4px 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

/* ===== Highlight Char (for matched characters in string problems) ===== */
.array-item.highlight-char {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
}

/* Rainwater — water cell highlight */
.array-item.water-cell {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5), inset 0 0 8px rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
}

/* Rainwater bar chart */
.rain-viz {
    align-items: flex-end !important;
    height: 180px !important;
    min-height: 180px !important;
    overflow: visible !important;
    padding: 28px 14px 40px !important;
    box-sizing: content-box;
    gap: 3px !important;
}
.rain-viz .rain-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100% !important;
    min-height: 20px;
    aspect-ratio: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
    max-width: none !important;
    flex: 1 1 0 !important;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
    font-size: 12px !important;
    color: var(--text-primary);
    z-index: 1;
}
.rain-viz .rain-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: var(--bar-h, 50%);
    background: rgba(154, 154, 154, 0.3);
    border-radius: 3px 3px 0 0;
    z-index: 0;
    transition: height 0.3s ease;
}
.rain-viz .rain-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: var(--water-h, 50%);
    background: rgba(59, 130, 246, 0.15);
    border-radius: 3px 3px 0 0;
    z-index: 0;
    transition: height 0.3s ease;
}
.rain-viz .rain-bar .array-index {
    bottom: -22px;
}
.rain-viz .rain-bar .pointer-label,
.rain-viz .rain-bar .pointer-label-pair {
    top: auto;
    bottom: -44px;
}

/* Container Water bar chart (Problem 30) */
.container-water-viz {
    align-items: flex-end !important;
    height: 180px !important;
    min-height: 180px !important;
    overflow: visible !important;
    padding: 28px 14px 40px !important;
    box-sizing: content-box;
    gap: 3px !important;
}
.container-water-viz .container-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100% !important;
    min-height: 20px;
    aspect-ratio: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
    max-width: none !important;
    flex: 1 1 0 !important;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
    font-size: 13px !important;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 1;
}
/* The wall itself */
.container-water-viz .container-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: var(--bar-h, 50%);
    background: rgba(154, 154, 154, 0.35);
    border-radius: 3px 3px 0 0;
    z-index: 0;
    transition: height 0.3s ease;
}
/* Water fill between L and R */
.container-water-viz .container-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--water-h, 0%);
    background: rgba(59, 130, 246, 0.18);
    border-top: 2px solid rgba(59, 130, 246, 0.35);
    z-index: 0;
    transition: height 0.3s ease;
}
/* Pointer colors on container bars */
.container-water-viz .container-bar.pointer-1::before {
    background: rgba(59, 130, 246, 0.45);
}
.container-water-viz .container-bar.pointer-2::before {
    background: rgba(249, 115, 22, 0.45);
}
.container-water-viz .container-bar.pointer-merge::before {
    background: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.container-water-viz .container-bar .array-index {
    bottom: -22px;
}
.container-water-viz .container-bar .pointer-label,
.container-water-viz .container-bar .pointer-label-pair {
    top: auto;
    bottom: -44px;
}

/* ═══════════════════════════════════════════════════════════ */
/*  Problem 36: Valid Parentheses — vertical stack + brackets */
/* ═══════════════════════════════════════════════════════════ */

/* Human message bar (reusable) */
.human-msg-bar {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(136, 120, 194, 0.04);
    border: 1px solid rgba(136, 120, 194, 0.12);
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
    animation: humanMsgIn 0.25s ease;
    width: 100%;
}
@keyframes humanMsgIn {
    0% { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.human-msg-text {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.5;
}

/* Bracket-specific coloring on array items */
.parens-viz .array-item {
    transition: all 0.2s ease;
}
.parens-viz .array-item.parens-pushing {
    border-color: var(--bracket-color, var(--accent-blue)) !important;
    background: color-mix(in srgb, var(--bracket-color, var(--accent-blue)) 12%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--bracket-color, var(--accent-blue)) 30%, transparent);
    animation: parensPush 0.35s ease;
}
@keyframes parensPush {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.parens-viz .array-item.parens-popping {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.12);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
    animation: parensPopItem 0.35s ease;
}
@keyframes parensPopItem {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}
.parens-viz .array-item.parens-mismatch {
    border-color: var(--accent-red) !important;
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.3);
    animation: parensMismatchShake 0.4s ease;
}
@keyframes parensMismatchShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}
.parens-viz .array-item.parens-pair-done {
    opacity: 0.4;
    border-style: dashed;
}
.parens-viz .array-item.parens-matched {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.08);
}
.parens-viz .array-item.parens-invalid {
    border-color: var(--accent-red) !important;
    background: rgba(239, 68, 68, 0.08);
}

/* Action banner */
.parens-action-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    animation: parensBannerIn 0.25s ease;
}
@keyframes parensBannerIn {
    0% { opacity: 0; transform: translateX(-8px); }
    100% { opacity: 1; transform: translateX(0); }
}
.parens-action-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.parens-action-push {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--accent-blue);
}
.parens-action-pop {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--accent-green);
}
.parens-action-mismatch {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--accent-red);
}

/* Vertical stack container */
.parens-stack-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 12px auto 8px;
    min-width: 100px;
    max-width: 180px;
}
.parens-stack-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
}
.parens-stack-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    width: 100%;
}
.parens-stack-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 12px 0;
}
.parens-stack-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 6px 16px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 800;
    color: var(--stack-color, var(--text-primary));
    background: var(--stack-bg, transparent);
    border: 1.5px solid color-mix(in srgb, var(--stack-color, var(--border-subtle)) 40%, transparent);
    transition: all 0.2s ease;
}
.parens-stack-block.parens-stack-top {
    border-color: var(--stack-color, var(--accent-purple));
    box-shadow: 0 0 10px color-mix(in srgb, var(--stack-color, var(--accent-purple)) 25%, transparent);
}
.parens-stack-block.parens-stack-push-anim {
    animation: parensStackPush 0.35s ease;
}
@keyframes parensStackPush {
    0% { opacity: 0; transform: translateY(-16px) scale(0.8); }
    60% { transform: translateY(2px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.parens-stack-char {
    font-size: 22px;
}
.parens-stack-top-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
}
.parens-stack-base {
    font-size: 10px;
    color: var(--border-subtle);
    letter-spacing: 2px;
    margin-top: 2px;
    user-select: none;
}

/* Result banner */
.parens-result {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    animation: parensResultIn 0.4s ease;
}
@keyframes parensResultIn {
    0% { opacity: 0; transform: scale(0.9); }
    60% { transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}
.parens-result-valid {
    background: rgba(16, 185, 129, 0.1);
    border: 1.5px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}
.parens-result-invalid {
    background: rgba(239, 68, 68, 0.1);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.array-index {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-card);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--border);
    z-index: 2;
}

.pointer-label {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    border: 1.5px solid;
    background: var(--bg-main);
    z-index: 3;
}

/* Combined pointer labels — two connected squares when both on same cell */
.pointer-label-pair {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    z-index: 3;
}

.pointer-label-pair .pointer-label {
    position: static;
    transform: none;
    top: auto;
    left: auto;
}

.pointer-label-pair .pair-left {
    border-radius: 4px 0 0 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.pointer-label-pair .pair-right {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.pointer-label.p1 {
    background: rgba(75, 139, 224, 0.12);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.pointer-label.p2 {
    background: rgba(224, 133, 46, 0.12);
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.pointer-label.p-merge {
    background: rgba(224, 133, 46, 0.12);
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.pointer-label.p-green {
    background: rgba(45, 166, 122, 0.12);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.pointer-info {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1.5px solid var(--border);
    margin-top: 4px;
    width: 100%;
}

.pointer-detail {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.pointer-detail-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.pointer-detail-value {
    font-size: 16px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    padding: 6px 12px;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1.5px solid;
}

.pointer-detail-value.p1 {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.pointer-detail-value.p2 {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.pointer-detail-value.p-merge {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.pointer-detail-value.p-purple {
    color: var(--accent-purple);
    border-color: var(--accent-purple);
}

.pointer-detail-value.p-green {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.pointer-detail-value.p-pink {
    color: #f472b6;
    border-color: #f472b6;
}

/* ─── New Problem Visualization Helpers ─── */

/* Sliding window highlight — items inside the current window */
.array-item.active-window {
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.45), inset 0 0 6px rgba(139, 92, 246, 0.1);
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
}

/* Already-processed items (dimmed) */
.array-item.visited {
    opacity: 0.35;
}

/* Highlight chars that belong to the target pattern */
.array-item.highlight-char {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
    border-color: var(--accent-green);
}

/* ─── Sum Bridge (Two Sum II visual connector) ─── */
.sum-pair-viz {
    overflow: visible;
    padding-bottom: 6px;
}

.sum-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: -2px;
    animation: bridgeFadeIn 0.35s ease;
}

@keyframes bridgeFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sum-bridge-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.sum-bridge-val {
    font-weight: 800;
}
.sum-bridge-lval {
    color: var(--accent-blue);
}
.sum-bridge-rval {
    color: var(--accent-orange);
}
.sum-bridge-op {
    color: var(--text-muted);
    font-size: 13px;
}
.sum-bridge-eq {
    color: var(--text-muted);
    font-size: 13px;
}
.sum-bridge-result {
    color: var(--accent-purple);
    font-weight: 800;
    font-size: 16px;
}
.sum-bridge-cmp {
    color: var(--accent-red);
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
}
.sum-bridge-cmp-match {
    color: var(--accent-green);
}
.sum-bridge-target {
    color: var(--accent-green);
    font-size: 14px;
    font-weight: 800;
    margin-left: 2px;
}

/* Sum bridge color variants */
.sum-bridge-match .sum-bridge-lval,
.sum-bridge-match .sum-bridge-rval {
    color: var(--accent-green);
}

/* ─── Move Hints (directional feedback, inline next to bridge) ─── */
.move-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    animation: hintPulse 1.2s ease-in-out infinite alternate;
}

@keyframes hintPulse {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

.move-hint-right {
    color: var(--accent-blue);
}

.move-hint-left {
    color: var(--accent-orange);
}

/* Update the code-metrics section */
.code-metrics {
    display: flex;
    gap: 11px;
    padding: 9px 13px 13px 13px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    font-size: 8px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 5px;
}

.metric-label {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-value {
    color: var(--accent-blue);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(59, 130, 246, 0.1);
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

body > main > section.module.viz-module > div.module-header {
    display: none;
}
body > main > section.module.viz-module > div.module-header:empty {
    display: none;
}
.module-header{
    display:none;
}

/* Annotation tooltip */
.annotation-tooltip {
    position: absolute;
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-primary);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

/* Mobile Bottom Navigation (hidden on desktop) */
.mobile-bottom-nav {
    display: none;
}

/* ===== RESPONSIVE – ZOOMED/COMPACT DESKTOP ===== */

/* ~130% zoom on 1440p, or ~110% on 1280p */
@media screen and (max-width: 1100px) {
    .nav-home-btn { width: 30px; height: 30px; font-size: 14px; border-radius: 7px; }
    .nav-home-btn i { font-size: 9px; }
    .problem-nav-btn { width: 26px; height: 34px; font-size: 9px; }

    .global-nav {
        padding: 8px 12px;
        gap: 8px;
    }

    .nav-left {
        gap: 8px;
    }

    .logo-svg, .problem-page-logo-svg { height: 23px; }

    #problemListBtn {
        font-size: 8px !important;
        padding: 0 10px !important;
        height: 34px !important;
        width: 180px !important;
    }

    .search-bar-wrapper {
        width: 140px;
        min-width: 80px;
    }

    .step-progress {
        width: 80px;
    }

    .modern-select {
        min-width: 110px;
        font-size: 8px;
    }

    .nav-right {
        gap: 8px;
    }

    .inspired-by-badge { display: none !important; }

    .app-layout {
        grid-template-columns: 25% 1fr 20%;
    }

    .app-layout.hide-code-panel {
        grid-template-columns: 0px 1fr 20%;
    }

    .code-viewport {
        padding: 12px;
    }

    /* Array visualization — slightly tighter at zoom */
    .array-inner {
        gap: 12px;
        padding: 16px;
        max-width: min(92%, 700px);
    }
    .array-item {
        width: 52px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 17px;
        margin-top: 30px;
        margin-bottom: 26px;
        flex: 1 1 52px; max-width: 52px;
    }
    .array-visualization {
        gap: 8px;
        padding: 14px;
    }
    .pointer-label {
        font-size: 10px;
        padding: 4px 9px;
        top: -28px;
    }
    .pointer-label-pair { top: -28px; }
    .array-index {
        font-size: 9px;
        padding: 3px 7px;
        bottom: -24px;
    }
    .array-label {
        font-size: 12px;
    }
    .pointer-info {
        gap: 12px;
        padding: 12px;
    }
    .pointer-detail-label { font-size: 10px; }
    .pointer-detail-value { font-size: 15px; padding: 6px 10px; }

    /* Dual-row array at ~130% zoom */
    .array-inner.array-dual { gap: 8px; padding: 12px; }
    .array-inner.array-dual .array-visualization { padding: 8px 12px; min-height: 60px; gap: 6px; }
    .array-inner.array-dual .array-item {
        width: 39px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 39px; max-width: 39px;
        font-size: 14px; margin-top: 22px; margin-bottom: 18px;
    }
    .array-inner.array-dual .pointer-label { font-size: 8px; top: -20px; padding: 1px 5px; }
    .array-inner.array-dual .array-index { font-size: 8px; bottom: -16px; }
    .array-inner.array-dual .pointer-info { gap: 10px; padding: 10px; }
    .array-inner.array-dual .pointer-detail-label { font-size: 9px; }
    .array-inner.array-dual .pointer-detail-value { font-size: 13px; padding: 5px 8px; }
    .array-inner.array-dual .array-label { font-size: 10px; }

    /* Dense (9+ items) at ~130% zoom */
    .array-dense .array-item { width: 36px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 36px; max-width: 36px; font-size: 14px; margin-top: 24px; margin-bottom: 20px; border-radius: 8px; }
    .array-dense .array-visualization { gap: 6px; padding: 12px; }
    .array-dense .pointer-label { font-size: 8px; padding: 2px 6px; top: -22px; }
    .array-dense .array-index { font-size: 7px; padding: 2px 5px; bottom: -18px; }
}

/* ~150% zoom on 1440p, or ~125% on 1280p */
@media screen and (max-width: 960px) {
    .global-nav {
        padding: 6px 10px;
        gap: 6px;
    }
    .nav-left { gap: 6px; }
    .nav-right { gap: 6px; flex-shrink: 1; min-width: 0; }
    .logo-svg, .problem-page-logo-svg { height: 22px; }

    #problemListBtn {
        font-size: 7px !important;
        padding: 0 8px !important;
        height: 30px !important;
        width: 150px !important;
    }

    /* Search stays visible but narrower */
    .search-bar-wrapper {
        width: 110px;
        min-width: 70px;
        height: 30px;
    }
    .search-bar {
        height: 30px;
        font-size: 8px;
    }

    .algorithm-label { display: none; }
    .step-progress { display: none; }

    .modern-select {
        min-width: 90px;
        font-size: 8px;
        padding: 0 22px 0 8px;
        height: 30px;
    }

    .youtube-link { width: 30px; height: 30px; font-size: 14px; }
    .problem-nav-btn { width: 24px; height: 30px; font-size: 8px; }
    /* search-bar-wrapper height already set above at 30px */

    .app-layout {
        grid-template-columns: 25% 1fr 20%;
    }

    .app-layout.hide-code-panel {
        grid-template-columns: 0px 1fr 20%;
    }

    .app-layout.hide-right-panel {
        grid-template-columns: 28% 1fr !important;
    }

    /* Scale down code to fit narrower panel */
    .code-viewport {
        padding: 10px;
        font-size: 8px;
    }

    .line {
        padding: 3px 8px;
        margin: 1px 0;
    }

    /* Array visualization — medium at zoom */
    .array-inner {
        gap: 10px;
        padding: 14px;
        max-width: min(92%, 620px);
    }
    .array-item {
        width: 46px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 15px;
        margin-top: 28px;
        margin-bottom: 24px;
        border-radius: 8px;
        flex: 1 1 46px; max-width: 46px;
    }
    .array-visualization {
        gap: 6px;
        padding: 12px;
        min-height: 70px;
    }
    .pointer-label {
        font-size: 9px;
        padding: 3px 8px;
        top: -26px;
    }
    .pointer-label-pair { top: -26px; }
    .array-index {
        font-size: 8px;
        padding: 2px 6px;
        bottom: -22px;
    }
    .pointer-info {
        gap: 10px;
        padding: 10px;
    }
    .pointer-detail-label { font-size: 9px; }
    .pointer-detail-value { font-size: 14px; padding: 5px 8px; }

    /* Dual-row array at ~150% zoom */
    .array-inner.array-dual { gap: 6px; padding: 10px; }
    .array-inner.array-dual .array-visualization { padding: 6px 10px; min-height: 55px; gap: 5px; }
    .array-inner.array-dual .array-item {
        width: 35px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 35px; max-width: 35px;
        font-size: 13px; margin-top: 20px; margin-bottom: 18px; border-radius: 7px;
    }
    .array-inner.array-dual .pointer-label { font-size: 8px; top: -18px; padding: 1px 4px; }
    .array-inner.array-dual .array-index { font-size: 7px; bottom: -16px; }
    .array-inner.array-dual .pointer-info { gap: 8px; padding: 8px; }
    .array-inner.array-dual .pointer-detail-label { font-size: 8px; }
    .array-inner.array-dual .pointer-detail-value { font-size: 12px; padding: 4px 7px; }
    .array-inner.array-dual .array-label { font-size: 9px; }

    /* Dense (9+ items) at ~150% zoom */
    .array-dense .array-item { width: 32px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 32px; max-width: 32px; font-size: 12px; margin-top: 22px; margin-bottom: 18px; border-radius: 7px; }
    .array-dense .array-visualization { gap: 5px; padding: 10px; }
    .array-dense .pointer-label { font-size: 7px; padding: 2px 5px; top: -20px; }
    .array-dense .array-index { font-size: 7px; padding: 2px 4px; bottom: -16px; }
}

/* ~175% zoom on 1440p, or ~150% on 1280p */
@media screen and (max-width: 840px) {
    .control-info { display: none; }

    .global-nav {
        padding: 6px 10px;
        gap: 6px;
    }

    .nav-left { gap: 5px; }
    .nav-right {
        gap: 5px;
        flex-shrink: 1;
        min-width: 0;
    }

    .logo-svg, .problem-page-logo-svg { height: 20px; }

    #problemListBtn {
        font-size: 7px !important;
        padding: 0 8px !important;
        height: 30px !important;
        width: 130px !important;
    }

    .step-progress { display: none; }

    /* Search collapses to icon-only toggle */
    .search-bar-wrapper .search-bar {
        width: 0;
        padding: 0;
        border: none;
        opacity: 0;
        position: absolute;
    }
    .search-bar-wrapper {
        width: 30px;
        height: 30px;
        margin: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 7px;
    }
    .search-bar-wrapper i {
        position: static;
        transform: none;
        pointer-events: auto;
        font-size: 10px;
    }
    /* When search is expanded */
    .search-bar-wrapper.expanded {
        width: auto;
        height: 30px;
        position: relative;
    }
    .search-bar-wrapper.expanded .search-bar {
        width: 120px;
        padding: 0 27px 0 11px;
        height: 30px;
        border: 1px solid var(--border);
        opacity: 1;
        position: static;
        font-size: 8px;
    }
    .search-bar-wrapper.expanded i {
        position: absolute;
        right: 9px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

    /* Algorithm select — icon-width only */
    .algorithm-selector .modern-select {
        min-width: 70px;
        font-size: 7px;
        height: 30px;
    }    .step-numbers {
        font-size: 14px;
    }

    .step-label {
        font-size: 6px;
    }

    .app-layout {
        grid-template-columns: 28% 1fr 22%;
    }

    .app-layout.hide-code-panel {
        grid-template-columns: 0px 1fr 22%;
    }

    .app-layout.hide-right-panel {
        grid-template-columns: 28% 1fr !important;
    }

    /* Shrink code and stack panels */
    .code-viewport {
        font-size: 8px !important;
        padding: 8px !important;
    }

    .line {
        font-size: 8px;
        padding: 2px 6px;
        margin: 1px 0;
    }

    .stack-title {
        font-size: 10px;
    }

    .stat-label {
        font-size: 7px;
    }

    .stat-value {
        font-size: 16px;
    }

    /* Compact stack items at tight widths */
    .stack-stats-bar {
        padding: 6px 8px;
        gap: 3px;
    }

    .stack-stat {
        padding: 4px 2px;
    }

    .stack-stat-label {
        font-size: 7px;
    }

    .stack-stat-value {
        font-size: 15px;
    }

    .stack-viewport {
        padding: 4px 8px;
    }

    .stack-item {
        padding: 10px 4px 10px 10px;
    }

    .stack-function-name {
        font-size: 10px;
    }

    .stack-node-value {
        font-size: 9px;
        padding: 2px 8px;
    }

    .stack-details {
        gap: 8px;
    }

    .stack-detail {
        padding: 0;
    }

    .detail-label {
        font-size: 7px;
    }

    .detail-value {
        font-size: 8px;
    }

    .complexity-label {
        font-size: 7px;
    }

    .complexity-value {
        font-size: 10px;
    }

    /* Compact action bar — above console */
    .action-bar {
        padding: 4px 0;
    }

    .action-bar .control-btn {
        padding: 5px 8px;
        font-size: 10px;
    }

    .action-bar .control-btn span {
        font-size: 8px;
    }

    .action-bar .speed-btn { padding: 4px 6px !important; min-width: 28px; }
    .action-bar .speed-btn .speed-label { font-size: 9px; }
    .action-bar .testcase-select { font-size: 9px; padding: 4px 20px 4px 7px; max-width: 140px; }
    .action-bar .testcase-pill { margin-right: 4px; padding-right: 6px; }

    /* Console */
    .console-panel {
        min-height: 52px;
    }

    .console-text {
        font-size: 10px;
        padding: 8px 10px;
    }

    .console-header {
        padding: 6px 10px;
        font-size: 8px;
    }

    /* Array visualization — compact at 840px */
    .array-inner {
        gap: 8px;
        padding: 10px;
        max-width: min(92%, 500px);
    }
    .array-item {
        width: 36px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 13px;
        margin-top: 24px;
        margin-bottom: 20px;
        border-radius: 7px;
        border-width: 1.5px;
        flex: 1 1 36px; max-width: 36px;
    }
    .array-visualization {
        gap: 4px;
        padding: 8px;
        min-height: 55px;
    }
    .pointer-label {
        font-size: 8px;
        padding: 2px 6px;
        top: -22px;
    }
    .pointer-label-pair { top: -22px; }
    .array-index {
        font-size: 7px;
        padding: 2px 5px;
        bottom: -20px;
    }
    .array-label { font-size: 10px; }
    .pointer-info {
        gap: 6px;
        padding: 8px;
    }
    .pointer-detail-label { font-size: 8px; }
    .pointer-detail-value { font-size: 12px; padding: 4px 7px; }

    /* Dual-row array at ~175% zoom */
    .array-inner.array-dual { gap: 5px; padding: 7px; }
    .array-inner.array-dual .array-visualization { padding: 5px 8px; min-height: 44px; gap: 4px; }
    .array-inner.array-dual .array-item {
        width: 28px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 28px; max-width: 28px;
        font-size: 11px; margin-top: 18px; margin-bottom: 16px; border-radius: 5px; border-width: 1.5px;
    }
    .array-inner.array-dual .pointer-label { font-size: 7px; top: -16px; padding: 1px 3px; }
    .array-inner.array-dual .array-index { font-size: 6px; bottom: -14px; }
    .array-inner.array-dual .pointer-info { gap: 5px; padding: 6px; }
    .array-inner.array-dual .pointer-detail-label { font-size: 7px; }
    .array-inner.array-dual .pointer-detail-value { font-size: 10px; padding: 3px 5px; }
    .array-inner.array-dual .array-label { font-size: 8px; }
    .array-inner.array-dual .array-section { gap: 3px; }

    /* Dense (9+ items) at ~175% zoom */
    .array-dense .array-item { width: 26px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 26px; max-width: 26px; font-size: 10px; margin-top: 18px; margin-bottom: 16px; border-radius: 5px; border-width: 1.5px; }
    .array-dense .array-visualization { gap: 3px; padding: 6px; }
    .array-dense .pointer-label { font-size: 7px; padding: 1px 4px; top: -16px; }
    .array-dense .array-index { font-size: 6px; padding: 2px 3px; bottom: -14px; }

    /* Sum bridge at 840px */
    .sum-bridge-label { font-size: 11px; padding: 4px 10px; gap: 4px; }
    .sum-bridge-result { font-size: 13px; }
    .move-hint { font-size: 9px; padding: 2px 6px; }
}

/* ~200% zoom on 1440p — ultra-compact desktop, NOT mobile */
@media screen and (max-width: 768px) and (hover: hover) and (pointer: fine) {
    .global-nav {
        padding: 6px 8px;
        gap: 6px;
    }

    .logo-svg, .problem-page-logo-svg { height: 22px; }

    .nav-left {
        gap: 4px;
    }

    /* Search stays as compact icon */
    .search-bar-wrapper {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .search-bar-wrapper i {
        font-size: 9px;
    }
    .search-bar-wrapper.expanded { height: 28px; }
    .search-bar-wrapper.expanded .search-bar {
        width: 120px;
        height: 28px;
        font-size: 8px;
    }

    #problemListBtn {
        width: 130px !important;
        padding: 0 8px !important;
        height: 28px !important;
        font-size: 7px;
    }

    .youtube-link { width: 28px; height: 28px; font-size: 12px; }
    .problem-nav-btn { width: 22px; height: 28px; font-size: 8px; }

    .nav-right {
        display: flex;
        gap: 4px;
        flex-shrink: 1;
        min-width: 0;
    }

    /* Algorithm selector — ultra compact */
    .algorithm-selector .modern-select {
        min-width: 60px;
        font-size: 7px;
        padding: 0 18px 0 6px;
        height: 28px;
    }

    .step-numbers {
        font-size: 12px;
    }

    .step-label {
        font-size: 5px;
    }

    .app-layout {
        grid-template-columns: 25% 1fr 22%;
    }

    .app-layout.hide-code-panel {
        grid-template-columns: 0px 1fr 22%;
    }

    .app-layout.hide-right-panel {
        grid-template-columns: 28% 1fr !important;
    }

    /* Ultra-compact code */
    .code-viewport {
        font-size: 7px !important;
        padding: 6px !important;
        line-height: 1.4 !important;
    }

    .line {
        font-size: 7px;
        padding: 1px 4px;
        margin: 0;
    }

    .module-header {
        padding: 6px 8px;
    }

    .module-label {
        font-size: 7px;
    }

    .language-badge, .depth-badge {
        font-size: 6px;
        padding: 2px 5px;
    }

    /* Ultra-compact stack */
    .stack-stats-bar {
        padding: 4px 6px;
        gap: 2px;
    }

    .stack-stat {
        padding: 3px 2px;
    }

    .stack-stat-label {
        font-size: 6px;
    }

    .stack-stat-value {
        font-size: 13px;
    }

    .stack-viewport {
        padding: 2px 6px;
    }

    .stack-item {
        padding: 6px 4px 6px 10px;
        border-radius: 0;
    }

    .stack-function-name {
        font-size: 8px;
    }

    .stack-node-value {
        font-size: 7px;
        padding: 1px 6px;
    }

    .stack-header-row {
        margin-bottom: 4px;
    }

    .stack-details {
        gap: 6px;
        margin-top: 4px;
    }

    .stack-detail {
        padding: 0;
    }

    .detail-label {
        font-size: 5px;
    }

    .detail-value {
        font-size: 7px;
    }

    /* Ultra-compact console */
    .console-panel {
        min-height: 40px;
    }

    .console-header {
        padding: 4px 8px;
        font-size: 7px;
    }

    .console-text {
        font-size: 9px;
        padding: 6px 8px;
    }

    /* Compact action bar */
    .action-bar {
        padding: 3px 0;
    }

    .action-bar .control-btn {
        padding: 4px 6px;
        font-size: 9px;
        border-radius: 6px;
    }

    .action-bar .control-btn span {
        font-size: 7px;
    }

    .action-bar .speed-btn { padding: 3px 5px !important; min-width: 24px; }
    .action-bar .speed-btn .speed-label { font-size: 8px; }
    .action-bar .testcase-select { font-size: 8px; padding: 3px 18px 3px 6px; max-width: 120px; }
    .action-bar .testcase-pill { margin-right: 3px; padding-right: 5px; }

    /* Compact complexity info */
    .code-info {
        padding: 4px 8px;
    }

    .complexity-label {
        font-size: 6px;
    }

    .complexity-value {
        font-size: 9px;
    }

    /* Stack legend */
    .stack-legend {
        padding: 6px 8px;
        gap: 8px;
    }

    .legend-item span {
        font-size: 6px;
    }

    /* Toggle buttons — keep both visible on desktop zoom */
    .code-toggle-btn {
        display: flex;
        width: 20px;
        height: 40px;
        font-size: 8px;
    }
    .code-toggle-btn .toggle-label {
        font-size: 6px;
    }
    .stack-toggle-btn {
        display: flex;
        width: 20px;
        height: 40px;
        font-size: 8px;
    }
    .stack-toggle-btn .toggle-label {
        font-size: 6px;
    }

    /* Array visualization — ultra compact at 200% zoom */
    .array-inner {
        gap: 6px;
        padding: 6px;
        max-width: min(92%, 420px);
    }
    .array-item {
        width: 30px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 11px;
        margin-top: 20px;
        margin-bottom: 18px;
        border-radius: 5px;
        border-width: 1px;
        flex: 1 1 30px; max-width: 30px;
    }
    .array-visualization {
        gap: 3px;
        padding: 6px;
        min-height: 44px;
    }
    .pointer-label {
        font-size: 7px;
        padding: 2px 4px;
        top: -18px;
        border-width: 1px;
    }
    .pointer-label-pair { top: -18px; }
    .array-index {
        font-size: 6px;
        padding: 2px 4px;
        bottom: -18px;
        border-width: 1px;
    }
    .array-label { font-size: 9px; }
    .array-section { gap: 4px; }
    .pointer-info {
        gap: 4px;
        padding: 6px;
    }
    .pointer-detail-label { font-size: 7px; }
    .pointer-detail-value { font-size: 10px; padding: 3px 5px; }

    /* Dual-row array at ~200% zoom */
    .array-inner.array-dual { gap: 4px; padding: 5px; }
    .array-inner.array-dual .array-visualization { padding: 4px 6px; min-height: 36px; gap: 3px; }
    .array-inner.array-dual .array-item {
        width: 24px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 24px; max-width: 24px;
        font-size: 9px; margin-top: 16px; margin-bottom: 14px; border-radius: 4px; border-width: 1px;
    }
    .array-inner.array-dual .pointer-label { font-size: 6px; top: -14px; padding: 1px 3px; border-width: 1px; }
    .array-inner.array-dual .array-index { font-size: 5px; bottom: -12px; border-width: 1px; }
    .array-inner.array-dual .pointer-info { gap: 3px; padding: 4px; }
    .array-inner.array-dual .pointer-detail-label { font-size: 6px; }
    .array-inner.array-dual .pointer-detail-value { font-size: 9px; padding: 2px 4px; }
    .array-inner.array-dual .array-label { font-size: 7px; }
    .array-inner.array-dual .array-section { gap: 3px; }

    /* Dense (9+ items) at ~200% zoom */
    .array-dense .array-item { width: 22px; min-width: 0; height: auto; aspect-ratio: 1; flex: 1 1 22px; max-width: 22px; font-size: 9px; margin-top: 14px; margin-bottom: 12px; border-radius: 4px; border-width: 1px; }
    .array-dense .array-visualization { gap: 2px; padding: 5px; }
    .array-dense .pointer-label { font-size: 6px; padding: 1px 3px; top: -12px; border-width: 1px; }
    .array-dense .array-index { font-size: 5px; padding: 1px 3px; bottom: -12px; border-width: 1px; }

    /* Sum bridge at 768px fine pointer */
    .sum-bridge-label { font-size: 10px; padding: 3px 8px; gap: 3px; }
    .sum-bridge-result { font-size: 12px; }
    .sum-bridge-cmp { font-size: 10px; }
    .move-hint { font-size: 8px; padding: 2px 5px; }
}

/* ===== RESPONSIVE LAYOUT – MOBILE ONLY (touch devices or truly small screens) ===== */

@media screen and (max-width: 768px) and (hover: none),
       screen and (max-width: 768px) and (pointer: coarse),
       screen and (max-width: 600px) {

    :root {
        --node-size: 80px;
    }

    .node {
        font-size: 30px;
        font-weight: 800;
    }

    .task-label {
        font-size: 16px;
        gap: 4px;
    }
    .task-label span {
        padding: 5px 10px;
        border-radius: 5px;
    }

    /* ---- Global nav: compact ---- */
    .global-nav {
        padding: 6px 10px;
    }
    .nav-left {
        gap: 6px;
        flex: 1;
    }
    .logo-svg, .problem-page-logo-svg { height: 18px; }
    .search-bar-wrapper { display: none; }
    /* Hide desktop-only nav-right items but keep the container for hamburger */
    .nav-right {
        display: flex !important;
        gap: 6px;
    }
    .nav-right .inspired-by-badge,
    .nav-right .algorithm-selector,
    .nav-right .nav-auth-wrapper { display: none !important; }
    /* Show hamburger on mobile */
    .hamburger-btn { display: flex !important; width: 30px; height: 30px; border-radius: 7px; }
    .hamburger-icon { width: 14px; gap: 3px; }
    .hamburger-icon span { height: 1.5px; }
    /* Show drawer on mobile */
    .hamburger-overlay { display: none; }
    .hamburger-drawer { display: flex; }
    /* Hide youtube, home, notes on mobile — accessible via hamburger drawer instead */
    .youtube-link { display: none !important; }
    .nav-home-btn { display: none !important; }
    .nav-notes-btn { display: none !important; }
    .problem-nav-btn { width: 28px; height: 30px; font-size: 9px; }
    .problem-nav-group { flex: 1; min-width: 0; }
    .problem-nav-group #problemListBtn { width: auto !important; max-width: none !important; flex: 1; }

    /* Hide problem page stats on mobile */
    .problem-page-stats { display: none; }

    /* ---- Problem list: clean mobile cards ---- */
    .problem-card-inner {
        padding: 12px 14px;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 0;
    }
    .problem-card:hover .problem-card-inner,
    .problem-card:active .problem-card-inner {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.05);
    }
    .problem-card-name {
        font-size: 14px;
        line-height: 1.4;
    }
    .problem-card-meta {
        gap: 6px;
        margin-top: 2px;
    }
    .difficulty-badge {
        display: none !important;
    }
    .problem-card-tags-inline {
        font-size: 10px;
    }
    .problem-card-inspired {
        font-size: 10px;
    }
    .problem-card-arrow svg {
        width: 12px;
        height: 12px;
    }
    .problem-list {
        gap: 0;
    }

    #problemListBtn {
        height: 30px !important;
        padding: 0 12px !important;
        font-size: 10px !important;
        max-width: 60% !important;
        flex: 0 1 auto !important;
        min-width: 0 !important;
        width: 60% !important;
    }

    /* ---- Landing page: reduce hero height on mobile ---- */
    .landing-hero {
        min-height: 80vh;
        padding: 40px 20px 32px;
    }
    .space-game-canvas {
        display: none !important;
    }
    .landing-hero .landing-hero-content {
        pointer-events: auto;
    }

    /* ---- Action bar: hide on mobile (floating pill replaces) ---- */
    .action-bar {
        display: none !important;
    }

    /* ---- Keyboard hints: hide ---- */
    .keyboard-hint {
        display: none !important;
    }

    /* ---- App layout: flex column ---- */
    .app-layout {
        display: flex !important;
        flex-direction: column !important;
        position: fixed;
        top: 44px;
        bottom: 60px;
        left: 0;
        right: 0;
        overflow: hidden;
        gap: 0;
    }

    /* ---- Code module: compact top panel when visible ---- */
    .app-layout.hide-code-panel .code-module,
    .app-layout .code-module {
        order: 1;
        width: 100% !important;
        max-height: 0;
        min-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease, min-height 0.3s ease;
        flex-shrink: 0;
        border-bottom: none;
        opacity: 0 !important;
        pointer-events: none !important;
        padding: 0 !important;
    }
    .app-layout.hide-code-panel .code-module.mobile-visible,
    .app-layout .code-module.mobile-visible {
        max-height: 35%;
        min-height: 30% !important;
        overflow-y: auto !important;
        flex-shrink: 0;
        border-bottom: 1px solid var(--border);
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    /* Hide complexity info on mobile to save space */
    .code-module .code-info {
        padding: 6px 10px;
    }
    .code-module .complexity-info {
        gap: 12px;
    }
    .code-module .complexity-label {
        font-size: 7px;
    }
    .code-module .complexity-value {
        font-size: 10px;
    }
    .code-viewport {
        font-size: 12px !important;
        line-height: 1.5 !important;
        padding: 8px 10px !important;
        overflow-y: auto !important;
    }
    /* Tighter code lines on mobile */
    .line {
        padding: 2px 8px !important;
        margin: 0 !important;
    }

    /* ---- Viz module: fills remaining space ---- */
    .viz-module {
        order: 2;
        flex: 1 1 0% !important;
        width: 100% !important;
        min-height: 0;
        position: relative;
        overflow: hidden;
        display: flex !important;
        flex-direction: column !important;
    }

    .render-engine {
        flex: 1 1 0%;
        min-height: 0;
        overflow: hidden;
        overflow-y: auto;
    }

    /* ---- Stack module: compact bottom panel when visible ---- */
    .stack-module {
        order: 3;
        width: 100% !important;
        max-height: 0;
        min-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, min-height 0.3s ease;
        flex-shrink: 0;
        display: flex !important;
        border-top: 1px solid var(--border);
    }
    .stack-module.mobile-visible {
        max-height: 38%;
        min-height: 30%;
        overflow-y: auto;
        flex-shrink: 0;
    }

    /* ---- Toggle buttons on mobile: HIDDEN — moved to ⋯ popover ---- */
    .code-toggle-btn {
        display: none !important;
    }

    .stack-toggle-btn {
        display: none !important;
    }

    /* ---- Mobile Algorithm/Testcase Selectors: HIDDEN — moved to ⋯ popover ---- */
    .mobile-algo-selector {
        display: none !important;
    }
    .mobile-testcase-selector {
        display: none !important;
    }

    /* ---- Mobile More (⋯) Button — single button top-right of viz ---- */
    .mobile-more-btn {
        display: flex;
        position: absolute;
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        color: var(--text-secondary);
        cursor: pointer;
        z-index: 30;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 2px;
        transition: background 0.15s, color 0.15s;
        -webkit-tap-highlight-color: transparent;
        padding: 0;
        line-height: 1;
    }
    .mobile-more-btn:active {
        background: var(--bg-card-light);
        color: var(--text-primary);
    }

    /* ---- Mobile More Popover ---- */
    .mobile-more-popover {
        display: none;
        position: absolute;
        top: 46px;
        right: 8px;
        z-index: 35;
        background: var(--bg-card, #161616);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px;
        min-width: 180px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
        flex-direction: column;
        gap: 4px;
        animation: morePopIn 0.15s ease-out;
    }
    .mobile-more-popover.show {
        display: flex;
    }
    @keyframes morePopIn {
        from { opacity: 0; transform: translateY(-6px) scale(0.96); }
        to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    .more-pop-item {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 9px 12px;
        border: none;
        border-radius: 7px;
        background: none;
        color: var(--text-secondary);
        font-size: 12.5px;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        transition: all 0.12s ease;
        text-align: left;
        -webkit-tap-highlight-color: transparent;
    }
    .more-pop-item:active,
    .more-pop-item:hover {
        background: rgba(255, 255, 255, 0.06);
        color: var(--text-primary);
    }
    .more-pop-item i {
        width: 16px;
        text-align: center;
        font-size: 12px;
        flex-shrink: 0;
    }
    .more-pop-item .more-pop-label {
        flex: 1;
    }
    .more-pop-divider {
        height: 1px;
        background: var(--border);
        margin: 2px 4px;
    }

    /* Popover select styling */
    .more-pop-select-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
    }
    .more-pop-select-label {
        font-size: 10px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        min-width: 55px;
    }
    .more-pop-select {
        flex: 1;
        background: rgba(0, 0, 0, 0.25);
        border: 1px solid var(--border);
        color: var(--text-primary);
        font-size: 11px;
        padding: 6px 24px 6px 8px;
        border-radius: 6px;
        appearance: none;
        cursor: pointer;
        font-family: inherit;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 6px center;
        min-width: 0;
    }

    /* ---- Array sections on mobile ---- */
    .array-container {
        gap: 0;
        padding: 8px 10px;
        padding-top: 56px;
        align-items: flex-start;
        justify-content: center;
    }
    .array-inner {
        gap: 12px;
        padding: 0 4px;
        max-width: 100%;
    }
    .array-section {
        gap: 6px;
        padding-top: 0;
    }
    .array-visualization {
        gap: 8px;
        row-gap: 32px;
        padding: 12px 10px;
        min-height: 80px;
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: center;
    }
    .array-item {
        width: 44px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 16px;
        margin-top: 28px;
        margin-bottom: 26px;
        border-radius: 7px;
        flex: 1 1 44px; max-width: 44px;
    }
    .array-index {
        font-size: 9px;
        padding: 3px 6px;
        bottom: -24px;
    }
    .pointer-label {
        font-size: 10px;
        padding: 3px 8px;
        top: -26px;
    }
    .pointer-label-pair { top: -26px; }
    .array-label {
        font-size: 9px;
        margin-bottom: 0;
    }

    /* Dense arrays (8+ items) — shrink to avoid wrapping */
    .array-dense .array-item {
        width: 32px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 12px;
        margin-top: 22px;
        margin-bottom: 20px;
        border-radius: 5px;
        flex: 1 1 32px; max-width: 32px;
    }
    .array-dense .array-visualization {
        gap: 3px;
        row-gap: 24px;
        padding: 8px 4px;
    }
    .array-dense .pointer-label {
        font-size: 7px;
        padding: 2px 5px;
        top: -20px;
    }
    .array-dense .pointer-label-pair { top: -20px; }
    .array-dense .array-index {
        font-size: 6px;
        padding: 2px 4px;
        bottom: -18px;
    }

    /* Dual-row array problems on mobile — prevent wrapping, rely on dense sizing */
    .array-dual {
        gap: 6px !important;
        padding: 0 2px !important;
    }
    .array-dual .array-section {
        gap: 2px;
    }
    .array-dual .array-label {
        font-size: 8px;
        letter-spacing: 0.6px;
    }
    .array-dual .array-visualization {
        flex-wrap: nowrap !important;
        overflow: hidden;
        min-height: auto;
        border-radius: 6px;
    }
    .array-dual.array-dense .array-item {
        width: 34px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 12px;
        margin-top: 18px;
        margin-bottom: 16px;
        border-radius: 5px;
        border-width: 1.5px;
        flex: 1 1 34px; max-width: 34px;
    }
    .array-dual.array-dense .array-visualization {
        gap: 3px;
        padding: 6px 4px;
    }
    .array-dual.array-dense .pointer-label {
        font-size: 7px;
        padding: 1px 4px;
        top: -16px;
    }
    .array-dual.array-dense .pointer-label-pair { top: -16px; }
    .array-dual.array-dense .array-index {
        font-size: 6px;
        padding: 2px 3px;
        bottom: -14px;
    }
    .array-dual .pointer-info {
        gap: 4px;
        padding: 4px 6px;
        margin-top: 0;
    }
    .array-dual .pointer-detail-label {
        font-size: 6px;
    }
    .array-dual .pointer-detail-value {
        font-size: 9px;
        padding: 2px 5px;
    }

    .pointer-info {
        gap: 6px;
        padding: 5px 8px;
        margin-top: 2px;
        border-radius: 7px;
    }
    .pointer-detail {
        gap: 3px;
    }
    .pointer-detail-label {
        font-size: 7px;
        letter-spacing: 0.3px;
    }
    .pointer-detail-value {
        font-size: 10px;
        padding: 3px 6px;
        border-radius: 5px;
        border-width: 1px;
    }

    /* Sum bridge on mobile */
    .sum-bridge { margin-top: 0; }
    .sum-bridge-label { font-size: 10px; padding: 4px 8px; gap: 4px; }
    .sum-bridge-result { font-size: 12px; }
    .sum-bridge-cmp { font-size: 9px; }
    .move-hint { font-size: 8px; padding: 2px 5px; }

    /* ---- YouTube modal: full screen on mobile ---- */
    .youtube-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-left: none !important;
        border-radius: 0 !important;
    }
    .youtube-modal-header {
        padding: 20px 20px 16px;
    }
    .youtube-modal-header h3 {
        font-size: 18px;
    }
    .video-card {
        padding: 16px 0;
    }
    .video-title {
        font-size: 14px;
    }
    .video-reason {
        font-size: 12px;
    }
    .video-card-icon {
        font-size: 12px;
    }
    .youtube-modal-body {
        padding: 8px 20px 80px;
    }

    /* ---- Mobile bottom nav bar → floating pill ---- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 16px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        z-index: 2100;
        justify-content: center;
        align-items: center;
        gap: 2px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.08);
        max-width: calc(100vw - 20px);
    }
    .mobile-bottom-nav .control-btn {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        background: none;
        color: #242424;
        border: none;
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 13px;
        cursor: pointer;
        transition: all 0.15s;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 1;
        min-width: 0;
    }
    .mobile-bottom-nav .control-btn span {
        font-size: 12px;
        font-weight: 700;
        color: #242424;
    }
    .mobile-bottom-nav .control-btn.primary,
    .mobile-bottom-nav .control-btn.primary span,
    .mobile-bottom-nav .control-btn.secondary,
    .mobile-bottom-nav .control-btn.secondary span {
        color: #242424;
    }
    .mobile-bottom-nav .control-btn:active {
        transform: scale(0.92);
        background: rgba(0, 0, 0, 0.07);
        color: #242424;
    }
    .mobile-bottom-nav .control-btn:active span {
        color: #242424;
    }
    .mobile-bottom-nav .control-btn:hover:not(:disabled) {
        background: rgba(0, 0, 0, 0.05);
        color: #242424;
    }
    .mobile-bottom-nav .control-btn:hover:not(:disabled) span {
        color: #242424;
    }
    .mobile-bottom-nav .control-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }
    .mobile-bottom-nav .speed-btn { padding: 6px 8px !important; min-width: 32px; }
    .mobile-bottom-nav .speed-btn .speed-label { font-size: 12px; font-weight: 800; }

    /* ---- Problem badge: hide on mobile ---- */
    .problem-badge { display: none; }

    /* ---- Console on mobile: sits at bottom of viz, above pill ---- */
    .console-panel {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        width: 100%;
        min-height: auto;
        max-height: none;
        z-index: 15;
        background: rgba(0, 0, 0, 0.95);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0;
        flex-shrink: 0;
    }
    .console-header {
        display: none;
    }
    .console-text {
        font-size: 13px;
        padding: 10px 14px;
        max-height: none;
        overflow-y: hidden;
        line-height: 1.3;
    }
    .console-line {
        padding: 4px 8px;
        margin-bottom: 0;
        font-size: 10px;
    }

    /* Queue visible on mobile (stack panel hidden) */
    .queue-container {
        display: flex !important;
        bottom: 13px;
    }

    /* ── Problem 8 mobile compact ── */
    .array-inner.cy-compact {
        gap: 4px;
        padding: 8px 10px 6px;
    }
    .cy-compact .array-label {
        font-size: 10px;
    }
    .cy-compact .cy-blueprint {
        margin: 0 0 2px;
        gap: 3px;
    }
    .cy-compact .cy-bp-step {
        padding: 2px 6px;
        border-radius: 5px;
    }
    .cy-compact .cy-bp-num {
        font-size: 10px;
    }
    .cy-compact .cy-bp-text {
        font-size: 9px;
    }
    .cy-compact .cy-bp-arrow {
        font-size: 10px;
    }
    .cy-compact .cy-why {
        font-size: 10px;
        padding: 3px 8px;
        margin: 0 auto 2px;
        max-width: 100%;
    }
    .cy-compact .cy-reverse-call {
        font-size: 9px;
        padding: 2px 8px;
        margin: 1px auto 3px;
    }
    .cy-compact .array-visualization {
        padding: 4px 6px;
        min-height: 50px;
        gap: 4px;
    }
    .cy-compact .array-item {
        width: 36px;
        height: 36px;
        flex: 1 1 36px;
        max-width: 36px;
        font-size: 13px;
        border-radius: 8px;
        margin-top: 18px;
        margin-bottom: 16px;
    }
    .cy-compact .pointer-label {
        top: -16px;
        font-size: 7.5px;
        padding: 1px 4px;
    }
    .cy-compact .array-index {
        font-size: 7px;
        bottom: -14px;
    }
    .cy-compact .cy-ghost-target {
        margin-top: 2px;
        gap: 1px;
    }
    .cy-compact .cy-ghost-cell {
        width: 20px !important;
        height: 20px !important;
        font-size: 9px !important;
        margin: 0 0 8px 0 !important;
    }
    .cy-compact .cy-ghost-label {
        font-size: 0.6em;
    }
    .cy-compact .cy-ghost-cell .array-index {
        font-size: 6px !important;
    }
    .cy-compact .pointer-info {
        margin-top: 2px;
        padding: 4px 8px;
        gap: 8px;
    }
    .cy-compact .pointer-detail-label {
        font-size: 7px;
    }
    .cy-compact .pointer-detail-value {
        font-size: 10px;
        padding: 2px 5px;
    }
    .cy-compact .sum-bridge {
        margin: 2px 0 0;
        padding: 4px 8px;
    }
    .cy-compact .cy-swap-over,
    .cy-compact .cy-swap-under {
        --lift: -34px;
        --drop: 34px;
    }
    .cy-compact .cy-insight-btn {
        width: 15px;
        height: 15px;
        font-size: 9px;
    }
}

/* Small mobile - 480px and below */
@media screen and (max-width: 480px) {
    .array-item {
        width: 36px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 13px;
        margin-top: 24px;
        margin-bottom: 22px;
        flex: 1 1 36px; max-width: 36px;
    }
    .array-visualization {
        gap: 6px;
        row-gap: 28px;
        padding: 10px 8px;
        min-height: 64px;
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: center;
    }
    .pointer-label {
        font-size: 7px;
        padding: 2px 5px;
        top: -20px;
    }
    .pointer-label-pair { top: -20px; }
    .array-index {
        font-size: 7px;
        padding: 2px 4px;
        bottom: -18px;
    }

    /* Dense arrays (8+ items) — even smaller on tiny screens */
    .array-dense .array-item {
        width: 26px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 10px;
        margin-top: 18px;
        margin-bottom: 16px;
        flex: 1 1 26px; max-width: 26px;
    }
    .array-dense .array-visualization {
        gap: 2px;
        row-gap: 20px;
        padding: 6px 3px;
    }
    .array-dense .pointer-label {
        font-size: 6px;
        padding: 1px 4px;
        top: -16px;
    }
    .array-dense .pointer-label-pair { top: -16px; }
    .array-dense .array-index {
        font-size: 5px;
        padding: 1px 3px;
        bottom: -14px;
    }

    /* Dual-row on tiny screens — even smaller dense items */
    .array-dual.array-dense .array-item {
        width: 28px;
        min-width: 0;
        height: auto;
        aspect-ratio: 1;
        font-size: 10px;
        margin-top: 14px;
        margin-bottom: 14px;
        border-radius: 4px;
        flex: 1 1 28px; max-width: 28px;
    }
    .array-dual.array-dense .array-visualization {
        gap: 2px;
        padding: 4px 3px;
    }
    .array-dual.array-dense .array-index {
        font-size: 5px;
        bottom: -12px;
    }
    .array-dual.array-dense .pointer-label {
        font-size: 6px;
        padding: 1px 3px;
        top: -12px;
    }
    .array-dual.array-dense .pointer-label-pair { top: -12px; }
    .array-dual .array-index {
        font-size: 5px;
        bottom: -12px;
    }
    .array-dual .pointer-label {
        font-size: 6px;
        padding: 1px 3px;
        top: -12px;
    }
    .array-dual .pointer-label-pair { top: -12px; }

    .pointer-info {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px 6px;
        border-radius: 6px;
    }
    .pointer-detail {
        min-width: 70px;
        gap: 2px;
    }
    .pointer-detail-label {
        font-size: 6px;
    }
    .pointer-detail-value {
        font-size: 9px;
        padding: 3px 5px;
        border-radius: 4px;
        border-width: 1px;
    }

    /* ── Problem 8 tiny mobile ── */
    .cy-compact .array-item {
        width: 30px;
        height: 30px;
        flex: 1 1 30px;
        max-width: 30px;
        font-size: 11px;
        margin-top: 16px;
        margin-bottom: 14px;
        border-radius: 7px;
        border-width: 1.5px;
    }
    .cy-compact .cy-why {
        font-size: 9px;
        line-height: 1.35;
        padding: 2px 6px;
    }
    .cy-compact .cy-reverse-call {
        font-size: 8px;
        padding: 1px 6px;
        margin: 0 auto 2px;
    }
    .cy-compact .cy-bp-step {
        padding: 2px 5px;
        border-width: 1px;
    }
    .cy-compact .cy-bp-num {
        font-size: 9px;
    }
    .cy-compact .cy-bp-text {
        font-size: 8px;
    }
    .cy-compact .cy-ghost-cell {
        width: 18px !important;
        height: 18px !important;
        font-size: 7px !important;
        border-width: 1px !important;
        margin: 0 !important;
    }
    .cy-compact .cy-ghost-cell .array-index {
        display: none !important;
    }
    .cy-compact .pointer-label {
        top: -14px;
        font-size: 6.5px;
    }
    .cy-compact .array-index {
        font-size: 6px;
        bottom: -12px;
    }
    .cy-compact .cy-swap-over,
    .cy-compact .cy-swap-under {
        --lift: -30px;
        --drop: 30px;
    }
}

/* ===== RESPONSIVE – DESKTOP PROPORTIONAL SCALING ===== */

/* --- Standard Desktop: 1200px – 1439px --- */
@media screen and (min-width: 1200px) and (max-width: 1439px) {
    html { font-size: clamp(14px, 1.05vw, 18px); }

    /* Nav */
    .global-nav { padding: 12px 20px; gap: 14px; }
    .logo-svg, .problem-page-logo-svg { height: 28px; }
    .search-bar-wrapper { width: 200px; }
    .search-bar { font-size: 11px; height: 36px; }
    .modern-select { font-size: 11px; height: 36px; min-width: 150px; }
    .youtube-link { width: 36px; height: 36px; font-size: 16px; }
    .problem-nav-btn { width: 32px; height: 36px; font-size: 11px; }
    .nav-home-btn { width: 36px; height: 36px; font-size: 16px; }
    .nav-auth-btn { width: 36px; height: 36px; font-size: 13px; }
    .algorithm-label { font-size: 10px; }
    #problemListBtn { font-size: 11px !important; height: 36px !important; width: 220px !important; }

    /* App layout */
    .app-layout {
        grid-template-columns: minmax(0, 26%) 1fr minmax(0, 22%);
    }

    /* Code module */
    .code-viewport { font-size: 11px; padding: 16px; line-height: 1.6; }
    .line { padding: 5px 12px; margin: 2px 0; font-size: 11px; }
    .module-label { font-size: 10px; }
    .language-badge, .depth-badge { font-size: 9px; padding: 3px 9px; }
    .complexity-label { font-size: 9px; }
    .complexity-value { font-size: 12px; }
    .code-info { padding: 12px 14px; }

    /* Viz module */
    .action-bar { padding: 7px 0; gap: 3px; }
    .control-btn { padding: 9px 14px; font-size: 14px; }
    .control-btn span { font-size: 11px; }
    .speed-btn .speed-label { font-size: 12px; }
    .console-text { font-size: 13px; padding: 14px; }
    .console-panel { min-height: 85px; }

    /* Stack module */
    .stack-controls { font-size: 10px; padding: 9px 13px; }
    .stack-stat-label { font-size: 10px; }
    .stack-stat-value { font-size: 20px; }
    .stack-stat { padding: 9px 5px; }
    .stack-function-name { font-size: 13px; }
    .stack-node-value { font-size: 11px; padding: 3px 11px; }
    .detail-label { font-size: 10px; }
    .detail-value { font-size: 11px; }
    .stack-legend { padding: 11px 13px; gap: 18px; }
    .legend-item span { font-size: 9px; }

    /* Code & stack toggles */
    .code-toggle-btn { width: 30px; height: 54px; }
    .code-toggle-btn .toggle-label { font-size: 9px; }
    .stack-toggle-btn { width: 30px; height: 54px; }
    .stack-toggle-btn .toggle-label { font-size: 9px; }

    /* Array visualization */
    .array-inner { max-width: min(94%, 900px); }
    .array-item { width: 64px; min-width: 0; height: auto; aspect-ratio: 1; font-size: 20px; flex: 1 1 64px; max-width: 64px; }
    .array-visualization { gap: 12px; padding: 20px; }
    .pointer-label { font-size: 11px; padding: 4px 9px; }
    .array-index { font-size: 10px; padding: 3px 7px; }
    .array-label { font-size: 13px; }

    /* Queue */
    .queue-item .qi-val { font-size: 15px; }
    .queue-item .qi-depth { font-size: 9px; }
    .queue-label { font-size: 9px; }

    /* Problem page */
    .problem-page-heading { font-size: 24px; }
    .problem-page-subtitle { font-size: 13px; }
    .problem-search-bar input { font-size: 14px; padding: 12px 16px 12px 42px; }
    .filter-btn { font-size: 12px; padding: 7px 15px; }
    .problem-card-inner { padding: 16px 18px; }
    .problem-card-name { font-size: 14.5px; }
    .problem-card-number { width: 22px; height: 22px; font-size: 10px; }
    .problem-tag { font-size: 10.5px; padding: 3px 9px; }
}

/* --- Large Desktop: 1440px – 1919px --- */
@media screen and (min-width: 1440px) and (max-width: 1919px) {
    html { font-size: clamp(15px, 1.1vw, 20px); }

    /* Nav */
    .global-nav { padding: 13px 24px; gap: 16px; }
    .logo-svg, .problem-page-logo-svg { height: 28px; }
    .search-bar-wrapper { width: 220px; min-width: 160px; }
    .search-bar { font-size: 12px; height: 38px; }
    .modern-select { font-size: 12px; height: 38px; min-width: 160px; padding: 0 30px 0 13px; }
    .youtube-link { width: 38px; height: 38px; font-size: 17px; }
    .problem-nav-btn { width: 34px; height: 38px; font-size: 12px; }
    .nav-home-btn { width: 38px; height: 38px; font-size: 17px; }
    .nav-auth-btn { width: 38px; height: 38px; font-size: 14px; }
    .algorithm-label { font-size: 11px; }
    #problemListBtn { font-size: 12px !important; height: 38px !important; padding: 0 16px !important; width: 240px !important; }

    /* App layout */
    .app-layout {
        grid-template-columns: minmax(0, 26%) 1fr minmax(0, 22%);
    }
    .app-layout.hide-right-panel {
        grid-template-columns: 26% 1fr !important;
    }

    /* Code module */
    .code-viewport { font-size: 12px; padding: 18px; line-height: 1.6; }
    .line { padding: 5px 13px; margin: 2px 0; font-size: 12px; }
    .module-label { font-size: 11px; }
    .language-badge, .depth-badge { font-size: 9px; padding: 4px 10px; }
    .complexity-label { font-size: 10px; }
    .complexity-value { font-size: 13px; }
    .code-info { padding: 13px 16px; }

    /* Viz module */
    .action-bar { padding: 8px 0; gap: 4px; }
    .control-btn { padding: 10px 16px; font-size: 15px; border-radius: 12px; }
    .control-btn span { font-size: 12px; }
    .speed-btn .speed-label { font-size: 13px; }
    .console-text { font-size: 14px; padding: 16px; }
    .console-panel { min-height: 90px; }
    .console-line { padding: 6px 10px; margin-bottom: 6px; }

    /* Nodes proportional */
    :root { --node-size: 52px; }
    .node { font-size: 17px; }

    /* Stack module */
    .stack-controls { font-size: 11px; padding: 10px 14px; }
    .stack-stat-label { font-size: 11px; }
    .stack-stat-value { font-size: 22px; }
    .stack-stat { padding: 10px 6px; }
    .stack-function-name { font-size: 14px; }
    .stack-node-value { font-size: 12px; padding: 4px 12px; }
    .stack-item { padding: 14px 16px; }
    .detail-label { font-size: 10px; }
    .detail-value { font-size: 12px; }
    .stack-legend { padding: 12px 14px; gap: 20px; }
    .legend-item span { font-size: 10px; }
    .legend-color { width: 10px; height: 10px; }

    /* Code & stack toggles */
    .code-toggle-btn { width: 32px; height: 58px; font-size: 11px; }
    .code-toggle-btn .toggle-label { font-size: 9px; }
    .stack-toggle-btn { width: 32px; height: 58px; font-size: 11px; }
    .stack-toggle-btn .toggle-label { font-size: 9px; }

    /* Array visualization */
    .array-inner { max-width: min(94%, 1000px); gap: 16px; padding: 22px; }
    .array-container { padding: 22px; }
    .array-item { width: 68px; min-width: 0; height: auto; aspect-ratio: 1; font-size: 21px; border-radius: 12px; margin-top: 36px; margin-bottom: 32px; flex: 1 1 68px; max-width: 68px; }
    .array-visualization { gap: 12px; padding: 18px; min-height: 100px; }
    .pointer-label { font-size: 11px; padding: 5px 10px; top: -32px; }
    .pointer-label-pair { top: -32px; }
    .array-index { font-size: 10px; padding: 4px 8px; bottom: -30px; }
    .array-label { font-size: 13px; }
    .pointer-info { padding: 16px; gap: 16px; }
    .pointer-detail-label { font-size: 11px; }
    .pointer-detail-value { font-size: 16px; padding: 8px 12px; }

    /* Queue */
    .queue-item { padding: 12px 14px; min-width: 52px; }
    .queue-item .qi-val { font-size: 16px; }
    .queue-item .qi-depth { font-size: 10px; }
    .queue-label { font-size: 10px; }

    /* Problem page */
    .problem-page-heading { font-size: 26px; }
    .problem-page-subtitle { font-size: 13px; }
    .problem-search-bar input { font-size: 14px; padding: 12px 16px 12px 42px; }
    .filter-btn { font-size: 12px; padding: 7px 17px; }
    .problem-card-inner { padding: 16px 20px; }
    .problem-card-name { font-size: 15px; }
    .problem-card-number { width: 24px; height: 24px; font-size: 10px; }
    .problem-tag { font-size: 11px; padding: 3px 10px; }
    .difficulty-badge { font-size: 11px; padding: 4px 12px; }

    /* YouTube modal */
    .youtube-modal-content { width: 420px; }
    .youtube-modal-header h3 { font-size: 24px; }
    .video-title { font-size: 16px; }
    .video-reason { font-size: 12px; }

}

/* --- Ultrawide / 4K Desktop: 1920px+ --- */
@media screen and (min-width: 1920px) {
    html { font-size: clamp(16px, 1.05vw, 22px); }

    /* Nav */
    .global-nav { padding: 14px 32px; gap: 18px; }
    .logo-svg, .problem-page-logo-svg { height: 28px; }
    .search-bar-wrapper { width: 260px; min-width: 180px; }
    .search-bar { font-size: 13px; height: 40px; }
    .modern-select { font-size: 13px; height: 40px; min-width: 180px; padding: 0 32px 0 14px; }
    .youtube-link { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
    .problem-nav-btn { width: 36px; height: 40px; font-size: 13px; }
    .nav-home-btn { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
    .nav-auth-btn { width: 40px; height: 40px; font-size: 15px; }
    .algorithm-label { font-size: 12px; }
    #problemListBtn { font-size: 13px !important; height: 40px !important; padding: 0 18px !important; border-radius: 9px !important; width: 260px !important; }

    /* App layout — slightly wider code and stack panels */
    .app-layout {
        grid-template-columns: minmax(0, 24%) 1fr minmax(0, 21%);
    }
    .app-layout.hide-right-panel {
        grid-template-columns: 24% 1fr !important;
    }
    .app-layout.hide-code-panel {
        grid-template-columns: 0px 1fr 21%;
    }

    /* Code module */
    .code-viewport { font-size: 14px; padding: 22px; line-height: 1.65; }
    .line { padding: 6px 14px; margin: 3px 0; font-size: 14px; border-radius: 5px; border-left-width: 3px; }
    .module-header { padding: 13px 16px; }
    .module-label { font-size: 12px; letter-spacing: 0.8px; }
    .language-badge, .depth-badge { font-size: 10px; padding: 4px 11px; border-radius: 14px; }
    .complexity-label { font-size: 11px; }
    .complexity-value { font-size: 14px; }
    .code-info { padding: 14px 18px; }
    .complexity-info { gap: 20px; }

    /* Viz module */
    .action-bar { padding: 8px 0; gap: 6px; }
    .action-bar .control-btn { padding: 14px 24px; font-size: 18px; border-radius: 14px; gap: 6px; }
    .action-bar .control-btn span { font-size: 14px; font-weight: 700; }
    .action-bar .speed-btn .speed-label { font-size: 15px; }
    .console-text { font-size: 15px; padding: 18px; line-height: 1.6; }
    .console-panel { min-height: 100px; }
    .console-line { padding: 7px 12px; margin-bottom: 7px; border-radius: 5px; }

    /* Nodes proportional */
    :root { --node-size: 56px; }
    .node { font-size: 18px; font-weight: 700; }

    /* Stack module */
    .stack-controls { font-size: 12px; padding: 11px 16px; }
    .stack-stat-label { font-size: 12px; }
    .stack-stat-value { font-size: 24px; }
    .stack-stat { padding: 11px 8px; }
    .stack-function-name { font-size: 15px; }
    .stack-node-value { font-size: 13px; padding: 4px 13px; border-radius: 10px; }
    .stack-item { padding: 16px 18px; }
    .stack-header-row { margin-bottom: 8px; }
    .stack-details { gap: 16px; margin-top: 8px; }
    .detail-label { font-size: 11px; }
    .detail-value { font-size: 13px; }
    .stack-legend { padding: 13px 16px; gap: 22px; }
    .legend-item span { font-size: 10px; }
    .legend-color { width: 11px; height: 11px; border-radius: 5px; }

    /* Code & stack toggles */
    .code-toggle-btn { width: 34px; height: 62px; font-size: 12px; }
    .code-toggle-btn .toggle-label { font-size: 10px; }
    .code-toggle-btn:hover { width: 38px; }
    .stack-toggle-btn { width: 34px; height: 62px; font-size: 12px; }
    .stack-toggle-btn .toggle-label { font-size: 10px; }
    .stack-toggle-btn:hover { width: 38px; }

    /* Array visualization */
    .array-inner { max-width: min(94%, 1200px); gap: 18px; padding: 26px; }
    .array-container { padding: 26px; }
    .array-item { width: 76px; min-width: 0; height: auto; aspect-ratio: 1; font-size: 22px; border-radius: 12px; margin-top: 38px; margin-bottom: 34px; flex: 1 1 76px; max-width: 76px; }
    .array-visualization { gap: 14px; padding: 20px; min-height: 110px; border-radius: 12px; }
    .pointer-label { font-size: 12px; padding: 5px 12px; top: -36px; border-radius: 4px; }
    .pointer-label-pair { top: -36px; }
    .array-index { font-size: 11px; padding: 4px 10px; bottom: -34px; border-radius: 6px; }
    .array-label { font-size: 15px; }
    .pointer-info { padding: 20px; gap: 20px; border-radius: 10px; }
    .pointer-detail-label { font-size: 13px; }
    .pointer-detail-value { font-size: 18px; padding: 10px 15px; border-radius: 8px; }

    /* Queue */
    .queue-item { padding: 14px 16px; min-width: 56px; }
    .queue-item .qi-val { font-size: 18px; }
    .queue-item .qi-depth { font-size: 10px; }
    .queue-label { font-size: 11px; padding: 0 12px; }

    /* Problem page */
    .problem-page-hero { max-width: 1060px; }
    .problem-page-grid-wrapper { max-width: 1060px; }
    .problem-page-heading { font-size: 28px; }
    .problem-page-subtitle { font-size: 14px; }
    .problem-search-bar input { font-size: 15px; padding: 13px 18px 13px 44px; border-radius: 14px; }
    .problem-search-wrapper .search-icon { width: 18px; height: 18px; left: 16px; }
    .filter-btn { font-size: 13px; padding: 8px 18px; border-radius: 12px; }
    .filter-options { gap: 8px; }
    .problem-card-inner { padding: 18px 22px; border-radius: 16px; }
    .problem-card { border-radius: 16px; }
    .problem-card-name { font-size: 16px; }
    .problem-card-number { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; }
    .problem-tag { font-size: 11px; padding: 3px 11px; }
    .difficulty-badge { font-size: 11px; padding: 4px 13px; }

    /* YouTube modal */
    .youtube-modal-content { width: 460px; }
    .youtube-modal-header { padding: 28px 32px 24px; }
    .youtube-modal-header h3 { font-size: 26px; gap: 12px; }
    .youtube-modal-body { padding: 10px 32px 32px; }
    .video-title { font-size: 17px; }
    .video-reason { font-size: 13px; }
    .video-card { padding: 20px 0; }
    .video-card-icon { font-size: 12px; }
    .video-tag { font-size: 11px; padding: 5px 12px; }

    /* Search dropdown */
    .search-dropdown { border-radius: 9px; }
    .search-result { padding: 10px 14px; font-size: 12px; }
    .search-result-title { margin-bottom: 4px; }
    .search-result-id { font-size: 9px; }
}

/* --- Ultra-large 4K+ Desktop: 2560px+ --- */
@media screen and (min-width: 2560px) {
    html { font-size: clamp(18px, 0.85vw, 26px); }

    .global-nav { padding: 16px 40px; gap: 22px; }
    .logo-svg, .problem-page-logo-svg { height: 28px; }
    .search-bar-wrapper { width: 300px; }
    .search-bar { font-size: 15px; height: 44px; border-radius: 9px; }
    .modern-select { font-size: 14px; height: 44px; min-width: 200px; border-radius: 9px; }
    .youtube-link { width: 44px; height: 44px; font-size: 20px; }
    .problem-nav-btn { width: 38px; height: 44px; font-size: 14px; }
    .nav-home-btn { width: 44px; height: 44px; font-size: 20px; border-radius: 10px; }
    .nav-auth-btn { width: 44px; height: 44px; font-size: 16px; }
    .algorithm-label { font-size: 13px; }
    #problemListBtn { font-size: 14px !important; height: 44px !important; width: 280px !important; }

    :root { --node-size: 64px; }
    .node { font-size: 20px; }

    .code-viewport { font-size: 16px; padding: 26px; }
    .line { padding: 7px 16px; margin: 3px 0; font-size: 16px; }

    .stack-stat-value { font-size: 28px; }
    .stack-stat-label { font-size: 13px; }
    .stack-function-name { font-size: 17px; }
    .stack-node-value { font-size: 15px; }
    .stack-item { padding: 18px 20px; }
    .detail-label { font-size: 12px; }
    .detail-value { font-size: 15px; }

    .action-bar { padding: 10px 0; gap: 8px; }
    .action-bar .control-btn { padding: 16px 30px; font-size: 22px; border-radius: 16px; gap: 8px; }
    .action-bar .control-btn span { font-size: 16px; font-weight: 700; }
    .action-bar .speed-btn .speed-label { font-size: 18px; }
    .console-text { font-size: 17px; padding: 20px; }

    .array-inner { max-width: min(95%, 1500px); gap: 22px; padding: 30px; }
    .array-container { padding: 34px; }
    .array-item { width: 88px; min-width: 0; height: auto; aspect-ratio: 1; font-size: 26px; border-radius: 14px; margin-top: 40px; margin-bottom: 36px; flex: 1 1 88px; max-width: 88px; }
    .array-visualization { gap: 16px; padding: 22px; min-height: 120px; border-radius: 14px; }
    .pointer-label { font-size: 13px; padding: 6px 13px; top: -42px; border-radius: 4px; }
    .pointer-label-pair { top: -42px; }
    .array-index { font-size: 12px; padding: 5px 11px; bottom: -38px; border-radius: 7px; }
    .array-label { font-size: 16px; }
    .pointer-info { padding: 22px; gap: 22px; border-radius: 12px; }
    .pointer-detail-label { font-size: 14px; }
    .pointer-detail-value { font-size: 21px; padding: 11px 17px; border-radius: 10px; }

    .queue-item .qi-val { font-size: 20px; }
    .queue-item { padding: 16px 18px; min-width: 64px; }

    .problem-card-name { font-size: 18px; }
    .problem-tag { font-size: 12px; padding: 4px 12px; }
    .problem-page-heading { font-size: 32px; }
    .problem-page-subtitle { font-size: 15px; }
    .problem-search-bar input { font-size: 16px; }
    .filter-btn { font-size: 14px; padding: 9px 20px; }
}

/* ===== Report / Feedback Modal ===== */
.report-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: var(--bg-card, #161616);
    color: var(--text-secondary, #9a9a9a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}
.report-fab:hover {
    background: var(--bg-card-light, #242424);
    color: var(--text-primary, #fff);
    transform: scale(1.08);
    border-color: rgba(255,255,255,0.2);
}

.report-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}
.report-modal.show {
    display: flex;
}
.report-modal-content {
    background: var(--bg-card, #161616);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: reportSlideIn 0.25s ease-out;
}
@keyframes reportSlideIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.report-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}
.report-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}
.report-modal-close {
    background: none;
    border: none;
    color: var(--text-muted, rgba(255,255,255,0.4));
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.report-modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #fff);
}

.report-form {
    padding: 20px 24px 24px;
}
.report-field {
    margin-bottom: 16px;
}
.report-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #9a9a9a);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.report-optional {
    text-transform: none;
    font-weight: 400;
    color: var(--text-muted, rgba(255,255,255,0.35));
    letter-spacing: 0;
}
.report-field select,
.report-field input,
.report-field textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    background: rgba(0,0,0,0.25);
    color: var(--text-primary, #fff);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.report-field select:focus,
.report-field input:focus,
.report-field textarea:focus {
    border-color: rgba(255, 255, 255, 0.25);
}
.report-field textarea {
    resize: vertical;
    min-height: 80px;
}
.report-actions {
    margin-top: 8px;
}
.report-submit-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: #ffffff;
    color: #000000;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.report-submit-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}
.report-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.report-status {
    margin-top: 12px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}
.report-status.success {
    color: var(--accent-green, #10b981);
}
.report-status.error {
    color: var(--accent-red, #ef4444);
}

/* ═══════════════════════════════════════════
   Hamburger Menu, Auth Button & Auth Modal
   ═══════════════════════════════════════════ */

/* --- Nav Auth Button (desktop: visible, mobile: hidden — use drawer instead) --- */
.nav-auth-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.nav-auth-btn:hover {
    background: var(--bg-card-light);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.2);
}
.nav-auth-btn.logged-in {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
}
.nav-auth-btn.logged-in:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* --- Auth wrapper (relative anchor for dropdown) --- */
.nav-auth-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* --- Auth Dropdown (desktop, when logged in) --- */
.nav-auth-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 9000;
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    padding: 6px;
    animation: authDdIn 0.15s ease-out;
}
.nav-auth-dropdown.show {
    display: block;
}
@keyframes authDdIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* User info row */
.auth-dd-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}
.auth-dd-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-dd-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.auth-dd-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.auth-dd-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Divider */
.auth-dd-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}

/* Dropdown items */
.auth-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s ease;
    text-align: left;
}
.auth-dd-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.auth-dd-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    flex-shrink: 0;
}
.auth-dd-item.auth-dd-logout {
    color: var(--accent-red, #ef4444);
}
.auth-dd-item.auth-dd-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red, #ef4444);
}

/* --- Hamburger Button (mobile only) --- */
.hamburger-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 16px;
}
.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.25s ease;
}
.hamburger-btn.open .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.hamburger-btn.open .hamburger-icon span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.open .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* --- Hamburger Overlay & Drawer --- */
.hamburger-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 8000;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.hamburger-overlay.show {
    display: block;
    opacity: 1;
}

.hamburger-drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 270px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-card, #161616);
    border-left: 1px solid var(--border);
    z-index: 8500;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}
.hamburger-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.drawer-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.drawer-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}
.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s ease;
    text-align: left;
}
.drawer-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}
.drawer-item:hover,
.drawer-item:active {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.drawer-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 20px;
}

/* Drawer auth section */
.drawer-auth-section {
    padding: 4px 0;
}
.drawer-auth-item i {
    color: rgba(255, 255, 255, 0.5);
}
/* Drawer utility icon colors */
#drawerHomeBtn i { color: rgba(255, 255, 255, 0.5); }
#drawerNotesBtn i { color: rgba(255, 255, 255, 0.5); }
#drawerYoutubeBtn i { color: rgba(255, 255, 255, 0.5); }
#drawerFeedbackBtn i { color: rgba(255, 255, 255, 0.5); }
.drawer-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
}
.drawer-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.drawer-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drawer-user-email {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drawer-logout {
    color: var(--text-muted) !important;
    font-size: 13px !important;
}
.drawer-logout:hover {
    color: #ef4444 !important;
}

/* --- Auth Modal --- */
/* ═══════════════════════════════════════════════════
   Auth Modal — Space-themed, dark glass
   ═══════════════════════════════════════════════════ */
.auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    align-items: center;
    justify-content: center;
}
.auth-modal.show {
    display: flex;
}
.auth-modal-content {
    background: rgba(8, 8, 12, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 92%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7), 0 0 80px rgba(255, 255, 255, 0.02), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: authSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}
.auth-modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(255, 255, 255, 0.015) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
.auth-modal-content > * {
    position: relative;
    z-index: 1;
}
@keyframes authSlideIn {
    0%   { opacity: 0; transform: translateY(16px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Header (X — title — spacer) ---- */
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}
.auth-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.auth-modal-title {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.auth-modal-header-spacer {
    width: 28px;
    flex-shrink: 0;
}

/* ---- Body ---- */
.auth-modal-body {
    padding: 24px 24px 20px;
}
.auth-welcome {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 20px 0;
    letter-spacing: -0.02em;
}

/* ---- Fieldset (stacked border-box, Airbnb-style) ---- */
.auth-fieldset {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.3);
}
.auth-field {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-field:last-child {
    border-bottom: none;
}
.auth-field input {
    width: 100%;
    padding: 24px 14px 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    transition: background 0.15s;
}
.auth-field input:focus {
    background: rgba(255, 255, 255, 0.03);
}
/* Floating label */
.auth-field label {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.15s ease;
    transform-origin: left center;
}
.auth-field input:focus + label,
.auth-field input:not(:placeholder-shown) + label {
    top: 10px;
    transform: translateY(0);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ---- Field error state ---- */
.auth-field.has-error input {
    background: rgba(239, 68, 68, 0.08);
}
.auth-field.has-error {
    border-color: rgba(239, 68, 68, 0.4);
}
.auth-field-error {
    display: none;
    font-size: 11.5px;
    color: var(--accent-red, #ef4444);
    padding: 4px 14px 8px;
    background: rgba(0, 0, 0, 0.18);
    line-height: 1.3;
}
.auth-field.has-error .auth-field-error {
    display: block;
}

/* Password hint */
.auth-password-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: -6px 0 14px 2px;
}

/* ---- Submit button ---- */
.auth-submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}
.auth-submit-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}
.auth-submit-btn:active {
    transform: translateY(0);
    box-shadow: none;
}
.auth-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Divider (— or —) ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---- Alt / switch button ---- */
.auth-alt-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.auth-alt-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}
.auth-alt-btn i {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.3);
}

/* ---- Explore link ---- */
.auth-explore {
    margin-top: 16px;
    text-align: center;
}
.auth-explore-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.auth-explore-btn:hover {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   Notes Button (nav)
   ═══════════════════════════════════════════════════ */
.nav-notes-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.nav-notes-btn:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════
   Notebook / Notes Panel — Right-side drawer
   ═══════════════════════════════════════════════════ */
.notebook-panel {
    position: fixed;
    top: var(--nav-height, 57px);
    right: 0;
    bottom: 0;
    width: var(--notebook-width, 440px);
    max-width: 100vw;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.notebook-panel.open {
    transform: translateX(0);
    pointer-events: auto;
}

/* Left-docked variant */
.notebook-panel.notebook-left {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}
.notebook-panel.notebook-left.open {
    transform: translateX(0);
}
.notebook-panel.notebook-left .notebook-chrome {
    border-left: none;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
}
.notebook-panel.notebook-left .notebook-resize-handle {
    left: auto;
    right: 0;
}

.notebook-chrome {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--bg-main, #000000);
    border-left: 1px solid var(--border);
    overflow: hidden;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);
    position: relative;
}

/* ---- Resize handle (left edge, desktop only) ---- */
.notebook-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}
.notebook-resize-handle:hover,
.notebook-resize-handle.dragging {
    background: rgba(255, 255, 255, 0.3);
}

/* ---- Header ---- */
.notebook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card, #161616);
    flex-shrink: 0;
}
.notebook-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.notebook-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.notebook-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.notebook-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.notebook-title i {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}
.notebook-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.notebook-save-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}
.notebook-save-status.saving {
    color: var(--accent-orange);
}
.notebook-save-status.saved {
    color: var(--accent-green, #10b981);
}
.notebook-save-status.error {
    color: var(--accent-red, #ef4444);
}
.notebook-save-status.local-only {
    color: var(--text-muted);
}

/* ---- Toolbar ---- */
.notebook-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card, #161616);
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.notebook-toolbar::-webkit-scrollbar {
    display: none;
}
.notebook-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.nb-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.12s;
    padding: 0;
    flex-shrink: 0;
}
.nb-tool-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.nb-tool-btn.active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
}
.nb-tool-btn.nb-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red, #ef4444);
}

/* ---- Whiteboard pen color swatches ---- */
.nb-pen-colors {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.nb-pen-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    flex-shrink: 0;
    transition: transform 0.1s, border-color 0.1s;
}
.nb-pen-swatch:hover {
    transform: scale(1.15);
}
.nb-pen-swatch.selected {
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

/* ---- Stroke size buttons ---- */
.nb-stroke-sizes {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.nb-stroke-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    transition: background 0.12s;
    padding: 0;
}
.nb-stroke-btn:hover {
    background: rgba(255,255,255,0.06);
}
.nb-stroke-btn.selected {
    background: rgba(255, 255, 255, 0.10);
}
.nb-stroke-dot {
    display: block;
    border-radius: 50%;
    background: var(--text-secondary);
}
.nb-stroke-btn.selected .nb-stroke-dot {
    background: var(--text-primary);
}

/* ---- Undo button ---- */
.nb-undo-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ---- Draw tools group ---- */
.nb-draw-tools {
    flex-shrink: 0;
}

.nb-tool-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
    flex-shrink: 0;
}

/* ---- Login prompt ---- */
.notebook-login-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.notebook-login-prompt i {
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}
.nb-login-link {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- Editor body ---- */
.notebook-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.notebook-editor {
    position: absolute;
    inset: 0;
    padding: 24px 28px;
    overflow-y: auto;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    outline: none;
    caret-color: rgba(255, 255, 255, 0.6);
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.notebook-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
    font-style: italic;
}
.notebook-editor h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 16px 0 8px;
    letter-spacing: -0.02em;
}
.notebook-editor ul, .notebook-editor ol {
    padding-left: 24px;
    margin: 8px 0;
}
.notebook-editor li {
    margin: 4px 0;
}
.notebook-editor b, .notebook-editor strong {
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Drawing canvas ---- */
.notebook-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    touch-action: none;
}
.notebook-canvas.draw-active {
    pointer-events: auto;
    cursor: crosshair;
}
.notebook-canvas.eraser-active {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='%23ef4444' stroke-width='2'/%3E%3C/svg%3E") 10 10, auto;
}

/* ---- Structures SVG overlay ---- */
.nb-structures-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    overflow: visible;
}
.nb-structures-svg.struct-placing {
    pointer-events: auto;
    cursor: crosshair;
}
.nb-struct-node {
    cursor: grab;
    pointer-events: auto;
    transition: filter 0.1s;
}
.nb-struct-node:hover circle,
.nb-struct-node:hover rect {
    filter: brightness(1.3);
}
.nb-struct-node.selected circle,
.nb-struct-node.selected rect {
    stroke-width: 2.5;
}
.nb-struct-edge {
    pointer-events: none;
}
.nb-struct-value {
    pointer-events: none;
    user-select: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    text-anchor: middle;
    dominant-baseline: central;
}
.nb-struct-index {
    pointer-events: none;
    user-select: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    fill: var(--text-muted, #525252);
    text-anchor: middle;
}
.nb-struct-arrow-ptr {
    pointer-events: none;
}

/* ---- Structures dropdown menu ---- */
.nb-structures-wrap {
    position: static;
    flex-shrink: 0;
}
.nb-structures-trigger.active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
}
.nb-structures-menu {
    display: none;
    position: fixed;
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 99999;
    overflow: visible;
}
.nb-structures-menu.open {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
}
.nb-struct-option {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border: none;
    border-radius: 7px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.nb-struct-option:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

/* ---- Node action bar (floating above selected node) ---- */
.nb-node-actions {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    pointer-events: auto;
}
.nb-na-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 5px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.nb-na-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.nb-na-btn.nb-na-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red, #ef4444);
}
.nb-na-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* ---- Inline value edit input ---- */
.nb-struct-edit-input {
    position: absolute;
    z-index: 20;
    background: var(--bg-main, #000000);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    text-align: center;
    outline: none;
    padding: 2px 4px;
    box-shadow: 0 0 8px rgba(255,255,255,0.1);
}

/* ---- Array size prompt ---- */
.nb-array-prompt {
    position: absolute;
    z-index: 20;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card, #161616);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.nb-array-prompt label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.nb-array-prompt input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-main, #0c0c0c);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    text-align: center;
    outline: none;
}
.nb-array-prompt input:focus {
    border-color: var(--accent-blue);
}
.nb-array-prompt-btns {
    display: flex;
    gap: 8px;
}
.nb-array-prompt-btns button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}
.nb-array-prompt-btns .nb-ap-ok {
    background: var(--accent-blue);
    color: #fff;
}
.nb-array-prompt-btns .nb-ap-ok:hover {
    filter: brightness(1.1);
}
.nb-array-prompt-btns .nb-ap-cancel {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
}
.nb-array-prompt-btns .nb-ap-cancel:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* ---- Footer ---- */
.notebook-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card, #161616);
    flex-shrink: 0;
}
.notebook-page-info {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ---- Notebook views (list / editor) ---- */
.notebook-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ---- Notes List View ---- */
.notebook-notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.notebook-notes-list::-webkit-scrollbar {
    width: 4px;
}
.notebook-notes-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Empty state */
.nb-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 24px;
    text-align: center;
    color: var(--text-muted);
}
.nb-list-empty i {
    font-size: 32px;
    opacity: 0.25;
}
.nb-list-empty p {
    font-size: 13px;
    line-height: 1.6;
    max-width: 240px;
}
.nb-list-empty .nb-list-empty-hint {
    font-size: 11px;
    opacity: 0.6;
}

/* Note card in list */
.nb-note-card {
    display: flex;
    align-items: flex-start;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.nb-note-card:hover {
    background: rgba(255, 255, 255, 0.04);
}
.nb-note-card:active {
    background: rgba(255, 255, 255, 0.06);
}
.nb-note-card.nb-note-empty {
    opacity: 0.5;
}
.nb-note-card.nb-note-empty:hover {
    opacity: 0.75;
}

/* Note text info */
.nb-note-info {
    flex: 1;
    min-width: 0;
}
.nb-note-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.nb-note-id {
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}
.nb-note-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nb-note-meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ---- Mobile responsive ---- */
@media screen and (max-width: 768px) {
    .notebook-panel {
        width: 100vw !important;
        top: 0;
        z-index: 9500;
    }
    .notebook-chrome {
        border-left: none;
        border-radius: 0;
    }
    .notebook-resize-handle {
        display: none;
    }
    .notebook-editor {
        padding: 16px 18px;
        font-size: 14px;
    }
    .notebook-toolbar {
        padding: 6px 8px;
        gap: 1px;
    }
    .nb-tool-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    .nb-pen-swatch {
        width: 18px;
        height: 18px;
    }
    .nb-tool-divider {
        margin: 0 4px;
        height: 18px;
    }
    .nb-stroke-btn {
        width: 24px;
        height: 24px;
    }
}

/* --- Desktop: show auth btn, hide hamburger --- */
@media screen and (min-width: 769px) {
    .hamburger-btn { display: none !important; }
    .hamburger-overlay, .hamburger-drawer { display: none !important; }
}

/* ═══════════════════════════════════════════
   Prerequisite Knowledge Check — Compact Bar
   ═══════════════════════════════════════════ */

.prereq-banner {
    position: relative;
    z-index: 5;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 14px;
    margin: 0 12px 6px;
    animation: prereqSlideIn 0.3s ease-out;
    overflow: hidden;
}

.prereq-banner.prereq-hiding {
    animation: prereqSlideOut 0.25s ease-in forwards;
}

@keyframes prereqSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes prereqSlideOut {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateY(-8px); }
}

.prereq-banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.prereq-label {
    font-size: 11.5px;
    color: #525252;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.prereq-topics {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.prereq-topic {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.prereq-topic.prereq-done {
    opacity: 0.7;
}

.prereq-topic-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
}

.prereq-done .prereq-topic-name {
    color: #34d399;
}

.prereq-check {
    color: #34d399;
    font-weight: 700;
    font-size: 13px;
    margin-left: 2px;
}

.prereq-btn {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.prereq-yes {
    background: rgba(255, 255, 255, 0.05);
    color: #525252;
}

.prereq-yes:hover {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
}

.prereq-no {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
}

.prereq-no:hover {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.7);
}

.prereq-dismiss-all {
    font-size: 10.5px;
    color: #242424;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
    margin-left: auto;
    transition: color 0.12s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.prereq-dismiss-all:hover {
    color: #525252;
}

/* ── Prerequisite Video Modal — Compact SaaS ── */

.prereq-video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
}

.prereq-video-modal.show {
    display: flex;
    animation: prereqModalIn 0.15s ease-out;
}

@keyframes prereqModalIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.prereq-video-content {
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    width: min(90vw, 640px);
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: prereqContentIn 0.2s ease-out;
}

@keyframes prereqContentIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.prereq-video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.prereq-video-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.prereq-video-badge {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.prereq-video-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prereq-video-close {
    background: transparent;
    border: none;
    color: #363636;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.prereq-video-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #9a9a9a;
}

.prereq-video-body {
    padding: 0;
}

.prereq-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
}

.prereq-video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.prereq-video-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.prereq-video-got-it {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.12s ease;
}

.prereq-video-got-it:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .prereq-banner-inner {
        gap: 6px;
    }
    .prereq-topics {
        flex-direction: column;
        width: 100%;
    }
    .prereq-topic {
        width: 100%;
        justify-content: space-between;
    }
    .prereq-btn {
        font-size: 10.5px;
        padding: 3px 8px;
    }
    .prereq-video-content {
        width: 96vw;
        border-radius: 10px;
    }
}

