/* === EDITOR.CSS === */
/* =========================================
   EDITOR, TOOLBAR, & CRT EFFECTS
   ========================================= */

/* Toolbar */
/* Toolbar (Horizontal Top-Left) */
#rt-toolbar {
    position: fixed;
    top: 48px;
    left: 0;
    width: 100%;
    height: 34px;
    /* Slimmer */
    background: var(--header-bg);
    border-bottom: 1px solid var(--main-color);
    display: flex;
    flex-direction: row;
    /* FORCE ROW */
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 10px;
    z-index: 100;
    /* Above screen wrapper, below header (2000) */
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    box-shadow: none;
}

#rt-toolbar.toolbar-hidden,
body:not([data-active-workspace="pantser"]) #rt-toolbar {
    display: none !important;
    transform: none;
}

.toolbar-group {
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: center;
    width: auto;
    margin-bottom: 0;
}

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--main-color);
    opacity: 0.5;
    margin: 0 5px;
    color: var(--main-color);
}

#rt-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--main-color);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 4px 8px;
    width: auto;
    height: auto;
    display: inline-block;
    border-radius: 2px;
    white-space: nowrap;
    min-width: 24px;
}

#rt-toolbar button:hover {
    border-color: var(--main-color);
    background: rgba(255, 255, 255, 0.1);
}

/* Screen Wrapper & CRT Effects */
#screen-wrapper {
    position: relative;
    width: 100%;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    box-sizing: border-box;
    background-color: var(--bg-color);
}

#editor-container::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.4) 100%);
    opacity: var(--vignette-opacity);
    pointer-events: none;
    z-index: 12;
}

#editor-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    opacity: var(--scanline-opacity);
    pointer-events: none;
    z-index: 10;
}

/* =========================================
   SCREEN SIMULATION EFFECT OVERLAYS
   ========================================= */
#screen-fx-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 11;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

/* 1. Oscilloscope Vector Graticule */
#screen-fx-overlay.fx-oscilloscope {
    opacity: 0.55;
    background-image:
        linear-gradient(to right, rgba(0, 240, 255, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 240, 255, 0.12) 1px, transparent 1px),
        linear-gradient(to right, transparent calc(50% - 1px), rgba(0, 240, 255, 0.35) 50%, transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(0, 240, 255, 0.35) 50%, transparent calc(50% + 1px));
    background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%;
}

/* 3. Tactical Military Grid / HUD */
#screen-fx-overlay.fx-tactical {
    opacity: 0.7;
    background-image:
        radial-gradient(circle 2px at 30px 30px, var(--main-color, #ffcc00) 100%, transparent 0),
        linear-gradient(to right, rgba(255, 204, 0, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 204, 0, 0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    border: 2px solid rgba(255, 204, 0, 0.2);
    margin: 10px;
    box-sizing: border-box;
}

#screen-fx-overlay.fx-tactical::before {
    content: '[ TACTICAL HUD :: SYS.READY ]';
    position: absolute;
    top: 10px;
    left: 20px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--main-color, #ffcc00);
    opacity: 0.6;
}

#screen-fx-overlay.fx-tactical::after {
    content: '+';
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-family: monospace;
    font-size: 16px;
    color: var(--main-color, #ffcc00);
    opacity: 0.5;
}

/* 4. Negative Camera / X-Ray Film Inversion */
#screen-fx-overlay.fx-negative {
    opacity: 0.45;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(208, 232, 255, 0.15) 80%, rgba(0, 0, 0, 0.8) 100%);
    backdrop-filter: invert(0.08);
}

/* 5. CCTV Security / Camcorder VHS */
#screen-fx-overlay.fx-cctv {
    opacity: 0.75;
    border: 1px solid rgba(152, 251, 152, 0.2);
    margin: 12px;
}

#screen-fx-overlay.fx-cctv::before {
    content: '● REC   SP   00:24:19   CH-01 [NIGHT-VISION]';
    position: absolute;
    top: 14px;
    left: 24px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--main-color, #98fb98);
    animation: cctv-rec-blink 1.5s infinite;
}

