:root {
  --bg: #0d0b16;
  --bg2: #15122a;
  --panel: #1c1834;
  --panel2: #241f42;
  --ink: #e8e4f8;
  --ink-dim: #9a92c4;
  --line: #322b58;
  --purple: #9d4edd;
  --purple-bright: #c77dff;
  --pink: #ff2e88;
  --cyan: #21e6ff;
  --green: #3ddc84;
  --gold: #ffcf40;
  --red: #ff5c5c;
  --shadow: rgba(0,0,0,0.5);
}

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

body {
  font-family: 'VT323', monospace;
  font-size: 20px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(157,78,221,0.25), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(33,230,255,0.10), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.4;
  overflow-x: hidden;
}

/* subtle scanlines */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.13) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* ===== HUD ===== */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-bottom: 3px solid var(--line);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  position: sticky; top: 0; z-index: 100;
  flex-wrap: wrap;
}
.logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,207,64,0.6), 2px 2px 0 var(--pink);
  letter-spacing: 1px;
}
.hud-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hud-nav-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 8px 11px;
  border: 2px solid var(--line);
  border-radius: 6px;
  transition: all 0.15s;
}
.hud-nav-link:hover { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 12px rgba(33,230,255,0.3); }
.hud-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
}
.stat-icon { font-size: 13px; }
.xp-stat .stat-icon { color: var(--gold); }
.level-stat .stat-icon { color: var(--cyan); }
.streak-stat .stat-icon { color: var(--pink); }
.icon-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  background: var(--bg2); color: var(--ink-dim);
  border: 2px solid var(--line); border-radius: 6px;
  width: 34px; height: 34px; cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }

/* XP BAR */
.xp-bar-wrap {
  position: relative;
  height: 22px;
  background: var(--bg);
  border-bottom: 3px solid var(--line);
}
.xp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  box-shadow: 0 0 16px rgba(255,46,136,0.6);
  transition: width 0.5s cubic-bezier(.2,.8,.2,1);
}
.xp-bar-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 1px;
}

/* ===== LAYOUT ===== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  gap: 18px;
  padding: 18px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

/* Panel titles */
.panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

/* ===== QUEST MAP ===== */
.questmap {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  position: sticky; top: 92px;
}
.chapter-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--purple-bright);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.chapter-label:first-child { margin-top: 0; }
.map-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  margin-bottom: 4px;
  transition: all 0.15s;
  font-size: 19px;
}
.map-item:hover { background: var(--panel2); border-color: var(--line); }
.map-item.active {
  background: linear-gradient(90deg, rgba(157,78,221,0.35), transparent);
  border-color: var(--purple);
  box-shadow: 0 0 14px rgba(157,78,221,0.4);
}
.map-item.locked { opacity: 0.45; cursor: not-allowed; }
.map-item.done .map-icon { filter: none; }
.map-icon { font-size: 17px; width: 22px; text-align: center; }
.map-name { flex: 1; }
.map-status { font-size: 16px; }
.map-item.done .map-status { color: var(--green); }
.map-item.locked .map-status { color: var(--ink-dim); }
.map-item.isboss { border-color: var(--red); }
.map-item.isboss.active { background: linear-gradient(90deg, rgba(255,92,92,0.3), transparent); }

