/* ============================================================
   CodeQuest Kids – style.css
   ============================================================ */

/* ---------- RESET & TOKENS ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ========================================================
   INTRO SPLASH SCREEN
   ======================================================== */
#introSplash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #04040f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity .7s ease, visibility .7s ease;
}
#introSplash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Particle canvas behind content */
#splashCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  animation: splashFadeUp .9s cubic-bezier(.22,1,.36,1) both;
}
@keyframes splashFadeUp {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Rocket orb */
.splash-logo-wrap {
  position: relative;
  width: 110px; height: 110px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.4rem;
}
.splash-rocket {
  font-size: 3rem;
  animation: rocketSpin 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(124,58,237,.8));
  position: relative; z-index: 2;
}
@keyframes rocketSpin {
  0%,100% { transform: translateY(0) rotate(-15deg); }
  50%      { transform: translateY(-12px) rotate(5deg); }
}
.splash-ring {
  position: absolute; border-radius: 50%; border-style: solid;
  border-color: transparent;
}
.splash-ring1 {
  width: 90px; height: 90px;
  border-width: 2px;
  border-top-color: rgba(124,58,237,.7);
  border-right-color: rgba(96,165,250,.5);
  animation: spinRing 2.5s linear infinite;
}
.splash-ring2 {
  width: 110px; height: 110px;
  border-width: 1.5px;
  border-bottom-color: rgba(236,72,153,.5);
  border-left-color: rgba(124,58,237,.3);
  animation: spinRing 4s linear infinite reverse;
}
@keyframes spinRing { to { transform: rotate(360deg); } }

/* CodeQuest Kids heading */
.splash-brand {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 50%, #f9a8d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.4rem;
  animation: glowPulse 2.5s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { filter: brightness(1); }
  50%      { filter: brightness(1.3) drop-shadow(0 0 12px rgba(167,139,250,.6)); }
}

/* Horizontal line */
.splash-line {
  width: 220px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,58,237,.8), rgba(96,165,250,.8), transparent);
  margin-bottom: 1.4rem;
  animation: lineGrow .8s cubic-bezier(.22,1,.36,1) .4s both;
}
@keyframes lineGrow {
  from { width: 0; opacity: 0; }
  to   { width: 220px; opacity: 1; }
}

/* "Developed by" */
.splash-presents {
  font-family: 'Nunito', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #6666aa;
  margin-bottom: .6rem;
  animation: fadeIn .6s ease .6s both;
}
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

/* Name — typewriter fills in via JS */
.splash-name {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: .06em;
  min-height: 2.4rem;
  text-shadow: 0 0 30px rgba(167,139,250,.7), 0 0 60px rgba(167,139,250,.3);
  margin-bottom: .75rem;
}
/* blinking cursor */
.splash-name::after {
  content: '|';
  color: #a78bfa;
  animation: blink .7s step-end infinite;
}
.splash-name.done::after { display: none; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

/* Developer badge */
.splash-title-badge {
  font-family: 'Nunito', sans-serif;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: .35rem 1.2rem;
  border-radius: 99px;
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(37,99,235,.25));
  border: 1px solid rgba(124,58,237,.5);
  color: #a78bfa;
  margin-top: .2rem;
  animation: fadeIn .5s ease 1.8s both;
}

/* Skip hint */
.splash-skip {
  margin-top: 2.8rem;
  font-size: .78rem;
  color: #33335a;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  transition: color .2s;
  animation: fadeIn .5s ease 2.2s both;
}
.splash-skip:hover { color: #6666aa; }

:root {
  --purple:    #7c3aed;
  --purple-lt: #a78bfa;
  --blue:      #2563eb;
  --blue-lt:   #60a5fa;
  --pink:      #ec4899;
  --pink-lt:   #f9a8d4;
  --yellow:    #f59e0b;
  --green:     #10b981;
  --red:       #ef4444;
  --bg:        #0a0a1a;
  --bg2:       #0f0f2e;
  --bg3:       #141440;
  --card:      rgba(255,255,255,0.05);
  --border:    rgba(255,255,255,0.1);
  --text:      #f0f0ff;
  --text-dim:  #9999cc;
  --radius:    1.2rem;
  --shadow:    0 20px 60px rgba(0,0,0,0.5);
  --font:      'Nunito', sans-serif;
  --font-hd:   'Orbitron', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 4px; }

/* ---------- THREE.JS BG CANVAS ---------- */
#heroCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- STARS ---------- */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
}
@keyframes twinkle {
  0%,100% { opacity: 0.15; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.4); }
}

