:root {
    --crt-bg: #001100;
    --crt-color: #33ff33;
    --crt-glow: rgba(51, 255, 51, 0.6);
    --font-ui: 'Press Start 2P', monospace;
    --font-text: 'IBM Plex Mono', monospace;
    --dim: color-mix(in srgb, var(--crt-color) 14%, transparent);
    --dim2: color-mix(in srgb, var(--crt-color) 35%, transparent);
    --panel: color-mix(in srgb, var(--crt-color) 5%, var(--crt-bg));
    --app-h: 100dvh;
    --app-top: 0px;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; }

html, body {
    width: 100vw; height: var(--app-h); overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
    background: #000; font-family: var(--font-text); cursor: crosshair;
}

/* ---------- Экран и CRT ---------- */
.crt-screen {
    position: fixed; top: var(--app-top); left: 0; width: 100vw; height: var(--app-h); overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--crt-color) 14%, var(--crt-bg)) 0%, var(--crt-bg) 65%);
    box-shadow: inset 0 0 100px rgba(0,0,0,.9), inset 0 0 40px var(--crt-glow);
    display: flex; justify-content: center; align-items: center;
}
.crt-screen.power-on { animation: turnOn .5s cubic-bezier(.23,1,.32,1) forwards; }
.crt-screen.shake { animation: screenShake .15s ease-in-out; }

.bg-grid {
    position: absolute; inset: auto -50% -10% -50%; height: 60%; overflow: hidden;
    transform: perspective(380px) rotateX(62deg);
    transform-origin: bottom;
    mask-image: linear-gradient(to top, #000, transparent 85%);
    -webkit-mask-image: linear-gradient(to top, #000, transparent 85%);
    will-change: transform;
}
.bg-grid::before {
    content: ''; position: absolute; left: 0; right: 0; top: -48px; bottom: 0;
    background-image:
        linear-gradient(var(--dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--dim) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: gridMove 3s linear infinite; will-change: transform;
}

.crt-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.scanlines { width: 100%; height: 100%; background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,.35) 50%); background-size: 100% 4px; }
.vignette { position: absolute; inset: 0; box-shadow: inset 0 0 140px rgba(0,0,0,.9); border-radius: 18px; }
.glass-glare { position: absolute; inset: 0; background: radial-gradient(circle at 10% 10%, rgba(255,255,255,.05) 0%, transparent 60%); }
.crt-overlay::after { content: ''; position: absolute; inset: 0; background: #000; opacity: 0; animation: flickerLayer .3s steps(2) infinite; will-change: opacity; }
@keyframes flickerLayer { 0% { opacity: .02; } 50% { opacity: 0; } 100% { opacity: .04; } }
.glitch-line { position: absolute; top: -20px; left: 0; width: 100%; height: 8px; background: var(--crt-color); opacity: 0; }
.glitch-active { animation: glitchAnim .3s ease-in-out; }

/* ---------- Загрузка ---------- */
.boot-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 2; transition: transform .8s ease-in-out, opacity .8s ease-in-out;
}
.boot-container.fade-out { opacity: 0; transform: scale(.6) translateY(-50px); }
.logo-loader {
    display: flex; align-items: center; font-family: var(--font-ui);
    font-size: clamp(48px, 10vw, 110px); color: var(--crt-color);
    text-shadow: 0 0 18px var(--crt-glow), 0 0 40px var(--crt-glow), 2px 0 3px rgba(255,0,0,.5), -2px 0 3px rgba(0,0,255,.5);
}
.progress-underscore {
    width: clamp(70px, 10vw, 120px); height: clamp(10px, 1.6vw, 18px);
    background: var(--dim); border: 2px solid var(--crt-color);
    box-shadow: 0 0 14px var(--crt-glow); margin: 0 0 12px 12px; align-self: flex-end;
}
.progress-fill { width: 0%; height: 100%; background: repeating-linear-gradient(90deg, var(--crt-color) 0 6px, transparent 6px 8px); box-shadow: 0 0 12px var(--crt-color); transition: width .1s linear; }
.boot-status { margin-top: 30px; font-size: clamp(12px, 1.8vw, 16px); color: var(--crt-color); letter-spacing: 3px; text-transform: uppercase; opacity: .85; text-shadow: 0 0 6px var(--crt-glow); animation: cursorBlink 1.2s infinite; }

/* ---------- Рабочий стол ---------- */
.terminal-container {
    width: 94vw; max-width: 100%; height: calc(var(--app-h) * .92); display: flex; flex-direction: column; gap: 14px;
    color: var(--crt-color); z-index: 2; transition: opacity .6s ease-in-out;
    text-shadow: 0 0 5px var(--crt-glow);
}
.terminal-container.hidden { display: none; opacity: 0; }

.menubar {
    display: flex; align-items: center; gap: 16px; padding: 8px 16px;
    background: linear-gradient(90deg, var(--dim), transparent);
    border: 1px solid var(--dim2); border-left: 4px solid var(--crt-color);
    box-shadow: 0 0 18px var(--dim);
    animation: fadeInLogo .5s ease-out;
}
.logo-wrapper { text-shadow: 0 0 8px var(--crt-glow), 2px 0 3px rgba(255,0,0,.35), -2px 0 3px rgba(0,0,255,.35); font-family: var(--font-ui); font-size: clamp(20px, 3.4vw, 30px); letter-spacing: -.05em; cursor: pointer; transition: transform .1s ease, text-shadow .2s; }
.logo-wrapper:hover { transform: scale(1.1); text-shadow: 0 0 18px var(--crt-color); }
.blinking-underscore { animation: cursorBlink .8s infinite; }
.menubar-title { font-family: var(--font-ui); font-size: clamp(8px, 1.3vw, 11px); letter-spacing: 2px; opacity: .8; }
.menubar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: clamp(11px, 1.6vw, 14px); font-weight: 600; }
.signal { display: flex; align-items: center; gap: 8px; opacity: .85; }
.dot { width: 8px; height: 8px; background: var(--crt-color); box-shadow: 0 0 8px var(--crt-color); animation: cursorBlink 1.6s infinite; }
#sysClock { padding: 3px 10px; border: 1px solid var(--dim2); background: var(--dim); font-variant-numeric: tabular-nums; }

.workspace { flex: 1; min-height: 0; display: flex; gap: 14px; }

.window {
    position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column;
    background: color-mix(in srgb, var(--crt-bg) 80%, transparent);
    border: 1px solid var(--crt-color);
    box-shadow: 0 0 22px var(--crt-glow), inset 0 0 30px rgba(0,0,0,.55);
}
.window::before, .window::after { content: ''; position: absolute; width: 16px; height: 16px; border: 3px solid var(--crt-color); pointer-events: none; }
.window::before { right: -5px; bottom: -5px; border-left: 0; border-top: 0; }
.window::after { left: -5px; top: -5px; border-right: 0; border-bottom: 0; }

.window-bar, .player-header {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: var(--crt-color); color: var(--crt-bg); text-shadow: none;
    font-family: var(--font-ui); font-size: 9px; padding: 8px 12px;
}
.wb-dots { display: flex; gap: 5px; }
.wb-dots i { width: 8px; height: 8px; background: var(--crt-bg); opacity: .8; }
.wb-dots i:nth-child(2) { opacity: .5; } .wb-dots i:nth-child(3) { opacity: .25; }
.window-bar span:nth-child(2) { margin-right: auto; }

.terminal-output {
    flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 6px;
    font-size: clamp(13px, 2.2vw, 18px); line-height: 1.65;
    white-space: pre-wrap; word-break: break-word;
    text-shadow: 0 0 3px var(--crt-glow); contain: layout paint; overscroll-behavior: contain;
}
.terminal-output::-webkit-scrollbar { width: 0; }
/* neofetch */
.nf { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 10px; line-height: 1.35; }
.nf-logo { flex: none; color: var(--crt-color); font-weight: 600; text-shadow: 0 0 8px var(--crt-glow), 0 0 18px var(--crt-glow); }
.nf-us { animation: cursorBlink .8s infinite; }
.nf-info { min-width: 0; }
.nf-title { font-weight: 600; text-shadow: 0 0 8px var(--crt-glow); }
.nf-sep { opacity: .5; }
.nf-k { display: inline-block; min-width: 9ch; font-weight: 600; text-shadow: 0 0 6px var(--crt-glow); }
.nf-v { opacity: .9; }
.nf-sw { display: flex; gap: 3px; margin-top: 6px; }
.nf-sw i { display: block; width: 1.6em; height: 1em; box-shadow: 0 0 6px var(--crt-glow); }
.system-msg { opacity: .85; margin-bottom: 10px; padding-left: 10px; border-left: 3px solid var(--crt-color); }

.input-line {
    display: flex; align-items: center; padding: 12px 18px;
    background: var(--dim); border-top: 1px solid var(--dim2);
    font-size: clamp(14px, 2.4vw, 19px); font-weight: 600;
}
.prompt { text-shadow: 0 0 10px var(--crt-color); }
.input-wrapper { display: flex; align-items: center; position: relative; }
.hidden-input { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; border: 0; padding: 0; pointer-events: none; }
.terminal-cursor {
    display: inline-block; width: clamp(8px, 1.4vw, 12px); height: clamp(14px, 2.6vw, 20px);
    background: var(--crt-color); box-shadow: 0 0 10px var(--crt-glow); margin-left: 3px;
    animation: cursorBlink .8s infinite;
}

