/* =========================================================
   games.css — Styles for mini-games, VK test, AI chat, XP
   ========================================================= */

/* ---------- Game wrapper inside terminal ---------- */
.game-wrap {
  margin: 16px 0 8px 0;
  border: 1px solid var(--neon-primary);
  background: rgba(0, 240, 255, 0.03);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
  font-family: var(--font-mono);
}
.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 240, 255, 0.06);
  border-bottom: 1px solid var(--border-glow);
  font-size: 0.72rem;
  color: var(--neon-primary);
  text-shadow: var(--glow-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.game-hint { color: var(--text-muted); font-weight: normal; letter-spacing: 0.05em; }
.game-body {
  padding: 12px;
  color: var(--text-primary);
}
.game-body pre.game-grid {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.1;
  color: var(--neon-accent);
  text-shadow: 0 0 3px var(--neon-accent);
  letter-spacing: 1px;
  white-space: pre;
  text-align: center;
}
.game-foot {
  padding: 8px 12px;
  background: rgba(0, 240, 255, 0.04);
  border-top: 1px dashed var(--border-glow);
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.game-foot b { color: var(--neon-primary); text-shadow: var(--glow-sm); }

/* Hack game grid */
.hack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.hack-word {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--border-glow);
  color: var(--neon-accent);
  font-family: var(--font-mono);
  padding: 8px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  text-shadow: 0 0 4px var(--neon-accent);
}
.hack-word:hover {
  background: rgba(0, 255, 65, 0.12);
  border-color: var(--neon-accent);
  box-shadow: 0 0 8px var(--neon-accent);
  transform: translateY(-1px);
}
.hack-log {
  font-size: 0.78rem;
  max-height: 120px;
  overflow-y: auto;
  padding: 6px 0;
  border-top: 1px dashed var(--border-grid);
}
.hack-log div { margin: 2px 0; }
.hack-log .ok { color: var(--neon-accent); }
.hack-log .err { color: var(--text-secondary); }

/* ---------- XP Badge in status bar ---------- */
.xp-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--neon-primary);
  text-shadow: 0 0 4px var(--neon-primary);
  padding: 2px 8px;
  border: 1px solid var(--border-glow);
  background: rgba(0, 240, 255, 0.04);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.xp-badge:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--neon-primary);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.35);
  transform: scale(1.02);
}
.xp-badge:active { transform: scale(0.98); }
.xp-badge:focus-visible {
  outline: 1px solid var(--neon-primary);
  outline-offset: 2px;
}
.xp-badge .xp-bar {
  color: var(--neon-accent);
  letter-spacing: 0;
  text-shadow: 0 0 3px var(--neon-accent);
}

@media (max-width: 900px) {
  .xp-badge { display: none; }
}

/* ---------- Voight-Kampff Test Modal ---------- */
.vk-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.vk-modal.active { opacity: 1; pointer-events: auto; }
.vk-inner {
  width: min(720px, 100%);
  background: rgba(10, 8, 20, 0.98);
  border: 1px solid var(--neon-danger);
  box-shadow: 0 0 32px rgba(255, 51, 102, 0.4), 0 0 64px rgba(255, 51, 102, 0.2);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  overflow: hidden;
  position: relative;
}
.vk-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 0) 2px,
    rgba(255, 51, 102, 0.05) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
}
.vk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 51, 102, 0.08);
  border-bottom: 1px solid var(--neon-danger);
  font-family: var(--font-mono);
  color: var(--neon-danger);
  text-shadow: 0 0 6px var(--neon-danger);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.vk-title { flex: 1; }
