/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO DESIGN SYSTEM - MOCKUP EXACT
   Design gerado por IA - Visual SaaS Premium
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   CSS VARIABLES - Design Tokens
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    /* Background Colors */
    --neuro-bg-deep: #0a0d14;
    --neuro-bg-base: #0f1219;
    --neuro-bg-surface: #151a24;
    --neuro-bg-elevated: #1a2030;

    /* Primary Colors */
    --neuro-cyan: #06d6a0;
    --neuro-cyan-glow: rgba(6, 214, 160, 0.4);
    --neuro-purple: #a855f7;
    --neuro-purple-glow: rgba(168, 85, 247, 0.4);
    --neuro-gold: #fbbf24;
    --neuro-green: #22c55e;
    --neuro-red: #ef4444;

    /* Text Colors */
    --neuro-text-primary: #ffffff;
    --neuro-text-secondary: #94a3b8;
    --neuro-text-muted: #8190a3; /* era #64748b (~3.2:1, falha WCAG AA); subido p/ ~5.8:1 — público dislexia/TDAH */

    /* Border Colors */
    --neuro-border: rgba(255, 255, 255, 0.06);
    --neuro-border-cyan: rgba(6, 214, 160, 0.2);
    --neuro-border-purple: rgba(168, 85, 247, 0.2);

    /* Fonts */
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-body: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --header-height: 56px;
    --sidebar-width: 180px;

    /* Z-Index Scale */
    --z-base: 1;
    --z-sidebar: 90;
    --z-header: 100;
    --z-fab: 200;
    --z-panel: 300;
    --z-overlay: 400;
    --z-modal: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */

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

body {
    font-family: var(--font-body);
    background: var(--neuro-bg-deep);
    color: var(--neuro-text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO HEADER - Top Navigation Bar
   Hamburger | Filename | Page X/Y (cyan line) | Zen Mode
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(15, 18, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex; /* Always visible */
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: var(--z-header);
    border-bottom: 1px solid var(--neuro-border-cyan);
}

/* Hide page info when no PDF is loaded */
body:not(.reader-active) .neuro-header__center {
    visibility: hidden;
}

/* Hide header in zen mode */
body.zen-mode .neuro-header {
    display: none !important;
}

/* Adjust reader content for header */
body.reader-active #reader-view {
    padding-top: var(--header-height);
}

/* Header Left: Menu + Filename */
.neuro-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.neuro-header__menu {
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.neuro-header__menu-line {
    width: 100%;
    height: 2px;
    background: var(--neuro-cyan);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.neuro-header__menu:hover .neuro-header__menu-line {
    box-shadow: 0 0 8px var(--neuro-cyan-glow);
}

.neuro-header__filename {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    color: var(--neuro-text-primary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile: nome do arquivo fica menor pra não brigar com Modo Zen toggle.
   Em viewports muito estreitos (<360px) o nome some — usuário usa a sidebar pra ver. */
@media (max-width: 480px) {
    .neuro-header__filename {
        max-width: 140px;
        font-size: 0.875rem;
    }
}
@media (max-width: 360px) {
    .neuro-header__filename {
        display: none;
    }
}

/* Header Center: Page Info */
.neuro-header__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.neuro-header__page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.neuro-header__page-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--neuro-text-muted);
}

.neuro-header__page-numbers {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--neuro-text-primary);
}

/* Page Input Wrapper */
.neuro-header__page-input-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(6, 214, 160, 0.08);
    border: 1px solid rgba(6, 214, 160, 0.2);
    border-radius: 8px;
    padding: 4px 10px;
    transition: all 0.2s ease;
}

.neuro-header__page-input-wrapper:hover {
    border-color: rgba(6, 214, 160, 0.4);
    background: rgba(6, 214, 160, 0.12);
}

.neuro-header__page-input-wrapper:focus-within {
    border-color: var(--neuro-cyan);
    box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.15);
    background: rgba(6, 214, 160, 0.15);
}

/* Page Input Field */
.neuro-header__page-input {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neuro-text-primary, #e2e8f0);
    background: transparent;
    border: none;
    outline: none;
    width: 3ch;
    text-align: right;
    padding: 0;
    -moz-appearance: textfield;
}

.neuro-header__page-input::-webkit-outer-spin-button,
.neuro-header__page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.neuro-header__page-input:focus {
    color: var(--neuro-cyan, #06d6a0);
}

.neuro-header__page-input::selection {
    background: rgba(6, 214, 160, 0.3);
}

/* Page Separator and Total */
.neuro-header__page-separator {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1rem;
    font-weight: 500;
    color: var(--neuro-text-muted, #64748b);
    margin: 0 2px;
}

.neuro-header__page-total {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1rem;
    font-weight: 600;
    color: var(--neuro-text-secondary, #94a3b8);
}

.neuro-header__line {
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--neuro-cyan), transparent);
    border-radius: 2px;
}

/* Header Right: Zen Toggle */
.neuro-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.neuro-header__zen-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--neuro-text-muted);
}

/* Toggle Switch */
.neuro-toggle {
    position: relative;
    width: 52px;
    height: 28px;
}

