* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.italic-up { font-style: italic; }

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #0d0d0d;
  font-family: 'VT323', 'Courier New', monospace;
  user-select: none;
  cursor: url('cursor/mouse_pointer.png') 0 0, auto;
}

/* CRT scanlines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.09) 2px,
    rgba(0, 0, 0, 0.09) 4px
  );
  pointer-events: none;
  z-index: 99998;
}

/* ── DESKTOP ── */
.desktop {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#desktop-credits {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #585858;
  font-size: min(13px, 1.55vw);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  z-index: 99996;
}

/* ── MAIN WINDOW ── */
.main-win-wrapper {
  transform-origin: center center;
}

.main-win {
  width: 390px;
  background: #c0c0c0;
  border: 4px solid;
  border-top-color: #dfdfdf;
  border-left-color: #dfdfdf;
  border-right-color: #404040;
  border-bottom-color: #404040;
  box-shadow: 4px 4px 0 #000, inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080;
  position: relative;
  z-index: 10;
}

.win-titlebar {
  background: #aa0000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px 3px 8px;
  gap: 6px;
}

.win-title {
  color: #fff;
  font-size: 15px;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-title-os {
  background: #000;
  color: #fff;
  padding: 0 5px;
}

.win-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.win-btn {
  width: 18px;
  height: 15px;
  background: #555;
  border: 1px solid #999;
  border-bottom-color: #333;
  border-right-color: #333;
  color: #000;
  font-size: 9px;
  font-family: 'Courier New', monospace;
  line-height: 14px;
  text-align: center;
  cursor: url('cursor/mouse_pointer.png') 0 0, auto;
}

.win-body {
  padding: 32px 28px 30px;
  text-align: center;
  background: #2d2d2d;
  border: 3px solid;
  border-top-color: #404040;
  border-left-color: #404040;
  border-right-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
  margin: 2px;
}

.win-body h1 {
  color: #cc0000;
  font-size: 34px;
  letter-spacing: 4px;
  text-shadow: 0 0 16px #cc000088, 0 0 4px #cc0000;
  margin-bottom: 2px;
}

.win-body .subtitle {
  color: #777;
  font-size: 14px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.win-separator {
  border: none;
  border-top: 1px solid #3a3a3a;
  border-bottom: 1px solid #666;
  margin: 16px 0;
}

.user-info {
  color: #888;
  font-size: 14px;
  margin-bottom: 4px;
}

.user-name {
  color: #aaa;
}

.status-line {
  color: #2c9e2c;
  font-size: 15px;
  margin-bottom: 26px;
  animation: blink 1.4s step-end infinite;
}

.status-line.error {
  color: #ff8800;
  animation: blink 0.45s step-end infinite;
}

.status-line.critical {
  color: #cc0000;
  animation: blink 0.15s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.logout-btn {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 21px;
  letter-spacing: 2px;
  color: #000;
  background: #c0c0c0;
  border: 2px solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
  padding: 9px 14px 7px;
  white-space: nowrap;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  display: block;
  margin: 0 auto;
  transition: background 0.08s, color 0.08s;
}

.logout-btn:hover {
  background: #cdcdcd;
}

.logout-btn:active {
  border-top-color: #404040;
  border-left-color: #404040;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #dfdfdf;
}

.logout-btn:disabled {
  color: #bb0000;
  cursor: url('cursor/mouse_pointer.png') 0 0, auto;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes winShake {
  0%, 100% { transform: translate(0, 0); }
  10%       { transform: translate(-10px, -3px); }
  20%       { transform: translate(10px, 3px); }
  30%       { transform: translate(-9px, -2px); }
  40%       { transform: translate(9px, 2px); }
  50%       { transform: translate(-7px, -1px); }
  60%       { transform: translate(7px, 1px); }
  70%       { transform: translate(-4px, 0); }
  80%       { transform: translate(4px, 0); }
  90%       { transform: translate(-2px, 0); }
}

.main-win.win-shake {
  animation: winShake 0.55s ease-in-out;
}

@keyframes siteShake {
  0%, 100% { transform: translate(0, 0); }
  25%       { transform: translate(-3px, -2px); }
  50%       { transform: translate(3px, 2px); }
  75%       { transform: translate(-2px, 1px); }
}

body.site-shake {
  animation: siteShake 0.13s linear;
}

/* ── MENU SCREEN ── */
#menu-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 150000;
  overflow: hidden;
  padding: min(50px, 3vw) min(50px, 3vw) min(40px, 3vh);
  flex-direction: column;
}

#menu-screen.active { display: flex; }

#menu-screen::before {
  content: '';
  position: absolute;
  inset: -25px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.78)),
    url('pictures/spam/noise_background.png') center / cover no-repeat;
  filter: blur(2px);
  z-index: 0;
  animation: menuBgWave 7s ease-in-out infinite;
}