#screen-fx-overlay.fx-cctv::after {
    content: 'AUTO-EXPOSURE [CAM-01]';
    position: absolute;
    bottom: 14px;
    right: 24px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--main-color, #98fb98);
    opacity: 0.7;
}

@keyframes cctv-rec-blink {
    0%, 49% { opacity: 0.9; }
    50%, 100% { opacity: 0.3; }
}

/* 6. Dot-Matrix LCD Sub-Pixel Grid */
#screen-fx-overlay.fx-lcd {
    opacity: 0.4;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.35) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 1px, transparent 1px);
    background-size: 3px 3px;
}

/* 7. 35mm Film Projector Grain */
#screen-fx-overlay.fx-film-grain {
    opacity: 0.3;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 0);
    background-size: 4px 4px;
    animation: film-grain-shift 0.2s steps(2) infinite;
}

@keyframes film-grain-shift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-2px, 1px); }
    100% { transform: translate(1px, -1px); }
}

/* 8. CRT Shadow Mask (Phosphor Dot Triads) */
#screen-fx-overlay.fx-shadow-mask {
    opacity: 0.45;
    background:
        radial-gradient(circle at 2px 2px, rgba(255, 0, 0, 0.4) 1px, transparent 1px),
        radial-gradient(circle at 4px 2px, rgba(0, 255, 0, 0.4) 1px, transparent 1px),
        radial-gradient(circle at 3px 4px, rgba(0, 0, 255, 0.4) 1px, transparent 1px);
    background-size: 5px 5px;
}

/* 9. Trinitron Aperture Grille */
#screen-fx-overlay.fx-aperture-grille {
    opacity: 0.35;
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.15) 0px, rgba(0, 255, 0, 0.15) 1px, rgba(0, 0, 255, 0.15) 2px, transparent 3px);
    background-size: 3px 100%;
}
#screen-fx-overlay.fx-aperture-grille::before,
#screen-fx-overlay.fx-aperture-grille::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.65);
    box-shadow: 0 0 1px rgba(255, 255, 255, 0.2);
}
#screen-fx-overlay.fx-aperture-grille::before { top: 33.3%; }
#screen-fx-overlay.fx-aperture-grille::after { top: 66.6%; }

/* 10. Spherical CRT Glass Barrel Curvature */
#screen-fx-overlay.fx-crt-curvature {
    opacity: 0.85;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.95), inset 0 0 150px rgba(0, 0, 0, 0.8);
    background: radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, 0.6) 90%, rgba(0, 0, 0, 0.95) 100%);
    border-radius: 12px;
}

/* 11. VHS Magnetic Tape Static Noise */
#screen-fx-overlay.fx-vhs-static {
    opacity: 0.55;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0px, transparent 1px, transparent 2px),
        radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 0);
    background-size: 100% 3px, 6px 6px;
    animation: vhs-tracking-jitter 0.12s steps(3) infinite;
}

@keyframes vhs-tracking-jitter {
    0% { transform: translateY(0px); }
    33% { transform: translateY(2px); }
    66% { transform: translateY(-1px); }
    100% { transform: translateY(0px); }
}

body.epilepsy-safe-mode #screen-fx-overlay.fx-vhs-static {
    animation: none;
    opacity: 0.2;
}

#rolling-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.12), transparent);
    opacity: var(--rolling-bar-opacity);
    animation: roll var(--rolling-bar-speed, 8s) linear infinite;
    pointer-events: none;
    z-index: 15;
}

/* 1. Classic Soft Single Beam */
#rolling-bar.roll-soft-single {
    height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.14), transparent);
}

/* 2. Sharp Phosphor Sweep (The White / Color Scanline) */
#rolling-bar.roll-sharp-white {
    height: 14%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 40%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 0.35) 60%,
        transparent 100%
    );
    mix-blend-mode: screen;
}

