/**
 * editor.css — Éditeur ASCII v2
 * À charger APRÈS main.css :
 *   <link rel="stylesheet" href="styles/editor.css">
 */

.ascii-editor-window.ae2 {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(1440px, 94vw);
    height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fffdf7);
    border: var(--line, 2px solid #11110f);
    border-radius: 0;
    box-shadow: 10px 10px 0 var(--purple, #7357ff);
    z-index: 1000;
    overflow: hidden;
    user-select: none;
}

/* ── Barre d'outils ──────────────────────────────────────── */
.ae2 .ae-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ae2 .ae-flex { flex: 1; }

.ae2 .ae-action-btn[disabled] {
    opacity: .3;
    cursor: default;
}

.ae2 .ae-zoom-box {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--border);
    padding: 2px;
}

.ae2 .ae-zoom-val {
    min-width: 62px;
    height: 26px;
    border: none;
    background: transparent;
    font-size: .7rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--text);
    letter-spacing: .04em;
}

.ae2 .ae-zoom-val:hover { background: var(--primary-subtle); }

/* ── Barre d'options ─────────────────────────────────────── */
.ae2 .ae-optionsbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 10px;
    background: var(--card-bg2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
    font-size: .68rem;
}

.ae2 .ae-opt {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ae2 .ae-opt > label,
.ae2 .ae-toggle {
    font-size: .66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ae2 .ae-opt select,
.ae2 .ae-opt input[type="range"] {
    height: 24px;
    font-size: .7rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    padding: 0 4px;
}

.ae2 .ae-opt input[type="range"] { width: 96px; padding: 0; }

.ae2 .ae-opt output {
    min-width: 18px;
    text-align: center;
    font-weight: 800;
    font-size: .7rem;
}

.ae2 .ae-opt-char input {
    width: 36px;
    height: 28px;
    text-align: center;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 15px;
    font-weight: 700;
    border: 2px solid var(--ink, #11110f);
    background: var(--acid, #d9ff32);
    color: var(--ink, #11110f);
    padding: 0;
}

/* ── Corps ───────────────────────────────────────────────── */
.ae2 .ae-editor-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg);
}

.ae2 .ae-canvas-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    background: #1a1a18;
    cursor: crosshair;
}

.ae2 .ae-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Zone de saisie invisible qui capte le clavier */
.ae2 #ae-capture {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 2px;
    opacity: 0;
    border: none;
    resize: none;
    padding: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ── Panneau latéral ─────────────────────────────────────── */
.ae2 .ae-side {
    width: 206px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--card-bg);
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ae2 .ae-side-block { display: flex; flex-direction: column; gap: 6px; }

.ae2 .ae-side-title {
    font-size: .6rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.ae2 .ae-pal-group { margin-bottom: 6px; }

.ae2 .ae-pal-title {
    font-size: .58rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.ae2 .ae-pal-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.ae2 .ae-pal-char {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    background: var(--card-bg2);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ae2 .ae-pal-char:hover {
    background: var(--acid, #d9ff32);
    border-color: var(--ink, #11110f);
}

.ae2 .ae-side-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.ae2 .ae-side-actions button {
    padding: 5px 4px;
    font-size: .62rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--card-bg2);
    color: var(--text);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.ae2 .ae-side-actions button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.ae2 .ae-hint { font-size: .62rem; color: var(--text-muted); }

/* ── Barre d'état ────────────────────────────────────────── */
.ae2 .ae-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px;
    background: var(--card-bg2);
    border-top: 1px solid var(--border);
    font-size: .64rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 700;
}

.ae2 .ae-st-right { margin-left: auto; }
.ae2 .ae-status-bar .ae-st-right::before { content: none; }

/* ── Toast ───────────────────────────────────────────────── */
.ae2 .ae-toast {
    position: absolute;
    left: 50%;
    bottom: 48px;
    transform: translate(-50%, 12px);
    background: var(--ink, #11110f);
    color: var(--acid, #d9ff32);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 7px 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 20;
}

.ae2 .ae-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Poignée de redimensionnement ────────────────────────── */
.ae2 .ae-resize-grip {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 50%, var(--text-muted) 50%, var(--text-muted) 60%,
            transparent 60%, transparent 75%, var(--text-muted) 75%, var(--text-muted) 85%, transparent 85%);
    z-index: 15;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1080px) {
    .ae2 .ae-side { width: 168px; }
}

@media (max-width: 860px) {
    .ae2 .ae-side { display: none; }
    .ascii-editor-window.ae2 { width: 96vw; height: 94vh; }
}