/* ---------- Боковая панель ---------- */
.sidebar { width: 220px; display: flex; flex-direction: column; gap: 14px; font-size: 12px; }
.panel { border: 1px solid var(--dim2); background: var(--panel); padding: 12px; box-shadow: inset 0 0 18px rgba(0,0,0,.4); }
.panel-title { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px dashed var(--dim2); }
.meter { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-weight: 600; }
.meter span { width: 32px; opacity: .8; }
.meter b { flex: 1; height: 10px; border: 1px solid var(--dim2); overflow: hidden; }
.meter b i { display: block; width: 0; height: 100%; background: repeating-linear-gradient(90deg, var(--crt-color) 0 5px, transparent 5px 7px); transition: width .9s ease-out; }
.meter em { width: 34px; text-align: right; font-style: normal; font-variant-numeric: tabular-nums; }
.meter.hot em { animation: cursorBlink .5s infinite; }
.sidebar { min-height: 0; }
.proc-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.proc-log { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 11px; line-height: 1.55; }
.proc-log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .75; animation: procIn .35s ease-out; }
.proc-log div:last-child { opacity: 1; }
.proc-log .pid { opacity: .5; }
.proc-log .pname { font-weight: 600; }
.proc-log .warn { color: #ff5555; text-shadow: 0 0 6px rgba(255,60,60,.6); }
@keyframes procIn { from { opacity: 0; transform: translateX(-6px); } }
.kv { display: flex; justify-content: space-between; margin-bottom: 7px; }
.kv span { opacity: .65; } .kv em { font-style: normal; font-weight: 600; }
.hint { opacity: .75; line-height: 1.6; }

/* ---------- Плеер ---------- */
.music-player-modal {
    position: absolute; top: 84px; right: 4vw; width: 330px;
    background: color-mix(in srgb, var(--crt-bg) 92%, #000);
    border: 1px solid var(--crt-color); color: var(--crt-color); z-index: 20; font-size: 12px;
    box-shadow: 0 0 26px var(--crt-glow), 8px 8px 0 rgba(0,0,0,.6);
    animation: popIn .25s cubic-bezier(.2,1.4,.4,1);
}
.music-player-modal.hidden { display: none; }
.player-body { padding: 14px; }
.player-title { letter-spacing: 1px; }
.player-close-btn { background: none; border: none; color: var(--crt-bg); font-family: var(--font-ui); font-size: 11px; cursor: pointer; padding: 2px 4px; }
.player-close-btn:hover { background: var(--crt-bg); color: var(--crt-color); }

.track-info { margin-bottom: 12px; position: relative; padding: 10px; background: var(--dim); border: 1px solid var(--dim2); }
.eq { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-bottom: 8px; }
.eq i { flex: 1; background: var(--crt-color); height: 100%; transform: scaleY(.2); transform-origin: bottom; will-change: transform; animation: eqBar .9s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s; animation-duration: 1.1s; } .eq i:nth-child(3) { animation-delay: -.6s; animation-duration: .7s; }
.eq i:nth-child(4) { animation-delay: -.2s; animation-duration: 1.3s; } .eq i:nth-child(5) { animation-delay: -.5s; } .eq i:nth-child(6) { animation-delay: -.8s; animation-duration: 1s; }
.track-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.time-display { font-size: 12px; opacity: .8; }
.seekbar-container { margin-bottom: 12px; }

.custom-slider { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; background: var(--dim); border: 1px solid var(--crt-color); outline: none; cursor: pointer; }
.custom-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 20px; background: var(--crt-color); box-shadow: 0 0 8px var(--crt-glow); }
.custom-slider::-moz-range-thumb { width: 12px; height: 20px; border: 0; border-radius: 0; background: var(--crt-color); }

.player-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.player-btn {
    flex: 1; background: transparent; border: 1px solid var(--crt-color); color: var(--crt-color);
    font-family: var(--font-ui); padding: 9px 6px; font-size: 9px; cursor: pointer; transition: box-shadow .15s;
}
.player-btn:hover, .player-btn:focus-visible { background: var(--crt-color); color: var(--crt-bg); outline: none; text-shadow: none; box-shadow: 0 0 14px var(--crt-glow); }
.volume-container { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mute-btn { flex: 0 0 auto; font-size: 8px; }

.playlist-container { max-height: 110px; overflow-y: auto; border-top: 1px dashed var(--dim2); padding-top: 8px; }
.playlist-container::-webkit-scrollbar { width: 4px; }
.playlist-container::-webkit-scrollbar-thumb { background: var(--crt-color); }
.playlist-item { font-size: 13px; padding: 5px 8px; cursor: pointer; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid transparent; }
.playlist-item:hover { opacity: 1; background: var(--dim); border-left-color: var(--crt-color); }
.playlist-item.active { opacity: 1; font-weight: 600; background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }

/* ---------- Быстрые клавиши (телефон) ---------- */
.quick-keys {
    display: none; gap: 8px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none;
    border-top: 1px solid var(--dim2); background: var(--panel);
}
.quick-keys::-webkit-scrollbar { display: none; }
.quick-keys button {
    flex: 0 0 auto; min-width: 44px; min-height: 40px; padding: 0 12px;
    background: transparent; border: 1px solid var(--crt-color); color: var(--crt-color);
    font-family: var(--font-ui); font-size: 9px; cursor: pointer;
}
.quick-keys button:active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.qk-sep { flex: 0 0 1px; background: var(--dim2); margin: 4px 2px; }

/* ---------- Уведомление о достижении ---------- */
.ach-toast-stack {
    position: absolute; top: 84px; right: 4vw; width: 300px; max-width: 92vw; z-index: 25;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.ach-toast {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; color: var(--crt-color);
    background: color-mix(in srgb, var(--crt-bg) 92%, #000);
    border: 1px solid var(--rar, var(--crt-color)); border-left: 6px solid var(--rar, var(--crt-color));
    box-shadow: 0 0 26px color-mix(in srgb, var(--rar, var(--crt-color)) 60%, transparent), 6px 6px 0 rgba(0,0,0,.6);
    opacity: 0; transform: translateX(30px);
    transition: opacity .35s ease, transform .35s cubic-bezier(.2,1.2,.4,1);
}
.ach-toast.show { opacity: 1; transform: none; }
.ach-toast .ach-head { color: var(--rar, var(--crt-color)); opacity: 1; }

/* ---------- Редкость ---------- */
.r-common    { --rar: var(--crt-color); }
.r-rare      { --rar: #4aa8ff; }
.r-epic      { --rar: #c26bff; }
.r-legendary { --rar: #ffb627; }
.ach-head { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; opacity: .75; margin-bottom: 8px; }
.ach-name { font-family: var(--font-ui); font-size: 11px; line-height: 1.5; text-shadow: 0 0 8px var(--crt-glow); }
.ach-desc { margin-top: 6px; font-size: 13px; opacity: .85; }

/* ---------- Достижения: кнопка, иконки, окно ---------- */
.ach-btn {
    display: flex; align-items: center; gap: 8px; padding: 3px 10px;
    background: var(--dim); border: 1px solid var(--dim2); color: inherit;
    font: inherit; font-weight: 600; cursor: pointer; text-shadow: inherit;
}
.ach-btn:hover, .ach-btn:focus-visible { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; outline: none; }
.ach-btn-icon { width: 14px; height: 14px; display: inline-block; }
.ach-icon { width: 100%; height: 100%; display: block; }
.ach-panel { cursor: pointer; }
.ach-panel:hover { border-color: var(--crt-color); }

.ach-icon-box {
    flex: 0 0 44px; width: 44px; height: 44px; padding: 7px; color: var(--rar, var(--crt-color));
    border: 1px solid var(--rar, var(--crt-color)); background: var(--dim);
    box-shadow: 0 0 10px color-mix(in srgb, var(--rar, var(--crt-color)) 55%, transparent);
}
.ach-icon-box.big { flex-basis: 60px; width: 60px; height: 60px; padding: 10px; }
.ach-icon-box.small { flex-basis: 32px; width: 32px; height: 32px; padding: 5px; }
.ach-icon-box .ach-icon { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--rar, var(--crt-color)) 60%, transparent)); }

.ach-toast-text { min-width: 0; }

.ach-window {
    position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
    width: 580px; max-width: 94vw; max-height: calc(var(--app-h) - 110px);
    display: flex; flex-direction: column; z-index: 22; font-size: 13px;
    background: color-mix(in srgb, var(--crt-bg) 94%, #000);
    border: 1px solid var(--crt-color); color: var(--crt-color);
    box-shadow: 0 0 26px var(--crt-glow), 8px 8px 0 rgba(0,0,0,.6);
    animation: achPop .25s cubic-bezier(.2,1.4,.4,1);
}
.ach-window.hidden { display: none; }
@keyframes achPop {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.97); }
    to { opacity: 1; transform: translateX(-50%); }
}
.ach-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; }
.ach-body::-webkit-scrollbar { width: 4px; }
.ach-body::-webkit-scrollbar-thumb { background: var(--crt-color); }

.ach-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px; background: var(--dim); border: 1px solid var(--dim2); }
.ach-rank-label { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; opacity: .7; margin-bottom: 10px; }
.ach-rank { font-family: var(--font-ui); font-size: 12px; line-height: 1.5; text-shadow: 0 0 8px var(--crt-glow); }
.ach-section { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--dim2); }

.ach-prow { display: grid; grid-template-columns: 130px 1fr 56px; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 600; font-size: 12px; }
.ach-prow-label { opacity: .85; }
.ach-prow-val { text-align: right; font-variant-numeric: tabular-nums; }
.ach-bar { height: 12px; border: 1px solid var(--crt-color); background: var(--dim); }
.ach-bar-fill { height: 100%; background: repeating-linear-gradient(90deg, var(--crt-color) 0 6px, transparent 6px 8px); box-shadow: 0 0 8px var(--crt-glow); }

.ach-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.ach-kv { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--dim2); font-weight: 600; }
.ach-kv span:first-child { opacity: .7; font-weight: 400; }
.ach-recent-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ach-empty { opacity: .6; padding: 8px 0; }
.ach-all-btn { display: block; width: 100%; margin-top: 18px; padding: 13px 6px; font-size: 10px; }

.ach-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.ach-toolbar .player-btn { flex: 0 0 auto; padding: 9px 12px; }
.ach-toolbar .player-btn.active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.ach-toolbar .spacer { flex: 1; }
.ach-sort-btns { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ach-sort-btns .player-btn { flex: 0 0 auto; padding: 9px 12px; }
.ach-group-title { display: flex; justify-content: space-between; font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--dim2); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ach-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--dim2); background: var(--panel); }
.ach-card.done { border-color: var(--rar, var(--crt-color)); box-shadow: inset 0 0 14px color-mix(in srgb, var(--rar, var(--crt-color)) 18%, transparent); }
.ach-card.done.r-legendary { position: relative; }
.ach-card.done.r-legendary::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 18px rgba(255,182,39,.3), 0 0 12px rgba(255,182,39,.45); opacity: .3; animation: rarPulse 2.2s ease-in-out infinite alternate; }
@keyframes rarPulse { to { opacity: 1; } }
@keyframes rarGlow { from { box-shadow: inset 0 0 10px rgba(255,182,39,.15), 0 0 0 rgba(255,182,39,0); } to { box-shadow: inset 0 0 18px rgba(255,182,39,.3), 0 0 12px rgba(255,182,39,.45); } }
.ach-card.locked { opacity: .5; }
.ach-card.locked .ach-icon-box { box-shadow: none; border-color: var(--dim2); background: transparent; }
.ach-card-text { min-width: 0; }
.ach-card-title { font-weight: 600; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.ach-card-desc { font-size: 12px; opacity: .75; line-height: 1.35; margin-top: 2px; }
.ach-card-rarity { font-family: var(--font-ui); font-size: 7px; letter-spacing: 1px; margin-top: 5px; color: var(--rar, var(--crt-color)); }
.ach-card.locked .ach-card-rarity { opacity: .8; }
.ach-prow.rar .ach-prow-label { color: var(--rar); opacity: 1; }
.ach-prow.rar .ach-bar { border-color: var(--rar); }
.ach-prow.rar .ach-bar-fill { background: repeating-linear-gradient(90deg, var(--rar) 0 6px, transparent 6px 8px); box-shadow: 0 0 8px var(--rar); }
.ach-card-date { font-size: 11px; opacity: .55; margin-top: 3px; }

/* ---------- Мобильные ---------- */
@media (max-width: 800px) { .sidebar { display: none; } }
@media (max-width: 650px), (hover: none) and (pointer: coarse) { .quick-keys { display: flex; } }
@media (max-width: 650px) {
    .terminal-container { width: 96vw; height: calc(var(--app-h) * .94); gap: 10px; }
    .terminal-output { font-size: 14px; padding: 12px 12px 4px; }
    .input-line { padding: 10px 12px; font-size: 15px; }
    .menubar { padding: 6px 12px; }
    .ach-toast-stack { top: 70px; right: auto; left: 50%; transform: translateX(-50%); width: 92vw; max-width: 340px; }
    .ach-toast { transform: translateY(-16px); }
    .ach-toast.show { transform: none; }
    .music-player-modal { max-height: 90%; overflow-y: auto; }
    .ach-window { top: 60px; width: 96vw; max-width: 96vw; max-height: calc(var(--app-h) - 72px); }
    .ach-body { padding: 12px; }
    .ach-prow { grid-template-columns: 96px 1fr 46px; gap: 8px; font-size: 11px; }
    .ach-stats { grid-template-columns: 1fr; }
    .ach-grid { grid-template-columns: 1fr; }
    .menubar-title, .signal { display: none; }
    .music-player-modal { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); width: 90%; max-width: 350px; z-index: 50; animation: none; }
}
@media (max-height: 480px) {
    .bg-grid, .sidebar { display: none; }
    .menubar { padding: 4px 10px; }
    .terminal-container { gap: 6px; }
}
@media (pointer: coarse) {
    .player-btn { min-height: 44px; }
    .custom-slider { height: 14px; }
    .custom-slider::-webkit-slider-thumb { width: 18px; height: 30px; }
    .custom-slider::-moz-range-thumb { width: 18px; height: 30px; }
    .playlist-item { padding: 9px 8px; }
}
@media (prefers-reduced-motion: reduce) { .crt-screen, .bg-grid::before, .crt-overlay::after { animation: none; } }
/* телефоны: без дорогих эффектов */
@media (max-width: 650px), (hover: none) and (pointer: coarse) {
    .bg-grid::before { animation-duration: 6s; }
    .terminal-container, .terminal-output { text-shadow: none; }
    .crt-overlay::after { display: none; }
}
.ach-window, .music-player-modal { contain: layout; }
/* вкладка скрыта - бесконечные анимации на паузу */
body.is-hidden *, body.is-hidden *::before, body.is-hidden *::after { animation-play-state: paused !important; }

