:root {
  --bg: #0b0c13;
  --card-bg: rgba(19, 22, 36, 0.85);
  --fg: #e0e5ff;
  --accent: #4cc9f0;
  --highlight: #72ddf7;
  --muted: #7e8bb5;
  --border: rgba(76, 201, 240, 0.12);
  --neon: 0 0 12px var(--accent), 0 0 24px var(--accent);
}

/* Temas */
body.red-mode { --accent: #ff2a6d; --highlight: #ff5c8a; --fg: #ffe0e6; --muted: #ff99aa; --card-bg: rgba(30, 10, 15, 0.88); --bg: #0a0305; }
body.green-mode { --accent: #00ff9d; --highlight: #4cffc6; --fg: #e0fff5; --muted: #88ffd0; --card-bg: rgba(5, 20, 15, 0.88); --bg: #020805; }
body.blackops-mode { --accent: #00ff00; --highlight: #33ff33; --fg: #00ff00; --muted: #00cc00; --card-bg: rgba(0, 5, 0, 0.92); --bg: #000000; --border: rgba(0, 255, 0, 0.15); }

/* Modo reclutador (suave) */
body.viewer-mode {
  --bg: #f8f9fa;
  --card-bg: white;
  --fg: #212529;
  --accent: #0d6efd;
  --highlight: #0dcaf0;
  --muted: #6c757d;
  --border: #dee2e6;
  --neon: none;
}
body.viewer-mode .glitch,
body.viewer-mode .glitch::before,
body.viewer-mode .glitch::after {
  color: var(--accent);
  text-shadow: none;
  animation: none;
}
body.viewer-mode #matrix,
body.viewer-mode #kanji-particles {
  display: none !important;
}
body.viewer-mode .simulation-section,
body.viewer-mode .terminal-section,
body.viewer-mode .game-section {
  border: 1px solid #e9ecef;
  background: #fafafa;
}
body.viewer-mode .theme-toggle,
body.viewer-mode .viewer-toggle {
  display: none;
}

/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Fira Code', monospace;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: all 0.4s ease;
}

#matrix {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; opacity: 0.35;
}
#kanji-particles {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
}
.kanji {
  position: absolute; font-size: 24px; opacity: 0.2; animation: float 15s infinite linear; color: var(--accent);
}
@keyframes float { to { transform: translateY(-100vh) rotate(360deg); } }

.profile-card {
  max-width: 900px; margin: 2rem auto; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--neon); backdrop-filter: blur(6px); padding: 2.5rem; position: relative;
}

.header-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem;
}
.theme-toggle { display: flex; gap: 0.5rem; }
.theme-toggle button {
  background: rgba(255,255,255,0.1); border: 1px solid var(--border); color: var(--fg); width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 12px; transition: all 0.2s;
}
.theme-toggle button:hover { transform: scale(1.15); box-shadow: 0 0 8px var(--accent); }

