:root {
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-light: #A78BFA;
  --secondary: #3B82F6;
  --secondary-dark: #2563EB;
  --accent: #1E1B4B;
  --dark: #0F0A1A;
  --dark-card: #1A1333;
  --dark-surface: #241E36;
  --text: #E8E0F0;
  --text-muted: #9B8FB8;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --glow: 0 0 20px rgba(124,58,237,0.3);
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--dark);
  min-height: 100vh;
  color: var(--text);
}

.navbar {
  background: rgba(26,19,51,0.95);
  backdrop-filter: blur(10px);
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(124,58,237,0.2);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--primary-light);
}

.brand-icon { font-size: 1.5rem; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.nav-links {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
  font-size: 0.82rem;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--primary);
  color: var(--white);
}

.nav-user-section, .nav-auth {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(124,58,237,0.3);
}

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-avatar { font-size: 1.2rem; }
.nav-username { font-size: 0.8rem; font-weight: 700; color: var(--primary-light); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dashboard { background: rgba(124,58,237,0.2); color: var(--primary-light) !important; }
.nav-logout { color: var(--danger) !important; font-size: 0.78rem; }
.nav-register-btn { background: var(--primary); color: var(--white) !important; border-radius: 20px; padding: 0.35rem 0.8rem !important; }

.main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem;
}

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.highlight {
  background: linear-gradient(135deg, var(--secondary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.3);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary-light);
}

.stat-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.filter-section { padding: 1.2rem 0 0.5rem; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  text-decoration: none;
  padding: 0.45rem 1rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.2);
  transition: all 0.3s;
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary-light); }
.filter-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.filter-btn.small { padding: 0.35rem 0.7rem; font-size: 0.75rem; }

.filter-result {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.6rem;
}

.section-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--white);
  margin: 1.5rem 0 1rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  padding: 0.8rem 0;
}

.game-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow), var(--shadow-lg);
  border-color: var(--primary);
}

.card-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  z-index: 2;
}

.badge-easy { background: var(--success); color: var(--white); }
.badge-medium { background: var(--warning); color: var(--dark); }
.badge-hard { background: var(--danger); color: var(--white); }

.card-type-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(59,130,246,0.2);
  color: var(--secondary);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  z-index: 2;
  border: 1px solid rgba(59,130,246,0.3);
}

.card-icon-wrap {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-surface), rgba(124,58,237,0.15));
}

.card-icon { font-size: 2.8rem; }

.card-body { padding: 0.8rem; flex-grow: 1; }
.card-title { font-size: 0.95rem; font-weight: 800; color: var(--white); margin-bottom: 0.1rem; }
.card-title-id { font-size: 0.75rem; color: var(--primary-light); font-weight: 600; margin-bottom: 0.3rem; }
.card-desc { color: var(--text-muted); font-size: 0.75rem; line-height: 1.3; }

.card-footer {
  padding: 0.6rem 0.8rem;
  background: rgba(124,58,237,0.1);
  text-align: center;
  border-top: 1px solid rgba(124,58,237,0.15);
}

.play-btn { font-weight: 800; color: var(--primary-light); font-size: 0.85rem; }
.game-card:hover .play-btn { color: var(--white); }

.how-to-play { padding: 1.5rem 0 1rem; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.step-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  color: var(--text);
  transition: transform 0.3s;
}

.step-card:hover { transform: translateY(-3px); border-color: var(--primary); }

.step-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  margin: 0 auto 0.6rem;
}

.step-card h3 { font-size: 0.95rem; font-weight: 800; margin-bottom: 0.3rem; color: var(--white); }
.step-card p { font-size: 0.8rem; color: var(--text-muted); }

.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(124,58,237,0.1);
  margin-top: 1.5rem;
}

.game-container { max-width: 750px; margin: 0 auto; }