.neuro-toggle__input {
    opacity: 0;
    width: 0;
    height: 0;
}

.neuro-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--neuro-border-cyan);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.neuro-toggle__slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--neuro-text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.neuro-toggle__input:checked + .neuro-toggle__slider {
    background: rgba(6, 214, 160, 0.2);
    border-color: var(--neuro-cyan);
}

.neuro-toggle__input:checked + .neuro-toggle__slider::before {
    transform: translateX(24px);
    background: var(--neuro-cyan);
    box-shadow: 0 0 10px var(--neuro-cyan-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO SIDEBAR - Left Navigation
   Dark panel with cyan outline icons
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    /* dvh corrige o bug do 100vh no mobile: em navegadores com barra dinâmica o
       100vh ESTOURA a área visível, empurrando o rodapé (perfil) pra baixo da
       barra do browser → "o perfil não aparece em alguns aparelhos". dvh usa a
       altura REALMENTE visível; navegadores sem suporte caem no 100vh acima. */
    height: calc(100dvh - var(--header-height));
    background: rgba(15, 18, 25, 0.98);
    border-right: 1px solid var(--neuro-border-cyan);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.neuro-sidebar.is-open {
    transform: translateX(0);
}

.neuro-sidebar__nav {
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    /* Ocupa o espaço disponível e ROLA quando os itens passam da tela —
       sem isso, no mobile o perfil (depois de "Ajuda") ficava cortado e
       inacessível. min-height:0 é obrigatório p/ flex item rolar. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.neuro-sidebar__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: var(--neuro-text-primary);
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
}

.neuro-sidebar__item:hover {
    background: rgba(6, 214, 160, 0.08);
}

.neuro-sidebar__item-icon {
    width: 22px;
    height: 22px;
    color: var(--neuro-cyan);
    stroke-width: 1.5;
}

.neuro-sidebar__item-arrow {
    width: 16px;
    height: 16px;
    color: var(--neuro-cyan);
    margin-left: auto;
}

/* Sidebar Divider and Section Title */
.neuro-sidebar__divider {
    height: 1px;
    background: var(--neuro-border, rgba(148, 163, 184, 0.12));
    margin: 12px 20px;
}

.neuro-sidebar__section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--neuro-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 20px 4px;
    margin: 0;
}

/* Sidebar User Section */
.neuro-sidebar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin-top: auto;
    flex-shrink: 0; /* perfil fixo no rodapé — sempre visível, nav rola acima */
    border-top: 1px solid var(--neuro-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.neuro-sidebar__user:hover {
    background: rgba(6, 214, 160, 0.08);
}

.neuro-sidebar__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neuro-cyan), var(--neuro-purple));
    display: flex;
    align-items: center;
    justify-content: center;
}

.neuro-sidebar__avatar-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.neuro-sidebar__user-info {
    display: flex;
    flex-direction: column;
}

.neuro-sidebar__user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--neuro-text-primary);
}

.neuro-sidebar__user-level {
    font-size: 0.75rem;
    color: var(--neuro-cyan);
}

/* Sidebar Overlay */
.neuro-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.neuro-sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO BRAIN FAB - Floating Action Button
   Purple brain with rotating cyan/purple gradient ring
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-fab {
    position: fixed;
    bottom: 110px;
    right: 24px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2d1f4e 0%, #1a1a2e 70%, #0f0f1a 100%);
    border: none;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--z-fab);
    transition: all 0.3s ease;
    box-shadow:
        0 0 30px var(--neuro-purple-glow),
        0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Show FAB in reader mode */
body.reader-active .neuro-fab {
    display: flex;
}

/* Hide FAB in zen mode */
body.zen-mode .neuro-fab,
body.ui-hidden .neuro-fab {
    display: none !important;
}

/* Rotating gradient ring */
.neuro-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(from 0deg, var(--neuro-cyan), var(--neuro-purple), var(--neuro-cyan));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: neuro-fab-rotate 4s linear infinite;
}

@keyframes neuro-fab-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.neuro-fab:hover {
    transform: scale(1.1);
    box-shadow:
        0 0 50px var(--neuro-purple-glow),
        0 12px 40px rgba(0, 0, 0, 0.5);
}

.neuro-fab__icon {
    font-size: 32px;
    filter: drop-shadow(0 0 15px var(--neuro-purple-glow));
    z-index: 2;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO ACTION BAR - Text Selection Toolbar
   Pill shape with cyan border: Explain | Highlight | Copy | Share
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-action-bar {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(15, 18, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--neuro-cyan);
    border-radius: 50px;
    z-index: var(--z-panel);
    box-shadow:
        0 0 30px var(--neuro-cyan-glow),
        0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.neuro-action-bar.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.neuro-action-bar__btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--neuro-cyan);
}

.neuro-action-bar__btn:hover {
    background: rgba(6, 214, 160, 0.15);
}

.neuro-action-bar__btn--explain {
    width: auto;
    padding: 0 16px;
    border-radius: 22px;
    background: rgba(168, 85, 247, 0.15);
    color: var(--neuro-text-primary);
}

.neuro-action-bar__btn--explain:hover {
    background: rgba(168, 85, 247, 0.25);
}