.btn { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; }
.close { background: #ff5f57; } .minimize { background: #ffbd2e; } .maximize { background: #28c940; }

.glitch {
  font-family: 'Orbitron', sans-serif; font-size: 2.8rem; font-weight: 700; color: var(--accent);
  position: relative; letter-spacing: 2px; margin-bottom: 0.5rem; text-shadow: 0 0 10px var(--accent);
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.glitch::before { left: 2px; clip: rect(44px, 450px, 56px, 0); animation: glitch-anim 5s infinite linear alternate-reverse; }
.glitch::after { left: -2px; clip: rect(44px, 450px, 56px, 0); animation: glitch-anim2 5s infinite linear alternate-reverse; }
@keyframes glitch-anim { 0%,100% { clip: rect(30px,9999px,10px,0); } 50% { clip: rect(60px,9999px,90px,0); } }
@keyframes glitch-anim2 { 0%,100% { clip: rect(10px,9999px,30px,0); } 50% { clip: rect(90px,9999px,40px,0); } }

.subtitle { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.8rem; letter-spacing: 1px; }

.badges { display: flex; gap: 1.2rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.badges a { color: var(--accent); text-decoration: none; font-weight: bold; font-size: 0.95rem; transition: color 0.3s; }
.badges a:hover { color: var(--highlight); text-shadow: 0 0 8px var(--highlight); }

section { margin: 2.2rem 0; }
h2 { font-size: 1.3rem; color: var(--highlight); margin-bottom: 1rem; letter-spacing: 1px; }

.tags { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.8rem; }
.tags span {
  background: rgba(76, 201, 240, 0.1); color: var(--fg); padding: 0.35rem 0.9rem; border-radius: 4px;
  font-size: 0.85rem; border: 1px solid var(--border); transition: all 0.2s;
}
.tags span:hover { background: rgba(76, 201, 240, 0.25); transform: translateY(-1px); box-shadow: 0 0 6px rgba(76, 201, 240, 0.3); }

/* Mini-game */
.game-section input {
  background: rgba(0, 30, 30, 0.7); border: 1px solid var(--border); color: var(--fg); padding: 0.5rem;
  font-family: 'Fira Code', monospace; margin: 0.5rem 0; width: 150px;
}
.game-section button {
  background: var(--accent); color: black; border: none; padding: 0.4rem 1rem;
  font-family: 'Orbitron', sans-serif; cursor: pointer; transition: all 0.2s;
}
.game-section button:hover { box-shadow: 0 0 10px var(--accent); }
#gameFeedback { min-height: 1.5rem; margin-top: 0.5rem; font-weight: bold; }

/* Terminal */
.terminal-section {
  background: rgba(0, 10, 10, 0.4); padding: 1rem; border-radius: 8px; border: 1px solid var(--border);
}
#terminalOutput {
  height: 150px; overflow-y: auto; padding: 0.5rem; font-family: 'Fira Code', monospace;
  font-size: 0.95rem; color: var(--muted); margin-bottom: 0.8rem;
}
.terminal-input { display: flex; align-items: center; }
.prompt { color: var(--accent); margin-right: 0.5rem; user-select: none; }
#terminalInput {
  background: transparent; border: none; color: var(--fg); font-family: 'Fira Code', monospace;
  font-size: 0.95rem; width: 100%; outline: none;
}

/* Simulación */
.simulation-section {
  background: rgba(0, 15, 20, 0.4); padding: 1.2rem; border-radius: 10px; border: 1px solid var(--border); margin-top: 2rem;
}
.simulation-controls { display: flex; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.simulation-controls button {
  background: var(--accent); color: #000; border: none; padding: 0.4rem 0.9rem;
  font-family: 'Orbitron', sans-serif; font-size: 0.85rem; cursor: pointer; border-radius: 4px; transition: all 0.2s;
}
.simulation-controls button:hover { box-shadow: 0 0 10px var(--accent); transform: translateY(-1px); }
.simulation-controls button:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-container {
  height: 24px; background: rgba(0, 30, 30, 0.6); border-radius: 12px; overflow: hidden;
  margin: 1rem 0; position: relative; border: 1px solid var(--border);
}
.progress-bar {
  height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--highlight));
  transition: width 0.4s ease; border-radius: 12px;
}
.progress-label {
  font-size: 0.9rem; color: var(--muted); text-align: center; margin-top: 0.4rem; min-height: 1.4rem;
  font-family: 'Fira Code', monospace;
}
.simulation-log {
  height: 140px; overflow-y: auto; padding: 0.6rem; background: rgba(0, 10, 15, 0.3);
  border-radius: 6px; font-family: 'Fira Code', monospace; font-size: 0.88rem; color: var(--fg);
}
.simulation-log div { margin-bottom: 0.3rem; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Viewer toggle */
.viewer-toggle {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  background: rgba(0,0,0,0.6); padding: 0.4rem 0.8rem; border-radius: 20px;
}
.viewer-toggle label { color: white; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; }
.viewer-toggle input { display: none; }

footer { margin-top: 2rem; text-align: left; }
.prompt { color: var(--muted); font-family: 'Fira Code', monospace; animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

@media (max-width: 650px) {
  .profile-card { padding: 1.5rem; }
  .glitch { font-size: 2rem; }
  h2 { font-size: 1.15rem; }
  .theme-toggle, .viewer-toggle { display: none; }
}