/* ═══════════════════════════════════════════════════
   ClawSkin — Global Styles
   Cyberpunk pixel aesthetic + modern UI
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&family=Outfit:wght@300;400;600;700;800&display=swap');

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a35;
  --text-primary: #e0e0f0;
  --text-secondary: #8888aa;
  --accent-cyan: #00f0ff;
  --accent-purple: #b44aff;
  --accent-pink: #ff44aa;
  --accent-green: #00ff88;
  --accent-gold: #ffcc00;
  --border: rgba(255,255,255,0.08);
  --glow-cyan: 0 0 20px rgba(0,240,255,0.3);
  --glow-purple: 0 0 20px rgba(180,74,255,0.3);
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ═══ Hero Section ═══ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 30% 20%, rgba(0,240,255,0.06) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(180,74,255,0.06) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(-2%,1%) scale(1.02); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(0,240,255,0.08);
  border: 1px solid rgba(0,240,255,0.2);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
  font-family: 'Space Mono', monospace;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  text-align: center;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(0,240,255,0.2));
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

/* ═══ Game Canvas ═══ */
.game-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: var(--glow-cyan), inset 0 0 60px rgba(0,0,0,0.5);
  background: var(--bg-secondary);
  z-index: 1;
}

.game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.game-status {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent-green);
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ═══ Controls Bar ═══ */
.controls-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.ctrl-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.ctrl-btn:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.ctrl-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0,240,255,0.1);
  color: var(--accent-cyan);
}

/* ═══ Scene Picker Buttons ═══ */
.scene-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.scene-btn:hover { border-color: var(--accent-purple); box-shadow: var(--glow-purple); }
.scene-btn.active { border-color: var(--accent-purple); background: rgba(180,74,255,0.1); color: var(--accent-purple); }

/* ═══ Sections ═══ */
.section {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.section-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* ═══ Feature Grid ═══ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: var(--glow-cyan);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.feature-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ Character Editor Panel ═══ */
.editor-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0,240,255,0.05);
  border-bottom: 1px solid var(--border);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

.editor-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}
.editor-close:hover { color: var(--accent-pink); }

.editor-body {
  padding: 1rem;
}

.editor-row {
  margin-bottom: 1rem;
}

.editor-row label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--accent-cyan); box-shadow: var(--glow-cyan); }

.btn-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ed-btn {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-family: 'Space Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.ed-btn:hover { border-color: var(--accent-purple); color: var(--text-primary); }
.ed-btn.active { border-color: var(--accent-cyan); background: rgba(0,240,255,0.1); color: var(--accent-cyan); }

.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ed-action-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.ed-action-btn:hover { border-color: var(--accent-green); background: rgba(0,255,136,0.1); }

.editor-toast {
  position: fixed;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-green);
  border-radius: 8px;
  color: var(--accent-green);
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  transition: bottom 0.3s ease;
  z-index: 1000;
}
.editor-toast.show { bottom: 30px; }

/* ═══ Embed Section ═══ */
.embed-section h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.embed-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.embed-code-wrap {
  position: relative;
}

.embed-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent-green);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.embed-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
}
.embed-copy-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* ═══ Footer ═══ */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ═══ Editor / Embed Container Layout ═══ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.5rem; }
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ═══ Embed Page ═══ */
body.embed-body {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* ═══ Pixel grid overlay (subtle) ═══ */
.pixel-grid-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
  background-size: 4px 4px;
  z-index: 0;
}