/* ---------- NAVBAR ---------- */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  background: rgba(10,10,26,0.7);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}
#navbar.scrolled { background: rgba(10,10,26,0.95); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-hd);
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
}
.logo-icon { font-size: 1.6rem; animation: rocketBob 2s ease-in-out infinite; }
@keyframes rocketBob {
  0%,100% { transform: translateY(0) rotate(-20deg); }
  50%      { transform: translateY(-5px) rotate(-20deg); }
}
.logo-text { background: linear-gradient(135deg, var(--purple-lt), var(--blue-lt)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  transition: color .2s;
  letter-spacing: .05em;
}
.nav-links a:hover { color: var(--purple-lt); }

.nav-xp {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: rgba(124,58,237,.25);
  border: 1px solid var(--purple);
  border-radius: 99px;
  padding: .35rem 1rem;
  font-weight: 800;
  font-size: .95rem;
}
.xp-label { color: var(--purple-lt); }
.xp-value { color: var(--yellow); }

/* ---------- SECTIONS (common) ---------- */
section {
  position: relative;
  z-index: 10;
  padding: 6rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-badge {
  display: inline-block;
  background: rgba(124,58,237,.25);
  border: 1px solid var(--purple);
  color: var(--purple-lt);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .15em;
  padding: .35rem 1rem;
  border-radius: 99px;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-family: var(--font-hd);
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: .75rem;
}
.section-header p { color: var(--text-dim); font-size: 1.1rem; max-width: 540px; margin: 0 auto; }

.gradient-text {
  background: linear-gradient(135deg, var(--purple-lt) 0%, var(--blue-lt) 40%, var(--pink-lt) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- HERO ---------- */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: 8rem 4rem 4rem;
}
.hero-content { flex: 1; max-width: 600px; }
.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .15em;
  padding: .4rem 1.2rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(236,72,153,.5); } 50% { box-shadow: 0 0 0 10px rgba(236,72,153,0); } }

.hero-title {
  font-family: var(--font-hd);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}
.hero-sub { color: var(--text-dim); font-size: 1.2rem; line-height: 1.7; margin-bottom: 2.5rem; }

.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 3rem; }

.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  border: none;
  padding: .85rem 2rem;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 6px 30px rgba(124,58,237,.5);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(124,58,237,.7); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: transparent;
  color: var(--purple-lt);
  border: 2px solid var(--purple);
  padding: .83rem 2rem;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.btn-secondary:hover { background: rgba(124,58,237,.2); transform: translateY(-3px); }