/* 3. Power Supply Hum Bars (60Hz / 50Hz Ground Loop Dual Waves) */
#rolling-bar.roll-hum-bars {
    height: 48%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.35) 15%,
        rgba(255, 255, 255, 0.12) 30%,
        transparent 50%,
        rgba(0, 0, 0, 0.35) 65%,
        rgba(255, 255, 255, 0.12) 80%,
        transparent 100%
    );
}

/* 4. Camera Rolling Bar (V-Blanking Interval Out-of-Phase Shutter) */
#rolling-bar.roll-camera-blanking {
    height: 30%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.4) 20%,
        rgba(0, 0, 0, 0.85) 45%,
        rgba(0, 0, 0, 0.95) 50%,
        rgba(0, 0, 0, 0.85) 55%,
        rgba(0, 0, 0, 0.4) 80%,
        transparent 100%
    );
    mix-blend-mode: multiply;
}

/* 5. Triple Interlaced Tri-Bar */
#rolling-bar.roll-tri-bar {
    height: 40%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 15%,
        transparent 30%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 70%,
        rgba(255, 255, 255, 0.1) 85%,
        transparent 100%
    );
}

/* 6. Vertical Sync / Deflection Slip */
#rolling-bar.roll-vsync-deflection {
    height: 32%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.7) 15%,
        rgba(255, 255, 255, 0.25) 30%,
        rgba(0, 0, 0, 0.95) 50%,
        rgba(255, 255, 255, 0.3) 60%,
        rgba(0, 0, 0, 0.7) 85%,
        transparent 100%
    );
}

/* 7. Aperture Grille Dampening Wires (Trinitron Damper Lines) */
#rolling-bar.roll-aperture-grille {
    height: 100%;
    top: 0 !important;
    animation: trinitron-vibrate 0.12s infinite !important;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 32.5%,
        rgba(0, 0, 0, 0.75) 33%,
        rgba(0, 0, 0, 0.75) 33.3%,
        transparent 33.8%,
        transparent 65.5%,
        rgba(0, 0, 0, 0.75) 66%,
        rgba(0, 0, 0, 0.75) 66.3%,
        transparent 66.8%,
        transparent 100%
    );
}

@keyframes trinitron-vibrate {
    0% { transform: translateY(0); }
    50% { transform: translateY(0.5px); }
    100% { transform: translateY(0); }
}

@keyframes roll {
    from {
        top: -50%;
    }

    to {
        top: 130%;
    }
}

/* Editor Text Area */
#editor {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: none;
    height: var(--view-height);
    text-align: justify;
    background: transparent;
    border: none;
    outline: none;
    color: var(--main-color);
    -webkit-text-fill-color: var(--main-color);
    caret-color: var(--main-color);
    font-family: var(--font-family), var(--cjk-stack);
    font-size: var(--font-size);
    letter-spacing: var(--letter-spacing);
    line-height: var(--line-height);
    text-shadow: calc(var(--aberration-offset) * -1) 0 rgba(255, 0, 0, 0.5), var(--aberration-offset) 0 rgba(0, 0, 255, 0.5), 0 0 calc(var(--glow-strength) * 10px) var(--main-color);
    padding: 40px 50px 50vh 50px;
    box-sizing: border-box;
    overflow-y: auto;
    white-space: pre-wrap;
    -webkit-user-select: text;
    user-select: text;
}

#editor-container.glow-cycle-active #editor {
    animation: crt-glow-breathe 4s ease-in-out infinite alternate;
}

@keyframes crt-glow-breathe {
    0% {
        text-shadow: calc(var(--aberration-offset) * -1) 0 rgba(255, 0, 0, 0.5), var(--aberration-offset) 0 rgba(0, 0, 255, 0.5), 0 0 calc(var(--glow-strength) * 6px) var(--main-color);
    }
    100% {
        text-shadow: calc(var(--aberration-offset) * -1) 0 rgba(255, 0, 0, 0.7), var(--aberration-offset) 0 rgba(0, 0, 255, 0.7), 0 0 calc(var(--glow-strength) * 15px) var(--main-color), 0 0 calc(var(--glow-strength) * 28px) var(--main-color);
    }
}

#editor * {
    color: inherit;
    -webkit-text-fill-color: inherit;
}

