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

:root {
  --bg-primary: #0a0b1a;
  --bg-secondary: #101126;
  --bg-card: #181a30;
  --bg-card-hover: #1e2040;
  --text-primary: #eef0f8;
  --text-secondary: #8a8fb0;
  --text-muted: #555b85;
  --accent-1: #7c5cfc;
  --accent-2: #00d4c0;
  --accent-3: #ff6b9d;
  --accent-4: #f5c842;
  --gradient-main: linear-gradient(135deg, #7c5cfc, #00d4c0);
  --gradient-warm: linear-gradient(135deg, #ff6b9d, #f5c842);
  --gradient-dark: linear-gradient(180deg, #0a0b1a, #101126);
  --glow-purple: 0 0 24px rgba(124,92,252,0.25);
  --glow-teal: 0 0 24px rgba(0,212,192,0.25);
  --glow-warm: 0 0 24px rgba(255,107,157,0.2);
  --border-color: rgba(124,92,252,0.12);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --shadow-card: 0 8px 40px rgba(0,0,0,0.45);
  --shadow-lg: 0 20px 70px rgba(0,0,0,0.55);
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* LOADER */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  text-align: center;
  animation: loaderFadeIn 0.8s ease;
}

@keyframes loaderFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.loader-logo {
  margin-bottom: 20px;
  animation: loaderPulse 2s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.loader-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #6c5ce7, #00cec9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.loader-bar-track {
  width: 200px;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #6c5ce7, #00cec9, #6c5ce7);
  background-size: 200% 100%;
  border-radius: 2px;
  animation: loaderBar 1.5s ease-in-out infinite;
}

@keyframes loaderBar {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(400%); width: 30%; }
}

.loader-text {
  color: var(--text-muted);
  font-size: 14px;
  animation: loaderText 2s ease-in-out infinite;
}

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

#loader.hidden ~ #app {
  animation: appAppear 0.6s ease;
}

@keyframes appAppear {
  from { opacity: 0; }
  to { opacity: 1; }
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,92,252,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(0,212,192,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(255,107,157,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(2deg); }
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 60px,
    rgba(124,92,252,0.015) 60px,
    rgba(124,92,252,0.015) 61px
  );
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* SCREENS */
.screen {
  display: none;
}
.screen.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: screenIn 0.45s ease;
}

@keyframes screenIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(108,92,231,0.2); }
  50% { box-shadow: 0 0 30px rgba(108,92,231,0.4); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* AUTH SCREEN */
#auth-screen {
  justify-content: center;
  align-items: center;
  background: var(--gradient-dark);
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '</>';
  position: absolute;
  font-size: 240px;
  font-weight: 900;
  font-family: monospace;
  color: rgba(124,92,252,0.04);
  top: -60px;
  right: -40px;
  pointer-events: none;
  animation: floatCode 12s ease-in-out infinite;
}

#auth-screen::after {
  content: '{ }';
  position: absolute;
  font-size: 180px;
  font-weight: 900;
  font-family: monospace;
  color: rgba(0,212,192,0.03);
  bottom: -40px;
  left: -30px;
  pointer-events: none;
  animation: floatCode 15s ease-in-out infinite reverse;
}

@keyframes floatCode {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(3deg); }
}



.auth-container {
  background: rgba(24,26,48,0.85);
  border: 1px solid rgba(124,92,252,0.15);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow-card), 0 0 80px rgba(124,92,252,0.05);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(24px);
  animation: containerIn 0.6s ease;
}

@keyframes containerIn {
  from { opacity: 0; transform: scale(0.96) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header .logo-svg {
  margin-bottom: 12px;
  animation: float 4s ease-in-out infinite;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--accent-1);
  color: white;
  box-shadow: var(--glow-purple);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active {
  display: flex;
  animation: slideUp 0.3s ease;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(16,17,38,0.7);
  border: 1.5px solid rgba(124,92,252,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 4px rgba(124,92,252,0.12), 0 0 20px rgba(124,92,252,0.05);
  background: rgba(16,17,38,0.9);
}

.auth-form input::placeholder {
  color: var(--text-muted);
}

.auth-form input:hover {
  border-color: rgba(124,92,252,0.2);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.remember-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-1);
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  border: none;
  background: var(--gradient-main);
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-purple), 0 4px 20px rgba(124,92,252,0.2);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.error-msg {
  color: var(--accent-3);
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.success-msg {
  color: var(--accent-2);
  font-size: 13px;
}

/* LANGUAGE SELECT */
#language-screen {
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.lang-container {
  max-width: 800px;
  width: 100%;
  animation: containerIn 0.5s ease;
}

.lang-header {
  text-align: center;
  margin-bottom: 36px;
}

.lang-header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.lang-header p {
  color: var(--text-secondary);
  font-size: 16px;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.lang-card {
  background: rgba(24,26,48,0.7);
  border: 1px solid rgba(124,92,252,0.1);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  animation: slideUp 0.4s ease backwards;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.lang-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-main);
  opacity: 0;
  transition: var(--transition);
}

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

.lang-card:hover {
  border-color: var(--accent-1);
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--glow-purple), 0 12px 40px rgba(0,0,0,0.3);
  background: rgba(30,32,64,0.85);
}

.lang-card .lang-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.lang-card .lang-name {
  font-size: 16px;
  font-weight: 700;
}

.lang-card .lang-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* TOP BAR */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(17,20,41,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 8px;
}

.top-bar .logo {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.lesson-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-name {
  font-weight: 600;
  font-size: 14px;
}

.level-badge {
  background: var(--gradient-warm);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bg-primary);
}

.xp-display {
  font-size: 13px;
  color: var(--accent-4);
  font-weight: 600;
}

.xp-bar-container {
  width: 100px;
  height: 6px;
  background: rgba(16,17,38,0.8);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.xp-bar {
  height: 100%;
  background: var(--gradient-main);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 0 10px rgba(124,92,252,0.3);
}

.xp-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15));
}

