* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: transparent; color: white; font-family: 'Segoe UI', Tahoma, sans-serif; overflow: hidden; }

#canvas { position: fixed; top: 0; left: 0; z-index: 1; pointer-events: none; }

#crosshair {
    position: fixed; top: 50%; left: 50%;
    width: 16px; height: 16px;
    transform: translate(-50%, -50%);
    z-index: 100; pointer-events: none; opacity: 0.8;
}
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #0f0; }
#crosshair::before { top: 50%; left: 0; width: 100%; height: 1px; }
#crosshair::after { top: 0; left: 50%; width: 1px; height: 100%; }

#status { position: fixed; top: 5px; left: 5px; z-index: 100; font-size: 10px; color: #0f0; opacity: 0.5; font-family: monospace; }

/* --- ПЛАВАЮЩИЙ КРУЖОК --- */
#menuToggle {
    position: fixed; bottom: 20px; left: 20px; z-index: 400;
    width: 30px; height: 30px;
    background: #a855f7; border-radius: 50%;
    cursor: pointer; pointer-events: auto;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
    transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
#menuToggle:hover { transform: scale(1.2); background: #c084fc; }
#menuToggle::after {
    content: ''; display: block; width: 10px; height: 10px;
    border-left: 2px solid white; border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(2px, -2px);
}

/* --- ПЛАВАЮЩЕЕ ОКНО --- */
#testWindow {
    position: fixed; top: 45px; left: 5px; z-index: 200;
    width: 230px; max-height: 90vh; overflow-y: auto;
    background: rgba(10, 10, 10, 0.95); border: 1px solid #444; border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace; font-size: 11px;
    pointer-events: auto; user-select: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8); cursor: grab;
}
#testWindow.dragging { cursor: grabbing; }
#testWindow::-webkit-scrollbar { width: 4px; }
#testWindow::-webkit-scrollbar-track { background: #111; }
#testWindow::-webkit-scrollbar-thumb { background: #a855f7; border-radius: 2px; }