body.has-vis-lines-mask #editor {
    --vis-line-h: calc(var(--font-size, 24px) * var(--line-height, 1.5));
    --vis-aperture-h: calc(var(--vis-lines-count, 3) * var(--vis-line-h));
    --vis-top-cutoff: calc(40% - (var(--vis-aperture-h) / 2));
    --vis-bottom-cutoff: calc(40% + (var(--vis-aperture-h) / 2));

    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        transparent calc(var(--vis-top-cutoff) - 12px),
        black var(--vis-top-cutoff),
        black var(--vis-bottom-cutoff),
        transparent calc(var(--vis-bottom-cutoff) + 12px),
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        transparent calc(var(--vis-top-cutoff) - 12px),
        black var(--vis-top-cutoff),
        black var(--vis-bottom-cutoff),
        transparent calc(var(--vis-bottom-cutoff) + 12px),
        transparent 100%
    );
}

/* =========================================
   BLOCK CURSOR MODE
   ========================================= */
body.block-cursor-mode #editor {
    caret-shape: block;
}

body.block-cursor-mode #editor,
body.block-cursor-mode #editor * {
    caret-color: var(--main-color);
}

@supports (caret-shape: block) {
    body.block-cursor-mode #editor {
        caret-shape: block;
    }
}

/* =========================================
   LINTER MARKS
   ========================================= */
.lint-mark {
    text-decoration: underline wavy var(--main-color);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    font-weight: 400 !important;
    background-color: transparent !important;
    text-shadow: inherit;
    display: inline-block;
    vertical-align: baseline;
}