.game-header {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-info { display: flex; align-items: center; gap: 0.8rem; }

.back-btn {
  text-decoration: none;
  color: var(--primary-light);
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
  font-size: 0.85rem;
}

.back-btn:hover { background: var(--primary); color: var(--white); }
.game-title { font-size: 1.1rem; font-weight: 800; color: var(--white); }
.game-status { display: flex; align-items: center; gap: 1rem; }
.score-display { text-align: center; }
.score-label { display: block; font-size: 0.6rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.score-value { font-size: 1.3rem; font-weight: 900; color: var(--primary-light); }
.question-counter { font-weight: 800; color: var(--text-muted); font-size: 0.85rem; }

.timer-display { width: 44px; height: 44px; }
.timer-ring { position: relative; width: 44px; height: 44px; }
.timer-ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: var(--dark-surface); stroke-width: 3; }
.timer-fill { fill: none; stroke: var(--secondary); stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 0; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.5s; }
.timer-fill.warning { stroke: var(--warning); }
.timer-fill.danger { stroke: var(--danger); }
.timer-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-weight: 900; font-size: 0.9rem; color: var(--white); }

.progress-bar { height: 4px; background: var(--dark-surface); border-radius: 3px; margin-bottom: 1rem; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--secondary), var(--primary)); border-radius: 3px; transition: width 0.5s ease; width: 0%; }

.game-area { min-height: 350px; }

.question-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.emoji-display { font-size: 5rem; margin-bottom: 0.8rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }

.translate-prompt {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  background: rgba(59,130,246,0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59,130,246,0.2);
}

.spelling-word { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.8rem; }
.spell-hint { color: var(--primary-light); }

.scramble-display { display: flex; justify-content: center; gap: 0.3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scramble-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 45px;
  background: var(--primary);
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 900;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(124,58,237,0.3);
}

.question-text { font-size: 1rem; font-weight: 800; margin-bottom: 1.2rem; color: var(--text); }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.option-btn {
  padding: 0.8rem;
  border: 2px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--white);
  background: var(--dark-surface);
  position: relative;
  overflow: hidden;
}

.option-btn:hover { background: rgba(124,58,237,0.3); border-color: var(--primary); transform: scale(1.02); }
.option-btn:active { transform: scale(0.97); }
.option-btn.correct { background: var(--success) !important; border-color: var(--success) !important; animation: pulse-correct 0.5s; }
.option-btn.wrong { background: var(--danger) !important; border-color: var(--danger) !important; opacity: 0.7; animation: shake 0.5s; }
.option-btn.disabled { pointer-events: none; }

@keyframes pulse-correct { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.result-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,10,26,0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.result-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--glow), var(--shadow-lg);
}

.result-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.result-title { font-size: 1.8rem; font-weight: 900; color: var(--white); margin-bottom: 0.8rem; }
.result-score { margin-bottom: 0.8rem; }
.final-score { font-size: 2.5rem; font-weight: 900; color: var(--primary-light); }
.score-max { font-size: 1.1rem; color: var(--text-muted); font-weight: 700; }
.result-stars { font-size: 1.8rem; margin-bottom: 0.8rem; }
.result-msg { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.result-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--glow); }

.btn-secondary {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-secondary:hover { background: var(--primary); color: var(--white); }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); color: var(--white); border: none; padding: 0.7rem 1.5rem; border-radius: var(--radius-sm); font-family: 'Nunito'; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: all 0.3s; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

.score-popup {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--success);
  text-shadow: 0 0 20px rgba(16,185,129,0.5);
  z-index: 150;
  pointer-events: none;
  animation: scoreFloat 1s ease-out forwards;
}

.score-popup.wrong { color: var(--danger); text-shadow: 0 0 20px rgba(239,68,68,0.5); }

@keyframes scoreFloat {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  50% { opacity: 1; transform: translate(-50%, -80%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
  padding: 1rem;
}

.auth-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.auth-header h1 { font-size: 1.6rem; font-weight: 900; color: var(--white); }
.auth-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-weight: 700; font-size: 0.85rem; color: var(--text); }

.form-group input, .form-select {
  padding: 0.7rem 1rem;
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.3s;
}

.form-group input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239B8FB8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-select option { background: var(--dark-card); color: var(--text); }

.auth-footer {
  text-align: center;
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a { color: var(--primary-light); text-decoration: none; font-weight: 700; }
.auth-footer a:hover { text-decoration: underline; }
.auth-note { margin-top: 0.5rem; font-size: 0.8rem; }

.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }

.page-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 0.3rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.leaderboard-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.leaderboard-section {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.leaderboard-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(124,58,237,0.2);
}

.data-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(124,58,237,0.1);
  color: var(--text);
}

.data-table tr:hover { background: rgba(124,58,237,0.05); }

.rank-badge {
  font-size: 1.1rem;
  font-weight: 900;
}