.hero-stats { display: flex; gap: 2rem; }
.stat { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.stat-num { font-family: var(--font-hd); font-size: 2rem; font-weight: 900; color: var(--purple-lt); }
.stat-lbl { color: var(--text-dim); font-size: .85rem; font-weight: 700; }

/* 3D Hero container */
.hero-3d-container {
  position: relative;
  flex: 0 0 420px;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#characterCanvas { width: 340px !important; height: 340px !important; position: relative; z-index: 2; }

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  animation: orbit 6s linear infinite;
  pointer-events: none;
}
.ring1 { width: 300px; height: 300px; border-color: rgba(124,58,237,.4); animation-duration: 6s; }
.ring2 { width: 400px; height: 400px; border-color: rgba(96,165,250,.2); animation-duration: 10s; animation-direction: reverse; }
@keyframes orbit { from { transform: rotate(0deg) rotateX(60deg); } to { transform: rotate(360deg) rotateX(60deg); } }

.float-tag {
  position: absolute;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: .6rem;
  padding: .4rem .8rem;
  font-size: .85rem;
  font-weight: 800;
  color: var(--purple-lt);
  animation: floatTag 3s ease-in-out infinite;
  pointer-events: none;
}
.tag1 { top: 10%; left: 5%;  animation-delay: 0s; }
.tag2 { bottom: 20%; left: 0%;  animation-delay: 1s; }
.tag3 { top: 50%; right: 0%; animation-delay: 2s; }
@keyframes floatTag {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ---------- LESSONS GRID ---------- */
#lessons { background: linear-gradient(180deg, transparent, var(--bg2) 30%, var(--bg2) 70%, transparent); }

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.lesson-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  position: relative;
  overflow: hidden;
}
.lesson-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-color, linear-gradient(90deg, var(--purple), var(--blue)));
}
.lesson-card:hover { transform: translateY(-8px); box-shadow: var(--shadow); border-color: rgba(255,255,255,.25); }
.lesson-card.completed { border-color: var(--green); }
.lesson-card.completed::before { background: linear-gradient(90deg, var(--green), #34d399); }
.lesson-card.locked { opacity: .5; cursor: not-allowed; }

.lesson-emoji { font-size: 2.5rem; margin-bottom: .8rem; display: block; }
.lesson-level-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  padding: .25rem .7rem;
  border-radius: 99px;
  margin-bottom: .8rem;
}
.badge-easy   { background: rgba(16,185,129,.2); color: var(--green); border: 1px solid var(--green); }
.badge-medium { background: rgba(245,158,11,.2); color: var(--yellow); border: 1px solid var(--yellow); }
.badge-hard   { background: rgba(239,68,68,.2);  color: var(--red);    border: 1px solid var(--red); }

.lesson-title { font-size: 1.15rem; font-weight: 800; margin-bottom: .4rem; }
.lesson-desc  { font-size: .88rem; color: var(--text-dim); line-height: 1.5; }
.lesson-xp    { margin-top: 1rem; font-size: .82rem; color: var(--yellow); font-weight: 700; }
.lesson-status { position: absolute; top: 1rem; right: 1rem; font-size: 1.2rem; }

/* ---------- PLAYGROUND ---------- */
#playground { background: linear-gradient(180deg, transparent, var(--bg3) 30%, var(--bg3) 70%, transparent); }

.lab-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1300px;
  margin: 0 auto;
  height: 600px;
}

.lab-editor, .lab-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Editor */
.editor-topbar, .preview-topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.2rem;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  font-weight: 700;
}
.editor-dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }
.editor-title, .preview-title { flex: 1; color: var(--text-dim); }

.run-btn {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  border: none;
  padding: .3rem .9rem;
  border-radius: .5rem;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.run-btn:hover { transform: scale(1.07); }

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0d0d1f;
}
.line-numbers {
  padding: 1rem .6rem;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: #555577;
  text-align: right;
  user-select: none;
  line-height: 1.6;
  min-width: 2.5rem;
  border-right: 1px solid var(--border);
  white-space: pre;
}
#codeEditor {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #e0e0ff;
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  line-height: 1.6;
  padding: 1rem;
  tab-size: 2;
  caret-color: var(--purple-lt);
}

.editor-footer {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: rgba(0,0,0,.2);
  border-top: 1px solid var(--border);
  font-size: .82rem;
}
.tool-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: .3rem .7rem;
  border-radius: .4rem;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.tool-btn:hover { background: rgba(124,58,237,.25); color: var(--purple-lt); }
.char-count { margin-left: auto; color: #555577; }

/* Preview */
.preview-topbar { gap: .5rem; }
.preview-icon { font-size: 1.1rem; }
.preview-lights { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.light { width: 10px; height: 10px; border-radius: 50%; }
.light-green { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.preview-3d-bar {
  height: 80px;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
}
#previewCanvas3D { width: 70px !important; height: 70px !important; }
.preview-3d-label { font-size: .78rem; color: var(--text-dim); font-weight: 700; }

#previewFrame {
  flex: 1;
  border: none;
  background: #fff;
  width: 100%;
}
.preview-footer {
  padding: .5rem 1rem;
  background: rgba(0,0,0,.2);
  font-size: .78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---------- ACHIEVEMENTS ---------- */
#achievements { background: linear-gradient(180deg, transparent, var(--bg2) 30%, var(--bg2) 70%, transparent); }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto 3rem;
}
.achievement-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: transform .25s, box-shadow .25s;
  position: relative;
}
.achievement-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.achievement-card.earned { border-color: var(--yellow); }
.achievement-card.earned::after {
  content: '✓';
  position: absolute; top: .5rem; right: .7rem;
  color: var(--yellow);
  font-weight: 900;
  font-size: .9rem;
}
.achievement-card.locked { filter: grayscale(1); opacity: .4; }

.ach-emoji { font-size: 2.8rem; display: block; margin-bottom: .7rem; }
.ach-name  { font-size: .88rem; font-weight: 800; margin-bottom: .3rem; }
.ach-desc  { font-size: .75rem; color: var(--text-dim); line-height: 1.4; }

.level-progress {
  max-width: 600px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
}
.level-info {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: .8rem;
}
.level-label { color: var(--purple-lt); font-size: 1rem; }
.level-xp    { color: var(--text-dim); font-size: .9rem; }
.progress-bar-wrap {
  height: 16px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue-lt));
  border-radius: 99px;
  width: 0%;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 10px var(--purple);
}