.lint-mark.lint-quote-closer {
    text-decoration-color: var(--warning-color, #ff3333);
    text-decoration-style: wavy;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.lint-mark.lint-name-inconsistent {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: double;
}

.lint-mark.lint-overused {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: dashed;
}

.lint-mark.lint-prose-pattern {
    text-decoration-color: var(--main-color);
    text-decoration-style: dotted;
    text-decoration-thickness: 2px;
}

.lint-mark.lint-dialogue {
    text-decoration-color: var(--main-color);
    text-decoration-style: wavy;
    opacity: 0.9;
}

.lint-mark.lint-dense {
    background-color: rgba(255, 180, 0, 0.08) !important;
}

.lint-mark.lint-fragment {
    text-decoration-style: dashed;
    opacity: 0.85;
}

.lint-mark.lint-qa {
    text-decoration-style: dotted;
}

.lint-mark.lint-echo {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: wavy;
}

.lint-mark.lint-redundancy {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: wavy;
    text-decoration-thickness: 1.5px;
}

.lint-mark.lint-nominalization {
    text-decoration-color: var(--main-color);
    text-decoration-style: dotted;
    text-decoration-thickness: 2px;
}

.lint-mark.lint-said-bookisms {
    text-decoration-color: var(--main-color);
    text-decoration-style: dashed;
}

.lint-mark.lint-repeated-openers {
    text-decoration-color: var(--main-color);
    text-decoration-style: solid;
    text-decoration-thickness: 2px;
}

.lint-mark.lint-vague {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: dotted;
}

.lint-mark.lint-emotion-thesaurus {
    text-decoration-color: var(--main-color);
    text-decoration-style: dotted;
    text-decoration-thickness: 1.5px;
}

.lint-mark.lint-sensory {
    text-decoration-color: var(--main-color);
    text-decoration-style: solid;
    text-decoration-thickness: 1px;
}

.lint-mark.lint-sensory-sight {
    text-decoration-style: solid;
}

.lint-mark.lint-sensory-sound {
    text-decoration-style: dashed;
}

.lint-mark.lint-sensory-smell {
    text-decoration-style: dotted;
}

.lint-mark.lint-sensory-taste {
    text-decoration-style: double;
}

.lint-mark.lint-sensory-touch {
    text-decoration-style: wavy;
}

.lint-mark.lint-subject-verb {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: dashed;
    text-decoration-thickness: 2px;
    background-color: rgba(255, 170, 0, 0.08) !important;
}

.lint-mark.lint-emphatic-end {
    text-decoration-color: var(--warning-color, #ffaa00);
    text-decoration-style: dotted;
    text-decoration-thickness: 2px;
}

.lint-mark.lint-word-territory {
    text-decoration-color: #ff77aa;
    text-decoration-style: wavy;
    text-decoration-thickness: 1.5px;
}

.lint-mark.lint-character-traits {
    text-decoration-color: #00e5ff;
    text-decoration-style: double;
    text-decoration-thickness: 1.5px;
}

.lint-mark.lint-articulate-dialogue {
    text-decoration-color: #ff9955;
    text-decoration-style: dashed;
    text-decoration-thickness: 2px;
    background-color: rgba(255, 153, 85, 0.08) !important;
}

.lint-mark.lint-self-interruption {
    text-decoration-color: #55ffcc;
    text-decoration-style: solid;
    text-decoration-thickness: 2px;
    background-color: rgba(85, 255, 204, 0.12) !important;
}

.lint-mark.lint-subtext-evasion {
    text-decoration-color: #ff44aa;
    text-decoration-style: wavy;
    text-decoration-thickness: 2px;
    background-color: rgba(255, 68, 170, 0.12) !important;
}

.lint-mark:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    cursor: help;
}

.lint-floating-tooltip {
    position: fixed;
    z-index: 100000;
    background: var(--bg-color);
    color: var(--main-color);
    border: 1px solid var(--main-color);
    padding: 4px 8px;
    font-size: 11px;
    font-family: var(--font-family, monospace);
    border-radius: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.85);
    pointer-events: none;
    white-space: nowrap;
}

/* Active Stepper Jump Target */
.lint-mark.lint-active-target {
    background-color: rgba(255, 255, 255, 0.25) !important;
    outline: 2px solid var(--main-color);
    outline-offset: 2px;
    animation: targetPulse 1.5s ease-in-out infinite alternate;
}

@keyframes targetPulse {
    0% {
        outline-color: var(--main-color);
        box-shadow: 0 0 5px var(--main-color);
    }
    100% {
        outline-color: var(--warning-color, #ffaa00);
        box-shadow: 0 0 15px var(--warning-color, #ffaa00);
    }
}

/* Stepper Navigator in Toolbar */
.stepper-nav-btn {
    font-size: 11px !important;
    padding: 2px 6px !important;
    min-width: 22px !important;
}

.stepper-counter {
    color: var(--main-color);
    font-weight: bold;
    user-select: none;
}

/* =========================================
   MAIN WORKSPACE FLEX & LAYOUT
   ========================================= */
#workspace-flex {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 5;
    box-sizing: border-box;
    transition: flex-direction 0.3s ease;
}

#workspace-flex.orient-vertical {
    flex-direction: column;
}

#editor-container {
    flex: 1 1 auto;
    width: 100%;
    height: 100% !important;
    max-height: 100% !important;
    position: relative;
    overflow: hidden;
    filter: blur(var(--blur-amount));
    animation: flicker 0.15s infinite;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    box-shadow: none;
    transform: translate(var(--jitter-x), var(--jitter-y));
}

#panel-resizer {
    flex: 0 0 auto;
    background: transparent;
    z-index: 50;
    transition: background 0.2s;
}

#panel-resizer:hover,
#panel-resizer.active {
    background: rgba(0, 255, 65, 0.25);
}

@keyframes flicker {
    0% {
        opacity: 0.99;
    }

    50% {
        opacity: calc(1 - var(--flicker-strength));
    }

    100% {
        opacity: 1;
    }
}

/* Rhythm Graph */
#rhythm-graph {
    height: 60px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    opacity: 1;
    overflow-x: auto;
    padding-bottom: 2px;
}

.rhythm-bar {
    background: var(--main-color);
    width: 6px;
    min-height: 4px;
    flex-shrink: 0;
    transition: height 0.3s ease;
}

/* Linter Options */
#linter-options label {
    justify-content: flex-start;
    gap: 10px;
    cursor: pointer;
    text-align: left;
}