.vk-close {
  background: transparent;
  border: 1px solid var(--neon-danger);
  color: var(--neon-danger);
  font-size: 1rem;
  width: 28px;
  height: 28px;
}
.vk-scan {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--neon-danger), transparent);
  animation: vk-scan 2.5s linear infinite;
}
@keyframes vk-scan {
  0% { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
.vk-body {
  padding: var(--s4);
  font-family: var(--font-mono);
  color: var(--text-primary);
  min-height: 280px;
}
.vk-q {
  font-size: 1.05rem;
  color: var(--neon-primary);
  text-shadow: var(--glow-sm);
  margin-bottom: var(--s3);
  line-height: 1.5;
  padding: var(--s2);
  border-left: 3px solid var(--neon-primary);
  background: rgba(0, 240, 255, 0.04);
}
.vk-opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vk-opt {
  background: rgba(5, 6, 12, 0.6);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  font-family: var(--font-mono);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.vk-opt:hover {
  border-color: var(--neon-primary);
  background: rgba(0, 240, 255, 0.08);
  color: var(--neon-primary);
  text-shadow: var(--glow-sm);
  box-shadow: var(--glow-sm);
  transform: translateX(4px);
}
.vk-foot {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--neon-danger);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-danger);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.vk-result {
  text-align: center;
  padding: var(--s3) 0;
}
.vk-verdict {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: var(--s2);
  animation: vk-verdict 1s;
}
@keyframes vk-verdict {
  0% { opacity: 0; transform: scale(0.8); filter: blur(8px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
.vk-msg {
  color: var(--text-secondary);
  margin-bottom: var(--s3);
  font-family: var(--font-mono);
}
.vk-stats {
  display: flex;
  justify-content: center;
  gap: var(--s4);
  margin-bottom: var(--s3);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.vk-stats b { color: var(--neon-primary); text-shadow: var(--glow-sm); }

/* ---------- AI Chat Modal ---------- */
.ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(3px);
  z-index: 9550;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.ai-modal.active { opacity: 1; pointer-events: auto; }
.ai-inner {
  width: min(680px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgba(5, 6, 12, 0.96);
  border: 1px solid var(--neon-secondary);
  box-shadow: 0 0 24px rgba(255, 0, 234, 0.4);
  font-family: var(--font-mono);
  overflow: hidden;
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(255, 0, 234, 0.08);
  border-bottom: 1px solid var(--neon-secondary);
  color: var(--neon-secondary);
  text-shadow: 0 0 6px var(--neon-secondary);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ai-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-accent);
  box-shadow: 0 0 8px var(--neon-accent);
  animation: pulse 2s ease-in-out infinite;
}
.ai-title { flex: 1; }
.ai-close {
  background: transparent;
  border: 1px solid var(--neon-secondary);
  color: var(--neon-secondary);
  width: 28px;
  height: 28px;
  font-size: 1rem;
}
.ai-body {
  flex: 1;
  padding: var(--s3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
}
.ai-body::-webkit-scrollbar { width: 6px; }
.ai-body::-webkit-scrollbar-track { background: rgba(255, 0, 234, 0.04); }
.ai-body::-webkit-scrollbar-thumb { background: var(--neon-secondary); }
.ai-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: ai-in 0.3s ease;
}
@keyframes ai-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-who {
  font-weight: bold;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border: 1px solid currentColor;
  font-size: 0.68rem;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}
.ai-line-user .ai-who { color: var(--neon-primary); text-shadow: var(--glow-sm); }
.ai-line-user .ai-text { color: var(--text-primary); }
.ai-line-ai .ai-who { color: var(--neon-secondary); text-shadow: 0 0 6px var(--neon-secondary); }
.ai-line-ai .ai-text { color: var(--neon-secondary); text-shadow: 0 0 4px var(--neon-secondary); }
.ai-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--s2) var(--s3);
  background: rgba(255, 0, 234, 0.04);
  border-top: 1px solid var(--neon-secondary);
}
.ai-prompt {
  color: var(--neon-secondary);
  text-shadow: 0 0 6px var(--neon-secondary);
  font-weight: bold;
}
.ai-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  caret-color: var(--neon-secondary);
}
.ai-input::placeholder { color: var(--text-muted); }

/* ---------- Night owl banner ---------- */
.night-owl-banner {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 6, 12, 0.95);
  border: 1px solid var(--neon-warn);
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neon-warn);
  text-shadow: 0 0 6px var(--neon-warn);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 90;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.3);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  animation: bob 3s ease-in-out infinite;
}
.night-owl-banner::before {
  content: "🦉 ";
}