#menu-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(70, 0, 0, 0.22) 2px,
    rgba(70, 0, 0, 0.22) 4px
  );
  pointer-events: none;
  z-index: 2;
}

@keyframes menuBgWave {
  0%   { transform: scale(1)     translate(0, 0); }
  50%  { transform: scale(1.04)  translate(-10px, 6px); }
  100% { transform: scale(1)     translate(0, 0); }
}

@keyframes menuBgShake {
  0%, 100% { transform: translate(0, 0); }
  10%      { transform: translate(-2px, 1px); }
  25%      { transform: translate(2px, -1px); }
  40%      { transform: translate(-1px, -2px); }
  55%      { transform: translate(1px, 2px); }
  70%      { transform: translate(-2px, 0); }
  85%      { transform: translate(1px, -1px); }
}

#menu-screen::after {
  animation: menuBgShake 0.5s linear infinite;
}

@keyframes logoShake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-1px, 1px); }
  40%      { transform: translate(1px, -1px); }
  60%      { transform: translate(-1px, -1px); }
  80%      { transform: translate(1px, 0); }
}

.menu-logo {
  position: relative;
  z-index: 1;
  color: #cc0000;
  font-size: min(140px, 11vw, 18vh);
  letter-spacing: min(14px, 1.2vw);
  line-height: 1;
  text-shadow: 0 0 24px #cc000077, 0 0 6px #cc0000;
  margin-bottom: min(40px, 2.5vh);
  user-select: none;
  display: inline-block;
  align-self: flex-start;
  flex: 0 0 auto;
  min-width: 0;
  animation: logoShake 0.22s linear infinite;
}

.menu-panel {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0;
  min-width: 0;
  flex: 0 0 auto;
}

.menu-panel-title {
  color: #fff;
  font-size: min(22px, 1.8vw);
  letter-spacing: 2px;
  margin-bottom: min(14px, 1vh);
  text-align: left;
}

.menu-btn {
  display: block;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: min(21px, 1.7vw);
  letter-spacing: 1px;
  color: #ddd;
  background: transparent;
  border: 1px dotted transparent;
  padding: min(3px, 0.4vh) min(12px, 1vw) min(3px, 0.4vh) min(6px, 0.5vw);
  margin: 0 0 min(2px, 0.3vh) min(12px, 1vw);
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.05s, color 0.05s;
}

.menu-btn .tree-line {
  color: #777;
  margin-right: 4px;
}

.menu-btn .folder-ico {
  color: #cc0000;
  margin-right: 6px;
}

.menu-btn:hover {
  background: #6a0000;
  border: 1px dotted #cc0000;
  color: #fff;
}

.menu-btn:hover .tree-line { color: #ddd; }
.menu-btn:hover .folder-ico { color: #fff; }

.menu-participants {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: min(50px, 4vh);
  text-align: left;
  max-width: 100%;
  flex: 0 0 auto;
}

.menu-participants-title {
  color: #888;
  font-size: min(13px, 1vw);
  letter-spacing: 2px;
  margin-bottom: min(4px, 0.5vh);
}

.menu-participants-list {
  color: #555;
  font-size: min(13px, 1.1vw);
  letter-spacing: 1px;
  line-height: 1.35;
}

/* ── COLLAB FULLSCREEN ── */
#collab-view {
  display: none;
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 160000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: min(16px, 1.6vh);
}

#collab-view.active { display: flex; }

#collab-view::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.92)),
    url('pictures/spam/noise_background.png') center / cover no-repeat;
  filter: blur(4px);
  z-index: 0;
}