.player-info { display: flex; align-items: center; gap: 0.5rem; }
.player-avatar { font-size: 1.2rem; }
.player-name { font-weight: 700; }

.score-badge {
  background: rgba(124,58,237,0.2);
  color: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: 15px;
  font-weight: 800;
  font-size: 0.78rem;
}

.score-badge.high { background: rgba(16,185,129,0.2); color: var(--success); }
.score-badge.mid { background: rgba(245,158,11,0.2); color: var(--warning); }
.score-badge.low { background: rgba(239,68,68,0.2); color: var(--danger); }

.type-badge {
  background: rgba(59,130,246,0.2);
  color: var(--secondary);
  padding: 0.15rem 0.5rem;
  border-radius: 15px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: capitalize;
}

.recent-activity { display: flex; flex-direction: column; gap: 0.6rem; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--dark-surface);
  transition: background 0.3s;
}

.activity-item:hover { background: rgba(124,58,237,0.1); }
.activity-avatar { font-size: 1.3rem; }
.activity-details { font-size: 0.82rem; color: var(--text); }
.activity-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.stat-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-icon { font-size: 1.5rem; display: block; margin-bottom: 0.3rem; }
.stat-val { display: block; font-size: 1.5rem; font-weight: 900; color: var(--primary-light); }
.stat-lbl { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.dashboard-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 100px);
}

.dashboard-sidebar {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 70px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.3rem; }

