:root {
  --bg: #000000;
  --panel: #050805;
  --panel-raised: #070b07;
  --border-dim: #143614;
  --border-bright: #1f4d1f;
  --accent: #39ff7a;
  --accent-dim: #2bbf5c;
  --accent-faint: #1c7a3c;
  --text-body: #5f8d68;
  --text-strong: #eafff1;
  --status-amber: #ffd24a;
  --status-red: #ff5f56;
  --status-cyan: #5cf6ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: "JetBrains Mono", "IBM Plex Mono", monospace;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

::selection { background: rgba(57, 255, 122, 0.3); color: var(--text-strong); }

/* Inputs below 16px make iOS Safari zoom in on focus and never zoom back out. */
input, textarea, select { font-size: 16px; }

button, a, [role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.4;
  background: repeating-linear-gradient(
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 51;
  pointer-events: none;
  background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

.glow-text { text-shadow: 0 0 8px rgba(57, 255, 122, 0.45), 0 0 24px rgba(57, 255, 122, 0.18); }
.glow-border { box-shadow: 0 0 10px rgba(57, 255, 122, 0.15); }

.blinking-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--status-amber);
  vertical-align: middle;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { from, to { opacity: 1; } 50% { opacity: 0; } }

.pulse { animation: pulse-glow 2s infinite ease-in-out; }
@keyframes pulse-glow {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 2px var(--accent)); }
  50% { filter: brightness(1.3) drop-shadow(0 0 10px var(--accent)); }
}

.signal-pulse { stroke-dasharray: 10 5; animation: signal-move 3s linear infinite; }
@keyframes signal-move { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }

.app-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.terminal-frame {
  width: 100%;
  max-width: 1440px;
  background: var(--panel);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  z-index: 10;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.title-bar {
  min-height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--border-dim);
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .app-shell { padding: 0; }
  .terminal-frame {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .terminal-frame.dashboard-frame { min-height: 100dvh; }
  .title-bar { padding-top: max(6px, env(safe-area-inset-top)); }
}

.traffic-dots { display: flex; gap: 8px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.amber { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.path-label { margin-left: 16px; font-size: 11px; color: var(--status-cyan); font-weight: 500; }

.nav-links { display: flex; gap: 16px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-links a { color: var(--text-body); text-decoration: none; }
.nav-links a.active { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover { color: var(--accent); }
}
.nav-links a:active { color: var(--accent); }

.status-cluster { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--status-amber); }

.stat-bar {
  min-height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dim);
}

@media (max-width: 640px) {
  .stat-bar > div { gap: 16px !important; }
}
.stat-label { font-size: 10px; color: var(--accent-faint); display: block; margin-bottom: 2px; }
.stat-value { font-size: 14px; color: var(--text-strong); font-weight: 700; }
.stat-value.accent { color: var(--accent); }

.roster { display: flex; margin-left: -4px; }
.roster .avatar {
  width: 32px; height: 32px;
  background: #0a120a;
  border: 1px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  font-size: 10px; color: var(--accent);
  margin-left: -4px;
}
.roster .avatar .online-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 8px; height: 8px; background: var(--status-amber);
  border: 1px solid black; border-radius: 50%;
}

.btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-bright);
  background: transparent;
  color: var(--accent);
  min-height: 44px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-solid {
  background: var(--accent);
  color: #021a07;
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(57, 255, 122, 0.3);
}
@media (hover: hover) and (pointer: fine) {
  .btn-solid:hover { background: #4bffa0; }
  .btn-ghost:hover { border-color: var(--accent); color: var(--text-strong); }
}
.btn:active { transform: scale(0.97); }
.btn-solid:active { background: #4bffa0; }
.btn-ghost:active { border-color: var(--accent); color: var(--text-strong); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
}

input.terminal-input {
  width: 100%;
  background: #020502;
  border: 1px solid var(--border-dim);
  color: var(--text-strong);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 4px;
  outline: none;
}
input.terminal-input:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(57,255,122,0.25); }

.tag-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  color: var(--text-body);
}
.tag-pill.amber { border-color: var(--status-amber); color: var(--status-amber); }

.log-line { font-size: 12px; padding: 2px 0; color: var(--text-body); }
.log-line .ts { color: var(--accent-faint); margin-right: 8px; }
.log-line.solved { color: var(--accent); }
.log-line.unlocked { color: var(--status-amber); }
.log-line.failed { color: var(--status-red); }

a { color: inherit; }