.neuro-action-bar__btn-icon {
    width: 20px;
    height: 20px;
}

.neuro-action-bar__btn-icon--brain {
    font-size: 22px;
    filter: drop-shadow(0 0 6px var(--neuro-purple-glow));
}

.neuro-action-bar__btn-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--neuro-cyan);
}

.neuro-action-bar__btn--highlight .neuro-action-bar__btn-icon {
    color: var(--neuro-gold);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO TUTOR PANEL - AI Explanation Modal
   Purple neon border glow, Credits badge, Simplify/Create Question buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-tutor {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 480px;
    background: rgba(15, 18, 25, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    z-index: var(--z-modal);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    /* Purple neon glow */
    box-shadow:
        0 0 0 2px var(--neuro-purple),
        0 0 40px var(--neuro-purple-glow),
        0 0 80px rgba(168, 85, 247, 0.2),
        inset 0 0 60px rgba(168, 85, 247, 0.03);
}

.neuro-tutor.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.neuro-tutor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

.neuro-tutor__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neuro-text-primary);
}

.neuro-tutor__credits {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(6, 214, 160, 0.15);
    border: 1px solid var(--neuro-cyan);
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--neuro-cyan);
}

.neuro-tutor__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--neuro-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.neuro-tutor__close svg,
.neuro-tutor__close i {
    pointer-events: none;
}

.neuro-tutor__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--neuro-text-primary);
}

.neuro-tutor__body {
    padding: 0 24px 24px;
}

.neuro-tutor__quote {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--neuro-text-primary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.neuro-tutor__quote::before,
.neuro-tutor__quote::after {
    color: var(--neuro-purple);
}

.neuro-tutor__quote::before { content: '"'; }
.neuro-tutor__quote::after { content: '"'; }

.neuro-tutor__content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.neuro-tutor__loader {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--neuro-text-muted);
    margin-bottom: 12px;
}

.neuro-tutor__loader-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.neuro-tutor__loader-bar {
    height: 8px;
    background: linear-gradient(90deg, rgba(6, 214, 160, 0.3), rgba(6, 214, 160, 0.1));
    border-radius: 4px;
    animation: neuro-loader-pulse 1.5s ease-in-out infinite;
}

.neuro-tutor__loader-bar:nth-child(1) { width: 100%; }
.neuro-tutor__loader-bar:nth-child(2) { width: 85%; animation-delay: 0.2s; }
.neuro-tutor__loader-bar:nth-child(3) { width: 70%; animation-delay: 0.4s; }

@keyframes neuro-loader-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.neuro-tutor__bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.neuro-tutor__bullets li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--neuro-text-secondary);
    line-height: 1.5;
}

.neuro-tutor__bullets li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--neuro-cyan);
    font-size: 1.2rem;
}

.neuro-tutor__actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.neuro-tutor__btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--neuro-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.neuro-tutor__btn--simplify {
    background: linear-gradient(135deg, var(--neuro-cyan), #0ea5e9);
}

.neuro-tutor__btn--simplify:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--neuro-cyan-glow);
}

.neuro-tutor__btn--question {
    background: linear-gradient(135deg, var(--neuro-purple), #7c3aed);
}

.neuro-tutor__btn--question:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--neuro-purple-glow);
}

.neuro-tutor__input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--neuro-border);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--neuro-text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.neuro-tutor__input::placeholder {
    color: var(--neuro-text-muted);
}

.neuro-tutor__input:focus {
    border-color: var(--neuro-border-purple);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO FOCUS RULER - Reading Guide
   Cyan translucent bar with measurement marks
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-ruler {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 500px;
    height: 40px;
    background: rgba(6, 214, 160, 0.12);
    border: 2px solid var(--neuro-cyan);
    border-radius: 8px;
    z-index: 30;
    display: none;
    align-items: center;
    box-shadow:
        0 0 20px var(--neuro-cyan-glow),
        inset 0 0 15px rgba(6, 214, 160, 0.08);
}

.neuro-ruler.is-active {
    display: flex;
}

/* Ruler tick marks */
.neuro-ruler::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 16px;
    height: 12px;
    background: repeating-linear-gradient(
        90deg,
        var(--neuro-cyan) 0px,
        var(--neuro-cyan) 1px,
        transparent 1px,
        transparent 20px
    );
    opacity: 0.5;
}

/* Small ticks */
.neuro-ruler::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 16px;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        rgba(6, 214, 160, 0.3) 0px,
        rgba(6, 214, 160, 0.3) 1px,
        transparent 1px,
        transparent 5px
    );
}

/* Grip handles */
.neuro-ruler__grip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px;
}

.neuro-ruler__grip--left { left: 4px; }
.neuro-ruler__grip--right { right: 4px; }