@media (max-width: 900px) {
  .vk-q { font-size: 0.95rem; }
  .vk-opt { font-size: 0.8rem; padding: 10px 12px; }
  .ai-body { min-height: 200px; }
  .ai-line { font-size: 0.82rem; }
}

/* =========================================================
   CYBERSPACE — Tron grid section
   ========================================================= */
#cyberspace {
  padding: var(--s6) 0;
}
.cyberspace-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  border: 1px solid var(--neon-primary);
  background: #05060c;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.3), 0 0 64px rgba(255, 0, 234, 0.15);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  overflow: hidden;
}
.cyberspace-viewport canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.cyberspace-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cs-line {
  position: absolute;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--neon-primary);
  text-shadow: 0 0 6px var(--neon-primary);
  letter-spacing: 0.05em;
}
.cs-line:nth-child(1) { top: 16px; }
.cs-line:nth-child(2) { top: 34px; opacity: 0.7; }
.cs-line-mobile { display: none; }
.cs-motion-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 6, 12, 0.95);
  border: 1px solid var(--neon-primary);
  color: var(--neon-primary);
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-shadow: 0 0 6px var(--neon-primary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  pointer-events: auto;
  cursor: pointer;
  display: none;
  animation: pulse 2s ease-in-out infinite;
}
.cs-motion-btn.active { border-color: var(--neon-accent); color: var(--neon-accent); }

@media (max-width: 900px) {
  .cs-line-desktop { display: none; }
  .cs-line-mobile { display: block; }
  .cs-motion-btn { display: inline-block; }
}
.cs-brackets { position: absolute; inset: 0; }
.cs-b {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid var(--neon-secondary);
  filter: drop-shadow(0 0 4px var(--neon-secondary));
}
.cs-b-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.cs-b-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.cs-b-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.cs-b-br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

/* =========================================================
   ACHIEVEMENT TIERS — visual differentiation
   ========================================================= */
.toast.toast-common { border-color: var(--neon-primary); }
.toast.toast-rare {
  border-color: var(--neon-accent);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.45);
}
.toast.toast-rare .toast-head { color: var(--neon-accent); text-shadow: 0 0 6px var(--neon-accent); }
.toast.toast-epic {
  border-color: var(--neon-secondary);
  box-shadow: 0 0 20px rgba(255, 0, 234, 0.5);
}
.toast.toast-epic .toast-head { color: var(--neon-secondary); text-shadow: 0 0 8px var(--neon-secondary); }
.toast.toast-legendary {
  border: 2px solid #ffd700;
  background: rgba(20, 15, 0, 0.96);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.6), 0 0 64px rgba(255, 215, 0, 0.3);
  animation: legendary-pulse 1.5s ease-in-out infinite;
}
.toast.toast-legendary .toast-head {
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #ffa500;
}
.toast.toast-legendary .toast-head::before { content: "★ "; }
.toast.toast-legendary .toast-body { color: #ffe680; }
@keyframes legendary-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 215, 0, 0.5), 0 0 48px rgba(255, 215, 0, 0.25); }
  50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.4); }
}

/* Elite XP badge (gold tint) */
.xp-badge.xp-elite {
  border-color: #ffd700;
  color: #ffd700;
  text-shadow: 0 0 4px #ffd700;
  background: rgba(40, 30, 0, 0.4);
}
.xp-badge.xp-elite .xp-bar { color: #ffd700; text-shadow: 0 0 3px #ffd700; }
html[data-mode="elite"] .status-dot {
  background: #ffd700;
  box-shadow: 0 0 8px #ffd700;
}

@media (max-width: 900px) {
  .cyberspace-viewport { aspect-ratio: 4 / 3; }
  .cs-line { font-size: 0.62rem; }
}