/* ---------- MISSION MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: linear-gradient(145deg, #0f0f2e, #141440);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 1.6rem;
  padding: 2.5rem;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: modalIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn { from { transform: scale(.8) translateY(40px); opacity:0; } to { transform: scale(1) translateY(0); opacity:1; } }

.modal-close {
  position: absolute; top: 1.2rem; right: 1.5rem;
  background: rgba(255,255,255,.1); border: none;
  color: var(--text-dim); font-size: 1.1rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  cursor: pointer; transition: background .2s;
}
.modal-close:hover { background: rgba(239,68,68,.3); color: var(--red); }

.modal-3d { text-align: center; margin-bottom: 1rem; }
#modalCanvas3D { width: 100px !important; height: 100px !important; }
.modal-badge { text-align: center; font-size: 3rem; margin-bottom: .5rem; }

.modal-box h3 {
  font-family: var(--font-hd);
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: .5rem;
  background: linear-gradient(135deg, var(--purple-lt), var(--blue-lt));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.modal-box > p { text-align: center; color: var(--text-dim); margin-bottom: 1.5rem; }

.modal-challenge {
  background: rgba(124,58,237,.1);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: .8rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text);
}
.modal-challenge code {
  background: rgba(255,255,255,.1);
  border-radius: .3rem;
  padding: .1rem .4rem;
  font-family: 'Courier New', monospace;
  color: var(--purple-lt);
}

.modal-editor-wrap {
  border: 1px solid var(--border);
  border-radius: .8rem;
  overflow: hidden;
  margin-bottom: 1rem;
}
#missionEditor {
  width: 100%;
  height: 140px;
  background: #0d0d1f;
  border: none;
  outline: none;
  color: #e0e0ff;
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  line-height: 1.6;
  padding: 1rem;
  resize: none;
}
#missionEditor::placeholder { color: #444466; }

.modal-preview-wrap {
  border: 1px solid var(--border);
  border-radius: .8rem;
  overflow: hidden;
  height: 150px;
  margin-bottom: 1.2rem;
}
#missionPreview { width: 100%; height: 100%; border: none; }

.modal-actions { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.modal-feedback {
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  min-height: 1.5rem;
  border-radius: .6rem;
  padding: .5rem;
}
.feedback-success { color: var(--green); background: rgba(16,185,129,.1); }
.feedback-error   { color: var(--red);   background: rgba(239,68,68,.1); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  padding: .8rem 2rem;
  border-radius: 99px;
  font-size: .95rem;
  font-weight: 800;
  z-index: 3000;
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .4s;
  opacity: 0;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(124,58,237,.6);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- CONFETTI CANVAS ---------- */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ---------- TUTORIAL SECTION ---------- */
#tutorial {
  background: linear-gradient(180deg, transparent, var(--bg2) 30%, var(--bg2) 70%, transparent);
  padding-bottom: 4rem;
}

.tutorial-card-wrap {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
}

