/* ============ БАЗА ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: #000;
  font-family: 'Courier New', Consolas, monospace;
  color: #cfd6cf;
  user-select: none;
  cursor: default;
}
.hidden { display: none !important; }
input, textarea { user-select: text; }

/* ============ СТИЛИЗОВАННЫЙ ЛИСТАТЕЛЬ (вместо системного) ============ */
:root { color-scheme: dark; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a120c; }
::-webkit-scrollbar-thumb {
  background: #2e4934;
  border: 1px solid #3c5a43;
}
::-webkit-scrollbar-thumb:hover { background: #4d7355; }
::-webkit-scrollbar-thumb:active { background: #6fae6f; }
::-webkit-scrollbar-corner { background: transparent; }
* {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #2e4934 #0a120c;
}

.btn {
  font-family: inherit;
  background: #111;
  border: 1px solid #3f5a3f;
  color: #9fdc9f;
  padding: 10px 22px;
  font-size: 15px;
  letter-spacing: 2px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: #1c2b1c; border-color: #6fae6f; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* ============ ЗАГРУЗКА / МЕНЮ ============ */
#boot {
  position: fixed; inset: 0; z-index: 1000;
  background: #000; color: #9fdc9f;
  padding: 40px 50px;
  display: flex; flex-direction: column;
}
#bios { white-space: pre-wrap; font-size: 14px; line-height: 1.55; flex: 1; overflow: hidden; }
#bios .warn { color: #d64848; }

#boot-menu { text-align: center; padding-bottom: 4vh; }
.boot-title { font-size: clamp(20px, 4vw, 42px); letter-spacing: 8px; color: #cfe8cf; text-shadow: 0 0 12px rgba(120,255,140,.25); margin-bottom: 10px; }
.boot-sub { font-size: 13px; color: #6a7f6a; margin-bottom: 34px; }
.diff-row { display: flex; gap: 12px; justify-content: center; margin-bottom: 26px; }
.btn.diff.selected { background: #24402a; border-color: #8fe08f; color: #d5ffd5; box-shadow: 0 0 14px rgba(90,220,110,.25); }
#enter-btn.big { font-size: 19px; padding: 16px 46px; letter-spacing: 5px; }
.boot-hint { margin-top: 30px; font-size: 12px; line-height: 2; color: #5c6e5c; }
.boot-footer { margin-top: 26px; font-size: 11px; color: #3b473b; letter-spacing: 2px; }

/* ============ РАБОЧИЙ СТОЛ ============ */
#screen { position: fixed; inset: 0; }
#desktop {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, #101a14 0%, #060a07 70%, #020302 100%);
}
#icons {
  position: absolute; top: 18px; left: 18px;
  display: flex; flex-direction: column; gap: 6px; z-index: 5;
}
.dicon {
  width: 96px; padding: 10px 4px; text-align: center;
  border: 1px solid transparent; cursor: pointer;
  font-size: 12px; color: #b9c9b9; line-height: 1.3;
}
.dicon:hover { border-color: #33513a; background: rgba(40,70,45,.25); }
.dicon .glyph { display: block; font-size: 30px; margin-bottom: 6px; filter: grayscale(.3); }
.dicon .badge {
  position: relative; top: -1px; left: 2px;
  display: inline-block; min-width: 16px; height: 16px; border-radius: 8px;
  background: #c33; color: #fff; font-size: 11px; line-height: 16px;
}

/* ============ ОКНА ============ */
.window {
  position: absolute; min-width: 300px;
  background: #0b120d;
  border: 1px solid #37503c;
  box-shadow: 0 14px 40px rgba(0,0,0,.65), 0 0 0 1px rgba(80,140,90,.08);
  display: flex; flex-direction: column;
}
.window.focused { border-color: #5d8a63; box-shadow: 0 18px 50px rgba(0,0,0,.75), 0 0 18px rgba(80,180,100,.10); }
.titlebar {
  display: flex; align-items: center;
  background: linear-gradient(#18251b, #101a12);
  border-bottom: 1px solid #2c4431;
  padding: 5px 8px; cursor: move; font-size: 12.5px; letter-spacing: 1px; color: #a9c4a9;
}
.titlebar .t-title { flex: 1; pointer-events: none; }
.win-btn {
  width: 20px; height: 18px; margin-left: 5px;
  background: #142016;
  border: 1px solid #3c5a43; color: #9fc79f;
  font-family: inherit; font-size: 11px; line-height: 1; cursor: pointer;
}
.win-btn:hover { background: #27422c; }
.win-body { padding: 10px; overflow: auto; font-size: 13px; line-height: 1.5; flex: 1; }

/* ============ ПАНЕЛЬ ЗАДАЧ ============ */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34px; z-index: 400;
  background: linear-gradient(#131f15, #0a120c);
  border-top: 1px solid #2e4934;
  display: flex; align-items: center; padding: 0 10px; gap: 10px;
  font-size: 12px;
}
#tb-label { color: #77a87c; letter-spacing: 1px; font-weight: bold; }
#tb-windows { flex: 1; display: flex; gap: 6px; overflow: hidden; }
.tb-win {
  max-width: 160px; padding: 3px 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  border: 1px solid #31503a; background: #0e1810; color: #93b893; cursor: pointer;
}
.tb-win.active { background: #1d3322; color: #cfeed0; }
.tb-win.minimized { opacity: .55; font-style: italic; }
#tb-right { display: flex; align-items: center; gap: 14px; }
#clock { color: #b9d8bc; letter-spacing: 2px; font-size: 13px; }
#wifi-icon { letter-spacing: 1px; }
#wifi-ok { color: #7fd88a; } #wifi-warn { color: #d8c05a; } #wifi-bad { color: #d85a5a; }
#webcam-led {
  color: #ff5548; animation: pulse 1s infinite; letter-spacing: 1px;
  border: 1px solid #6e2320; padding: 1px 6px; background: #200a09;
}
@keyframes pulse { 50% { opacity: .35; } }

/* ============ УВЕДОМЛЕНИЯ / АЛАРМЫ ============ */
#toasts { position: absolute; right: 14px; bottom: 48px; z-index: 450; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: rgba(10,18,11,.94); border: 1px solid #3c5a43; border-left: 3px solid #7fd88a;
  padding: 8px 14px; font-size: 12.5px; max-width: 320px; color: #b7d4b7;
  animation: toast-in .25s ease-out;
}
.toast.bad { border-left-color: #d84848; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } }

#alert-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: #2a0708; color: #ff6b5e; border: 1px solid #8c2018;
  padding: 10px 34px; font-size: 17px; letter-spacing: 4px;
  animation: banner-blink .5s steps(2) infinite;
  box-shadow: 0 0 30px rgba(200,40,30,.35);
}
@keyframes banner-blink { 50% { opacity: .55; } }

#rec-overlay {
  position: absolute; top: 14px; right: 18px; z-index: 300;
  color: #ff5548; font-size: 14px; letter-spacing: 2px; animation: pulse 1.2s infinite;
}
.rec-dot { animation: pulse 1.2s infinite; }

#ghost-cursor { position: fixed; z-index: 950; pointer-events: none; transition: all .45s cubic-bezier(.4,0,.6,1); filter: drop-shadow(0 0 3px rgba(255,255,255,.4)); }

/* ============ БЛЭКАУТ (весь эффект внутри монитора) ============ */
#blackout {
  position: absolute; inset: 0; z-index: 850; pointer-events: none;
  background: radial-gradient(
    circle 190px at var(--mx, 50%) var(--my, 50%),
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 55px,
    rgba(0,0,0,.55) 110px, rgba(0,0,0,.94) 170px, rgba(0,0,0,.985) 100%
  );
  transition: opacity .3s;
}
body.blackout .toast {
  border-color: #7fd88a; color: #d9f2d9;
  box-shadow: 0 0 14px rgba(127,216,138,.55);
}
/* в круге фонарика интерфейс должен быть реально виден */
body.blackout #desktop { filter: brightness(2.2) contrast(1.06); }

/* ============ СТРЕСС: дрожь экрана ============ */
body.panic-1 #screen { animation: sway1 3.4s ease-in-out infinite; }
body.panic-2 #screen { animation: sway2 2.3s ease-in-out infinite; }
body.panic-3 #screen { animation: sway3 1.6s ease-in-out infinite; }
@keyframes sway1 { 0%,100%{transform:translate(0,0)} 25%{transform:translate(.6px,-.4px)} 75%{transform:translate(-.5px,.5px)} }
@keyframes sway2 { 0%,100%{transform:translate(0,0)} 20%{transform:translate(1.2px,-.8px)} 60%{transform:translate(-1.1px,1px)} 80%{transform:translate(.7px,.9px)} }
@keyframes sway3 { 0%,100%{transform:translate(0,0)} 15%{transform:translate(2px,-1.4px)} 45%{transform:translate(-1.8px,1.6px)} 70%{transform:translate(1.4px,1.2px)} 90%{transform:translate(-1px,-1.6px)} }

.mg-code-display.distort { animation: code-distort .32s steps(2) infinite; }
@keyframes code-distort {
  0% { filter: blur(.4px); transform: skewX(.7deg); }
  100% { filter: blur(.1px) contrast(1.25); transform: skewX(-.5deg); }
}
.mg-code-input-row .btn.jitter { animation: btn-jitter .26s steps(2) infinite; }
@keyframes btn-jitter { 0%{transform:translate(-3px,1px)} 100%{transform:translate(3px,-1px)} }

.mg-fake-btn { border-color: #8c2018; color: #ff8f7e; }

/* ============ КАЛИБРОВКА ШЛЮЗА ============ */
.cal-wrap { display: flex; justify-content: center; gap: 26px; padding: 10px 0; }
.cal-track { position: relative; width: 46px; height: 160px; background: #060a07; border: 1px solid #33513a; cursor: pointer; touch-action: none; user-select: none; }
.cal-track:hover { border-color: #5d8a63; }
.cal-track.held { border-color: #7fd88a; box-shadow: 0 0 10px rgba(127,216,138,.35); }
.cal-label { position: absolute; left: 0; right: 0; bottom: -18px; font-size: 10px; color: #5c7a5c; text-align: center; pointer-events: none; }
.cal-zone { position: absolute; left: 4px; right: 4px; height: 18%; background: rgba(90,190,110,.22); border-top: 1px solid #6fae6f; border-bottom: 1px solid #6fae6f; }
.cal-needle { position: absolute; left: 2px; right: 2px; height: 5px; background: #d85a5a; box-shadow: 0 0 6px rgba(216,90,90,.7); }
.cal-needle.ok { background: #7fd88a; box-shadow: 0 0 8px rgba(127,216,138,.9); }
.cal-wrap.all-ok .cal-track { border-color: #6fae6f; }
.cal-progress { height: 8px; background: #10241a; border: 1px solid #33513a; }
.cal-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg,#2e7a44,#7fd88a); transition: width .1s linear; }
.cal-hint { font-size: 11.5px; color: #6d846d; text-align: center; margin-top: 8px; }

/* ============ АНТИВИРУСНЫЙ ЛАБИРИНТ ============ */
.maze-grid { display: grid; grid-template-columns: repeat(5, 52px); gap: 5px; justify-content: center; margin-top: 6px; }
.maze-cell { height: 52px; background: #131f15; border: 1px solid #31503a; cursor: pointer; transition: background .12s; }
.maze-cell:hover { background: #1d3322; }
.maze-cell.green { background: #1f4a2b; border-color: #7fd88a; box-shadow: inset 0 0 10px rgba(127,216,138,.4); }
.maze-cell.boom { background: #4a1410; border-color: #d85a5a; animation: shake-mini .3s; }
@keyframes shake-mini { 25%{transform:translate(3px,-2px)} 75%{transform:translate(-3px,2px)} }
.maze-status { text-align: center; margin-top: 10px; color: #93b893; font-size: 13px; min-height: 20px; }

/* ============ ОЧИСТКА КЭША (падающие символы) ============ */
.fall-area {
  position: relative; height: 240px; overflow: hidden;
  background: #030704; border: 1px solid #1e3324;
}
.fall-area.leak { border-color: #8c2018; }
.fall-floor { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #571812; }
.fall-char {
  position: absolute; top: 0; color: #ffd76e; font-size: 19px; font-family: inherit;
  text-shadow: 0 0 8px rgba(255,215,110,.55); user-select: none;
}
.fall-char.hit { color: #7fd88a; opacity: 0; transition: opacity .15s, transform .15s; transform: scale(1.8); }
.fall-stats { margin-top: 8px; text-align: center; color: #93b893; font-size: 13px; }

/* ============ CAM-QTE ============ */
.qte-overlay {
  position: fixed; inset: 0; z-index: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: rgba(20,0,0,.45);
}
.qte-title { color: #ff6b5e; font-size: clamp(22px, 4vw, 40px); letter-spacing: 6px; animation: pulse .5s infinite; }
.qte-combo {
  color: #ffd76e; font-size: clamp(26px, 5vw, 52px); letter-spacing: 8px;
  text-shadow: 0 0 22px rgba(255,215,110,.6);
}
.qte-sub { color: #cfcfcf; font-size: 15px; }
.qte-bar { width: min(420px, 70vw); height: 14px; background: #230b0a; border: 1px solid #571812; }
.qte-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#c93a2e,#ffd76e); }
.qte-timer { color: #b08a8a; font-size: 13px; letter-spacing: 2px; }

/* ============ КРИПТОГРАФИЧЕСКИЙ ДАМП (Fallout) ============ */
.fo-attempts { color: #d8c05a; letter-spacing: 2px; margin-bottom: 6px; }
.fo-log { max-height: 84px; overflow-y: auto; color: #86d68e; font-size: 12.5px; margin-bottom: 8px; }
.fo-log div { margin-bottom: 2px; }
.fo-matrix {
  font-family: 'Courier New', monospace; font-size: 11.5px; line-height: 1.35;
  color: #6fbf77; background: #010603; border: 1px solid #1e3324;
  padding: 8px; white-space: pre; overflow: hidden; letter-spacing: 1px;
}
/* слова в дампе НЕ выделяются — их ищут глазами среди мусора */
.fo-word { color: inherit; cursor: default; }

/* ============ АТМОСФЕРА: дред, туннель, срыв кадра ============ */
#vignette { transition: box-shadow 2.5s; }
body.tunnel #vignette { box-shadow: inset 0 0 220px 90px rgba(0,0,0,.9); }
body.dread .t-title { animation: t-jitter .14s steps(2) infinite; }
@keyframes t-jitter {
  0% { transform: translate(0, 0); }
  50% { transform: translate(.4px, -.3px); }
  100% { transform: translate(-.3px, .3px); }
}
body.roll #crt { animation: crt-roll .5s steps(4); }
@keyframes crt-roll {
  0% { transform: translateY(-10px); }
  40% { transform: translateY(7px); }
  70% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}
.msg.typing { opacity: .75; font-style: italic; }
.msg.typing .dots { display: inline-block; animation: dots-pulse 1s infinite; margin-left: 3px; }
@keyframes dots-pulse { 50% { opacity: .15; } }

/* ============ CRT / ГЛИТЧИ ============ */
#crt {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(255,255,255,.028) 0px, rgba(255,255,255,.028) 1px,
    transparent 2px, transparent 4px);
  animation: crt-flicker 4s infinite;
}
#vignette {
  position: fixed; inset: 0; z-index: 901; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0,0,0,.55) 100%);
}
@keyframes crt-flicker { 0%,100% {opacity:.85} 31% {opacity:.92} 32% {opacity:.78} 64% {opacity:.9} 67% {opacity:.82} }

body.glitch #screen { animation: glitch-jump .38s steps(2) infinite; }
body.glitch #screen { filter: hue-rotate(12deg) contrast(1.15); }
@keyframes glitch-jump {
  0% { transform: translate(2px,-2px) skewX(.4deg); }
  25% { transform: translate(-3px,1px); }
  50% { transform: translate(1px,2px) skewX(-.6deg); }
  75% { transform: translate(-2px,-1px); }
  100% { transform: translate(2px,1px); }
}
body.hard-glitch #screen { animation: hard-glitch .12s steps(2) infinite; filter: invert(.85) hue-rotate(160deg); }
@keyframes hard-glitch { 0% { transform: translate(6px,-4px);} 100% { transform: translate(-6px,4px);} }

/* ============ ПРИЛОЖЕНИЯ ============ */
/* --- браузер --- */
.browser-bar { display: flex; gap: 6px; margin-bottom: 10px; }
.url-input {
  flex: 1; background: #050a06; border: 1px solid #33513a; color: #9fdc9f;
  font-family: inherit; font-size: 13px; padding: 6px 10px;
}
.site-home { padding: 8px 2px; }
.site-home h3 { color: #9fdc9f; margin: 4px 0 10px; letter-spacing: 1px; }
.bm-row { display: block; width: 100%; text-align: left; margin-bottom: 8px; }
.site-page h2 { color: #cfe8cf; font-size: 17px; margin-bottom: 4px; }
.site-page .site-url { color: #5c7a5c; font-size: 11px; margin-bottom: 12px; }
.site-page p, .site-page li { margin-bottom: 10px; color: #b2c6b2; }
.site-page .redact { background: #233; color: transparent; padding: 0 3px; }
.site-page.deep { color: #c98f8f; }
.back-link { margin-top: 6px; }

/* --- мессенджер --- */
.chat-log { height: 260px; overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 7px 11px; font-size: 13px; line-height: 1.45; border-radius: 8px; }
.msg .who { display: block; font-size: 10.5px; letter-spacing: 1px; margin-bottom: 3px; opacity: .75; }
.msg.them { background: #15241a; border: 1px solid #2c4a33; align-self: flex-start; }
.msg.me { background: #1a2130; border: 1px solid #33456a; align-self: flex-end; }
.msg.sys { background: transparent; border: none; color: #6d846d; font-style: italic; align-self: center; font-size: 12px; }
.msg.them.unknown { border-color: #6e2320; background: #1d0d0c; }
.msg.them.unknown .who { color: #e06055; }
.chat-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-choices .btn { font-size: 12px; padding: 6px 12px; }

/* --- файлы --- */
.filelist { width: 100%; border-collapse: collapse; }
.filelist td { padding: 5px 8px; border-bottom: 1px solid #17281b; font-size: 13px; cursor: pointer; }
.filelist tr:hover td { background: #14241a; }
.corrupt { color: #b05252; text-decoration: line-through wavy rgba(176,82,82,.6); }
.photo-canvas { image-rendering: pixelated; border: 1px solid #33513a; display: block; }

/* --- терминал --- */
.term { background: #030704; height: 280px; overflow-y: auto; padding: 8px; font-size: 13px; color: #86d68e; line-height: 1.5; }
.term .cmd-echo { color: #cfe8cf; }
.term .err { color: #e06055; }
.term .info { color: #d8c05a; }
.term-input-row { display: flex; gap: 6px; margin-top: 6px; }
.term-input-row span { color: #7fd88a; }
.term-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #b9ecbd; font-family: inherit; font-size: 13px;
}

/* --- просмотр файла --- */
.doc-view { white-space: pre-wrap; font-size: 13px; color: #b2c6b2; }

/* ============ МИНИ-ИГРЫ ============ */
.mg-modal {
  position: fixed; z-index: 600; left: 50%; top: 46%; transform: translate(-50%,-50%);
  width: min(720px, 92vw);
  background: rgba(8,4,4,.97); border: 1px solid #8c2018;
  box-shadow: 0 0 60px rgba(180,30,20,.35), 0 20px 60px rgba(0,0,0,.8);
  padding: 18px 22px;
}
.mg-title { color: #ff6b5e; font-size: 16px; letter-spacing: 3px; margin-bottom: 4px; }
.mg-sub { color: #b08a8a; font-size: 12.5px; margin-bottom: 12px; }
.mg-timerbar-wrap { height: 6px; background: #230b0a; margin-bottom: 12px; border: 1px solid #571812; }
.mg-timerbar { height: 100%; background: linear-gradient(90deg,#c93a2e,#ff7a5e); width: 100%; }
.mg-garbage {
  font-size: 12.5px; line-height: 1.7; letter-spacing: .5px;
  max-height: 300px; overflow: hidden; color: #7d8f7d;
  background: #060a07; border: 1px solid #1e3324; padding: 8px;
}
.mg-garbage div { white-space: nowrap; }
.mg-target-chunk {
  color: #ffe9a8; background: #4a3a08; outline: 1px solid #ffd76e;
  padding: 1px 3px; cursor: pointer;
  animation: target-pulse .9s ease-in-out infinite;
}
.mg-target-chunk:hover { background: #6b540c; }
@keyframes target-pulse {
  0%, 100% { box-shadow: 0 0 2px rgba(255,215,110,.25); filter: brightness(1); }
  50% { box-shadow: 0 0 16px rgba(255,215,110,.9); filter: brightness(1.4); }
}
.mg-code-display {
  text-align: center; font-size: 42px; letter-spacing: 10px; color: #ffd76e;
  text-shadow: 0 0 16px rgba(255,215,110,.4); margin: 18px 0 22px;
}
.mg-code-input-row { display: flex; justify-content: center; gap: 10px; }
.code-input {
  background: #0a0606; border: 1px solid #571812; color: #ffe9a8;
  font-family: inherit; font-size: 22px; letter-spacing: 6px; text-align: center;
  padding: 8px 14px; width: 280px; text-transform: uppercase; outline: none;
}
.shake { animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translate(-50%,-50%)} 25%{transform:translate(calc(-50% - 8px),-50%)} 75%{transform:translate(calc(-50% + 8px),-50%)} }
.mg-result { text-align:center; margin-top: 14px; font-size: 14px; letter-spacing: 2px; }

/* ============ ФИНАЛЫ ============ */
#ending {
  position: fixed; inset: 0; z-index: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px; gap: 18px;
}
#ending.win { background: radial-gradient(ellipse at 50% 80%, #2a3620 0%, #0a0f08 70%); color: #cfe8cf; }
#ending.lose { background: #000; color: #d8d8d8; }
#ending.trace { background: radial-gradient(ellipse at 50% 30%, #10202c 0%, #04080c 70%); color: #bcd6e8; }
.end-big { font-size: clamp(26px, 5vw, 54px); letter-spacing: 10px; }
.end-line { font-size: 15px; color: inherit; opacity: .85; max-width: 640px; line-height: 1.7; }
.end-stats { font-size: 13px; opacity: .6; line-height: 1.9; letter-spacing: 1px; }
#endcam { position: fixed; inset: 0; z-index: 799; width: 100%; height: 100%; }