.badge-display {
  font-size: 18px;
}

.btn-small {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  background: rgba(108,92,231,0.08);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-small:hover {
  border-color: var(--accent-1);
  background: rgba(108,92,231,0.15);
  color: var(--text-primary);
}

/* LANG INDICATOR */
.lang-indicator {
  text-align: center;
  padding: 16px 20px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* WORLD MAP */
.world-map {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.chapter-card {
  background: rgba(24,26,48,0.7);
  border: 1px solid rgba(124,92,252,0.1);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
  animation: slideUp 0.4s ease backwards;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.chapter-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--gradient-main);
  opacity: 0;
  transition: var(--transition);
}

.chapter-card:hover::after {
  opacity: 1;
}

.chapter-card:hover {
  border-color: var(--accent-1);
  transform: translateX(8px) scale(1.01);
  box-shadow: var(--glow-purple), 0 8px 30px rgba(0,0,0,0.25);
  background: rgba(30,32,64,0.85);
}

.chapter-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.chapter-card.locked:hover {
  transform: none;
  border-color: var(--border-color);
  box-shadow: none;
}

.chapter-card.completed {
  border-color: rgba(0,206,201,0.3);
}

.chapter-icon {
  font-size: 36px;
  width: 56px;
  text-align: center;
  flex-shrink: 0;
}

.chapter-info {
  flex: 1;
}

.chapter-info h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.chapter-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.chapter-progress {
  width: 100%;
  height: 4px;
  background: rgba(16,17,38,0.6);
  border-radius: 2px;
  overflow: hidden;
}

.chapter-progress-bar {
  height: 100%;
  background: var(--gradient-main);
  border-radius: 2px;
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(124,92,252,0.3);
}

.chapter-status {
  font-size: 22px;
  flex-shrink: 0;
}

/* CHAPTER SCREEN */
#chapter-screen {
  background: var(--bg-primary);
}

.chapter-exercises {
  flex: 1;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.exercise-card {
  background: rgba(24,26,48,0.7);
  border: 1px solid rgba(124,92,252,0.08);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: slideUp 0.3s ease backwards;
}

.exercise-card:hover {
  border-color: var(--accent-1);
  transform: translateX(6px) scale(1.01);
  background: rgba(30,32,64,0.85);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.exercise-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.exercise-card.locked:hover {
  transform: none;
  border-color: var(--border-color);
}

.exercise-card.completed {
  border-color: rgba(0,206,201,0.25);
}

.exercise-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.exercise-info {
  flex: 1;
}

.exercise-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.exercise-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.exercise-check {
  color: var(--accent-2);
  font-size: 18px;
}

/* LESSON SCREEN */
#lesson-screen {
  background: var(--bg-primary);
}

.lesson-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.lesson-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.lesson-content::-webkit-scrollbar {
  width: 4px;
}

.lesson-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.lesson-content h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--accent-2);
}

.lesson-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.lesson-content p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
  font-size: 14px;
}

.lesson-content pre {
  background: rgba(11,12,26,0.8);
  border: 1px solid rgba(124,92,252,0.1);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--accent-2);
  position: relative;
}

.lesson-content ul {
  padding-left: 20px;
  margin: 8px 0;
}

.lesson-content li {
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-size: 14px;
}

.code-section {
  width: 50%;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  background: rgba(11,12,26,0.6);
  border-left: 1px solid rgba(124,92,252,0.1);
  position: relative;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10,11,26,0.6);
  border-bottom: 1px solid rgba(124,92,252,0.08);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-run {
  padding: 8px 20px;
  border: none;
  background: var(--gradient-main);
  color: white;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-run:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow-purple);
}

#code-editor {
  flex: 1;
  padding: 16px;
  background: #0d0f1e;
  border: none;
  color: var(--text-primary);
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  caret-color: var(--accent-2);
  tab-size: 2;
}

#code-editor::placeholder {
  color: var(--text-muted);
}

.quest-status {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid var(--border-color);
  min-height: 20px;
}

.quest-status.success {
  color: var(--accent-2);
  background: rgba(0,206,201,0.08);
}

.quest-status.error {
  color: var(--accent-3);
  background: rgba(253,121,168,0.08);
}

