:root {
  --red: #ff1100;
  --white: #f0f0f0;
  --bg: #030303;
  --grid: rgba(255,255,255,0.03);
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  overflow: hidden;
  color: var(--white);
  font-family: 'DM Mono', monospace;
  user-select: none;
  -webkit-user-select: none;
}

#canvas-container {
  position: absolute; inset: 0; z-index: 1;
}

.vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
}

.grid-overlay {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background-image: 
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
}

.scanlines {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
  background-size: 100% 4px;
  opacity: 0.3;
}

.ui-layer {
  position: absolute; inset: 0; z-index: 10; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px;
}

.top-bar, .bottom-bar {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.2em; opacity: 0.7;
}
.coord { pointer-events: auto; cursor: crosshair; transition: color 0.3s; padding: 10px; margin: -10px; }
.coord:hover { color: var(--red); }
.void-mode { filter: invert(1) hue-rotate(180deg); }
.red-mode { filter: sepia(1) hue-rotate(310deg) saturate(3) contrast(1.5); }
.sepia-mode { filter: sepia(1) saturate(0.5) contrast(1.2); }

.pulse-text {
  animation: pulse 2s infinite alternate;
}

.center-content {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
  margin-top: 15vh;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(30px, 6vw, 70px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0;
  text-shadow: 0 0 20px rgba(255,255,255,0.2);
  transition: transform 0.1s;
}

.subtitle {
  font-size: 12px; letter-spacing: 0.1em; opacity: 0.6;
}

.glitch-btn {
  pointer-events: auto;
  margin-top: 30px;
  padding: 15px 30px;
  background: transparent;
  color: var(--white);
  border: 1px solid var(--white);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.3em;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.glitch-btn::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: var(--white); transition: left 0.3s; z-index: -1;
}

.glitch-btn:hover {
  color: var(--bg);
}

.glitch-btn:hover::before {
  left: 0;
}

.meter-container {
  display: flex; align-items: center; gap: 15px;
  pointer-events: auto; cursor: crosshair;
}

.meter {
  width: 100px; height: 2px; background: rgba(255,255,255,0.2);
}

.meter-fill {
  width: 80%; height: 100%; background: var(--white); transition: width 0.5s;
}

.warning-text { color: var(--red); }

.crosshair {
  position: absolute; background: transparent; pointer-events: auto; cursor: crosshair; z-index: 20;
}
.ch-top { top: 0; left: 50%; width: 44px; height: 44px; transform: translateX(-50%); }
.ch-top::after { content:''; position:absolute; top:0; left:21px; width:1px; height:30px; background:rgba(255,255,255,0.8); }
.ch-bottom { bottom: 0; left: 50%; width: 44px; height: 44px; transform: translateX(-50%); }
.ch-bottom::after { content:''; position:absolute; bottom:0; left:21px; width:1px; height:30px; background:rgba(255,255,255,0.8); }
.ch-left { top: 50%; left: 0; width: 44px; height: 44px; transform: translateY(-50%); }
.ch-left::after { content:''; position:absolute; top:21px; left:0; width:30px; height:1px; background:rgba(255,255,255,0.8); }
.ch-right { top: 50%; right: 0; width: 44px; height: 44px; transform: translateY(-50%); }
.ch-right::after { content:''; position:absolute; top:21px; right:0; width:30px; height:1px; background:rgba(255,255,255,0.8); }

#flash-overlay {
  position: absolute; inset: 0; z-index: 100; pointer-events: none;
  background: var(--red); opacity: 0; mix-blend-mode: overlay;
  transition: opacity 0.1s;
}

.active #flash-overlay {
  opacity: 1; animation: flash-fade 2s forwards;
}

@keyframes pulse { from { opacity: 0.4; } to { opacity: 1; } }
@keyframes flash-fade { 0% { opacity: 1; background: var(--red); } 50% { background: #fff; } 100% { opacity: 0; } }

.terminal-container {
  position: absolute;
  bottom: 80px;
  left: 40px;
  width: calc(100% - 80px);
  max-width: 450px;
  font-size: 11px;
  color: var(--white);
  opacity: 0.5;
  pointer-events: auto;
  cursor: help;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  text-transform: uppercase;
  font-family: 'DM Mono', monospace;
  text-shadow: 0 0 5px rgba(255,255,255,0.3);
}

.terminal-line {
  overflow: hidden;
  white-space: nowrap;
  animation: type 0.5s steps(30, end) forwards;
}

@keyframes type {
  from { width: 0; }
  to { width: 100%; }
}

@media (max-width: 768px) {
  .ui-layer { padding: 20px; }
  .terminal-container { left: 20px; bottom: 60px; width: calc(100% - 40px); font-size: 8px; }
  .top-bar .coord, .bottom-bar .meter-container { display: none; }
  .center-content { gap: 10px; margin-top: 5vh; }
  .glitch-btn { padding: 12px 20px; font-size: 10px; }
}

.interactive-word, .interactive-link {
  color: var(--white);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
  transition: all 0.3s;
}

.interactive-word:hover, .interactive-link:hover {
  color: var(--red);
  text-decoration-style: solid;
  background: rgba(255,17,0,0.2);
  text-shadow: 0 0 5px var(--red);
}
