/* =====================================================================
   Редактор уровней
   ===================================================================== */

.screen-editor { pointer-events: none !important; }
.editor { position: absolute; inset: 0; pointer-events: none; --ins-l: 300px; --ins-r: 320px; }
.editor > * { pointer-events: auto; transition: opacity 0.35s var(--ease), transform 0.45s var(--ease); }
.editor.suspended > * { opacity: 0 !important; pointer-events: none !important; transform: translateY(8px); }
.editor .glass { background: color-mix(in srgb, var(--surface-solid) 82%, transparent); }

/* ---------- верхняя панель ---------- */
.ed-top { position: absolute; top: 10px; left: 12px; right: 12px; height: 50px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 16px; z-index: 5; }
.ed-name-wrap { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; color: var(--muted); border: 1px solid transparent; transition: all 0.2s; min-width: 120px; flex: 0 1 300px; }
.ed-name-wrap:hover, .ed-name-wrap:focus-within { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.ed-name { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text); font: 800 1.05rem var(--font-display); outline: none; }
.save-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); transition: background 0.3s; }
.save-pill[data-state='dirty'] .save-dot, .save-pill[data-state='saving'] .save-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: bump 0.8s ease-in-out infinite; }
.save-pill[data-state='error'] .save-dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.ed-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.ed-status { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 11px; font-weight: 800; font-size: 0.85rem; border: 1px solid var(--line); background: var(--surface-2); transition: all 0.25s; white-space: pre-line; }
.ed-status.ok { color: var(--good); border-color: rgba(52, 211, 153, 0.4); }
.ed-status.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.5); }
.ed-status.bad { color: var(--bad); border-color: rgba(251, 113, 133, 0.6); background: rgba(251, 113, 133, 0.12); }
.ed-status:hover { transform: translateY(-1px); }

/* ---------- боковые панели ---------- */
.ed-left, .ed-right { position: absolute; top: 68px; bottom: 12px; border-radius: 20px; overflow: hidden; z-index: 4; display: flex; flex-direction: column; }
.ed-left { left: 12px; width: 288px; }
.ed-right { right: 12px; width: 308px; overflow: auto; padding: 10px; gap: 10px; flex-direction: column; }
.panels-hidden .ed-left { transform: translateX(-110%); opacity: 0; pointer-events: none; }
.panels-hidden .ed-right { transform: translateX(110%); opacity: 0; pointer-events: none; }

.palette { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.pal-top { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); flex: none; }
.pal-tools { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.pal-tool { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); color: var(--text-2); transition: all 0.2s var(--ease); padding: 0; }
.pal-tool:hover { color: var(--text); background: var(--surface-3); transform: translateY(-1px); }
.pal-tool.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.45); }
.pal-sections { flex: 1; overflow: auto; padding: 6px 8px 14px; }
.pal-section { margin-bottom: 4px; }
.pal-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 8px; border: 0; background: transparent; color: var(--text-2); font-weight: 800; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 8px; text-align: left; }
.pal-head span { flex: 1; }
.pal-head small { color: var(--muted); font-family: var(--font-mono); }
.pal-head:hover { background: var(--surface-2); color: var(--text); }
.pal-chev { transition: transform 0.3s var(--ease); }
.pal-section.collapsed .pal-chev { transform: rotate(-90deg); }
.pal-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.35s var(--ease), opacity 0.3s; }
.pal-body > * { min-height: 0; }
.pal-section.collapsed .pal-body { display: none; }
.pal-sub { margin: 6px 6px 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 2px 6px; }
.pal-grid.dense { grid-template-columns: repeat(4, 1fr); }
.pal-item { display: grid; justify-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); color: var(--text-2); transition: all 0.22s var(--ease); min-width: 0; }
.pal-item:hover { transform: translateY(-2px); background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }
.pal-item.active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.22); color: var(--text); box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(var(--accent-rgb), 0.3); }
.pal-icon { border-radius: 8px; display: block; }
.pal-label { font-size: 0.66rem; font-weight: 700; line-height: 1.15; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; height: 2.3em; }
.pal-grid.dense .pal-label { height: 1.2em; -webkit-line-clamp: 1; font-size: 0.6rem; }
.pal-empty { display: grid; justify-items: center; gap: 8px; padding: 30px; color: var(--muted); }