/* Corner thanks badge */
.thanks-badge {
  position: absolute;
  top: -1.1rem; right: -1rem;
  z-index: 20;
  background: linear-gradient(135deg, var(--yellow), #f97316);
  color: #1a1a00;
  font-size: .75rem;
  font-weight: 800;
  padding: .35rem .9rem;
  border-radius: 99px;
  box-shadow: 0 4px 20px rgba(245,158,11,.5);
  white-space: nowrap;
  letter-spacing: .03em;
}
.thanks-channel { font-weight: 600; opacity: .85; }

/* Card link */
.tutorial-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform .28s, box-shadow .28s, border-color .28s;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.tutorial-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(124,58,237,.35);
  border-color: rgba(124,58,237,.5);
}

/* Thumbnail wrapper */
.tut-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050510;
}
.tut-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.tutorial-card:hover .tut-thumb { transform: scale(1.04); }

/* Dark gradient overlay */
.tut-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,10,26,.8) 0%, rgba(10,10,26,.1) 60%, transparent 100%);
  pointer-events: none;
}

/* Big play button */
.tut-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 72px; height: 72px;
  transition: transform .25s, opacity .25s;
  opacity: .9;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,.6));
}
.tut-play svg { width: 72px; height: 72px; }
.tutorial-card:hover .tut-play { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }

/* YouTube badge (bottom-left of thumb) */
.tut-yt-badge {
  position: absolute;
  bottom: .75rem; left: .85rem;
  display: flex; align-items: center; gap: .4rem;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  padding: .3rem .75rem;
  font-size: .78rem; font-weight: 800;
  color: #fff; letter-spacing: .03em;
}

/* Info strip below thumbnail */
.tut-info {
  padding: 1.2rem 1.5rem 1.4rem;
}
.tut-tag {
  font-size: .72rem; font-weight: 800; letter-spacing: .1em;
  color: var(--blue-lt);
  text-transform: uppercase; margin-bottom: .5rem;
}
.tut-title {
  font-family: var(--font-hd);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: .75rem;
  background: linear-gradient(135deg, #fff 60%, var(--purple-lt));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tut-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-size: .83rem; color: var(--text-dim); font-weight: 700;
}

/* ---------- FOOTER ---------- */
#site-footer {
  position: relative; z-index: 10;
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  background: rgba(5,5,20,.6);
}
.footer-inner { max-width: 700px; margin: 0 auto; }
.footer-logo {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-hd); font-size: 1.2rem; font-weight: 900;
  margin-bottom: .6rem;
}
.footer-brand {
  background: linear-gradient(135deg, var(--purple-lt), var(--blue-lt));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.footer-copy { color: var(--text-dim); font-size: .88rem; margin-bottom: .8rem; }
.footer-thanks {
  font-size: .82rem; color: var(--text-dim); font-weight: 700;
}
.footer-thanks a {
  color: var(--yellow); text-decoration: none; font-weight: 800;
  transition: color .2s;
}
.footer-thanks a:hover { color: #fcd34d; }

/* Footer creator cards */
.footer-creators {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .8rem;
  margin: 1.2rem 0 1rem;
}
.creator-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.2rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: transform .2s, box-shadow .2s;
}
.creator-card:hover { transform: translateY(-3px); }
.creator-main {
  border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 18px rgba(124,58,237,.15);
}
.creator-main:hover { box-shadow: 0 6px 28px rgba(124,58,237,.35); }
.creator-co {
  border-color: rgba(37,99,235,.4);
  box-shadow: 0 0 18px rgba(37,99,235,.12);
}
.creator-co:hover { box-shadow: 0 6px 28px rgba(37,99,235,.3); }
.creator-icon { font-size: 1.4rem; }
.creator-name {
  font-family: 'Nunito', sans-serif;
  font-size: .9rem;
  font-weight: 900;
  color: var(--text);
}
.creator-role {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.creator-main .creator-role { color: var(--purple-lt); }
.creator-co  .creator-role { color: var(--blue-lt); }
.creator-divider {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-dim);
  padding: 0 .2rem;
}

@media (max-width: 1024px) {
  .lab-container { grid-template-columns: 1fr; height: auto; }
  #previewFrame { height: 300px; }
}
@media (max-width: 768px) {
  #hero { flex-direction: column; padding: 7rem 1.5rem 3rem; text-align: center; }
  .hero-buttons { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-3d-container { flex: none; width: 100%; height: 300px; }
  #navbar { padding: 1rem 1.5rem; }
  .nav-links { display: none; }
  .ring2 { display: none; }
}