.neuro-ruler__grip-line {
    width: 8px;
    height: 2px;
    background: var(--neuro-cyan);
    border-radius: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO DASHBOARD - Gamification Panel
   Level ring, XP bar with bubbles, stat cards with gradient border
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-dashboard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 520px;
    background: rgba(15, 18, 25, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--neuro-border);
    border-radius: 24px;
    z-index: var(--z-modal);
    padding: 32px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.neuro-dashboard.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Level Ring */
.neuro-dashboard__level {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.neuro-dashboard__ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.neuro-dashboard__ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.neuro-dashboard__ring-bg {
    fill: none;
    stroke: rgba(6, 214, 160, 0.2);
    stroke-width: 8;
}

.neuro-dashboard__ring-progress {
    fill: none;
    stroke: var(--neuro-cyan);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 84.823;
    filter: drop-shadow(0 0 10px var(--neuro-cyan-glow));
    transition: stroke-dashoffset 0.5s ease;
}

.neuro-dashboard__level-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.neuro-dashboard__level-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--neuro-cyan);
    text-shadow: 0 0 20px var(--neuro-cyan-glow);
}

.neuro-dashboard__level-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--neuro-text-muted);
}

/* Streak Badge */
.neuro-dashboard__streak {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.neuro-dashboard__streak-icon {
    font-size: 1.5rem;
}

.neuro-dashboard__streak-text {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: #f97316;
}

/* XP Progress Bar */
.neuro-dashboard__xp {
    margin-bottom: 28px;
}

.neuro-dashboard__xp-label {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--neuro-text-secondary);
    margin-bottom: 10px;
}

.neuro-dashboard__xp-bar {
    position: relative;
    width: 100%;
    height: 32px;
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 16px;
    overflow: hidden;
}

.neuro-dashboard__xp-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--neuro-green), #4ade80);
    border-radius: 14px;
    transition: width 0.5s ease;
}

/* Liquid bubbles */
.neuro-dashboard__xp-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.neuro-dashboard__xp-bubble {
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: neuro-bubble 2s ease-in-out infinite;
}

.neuro-dashboard__xp-bubble:nth-child(1) { left: 10%; animation-delay: 0s; }
.neuro-dashboard__xp-bubble:nth-child(2) { left: 25%; animation-delay: 0.3s; }
.neuro-dashboard__xp-bubble:nth-child(3) { left: 40%; animation-delay: 0.6s; }
.neuro-dashboard__xp-bubble:nth-child(4) { left: 55%; animation-delay: 0.9s; }

@keyframes neuro-bubble {
    0%, 100% { transform: translateY(8px); opacity: 0.3; }
    50% { transform: translateY(-4px); opacity: 0.8; }
}

/* Stat Cards Grid */
.neuro-dashboard__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.neuro-dashboard__stat {
    position: relative;
    padding: 20px;
    background: rgba(15, 18, 25, 0.8);
    border-radius: 16px;
    overflow: hidden;
}

/* Gradient border */
.neuro-dashboard__stat::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: linear-gradient(135deg, var(--neuro-purple) 0%, var(--neuro-cyan) 100%);
    border-radius: 16px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.neuro-dashboard__stat-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--neuro-text-muted);
    margin-bottom: 8px;
}

.neuro-dashboard__stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--neuro-text-primary);
}

.neuro-dashboard__stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--neuro-text-muted);
}

/* Gold CTA Button */
.neuro-dashboard__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--neuro-gold), #f59e0b);
    border: none;
    border-radius: 14px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow:
        0 4px 15px rgba(251, 191, 36, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.neuro-dashboard__cta:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 30px rgba(251, 191, 36, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO OVERLAY - Modal Backdrop
   ═══════════════════════════════════════════════════════════════════════════════ */

.neuro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.neuro-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NEURO DOCK - Restyled for Neuro-Futurista Design
   Bottom floating controls for reading
   ═══════════════════════════════════════════════════════════════════════════════ */

#neuro-dock.neuro-dock {
    background: rgba(10, 13, 20, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--neuro-border-cyan) !important;
    border-radius: 16px !important;
    box-shadow:
        0 0 20px rgba(6, 214, 160, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4) !important;
    padding: 8px 12px !important;
    gap: 6px !important;
}

#neuro-dock .dock-btn {
    width: 44px !important;
    height: 44px !important;
    background: transparent !important;
    border: none !important;
    color: var(--neuro-text-secondary) !important;
    transition: all 0.2s ease !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#neuro-dock .dock-btn:hover {
    color: var(--neuro-cyan) !important;
    background: rgba(6, 214, 160, 0.1) !important;
}

#neuro-dock .dock-btn.dock-play {
    width: 52px !important;
    height: 52px !important;
    background: linear-gradient(135deg, var(--neuro-cyan), var(--neuro-purple)) !important;
    color: white !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 15px rgba(6, 214, 160, 0.35) !important;
}

#neuro-dock .dock-btn.dock-play:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--neuro-cyan-glow);
}

#neuro-dock .dock-divider {
    background: var(--neuro-border-cyan) !important;
    opacity: 0.5;
}

#neuro-dock .dock-emoji {
    filter: drop-shadow(0 0 4px var(--neuro-cyan-glow));
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SELECTION FABs - Restyled for Neuro-Futurista Design
   Sniper, Auto-Select, Smart Hover buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Sniper FAB - Main selection button */
