/* Добавляем новые стили */
.note {
    color: #00ffff;
    cursor: help;
    border-bottom: 1px dotted #00ffff;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border: 1px solid #00ffff;
    max-width: 500px;
    z-index: 1000;
}

.modal-content {
    white-space: pre-wrap;
}

.modal-back {
    color: #00ffff;
    cursor: pointer;
    margin-top: 15px;
    display: inline-block;
    border: 1px solid #00ffff;
    padding: 5px 10px;
}

/* ─── Content Layout ─────────────────────────────────────────────────────────
   #content is fixed-positioned by default so the block anchor never moves
   while the typewriter runs. Each .layout-* class sets the anchor point
   and text-align. center-unfixed is the only exception — it uses the body
   flexbox and lets the block float (original behaviour, jitters).
────────────────────────────────────────────────────────────────────────── */

#content {
    position: fixed;
    white-space: pre-wrap;
    max-width: 600px;
    width: 600px;
    padding: 20px;
    box-sizing: border-box;
}

/* center — anchor is top-left of what would be the visual center.
   Text grows down-right from the midpoint; no reflow jitter. */
.layout-center       { top: 50%; left: 50%; transform: translateX(-50%); text-align: left; }

/* left / right — vertically centered, pinned to edge */
.layout-left         { top: 50%; left: 40px;  transform: translateY(-50%); text-align: left; }
.layout-right        { top: 50%; right: 40px; transform: translateY(-50%); text-align: right; left: unset; }

/* top row */
.layout-top-left     { top: 40px;    left: 40px;              text-align: left; }
.layout-top-center   { top: 40px;    left: 50%; transform: translateX(-50%); text-align: left; }
.layout-top-right    { top: 40px;    right: 40px; left: unset; text-align: right; }

/* bottom row */
.layout-bottom-left  { bottom: 40px; left: 40px;              text-align: left; top: unset; }
.layout-bottom-center{ bottom: 40px; left: 50%; transform: translateX(-50%); top: unset; text-align: left; }
.layout-bottom-right { bottom: 40px; right: 40px; left: unset; top: unset; text-align: right; }

/* center-unfixed — original behaviour, block floats with flex body */
.layout-center-unfixed { position: static; width: auto; max-width: 600px; padding: 20px; }

/* Новые стили для логов */
.logs-window {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #00ff00;
    padding: 15px;
    max-width: 400px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 999;
    font-family: monospace;
    font-size: 12px;
    color: #00ff00;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.logs-content {
    white-space: pre-wrap;
}

/* Стиль для кликабельного слова */
.expand-word {
    color: #00ff00; /* Зелёный цвет */
    cursor: pointer;
    text-decoration: underline;
}

/* Стиль для неактивного слова после нажатия */
.expand-word.inactive {
    color: #00ff00; /* Зелёный цвет */
    cursor: default;
    text-decoration: none;
}

/* Стиль для текста, который появляется после нажатия */
.expand-text {
    color: white; /* Белый цвет */
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

/* Анимация появления текста */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* style.css */
/* ... предыдущие стили ... */

.control-window {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ff00ff;
    padding: 15px;
    max-width: 300px;
    z-index: 1001;
    font-family: monospace;
    color: #ff00ff;
}

.control-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.control-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-section h4 {
    margin: 0 0 8px 0;
    color: #00ffff;
}

#stepSelector {
    width: 100%;
    background: #111;
    color: white;
    border: 1px solid #00ffff;
    padding: 5px;
}

#stateFields input {
    width: 100%;
    margin-bottom: 5px;
    background: #222;
    color: white;
    border: 1px solid #00ffff;
    padding: 3px;
}

#jumpToStep {
    background: #000033;
    color: #00ffff;
    border: 1px solid #00ffff;
    padding: 5px 10px;
    cursor: pointer;
    margin-top: 5px;
    width: 100%;
}

#jumpToStep:hover {
    background: #000066;
}

#updateState {
    background: #003300;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 5px 10px;
    cursor: pointer;
}

#updateState:hover {
    background: #005500;
}

/* External panel toggle buttons — always visible, anchored to panel corners */
.panel-toggle {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    font-family: monospace;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    z-index: 1002;
}

.controls-toggle {
    top: 0;
    left: 20px;
    border: 1px solid #ff00ff;
    color: #ff00ff;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.logs-toggle {
    bottom: 0;
    right: 20px;
    border: 1px solid #00ff00;
    color: #00ff00;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
/* ─── Main Menu ─────────────────────────────────────────────────────────────── */

#menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.menu-title {
    font-size: 32px;
    letter-spacing: 0.3em;
    color: white;
    text-transform: uppercase;
}

