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

html, body, #root {
  width: 100%;
  height: 100%;
  background: #000;
  font-family: 'JetBrains Mono', monospace;
  color: #ccc;
  overflow-x: hidden;
}

@keyframes pulse-breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1.0; }
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  20% { transform: translate(-15%, 5%); }
  30% { transform: translate(7%, -25%); }
  40% { transform: translate(-5%, 25%); }
  50% { transform: translate(-15%, 10%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 15%); }
  80% { transform: translate(3%, 35%); }
  90% { transform: translate(-10%, 10%); }
}

@keyframes flash-green {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes flash-red {
  0% { border-color: #f00; }
  100% { border-color: #333; }
}

.noise-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background: #000;
}

.noise-bg::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  right: -50%; bottom: -50%;
  width: 200%; height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: grain 0.5s steps(6) infinite;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

.crt-flicker {
  animation: crt-flicker 0.15s infinite alternate;
}

@keyframes crt-flicker {
  0% { opacity: 0.98; }
  100% { opacity: 1.0; }
}

.breathe {
  animation: pulse-breathe 3s ease-in-out infinite;
}

.input-flash-red {
  animation: flash-red 0.4s ease-out forwards;
}

.green-flash-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #001100;
  z-index: 9999;
  animation: flash-green 100ms linear forwards;
  pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #080808;
}
::-webkit-scrollbar-thumb {
  background: #222;
}
::-webkit-scrollbar-thumb:hover {
  background: #333;
}

/* No rounded corners */
* {
  border-radius: 0 !important;
}

input:focus {
  outline: none;
}

button:focus {
  outline: none;
}

/* Toast */
.toast-appear {
  animation: toast-in 0.05s linear forwards;
}
@keyframes toast-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .breathe { animation: none; opacity: 0.8; }
  .noise-bg::before { animation: none; }
  .scanlines { display: none; }
  .crt-flicker { animation: none; }
  .green-flash-overlay { animation: none; display: none; }
}

/* Slide pane */
.slide-pane {
  transition: transform 50ms linear;
}

/* Access animation cursor blink */
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.access-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #0f0;
  animation: blink-cursor 0.8s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

/* Selection color */
::selection {
  background: #003300;
  color: #0f0;
}