#btn-sniper-fab.sniper-fab {
    background: rgba(10, 13, 20, 0.95) !important;
    border: 2px solid var(--neuro-cyan) !important;
    box-shadow:
        0 0 20px var(--neuro-cyan-glow),
        0 4px 16px rgba(0, 0, 0, 0.4) !important;
    color: var(--neuro-cyan) !important;
}

#btn-sniper-fab.sniper-fab:hover {
    background: rgba(6, 214, 160, 0.15) !important;
    transform: scale(1.1);
}

/* Auto-Select FAB */
#btn-auto-select-fab.auto-select-fab {
    background: rgba(10, 13, 20, 0.95) !important;
    border: 2px solid var(--neuro-purple) !important;
    box-shadow:
        0 0 15px var(--neuro-purple-glow),
        0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

#btn-auto-select-fab.auto-select-fab:hover {
    background: rgba(168, 85, 247, 0.15) !important;
    transform: scale(1.1);
}

/* Smart Hover FAB */
#btn-smart-hover-fab.smart-hover-fab {
    background: rgba(10, 13, 20, 0.95) !important;
    border: 2px solid var(--neuro-gold) !important;
    box-shadow:
        0 0 15px rgba(251, 191, 36, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

#btn-smart-hover-fab.smart-hover-fab:hover {
    background: rgba(251, 191, 36, 0.15) !important;
    transform: scale(1.1);
}

/* Selection Mode Bar - when sniper is active */
/* IMPORTANTE: Só mostra quando tem .active, não força display sempre! */
#selection-mode-bar.selection-mode-bar {
    background: rgba(10, 13, 20, 0.98) !important;
    border: 1px solid var(--neuro-cyan) !important;
    box-shadow: 0 0 20px var(--neuro-cyan-glow) !important;
    z-index: 500 !important;
    pointer-events: auto !important;
}

/* Só mostra quando está ativo */
#selection-mode-bar.selection-mode-bar.active {
    display: flex !important;
}

#selection-mode-bar.selection-mode-bar button {
    background: rgba(6, 214, 160, 0.2) !important;
    border: 1px solid rgba(6, 214, 160, 0.3) !important;
    color: var(--neuro-text-primary) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

#selection-mode-bar.selection-mode-bar button:hover {
    background: rgba(6, 214, 160, 0.35) !important;
    border-color: var(--neuro-cyan) !important;
}

#selection-mode-bar.selection-mode-bar .cancel-btn {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

#selection-mode-bar.selection-mode-bar .cancel-btn:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    border-color: var(--neuro-red) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RULER CONTROLS - Neuro-Futurista Styling
   Controles da régua de foco - essencial para TDAH
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Ruler controls — neuro design overrides */
.ruler-controls,
#ruler-controls {
    background: rgba(10, 13, 20, 0.97) !important;
    backdrop-filter: blur(24px) saturate(1.3) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.3) !important;
    border: 1px solid var(--neuro-border-cyan) !important;
    border-radius: 18px !important;
    box-shadow:
        0 0 15px rgba(6, 214, 160, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HIDE LEGACY COMPONENTS - Remove old design elements
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Hide old FABs and legacy components (but NOT the dock and selection FABs - essential controls) */
.premium-badge,
#premium-badge,
#help-btn,
.help-btn,
.teleprompter-bar,
#teleprompter-bar,
.page-navigator,
#page-indicator-box,
#demo-upsell-banner,
/* Ruler controls - Mantido visível, é essencial para TDAH */
.region-counter-badge,
#region-counter-badge,
.reading-highlight-word,
#mobile-quickbar,
.mobile-quickbar,
#neurotutor-fab,
.neurotutor-fab,
.watermark {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ZEN MODE - Toggle só aparece quando PDF está carregado
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Esconder toggle Modo Zen quando não há PDF carregado */
body:not(.reader-active) .neuro-header__right {
    visibility: hidden;
    pointer-events: none;
}

/* Mostrar toggle quando PDF está carregado */
body.reader-active .neuro-header__right {
    visibility: visible;
    pointer-events: auto;
}

/* Botão flutuante para sair do Modo Zen - escondido por padrão */
.zen-exit-btn,
#zen-exit-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(12, 16, 33, 0.7);
    border: 2px solid rgba(6, 214, 160, 0.3);
    color: var(--neuro-text-primary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.zen-exit-btn:hover,
#zen-exit-btn:hover {
    background: rgba(6, 214, 160, 0.2);
    border-color: var(--neuro-cyan);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(6, 214, 160, 0.3);
}

/* Mostrar botão de sair APENAS quando Modo Zen está ativo */
body.zen-mode .zen-exit-btn,
body.zen-mode #zen-exit-btn {
    display: flex !important;
}

/* Hide old header elements if any conflict */
.neuro-reader-header:not(.neuro-header) {
    display: none !important;
}

/* Hide old sidebar elements */
.neuro-sidebar-header,
.neuro-sidebar-logo,
.neuro-sidebar-title,
.neuro-sidebar-footer,
.neuro-sidebar-divider {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LIBRARY VIEW - Mockup Design (Clean & Minimal)
   ═══════════════════════════════════════════════════════════════════════════════ */

#library-view {
    background: var(--neuro-bg-deep) !important;
    min-height: 100vh;
    padding-top: var(--header-height) !important; /* Espaço para o header fixo */
}

/* Hide old hero section with gradient background */
#library-view > div:nth-child(2) {
    display: none !important;
}