#linter-options input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

/* Waveform Sound Viewer Bar */
#bottom-bar {
    position: relative;
    width: 100%;
    height: 38px;
    background: var(--header-bg);
    border-top: 1px solid var(--main-color);
    border-bottom: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none;
    box-sizing: border-box;
}

canvas#wave-bar {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0.85;
}

/* Chapter Selector & Chapter Items */
.chapter-select-dropdown {
    font-size: 11px;
    height: 22px;
    background: var(--panel-bg, rgba(0, 0, 0, 0.3));
    color: var(--main-color);
    border: 1px solid var(--main-color);
    border-radius: 2px;
    max-width: 150px;
    cursor: pointer;
    font-family: inherit;
}

.chapter-select-dropdown option {
    background: #000;
    color: var(--main-color);
    font-family: inherit;
    padding: 3px 6px;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 6px;
    margin-bottom: 2px;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-size: 11px;
    border: 1px solid transparent;
}

.chapter-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.chapter-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--main-color);
}

.chapter-item-left {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-wc-badge {
    font-size: 10px;
    opacity: 0.75;
    white-space: nowrap;
    padding: 1px 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}

/* =========================================
   E-INK (E-INK DEVICE) THEME OPTIMIZATION
   ========================================= */

[data-theme="e-ink"],
body.theme-e-ink {
    --main-color: #000000 !important;
    --bg-color: #ffffff !important;
    --panel-bg: #f2f2f2 !important;
    --panel-text: #000000 !important;
    --header-bg: #ffffff !important;
    --success-color: #000000 !important;
    --border-color: #000000 !important;
    --selection-bg: #cccccc !important;
    --selection-color: #000000 !important;
}

[data-theme="e-ink"] *,
body.theme-e-ink * {
    transition: none !important;
    animation: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
}

[data-theme="e-ink"] #editor,
body.theme-e-ink #editor {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    caret-color: #000000 !important;
    text-shadow: none !important;
    font-family: var(--font-family), 'Atkinson Hyperlegible', sans-serif !important;
}

[data-theme="e-ink"] .sys-btn,
[data-theme="e-ink"] button,
body.theme-e-ink .sys-btn,
body.theme-e-ink button {
    border: 1.5px solid #000000 !important;
    background: transparent !important;
    color: #000000 !important;
    box-shadow: none !important;
}

[data-theme="e-ink"] .sys-btn:hover,
[data-theme="e-ink"] button:hover,
body.theme-e-ink .sys-btn:hover,
body.theme-e-ink button:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

/* =========================================
   TELEPROMPTER / READ-THROUGH MODE
   ========================================= */

body.teleprompter-mode {
    overflow: hidden;
}

body.teleprompter-mode header,
body.teleprompter-mode #underdeck-toggle,
body.teleprompter-mode #underdeck,
body.teleprompter-mode #world-builder-panel,
body.teleprompter-mode #game-deck-panel {
    pointer-events: none;
    opacity: 0.25;
    filter: grayscale(1);
    transition: opacity 0.3s ease;
}

body.teleprompter-mode #editor {
    cursor: default;
    user-select: text;
    padding-top: 25vh !important;
    padding-bottom: 50vh !important;
    scroll-behavior: auto !important;
}