/* ---------- инспектор ---------- */
.inspector { display: grid; gap: 10px; align-content: start; }
.insp-card { padding: 12px 14px; display: grid; gap: 10px; background: color-mix(in srgb, var(--surface-2) 90%, transparent); }
.insp-head { display: flex; align-items: center; gap: 12px; }
.insp-icon { --c: var(--accent); width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); overflow: hidden; }
.insp-titles { min-width: 0; }
.insp-title { font-weight: 800; }
.insp-sub { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.insp-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.insp-hintbox { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; color: var(--text-2); padding: 8px 10px; border-radius: 10px; background: rgba(var(--accent-rgb), 0.1); }
.insp-hintbox .ic { margin-top: 2px; color: var(--accent-2); }
.insp-tips { display: grid; gap: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 0.8rem; }
.tip-row .ic { color: var(--accent-2); }
.insp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.insp-form { gap: 12px; }
.insp-field { display: grid; gap: 6px; }
.insp-field.row { grid-template-columns: 1fr auto; align-items: center; }
.insp-field.row .full { grid-column: 1 / -1; }
.insp-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.insp-label.scrub { cursor: ew-resize; }
.insp-hint { font-size: 0.78rem; color: var(--muted); }
.insp-inline { display: flex; justify-content: flex-end; }
.num-wrap { display: flex; align-items: center; gap: 4px; }
.num-input { height: 34px; text-align: center; padding: 0 6px; flex: 1; min-width: 0; -moz-appearance: textfield; }
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-step { width: 30px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.num-step:hover { background: var(--surface-3); color: var(--text); }
.num-unit { color: var(--muted); font-size: 0.72rem; min-width: 28px; }
.color-wrap { display: flex; align-items: center; gap: 8px; }
.color-input { -webkit-appearance: none; appearance: none; width: 44px; height: 32px; padding: 0; border: 2px solid var(--line-strong); border-radius: 9px; background: none; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 6px; }
.keycolors { display: flex; gap: 6px; flex-wrap: wrap; }
.kc { width: 30px; height: 30px; border-radius: 10px; border: 2px solid transparent; color: transparent; display: grid; place-items: center; transition: all 0.25s var(--spring); }
.kc:hover { transform: scale(1.12); }
.kc.active { border-color: #fff; color: #fff; transform: scale(1.1); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.surf-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.surf { padding: 0; aspect-ratio: 1; border-radius: 9px; border: 2px solid transparent; background: none; display: grid; place-items: center; overflow: hidden; transition: all 0.2s var(--ease); }
.surf:hover { transform: scale(1.1); }
.surf.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.35); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-out { min-width: 40px; text-align: right; color: var(--text-2); font-weight: 700; font-size: 0.82rem; }
.targets { display: grid; gap: 6px; }
.target-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-3); }
.target-row.check { cursor: pointer; font-size: 0.85rem; }
.target-name { display: inline-flex; align-items: center; gap: 8px; flex: 1; border: 0; background: transparent; font-weight: 700; font-size: 0.82rem; padding: 0; text-align: left; min-width: 0; }
.target-name:hover { color: var(--accent-2); }
.target-row .input.tiny { height: 28px; width: auto; font-size: 0.75rem; padding: 0 22px 0 8px; }
.ov-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ov-stat { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); }
.ov-stat b { color: var(--text); font-size: 1.05rem; }
.ov-stat span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.checklist { display: grid; gap: 7px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-2); }
.check-row.ok { color: var(--text); }
.check-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: #fff; flex: none; transition: all 0.3s var(--spring); }
.check-row.ok .check-dot { background: var(--good); border-color: var(--good); transform: scale(1.05); }
.val-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-row { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-dot { width: 28px; height: 28px; border-radius: 9px; border: 2px solid; transition: all 0.25s var(--spring); }
.theme-dot:hover { transform: scale(1.18) rotate(-6deg); }
.theme-dot.active { outline: 2px solid var(--accent); outline-offset: 2px; transform: scale(1.1); }

/* ---------- низ экрана ---------- */
.ed-hotbar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 18px; z-index: 4; }
.hb-slot { position: relative; width: 48px; height: 48px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; padding: 0; transition: all 0.22s var(--spring); }
.hb-slot:hover { transform: translateY(-4px) scale(1.06); border-color: var(--line-strong); }
.hb-slot.active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.25); box-shadow: 0 0 0 1px var(--accent), 0 8px 22px rgba(var(--accent-rgb), 0.4); transform: translateY(-3px); }
.hb-slot kbd { position: absolute; top: -6px; left: -4px; padding: 0 5px; font-size: 0.62rem; border-bottom-width: 1px; }
.ed-hint { position: absolute; bottom: 78px; left: 50%; transform: translate(-50%, 8px); max-width: min(620px, 60vw); display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 20px; background: rgba(10, 11, 22, 0.82); backdrop-filter: blur(12px); border: 1px solid var(--line-strong); color: #e6e8ff; font-size: 0.85rem; font-weight: 600; opacity: 0; pointer-events: none !important; z-index: 3; }
.ed-hint.show { opacity: 1; transform: translate(-50%, 0); }
.ed-hint .ic { color: var(--accent-2); flex: none; }
.ed-zoombar { position: absolute; bottom: 14px; left: calc(var(--ins-l, 300px) + 6px); display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 14px; z-index: 4; transition: left 0.4s var(--ease), opacity 0.35s; }
.zoom-label { min-width: 46px; height: 30px; border: 0; background: transparent; color: var(--text-2); font-weight: 700; font-size: 0.8rem; }
.coords { padding: 0 8px; color: var(--muted); font-size: 0.78rem; min-width: 58px; text-align: center; }
.ed-zoombar .btn.on { color: var(--accent-2); background: rgba(var(--accent-2-rgb), 0.15); }
.ed-minibox { position: absolute; right: calc(var(--ins-r, 320px) + 6px); bottom: 14px; width: 190px; height: 128px; padding: 6px; border-radius: 14px; z-index: 4; cursor: crosshair; transition: right 0.4s var(--ease), opacity 0.3s, transform 0.3s; }
.ed-minibox.hidden { opacity: 0; pointer-events: none !important; transform: scale(0.9); }
.ed-minimap { width: 100%; height: 100%; display: block; border-radius: 8px; }
.mini-view { position: absolute; left: 6px; top: 6px; border: 2px solid var(--accent-2); border-radius: 3px; background: rgba(var(--accent-2-rgb), 0.12); pointer-events: none; margin: 6px; }
.panels-hidden .ed-zoombar { left: 12px; }
.panels-hidden .ed-minibox { right: 12px; }

/* ---------- обучение ---------- */
.tour { position: fixed; inset: 0; z-index: 150; pointer-events: auto; opacity: 0; transition: opacity 0.4s; }
.tour.in { opacity: 1; }
.tour.out { opacity: 0; }
.tour-veil { position: absolute; inset: 0; background: rgba(4, 5, 12, 0.65); transition: opacity 0.4s; }
.tour-hole { position: absolute; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(4, 5, 12, 0.65), 0 0 0 3px var(--accent), 0 0 40px rgba(var(--accent-rgb), 0.5); transition: all 0.55s var(--ease); pointer-events: none; }
.tour-card { position: absolute; left: 0; top: 0; width: 340px; padding: 18px; display: grid; gap: 10px; background: var(--surface-solid) !important; transition: transform 0.55s var(--ease); box-shadow: var(--shadow-2); }
.tour-card p { margin: 0; color: var(--text-2); font-size: 0.92rem; }
.tour-head { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.tour-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: all 0.3s; }
.tour-dots i.on { width: 20px; border-radius: 7px; background: var(--accent); }

/* ---------- окна редактора ---------- */
.ls-layout { display: grid; grid-template-columns: 200px 1fr; gap: 18px; height: min(64vh, 600px); }
.ls-nav { padding: 4px 0; }
.ls-content { overflow: auto; padding: 0 6px 20px 2px; display: grid; gap: 14px; align-content: start; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; width: 100%; }
.theme-card { display: grid; gap: 6px; justify-items: center; padding: 8px; border-radius: 14px; border: 2px solid transparent; background: var(--surface-2); font-weight: 700; font-size: 0.78rem; transition: all 0.25s var(--ease); }
.theme-card:hover { transform: translateY(-3px); background: var(--surface-3); }
.theme-card.active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.2); }
.theme-swatch { width: 100%; aspect-ratio: 16/10; border-radius: 9px; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; background: var(--t1); border: 1px solid rgba(0, 0, 0, 0.3); }
.theme-swatch i:nth-child(1) { background: var(--t2); }
.theme-swatch i:nth-child(2) { background: var(--t3); }
.theme-swatch i:nth-child(3) { background: var(--t3); }
.theme-swatch i:nth-child(4) { background: var(--t4); }
.color-overrides { display: flex; flex-wrap: wrap; gap: 10px; }
.co-item { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--surface-2); font-size: 0.8rem; font-weight: 700; color: var(--text-2); cursor: pointer; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 24px); gap: 4px; }
.anchor-cell { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 0; }
.anchor-cell.active { background: var(--accent); border-color: var(--accent); }
.music-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; width: 100%; }
.music-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; text-align: left; transition: all 0.2s; }
.music-item span { flex: 1; }
.music-item:hover { border-color: var(--line-strong); }
.music-item.active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.2); }
.val-head { display: flex; align-items: center; gap: 14px; }
.val-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: none; }
.val-badge.ok { background: linear-gradient(135deg, #10b981, #34d399); }
.val-badge.warn { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #2a1500; }
.val-badge.bad { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.val-list { display: grid; gap: 8px; }
.val-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--muted); }
.val-row.error { border-left-color: var(--bad); }
.val-row.error .ic { color: var(--bad); }
.val-row.warn { border-left-color: var(--warn); }
.val-row.warn .ic { color: var(--warn); }
.val-row.info .ic { color: var(--accent-2); }
.val-text { flex: 1; font-weight: 600; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.help-col h3 { font-family: var(--font-display); margin-bottom: 8px; }
.help-rows { display: grid; gap: 6px; }
.help-row { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 0.85rem; }
.help-row kbd { min-width: 34px; text-align: center; }

.ed-drawer-btn { display: none !important; }

@media (max-width: 979px) {
    .ed-drawer-btn { display: inline-flex !important; }
    .ed-left, .ed-right { transition: transform 0.4s var(--ease), opacity 0.3s; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); z-index: 6; }
    .ed-left { width: min(300px, 86vw); transform: translateX(-112%); opacity: 0; pointer-events: none; }
    .ed-right { width: min(320px, 86vw); transform: translateX(112%); opacity: 0; pointer-events: none; }
    .editor.drawer-left .ed-left, .editor.drawer-right .ed-right { transform: none; opacity: 1; pointer-events: auto; }
    .ed-minibox { display: none; }
    .ed-hotbar { display: none; }
    .ed-name-wrap { flex: 1; min-width: 0; }
    .ed-top .save-pill { display: none; }
    .ed-zoombar { left: 12px; bottom: auto; top: 68px; }
    .ed-hint { max-width: 92vw; bottom: 24px; }
}
@media (max-width: 560px) {
    .ed-top .btn-icon-only { width: 34px; padding: 0; }
    .ed-name-wrap { flex: 1 1 40px; }
    .ed-top .ed-status { font-size: 0; gap: 0; padding: 0 9px; }
    .ed-top .ed-sep { display: none; }
    .ed-top .ed-test { padding: 0 12px; }
    .ed-top .ed-test .btn-label { display: none; }
    .ed-zoombar .btn:nth-child(n+7), .ed-zoombar .coords { display: none; }
}