/* --- ПЛАВАЮЩЕЕ ОКНО SPEC LIST --- */
#specListWindow {
    position: fixed; top: 45px; right: 5px; z-index: 250;
    width: 260px; max-height: 90vh; overflow-y: auto;
    background: rgba(10, 10, 10, 0.95); border: 1px solid #444; border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace; font-size: 11px;
    pointer-events: auto; user-select: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8); cursor: grab;
}
#specListWindow.dragging { cursor: grabbing; }
#specListWindow::-webkit-scrollbar { width: 4px; }
#specListWindow::-webkit-scrollbar-track { background: #111; }
#specListWindow::-webkit-scrollbar-thumb { background: #a855f7; border-radius: 2px; }
.spec-row { padding: 5px 10px; border-bottom: 1px solid #222; font-size: 11px; }
.spec-dead { color: #ff5555; }
.spec-live { color: #55ff55; }
.spec-empty { padding: 8px 10px; color: #666; font-size: 10px; }

/* --- ПЛАВАЮЩЕЕ ОКНО DEBUG --- */
#debugWindow {
    position: fixed; top: 45px; right: 5px; z-index: 260;
    width: 320px; height: 400px; min-width: 220px; min-height: 150px;
    display: flex; flex-direction: column;
    background: rgba(10, 10, 10, 0.95); border: 1px solid #444; border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace; font-size: 11px;
    pointer-events: auto; user-select: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8); cursor: grab;
}
#debugWindow.dragging { cursor: grabbing; }
/* текст лога можно выделять мышью и копировать (Ctrl+C) */
#debugContent { user-select: text; -webkit-user-select: text; cursor: text; }
#debugWindow::-webkit-scrollbar { width: 4px; }
#debugWindow::-webkit-scrollbar-track { background: #111; }
#debugWindow::-webkit-scrollbar-thumb { background: #a855f7; border-radius: 2px; }
#debugContent { flex: 1 1 auto; overflow-y: auto; }
#debugResizeHandle {
    position: absolute; right: 0; bottom: 0;
    width: 16px; height: 16px;
    cursor: nwse-resize; z-index: 5;
}
#debugResizeHandle::after {
    content: ''; position: absolute; right: 3px; bottom: 3px;
    width: 8px; height: 8px;
    border-right: 2px solid #a855f7; border-bottom: 2px solid #a855f7;
    opacity: 0.6;
}
.dbg-player { padding: 6px 10px; border-bottom: 1px solid #333; }
.dbg-title { color: #a855f7; font-weight: bold; margin-bottom: 3px; }
.dbg-field { padding: 1px 0; color: #ccc; }
.dbg-field b { color: #55ff55; font-weight: normal; }
.dbg-nested { padding-left: 12px; color: #888; }

/* --- ПЛАВАЮЩЕЕ ОКНО WORLD ENTS (зеркало DEBUG, слева) --- */
#worldEntsWindow {
    position: fixed; top: 45px; left: 5px; z-index: 265;
    width: 320px; height: 400px; min-width: 220px; min-height: 150px;
    display: flex; flex-direction: column;
    background: rgba(10, 10, 10, 0.95); border: 1px solid #444; border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace; font-size: 11px;
    pointer-events: auto; user-select: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8); cursor: grab;
}
#worldEntsWindow.dragging { cursor: grabbing; }
#worldEntsContent { user-select: text; -webkit-user-select: text; cursor: text; }
#worldEntsWindow::-webkit-scrollbar { width: 4px; }
#worldEntsWindow::-webkit-scrollbar-track { background: #111; }
#worldEntsWindow::-webkit-scrollbar-thumb { background: #ffd23f; border-radius: 2px; }
#worldEntsContent { flex: 1 1 auto; overflow-y: auto; }

.sec-header {
    background: #1a1a1a; padding: 8px 10px; border-bottom: 1px solid #333;
    color: #ccc; font-weight: bold; letter-spacing: 1px; cursor: pointer;
    position: sticky; top: 0; z-index: 10;
}
.sec-header:hover { background: #222; color: #fff; }
.sec-content { border-bottom: 2px solid #a855f7; }

.row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid #222; }
.col { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px; border-bottom: 1px solid #222; }
.col-header { display: flex; justify-content: space-between; align-items: center; }

.sub-header { padding: 6px 10px 6px 15px; display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.3); cursor: pointer; border-bottom: 1px solid #1a1a1a; font-size: 10px; }
.sub-header:hover { background: rgba(168, 85, 247, 0.1); }
.sub-content { padding: 6px 10px 6px 25px; background: rgba(0,0,0,0.2); border-bottom: 1px solid #222; }
.sub-content label { color: #666; font-size: 9px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px;}
.sub-content label span { color: #a855f7; width: 30px; text-align: right;}

.color-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-body { background: #ff4444; box-shadow: 0 0 4px #ff4444; }
.dot-head { background: #00ffff; box-shadow: 0 0 4px #00ffff; }

.switch { position: relative; display: inline-block; width: 30px; height: 15px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .3s; border-radius: 15px; }
.slider-toggle:before { position: absolute; content: ""; height: 11px; width: 11px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider-toggle { background-color: #ff4444; }
input.head-toggle:checked + .slider-toggle { background-color: #00ffff; }
input:checked + .slider-toggle:before { transform: translateX(15px); }

.close-btn {
    cursor: pointer; color: #888; font-size: 16px; font-weight: bold; line-height: 1;
    transition: 0.2s; padding: 0 5px;
}
.close-btn:hover { color: #ff4444; transform: scale(1.1); }

select { background: #222; color: #fff; border: 1px solid #444; padding: 2px 4px; font-size: 10px; font-family: inherit; outline: none; border-radius: 3px; width: 100%; }

input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: #333; border-radius: 2px; outline: none; pointer-events: auto; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: #a855f7; border-radius: 50%; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; background: #a855f7; border-radius: 50%; cursor: pointer; border: none; }
input[type="range"]:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="text"] { background: #1a1a1a; color: #a855f7; border: 1px solid #444; padding: 2px 4px; font-size: 10px; font-family: inherit; text-align: right; outline: none; border-radius: 3px; width: 60px; cursor: text; pointer-events: auto; }
input[type="text"]:focus { background: #000; border-color: #a855f7; color: #fff; }
input[type="text"]:disabled { opacity: 0.65; color: #777; cursor: not-allowed; }
input[type="color"] { background: #1a1a1a; border: 1px solid #444; width: 25px; height: 18px; cursor: pointer; padding: 0; border-radius: 3px; pointer-events: auto;}

#webEspList { position: fixed; bottom: 10px; right: 10px; z-index: 100; text-align: right; pointer-events: none; }
.esp-user { color: #a855f7; font-size: 15px; margin-top: 2px; text-shadow: 1px 1px 2px black; }

#userHud { position: fixed; top: 10px; right: 10px; z-index: 100; background: rgba(0, 0, 0, 0.7); border-left: 3px solid #a855f7; padding: 8px 15px; border-radius: 4px; display: none; }

#login { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #111; padding: 25px; border-radius: 10px; border: 2px solid #a855f7; width: 350px; z-index: 200; box-shadow: 0 0 30px rgba(0,0,0,0.8); }
#playerList { max-height: 250px; overflow-y: auto; background: #050505; border: 1px solid #222; border-radius: 4px; }
.player-item { padding: 10px; border-bottom: 1px solid #222; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.1s; }
.player-item:hover { background: #1a1a1a; }
.player-item.selected { background: #a855f7 !important; color: white; }
.dev-badge { background: #a855f7; color: white; padding: 1px 4px; border-radius: 3px; font-size: 9px; margin-right: 8px; font-weight: bold; }

button { width: 100%; padding: 15px; background: #a855f7; border: none; color: white; font-weight: bold; cursor: pointer; margin-top: 15px; border-radius: 5px; transition: 0.3s; }
button:hover { background: #9333ea; }
.hidden { display: none !important; }

/* =========================================================================
   VISUALS EDITOR (порт меню-прототипа) — все классы с префиксом ve-
   ========================================================================= */
/* плавающие fab/#veFm убраны: редактор открывается кнопкой в окне настроек */
.ve-cb { display: none; }
.ve-sw { width: 26px; height: 14px; flex: none; position: relative; border-radius: 999px; background: #20293380; border: 1px solid #1e2731; transition: background .2s, border-color .2s; }
.ve-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: #7d8b9c; transition: transform .2s cubic-bezier(.23,1,.32,1), background .2s; }
.ve-cb:checked + .ve-sw { background: rgba(34,211,238,0.30); border-color: #22d3ee; }
.ve-cb:checked + .ve-sw::after { transform: translateX(12px); background: #22d3ee; }

#veFs {
    position: fixed; inset: 0; z-index: 420; display: flex; flex-direction: column;
    background: radial-gradient(110% 90% at 28% 18%, #0b1017 0%, #07090d 60%);
}
/* показываем редактор, когда он открыт (перебивает .hidden !important) */
body.ve-fs-open #veFs { display: flex !important; }
#veFs .ve-fs-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #1e2731; }
.ve-fs-brand { font-size: 12px; letter-spacing: 0.22em; color: #22d3ee; }
.ve-fs-close { width: 28px; height: 28px; border: 1px solid #1e2731; border-radius: 8px; background: none; color: #7d8b9c; cursor: pointer; font-size: 18px; line-height: 1; }
.ve-fs-close:hover { color: #cbd5e1; border-color: #22d3ee; }
.ve-fs-body { flex: 1 1 auto; display: flex; min-height: 0; }
.ve-el-block { width: 252px; flex: none; padding: 14px 12px; overflow-y: auto; border-right: 1px solid #1e2731; }
.ve-vtitle { font-size: 10px; letter-spacing: 0.16em; color: #7d8b9c; margin: 14px 0 8px; }
.ve-vtitle:first-child { margin-top: 0; }
.ve-el-list { display: flex; flex-direction: column; gap: 2px; }
.ve-el-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: background .12s; }
.ve-el-row:hover { background: rgba(34,211,238,0.10); }
.ve-preview-sel { width: 100%; margin-bottom: 4px; background: #222; color: #fff; border: 1px solid #444; padding: 4px; font-size: 11px; border-radius: 4px; }
.ve-pv-wrap { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; gap: 8px; padding: 10px; }
#vePvSvg { height: min(940px, 96vh); width: auto; aspect-ratio: 4 / 5; background: rgba(255,255,255,0.015); border: 1px solid #1e2731; border-radius: 12px; touch-action: none; overflow: visible; user-select: none; -webkit-user-select: none; }
.ve-pv-hint { font-size: 10px; color: #7d8b9c; letter-spacing: 0.04em; }
.ve-reset-btn {
    width: 100%; margin-top: 8px; padding: 6px;
    background: #16202b; color: #22d3ee;
    border: 1px solid #1e2731; border-radius: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.ve-reset-btn:hover { background: #1c2b39; border-color: #22d3ee; }
.ve-reset-sub { background: #11202b; color: #9fb3c8; font-weight: 600; }
.ve-reset-sub:hover { background: #1c2b39; color: #22d3ee; border-color: #22d3ee; }
.ve-brush-btn { display: block; width: 100%; margin-top: 6px; padding: 7px; background: #16202b; color: #22d3ee; border: 1px solid #1e2731; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 11px; }
.ve-brush-btn.on { background: #155e75; color: #fff; border-color: #22d3ee; box-shadow: 0 0 10px rgba(34, 211, 238, 0.5); }
#gl3d { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; display: none; background: transparent; }
.ve-style-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 9px; font-size: 12px; }
.ve-style-row input[type="range"] { width: 104px; }
.ve-style-row b { color: #22d3ee; min-width: 46px; text-align: right; font-size: 10px; font-family: 'Consolas', monospace; }
.ve-style-row input[type="color"] { width: 34px; height: 22px; padding: 0; background: none; border: 1px solid #1e2731; border-radius: 6px; cursor: pointer; }
.ve-hp-anchor { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 9px 2px; }
.ve-an-btn {
    flex: 1 1 auto; min-width: 54px; padding: 5px 4px;
    background: #16202b; color: #cbd5e1;
    border: 1px solid #1e2731; border-radius: 7px;
    font-size: 11px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.ve-an-btn:hover { background: #1c2b39; }
.ve-an-btn.active { background: #155e75; color: #fff; border-color: #22d3ee; box-shadow: 0 0 8px rgba(34, 211, 238, 0.45); }