/* New minimal library header */
.neuro-library-header {
    padding: 40px 20px 20px;
    text-align: center;
}

.neuro-library-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--neuro-text-primary);
    margin-bottom: 8px;
}

.neuro-library-header p {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--neuro-text-muted);
}

/* Library actions row */
.neuro-library-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.neuro-library-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.neuro-library-btn--primary {
    background: linear-gradient(135deg, var(--neuro-cyan), #0ea5e9);
    color: white;
}

.neuro-library-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--neuro-cyan-glow);
}

.neuro-library-btn--secondary {
    background: var(--neuro-bg-surface);
    color: var(--neuro-text-primary);
    border: 1px solid var(--neuro-border);
}

.neuro-library-btn--secondary:hover {
    border-color: var(--neuro-cyan);
    background: var(--neuro-bg-elevated);
}

/* Hide old action buttons */
#library-view .dash-hud-btn,
#library-view .user-hud,
#library-view [onclick="showHelpModal()"],
#library-view [onclick="showActivationModal()"],
#library-view #btn-activate {
    display: none !important;
}

/* Search bar - keep but restyle */
#library-view #pdf-search {
    background: var(--neuro-bg-surface) !important;
    border: 1px solid var(--neuro-border) !important;
    border-radius: 12px !important;
    color: var(--neuro-text-primary) !important;
    font-family: var(--font-body) !important;
}

#library-view #pdf-search:focus {
    border-color: var(--neuro-cyan) !important;
    box-shadow: 0 0 0 3px var(--neuro-cyan-glow) !important;
}

/* Book cards */
#library-view .book-card,
#library-view [class*="book-card"] {
    background: var(--neuro-bg-surface) !important;
    border: 1px solid var(--neuro-border) !important;
    border-radius: 16px !important;
    transition: all 0.2s ease !important;
}

#library-view .book-card:hover,
#library-view [class*="book-card"]:hover {
    border-color: var(--neuro-cyan) !important;
    box-shadow: 0 0 20px var(--neuro-cyan-glow) !important;
    transform: translateY(-4px) !important;
}

/* Buttons in library */
#library-view .btn,
#library-view button {
    font-family: var(--font-body) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   READER VIEW - Clean up old styles
   ═══════════════════════════════════════════════════════════════════════════════ */

#reader-view {
    background: var(--neuro-bg-deep) !important;
}

/* Page navigator - hide old one, use header */
.page-navigator,
#page-indicator-box {
    display: none !important;
}