/* ===== STAGE ===== */
.stage {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  min-height: 500px;
}
.lesson-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.lesson-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(20px, 2.4vw, 27px);
  color: var(--ink);
  line-height: 1.2;
  display: flex; align-items: center; gap: 10px;
}
.lesson-icon { font-size: 1.1em; }
.lesson-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--bg2);
  border: 2px solid var(--line);
  color: var(--purple-bright);
  letter-spacing: 1px;
}
.xp-chip { color: var(--gold); border-color: #6b5a1a; }

.brief {
  font-size: 21px;
  color: var(--ink);
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--bg2);
  border-left: 4px solid var(--cyan);
  border-radius: 6px;
}
.brief code {
  font-family: 'Fira Code', monospace;
  font-size: 16px;
  background: #0a0818;
  color: var(--cyan);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.concept {
  font-size: 18px;
  color: var(--ink-dim);
  margin-bottom: 16px;
  padding-left: 4px;
  font-style: italic;
}
.concept:empty { display: none; }

/* EDITOR */
.editor-wrap {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #0a0818;
}
.editor-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--panel2);
  border-bottom: 2px solid var(--line);
}
.dots { display: flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.dots i:nth-child(1) { background: var(--red); }
.dots i:nth-child(2) { background: var(--gold); }
.dots i:nth-child(3) { background: var(--green); }
.editor-file {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: var(--ink-dim);
  flex: 1;
}
.hint-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: var(--bg);
  color: var(--gold);
  border: 2px solid #6b5a1a;
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.hint-btn:hover { background: #6b5a1a; color: #fff; }
.hint-box {
  display: none;
  font-size: 17px;
  color: var(--gold);
  background: rgba(255,207,64,0.08);
  border-bottom: 2px solid var(--line);
  padding: 10px 14px;
  line-height: 1.5;
}
.hint-box.show { display: block; }
.hint-box code {
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  background: #0a0818; color: var(--cyan);
  padding: 1px 5px; border-radius: 4px;
}
#editor {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  background: #0a0818;
  color: var(--green);
  font-family: 'Fira Code', monospace;
  font-size: 15px;
  line-height: 1.6;
  border: none;
  outline: none;
  padding: 14px;
  tab-size: 2;
}
#editor::selection { background: rgba(157,78,221,0.5); }

/* ACTIONS */
.actions { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 14px 22px;
  border-radius: 8px;
  border: 3px solid;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.15s;
  text-transform: uppercase;
}
.btn-run {
  background: linear-gradient(180deg, var(--purple), #6a1fb0);
  border-color: var(--purple-bright);
  color: #fff;
  box-shadow: 0 5px 0 #4a1580;
}
.btn-run:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #4a1580; }
.btn-run:active { transform: translateY(3px); box-shadow: 0 2px 0 #4a1580; }
.btn-next {
  background: linear-gradient(180deg, var(--green), #1f9e5c);
  border-color: #6affb0;
  color: #05230d;
  box-shadow: 0 5px 0 #14703f;
}
.btn-next:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 #14703f; }
.btn-next:disabled {
  background: var(--bg2); border-color: var(--line); color: var(--ink-dim);
  box-shadow: none; cursor: not-allowed;
}

/* OUTPUT */
.output {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #06040f;
}
.output-head {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--ink-dim);
  padding: 8px 12px;
  background: var(--panel2);
  border-bottom: 2px solid var(--line);
  letter-spacing: 1px;
}
.output-body {
  padding: 14px;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.7;
  max-height: 300px;
  overflow-y: auto;
}
.output-body .dim { color: var(--ink-dim); }
.test-line { padding: 3px 0; display: flex; gap: 8px; align-items: flex-start; }
.test-pass { color: var(--green); }
.test-fail { color: var(--red); }
.test-info { color: var(--cyan); }
.test-warn { color: var(--gold); }
.test-detail { color: var(--ink-dim); font-size: 13px; padding-left: 22px; }
.summary { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 16px; }

/* ===== BADGES PANEL ===== */
.badges-panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  position: sticky; top: 92px;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.badge {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  background: var(--bg2);
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 24px;
  filter: grayscale(1) opacity(0.35);
  transition: all 0.3s;
  cursor: help;
  position: relative;
}
.badge.unlocked {
  filter: none;
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255,207,64,0.4);
  background: linear-gradient(180deg, #2a2145, var(--panel2));
}
.badge .badge-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.4;
  padding: 0 2px;
}
.badge.unlocked .badge-label { color: var(--gold); }

.progress-ring-wrap { position: relative; width: 130px; margin: 0 auto; }
.ring { width: 130px; height: 130px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-fg {
  fill: none; stroke: url(#g); stroke-width: 10; stroke-linecap: round;
  stroke: var(--cyan);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.8s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(0 0 6px var(--cyan));
}
.ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-label span {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px; color: var(--cyan);
}
.ring-label small {
  font-size: 13px; color: var(--ink-dim); margin-top: 2px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,4,15,0.85);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 3px solid var(--gold);
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 0 60px rgba(255,207,64,0.4), 0 20px 60px rgba(0,0,0,0.7);
  animation: pop 0.35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-burst { font-size: 64px; margin-bottom: 10px; animation: spin 0.6s; }
@keyframes spin { from { transform: rotate(-20deg) scale(0.5); } to { transform: rotate(0) scale(1); } }
.modal h2 {
  font-family: 'Cinzel', serif;
  font-size: 28px; color: var(--gold);
  margin-bottom: 8px;
}
.modal p { color: var(--ink-dim); font-size: 19px; margin-bottom: 16px; }
.modal-xp {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px; color: var(--green);
  margin-bottom: 22px;
  text-shadow: 0 0 14px rgba(61,220,132,0.7);
}
.modal .btn-run { width: 100%; }

/* ===== FOOT ===== */
.foot {
  text-align: center;
  padding: 30px 20px 40px;
  color: var(--ink-dim);
  font-size: 17px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.home-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--cyan);
  text-decoration: none;
  border: 2px solid var(--line);
  padding: 10px 16px;
  border-radius: 6px;
  transition: all 0.15s;
}
.home-link:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(33,230,255,0.4); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 220px 1fr; }
  .badges-panel { grid-column: 1 / -1; position: static; }
  .badge-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 18px; }
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .questmap { position: static; }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .logo { font-size: 11px; }
  .stat { font-size: 8px; padding: 6px 8px; }
  .hud { padding: 10px 12px; }
  .lesson-title { font-size: 21px; }
  .editor-bar { flex-wrap: wrap; }
  #editor { min-height: 200px; font-size: 14px; }
}

