:root {
  --bg-dark: #0a0d18;
  --bg-card: #121829;
  --bg-card-hover: #19223a;
  --bg-surface: rgba(18, 24, 41, 0.85);
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --pink: #ff007f;
  --pink-glow: rgba(255, 0, 127, 0.35);
  --purple: #9d4edd;
  --yellow: #ffd60a;
  --text-main: #f3f6fa;
  --text-muted: #8b9bb4;
  --border: rgba(0, 240, 255, 0.18);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(0, 240, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(255, 0, 127, 0.07) 0%, transparent 45%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  overflow-x: hidden;
}

/* Header & Nav */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 13, 24, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 2rem;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 16px var(--cyan-glow);
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo-text span {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  position: relative;
  width: 280px;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Main Container */
.main-content {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 2rem 4rem;
}

/* Hero Section */
.hero-banner {
  position: relative;
  background: linear-gradient(135deg, rgba(18, 24, 41, 0.95), rgba(25, 34, 58, 0.7)),
              url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><path d="M30 0l30 30-30 30L0 30z" fill="rgba(0,240,255,0.02)"/></svg>');
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, var(--pink-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-tag {
  display: inline-block;
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.8rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 40%, var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-muted);
  max-width: 540px;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #00a8ff);
  color: #050a14;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 0 20px var(--cyan-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.6);
}

.hero-badges {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.hero-badge-item {
  display: flex;
  flex-direction: column;
}

.badge-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
}

.badge-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Category Filters */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.filter-btn-horror {
  border-color: rgba(255, 51, 102, 0.4) !important;
  background: rgba(255, 51, 102, 0.08) !important;
  color: #ff3366 !important;
}

.filter-btn-horror:hover {
  background: rgba(255, 51, 102, 0.18) !important;
  border-color: #ff3366 !important;
  color: #ff5588 !important;
}

.filter-btn-horror.active {
  background: rgba(255, 51, 102, 0.25) !important;
  border-color: #ff3366 !important;
  color: #ff5588 !important;
  box-shadow: 0 0 16px rgba(255, 51, 102, 0.6) !important;
}

/* Game Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-md);
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.6), transparent 50%, rgba(255, 0, 127, 0.6));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.game-card:hover::before {
  opacity: 1;
}

.game-card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 26px var(--cyan-glow);
}

.card-thumb {
  width: 100%;
  height: 180px;
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.card-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(18, 24, 41, 0.95));
}

.card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 13, 24, 0.85);
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  backdrop-filter: blur(4px);
}

.card-rating {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10, 13, 24, 0.85);
  color: var(--yellow);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  flex: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-subtle);
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-play-btn {
  background: rgba(0, 240, 255, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.game-card:hover .card-play-btn {
  background: var(--cyan);
  color: #050a14;
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Game Theater Modal */
.theater-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 7, 13, 0.92);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.theater-modal.active {
  display: flex;
}

.theater-container {
  width: 100%;
  max-width: 980px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px var(--cyan-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.theater-header {
  padding: 0.9rem 1.5rem;
  background: rgba(10, 13, 24, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theater-title-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theater-game-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.theater-hud-score {
  font-size: 0.95rem;
  color: var(--yellow);
  font-weight: 700;
  background: rgba(255, 214, 10, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 214, 10, 0.3);
}

.theater-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theater-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.theater-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.theater-btn-close {
  background: rgba(255, 0, 127, 0.15);
  border-color: rgba(255, 0, 127, 0.3);
  color: var(--pink);
}

.theater-btn-close:hover {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
  box-shadow: 0 0 12px var(--pink-glow);
}

/* Canvas Viewport */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #04060d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
}

.canvas-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.22) 50%),
    radial-gradient(circle at center, transparent 70%, rgba(0, 0, 0, 0.45) 100%);
  background-size: 100% 4px, 100% 100%;
  z-index: 5;
  opacity: 0.55;
}

#gameCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.theater-footer {
  padding: 0.8rem 1.5rem;
  background: rgba(10, 13, 24, 0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.control-tips kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--cyan);
  font-family: inherit;
  font-size: 0.8rem;
  margin: 0 0.15rem;
}

/* Leaderboard Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px var(--cyan-glow);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.leaderboard-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rank-pill {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.rank-1 { background: var(--yellow); color: #000; box-shadow: 0 0 8px rgba(255, 214, 10, 0.5); }
.rank-2 { background: #b0bec5; color: #000; }
.rank-3 { background: #cd7f32; color: #fff; }

.score-highlight {
  color: var(--cyan);
  font-weight: 700;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--cyan-glow);
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   CyberForge AI Game Studio Styles
   ========================================================================== */
.btn-ai-glow {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: 1px solid rgba(255, 0, 127, 0.4);
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 0 16px var(--pink-glow);
  transition: all 0.25s ease;
}

.btn-ai-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(255, 0, 127, 0.65);
  border-color: var(--pink);
}