#collab-img {
  position: relative;
  z-index: 1;
  max-height: 82vh;
  max-width: 90vw;
  display: block;
  user-select: none;
  border: 8px solid rgba(255, 255, 255, 0.25);
  filter: drop-shadow(0 0 28px rgba(204, 0, 0, 0.38)) drop-shadow(0 0 55px rgba(204, 0, 0, 0.18));
}

#collab-caption {
  position: relative;
  z-index: 1;
  color: #777;
  font-size: min(15px, 1.4vw);
  letter-spacing: 1px;
  text-align: center;
  user-select: none;
}

/* ── BACK BUTTON ── */
.back-btn {
  position: fixed;
  top: min(24px, 2vh);
  left: min(24px, 2vw);
  z-index: 200002;
  background: transparent;
  border: none;
  padding: 0;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  user-select: none;
  line-height: 0;
}

.back-btn img {
  display: block;
  height: min(56px, 4.2vw);
  min-height: 30px;
  width: auto;
  image-rendering: pixelated;
  transition: filter 0.12s, transform 0.12s;
  user-select: none;
}

.back-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('button_back.png') center / contain no-repeat;
  filter: brightness(0) saturate(100%) invert(15%) sepia(99%) saturate(7000%) hue-rotate(355deg) brightness(110%);
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}

.back-btn:hover::before {
  opacity: 0.32;
}

.back-btn:hover img {
  filter: brightness(1.05);
}

.back-btn:active img {
  transform: scale(0.92);
}

/* ── BACKGROUND FLICKER ── */
#bg-flicker {
  position: fixed;
  inset: 0;
  background: rgba(160, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  z-index: 150002;
  mix-blend-mode: screen;
}

/* ── RED OVERLAY ── */
@keyframes redFill {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#red-overlay {
  position: fixed;
  inset: 0;
  background: #cc0000;
  opacity: 0;
  z-index: 10000;
  pointer-events: none;
}

#red-overlay.filling {
  animation: redFill 3s linear forwards;
}

/* ── CAROUSEL ── */
#carousel {
  display: none;
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 200000;
  overflow: hidden;
}

#carousel.active { display: block; }

#carousel::before {
  content: '';
  position: absolute;
  inset: -10px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.91), rgba(0, 0, 0, 0.91)),
    url('pictures/spam/noise_background.png') center / cover no-repeat;
  filter: blur(6px);
  z-index: 0;
}

#carousel-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.44s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.44s ease;
}

.carousel-item-name {
  color: #cc0000;
  font-size: min(20px, 1.7vw);
  letter-spacing: min(3px, 0.25vw);
  text-align: center;
}

.carousel-item-link {
  color: #444;
  font-size: min(15px, 1.3vw);
  letter-spacing: 1px;
  text-decoration: none;
  transition: color 0.15s;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
}

.carousel-item-link:hover { color: #888; }

.carousel-img {
  display: block;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  user-select: none;
  transition: max-height 0.44s ease, max-width 0.44s ease, filter 0.44s ease;
  filter: drop-shadow(0 0 14px rgba(204, 0, 0, 0.18));
}

.carousel-item.ci-center .carousel-img {
  filter: drop-shadow(0 0 28px rgba(204, 0, 0, 0.38)) drop-shadow(0 0 55px rgba(204, 0, 0, 0.18));
}

.carousel-item.ci-center {
  z-index: 2;
}

.carousel-item.ci-side {
  z-index: 1;
}

.carousel-item.ci-center .carousel-img {
  max-height: 72vh;
  max-width: 44vw;
}

.carousel-item.ci-side .carousel-img {
  max-height: 50vh;
  max-width: 20vw;
}

.carousel-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  z-index: 200001;
  user-select: none;
  line-height: 0;
}

