:root {
  color-scheme: dark;
  --bg: #000000;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

body {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
  font-family: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
}

#cyber-canvas,
.screen-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#cyber-canvas {
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
}

.screen-noise {
  z-index: 2;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 3px 3px, 4px 4px;
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(0, 0, 0, 0.34) 74%, rgba(0, 0, 0, 0.72) 100%);
}

.x-window {
  position: fixed;
  z-index: 4;
  top: clamp(34px, 8vh, 88px);
  left: clamp(28px, 7vw, 96px);
  width: min(420px, calc(100vw - 48px));
  border: 1px solid #8e8e8e;
  background: rgba(4, 4, 4, 0.92);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 18px 46px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.x-window.is-dragging {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 24px 60px rgba(0, 0, 0, 0.74);
}

.x-window__titlebar {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-bottom: 1px solid #646464;
  background:
    linear-gradient(180deg, rgba(30, 30, 30, 0.98) 0%, rgba(0, 0, 0, 0.98) 100%);
  color: #dddddd;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  user-select: none;
}

.x-window__title {
  font-size: 12px;
  line-height: 1;
}

.x-window__body {
  position: relative;
  padding: 22px 24px 24px;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.96) 0%, rgba(1, 1, 1, 0.96) 100%);
}

.x-window__body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 100% 3px;
  opacity: 0.12;
}

.x-window__line {
  position: relative;
  margin: 0;
  color: #f3f3f3;
  font-size: clamp(1rem, 1.15vw, 1.2rem);
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}

.x-window__name {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  color: #f3f3f3;
}

.x-window__glyph {
  display: inline-block;
  color: #f3f3f3;
}

.x-window__glyph.is-glitched {
  text-shadow: 0 0 8px currentColor;
}

.x-window__glyph.glitch-red {
  color: rgba(255, 62, 62, 0.96);
  transform: translate(-0.03em, 0);
}

.x-window__glyph.glitch-blue {
  color: rgba(92, 178, 255, 0.94);
  transform: translate(0.03em, 0);
}

@media (hover: hover) and (pointer: fine) {
  .x-window__titlebar {
    cursor: move;
    touch-action: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen-noise {
    opacity: 0.05;
  }

  .x-window__glyph.is-glitched {
    text-shadow: 0 0 4px currentColor;
    transform: none;
  }
}

@media (max-width: 700px) {
  .x-window {
    top: auto;
    right: 16px;
    bottom: 18px;
    left: 16px;
    width: auto;
  }

  .x-window__titlebar {
    min-height: 28px;
    padding: 6px 10px;
  }

  .x-window__body {
    padding: 18px 18px 20px;
  }

  .x-window__line {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    white-space: normal;
  }

  .x-window__name {
    white-space: normal;
  }
}