/* ---------- Анимации ---------- */
@keyframes turnOn {
    0% { transform: scale(1,.002); opacity: 0; filter: brightness(30); }
    30% { transform: scale(1,.002); opacity: 1; filter: brightness(30); }
    60% { transform: scale(1,1); opacity: 1; filter: brightness(5); }
    100% { transform: scale(1,1); opacity: 1; filter: brightness(1); }
}
@keyframes textFlicker { 0% { opacity: .96; } 50% { opacity: 1; } 100% { opacity: .97; } }
@keyframes cursorBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes screenShake {
    0% { transform: translate(0,0); } 25% { transform: translate(3px,-2px); }
    50% { transform: translate(-3px,2px); } 75% { transform: translate(2px,2px); } 100% { transform: translate(0,0); }
}
@keyframes glitchAnim { 0% { top: -20px; opacity: 1; } 50% { top: 50%; opacity: .7; height: 15px; } 100% { top: 110%; opacity: 0; } }
@keyframes fadeInLogo { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gridMove { to { transform: translateY(48px); } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes eqBar { to { transform: scaleY(1); } }

.crash-glitch { animation: screenCrash .08s infinite alternate; }
@keyframes screenCrash {
    0% { transform: translate(3px,-2px) skewX(4deg); filter: invert(.8) hue-rotate(180deg) contrast(200%); }
    20% { transform: translate(-4px,3px) skewY(-2deg); filter: invert(0) saturate(500%) brightness(1.5); }
    40% { transform: translate(5px,1px) scaleY(1.02); filter: contrast(300%) hue-rotate(90deg); }
    60% { transform: translate(-3px,-4px) skewX(-5deg); filter: invert(1) brightness(2); }
    80% { transform: translate(2px,4px); filter: hue-rotate(270deg) contrast(150%); }
    100% { transform: translate(-2px,-1px); filter: none; }
}
.text-crash { animation: textGlitchJitter .05s infinite; color: #00ff00 !important; }
@keyframes textGlitchJitter {
    0% { transform: translate(0); text-shadow: 4px 0 0 red, -4px 0 0 blue; }
    20% { transform: translate(-3px,2px); text-shadow: -4px 0 0 red, 4px 0 0 blue; }
    40% { transform: translate(-2px,-3px); text-shadow: 4px 0 0 red, -4px 0 0 blue; }
    60% { transform: translate(3px,2px); text-shadow: -4px 0 0 red, 4px 0 0 blue; }
    80% { transform: translate(2px,-2px); text-shadow: 4px 0 0 red, -4px 0 0 blue; }
    100% { transform: translate(0); text-shadow: 4px 0 0 red, -4px 0 0 blue; }
}
.crt-off { animation: crtPowerOff .6s cubic-bezier(.23,1,.32,1) forwards !important; }
@keyframes crtPowerOff {
    0% { transform: scale(1,1); filter: brightness(1) contrast(100%); opacity: 1; }
    40% { transform: scale(1,.005); filter: brightness(4) contrast(300%); opacity: 1; }
    70% { transform: scale(.005,.005); filter: brightness(10); opacity: 1; }
    100% { transform: scale(0,0); filter: brightness(0); opacity: 0; }
}

/* ---- сортировка достижений по редкости ---- */
.ach-sort-label { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; opacity: .7; }
.ach-group-title[class*="r-"] { color: var(--rar); border-bottom-color: var(--rar); }

/* ---- скрытое админ-меню ---- */
.adm-window { width: 680px; max-width: 96vw; z-index: 30; border-color: #ff3355; box-shadow: 0 0 26px rgba(255, 51, 85, .45), 8px 8px 0 rgba(0,0,0,.6); }
.adm-window .player-header { background: #ff3355; color: #000; }
.adm-tabs, .adm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.adm-window .player-btn { flex: 0 0 auto; padding: 8px 10px; }
.adm-window .player-btn.small { padding: 5px 8px; font-size: 9px; }
.adm-window .player-btn.active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.adm-window .player-btn.danger { border-color: #ff3355; color: #ff3355; }
.adm-window .player-btn.danger:hover { background: #ff3355; color: #000; }
.adm-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.adm-name { flex: 1 1 160px; font-weight: 600; color: var(--rar, var(--crt-color)); }
.adm-id { flex: 0 0 auto; font-size: 11px; opacity: .5; }
.adm-label { flex: 0 0 130px; opacity: .75; }
.adm-note { margin: 8px 0; font-size: 12px; opacity: .7; overflow-wrap: anywhere; }
.adm-input { flex: 1; min-width: 0; padding: 7px 8px; font: inherit; color: var(--crt-color); background: var(--dim); border: 1px solid var(--crt-color); outline: none; }
.adm-area { width: 100%; min-height: 150px; margin-bottom: 8px; resize: vertical; font-size: 11px; }
.adm-dim { opacity: .45; }
.adm-window .adm-input[type="range"] { padding: 0; border: 0; background: transparent; }
.adm-window .ach-group-title { margin-top: 10px; }
.ach-card.has-hint { cursor: pointer; }
.ach-card-hint { font-size: 12px; margin-top: 5px; color: var(--crt-color); opacity: 1; line-height: 1.35; }
.ach-card-hint.hidden { display: none; }

.spati-btn.on { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }

/* ---------- Стартовый экран (жест для разблокировки звука) ---------- */
.start-screen {
    position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center;
    padding: 24px; cursor: pointer; text-align: center;
    background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--crt-color) 14%, var(--crt-bg)) 0%, var(--crt-bg) 65%);
    transition: opacity .35s ease-out;
}
.start-screen.hide { opacity: 0; pointer-events: none; }
.start-text {
    font-family: var(--font-ui); font-size: clamp(14px, 3.2vw, 28px); line-height: 2.2; letter-spacing: 2px;
    color: var(--crt-color); text-shadow: 0 0 10px var(--crt-glow), 0 0 26px var(--crt-glow);
    animation: cursorBlink 1.2s infinite;
}

/* ---------- Красивые уведомления: свой стиль для каждой редкости ---------- */
.ach-toast { position: relative; }
.ach-toast .ach-icon-box, .ach-toast .ach-toast-text { position: relative; z-index: 1; }

/* полоска оставшегося времени */
.ach-toast::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; z-index: 2; pointer-events: none;
    background: var(--rar, var(--crt-color)); box-shadow: 0 0 8px var(--rar, var(--crt-color)); opacity: .85;
    transform-origin: left; animation: achLife var(--life, 4s) linear forwards;
}
@keyframes achLife { to { transform: scaleX(0); } }

/* иконка «выскакивает» */
.ach-toast.show .ach-icon-box { animation: achIconPop .45s cubic-bezier(.2,1.6,.4,1) .15s both; }
@keyframes achIconPop { from { opacity: 0; transform: scale(.35) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes achRing {
    from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rar) 75%, transparent), 0 0 10px color-mix(in srgb, var(--rar) 55%, transparent); }
    to   { box-shadow: 0 0 0 18px transparent, 0 0 10px color-mix(in srgb, var(--rar) 55%, transparent); }
}

/* блик, пробегающий по карточке */
.ach-toast.r-rare::before, .ach-toast.r-epic::before, .ach-toast.r-legendary::before {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .4;
    background: linear-gradient(105deg, transparent, color-mix(in srgb, var(--rar) 45%, #fff), transparent) no-repeat;
    background-size: 40% 100%; background-position: -100% 0;
}
.ach-toast.r-rare.show::before { animation: achShine 1.1s ease-out .4s 1; }
.ach-toast.r-epic.show::before { animation: achShine 1.0s ease-out .4s 2; }
.ach-toast.r-legendary.show::before { animation: achShine 1.2s ease-out .5s 3; opacity: .5; }
@keyframes achShine { from { background-position: -100% 0; } to { background-position: 200% 0; } }

/* ОБЫЧНОЕ — чистое появление, только иконка и полоска времени */

/* РЕДКОЕ — синее: кольцо от иконки + блик */
.ach-toast.r-rare .ach-name { text-shadow: 0 0 8px rgba(74,168,255,.7); }
.ach-toast.r-rare.show .ach-icon-box { animation: achIconPop .45s cubic-bezier(.2,1.6,.4,1) .15s both, achRing 1s ease-out .45s 1; }

/* ЭПИЧЕСКОЕ — фиолетовое: глитч при появлении, переливающийся фон, искры */
.ach-toast.r-epic {
    background: linear-gradient(115deg, color-mix(in srgb, var(--crt-bg) 92%, #000) 0%, color-mix(in srgb, #c26bff 20%, var(--crt-bg)) 50%, color-mix(in srgb, var(--crt-bg) 92%, #000) 100%);
    background-size: 220% 100%;
}
.ach-toast.r-epic.show { animation: achGlitch .45s steps(2, end) 1, achBgSlide 3.2s linear infinite; }
.ach-toast.r-epic .ach-name { text-shadow: 0 0 10px rgba(194,107,255,.85); }
.ach-toast.r-epic.show .ach-icon-box { animation: achIconPop .45s cubic-bezier(.2,1.6,.4,1) .15s both, achRing .9s ease-out .45s 2; }
@keyframes achGlitch {
    0%   { transform: translateX(-8px) skewX(10deg); filter: hue-rotate(60deg); }
    25%  { transform: translateX(6px) skewX(-8deg); filter: hue-rotate(-40deg); }
    50%  { transform: translateX(-4px) skewX(5deg); filter: none; }
    75%  { transform: translateX(3px) skewX(-3deg); filter: hue-rotate(30deg); }
    100% { transform: none; filter: none; }
}
@keyframes achBgSlide { from { background-position: 0 0; } to { background-position: 220% 0; } }

/* ЛЕГЕНДАРНОЕ — золотое: больше, всплеск, вращающиеся лучи, искры, вспышка */
.ach-toast.r-legendary {
    padding: 16px 16px; border-left-width: 8px;
    background: linear-gradient(115deg, color-mix(in srgb, var(--crt-bg) 90%, #000) 0%, color-mix(in srgb, #ffb627 24%, var(--crt-bg)) 50%, color-mix(in srgb, var(--crt-bg) 90%, #000) 100%);
    background-size: 220% 100%;
}
.ach-toast.r-legendary.show { animation: achLegend .8s cubic-bezier(.2,1.3,.4,1) 1, achBgSlide 2.6s linear infinite, achGlow 1.4s ease-in-out infinite alternate; }
.ach-toast.r-legendary .ach-name { font-size: 12px; color: #ffe29a; text-shadow: 0 0 10px rgba(255,182,39,.9); }
.ach-toast.r-legendary .ach-head { text-shadow: 0 0 8px rgba(255,182,39,.8); }
.ach-toast.r-legendary.show .ach-icon-box { animation: achIconPop .5s cubic-bezier(.2,1.6,.4,1) .2s both, achRing 1.1s ease-out .5s 3; }
@keyframes achLegend {
    0%   { transform: translateX(40px) scale(.7); }
    60%  { transform: translateX(0) scale(1.06); }
    100% { transform: none; }
}
@keyframes achGlow {
    from { box-shadow: 0 0 22px rgba(255,182,39,.45), 6px 6px 0 rgba(0,0,0,.6); }
    to   { box-shadow: 0 0 44px rgba(255,182,39,.9), 6px 6px 0 rgba(0,0,0,.6); }
}
.ach-rays {
    position: absolute; left: 38px; top: 50%; width: 150px; height: 150px; margin: -75px 0 0 -75px;
    pointer-events: none; z-index: 0; opacity: .55;
    background: repeating-conic-gradient(from 0deg, rgba(255,200,70,.55) 0 6deg, transparent 6deg 20deg);
    -webkit-mask-image: radial-gradient(circle, #000 0, transparent 68%); mask-image: radial-gradient(circle, #000 0, transparent 68%);
    animation: achSpin 9s linear infinite;
}
@keyframes achSpin { to { transform: rotate(360deg); } }

/* искры */
.ach-spark {
    position: absolute; left: 36px; top: 50%; width: var(--sz, 3px); height: var(--sz, 3px); margin: -2px 0 0 -2px;
    background: var(--rar); box-shadow: 0 0 6px var(--rar); opacity: 0; pointer-events: none; z-index: 3;
    animation: achSpark var(--dur, 1s) ease-out forwards;
}
.ach-toast.r-legendary .ach-spark { left: 38px; background: #ffd36a; }
@keyframes achSpark {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}

/* вспышка по экрану */
.ach-flash {
    position: absolute; inset: 0; pointer-events: none; z-index: 24; opacity: 0;
    background: radial-gradient(circle at 80% 14%, color-mix(in srgb, var(--rar) 55%, transparent), transparent 60%);
    animation: achFlash 1s ease-out forwards;
}
.ach-flash.r-epic { --peak: .55; }
@keyframes achFlash { 0% { opacity: 0; } 15% { opacity: var(--peak, 1); } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .ach-toast, .ach-toast *, .ach-toast::before, .ach-toast::after { animation: none !important; }
}

/* ---------- Змейка ---------- */
.snake-window { width: 372px; }
.snake-body { padding: 12px; overflow-y: auto; min-height: 0; }
.snake-stats { display: flex; justify-content: space-between; font-family: var(--font-ui); font-size: 8px; margin-bottom: 10px; }
.snake-stats b { font-weight: 400; margin-left: 6px; text-shadow: 0 0 8px var(--crt-glow); }
#skCanvas {
    display: block; width: min(100%, 52dvh); aspect-ratio: 1; margin: 0 auto; cursor: pointer;
    border: 1px solid var(--crt-color); background: color-mix(in srgb, var(--crt-bg) 70%, #000);
    box-shadow: inset 0 0 20px rgba(0,0,0,.6), 0 0 12px var(--dim2); touch-action: none; image-rendering: pixelated;
}
.snake-ctrl { display: flex; gap: 8px; margin-top: 10px; }
.snake-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.snake-opts .player-btn { flex: none; font-size: 8px; padding: 8px 4px; white-space: nowrap; }
.snake-top { margin-top: 10px; border: 1px solid var(--dim2); padding: 8px; font-size: 11px; }
.sk-top-title { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; margin-bottom: 6px; opacity: .8; }
.sk-top-empty { font-size: 10px; opacity: .5; }
.sk-top-row { display: grid; grid-template-columns: 22px 34px 1fr auto; gap: 6px; line-height: 1.7; opacity: .85; padding: 0 2px; }
.sk-top-row span:nth-child(2) { font-weight: 600; }
.sk-top-row span:last-child { font-size: 9px; opacity: .65; align-self: center; }
.sk-top-row.new { opacity: 1; background: var(--dim); text-shadow: 0 0 8px var(--crt-glow); }
.snake-pad { display: none; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 46px); gap: 6px; justify-content: center; margin-top: 10px; }
.snake-pad .player-btn { flex: none; font-size: 14px; padding: 0; touch-action: manipulation; }
.snake-pad [data-d="up"] { grid-column: 2; grid-row: 1; }
.snake-pad [data-d="left"] { grid-column: 1; grid-row: 2; }
.snake-pad [data-d="down"] { grid-column: 2; grid-row: 2; }
.snake-pad [data-d="right"] { grid-column: 3; grid-row: 2; }
.snake-help { margin-top: 10px; font-size: 10px; opacity: .6; text-align: center; letter-spacing: .5px; }
@media (pointer: coarse), (max-width: 650px) { .snake-pad { display: grid; } .snake-help { display: none; } }

.snake-spati { margin-top: 10px; padding-left: 8px; border-left: 3px solid var(--crt-color); font-size: 11px; line-height: 1.5; text-shadow: 0 0 6px var(--crt-glow); }
.snake-spati:empty { display: none; }

/* уведомление импорта/экспорта */
.io-note {
    position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 26; max-width: 90vw;
    padding: 10px 14px; font-size: 12px; text-align: center; color: var(--crt-color);
    background: color-mix(in srgb, var(--crt-bg) 92%, #000); border: 1px solid var(--crt-color);
    box-shadow: 0 0 18px var(--crt-glow), 6px 6px 0 rgba(0,0,0,.6); pointer-events: none; animation: popIn .25s ease-out;
}


/* ---------- Перетаскиваемые окна ---------- */
.player-header { cursor: move; touch-action: none; }
.player-header button { cursor: pointer; }
.win-moved { transform: none !important; animation: none !important; }
.win-drag { opacity: .93; box-shadow: 0 0 34px var(--crt-glow), 12px 12px 0 rgba(0,0,0,.6); }

/* ---------- Карточка прогресса ---------- */
.card-window { width: 540px; }
.card-body { padding: 12px; overflow-y: auto; min-height: 0; }
.card-body canvas { display: block; width: 100%; height: auto; border: 1px solid var(--crt-color); box-shadow: 0 0 12px var(--dim2); }
.card-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card-actions .player-btn { min-width: 110px; }


/* ---------- Никнейм ---------- */
.user-btn { display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
#statNick { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-nick { font-family: var(--font-ui); font-size: 11px; margin-bottom: 8px; word-break: break-all; text-shadow: 0 0 8px var(--crt-glow); }
@media (max-width: 650px) { .user-btn { max-width: 80px; } }

/* ---------- Маскот Спати ---------- */
.spati-mascot {
    position: absolute; left: 0; top: 0; width: 96px; height: 104px; z-index: 24;
    pointer-events: none; opacity: 0; transform: scale(.4); transform-origin: 50% 100%;
    transition: opacity .45s ease, transform .45s cubic-bezier(.3,1.6,.5,1);
    touch-action: none; cursor: grab; -webkit-user-drag: none;
}
.spati-mascot.show { opacity: .94; transform: scale(1); pointer-events: auto; }
.spati-mascot.held { cursor: grabbing; }
.spati-mascot.gliding { transition: opacity .45s ease, transform .45s cubic-bezier(.3,1.6,.5,1), left .65s cubic-bezier(.4,0,.2,1), top .65s cubic-bezier(.4,0,.2,1); }
.sm-react { position: absolute; inset: 10px; transform-origin: 50% 85%; transition: transform .1s ease-out; }
.sm-react svg {
    display: block; width: 100%; height: 100%; overflow: visible;
    filter: drop-shadow(0 0 6px var(--crt-glow));
}
.spati-mascot.show .sm-react svg { animation: spatiFloat 3.4s ease-in-out infinite; }
.spati-mascot.held .sm-react svg { animation-duration: 1.1s; }
.sm-body { fill: var(--crt-color); }
.sm-eyes, .sm-mouth, .sm-eye { fill: var(--crt-bg); }
.sm-eye { transform-box: fill-box; transform-origin: 50% 50%; }
.sm-gaze { transform: translate(var(--gx, 0px), var(--gy, 0px)); transition: transform .15s ease-out; }
.sm-eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: spatiBlink 4.6s steps(1) infinite; }
.sm-mouth {
    transform-box: fill-box; transform-origin: 50% 0;
    transform: scale(var(--mx, 1), var(--my, .4)); transition: transform .06s steps(1);
}
.spati-mascot.open .sm-mouth { transform: scale(var(--ox, 1), var(--oy, 1)); }
.spati-mascot.think .sm-eyes { animation: spatiLook .6s steps(1) infinite; }
body.spati-on:not(.sm-moved) .terminal-output { padding-right: 100px; }

/* эмоции */
.spati-mascot[data-em="happy"]     { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.spati-mascot[data-em="happy"] .sm-eye     { transform: scaleY(.45); }
.spati-mascot[data-em="surprised"] { --mx: 1.6; --my: .9; --ox: 1.8; --oy: 1.3; }
.spati-mascot[data-em="surprised"] .sm-eye { transform: scale(1.5); }
.spati-mascot[data-em="angry"]     { --mx: 2; --my: .2; --ox: 2; --oy: .6; }
.spati-mascot[data-em="angry"] .sm-eye.l   { transform: rotate(22deg) scaleY(.6); }
.spati-mascot[data-em="angry"] .sm-eye.r   { transform: rotate(-22deg) scaleY(.6); }
.spati-mascot[data-em="sleepy"]    { --mx: .8; --my: .25; --ox: .9; --oy: .5; }
.spati-mascot[data-em="sleepy"] .sm-eye    { transform: scaleY(.12); }
.spati-mascot[data-em="dizzy"]     { --mx: 1.4; --my: .5; --ox: 1.4; --oy: .9; }
.spati-mascot[data-em="dizzy"] .sm-eye     { animation: smEyeSpin .5s linear infinite; }
.spati-mascot[data-em="wink"]      { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.spati-mascot[data-em="wink"] .sm-eye.r    { transform: scaleY(.12); }
.spati-mascot[data-em="laugh"]     { --mx: 3; --my: .7; --ox: 3; --oy: 1.3; }
.spati-mascot[data-em="laugh"] .sm-eye     { transform: scaleY(.35); }
.spati-mascot[data-em="sad"]       { --mx: 1.4; --my: .2; --ox: 1.2; --oy: .5; }
.spati-mascot[data-em="sad"] .sm-eye       { transform: scaleY(.75) translateY(.12px); }
.spati-mascot[data-em="yawn"]      { --mx: 1.6; --my: 1.5; --ox: 1.6; --oy: 1.5; }
.spati-mascot[data-em="yawn"] .sm-eye      { transform: scaleY(.2); }
.spati-mascot[data-em="blink"] .sm-eye     { animation: smBlink2 .7s steps(1); }
.spati-mascot[data-em="look"] .sm-gaze     { animation: spatiGaze 2.4s steps(1); }

/* движения тела */
.sm-react.a-jump   { animation: smJump .7s ease-out; }
.sm-react.a-hop    { animation: smHop .55s ease-out; }
.sm-react.a-spin   { animation: smSpin .9s ease-in-out; }
.sm-react.a-flip   { animation: smFlip .8s ease-in-out; }
.sm-react.a-squish { animation: smSquish .6s ease-out; }
.sm-react.a-shake  { animation: smShake .55s steps(2); }
.sm-react.a-dizzy  { animation: smDizzy 1.6s ease-in-out; }
.sm-react.a-vanish { animation: smVanish 1.4s ease-in-out; }
.sm-react.a-laugh  { animation: smLaugh 1.3s steps(2); }
.sm-react.a-boo    { animation: smBoo .9s ease-out; filter: drop-shadow(0 0 14px var(--crt-color)); }
.sm-react.a-dance  { animation: smDance 2.6s ease-in-out; }
.sm-react.a-glitch { animation: smGlitch .8s steps(1); }
.sm-react.a-sleep  { animation: smSleep 3.2s ease-in-out; }
.sm-react.a-yawn   { animation: smYawn 1.8s ease-in-out; }
.sm-react.a-sway   { animation: smSway 2s ease-in-out; }
.sm-react.a-bump   { animation: smBump .3s ease-out; }
.sm-react.a-land   { animation: smLand .45s ease-out; }

/* реплика над/под маскотом */
.sm-bubble {
    position: absolute; z-index: 2; width: max-content; max-width: 210px; padding: 6px 10px;
    font-family: var(--font-text); font-size: 12px; line-height: 1.35; white-space: normal;
    color: var(--crt-color); background: color-mix(in srgb, var(--crt-bg) 92%, #000);
    border: 1px solid var(--crt-color); box-shadow: 0 0 10px var(--crt-glow);
    text-shadow: 0 0 3px var(--crt-glow); opacity: 0; transform: scale(.85);
    transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.sm-bubble.show { opacity: 1; transform: none; }
.sm-bubble.up   { bottom: 100%; margin-bottom: -6px; }
.sm-bubble.down { top: 100%; margin-top: -6px; }
.sm-bubble.l { left: 0; transform-origin: 0 100%; }
.sm-bubble.r { right: 0; transform-origin: 100% 100%; }

@keyframes spatiFloat { 0%, 100% { transform: translateY(-7px); } 50% { transform: translateY(9px); } }
@keyframes spatiBlink { 0%, 93%, 100% { transform: scaleY(1); } 94%, 97% { transform: scaleY(.12); } }
@keyframes spatiLook { 0%, 100% { transform: translateX(-.35px); } 50% { transform: translateX(.35px); } }
@keyframes spatiGaze { 0% { transform: translate(-.4px, 0); } 30% { transform: translate(.4px, -.1px); } 60% { transform: translate(-.4px, .1px); } 85% { transform: translate(.4px, 0); } 100% { transform: translate(0, 0); } }
@keyframes smEyeSpin { to { transform: rotate(360deg); } }
@keyframes smBlink2 { 0%, 100% { transform: scaleY(1); } 15%, 30% { transform: scaleY(.1); } 45%, 60% { transform: scaleY(1); } 70%, 85% { transform: scaleY(.1); } }
@keyframes smJump { 0% { transform: translateY(0) scale(1.15, .8); } 25% { transform: translateY(-34px) scale(.9, 1.12); } 50% { transform: translateY(-44px) scale(1); } 75% { transform: translateY(-8px) scale(.95, 1.08); } 90% { transform: translateY(0) scale(1.15, .8); } 100% { transform: none; } }
@keyframes smHop { 0% { transform: none; } 40% { transform: translateY(-16px); } 100% { transform: none; } }
@keyframes smSpin { from { transform: perspective(300px) rotateY(0); } to { transform: perspective(300px) rotateY(720deg); } }
@keyframes smFlip { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-30px) rotate(-180deg); } 100% { transform: translateY(0) rotate(-360deg); } }
@keyframes smSquish { 0% { transform: none; } 25% { transform: scale(1.35, .6); } 55% { transform: scale(.8, 1.25); } 80% { transform: scale(1.1, .92); } 100% { transform: none; } }
@keyframes smShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px) rotate(-6deg); } 75% { transform: translateX(8px) rotate(6deg); } }
@keyframes smDizzy { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-14deg) translateX(-5px); } 35% { transform: rotate(12deg) translateX(5px); } 55% { transform: rotate(-10deg) translateX(-4px); } 75% { transform: rotate(8deg) translateX(3px); } }
@keyframes smVanish { 0% { transform: none; opacity: 1; } 25% { transform: scale(.1, 1.6); opacity: 0; } 65% { transform: scale(.1); opacity: 0; } 80% { transform: scale(1.25); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes smLaugh { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px) rotate(2deg); } }
@keyframes smBoo { 0% { transform: none; } 15% { transform: scale(1.9); } 70% { transform: scale(1.9); } 100% { transform: none; } }
@keyframes smDance { 0%, 100% { transform: rotate(0); } 12% { transform: translateX(-8px) rotate(-12deg); } 25% { transform: translateY(-8px); } 37% { transform: translateX(8px) rotate(12deg); } 50% { transform: translateY(0); } 62% { transform: translateX(-8px) rotate(-12deg); } 75% { transform: translateY(-8px); } 87% { transform: translateX(8px) rotate(12deg); } }
@keyframes smGlitch { 0% { transform: translateX(-6px) skewX(14deg); } 20% { transform: translateX(7px); opacity: .5; } 40% { transform: translateX(-3px) skewX(-18deg); opacity: 1; } 60% { transform: translate(5px, -4px); opacity: .4; } 80% { transform: translateX(-4px) skewX(8deg); opacity: 1; } 100% { transform: none; } }
@keyframes smSleep { 0% { transform: none; } 15%, 80% { transform: translateY(8px) rotate(7deg); } 90% { transform: translateY(-10px) scale(1.1); } 100% { transform: none; } }
@keyframes smYawn { 0%, 100% { transform: none; } 40%, 60% { transform: scale(1, 1.1); } }
@keyframes smSway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(7deg); } 75% { transform: rotate(-7deg); } }
@keyframes smBump { 0% { transform: scale(.82, 1.22); } 100% { transform: none; } }
@keyframes smLand { 0% { transform: scale(1.2, .8); } 55% { transform: scale(.92, 1.1); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .spati-mascot.show .sm-react svg { animation: none; } }
.is-hidden .spati-mascot * { animation-play-state: paused; }

/* --- маскот: новые реакции и сон --- */
.sm-react.a-inflate { animation: smInflate 1.3s ease-in-out; }
.sm-react.a-tilt    { animation: smTilt 1.2s ease-in-out; }
.sm-react.a-hiccup  { animation: smHiccup 1.4s ease-out; }
.sm-react.a-sneeze  { animation: smSneeze 1s ease-out; }
.sm-react.a-stretch { animation: smStretch 1.8s ease-in-out; }
.spati-mascot.show.asleep { opacity: .68; }
.spati-mascot.asleep .sm-react svg { animation-duration: 8s; }
@keyframes smInflate { 0% { transform: none; } 40%, 60% { transform: scale(1.45); } 50% { transform: scale(1.5, 1.4); } 80% { transform: scale(.85, .9); } 100% { transform: none; } }
@keyframes smTilt { 0%, 100% { transform: none; } 30%, 70% { transform: rotate(-16deg) translateX(-3px); } }
@keyframes smHiccup { 0%, 100% { transform: none; } 10%, 40%, 70% { transform: translateY(-9px) scale(.95, 1.08); } 20%, 50%, 80% { transform: translateY(0) scale(1.08, .92); } }
@keyframes smSneeze { 0% { transform: none; } 50% { transform: scale(1.12, .9) translateY(3px); } 58% { transform: scale(.82, 1.22) translateX(-12px); } 70% { transform: translateX(8px); } 85% { transform: translateX(-3px); } 100% { transform: none; } }
@keyframes smStretch { 0%, 100% { transform: none; } 35%, 70% { transform: scale(.82, 1.32); } }

/* ---------- Яблоко для Спати ---------- */
.sm-apple {
    position: absolute; z-index: 25; width: 40px; height: 40px; padding: 4px; box-sizing: border-box;
    border: 0; background: none; cursor: pointer; color: var(--crt-color);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
    filter: drop-shadow(0 0 6px var(--crt-glow));
    animation: smAppleDrop .5s cubic-bezier(.3,1.6,.5,1), smAppleBob 1.6s ease-in-out .5s infinite;
    transition: left .3s ease-in, top .3s ease-in, transform .3s ease-in, opacity .3s ease-in;
}
.sm-apple svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.sm-apple:hover { filter: drop-shadow(0 0 10px var(--crt-glow)) brightness(1.25); }
.sm-apple.eaten { transform: scale(.2); opacity: 0; pointer-events: none; animation: none; }
.sm-apple.gone { transform: translateY(10px) scale(.6); opacity: 0; pointer-events: none; animation: none; }
@keyframes smAppleDrop { from { transform: translateY(-34px) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes smAppleBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .sm-apple { animation: none; } }

/* ---------- Спати 3.0: ночь, шёпот, зеркало в плеере ---------- */
.spati-mascot.show.night { opacity: .8; }
.spati-mascot.show.night.asleep { opacity: .55; }
.sm-bubble.whisper { font-size: 10px; letter-spacing: .3px; max-width: 170px; }
.sm-bubble.show.whisper { opacity: .82; }

/* зеркало: мини-Спати в углу блока трека в окне плеера */
.pm-spati { display: none; position: absolute; right: 8px; top: 4px; width: 34px; height: 38px; z-index: 2; cursor: pointer; touch-action: manipulation; }
body.spati-on .track-info .eq { margin-right: 46px; }
body.spati-on .pm-spati { display: block; }
.pm-spati .sm-react { inset: 0; }
.pm-spati svg { animation: pmFloat 3.6s ease-in-out infinite; }
.pm-spati.asleep { opacity: .6; }
.pm-spati.asleep svg { animation-duration: 8s; }
.pm-spati.playing svg { animation: pmBeat .52s ease-in-out infinite alternate; }
.pm-note { position: absolute; left: -12px; top: 8px; font-family: var(--font-ui); font-size: 10px; color: var(--crt-color); text-shadow: 0 0 6px var(--crt-glow); opacity: 0; pointer-events: none; }
.pm-spati.playing .pm-note { animation: pmNote 1.8s ease-out infinite; }
@keyframes pmFloat { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@keyframes pmBeat { from { transform: translateY(1px) rotate(-5deg); } to { transform: translateY(-4px) rotate(5deg); } }
@keyframes pmNote { 0% { opacity: 0; transform: translate(0, 6px); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(-6px, -22px); } }
@media (prefers-reduced-motion: reduce) { .pm-spati svg, .pm-spati.playing svg, .pm-spati.playing .pm-note { animation: none; } .pm-spati.playing .pm-note { opacity: .8; } }
.is-hidden .pm-spati * { animation-play-state: paused; }

/* эмоции зеркала — копия правил настоящего Спати */
.pm-spati.open .sm-mouth { transform: scale(var(--ox, 1), var(--oy, 1)); }
.pm-spati.think .sm-eyes { animation: spatiLook .6s steps(1) infinite; }
.pm-spati[data-em="happy"]     { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.pm-spati[data-em="happy"] .sm-eye     { transform: scaleY(.45); }
.pm-spati[data-em="surprised"] { --mx: 1.6; --my: .9; --ox: 1.8; --oy: 1.3; }
.pm-spati[data-em="surprised"] .sm-eye { transform: scale(1.5); }
.pm-spati[data-em="angry"]     { --mx: 2; --my: .2; --ox: 2; --oy: .6; }
.pm-spati[data-em="angry"] .sm-eye.l   { transform: rotate(22deg) scaleY(.6); }
.pm-spati[data-em="angry"] .sm-eye.r   { transform: rotate(-22deg) scaleY(.6); }
.pm-spati[data-em="sleepy"]    { --mx: .8; --my: .25; --ox: .9; --oy: .5; }
.pm-spati[data-em="sleepy"] .sm-eye    { transform: scaleY(.12); }
.pm-spati[data-em="dizzy"]     { --mx: 1.4; --my: .5; --ox: 1.4; --oy: .9; }
.pm-spati[data-em="dizzy"] .sm-eye     { animation: smEyeSpin .5s linear infinite; }
.pm-spati[data-em="wink"]      { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.pm-spati[data-em="wink"] .sm-eye.r    { transform: scaleY(.12); }
.pm-spati[data-em="laugh"]     { --mx: 3; --my: .7; --ox: 3; --oy: 1.3; }
.pm-spati[data-em="laugh"] .sm-eye     { transform: scaleY(.35); }
.pm-spati[data-em="sad"]       { --mx: 1.4; --my: .2; --ox: 1.2; --oy: .5; }
.pm-spati[data-em="sad"] .sm-eye       { transform: scaleY(.75) translateY(.12px); }
.pm-spati[data-em="yawn"]      { --mx: 1.6; --my: 1.5; --ox: 1.6; --oy: 1.5; }
.pm-spati[data-em="yawn"] .sm-eye      { transform: scaleY(.2); }
.pm-spati[data-em="blink"] .sm-eye     { animation: smBlink2 .7s steps(1); }
.pm-spati[data-em="look"] .sm-gaze     { animation: spatiGaze 2.4s steps(1); }

/* ---------- Спати 4.0: аксессуары, сезоны, частицы, щекотка ---------- */
.sm-acc { display: none; }
.spati-mascot.acc-glasses .a-glasses, .pm-spati.acc-glasses .a-glasses,
.spati-mascot.acc-phones .a-phones,   .pm-spati.acc-phones .a-phones,
.spati-mascot.acc-beanie .a-beanie,   .pm-spati.acc-beanie .a-beanie,
.spati-mascot.acc-santa .a-santa,     .pm-spati.acc-santa .a-santa,
.spati-mascot.acc-witch .a-witch,     .pm-spati.acc-witch .a-witch,
.spati-mascot.acc-party .a-party,     .pm-spati.acc-party .a-party { display: inline; }
.spati-mascot.has-hat .ph-band, .pm-spati.has-hat .ph-band { display: none; }
.spati-mascot.has-hat .sm-bubble.up { margin-bottom: 20px; }
.spati-mascot.acc-cap .a-cap,
.spati-mascot.acc-chef .a-chef,
.spati-mascot.acc-bunny .a-bunny,
.spati-mascot.acc-horns .a-horns,
.spati-mascot.acc-halo .a-halo,
.spati-mascot.acc-tophat .a-tophat,
.spati-mascot.acc-crown .a-crown,
.spati-mascot.acc-sunglasses .a-sunglasses,
.spati-mascot.acc-hearts .a-hearts,
.spati-mascot.acc-monocle .a-monocle,
.spati-mascot.acc-mustache .a-mustache,
.spati-mascot.acc-eyepatch .a-eyepatch,
.spati-mascot.acc-blush .a-blush,
.spati-mascot.acc-scarf .a-scarf,
.spati-mascot.acc-bowtie .a-bowtie,
.spati-mascot.acc-tee .a-tee,
.spati-mascot.acc-medal .a-medal,
.spati-mascot.acc-backpack .a-backpack,
.spati-mascot.acc-cape .a-cape,
.spati-mascot.acc-wings .a-wings { display: inline; }
.pm-spati.acc-cap .a-cap,
.pm-spati.acc-chef .a-chef,
.pm-spati.acc-bunny .a-bunny,
.pm-spati.acc-horns .a-horns,
.pm-spati.acc-halo .a-halo,
.pm-spati.acc-tophat .a-tophat,
.pm-spati.acc-crown .a-crown,
.pm-spati.acc-sunglasses .a-sunglasses,
.pm-spati.acc-hearts .a-hearts,
.pm-spati.acc-monocle .a-monocle,
.pm-spati.acc-mustache .a-mustache,
.pm-spati.acc-eyepatch .a-eyepatch,
.pm-spati.acc-blush .a-blush,
.pm-spati.acc-scarf .a-scarf,
.pm-spati.acc-bowtie .a-bowtie,
.pm-spati.acc-tee .a-tee,
.pm-spati.acc-medal .a-medal,
.pm-spati.acc-backpack .a-backpack,
.pm-spati.acc-cape .a-cape,
.pm-spati.acc-wings .a-wings { display: inline; }
.wd-spati.acc-glasses .a-glasses,
.wd-spati.acc-phones .a-phones,
.wd-spati.acc-beanie .a-beanie,
.wd-spati.acc-santa .a-santa,
.wd-spati.acc-witch .a-witch,
.wd-spati.acc-party .a-party,
.wd-spati.acc-cap .a-cap,
.wd-spati.acc-chef .a-chef,
.wd-spati.acc-bunny .a-bunny,
.wd-spati.acc-horns .a-horns,
.wd-spati.acc-halo .a-halo,
.wd-spati.acc-tophat .a-tophat,
.wd-spati.acc-crown .a-crown,
.wd-spati.acc-sunglasses .a-sunglasses,
.wd-spati.acc-hearts .a-hearts,
.wd-spati.acc-monocle .a-monocle,
.wd-spati.acc-mustache .a-mustache,
.wd-spati.acc-eyepatch .a-eyepatch,
.wd-spati.acc-blush .a-blush,
.wd-spati.acc-scarf .a-scarf,
.wd-spati.acc-bowtie .a-bowtie,
.wd-spati.acc-tee .a-tee,
.wd-spati.acc-medal .a-medal,
.wd-spati.acc-backpack .a-backpack,
.wd-spati.acc-cape .a-cape,
.wd-spati.acc-wings .a-wings { display: inline; }
.wd-flyer.acc-glasses .a-glasses,
.wd-flyer.acc-phones .a-phones,
.wd-flyer.acc-beanie .a-beanie,
.wd-flyer.acc-santa .a-santa,
.wd-flyer.acc-witch .a-witch,
.wd-flyer.acc-party .a-party,
.wd-flyer.acc-cap .a-cap,
.wd-flyer.acc-chef .a-chef,
.wd-flyer.acc-bunny .a-bunny,
.wd-flyer.acc-horns .a-horns,
.wd-flyer.acc-halo .a-halo,
.wd-flyer.acc-tophat .a-tophat,
.wd-flyer.acc-crown .a-crown,
.wd-flyer.acc-sunglasses .a-sunglasses,
.wd-flyer.acc-hearts .a-hearts,
.wd-flyer.acc-monocle .a-monocle,
.wd-flyer.acc-mustache .a-mustache,
.wd-flyer.acc-eyepatch .a-eyepatch,
.wd-flyer.acc-blush .a-blush,
.wd-flyer.acc-scarf .a-scarf,
.wd-flyer.acc-bowtie .a-bowtie,
.wd-flyer.acc-tee .a-tee,
.wd-flyer.acc-medal .a-medal,
.wd-flyer.acc-backpack .a-backpack,
.wd-flyer.acc-cape .a-cape,
.wd-flyer.acc-wings .a-wings { display: inline; }
.wd-spati.has-hat .ph-band, .wd-flyer.has-hat .ph-band { display: none; }
.spati-mascot.sk-red .sm-body, .pm-spati.sk-red .sm-body, .wd-spati.sk-red .sm-body, .wd-flyer.sk-red .sm-body { fill: #ff5a5a; }
.spati-mascot.sk-white .sm-body, .pm-spati.sk-white .sm-body, .wd-spati.sk-white .sm-body, .wd-flyer.sk-white .sm-body { fill: #f2f2f2; }
.spati-mascot.sk-pink .sm-body, .pm-spati.sk-pink .sm-body, .wd-spati.sk-pink .sm-body, .wd-flyer.sk-pink .sm-body { fill: #ff7ab8; }
.spati-mascot.sk-cyan .sm-body, .pm-spati.sk-cyan .sm-body, .wd-spati.sk-cyan .sm-body, .wd-flyer.sk-cyan .sm-body { fill: #4fe3ff; }
.spati-mascot.sk-purple .sm-body, .pm-spati.sk-purple .sm-body, .wd-spati.sk-purple .sm-body, .wd-flyer.sk-purple .sm-body { fill: #b57bff; }
.spati-mascot.sk-gold .sm-body, .pm-spati.sk-gold .sm-body, .wd-spati.sk-gold .sm-body, .wd-flyer.sk-gold .sm-body { fill: #ffc83d; }
.wd-spati.sm-halloween .sm-body, .wd-flyer.sm-halloween .sm-body { fill: #ff8a1f; }
.wd-spati.sm-aprilfools svg, .wd-flyer.sm-aprilfools svg { rotate: 180deg; }

/* эмоции Спати в гардеробе */
.wd-spati[data-em="happy"]     { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.wd-spati[data-em="happy"] .sm-eye     { transform: scaleY(.45); }
.wd-spati[data-em="surprised"] { --mx: 1.6; --my: .9; --ox: 1.8; --oy: 1.3; }
.wd-spati[data-em="surprised"] .sm-eye { transform: scale(1.5); }
.wd-spati[data-em="angry"]     { --mx: 2; --my: .2; --ox: 2; --oy: .6; }
.wd-spati[data-em="angry"] .sm-eye.l   { transform: rotate(22deg) scaleY(.6); }
.wd-spati[data-em="angry"] .sm-eye.r   { transform: rotate(-22deg) scaleY(.6); }
.wd-spati[data-em="sleepy"]    { --mx: .8; --my: .25; --ox: .9; --oy: .5; }
.wd-spati[data-em="sleepy"] .sm-eye    { transform: scaleY(.12); }
.wd-spati[data-em="dizzy"]     { --mx: 1.4; --my: .5; --ox: 1.4; --oy: .9; }
.wd-spati[data-em="dizzy"] .sm-eye     { animation: smEyeSpin .5s linear infinite; }
.wd-spati[data-em="wink"]      { --mx: 3; --my: .35; --ox: 3; --oy: .9; }
.wd-spati[data-em="wink"] .sm-eye.r    { transform: scaleY(.12); }
.wd-spati[data-em="laugh"]     { --mx: 3; --my: .7; --ox: 3; --oy: 1.3; }
.wd-spati[data-em="laugh"] .sm-eye     { transform: scaleY(.35); }
.wd-spati[data-em="sad"]       { --mx: 1.4; --my: .2; --ox: 1.2; --oy: .5; }
.wd-spati[data-em="sad"] .sm-eye       { transform: scaleY(.75) translateY(.12px); }
.wd-spati[data-em="yawn"]      { --mx: 1.6; --my: 1.5; --ox: 1.6; --oy: 1.5; }
.wd-spati[data-em="yawn"] .sm-eye      { transform: scaleY(.2); }
.wd-spati[data-em="blink"] .sm-eye     { animation: smBlink2 .7s steps(1); }
.wd-spati[data-em="look"] .sm-gaze     { animation: spatiGaze 2.4s steps(1); }


/* ---------- Гардероб Спати 2.0 ---------- */
.wardrobe-window { width: 780px; height: min(600px, calc(var(--app-h) - 110px)); }
.wr-body { padding: 0; overflow: hidden; display: grid; grid-template-columns: 270px minmax(0, 1fr); }

/* левая колонка: примерочная */
.wr-side {
    display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 12px;
    border-right: 1px solid var(--dim2); background: color-mix(in srgb, var(--crt-color) 3%, transparent);
}
.wr-side::-webkit-scrollbar { width: 4px; }
.wr-side::-webkit-scrollbar-thumb { background: var(--crt-color); }
.wr-stage {
    position: relative; flex: 0 0 auto; height: 200px; border: 1px solid var(--dim2);
    background:
        radial-gradient(ellipse 70% 55% at 50% 100%, color-mix(in srgb, var(--crt-color) 28%, transparent), transparent 72%),
        linear-gradient(to bottom, color-mix(in srgb, var(--crt-color) 7%, transparent), transparent 65%);
}
.wr-stage::before {
    content: ''; position: absolute; inset: auto 0 0 0; height: 42%; pointer-events: none;
    background: repeating-linear-gradient(90deg, var(--dim) 0 1px, transparent 1px 20px), repeating-linear-gradient(0deg, var(--dim) 0 1px, transparent 1px 12px);
    mask-image: linear-gradient(to top, #000, transparent); -webkit-mask-image: linear-gradient(to top, #000, transparent);
}
.wr-stage::after {
    content: ''; position: absolute; left: 50%; bottom: 10px; width: 130px; height: 14px; margin-left: -65px; pointer-events: none;
    border-radius: 50%; background: radial-gradient(ellipse, color-mix(in srgb, var(--crt-color) 55%, transparent), transparent 70%);
    box-shadow: 0 0 18px var(--crt-glow);
}
.wr-tag { position: absolute; top: 6px; left: 8px; z-index: 2; font-family: var(--font-ui); font-size: 7px; letter-spacing: 1px; opacity: .6; }
.wr-tag.prev { left: auto; right: 6px; padding: 2px 4px; opacity: 0; background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-stage.previewing .wr-tag.prev { opacity: 1; }

.wd-spati { position: absolute; left: 50%; bottom: 16px; z-index: 1; width: 124px; height: 136px; margin-left: -62px; cursor: pointer; touch-action: manipulation; }
.wd-spati.wait { visibility: hidden; }
.wd-spati svg { animation: spatiFloat 3.4s ease-in-out infinite; }
.wd-spati.open .sm-mouth { transform: scale(var(--ox, 1), var(--oy, 1)); }

.wr-say {
    position: relative; flex: none; min-height: 54px; padding: 8px 10px; font-size: 13px; line-height: 1.35;
    border: 1px solid var(--crt-color); background: var(--dim); box-shadow: 0 0 10px var(--dim2); opacity: 0; transition: opacity .2s;
}
.wr-say.show { opacity: 1; }
.wr-say::before {
    content: ''; position: absolute; left: 50%; top: -7px; width: 12px; height: 12px; margin-left: -6px; background: var(--crt-bg);
    border-left: 1px solid var(--crt-color); border-top: 1px solid var(--crt-color); transform: rotate(45deg);
}

/* что надето сейчас */
.wr-slots { display: flex; flex-direction: column; gap: 6px; }
.wr-slot {
    display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 6px; cursor: pointer; touch-action: manipulation;
    background: var(--dim); border: 1px solid var(--dim2);
}
.wr-slot:hover, .wr-slot:focus-visible { border-color: var(--crt-color); outline: none; }
.wr-slot.active { border-color: var(--crt-color); box-shadow: inset 3px 0 0 var(--crt-color); }
.wr-slot .wd-thumb { flex: 0 0 34px; width: 34px; height: 34px; }
.wr-slot-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wr-slot-k { font-family: var(--font-ui); font-size: 7px; opacity: .6; }
.wr-slot-v { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-slot:not(.on) .wr-slot-v { opacity: .45; font-weight: 400; }
.wr-x {
    flex: none; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--dim2); font-family: var(--font-text); font-size: 15px; line-height: 1; cursor: pointer;
}
.wr-x:hover { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-acts { display: flex; gap: 6px; }

.wr-btn {
    flex: 1; padding: 9px 6px; background: transparent; border: 1px solid var(--crt-color); color: var(--crt-color);
    font-family: var(--font-ui); font-size: 8px; cursor: pointer; touch-action: manipulation;
}
.wr-btn:hover, .wr-btn:focus-visible { background: var(--crt-color); color: var(--crt-bg); outline: none; text-shadow: none; box-shadow: 0 0 12px var(--crt-glow); }
.wr-btn.solid { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-btn.solid:hover, .wr-btn.solid:focus-visible { filter: brightness(1.15); }
.wr-btn.x { flex: 0 0 auto; padding: 9px 10px; border-color: var(--dim2); font-family: var(--font-text); font-size: 14px; line-height: 1; }

/* правая колонка: вкладки, фильтры, вещи */
.wr-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wr-tabs { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--dim2); }
.wr-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 2px 8px;
    background: transparent; border: 0; border-right: 1px solid var(--dim2); color: inherit; font-family: var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.wr-tab:last-child { border-right: 0; }
.wr-tab-l { font-size: 8px; }
.wr-tab-n { font-size: 7px; opacity: .6; }
.wr-tab:hover, .wr-tab:focus-visible { background: var(--dim); outline: none; }
.wr-tab.active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-tab.active .wr-tab-n { opacity: .8; }
.wr-tab.has-new::after { content: ''; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; background: var(--crt-color); box-shadow: 0 0 6px var(--crt-glow); animation: cursorBlink 1.2s infinite; }
.wr-tab.active.has-new::after { background: var(--crt-bg); box-shadow: none; }

.wr-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px dotted var(--dim2); }
.wr-bar.hidden { display: none; }
.wr-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wr-chip { padding: 5px 7px; background: transparent; border: 1px solid var(--dim2); color: inherit; font-family: var(--font-ui); font-size: 7px; cursor: pointer; touch-action: manipulation; }
.wr-chip:hover, .wr-chip:focus-visible { border-color: var(--crt-color); outline: none; }
.wr-chip.active { background: var(--crt-color); border-color: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-prog { flex: none; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; }
.wr-prog b { display: block; width: 56px; height: 8px; border: 1px solid var(--dim2); }
.wr-prog i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--crt-color) 0 4px, transparent 4px 6px); }
.wr-prog em { font-style: normal; }

.wr-list {
    flex: 1; min-height: 0; overflow-y: auto; padding: 12px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; align-content: start;
}
.wr-list::-webkit-scrollbar { width: 4px; }
.wr-list::-webkit-scrollbar-thumb { background: var(--crt-color); }
.wr-card {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
    min-height: 100px; padding: 8px 4px 6px; background: var(--dim); border: 1px solid var(--dim2); box-shadow: inset 0 2px 0 var(--rar, transparent);
    color: inherit; font-family: var(--font-ui); font-size: 7px; line-height: 1.5; text-align: center; cursor: pointer; touch-action: manipulation;
    transition: transform .1s, border-color .1s;
}
.wr-card:hover, .wr-card:focus-visible { border-color: var(--rar, var(--crt-color)); outline: none; transform: translateY(-2px); }
.wr-card.active { border-color: var(--crt-color); background: color-mix(in srgb, var(--crt-color) 22%, transparent); box-shadow: inset 0 0 0 1px var(--crt-color), 0 0 12px var(--crt-glow); }
.wr-card.active::before { content: 'ON'; position: absolute; top: 3px; left: 3px; padding: 1px 3px; font-size: 6px; background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.wr-card.locked { opacity: .5; }
.wr-card.locked:hover { opacity: .8; transform: none; }
.wr-card.new::after { content: 'NEW'; position: absolute; top: 3px; right: 3px; padding: 1px 3px; font-size: 6px; background: var(--crt-color); color: var(--crt-bg); text-shadow: none; animation: cursorBlink 1.2s infinite; }
.wr-card .wd-thumb { width: 52px; height: 52px; }
.wr-lock { width: 26px; height: 26px; margin: 13px 0; }
.wr-name { padding: 0 2px; word-break: break-word; }
.wr-badge { position: absolute; top: 3px; right: 3px; padding: 1px 3px; font-size: 6px; border: 1px solid var(--dim2); opacity: .8; }
.wr-empty { grid-column: 1 / -1; padding: 24px 8px; text-align: center; opacity: .55; font-size: 12px; }

/* вкладка «Образы» */
.wr-list.looks { display: flex; flex-direction: column; gap: 10px; }
.wr-looks-h { font-size: 12px; line-height: 1.4; opacity: .7; }
.wr-look { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--dim); border: 1px dashed var(--dim2); }
.wr-look.filled { border-style: solid; }
.wr-look.current { border-color: var(--crt-color); box-shadow: inset 0 0 0 1px var(--crt-color), 0 0 10px var(--crt-glow); }
.wr-look-th { flex: 0 0 64px; height: 64px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--dim2); background: color-mix(in srgb, var(--crt-bg) 70%, transparent); }
.wr-look-th .wd-thumb { width: 58px; height: 58px; }
.wr-look:not(.filled) .wr-look-th .wd-thumb { opacity: .5; }
.wr-look-i { flex: 1; min-width: 0; }
.wr-look-t { margin-bottom: 6px; font-family: var(--font-ui); font-size: 9px; }
.wr-look-s { font-size: 12px; line-height: 1.35; opacity: .8; }
.wr-look-a { flex: none; display: flex; flex-direction: column; gap: 5px; width: 104px; }
.wr-look-a .wr-btn { flex: none; }

.wr-info { flex: none; min-height: 60px; padding: 8px 12px; border-top: 1px solid var(--dim2); background: color-mix(in srgb, var(--crt-bg) 96%, #000); }
.wr-info-h { margin-bottom: 6px; font-family: var(--font-ui); font-size: 8px; color: var(--rar, inherit); }
.wr-info-t { font-size: 12px; line-height: 1.4; opacity: .8; }
.wr-info.note { border-top-color: var(--rar, var(--crt-color)); box-shadow: inset 0 2px 0 var(--rar, var(--crt-color)); }
.wr-info.note .wr-info-t { opacity: 1; }

/* Спати уехал в окно гардероба: настоящий прячется, пока смотрит скины */
.spati-mascot.wd-away { visibility: hidden; pointer-events: none; }
.wd-flyer { position: absolute; z-index: 90; pointer-events: none; }
.wd-flyer.go { transition: left .7s cubic-bezier(.45,0,.2,1), top .7s cubic-bezier(.45,-.4,.3,1.3), width .7s ease, height .7s ease; }
.wd-flyer svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 6px var(--crt-glow)); }
.wd-thumb { width: 56px; height: 56px; display: block; overflow: visible; }

@media (max-height: 560px) { .wr-stage { height: 160px; } .wd-spati { width: 100px; height: 110px; margin-left: -50px; } }
@media (max-width: 650px) {
    .wardrobe-window { width: 96vw; height: calc(var(--app-h) - 72px); }
    .wr-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .wr-side {
        display: grid; grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "stage say" "stage acts" "slots slots";
        gap: 8px; padding: 8px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--dim2);
    }
    .wr-stage { grid-area: stage; height: 150px; }
    .wr-stage::after { width: 90px; margin-left: -45px; }
    .wd-spati { bottom: 12px; width: 100px; height: 110px; margin-left: -50px; }
    .wr-say { grid-area: say; min-height: 46px; padding: 6px 8px; font-size: 12px; }
    .wr-say::before { left: -7px; top: 14px; margin-left: 0; border-top: 0; border-left: 1px solid var(--crt-color); border-bottom: 1px solid var(--crt-color); }
    .wr-acts { grid-area: acts; align-self: end; }
    .wr-slots { grid-area: slots; flex-direction: row; gap: 5px; }
    .wr-slot { flex: 1; flex-direction: column; gap: 3px; padding: 4px 2px; }
    .wr-slot .wd-thumb { flex-basis: 30px; width: 30px; height: 30px; }
    .wr-slot-t { align-items: center; flex: none; }
    .wr-slot-k { font-size: 6px; }
    .wr-slot-v, .wr-x { display: none; }
    .wr-tab-l { font-size: 7px; }
    .wr-tab-n { font-size: 6px; }
    .wr-bar { padding: 6px 8px; }
    .wr-prog b { width: 36px; }
    .wr-list { padding: 8px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
    .wr-info { min-height: 0; padding: 6px 10px; }
    .wr-info-t { font-size: 11px; }
    .wr-look { flex-wrap: wrap; gap: 8px; padding: 8px; }
    .wr-look-a { flex-direction: row; width: 100%; }
    .wr-look-a .wr-btn { flex: 1; }
    .wr-look-a .wr-btn.x { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .wd-spati svg { animation: none; }
    .wr-card { transition: none; }
    .wr-tab.has-new::after, .wr-card.new::after { animation: none; }
}
.spati-mascot.sm-halloween .sm-body, .pm-spati.sm-halloween .sm-body { fill: #ff8a1f; }
.spati-mascot.sm-aprilfools .sm-react svg, .pm-spati.sm-aprilfools svg { rotate: 180deg; }

.sm-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sm-p {
    position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; font-style: normal; opacity: 0;
    animation: smPart var(--dur, 1400ms) ease-out forwards; will-change: transform, opacity;
}
.sm-p svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.sm-p-heart { color: #ff6b9a; filter: drop-shadow(0 0 4px rgba(255, 107, 154, .7)); }
.sm-p-star  { color: #ffe66b; width: 11px; height: 11px; margin: -5px 0 0 -5px; filter: drop-shadow(0 0 4px rgba(255, 230, 107, .7)); }
.sm-p-zzz   { width: auto; height: auto; margin: 0; font-family: var(--font-ui); line-height: 1; color: var(--crt-color); text-shadow: 0 0 5px var(--crt-glow); }
@keyframes smPart {
    0%   { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0deg); }
    15%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -50px)) scale(1.15) rotate(var(--rot, 0deg)); }
}

.sm-react.a-tickle { animation: smTickle .48s ease-in-out; }
@keyframes smTickle {
    0%, 100% { transform: translate(0, 0) rotate(0) scale(1.04, .96); }
    25% { transform: translate(-4px, -3px) rotate(-7deg) scale(.96, 1.05); }
    50% { transform: translate(4px, 0) rotate(7deg) scale(1.05, .95); }
    75% { transform: translate(-3px, -4px) rotate(-5deg) scale(.98, 1.03); }
}

/* ---------- Гардероб Спати: живые скины ---------- */
@keyframes skRainbow {
    0% { fill: #ff5a5a; } 17% { fill: #ffb347; } 33% { fill: #ffe66b; } 50% { fill: #5aff8a; }
    67% { fill: #4fe3ff; } 83% { fill: #b57bff; } 100% { fill: #ff5a5a; }
}
@keyframes skLava    { from { fill: #ff3b1f; } to { fill: #ffb300; } }
@keyframes skToxic   { from { fill: #7dff2a; } to { fill: #1f9a00; } }
@keyframes skSunset  { 0% { fill: #ffb347; } 50% { fill: #ff4f8a; } 100% { fill: #7a4fd6; } }
@keyframes skChrome  { 0%, 100% { fill: #7d8591; } 50% { fill: #f4f6fa; } }
@keyframes skCandy   { 0%, 49% { fill: #ff7ab8; } 50%, 100% { fill: #ffffff; } }
@keyframes skNeon    { from { fill: #ffffff; } to { fill: color-mix(in srgb, #ffffff 55%, var(--crt-color)); } }
@keyframes skGlitch  {
    0%, 58%, 72%, 100% { fill: var(--crt-color); transform: translate(0, 0); }
    60% { fill: #ff2bd6; transform: translate(.3px, 0); }
    64% { fill: #00f0ff; transform: translate(-.3px, .1px); }
    68% { fill: var(--crt-color); transform: translate(.2px, -.1px); }
}
.sk-rainbow .sm-body { animation: skRainbow 5s linear infinite; }
.sk-lava    .sm-body { animation: skLava 1.4s ease-in-out infinite alternate; }
.sk-toxic   .sm-body { animation: skToxic 1.3s ease-in-out infinite alternate; }
.sk-sunset  .sm-body { animation: skSunset 3.5s ease-in-out infinite alternate; }
.sk-chrome  .sm-body { animation: skChrome 2.4s ease-in-out infinite; }
.sk-candy   .sm-body { animation: skCandy 1.2s steps(1) infinite; }
.sk-neon    .sm-body { animation: skNeon 1.6s ease-in-out infinite alternate; }
.sk-glitch  .sm-body { animation: skGlitch 2.4s steps(1) infinite; }
.sk-ghost   .sm-body { opacity: .45; }
@media (prefers-reduced-motion: reduce) {
    .sk-rainbow .sm-body, .sk-lava .sm-body, .sk-toxic .sm-body, .sk-sunset .sm-body,
    .sk-chrome .sm-body, .sk-candy .sm-body, .sk-neon .sm-body, .sk-glitch .sm-body { animation: none; }
}
/* ---------- Фото Спати ---------- */
.photo-window { width: 480px; }
.photo-window .card-body canvas {
    background: repeating-conic-gradient(var(--dim) 0 25%, transparent 0 50%) 0 0 / 20px 20px;
}
.photo-flash {
    position: absolute; inset: 0; z-index: 28; background: #fff; pointer-events: none;
    animation: photoFlash .55s ease-out forwards;
}
@keyframes photoFlash { 0% { opacity: .95; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .photo-flash { animation-duration: .01s; } }
/* ---------- Фотостудия: меню выбора ---------- */
.photo-window { width: 520px; max-width: calc(100% - 16px); }
.photo-window .ph-stage { position: sticky; top: -12px; z-index: 2; padding-bottom: 8px; background: var(--crt-bg); }
.photo-window .ph-stage canvas { width: min(100%, 300px); margin: 0 auto; }
.photo-window.shot .ph-stage canvas { width: 100%; }
.photo-window .ph-stage { position: relative; top: 0; }
.ph-grp { margin-top: 10px; }
.ph-grp-title { font-size: 10px; letter-spacing: 2px; opacity: .7; margin-bottom: 5px; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-window .ph-chips .player-btn { flex: 0 0 auto; padding: 7px 9px; font-size: 9px; min-width: 0; }
.photo-window .player-btn.active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.photo-window .ph-shot-actions { display: none; }
.photo-window.shot .ph-shot-actions { display: flex; }
.photo-window.shot .ph-opts, .photo-window.shot .ph-studio-actions { display: none; }
/* ---- прогресс-бар у счётных достижений ---- */
.ach-prog { height: 4px; margin-top: 6px; border: 1px solid var(--dim2); background: transparent; }
.ach-prog i { display: block; height: 100%; background: var(--rar, var(--crt-color)); box-shadow: 0 0 6px var(--rar, var(--crt-color)); }
.ach-prog-label { font-size: 10px; opacity: .65; margin-top: 2px; }
.ach-card.locked .ach-prog-label { opacity: .8; }
.adm-window input[type="search"] { appearance: none; }

/* ---------- Игры: общие окна ---------- */
.game-window { width: 372px; }
.games-window { width: 460px; }
.game-body, .gm-body { padding: 12px; overflow-y: auto; min-height: 0; flex: 1; }
.game-body::-webkit-scrollbar, .gm-body::-webkit-scrollbar { width: 4px; }
.game-body::-webkit-scrollbar-thumb, .gm-body::-webkit-scrollbar-thumb { background: var(--crt-color); }
.gm-top-row { display: grid; grid-template-columns: 22px 66px 1fr auto; gap: 6px; line-height: 1.7; font-size: 11px; opacity: .85; padding: 0 2px; }
.gm-top-row span:nth-child(2) { font-weight: 600; }
.gm-top-row span:last-child { font-size: 9px; opacity: .65; align-self: center; }
.gm-top-row.new { opacity: 1; background: var(--dim); text-shadow: 0 0 8px var(--crt-glow); }

/* ---------- Тетрис ---------- */
.tt-wrap { display: flex; gap: 10px; justify-content: center; align-items: flex-start; }
#ttCanvas {
    display: block; height: min(44dvh, 400px); aspect-ratio: 1 / 2; width: auto; cursor: pointer;
    border: 1px solid var(--crt-color); background: color-mix(in srgb, var(--crt-bg) 70%, #000);
    box-shadow: inset 0 0 20px rgba(0,0,0,.6), 0 0 12px var(--dim2); touch-action: none; image-rendering: pixelated;
}
.tt-side { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tt-lab { font-family: var(--font-ui); font-size: 8px; opacity: .8; }
#ttNext { display: block; width: 72px; height: 72px; border: 1px solid var(--dim2); background: var(--dim); image-rendering: pixelated; }
.tt-pad { display: none; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.tt-pad .player-btn { flex: none; font-size: 12px; padding: 12px 0; touch-action: manipulation; }
.tt-pad [data-a="drop"] { grid-column: span 2; }
@media (pointer: coarse), (max-width: 650px) { .tt-pad { display: grid; } }

/* ---------- Слово ---------- */
.wd-grid { display: grid; gap: 5px; width: min(100%, 250px); margin: 0 auto 10px; }
.wd-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.wd-row.shake { animation: wdShake .3s; }
@keyframes wdShake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.wd-tile {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 1px solid var(--dim2);
    font-family: var(--font-ui); font-size: 15px; text-transform: uppercase;
}
.wd-tile.fill { border-color: var(--crt-color); }
.wd-tile.ok, .wd-key.ok { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; border-color: var(--crt-color); }
.wd-tile.has, .wd-key.has { border-color: var(--crt-color); background: repeating-linear-gradient(45deg, var(--dim2) 0 4px, transparent 4px 8px); }
.wd-tile.no, .wd-key.no { opacity: .3; border-color: var(--dim2); }
.wd-tile.ok, .wd-tile.has, .wd-tile.no { animation: wdFlip .35s ease-out; }
@keyframes wdFlip { from { transform: scaleY(.1); } to { transform: none; } }
.wd-kb { display: flex; flex-direction: column; gap: 4px; }
.wd-kbrow { display: flex; gap: 3px; justify-content: center; }
.wd-key {
    flex: 1; min-width: 0; padding: 10px 0; background: transparent; border: 1px solid var(--dim2); color: var(--crt-color);
    font-family: var(--font-text); font-weight: 600; font-size: 12px; text-transform: uppercase; cursor: pointer; touch-action: manipulation;
}
.wd-key:hover { background: var(--dim); }
.wd-key.wide { flex: 1.7; font-family: var(--font-ui); font-size: 8px; }
.wd-dist-row { display: grid; grid-template-columns: 14px 1fr 26px; gap: 6px; align-items: center; font-size: 10px; line-height: 1.5; }
.wd-dist-row b { display: block; height: 8px; border: 1px solid var(--dim2); }
.wd-dist-row i { display: block; height: 100%; background: var(--crt-color); }
.wd-dist-row em { font-style: normal; text-align: right; }

/* ---------- Вкладка «Игры» ---------- */
.gm-rank { padding: 12px; background: var(--dim); border: 1px solid var(--dim2); }
.gm-pts { font-size: 11px; opacity: .8; margin: 4px 0 8px; }
.gm-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--dim2); background: var(--dim); }
.gm-info { flex: 1; min-width: 0; }
.gm-name { font-family: var(--font-ui); font-size: 10px; margin-bottom: 6px; text-shadow: 0 0 8px var(--crt-glow); }
.gm-stat { font-size: 11px; font-weight: 600; }
.gm-stat.dim { opacity: .6; font-weight: 400; margin-top: 2px; }
.gm-card .player-btn { flex: 0 0 92px; }
.gm-table { border: 1px solid var(--dim2); padding: 6px 8px; }
.gm-tr { display: grid; grid-template-columns: 1.2fr 1fr .8fr .8fr; gap: 6px; padding: 5px 2px; border-bottom: 1px dotted var(--dim2); font-size: 12px; font-weight: 600; }
.gm-th { opacity: .7; font-family: var(--font-ui); font-size: 8px; font-weight: 400; }
.gm-sum { border-top: 1px solid var(--crt-color); border-bottom: 0; }
.gm-note { margin-top: 12px; font-size: 10px; opacity: .55; line-height: 1.5; }

/* ---------- BIOS / POST ---------- */
.post-screen {
    position: absolute; inset: 0; z-index: 5; padding: clamp(14px, 4vw, 40px); overflow: hidden;
    background: var(--crt-bg); color: var(--crt-color); text-shadow: 0 0 5px var(--crt-glow);
    font: 600 clamp(11px, 1.6vw, 14px) / 1.7 var(--font-text);
}
.post-hd { font-family: var(--font-ui); font-size: clamp(9px, 1.7vw, 13px); margin-bottom: 6px; }
.post-sub { opacity: .6; margin-bottom: 16px; }
.post-line { display: flex; justify-content: space-between; gap: 14px; max-width: 560px; white-space: pre; }
.post-st { flex: none; }
.post-line.err, .post-st.err { color: #ff5a5a; text-shadow: 0 0 8px rgba(255, 60, 60, .7); }
.post-skip { position: absolute; right: 18px; bottom: 14px; font-size: 11px; opacity: .55; animation: cursorBlink 1.2s infinite; }
.post-screen.text-crash .post-line.err { color: #ff5a5a !important; }

/* =====================================================================
   МЕНЮ ДОСТИЖЕНИЙ v2
   ===================================================================== */
#achWindow { width: 680px; }
#achWindow .ach-body { padding: 0; scroll-behavior: auto; }

.am-tabs { position: sticky; top: 0; z-index: 4; display: flex; background: color-mix(in srgb, var(--crt-bg) 96%, #000); border-bottom: 1px solid var(--crt-color); }
.am-tab {
    flex: 1 1 0; min-width: 0; padding: 13px 4px; font-family: var(--font-ui); font-size: 9px; letter-spacing: 1px;
    color: var(--crt-color); background: transparent; border: 0; border-right: 1px solid var(--dim2); cursor: pointer;
}
.am-tab:last-child { border-right: 0; }
.am-tab:hover, .am-tab:focus-visible { background: var(--dim); outline: none; }
.am-tab.active { background: var(--crt-color); color: var(--crt-bg); text-shadow: none; }
.am-content { padding: 14px; }
.am-h { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--dim2); }
.am-empty { opacity: .6; padding: 8px 0; }

/* герой */
.am-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 14px; align-items: center; padding: 14px; background: var(--dim); border: 1px solid var(--dim2); border-left: 3px solid var(--crt-color); }
.am-nick { font-family: var(--font-ui); font-size: 10px; margin-bottom: 8px; word-break: break-all; text-shadow: 0 0 8px var(--crt-glow); }
.am-kicker { font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; opacity: .7; margin-bottom: 8px; }
.am-rank { font-family: var(--font-ui); font-size: 12px; line-height: 1.5; text-shadow: 0 0 8px var(--crt-glow); }
.am-hero-num { text-align: right; }
.am-hero-num b { display: block; font-family: var(--font-ui); font-size: 24px; text-shadow: 0 0 10px var(--crt-glow); }
.am-hero-num span { display: block; margin-top: 8px; font-weight: 600; opacity: .75; }
.am-rankbar { grid-column: 1 / -1; position: relative; }
.am-rankbar .am-meter { height: 14px; }
.am-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--dim2); pointer-events: none; }
.am-tick.on { background: var(--crt-color); }
.am-next { grid-column: 1 / -1; font-size: 12px; opacity: .8; }

/* шкала */
.am-meter { height: 10px; border: 1px solid var(--rar, var(--crt-color)); background: var(--dim); }
.am-meter i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--rar, var(--crt-color)) 0 6px, transparent 6px 8px); box-shadow: 0 0 8px var(--rar, var(--crt-glow)); }
.am-meter.thin { height: 5px; margin-top: 7px; }

/* цели */
.am-goals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.am-goal { display: flex; align-items: center; gap: 10px; padding: 9px; text-align: left; font: inherit; color: var(--crt-color); background: var(--panel); border: 1px solid var(--dim2); border-left: 3px solid var(--rar, var(--crt-color)); cursor: pointer; min-width: 0; }
.am-goal:hover, .am-goal:focus-visible { background: var(--dim); outline: none; }
.am-goal-text { flex: 1; min-width: 0; }
.am-goal-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13px; }
.am-goal-title { overflow-wrap: anywhere; }
.am-goal-val { flex: none; font-variant-numeric: tabular-nums; opacity: .8; }
.am-goal-left { margin-top: 5px; font-size: 12px; opacity: .75; line-height: 1.35; }

/* плитки */
.am-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.am-tiles-rar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.am-tile { display: block; width: 100%; min-width: 0; padding: 10px; text-align: left; font: inherit; color: var(--crt-color); background: var(--panel); border: 1px solid var(--rar, var(--dim2)); cursor: pointer; }
.am-tile:hover, .am-tile:focus-visible { background: var(--dim); border-color: var(--rar, var(--crt-color)); outline: none; }
.am-tile.full { border-color: var(--rar, var(--crt-color)); box-shadow: inset 0 0 14px color-mix(in srgb, var(--rar, var(--crt-color)) 22%, transparent); }
.am-tile-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin-bottom: 9px; font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; color: var(--rar, var(--crt-color)); }
.am-tile.secret { border-style: dashed; }

/* последние */
.am-recent { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.am-recent-item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.am-recent-text { min-width: 0; }
.am-recent-title { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.am-recent-date { font-size: 11px; opacity: .55; margin-top: 2px; }
.am-open-all { display: block; width: 100%; margin-top: 20px; padding: 13px 6px; font-size: 10px; }
.am-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.am-actions .player-btn { flex: 1 1 auto; padding: 9px 12px; }

/* коллекция */
.am-search { display: block; width: 100%; margin-bottom: 12px; padding: 11px 12px; font: inherit; font-size: 14px; color: var(--crt-color); background: var(--dim); border: 1px solid var(--crt-color); border-radius: 0; outline: none; -webkit-appearance: none; appearance: none; }
.am-search::placeholder { color: var(--crt-color); opacity: .4; }
.am-search:focus { box-shadow: 0 0 10px var(--crt-glow); }
.am-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.am-row-label { flex: 0 0 82px; padding-top: 9px; font-family: var(--font-ui); font-size: 7px; letter-spacing: 1px; opacity: .65; }
.am-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.am-chip { flex: 0 0 auto; padding: 8px 10px; font-family: var(--font-ui); font-size: 8px; letter-spacing: .5px; color: var(--rar, var(--crt-color)); background: transparent; border: 1px solid var(--rar, var(--dim2)); cursor: pointer; }
.am-chip:hover, .am-chip:focus-visible { background: var(--dim); outline: none; }
.am-chip.active { background: var(--rar, var(--crt-color)); color: var(--crt-bg); border-color: var(--rar, var(--crt-color)); text-shadow: none; }
.am-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 0; font-family: var(--font-ui); font-size: 8px; letter-spacing: 1px; opacity: .8; }
.am-reset { padding: 7px 10px; font-family: var(--font-ui); font-size: 8px; color: var(--crt-color); background: transparent; border: 1px solid var(--crt-color); cursor: pointer; }
.am-reset:hover, .am-reset:focus-visible { background: var(--crt-color); color: var(--crt-bg); outline: none; text-shadow: none; }
.am-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }

.am-card { position: relative; min-width: 0; background: var(--panel); border: 1px solid var(--dim2); border-left: 3px solid var(--dim2); cursor: pointer; }
.am-card:hover, .am-card:focus-visible { background: var(--dim); outline: none; }
.am-card.done { border-color: var(--rar, var(--crt-color)); box-shadow: inset 0 0 14px color-mix(in srgb, var(--rar, var(--crt-color)) 16%, transparent); }
.am-card.done::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; background: var(--rar, var(--crt-color)); box-shadow: 0 0 6px var(--rar, var(--crt-color)); }
.am-card.done.r-legendary { box-shadow: inset 0 0 18px rgba(255,182,39,.28), 0 0 12px rgba(255,182,39,.35); }
.am-card.locked .am-card-main { opacity: .62; }
.am-card.locked .ach-icon-box { box-shadow: none; border-color: var(--dim2); background: transparent; }
.am-card.open { background: var(--dim); }
.am-card.open .am-card-main { opacity: 1; }
.am-card-main { display: flex; align-items: flex-start; gap: 10px; padding: 9px; }
.am-card-text { flex: 1; min-width: 0; }
.am-card-title { font-weight: 600; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; padding-right: 10px; }
.am-card-desc { margin-top: 2px; font-size: 12px; line-height: 1.35; opacity: .75; }
.am-card-prog { margin-top: 3px; font-size: 10px; opacity: .7; font-variant-numeric: tabular-nums; }
.am-card-rar { margin-top: 6px; font-family: var(--font-ui); font-size: 7px; letter-spacing: 1px; color: var(--rar, var(--crt-color)); }
.am-card-detail { display: none; padding: 8px 9px 9px; border-top: 1px dashed var(--dim2); }
.am-card.open .am-card-detail { display: block; }
.am-d { font-size: 12px; line-height: 1.4; }
.am-d + .am-d { margin-top: 4px; }
.am-d.dim { opacity: .55; font-size: 11px; }
.am-d.hint { color: var(--crt-color); }

@media (prefers-reduced-motion: no-preference) {
    .am-meter i { transition: width .35s ease-out; }
}

/* гардероб закрыт, пока Спати выключен */
.wardrobe-btn.locked { opacity: .4; border-style: dashed; }