:root {
  --bg: #07080c;
  --bg-2: #0d0f17;
  --fg: #e6e8ee;
  --fg-dim: #8b93a7;
  --fg-faint: #4a5066;
  --accent: #cc0000;
  --accent-2: #ff3a3a;
  --accent-3: #ff6b6b;
  --neon: #00ffa3;
  --neon-2: #5cffce;
  --warn: #ffcb47;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.18);
  --grid: rgba(255, 70, 70, 0.06);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overflow: hidden;
  height: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===== Background FX ===== */
#matrix {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.22;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.012) 0,
      rgba(255, 255, 255, 0.012) 1px,
      transparent 1px,
      transparent 3px
    );
  pointer-events: none;
  mix-blend-mode: overlay;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.75) 100%);
  pointer-events: none;
}

main, footer { position: relative; z-index: 2; }

/* ===== Screen ===== */
.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  pointer-events: none;
  animation: gridShift 30s linear infinite;
}
@keyframes gridShift { to { transform: translate(60px, 60px); } }

.hero-inner {
  max-width: 920px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 2;
}

.status-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  padding: 6px 14px;
  border: 1px solid var(--border-bright);
  border-radius: 100px;
  background: rgba(13,15,23,0.6);
  margin-bottom: 40px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-live {
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon), 0 0 14px rgba(0,255,163,0.4);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.85); } }
.status-sep { color: var(--fg-faint); }
.status-label { letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.coords-trigger {
  cursor: pointer;
  transition: color 0.15s ease, text-shadow 0.15s ease;
  outline: none;
}
.coords-trigger:hover, .coords-trigger:focus-visible {
  color: var(--neon);
  text-shadow: 0 0 8px rgba(0,255,163,0.5);
}
.coords-trigger.roll {
  animation: coordsRoll 0.45s ease;
}
@keyframes coordsRoll {
  0%   { color: var(--accent-2); text-shadow: 0 0 10px rgba(255,58,58,0.6); transform: translateY(0); }
  40%  { color: var(--warn); text-shadow: 0 0 10px rgba(255,203,71,0.6); transform: translateY(-2px); }
  100% { color: var(--fg-dim); text-shadow: none; transform: translateY(0); }
}

.glitch {
  font-family: var(--sans);
  font-size: clamp(2.4rem, 9vw, 6.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  position: relative;
  color: var(--fg);
  margin-bottom: 28px;
}
.glitch span { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.glitch::before {
  color: var(--accent-2);
  clip-path: inset(0 0 60% 0);
  transform: translate(-2px, -1px);
  animation: glitch-a 4s infinite steps(1);
  mix-blend-mode: screen;
}
.glitch::after {
  color: var(--neon);
  clip-path: inset(70% 0 0 0);
  transform: translate(2px, 1px);
  animation: glitch-b 3.5s infinite steps(1);
  mix-blend-mode: screen;
}
@keyframes glitch-a {
  0%, 92%, 100% { transform: translate(0,0); clip-path: inset(0 0 60% 0); }
  93% { transform: translate(-3px, 1px); clip-path: inset(10% 0 50% 0); }
  95% { transform: translate(2px, -1px); clip-path: inset(40% 0 20% 0); }
  97% { transform: translate(-1px, 2px); clip-path: inset(0 0 80% 0); }
}
@keyframes glitch-b {
  0%, 90%, 100% { transform: translate(0,0); clip-path: inset(70% 0 0 0); }
  91% { transform: translate(3px, -2px); clip-path: inset(50% 0 10% 0); }
  93% { transform: translate(-2px, 1px); clip-path: inset(80% 0 0 0); }
  96% { transform: translate(1px, 2px); clip-path: inset(30% 0 40% 0); }
}

.tagline {
  font-family: var(--mono);
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--fg-dim);
  margin-bottom: 56px;
}
.tagline .cursor { color: var(--neon); margin-right: 6px; }
#rotator { color: var(--fg); }
.cursor-blink {
  color: var(--neon);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.brand-row {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-dim);
}
.diamond {
  color: var(--accent-2);
  text-shadow: 0 0 12px rgba(255,58,58,0.7);
  animation: spin 8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand-text { color: var(--fg); }
.ver {
  font-size: 0.72rem;
  color: var(--fg-faint);
  border: 1px solid var(--border-bright);
  padding: 2px 8px;
  border-radius: 3px;
}

.hint-row {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-faint);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.hint kbd {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.72rem;
  color: var(--fg-dim);
  margin: 0 1px;
  font-family: var(--mono);
}
.hint.sep { color: var(--fg-faint); }

/* ===== Footer ===== */
.footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 18px 32px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-dim);
  display: flex;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(to top, rgba(7,8,12,0.6), transparent);
}
.footer .dim { color: var(--fg-faint); }

/* ===== Buttons ===== */
.btn {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 14px 24px;
  border: 1px solid;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(204,0,0,0.5);
}

/* ===== Terminal overlay ===== */
.term-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 32px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
}
.term-overlay.show {
  display: grid;
  animation: fadeIn 0.25s ease;
}
.term-overlay {
  transition: background 0.35s ease, backdrop-filter 0.35s ease;
}
.term-overlay.peek {
  background: rgba(0,0,0,0.18);
  backdrop-filter: blur(2px);
}
.term-overlay.peek .terminal {
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 0.55;
  transform: scale(0.97);
}
.terminal { transition: opacity 0.35s ease, transform 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; } }