.output-section {
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.section-tabs {
  display: flex;
  background: rgba(11,13,26,0.5);
}

.sec-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.sec-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
  background: rgba(0,206,201,0.06);
}

.sec-content {
  display: none;
  max-height: 180px;
  overflow-y: auto;
}

.sec-content.active {
  display: block;
}

#output-display {
  padding: 12px 16px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 50px;
}

.qa-messages {
  padding: 12px 16px;
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-msg {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  max-width: 85%;
  line-height: 1.5;
}

.qa-msg.bot {
  background: rgba(108,92,231,0.1);
  color: var(--text-primary);
  align-self: flex-start;
  border: 1px solid rgba(108,92,231,0.15);
}

.qa-msg.user {
  background: rgba(0,206,201,0.1);
  color: var(--text-primary);
  align-self: flex-end;
  border: 1px solid rgba(0,206,201,0.15);
}

.qa-input-row {
  display: flex;
  padding: 8px 12px;
  gap: 8px;
  border-top: 1px solid var(--border-color);
}

.qa-input-row input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.qa-input-row input:focus {
  border-color: var(--accent-1);
}

.btn-ask {
  background: rgba(108,92,231,0.2) !important;
  color: var(--accent-1) !important;
  border-color: var(--accent-1) !important;
}

.hint-area {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--accent-4);
  min-height: 20px;
}

.admin-panel {
  flex: 1;
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(24,26,48,0.6);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid rgba(124,92,252,0.1);
}

.admin-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.admin-tab.active {
  background: var(--accent-1);
  color: white;
  box-shadow: var(--glow-purple);
}

.admin-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.admin-tab-content.active {
  display: block;
}

.admin-tab-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.admin-section {
  background: rgba(24,26,48,0.7);
  border: 1px solid rgba(124,92,252,0.1);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
  backdrop-filter: blur(8px);
}

.admin-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.admin-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-form-row input,
.admin-form-row select {
  flex: 1;
  min-width: 130px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.admin-form-row input:focus,
.admin-form-row select:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

.admin-form-row select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  resize: vertical;
  margin-bottom: 10px;
}

textarea:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

.admin-eval-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-eval-row select {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 150px;
}

.admin-eval-row textarea {
  flex: 2;
  min-width: 200px;
  margin-bottom: 0;
}

.admin-eval-row input {
  flex: 1;
  min-width: 130px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.btn-sm {
  padding: 10px 18px !important;
  font-size: 13px !important;
  width: auto !important;
  flex-shrink: 0;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  animation: slideUp 0.2s ease backwards;
}

.admin-list-item .item-info {
  flex: 1;
}

.admin-list-item .item-actions {
  display: flex;
  gap: 6px;
}

.admin-list-item .item-actions button {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: var(--transition);
}

.admin-list-item .item-actions .edit-btn {
  background: rgba(0,206,201,0.15);
  color: var(--accent-2);
}

.admin-list-item .item-actions .edit-btn:hover {
  background: rgba(0,206,201,0.25);
}

.admin-list-item .item-actions .del-btn {
  background: rgba(253,121,168,0.15);
  color: var(--accent-3);
}

.admin-list-item .item-actions .del-btn:hover {
  background: rgba(253,121,168,0.25);
}

.levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.levelup-modal {
  background: rgba(24,26,48,0.92);
  border: 1px solid rgba(124,92,252,0.15);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 100px rgba(124,92,252,0.08);
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.levelup-modal::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(108,92,231,0.08), transparent, rgba(0,206,201,0.08), transparent);
  animation: shimmer 6s linear infinite;
}

.levelup-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 2s ease-in-out infinite;
}

.levelup-modal h2 {
  font-size: 32px;
  font-weight: 800;
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  position: relative;
}

.levelup-text {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 4px;
  position: relative;
}

.levelup-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  position: relative;
}

.levelup-modal .btn-primary {
  max-width: 200px;
  margin: 0 auto;
  position: relative;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: rgba(24,26,48,0.92);
  border: 1px solid rgba(124,92,252,0.15);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(124,92,252,0.05);
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  backdrop-filter: blur(16px);
  max-width: 360px;
}

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

.toast.success {
  border-color: rgba(0,206,201,0.3);
}

.toast.error {
  border-color: rgba(253,121,168,0.3);
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

@media (max-width: 768px) {
  .lesson-container {
    flex-direction: column;
    height: auto;
  }

  .code-section {
    width: 100%;
    min-width: 0;
    height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .lesson-content {
    height: 50vh;
  }

  .auth-container {
    padding: 32px 24px;
  }

  .top-bar {
    padding: 10px 16px;
  }

  .player-info {
    gap: 6px;
  }

  .xp-bar-container {
    width: 60px;
  }

  .admin-panel {
    padding: 16px;
  }

  .admin-form-row {
    flex-direction: column;
  }

  .admin-form-row input,
  .admin-form-row select {
    min-width: unset;
  }

  .chapter-card {
    padding: 14px 16px;
  }

  .world-map {
    padding: 12px;
  }

  .lang-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
