:root {
  --bg:       #02060a;
  --bg2:      #04120b;
  --neon:     #39ff14;
  --neon-dim: #1f8a12;
  --cyan:     #00e5ff;
  --magenta:  #ff2e8b;
  --red:      #ff2e63;
  --text:     #9affc8;
  --muted:    #4f7a63;
  --font:     'Share Tech Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(57,255,20,.08), transparent 60%),
    var(--bg);
  overflow: hidden;
  letter-spacing: .5px;
}

.hidden { display: none !important; }

/* ===== Background FX: animated grid + scanlines ===== */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(57,255,20,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,255,20,.05) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: drift 14s linear infinite;
}
@keyframes drift { to { background-position: 40px 40px; } }

.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.18) 3px);
  mix-blend-mode: multiply;
  animation: flicker 3s infinite;
}
@keyframes flicker { 0%,100% { opacity: .7; } 50% { opacity: .9; } }

#app { position: relative; z-index: 1; height: 100%; }

/* ===== Shared frame ===== */
.terminal-frame {
  background: linear-gradient(180deg, rgba(4,18,11,.92), rgba(2,8,5,.96));
  border: 1px solid var(--neon-dim);
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(57,255,20,.18), inset 0 0 30px rgba(57,255,20,.05);
}

/* ===== Views ===== */
.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
}

/* ===== Registration modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.7); backdrop-filter: blur(3px);
}
.modal { width: min(420px, 92vw); padding: 28px; }
.modal-title {
  color: var(--neon); font-size: 20px; margin-bottom: 6px;
  text-shadow: 0 0 10px var(--neon);
}
.muted { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

label {
  display: block; font-size: 12px; color: var(--cyan);
  margin: 14px 0 6px; text-transform: uppercase;
}
input[type=text] {
  width: 100%; padding: 11px 12px;
  background: #020a06; color: var(--neon);
  border: 1px solid var(--neon-dim); border-radius: 6px;
  font-family: var(--font); font-size: 15px; outline: none;
}
input[type=text]:focus {
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(57,255,20,.4);
}
.error-text { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

button {
  margin-top: 18px; width: 100%; padding: 12px; cursor: pointer;
  background: transparent; color: var(--neon);
  border: 1px solid var(--neon); border-radius: 6px;
  font-family: var(--font); font-size: 15px; letter-spacing: 2px;
  text-transform: uppercase; transition: all .15s;
}
button:hover { background: var(--neon); color: #021; box-shadow: 0 0 18px var(--neon); }

/* ===== Terminal ===== */
.term-window {
  width: min(760px, 94vw); height: min(70vh, 520px);
  display: flex; flex-direction: column; overflow: hidden;
}
.term-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--neon-dim);
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ff5f56; } .dot.yellow { background: #ffbd2e; } .dot.green { background: #27c93f; }
.term-title { margin-left: 8px; color: var(--muted); font-size: 13px; }

.term-output { flex: 1; padding: 16px; overflow-y: auto; font-size: 14px; line-height: 1.6; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.sys  { color: var(--cyan); }
.term-line.ok   { color: var(--neon); text-shadow: 0 0 8px var(--neon); }
.term-line.err  { color: var(--red); }

.term-input-line {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--neon-dim);
}
.prompt { color: var(--neon); text-shadow: 0 0 8px var(--neon); }
#term-input {
  flex: 1; background: transparent; border: none; color: var(--neon);
  font-family: var(--font); font-size: 15px; outline: none;
}
.term-input-line::after {
  content: '_'; color: var(--neon);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== HUD + canvas ===== */
.hud {
  width: min(760px, 94vw);
  display: flex; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; font-size: 14px;
}
.hud-left  { color: var(--cyan); }
.hud-mid   { color: var(--text); text-align: center; flex: 1; }
.hud-right { color: var(--neon); text-shadow: 0 0 8px var(--neon); white-space: nowrap; }

.canvas-wrap { padding: 10px; display: flex; align-items: center; justify-content: center; }
.game-canvas {
  display: block; background: #04140c; border-radius: 6px;
  max-width: 90vw; height: auto;
  box-shadow: 0 0 20px rgba(57,255,20,.25);
}
.controls-hint { margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ===== Success ===== */
.success-box { text-align: center; padding: 44px 38px; max-width: 560px; }
.success-box p { color: var(--text); font-size: 15px; line-height: 1.7; margin: 6px 0; }
.glitch {
  font-size: 42px; color: var(--neon); margin-bottom: 18px;
  text-shadow: 0 0 16px var(--neon); animation: glitch 1.6s infinite;
}
@keyframes glitch {
  0%,100% { text-shadow: 0 0 16px var(--neon); transform: none; }
  20%     { text-shadow: -2px 0 var(--magenta), 2px 0 var(--cyan); }
  40%     { transform: translateX(2px); }
  60%     { text-shadow: 2px 0 var(--magenta), -2px 0 var(--cyan); }
}

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 60; padding: 12px 18px; border-radius: 6px;
  background: rgba(4,18,11,.95); border: 1px solid var(--neon);
  color: var(--neon); font-size: 14px;
  box-shadow: 0 0 18px rgba(57,255,20,.35);
  animation: rise .25s ease;
}
.toast-error {
  border-color: var(--red); color: var(--red);
  box-shadow: 0 0 18px rgba(255,46,99,.4);
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