.terminal {
  width: min(800px, 100%);
  background: #050608;
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  font-family: var(--mono);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,255,163,0.1),
    0 24px 80px rgba(0,0,0,0.6),
    0 0 80px rgba(0,255,163,0.08);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(to bottom, #1a1d28, #12141b);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--fg-dim);
}
.tdot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
}
.tdot.red { background: #ff5f57; }
.tdot.yellow { background: #febc2e; }
.tdot.green { background: #28c840; }
.term-title { margin-left: auto; margin-right: auto; padding-right: 60px; }

.term-body {
  padding: 20px;
  height: 320px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #d4d7e0;
}
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.error { color: var(--accent-3); }
.term-line .prompt { color: var(--neon); font-weight: 600; }
.term-line .path { color: #4fb3ff; font-weight: 600; }
.term-line .sep { color: var(--fg-dim); }
.term-line .kw { color: var(--warn); }
.term-line .typed { color: var(--fg); }
.term-line .accent { color: var(--accent-3); }
.term-line .neon { color: var(--neon); }
.term-line .dim { color: var(--fg-dim); }

.term-input-row {
  display: flex;
  align-items: center;
  padding: 0 20px 20px 20px;
  font-size: 0.92rem;
}
.term-input-row .prompt { color: var(--neon); font-weight: 600; }
.term-input-row .path { color: #4fb3ff; font-weight: 600; }
.term-input-row .sep { color: var(--fg-dim); }
#term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.92rem;
  caret-color: transparent;
}
.caret {
  color: var(--neon);
  animation: blink 1s steps(2) infinite;
  margin-left: -8px;
}
.term-hint {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
  text-align: center;
}

/* ===== Konami overlay ===== */
.konami-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  text-align: center;
  padding: 32px;
}
.konami-overlay.show {
  display: grid;
  animation: fadeIn 0.4s ease;
}
.ascii {
  color: var(--neon);
  font-family: var(--mono);
  font-size: clamp(0.55rem, 1.5vw, 1rem);
  line-height: 1.1;
  margin-bottom: 24px;
  text-shadow: 0 0 12px var(--neon);
}
.konami-text {
  color: var(--fg);
  font-size: 1.2rem;
  margin-bottom: 24px;
}
.konami-text .dim { color: var(--fg-dim); font-size: 0.95rem; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .screen { padding: 24px; }

  /* Let the status pill wrap as a group on narrow viewports; drop the
     // separators so wrapped lines don't end with a stray "//".
     Switch from inline-flex to flex + fit-content so max-width:100%
     actually clamps the row and triggers wrap when the content overflows. */
  .status-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 10px;
    font-size: 0.72rem;
    padding: 7px 14px;
    border-radius: 16px;
    margin-inline: auto;
    width: fit-content;
    max-width: 100%;
  }
  .status-row .status-sep { display: none; }

  /* Glitch hero — let it shrink further on narrow viewports so
     "nothing to see here." fits in one line without horizontal overflow. */
  .glitch  { font-size: clamp(1.9rem, 8vw, 6.5rem); margin-bottom: 22px; }
  .tagline { margin-bottom: 40px; }

  .hint-row { bottom: 80px; flex-direction: column; gap: 6px; }
  .hint-row .sep { display: none; }
  .footer { font-size: 0.7rem; padding: 14px 18px; }
  .term-overlay { padding: 12px; }
  .term-body { height: 240px; font-size: 0.85rem; }
}

/* ===== Selection ===== */
::selection { background: var(--accent); color: white; }
::-moz-selection { background: var(--accent); color: white; }

/* ===== Scrollbar (terminal body) ===== */
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-track { background: transparent; }
.term-body::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}