.menu-meta {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.menu-icon-btn {
    background: transparent;
    border: 1px solid;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.menu-icon-btn.info {
    color: #4aa8ff;
    border-color: #4aa8ff;
}
.menu-icon-btn.info:hover  { background: rgba(74, 168, 255, 0.12); }

.menu-icon-btn.manual {
    color: #ffd700;
    border-color: #ffd700;
}
.menu-icon-btn.manual:hover { background: rgba(255, 215, 0, 0.1); }

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 240px;
}

.menu-entry {
    background: transparent;
    color: white;
    border: 1px solid white;
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.menu-entry:hover {
    background: rgba(255, 255, 0, 0.1);
}

.menu-error {
    color: #ff4444;
    font-size: 13px;
    text-align: center;
}

/* ─── Info / Manual overlay panels ──────────────────────────────────────────── */

.menu-overlay {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.96);
    padding: 30px;
    max-width: 560px;
    width: 90vw;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 2000;
    white-space: pre-wrap;
    line-height: 1.6;
}

.menu-overlay.info   { border: 1px solid #4aa8ff; color: #cce6ff; }
.menu-overlay.manual { border: 1px solid #ffd700; color: #fff8dc; }

.menu-overlay-close {
    display: inline-block;
    margin-top: 20px;
    cursor: pointer;
    border: 1px solid;
    padding: 4px 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}
.menu-overlay.info   .menu-overlay-close { color: #4aa8ff; border-color: #4aa8ff; }
.menu-overlay.manual .menu-overlay-close { color: #ffd700; border-color: #ffd700; }

/* ─── Content Layout ─────────────────────────────────────────────────────────── */
/* Applied to #content per-step via the `layout` field. Default: top-left.       */

#content.layout-top-left {
    top: 40px;
    left: 40px;
    transform: none;
    text-align: left;
}

#content.layout-top-center {
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#content.layout-top-right {
    top: 40px;
    right: 40px;
    left: auto;
    transform: none;
    text-align: right;
}

#content.layout-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: left;
}

/* ─── Back + Save buttons ────────────────────────────────────────────────────── */

.back-btn {
    top: 0;
    right: 20px;
    border: 1px solid #aaaaaa;
    color: #aaaaaa;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.save-btn {
    bottom: 0;
    left: 20px;
    border: 1px solid #ffaa00;
    color: #ffaa00;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

/* ─── Save Dialog ────────────────────────────────────────────────────────────── */

.save-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.96);
    border: 1px solid #ffaa00;
    padding: 24px;
    z-index: 3000;
    font-family: monospace;
    color: #ffaa00;
    min-width: 280px;
}

.save-dialog-title {
    margin-bottom: 14px;
    font-size: 14px;
}

.save-dialog input {
    width: 100%;
    background: #111;
    color: white;
    border: 1px solid #ffaa00;
    padding: 6px 8px;
    font-family: monospace;
    font-size: 13px;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.save-dialog-buttons {
    display: flex;
    gap: 8px;
}

.save-dialog-buttons button {
    flex: 1;
    background: transparent;
    border: 1px solid #ffaa00;
    color: #ffaa00;
    padding: 6px;
    cursor: pointer;
    font-family: monospace;
    font-size: 13px;
    transition: background 0.15s;
}

.save-dialog-buttons button:hover {
    background: rgba(255, 170, 0, 0.12);
}

.save-dialog-error {
    color: #ff4444;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}

/* ─── Menu save slots ────────────────────────────────────────────────────────── */

.menu-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 6px;
    padding-left: 12px;
}

.menu-slot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}

.menu-slot-load {
    color: #ffaa00;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s;
    flex: 1;
}

.menu-slot-load:hover { opacity: 1; }

.menu-slot-meta {
    color: #666;
    font-size: 11px;
    margin-left: 8px;
}

.menu-slot-delete {
    color: #ff4444;
    cursor: pointer;
    opacity: 0.6;
    font-size: 11px;
    transition: opacity 0.15s;
}

.menu-slot-delete:hover { opacity: 1; }

/* ─── Save trigger inline word ───────────────────────────────────────────────── */

.save-trigger {
    color: #ffaa00;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.save-trigger:hover { opacity: 0.8; }

/* ─── Control Panel dev save button ─────────────────────────────────────────── */

#devSave {
    background: #1a0f00;
    color: #ffaa00;
    border: 1px solid #ffaa00;
    padding: 5px 10px;
    cursor: pointer;
    font-family: monospace;
    width: 100%;
    margin-top: 4px;
    transition: background 0.15s;
}

#devSave:hover { background: #2a1800; } 
/* ─── History Navigation Buttons ────────────────────────────────────────────── */

.hist-btn {
    bottom: 0;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    font-size: 18px;
    padding: 2px 14px 4px;
    line-height: 1;
    border: 1px solid #888888;
    color: #888888;
    transition: opacity 0.15s;
}

.hist-prev-btn {
    /* sits just right of the save button — save btn is left:20px, ~80px wide */
    left: 108px;
    border-bottom: none;
}

.hist-next-btn {
    left: 152px;
    border-bottom: none;
}

/* ─── Reader / History-frozen elements ──────────────────────────────────────── */

.history-frozen {
    color: #555555 !important;
    cursor: default !important;
    text-decoration: none !important;
    border-bottom: none !important;
    pointer-events: none;
    opacity: 0.5;
}