.sidebar-link {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.sidebar-link:hover { background: rgba(124,58,237,0.15); color: var(--text); }
.sidebar-link.active { background: var(--primary); color: var(--white); }

.dashboard-main { min-width: 0; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.dash-stat-card {
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.dash-stat-card .stat-val { font-size: 1.8rem; }
.dash-stat-card .stat-lbl { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; margin-top: 0.2rem; }

.dash-section {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.dash-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dash-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.exam-container { max-width: 800px; margin: 0 auto; }

.exam-header {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.exam-title { font-size: 1.2rem; font-weight: 800; color: var(--white); }
.exam-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.exam-question-counter { font-weight: 800; color: var(--primary-light); font-size: 0.95rem; }

.exam-progress { height: 4px; background: var(--dark-surface); border-radius: 3px; margin-bottom: 1rem; overflow: hidden; }
.exam-progress-fill { height: 100%; background: linear-gradient(90deg, var(--secondary), var(--primary)); border-radius: 3px; transition: width 0.5s ease; width: 0%; }

.exam-area { min-height: 350px; }

.exam-question-card {
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.exam-question-number { font-size: 0.8rem; font-weight: 800; color: var(--primary-light); text-transform: uppercase; margin-bottom: 0.5rem; }
.exam-question-text { font-size: 1.1rem; font-weight: 700; color: var(--white); margin-bottom: 1rem; line-height: 1.5; }

.exam-question-image { margin-bottom: 1rem; text-align: center; }
.exam-question-image img { max-width: 100%; max-height: 250px; border-radius: var(--radius-sm); object-fit: contain; }

.exam-options { display: flex; flex-direction: column; gap: 0.5rem; }

.exam-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--dark-surface);
  border: 2px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.exam-option:hover { border-color: var(--primary); background: rgba(124,58,237,0.15); }

.exam-option.selected {
  border-color: var(--primary);
  background: rgba(124,58,237,0.25);
  color: var(--white);
}

.option-letter {
  width: 30px;
  height: 30px;
  background: rgba(124,58,237,0.3);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.exam-option.selected .option-letter {
  background: var(--primary);
  color: var(--white);
}

.option-text { flex: 1; }

.exam-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.exam-dots {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}

.exam-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--dark-surface);
  border: 2px solid rgba(124,58,237,0.3);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-family: 'Nunito', sans-serif;
}

.exam-dot:hover { border-color: var(--primary); }
.exam-dot.active { border-color: var(--primary); background: var(--primary); color: var(--white); }
.exam-dot.answered { background: rgba(16,185,129,0.3); border-color: var(--success); color: var(--success); }
.exam-dot.answered.active { background: var(--primary); border-color: var(--primary); color: var(--white); }

.room-code-display {
  background: var(--dark-surface);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin: 1rem 0;
}

.room-code-value {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary-light);
  letter-spacing: 0.3rem;
  cursor: pointer;
}

.room-code-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.status-badge {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border-radius: 15px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-active { background: rgba(16,185,129,0.2); color: var(--success); }
.status-closed { background: rgba(239,68,68,0.2); color: var(--danger); }
.status-progress { background: rgba(245,158,11,0.2); color: var(--warning); }

.exam-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.exam-card-item {
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
  display: block;
}

.exam-card-item:hover { border-color: var(--primary); transform: translateY(-2px); }

.question-builder {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question-item {
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 1rem;
}

.question-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.question-item-title { font-weight: 800; color: var(--primary-light); font-size: 0.9rem; }

.remove-question-btn {
  background: rgba(239,68,68,0.2);
  color: var(--danger);
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Nunito';
}

.question-input, .option-input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  background: var(--dark-card);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Nunito';
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.question-input:focus, .option-input:focus {
  outline: none;
  border-color: var(--primary);
}

.option-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.option-row label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 20px;
}

.correct-select {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.correct-select label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
}

.correct-select select {
  padding: 0.3rem 0.6rem;
  background: var(--dark-card);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Nunito';
  font-size: 0.85rem;
}

.answer-key {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 1rem 0;
}

.answer-key-item {
  background: var(--dark-surface);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
}

.answer-key-q { font-weight: 700; color: var(--white); margin-bottom: 0.4rem; }
.answer-key-options { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.answer-key-opt { color: var(--text-muted); padding: 0.2rem 0.5rem; border-radius: 4px; }
.answer-key-opt.correct-answer { background: rgba(16,185,129,0.2); color: var(--success); font-weight: 700; }

@media (max-width: 900px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    position: static;
    margin-bottom: 1rem;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .sidebar-link {
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
  }
  .leaderboard-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(26,19,51,0.98);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(124,58,237,0.2);
    box-shadow: var(--shadow);
    gap: 0.2rem;
  }

  .nav-links.active { display: flex; }

  .nav-link {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  .nav-user-section, .nav-auth {
    flex-direction: column;
    border-left: none;
    margin-left: 0;
    padding-left: 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(124,58,237,0.2);
    width: 100%;
  }

  .nav-user-info {
    padding: 0.3rem 1rem;
    width: 100%;
  }

  .navbar { position: relative; }

  .hero-title { font-size: 1.8rem; }
  .hero-subtitle { font-size: 0.9rem; }
  .hero-stats { gap: 0.6rem; }
  .stat-item { padding: 0.6rem 1rem; }
  .stat-number { font-size: 1.4rem; }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
  }

  .card-icon-wrap { height: 70px; }
  .card-icon { font-size: 2.2rem; }
  .card-body { padding: 0.6rem; }
  .card-title { font-size: 0.85rem; }
  .card-desc { font-size: 0.7rem; }

  .game-header { flex-direction: column; text-align: center; }
  .game-info { flex-direction: column; gap: 0.3rem; }

  .options-grid { grid-template-columns: 1fr; }
  .question-card { padding: 1rem; }
  .emoji-display { font-size: 3.5rem; }
  .translate-prompt { font-size: 1.3rem; }
  .scramble-letter { width: 32px; height: 36px; font-size: 1rem; }

  .steps-grid { grid-template-columns: 1fr 1fr; }
  .result-card { padding: 1.5rem 1rem; }
  .final-score { font-size: 2rem; }

  .filter-btn { padding: 0.35rem 0.7rem; font-size: 0.75rem; }

  .page-title { font-size: 1.5rem; }

  .exam-dots { gap: 0.2rem; }
  .exam-dot { width: 28px; height: 28px; font-size: 0.65rem; }

  .exam-navigation {
    flex-direction: column;
    align-items: stretch;
  }

  .exam-navigation .btn-secondary,
  .exam-navigation .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .stats-overview { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .brand-text { font-size: 1rem; }
  .steps-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; align-items: center; }
  .games-grid { grid-template-columns: 1fr 1fr; }
  .stat-item { width: 100%; }
  .hero-title { font-size: 1.5rem; }
  .room-code-value { font-size: 1.8rem; }
}

.site-footer {
  background: var(--dark-card);
  border-top: 1px solid rgba(124,58,237,0.15);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
}
.footer-content {
  max-width: 800px;
  margin: 0 auto;
}
.footer-brand {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.footer-text {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: color 0.2s;
}
.footer-links a:hover {
  color: var(--primary-light);
}
.footer-copy {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.6;
}