/* ===== ACCOUNT / AUTH ===== */
.acct-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: var(--bg2);
  color: var(--cyan);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.acct-btn:hover { border-color: var(--cyan); box-shadow: 0 0 12px rgba(33,230,255,0.35); }
.acct-btn.logged-in {
  color: var(--green);
  border-color: #1f7a4a;
  text-transform: none;
  font-family: 'VT323', monospace;
  font-size: 16px;
}
.acct-btn.logged-in:hover { border-color: var(--green); box-shadow: 0 0 12px rgba(61,220,132,0.35); }

.auth-modal { position: relative; max-width: 380px; text-align: left; }
.auth-modal h2 { text-align: center; }
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--bg);
  border-radius: 8px;
  padding: 5px;
}
.auth-tab {
  flex: 1;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 10px 6px;
  background: transparent;
  color: var(--ink-dim);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active {
  background: linear-gradient(180deg, var(--purple), #6a1fb0);
  color: #fff;
  box-shadow: 0 0 12px rgba(157,78,221,0.5);
}
.auth-sub {
  text-align: center;
  font-size: 17px;
  color: var(--ink-dim);
  margin-bottom: 16px;
}
.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--gold);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.auth-field input {
  width: 100%;
  font-family: 'Fira Code', monospace;
  font-size: 15px;
  padding: 11px 12px;
  background: #0a0818;
  border: 2px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.auth-field input:focus { border-color: var(--purple-bright); }
.auth-msg {
  font-size: 16px;
  min-height: 0;
  margin-bottom: 8px;
  text-align: center;
}
.auth-msg.error { color: var(--red); }
.auth-msg.ok { color: var(--green); }
.auth-logout {
  width: 100%;
  margin-top: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 12px;
  background: transparent;
  color: var(--red);
  border: 2px solid #6b2a2a;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-logout:hover { background: rgba(255,92,92,0.12); }
.auth-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none; border: none;
  color: var(--ink-dim);
  font-size: 18px; cursor: pointer;
  font-family: 'VT323', monospace;
}
.auth-close:hover { color: var(--red); }

/* ================= TRACK SELECTOR ================= */
.tracks {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.track-tab {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  top: 1px;
}
.track-tab small { font-size: 10px; color: var(--purple-bright); font-family: "Fira Code", monospace; }
.track-tab:hover { color: var(--ink); background: var(--panel2); }
.track-tab.active {
  color: var(--gold);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-color: var(--gold);
  box-shadow: 0 -3px 12px rgba(255,207,64,0.15);
}

/* ================= CODE SNIPPET (predict/quiz PHP/SQL) ================= */
.snippet-wrap {
  background: #0a0812;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 4px;
}
.snippet-bar {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}
.snippet-bar .editor-file {
  font-family: "Fira Code", monospace;
  font-size: 12px;
  color: var(--cyan);
  text-transform: lowercase;
}
.snippet {
  font-family: "Fira Code", monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: #d7f0ff;
  padding: 16px 18px;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

/* ================= QUIZ ================= */
.quiz-wrap { margin-top: 6px; }
.quiz-question {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  background: var(--panel2);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14.5px;
  font-family: inherit;
  transition: all 0.13s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--purple-bright); background: var(--panel); transform: translateX(3px); }
.quiz-opt:disabled { cursor: default; }
.quiz-letter {
  flex: 0 0 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--gold);
}
.quiz-text { flex: 1; line-height: 1.45; }
.quiz-opt.picked { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.quiz-opt.correct { border-color: var(--green); background: rgba(61,220,132,0.12); }
.quiz-opt.correct .quiz-letter { background: var(--green); color: #06210f; border-color: var(--green); }
.quiz-opt.wrong { border-color: var(--red); background: rgba(255,92,92,0.12); }
.quiz-opt.wrong .quiz-letter { background: var(--red); color: #2a0808; border-color: var(--red); }

@media (max-width: 640px) {
  .track-tab { font-size: 12px; padding: 9px 12px; }
  .track-tab small { display: none; }
  .snippet { font-size: 12px; padding: 12px; }
}

/* ===== SIGN-IN GATE ===== */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(120,80,220,0.35), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(20,120,180,0.30), transparent 60%),
    #0b0a14;
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.auth-gate[hidden] { display: none; }
.auth-gate-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(28,24,48,0.98), rgba(18,15,32,0.98));
  border: 1px solid rgba(150,120,255,0.35);
  border-radius: 16px;
  padding: 28px 26px 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03) inset;
  text-align: center;
}
.auth-gate-logo {
  font-family: "Press Start 2P", monospace;
  font-size: 15px;
  color: var(--gold, #f5c451);
  margin-bottom: 18px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
}
.auth-gate-title {
  font-family: "Cinzel", serif;
  font-size: 26px;
  margin: 0 0 10px;
  color: #fff;
}
.auth-gate-sub {
  font-size: 14px;
  line-height: 1.5;
  color: #b9b3d0;
  margin: 0 0 20px;
}
.auth-gate .auth-tabs,
.auth-gate .auth-field,
.auth-gate .auth-msg,
.auth-gate #gateSubmit { text-align: left; }
.auth-gate .auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-gate .auth-tab {
  flex: 1; padding: 10px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line, #2a2540);
  color: #e6e1f5; font-weight: 600; font-size: 13px; transition: all .15s;
}
.auth-gate .auth-tab:hover { background: rgba(255,255,255,0.11); color: #fff; }
.auth-gate .auth-tab.active {
  background: rgba(150,120,255,0.22); border-color: var(--cyan, #4dd8ff); color: #fff;
}
.auth-gate .auth-field { margin-bottom: 14px; }
.auth-gate .auth-field label {
  display: block; font-size: 12px; color: #a79fc4; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.auth-gate .auth-field input {
  width: 100%; box-sizing: border-box; padding: 11px 13px; border-radius: 8px;
  background: #0e0c1a; border: 1px solid var(--line, #2a2540); color: #fff;
  font-size: 15px; outline: none; transition: border-color .15s;
}
.auth-gate .auth-field input:focus { border-color: var(--cyan, #4dd8ff); }
.auth-gate .auth-msg { min-height: 18px; font-size: 13px; margin: 4px 0 12px; color: #a79fc4; }
.auth-gate .auth-msg.error { color: var(--red, #ff5c5c); }
.auth-gate .auth-msg.ok { color: var(--green, #3ddc84); }
.auth-gate #gateSubmit { width: 100%; justify-content: center; }