.carousel-btn img {
  display: block;
  height: min(160px, 12vw);
  min-height: 72px;
  width: auto;
  image-rendering: pixelated;
  transition: filter 0.12s, transform 0.12s;
  user-select: none;
}

.carousel-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('button.png') center / contain no-repeat;
  filter: brightness(0) saturate(100%) invert(15%) sepia(99%) saturate(7000%) hue-rotate(355deg) brightness(110%);
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}

#carousel-next::before {
  transform: scaleX(-1);
}

.carousel-btn:hover::before {
  opacity: 0.32;
}

.carousel-btn:hover img {
  filter: brightness(1.05);
}

.carousel-btn:active img {
  transform: scale(0.92);
}

#carousel-next img {
  transform: scaleX(-1);
}

#carousel-next:active img {
  transform: scaleX(-1) scale(0.92);
}

#carousel-prev { left: min(24px, 2vw); }
#carousel-next { right: min(24px, 2vw); }

/* ── CAROUSEL DOTS ── */
#carousel-dots {
  position: absolute;
  bottom: clamp(12px, 2.5vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: min(7px, 0.7vw);
  max-width: 96vw;
  z-index: 200001;
}

.carousel-dot {
  width: min(8px, 0.9vw);
  height: min(8px, 0.9vw);
  min-width: 3px;
  min-height: 3px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid #cc0000;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.carousel-dot:hover { background: #660000; transform: scale(1.2); }
.carousel-dot.active { background: #cc0000; transform: scale(1.3); }

/* ── PROGRESS BAR ── */
#ad-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: #080808;
  border-top: 1px solid #2a0000;
  z-index: 99997;
  overflow: hidden;
  display: none;
}

#ad-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #cc0000;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

#ad-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: clamp(10px, 1.2vw, 13px);
  letter-spacing: 3px;
  pointer-events: none;
  text-shadow: 0 0 6px #000, 0 0 12px #000;
}

/* ── POPUP ADS ── */
.popup {
  position: fixed;
  z-index: 1000;
  filter: drop-shadow(6px 6px 18px rgba(0, 0, 0, 0.95));
  animation: popIn 0.14s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes popIn {
  from { transform: scale(0.75); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes popOut {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(0.7);  opacity: 0; }
}

.popup.fading-out {
  animation: popOut 0.25s ease forwards;
  pointer-events: none;
}

.popup-inner {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.popup-inner img {
  display: block;
  max-height: 80vh;
  max-width: 86vw;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  transition: filter 0.15s;
}

.popup:hover .popup-inner img {
  filter: brightness(1.12);
}

/* Невидимая зона поверх кнопок окна (_, □, X) в правом верхнем углу.
   Картинки рисуют свой фрейм сами, мы просто перекрываем эту область. */
.popup-close-zone {
  position: absolute;
  cursor: url('cursor/mouse_click.png') 0 0, pointer;
  z-index: 10;
  transition: background 0.08s;
  border-radius: 1px;
}

.popup-close-zone:hover {
  background:
    radial-gradient(circle at top left,     rgba(255, 40, 40, 0.65) 0%, transparent 65%),
    radial-gradient(circle at top right,    rgba(255, 40, 40, 0.65) 0%, transparent 65%),
    radial-gradient(circle at bottom left,  rgba(255, 40, 40, 0.65) 0%, transparent 65%),
    radial-gradient(circle at bottom right, rgba(255, 40, 40, 0.65) 0%, transparent 65%);
  box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.25);
}

/* ── BOOT SCREEN ── */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: 'VT323', monospace;
  color: #cc0000;
  transition: opacity 0.5s ease;
}

#boot-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.09) 2px,
    rgba(0, 0, 0, 0.09) 4px
  );
  pointer-events: none;
}

#boot-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-bar {
  width: clamp(260px, 40vw, 420px);
  height: 18px;
  border: 1px solid #aa0000;
  background: #1a1a1a;
  padding: 2px;
  box-sizing: border-box;
}

#boot-bar-fill {
  height: 100%;
  width: 0%;
  background: #cc0000;
}

#boot-pct {
  margin-top: 16px;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: 3px;
  color: #cc0000;
}