/* AI Studio Modal */
.ai-studio-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5, 7, 14, 0.94);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.ai-studio-modal.active {
  display: flex;
}

.ai-studio-container {
  width: 100%;
  max-width: 1140px;
  max-height: 92vh;
  background: var(--bg-card);
  border: 1px solid rgba(157, 78, 221, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(157, 78, 221, 0.35);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ai-studio-header {
  padding: 1rem 1.8rem;
  background: rgba(10, 13, 24, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-studio-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
}

.ai-studio-title span {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ai-studio-body {
  padding: 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Prompt Controls */
.ai-prompt-box {
  background: rgba(10, 13, 24, 0.7);
  border: 1px solid rgba(157, 78, 221, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.ai-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.ai-prompt-header h3 {
  font-size: 1.05rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* AI Tuning Controls Toolbar */
.ai-tuning-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  background: rgba(5, 7, 14, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  align-items: center;
}

.ai-tune-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 170px;
}

.ai-tune-item label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.ai-tune-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-tune-select:focus,
.ai-tune-select:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.ai-tune-range {
  accent-color: var(--cyan);
  cursor: pointer;
  height: 6px;
}

.ai-prompt-input-wrapper {
  position: relative;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ai-prompt-input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.ai-prompt-input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 14px rgba(157, 78, 221, 0.4);
}

/* Preset Chips */
.ai-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ai-chip-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.ai-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.ai-chip:hover {
  background: rgba(157, 78, 221, 0.2);
  border-color: var(--purple);
  color: var(--text-main);
}

/* Compilation Terminal */
.ai-terminal {
  background: #04060c;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #00ff88;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.5;
  display: none;
}

.ai-terminal.active {
  display: block;
}

.ai-terminal .term-line {
  margin-bottom: 0.2rem;
}

.ai-terminal .term-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #00ff88;
  animation: blinkCursor 0.8s infinite;
  vertical-align: middle;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Studio Workspace Split-View */
.studio-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-height: 380px;
}

.studio-pane {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.studio-pane-header {
  padding: 0.65rem 1rem;
  background: rgba(10, 13, 24, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sandbox-canvas-wrapper {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

#aiSandboxCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

#aiSandboxCanvas:focus {
  outline: none;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.45);
}

.code-inspector-wrapper {
  flex: 1;
  max-height: 340px;
  overflow: auto;
  background: #060912;
  padding: 1rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #8b9bb4;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-inspector-editor {
  flex: 1;
  min-height: 320px;
  max-height: 360px;
  background: #060912;
  border: none;
  padding: 1rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #a5b4fc;
  resize: vertical;
  white-space: pre;
  tab-size: 2;
  overflow: auto;
  outline: none;
}

.code-inspector-editor:focus {
  background: #040710;
  box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.12);
}

/* AI Creation Tag */
.card-tag-ai {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.9), rgba(255, 0, 127, 0.9)) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.6);
}

/* 2-Player & Multiplayer Badges and Filters */
.filter-btn-multiplayer.active {
  background: var(--pink) !important;
  color: #fff !important;
  border-color: var(--pink) !important;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.6) !important;
}

.card-tag-multiplayer {
  background: linear-gradient(135deg, #ff007f, #9d4edd) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.6);
}

/* External AI Importer */
.importer-drop-zone {
  border: 2px dashed rgba(0, 240, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 1.4rem;
  text-align: center;
  background: rgba(0, 240, 255, 0.03);
  cursor: pointer;
  transition: all 0.25s ease;
}

.importer-drop-zone:hover,
.importer-drop-zone.dragover {
  border-color: var(--green);
  background: rgba(0, 255, 136, 0.08);
  transform: translateY(-2px);
}

.importer-icon-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.importer-icon-chip:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--cyan);
  transform: scale(1.1);
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 1rem; }
  .main-content { padding: 0 1rem 3rem; }
  .search-box { width: 180px; }
  .hero-banner {
    flex-direction: column;
    padding: 2rem 1.5rem;
    text-align: center;
  }
  .hero-title { font-size: 1.8rem; }
  .hero-badges { justify-content: center; }
  .games-grid { grid-template-columns: 1fr; }
  .theater-modal { padding: 0.5rem; }
  .studio-workspace { grid-template-columns: 1fr; }
  .ai-prompt-input-wrapper { flex-direction: column; }
}