/* Region counter badge - subtle styling */
.region-counter-badge {
    background: var(--neuro-bg-surface) !important;
    border: 1px solid var(--neuro-border-cyan) !important;
    color: var(--neuro-cyan) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .neuro-header__center {
        display: none;
    }

    .neuro-header__filename {
        max-width: 150px;
        font-size: 0.9rem;
    }

    .neuro-sidebar {
        width: 280px;
    }

    /* ══════════════════════════════════════
       NEURO FAB - Mobile positioning
       ══════════════════════════════════════ */
    .neuro-fab {
        bottom: 100px;
        right: 16px;
        width: 60px;
        height: 60px;
    }

    .neuro-fab__icon {
        font-size: 26px;
    }

    /* ══════════════════════════════════════
       NEURO TUTOR - BOTTOM SHEET (Mobile)
       Abre de BAIXO para cima, cobrindo 70%
       ══════════════════════════════════════ */
    .neuro-tutor {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: translateY(100%) !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 70vh;
        border-radius: 24px 24px 0 0 !important;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    }

    .neuro-tutor.is-open {
        transform: translateY(0) !important;
    }

    /* Handle de arraste (bottom sheet indicator) */
    .neuro-tutor::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .neuro-tutor__header {
        padding-top: 16px;
    }

    .neuro-dashboard {
        width: 95%;
        padding: 20px;
    }

    .neuro-dashboard__stats {
        grid-template-columns: 1fr;
    }

    /* ══════════════════════════════════════
       ACTION BAR - Mobile touch targets (44px min)
       ══════════════════════════════════════ */
    .neuro-action-bar {
        bottom: 140px;
        padding: 8px 10px;
    }

    .neuro-action-bar__btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* ══════════════════════════════════════
       SELECTION FABs - Mobile positioning
       ══════════════════════════════════════ */
    #btn-sniper-fab.sniper-fab,
    #btn-auto-select-fab.auto-select-fab,
    #btn-smart-hover-fab.smart-hover-fab {
        width: 52px !important;
        height: 52px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* ══════════════════════════════════════
       NEURO DOCK - Mobile Compact (Hamburger)
       ══════════════════════════════════════ */
    #neuro-dock.neuro-dock {
        padding: 6px 10px !important;
        border-radius: 18px !important;
        gap: 8px !important;
        justify-content: center !important;
        overflow: visible !important;
    }

    /* Hide ALL regular dock buttons on mobile */
    #neuro-dock .dock-btn.dock-eye-btn {
        display: none !important;
    }
    #neuro-dock .dock-controls-wrapper > .dock-btn:not(.dock-play) {
        display: none !important;
    }
    #neuro-dock .dock-controls-wrapper > .dock-divider {
        display: none !important;
    }

    /* Show mobile-only hamburger + region nav */
    #neuro-dock .dock-btn.dock-mobile-only {
        display: flex !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        border-radius: 14px !important;
        background: rgba(6, 214, 160, 0.08) !important;
        border: 1px solid rgba(6, 214, 160, 0.15) !important;
        color: var(--neuro-cyan) !important;
    }

    /* Config button — subtle different style */
    #neuro-dock #dock-config-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        border-radius: 12px !important;
        background: rgba(14, 165, 233, 0.08) !important;
        border: 1px solid rgba(14, 165, 233, 0.15) !important;
        color: var(--neuro-blue, #0ea5e9) !important;
    }

    /* Active Tool contextual button — hidden by default */
    #neuro-dock .dock-btn.dock-active-tool {
        display: none !important;
    }

    /* Active Tool contextual button — visible + pulsing when tool is active */
    #neuro-dock .dock-btn.dock-active-tool.dock-tool-visible {
        display: flex !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        border-radius: 12px !important;
        background: var(--active-tool-bg, rgba(6, 214, 160, 0.12)) !important;
        border: 1px solid var(--active-tool-color, #06d6a0) !important;
        color: var(--active-tool-color, #06d6a0) !important;
        animation: dock-tool-pulse 1.5s ease-in-out infinite !important;
    }

    @keyframes dock-tool-pulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(6, 214, 160, 0); }
        50% { box-shadow: 0 0 12px 2px rgba(6, 214, 160, 0.3); }
    }

    /* Play/Pause — larger, centered, circular */
    #neuro-dock .dock-btn.dock-play {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        border-radius: 50% !important;
    }

    /* ══════════════════════════════════════
       RULER CONTROLS - Mobile
       ══════════════════════════════════════ */
    .ruler-controls,
    #ruler-controls {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    /* ══════════════════════════════════════
       SIDEBAR ITEMS - Mobile touch targets
       ══════════════════════════════════════ */
    .neuro-sidebar__item {
        padding: 16px 20px !important;
        min-height: 52px;
    }

    .neuro-sidebar__user {
        /* safe-area: garante que o perfil não fique sob a barra de gestos/navegação */
        padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
        min-height: 60px;
    }

    /* ══════════════════════════════════════
       SIDEBAR DIVIDER & SECTION - Mobile
       ══════════════════════════════════════ */
    .neuro-sidebar__divider {
        margin: 8px 16px;
    }

    .neuro-sidebar__section-title {
        font-size: 10px;
        padding: 6px 20px 2px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRA SMALL MOBILE (iPhone SE, 375px)
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 375px) {
    .neuro-header__filename {
        max-width: 120px;
        font-size: 0.85rem;
    }

    .neuro-tutor {
        max-height: 80vh;
        padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    }

    .neuro-tutor__title {
        font-size: 1.2rem;
    }

    .neuro-tutor__credits {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .neuro-action-bar {
        padding: 6px 8px;
        gap: 2px;
    }

    .neuro-action-bar__btn--explain {
        padding: 0 12px;
    }

    .neuro-fab {
        width: 52px;
        height: 52px;
        bottom: 90px;
        right: 12px;
    }

    .neuro-fab__icon {
        font-size: 22px;
    }

    /* Sidebar - Extra small adjustments */
    .neuro-sidebar {
        width: 260px;
    }

    .neuro-sidebar__item {
        padding: 14px 16px !important;
        font-size: 0.9rem;
    }

    .neuro-sidebar__section-title {
        font-size: 9px;
        padding: 4px 16px 2px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ACESSIBILIDADE TDAH - Redução de Movimento
   Respeita preferências do usuário por menos animações
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    /* Desativa animações infinitas que podem causar distração */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Mantém apenas transições essenciais de UI */
    .neuro-tutor,
    .neuro-dashboard,
    .neuro-sidebar,
    .neuro-action-bar {
        transition-duration: 0.15s !important;
    }

    /* Remove o anel giratório do FAB */
    .neuro-fab::before {
        animation: none !important;
    }

    /* Remove pulsação do loader */
    .neuro-tutor__loader-bar {
        animation: none !important;
        opacity: 0.6;
    }

    /* Remove bubbles animados */
    .neuro-dashboard__xp-bubble {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODO ZEN - Foco Total para TDAH
   Remove TUDO exceto o texto do PDF
   ═══════════════════════════════════════════════════════════════════════════════ */

body.zen-mode .neuro-fab,
body.zen-mode .neuro-action-bar,
body.zen-mode .neuro-tutor:not(.is-open),
body.zen-mode #neuro-dock,
body.zen-mode .ruler-controls,
body.zen-mode #btn-sniper-fab,
body.zen-mode #btn-auto-select-fab,
body.zen-mode #btn-smart-hover-fab {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease;
}

/* Mostrar controles ao hover no zen mode (sutil) */
body.zen-mode:hover .neuro-fab,
body.zen-mode:hover #neuro-dock {
    opacity: 0.3;
    pointer-events: auto;
}

body.zen-mode:hover .neuro-fab:hover,
body.zen-mode:hover #neuro-dock:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FEEDBACK VISUAL CLARO - Micro-interações satisfatórias
   Dopamina sem distração
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Botão pressionado - feedback tátil */
.neuro-action-bar__btn:active,
.neuro-tutor__btn:active,
.neuro-fab:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Focus ring acessível */
.neuro-action-bar__btn:focus-visible,
.neuro-tutor__btn:focus-visible,
.neuro-fab:focus-visible,
.neuro-sidebar__item:focus-visible {
    outline: 2px solid var(--neuro-cyan);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONTEXTUAL TIPS - Dicas Contextuais
   ═══════════════════════════════════════════════════════════════════════════════ */

.contextual-tip {
    position: fixed;
    z-index: 10001;
    max-width: 320px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.contextual-tip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.contextual-tip__content {
    background: linear-gradient(135deg, rgba(15, 18, 25, 0.98), rgba(26, 32, 48, 0.98));
    border: 1px solid var(--neuro-border-cyan);
    border-radius: 16px;
    padding: 16px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(6, 214, 160, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.contextual-tip__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.contextual-tip__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neuro-cyan);
}

.contextual-tip__close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--neuro-text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.contextual-tip__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--neuro-text-primary);
}

.contextual-tip__message {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--neuro-text-secondary);
    margin: 0 0 12px 0;
}

.contextual-tip__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--neuro-cyan);
    border-radius: 0 0 16px 16px;
    animation: tip-progress linear forwards;
    width: 100%;
}