/* Eye-line Focal Reading Guide */
.teleprompter-reading-guide {
    position: fixed;
    top: 45vh;
    left: 0;
    right: 0;
    height: 10vh;
    pointer-events: none;
    z-index: 25000;
    border-top: 1.5px dashed var(--main-color, #ffff00);
    border-bottom: 1.5px dashed var(--main-color, #ffff00);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
}

.teleprompter-guide-line {
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 1px;
    background: var(--main-color, #ffff00);
    opacity: 0.35;
}

/* Floating Teleprompter HUD */
.teleprompter-hud {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30000;
    background: var(--panel-bg, #111111);
    border: 2px solid var(--main-color, #ffff00);
    border-radius: 6px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 15px rgba(0, 0, 0, 0.6);
    color: var(--panel-text, var(--main-color, #ffff00));
    font-family: inherit;
    animation: tpFadeIn 0.2s ease-out;
}

@keyframes tpFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 12px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.teleprompter-hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.teleprompter-hud-title {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--main-color, #ffff00);
}

.teleprompter-progress-badge {
    font-size: 10px;
    font-family: monospace;
    font-weight: bold;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--main-color, #ffff00);
    border-radius: 3px;
}

.teleprompter-hud-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tp-btn {
    background: transparent;
    border: 1px solid var(--main-color, #ffff00);
    color: var(--main-color, #ffff00);
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.tp-btn:hover {
    background: var(--main-color, #ffff00);
    color: var(--bg-color, #000000);
}

.tp-btn.active,
.tp-btn-primary {
    background: var(--main-color, #ffff00);
    color: var(--bg-color, #000000);
}

.tp-btn-exit {
    color: var(--warning-color, #ff4444);
    border-color: var(--warning-color, #ff4444);
}

.tp-btn-exit:hover {
    background: var(--warning-color, #ff4444);
    color: #ffffff;
}

.tp-speed-stepper {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 1px 3px;
}

.tp-speed-val {
    font-size: 10.5px;
    font-family: monospace;
    font-weight: bold;
    min-width: 34px;
    text-align: center;
}

/* =========================================
   CADENCE WAVEFORM & SENTENCE RHYTHM (Tools 18, 19, 52)
   ========================================= */
.interactive-cadence-graph {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 70px;
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow-x: auto;
    overflow-y: hidden;
}

.cadence-bar {
    flex: 0 0 6px;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.cadence-bar:hover {
    transform: scaleY(1.15) translateY(-2px);
    filter: brightness(1.3);
}

.cadence-bar.cadence-short {
    background-color: var(--main-color, #00ff66);
}

.cadence-bar.cadence-med {
    background-color: #38bdf8;
}

.cadence-bar.cadence-long {
    background-color: #c084fc;
}

.cadence-bar.cadence-truth-5 {
    background-color: #ffd700 !important;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.8);
    position: relative;
}

.cadence-bar.active-cadence-bar {
    outline: 2px solid #ffffff;
    filter: brightness(1.5);
}

/* =========================================
   LADDER OF ABSTRACTION METER (Tool 22)
   ========================================= */
.abstraction-track {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 170, 0, 0.18);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#abstraction-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--main-color, #00ff66), #00e5ff);
    transition: width 0.3s ease;
}

.chip-mini {
    display: inline-block;
    padding: 1px 5px;
    margin: 2px;
    font-size: 8.5px;
    border-radius: 3px;
    font-family: inherit;
}

.chip-mini.concrete {
    background: rgba(0, 255, 100, 0.12);
    border: 1px solid var(--main-color, #00ff66);
    color: var(--main-color, #00ff66);
}

.chip-mini.abstract {
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid var(--warning-color, #ffaa00);
    color: var(--warning-color, #ffaa00);
}

/* =========================================
   THE 15–20% PRUNING CHALLENGE (Tools 10 & 37)
   ========================================= */
#pruning-modal,
.pruning-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    padding: 20px;
}

.pruning-modal-content {
    background: var(--bg-color, #111111);
    color: var(--text-color, #ffffff);
    border: 1px solid var(--main-color, #00ff66);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(0, 255, 100, 0.2);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    border-radius: 6px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pruning-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.pruning-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pruning-icon {
    font-size: 24px;
    color: var(--main-color, #00ff66);
}

.pruning-title {
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: var(--main-color, #00ff66);
}

.pruning-subtitle {
    font-size: 10px;
    opacity: 0.75;
}

.pruning-close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

.pruning-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pruning-target-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.prune-target-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--main-color, #00ff66);
    color: var(--main-color, #00ff66);
    padding: 5px 10px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.prune-target-btn:hover {
    background: rgba(0, 255, 100, 0.15);
}

.prune-target-btn.active {
    background: var(--main-color, #00ff66);
    color: var(--bg-color, #000000);
}

.prune-target-btn.secondary {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    margin-left: auto;
}

.pruning-progress-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pruning-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: bold;
    opacity: 0.9;
}

.pruning-progress-track {
    height: 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.pruning-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--main-color, #00ff66), #00e5ff);
    transition: width 0.3s ease;
}

.pruning-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.pruning-stat-tile {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 8px;
    text-align: center;
}

.pruning-stat-tile.highlight {
    border-color: var(--main-color, #00ff66);
    background: rgba(0, 255, 100, 0.05);
}

.pruning-stat-val {
    font-size: 16px;
    font-weight: bold;
    font-family: monospace;
    margin-bottom: 2px;
}

.pruning-stat-lbl {
    font-size: 8.5px;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.pruning-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.prune-pill-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: inherit;
    font-size: 9.5px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.prune-pill-btn:hover {
    border-color: var(--main-color, #00ff66);
    background: rgba(0, 255, 100, 0.1);
}

.pruning-diff-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    max-height: 160px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 10.5px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.diff-del {
    background: rgba(255, 68, 68, 0.25);
    color: #ff8888;
    text-decoration: line-through;
}

.diff-add {
    background: rgba(0, 255, 100, 0.25);
    color: #88ffaa;
}

.pruning-footer {
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

/* === VIRTUALIZED VIEWPORT & BLOCK RECYCLING (PHASE 2) === */
.virtual-spacer-top,
.virtual-spacer-bottom {
    width: 100%;
    pointer-events: none;
    user-select: none;
    box-sizing: border-box;
}

.virtual-block {
    margin: 0 0 1.2em 0;
    line-height: inherit;
    min-height: 1.5em;
    outline: none;
    box-sizing: border-box;
}

/* === SELF SUGGESTION & TRACK CHANGES MODE (PHASE 5) === */
del.diff-del {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
    text-decoration: line-through;
    border-radius: 2px;
    padding: 0 2px;
    cursor: pointer;
    transition: background 0.15s ease;
}

del.diff-del:hover {
    background: rgba(239, 68, 68, 0.4);
}

ins.diff-ins {
    background: rgba(34, 197, 94, 0.22);
    color: #86efac;
    text-decoration: underline;
    border-radius: 2px;
    padding: 0 2px;
    cursor: pointer;
    transition: background 0.15s ease;
}

ins.diff-ins:hover {
    background: rgba(34, 197, 94, 0.4);
}

/* Before / After / Diff view toggling on editor and preview containers */
.suggestion-view-before del.diff-del {
    text-decoration: none !important;
    background: transparent !important;
    color: inherit !important;
}

.suggestion-view-before ins.diff-ins {
    display: none !important;
}

.suggestion-view-after del.diff-del {
    display: none !important;
}

.suggestion-view-after ins.diff-ins {
    text-decoration: none !important;
    background: transparent !important;
    color: inherit !important;
}

/* Inline Suggestion Action Pill */
.suggestion-action-pill {
    position: absolute;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--panel-bg, #1e293b);
    border: 1px solid var(--main-color, #38bdf8);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    font-size: 11px;
    color: var(--panel-text, #f8fafc);
    animation: fadeInPill 0.15s ease-out;
}

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

.suggestion-btn-accept {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
    border-radius: 12px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: 10px;
    cursor: pointer;
}

.suggestion-btn-reject {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid #ef4444;
    border-radius: 12px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: 10px;
    cursor: pointer;
}

/* Self Suggestion Cards in Editor Studio */
.self-sug-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.self-sug-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 11.5px;
    line-height: 1.5;
}

.self-sug-col {
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.15);
}

.self-sug-col-before {
    border-left: 3px solid #ef4444;
}

.self-sug-col-after {
    border-left: 3px solid #22c55e;
}

/* Save Menu Modal Feedback Toast */
.save-toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    background: var(--panel-bg, #0f172a);
    color: var(--main-color, #38bdf8);
    border: 1px solid var(--main-color, #38bdf8);
    border-radius: 8px;
    padding: 10px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    animation: toastSlideIn 0.25s ease-out;
}

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