@keyframes tip-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.contextual-tip__arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, rgba(15, 18, 25, 0.98), rgba(26, 32, 48, 0.98));
    border: 1px solid var(--neuro-border-cyan);
    transform: rotate(45deg);
}

/* Arrow positions */
.contextual-tip--top .contextual-tip__arrow {
    bottom: -7px;
    left: 50%;
    margin-left: -6px;
    border-top: none;
    border-left: none;
}

.contextual-tip--bottom .contextual-tip__arrow {
    top: -7px;
    left: 50%;
    margin-left: -6px;
    border-bottom: none;
    border-right: none;
}

.contextual-tip--left .contextual-tip__arrow {
    right: -7px;
    top: 50%;
    margin-top: -6px;
    border-top: none;
    border-left: none;
}

.contextual-tip--right .contextual-tip__arrow {
    left: -7px;
    top: 50%;
    margin-top: -6px;
    border-bottom: none;
    border-right: none;
}

.contextual-tip--bottom-left .contextual-tip__arrow,
.contextual-tip--bottom-right .contextual-tip__arrow {
    top: -7px;
    border-bottom: none;
    border-right: none;
}

.contextual-tip--bottom-left .contextual-tip__arrow {
    left: 20px;
}

.contextual-tip--bottom-right .contextual-tip__arrow {
    right: 20px;
}

.contextual-tip--center .contextual-tip__arrow {
    display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .contextual-tip {
        max-width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px !important;
        transform: none !important;
    }

    .contextual-tip--top,
    .contextual-tip--bottom,
    .contextual-tip--left,
    .contextual-tip--right {
        bottom: 100px !important;
        top: auto !important;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   WCAG 2.5.5 — ALVOS DE TOQUE >=44px (controles neuro do header / tips)
   Estes têm classe neuro- ou __close, que o backstop coarse exclui de
   propósito, então recebem tamanho explícito aqui. Apêndice vence na ordem.
   ════════════════════════════════════════════════════════════════════════ */

/* (4) Hambúrguer do header: 24x18 -> caixa de toque 44x44 mantendo o glifo.
   box-sizing:border-box faz a borda de 44 ser o alvo; padding 13/10 deixa o
   conteúdo 24x18, então as 3 linhas (.neuro-header__menu-line width:100%)
   continuam idênticas. margin-left:-10 mantém o ícone alinhado à esquerda. */
.neuro-header__menu {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 13px 10px;
    box-sizing: border-box;
    margin-left: -10px;
}

/* (3a) NeuroTutor close: círculo 32 -> 44 (display:flex/border-radius mantidos) */
.neuro-tutor__close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

/* (3b) Contextual-tip close: MANTÉM o círculo visual de 24px; expande a área
   de toque pra 44px via ::before, com margem negativa pra não mexer no header. */
.contextual-tip__close {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    margin: -10px -10px -10px 0;
}
.contextual-tip__close::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
    transition: background 0.2s ease;
}
/* o hover agora pinta só o círculo (::before); o botão 44px fica transparente */
.contextual-tip__close:hover { background: transparent; }
.contextual-tip__close:hover::before { background: rgba(255, 255, 255, 0.2); }

/* (5) Toggle do Modo Zen (52x28): preserva a pílula; ::after estende a área
   de toque pra 44px de altura sem esticar o slider (position:absolute;inset:0). */
.neuro-toggle::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 44px;
}
