/* ====================== CSS VARIABLES ====================== */
:root {
  --bg: #070a13;
  --bg-alt: #0b0f1d;
  --card: rgba(19, 26, 46, 0.45);
  --card-hover: rgba(26, 35, 64, 0.6);
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(99, 102, 241, 0.4);
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.08);
  --secondary: #06b6d4;
  --secondary-hover: #22d3ee;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #f8fafc;
  --muted: #64748b;
  --sidebar: rgba(10, 14, 26, 0.8);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
  --glow: 0 0 25px rgba(99, 102, 241, 0.15);
  --glow-cyan: 0 0 25px rgba(6, 182, 212, 0.15);
  --radius: 16px;
  --radius-sm: 12px;
  --transition: 0.2s ease;
  --bounce: cubic-bezier(0.16, 1, 0.3, 1);
  --glass: blur(12px) saturate(180%);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: rgba(255, 255, 255, 0.7);
  --card-hover: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(99, 102, 241, 0.3);
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --primary-soft: rgba(79, 70, 229, 0.06);
  --secondary: #0891b2;
  --secondary-hover: #06b6d4;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --text: #0f172a;
  --muted: #475569;
  --sidebar: rgba(255, 255, 255, 0.85);
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  --shadow-soft: 0 4px 16px 0 rgba(0, 0, 0, 0.02);
  --glow: 0 0 25px rgba(79, 70, 229, 0.08);
  --glow-cyan: 0 0 25px rgba(8, 145, 178, 0.08);
  --glass: blur(12px) saturate(180%);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
}

ul {
  list-style: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* ====================== SCROLLBAR ====================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

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

/* ====================== AUTH SCREEN ====================== */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: var(--primary);
  top: -120px;
  left: -120px;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: var(--secondary);
  bottom: -80px;
  right: -80px;
  animation-delay: 3s;
}

.orb-3 {
  width: 280px;
  height: 280px;
  background: var(--primary);
  top: 40%;
  left: 60%;
  animation-delay: 5s;
  opacity: 0.1;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -15px) scale(1.05);
  }

  66% {
    transform: translate(-15px, 20px) scale(0.97);
  }
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 20px;
  animation: authSlideIn 0.6s var(--bounce);
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.auth-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 16px;
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.auth-brand h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-brand h1 span {
  color: var(--primary);
}

.auth-brand p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

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

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.3s var(--transition);
}

.auth-tab:hover:not(.active) {
  color: var(--text);
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* ====================== FORMS ====================== */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.form-group input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border var(--transition), box-shadow var(--transition), transform var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-group input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.pwd-wrap {
  position: relative;
}

.pwd-wrap input {
  padding-right: 44px;
}

.pwd-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.pwd-toggle:hover {
  opacity: 1;
}

/* ====================== BUTTONS ====================== */
.btn {
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

.btn:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s !important;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 14px rgba(91, 124, 250, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(91, 124, 250, 0.4);
}

.btn-ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #e8555a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(240, 101, 106, 0.2);
}

.btn-danger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(240, 101, 106, 0.35);
}

.link-btn {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.link-btn:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* Premium Button Effects */
.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}

/* Success Animation */
@keyframes successPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.btn.success-animate {
  animation: successPulse 0.4s ease;
}

/* New Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

  100% {
    background-position: 200% 0;
  }
}

.animate-slide-in {
  animation: slideInUp 0.3s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease forwards;
}

.shimmer-effect {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ====================== APP LAYOUT ====================== */
.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 250ms ease, transform 250ms ease, opacity 250ms ease;
}

.app.sidebar-collapsed .sidebar,
.sidebar.collapsed {
  width: 84px;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  transition: padding 250ms ease;
}

.app.sidebar-collapsed .sidebar-header,
.sidebar.collapsed .sidebar-header {
  padding: 18px 10px;
  justify-content: center;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.app.sidebar-collapsed .sidebar-logo span,
.sidebar.collapsed .sidebar-logo span {
  display: none;
}

.sidebar-logo span span {
  color: var(--primary);
}

.sidebar-close {
  display: none;
  font-size: 20px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: all 250ms ease;
  margin-bottom: 4px;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.nav-label {
  white-space: nowrap;
  transition: opacity 250ms ease, width 250ms ease;
}

.app.sidebar-collapsed .nav-label,
.sidebar.collapsed .nav-label {
  display: none;
}

.app.sidebar-collapsed .nav-item,
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.nav-item .ripple {
  background: rgba(255, 255, 255, 0.2);
}

.nav-item:hover {
  background: var(--card-hover);
  color: var(--text);
  transform: translateX(6px);
}

.app.sidebar-collapsed .nav-item:hover,
.sidebar.collapsed .nav-item:hover {
  transform: translateX(0) translateY(-1px);
}

.nav-item:active {
  transform: translateX(6px) scale(0.98);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

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

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  width: 100%;
  color: var(--danger);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 250ms ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* MAIN */
.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  transition: margin-left 250ms ease;
}

.app.sidebar-collapsed .main {
  margin-left: 84px;
}

/* ==========================================================
   DESKTOP SAFETY FLOOR — sahifa hech qachon desktopda
   telefon ekrani kabi tor bo'lib qolmasin.
   Faqat >= 769px ekranlarda ishlaydi (mobil layoutga ta'sir qilmaydi).
   ========================================================== */
@media (min-width: 769px) {
  html,
  body {
    max-width: none;
    width: auto;
  }

  #app,
  .app {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .main {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }

  .main .page {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  .app {
    display: block;
  }

  .sidebar {
    width: min(78vw, 290px);
    transform: translateX(-105%);
    box-shadow: var(--shadow);
    border-right: none;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-header {
    padding: 18px 18px 16px;
    justify-content: space-between;
  }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
  }

  .sidebar-logo {
    gap: 6px;
  }

  .sidebar-logo span {
    display: inline-flex;
  }

  .nav-item,
  .nav-item:hover,
  .nav-item:active {
    transform: none;
  }

  .nav-label {
    display: block;
  }

  .main {
    margin-left: 0 !important;
  }

  .sidebar-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 430px) {
  .sidebar {
    width: min(82vw, 280px);
  }

  .nav-item {
    padding: 11px 12px;
  }

  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-left h2 {
    font-size: 18px;
  }
}

/* TOPBAR */
/* Root-cause fix: oldin `position: fixed` edi lekin left/right/width YO'Q edi —
   shrink-to-fit bo'lib chapdagi kichik blok ko'rinishida qolardi va content
   ostida content yashirinib qolardi. Endi sticky: full width (sidebar bilan
   align), content tabiiy oqimda header OSTIDA boshlanadi, scroll'da sakramaydi. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  min-height: 64px;
  background: color-mix(in srgb, var(--bg) 92%, var(--card));
  border-bottom: 1px solid var(--border);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 90;
  gap: 12px;
  /* Header ichidagi dropdown'lar stack contexti izolyatsiya qilinadi */
  isolation: isolate;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h2 {
  font-size: 20px;
  font-weight: 700;
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  transition: background 250ms ease, border-color 250ms ease, transform 250ms ease;
}

.hamburger:hover {
  background: var(--card-hover);
  border-color: rgba(99, 102, 241, 0.22);
}

.hamburger:active {
  transform: scale(0.96);
}

.hamburger span {
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
  transition: transform 250ms ease, opacity 250ms ease;
}

.hamburger span:nth-child(1) { transform: translateY(-6px); }
.hamburger span:nth-child(2) { transform: translateY(0); }
.hamburger span:nth-child(3) { transform: translateY(6px); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
  transition: all 0.3s var(--transition);
}

.icon-btn:hover {
  background: var(--card-hover);
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0) scale(0.95);
}

.theme-icon-light {
  display: none;
}

[data-theme="light"] .theme-icon-dark {
  display: none;
}

[data-theme="light"] .theme-icon-light {
  display: inline;
}

.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  display: none;
}

.notif-badge.active {
  display: block;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.notif-wrap {
  position: relative;
}

.notif-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  display: none;
  z-index: 200;
}

.notif-dropdown.active {
  display: block;
  animation: dropDown 0.3s var(--transition);
}

@keyframes dropDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notif-header {
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: start;
  transition: background var(--transition);
}

.notif-item:hover {
  background: var(--bg);
}

.notif-item .notif-emoji {
  font-size: 18px;
}

.notif-item .notif-text {
  color: var(--muted);
}

.notif-item .notif-time {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 30px;
  background: var(--bg);
  transition: all 0.3s ease;
  cursor: pointer;
}

.user-chip:hover {
  background: var(--card-hover);
  transform: scale(1.03);
}

.user-chip:active {
  transform: scale(0.97);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.3s var(--bounce);
}

.user-chip:hover .user-avatar {
  transform: scale(1.1) rotate(-5deg);
}

#topbarUsername {
  font-size: 14px;
  font-weight: 500;
}

/* CONTENT */
.content {
  padding: 24px;
  flex: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: pageIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================== CARDS ====================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: var(--glow);
  transform: translateY(-4px) scale(1.01);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Premium Card Effects */
.card.premium-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.card.premium-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}

/* Hover Glow Animation */
@keyframes cardGlow {

  0%,
  100% {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
  }

  50% {
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
  }
}

.card.glow-hover:hover {
  animation: cardGlow 2s ease-in-out infinite;
}

/* ====================== DASHBOARD ====================== */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  position: relative;
  overflow: hidden;
  animation: bannerIn 0.5s var(--bounce);
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  filter: blur(40px);
  animation: floatOrb 8s ease-in-out infinite;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-20px, 10px) scale(1.1);
  }
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.welcome-banner h1 {
  font-size: 24px;
  font-weight: 700;
}

.welcome-banner p {
  opacity: 0.9;
  font-size: 14px;
  margin-top: 4px;
}

.welcome-level {
  display: flex;
  align-items: center;
  gap: 16px;
}

.level-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.3s ease;
}

.level-badge:hover {
  transform: scale(1.05);
}

.xp-bar-wrap {
  min-width: 180px;
}

.xp-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  opacity: 0.9;
}

.xp-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 4px;
  transition: width 0.6s ease;
  position: relative;
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
  border-radius: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  animation: cardSlideIn 0.5s var(--transition) backwards;
}

.stat-card:nth-child(1) {
  animation-delay: 0.05s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.15s;
}

.stat-card:nth-child(4) {
  animation-delay: 0.2s;
}

.stat-card:nth-child(5) {
  animation-delay: 0.25s;
}

.stat-card.duel-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
}

.stat-card.duel-stat-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: var(--glow);
}

.duel-icon {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}

.stat-info-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 12px;
}

.stat-row-label {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.stat-row-val {
  font-weight: 700;
  color: var(--text);
}

.stat-row-sub {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 1px;
  padding-top: 2px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow);
  border-color: rgba(99, 102, 241, 0.3);
}

.stat-card:active {
  transform: translateY(-1px);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-3deg);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: transform 0.3s var(--transition);
}

.xp-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.test-icon {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.avg-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.streak-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* PROGRESS BARS */
.progress-item {
  margin-bottom: 16px;
}

.progress-item:last-child {
  margin-bottom: 0;
}

.progress-item-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.progress-item-head .muted {
  font-size: 12px;
}

.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  border-radius: 4px;
}

/* RECENT RESULTS */
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.25s ease;
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item:hover {
  padding-left: 8px;
}

.recent-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-item-name {
  font-weight: 500;
  font-size: 14px;
}

.recent-item-sub {
  font-size: 12px;
  color: var(--muted);
}

.recent-item-score {
  text-align: right;
}

.recent-item-pct {
  font-weight: 700;
  font-size: 16px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(240, 101, 106, 0.15);
  color: var(--danger);
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* ====================== DASHBOARD CHARTS ====================== */
.dash-grid-charts {
  margin-top: 12px;
}

.chart-card .card-body.chart-body {
  padding-top: 10px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 10px 0 4px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.legend-dot-primary {
  background: var(--primary);
}

.legend-dot-pass {
  background: var(--success);
  border-style: dashed;
  opacity: 0.7;
}

.line-chart-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

.line-chart-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.line-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100%;
  color: var(--muted);
  gap: 8px;
  text-align: center;
  padding: 12px;
}

.line-chart-empty .big-icon {
  font-size: 52px;
  opacity: 0.5;
}

.donut-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  flex-wrap: wrap;
}

.donut-chart-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.donut-chart-wrap svg {
  width: 100%;
  height: 100%;
}

.donut-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center-text .dc-big {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.donut-center-text .dc-small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.donut-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.chart-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 150px;
}

.chart-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.chart-stat .cs-val {
  font-size: 18px;
  font-weight: 700;
}

.chart-stat .cs-lbl {
  font-size: 12px;
  color: var(--muted);
}

.chart-stat-correct .cs-val {
  color: var(--success);
}

.chart-stat-wrong .cs-val {
  color: var(--danger);
}

.chart-stat-skipped .cs-val {
  color: var(--muted);
}

@media (max-width: 768px) {
  .donut-body {
    flex-direction: column;
  }

  .donut-chart-wrap {
    width: 180px;
    height: 180px;
  }

  .line-chart-wrap {
    height: 220px;
  }
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.empty-state p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ====================== SUBJECT CARDS ====================== */
.subject-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.subject-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--transition);
}

.subject-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.subject-card:hover::before {
  transform: scaleX(1);
}

.subject-card:active {
  transform: translateY(-2px) scale(0.99);
}

.subject-card-icon {
  font-size: 38px;
  margin-bottom: 12px;
  display: inline-block;
  transition: transform 0.4s var(--transition);
}

.subject-card:hover .subject-card-icon {
  transform: scale(1.15) rotate(-5deg);
}

.subject-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subject-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.subject-card-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  margin-bottom: 12px;
}

.subject-card-stats span {
  color: var(--muted);
}

.subject-card-stats strong {
  color: var(--text);
}

.diff-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.subject-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.subject-icon {
  font-size: 32px;
  transition: transform 0.4s var(--bounce);
}

.subject-card:hover .subject-icon {
  transform: scale(1.15) rotate(-5deg);
}

.subject-name {
  font-size: 18px;
  font-weight: 700;
}

.subject-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.subject-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.diff-badge {
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.diff-beginner {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
}

.diff-intermediate {
  background: rgba(251, 191, 60, 0.15);
  color: var(--warning);
}

.diff-advanced {
  background: rgba(240, 101, 106, 0.15);
  color: var(--danger);
}

/* ====================== TEST LIST ====================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-head h2 {
  font-size: 22px;
  font-weight: 700;
}

.back-btn {
  padding: 8px 14px;
  font-size: 14px;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  gap: 16px;
}

.test-list-item:hover {
  border-color: var(--primary);
  transform: translateX(6px);
  box-shadow: var(--shadow-soft);
}

.test-list-item:active {
  transform: translateX(2px) scale(0.99);
}

.test-list-info {
  flex: 1;
}

.test-list-info h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.test-list-info p {
  font-size: 13px;
  color: var(--muted);
}

.test-list-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.test-list-meta strong {
  color: var(--text);
}

.tli-left {
  flex: 1;
}

.tli-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tli-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.tli-best {
  color: var(--warning);
  font-weight: 600;
}

.tli-right {
  flex-shrink: 0;
}

/* ====================== TOOLBAR ====================== */
.page-toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

.search-box input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(91, 124, 250, 0.25);
}

.chip:hover:not(.active) {
  border-color: var(--primary);
  color: var(--text);
  transform: translateY(-1px);
}

.chip:active {
  transform: scale(0.95);
}

/* ====================== TEST INTERFACE ====================== */
.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.test-header-info h2 {
  font-size: 20px;
}

.test-timer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  position: static;
  z-index: auto;
  flex-shrink: 0;
}

.test-timer.warning {
  color: var(--warning);
  border-color: var(--warning);
}

.test-timer.timer-warn {
  color: var(--warning);
  border-color: var(--warning);
  animation: pulse 1s infinite;
}

.test-timer.danger {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.test-progress {
  margin-bottom: 20px;
}

.test-progress-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* SAVOL + NAVIGATOR LAYOUT: chap — savol, o'ng — ixcham navigator paneli.
   Panel oqim ichida (grid column), savol bilan overlap qilmaydi. */
.test-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  margin-bottom: 20px;
  align-items: start;
}

.test-sidebar {
  position: sticky;
  top: calc(var(--topbar-h, 64px) + 12px);
  align-self: start;
  min-width: 0;
}

.question-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  min-width: 0;
}

.question-number {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 24px;
}

.question-type-tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
  vertical-align: middle;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.option:hover {
  border-color: var(--primary);
  background: var(--card-hover);
  transform: translateX(4px);
}

@media (max-width: 680px) {
  .option { transition: border-color .15s ease, background-color .15s ease; }
  .option:hover { transform: none; }
}

.option:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.option-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* FINISH MODAL SUMMARY */
#finishTestSummary {
  font-size: 14px;
  line-height: 1.8;
}

.option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.option.selected.correct {
  border-color: var(--success);
  background: rgba(45, 212, 167, 0.14);
  box-shadow: 0 0 0 3px rgba(45, 212, 167, 0.22);
}

.option.selected.correct .option-mark {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.option.selected.wrong {
  border-color: var(--danger);
  background: rgba(240, 101, 106, 0.14);
  box-shadow: 0 0 0 3px rgba(240, 101, 106, 0.22);
}

.option.selected.wrong .option-mark {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.option-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.option-badge.badge-correct {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(45, 212, 167, 0.3);
}

.option-badge.badge-wrong {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(240, 101, 106, 0.3);
}

@media (max-width: 480px) {
  .option-badge {
    position: static;
    transform: none;
    margin-left: auto;
    padding: 3px 8px;
    font-size: 11px;
  }

  .option {
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    gap: 10px;
    border-radius: 12px;
    margin: 0;
    flex-wrap: nowrap;
    align-items: center;
  }

  .option-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
  }

  .option-mark,
  .option-letter {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

.option-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: all var(--transition);
  color: var(--muted);
}

.option.selected .option-mark {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(91, 124, 250, 0.3);
}

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--transition);
}

.option.selected .option-letter {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(91, 124, 250, 0.3);
}

/* ------------------------------------------------------------------
   SAVOLLAR NAVIGATORI (DESKTOP SIDEBAR)
   Root-cause fix: oldin .navigator-area `position: fixed; top: 80px` edi —
   navigator floating overlay bo'lib asosiy savol kontenti USTIDA turardi.
   Endi u .test-body gridining o'ng ustunida ODDIY oqim elementi sifatida
   turadi (sticky scroll effekt bilan), hech qachon savol ustiga chiqmaydi.
   ------------------------------------------------------------------ */
.navigator-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  align-self: start;
  position: sticky;
  top: calc(var(--topbar-h, 64px) + 12px);
  z-index: 1;
  min-width: 0;
  max-height: calc(100vh - var(--topbar-h, 64px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.navigator-header {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}

.question-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.qn-btn {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.qn-btn:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.qn-btn:active {
  transform: scale(0.9);
}

.qn-btn.current {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.qn-btn.correct {
  background: linear-gradient(135deg, var(--success), #34d399);
  color: #fff;
  border-color: var(--success);
}

.qn-btn.wrong {
  background: linear-gradient(135deg, var(--danger), #f0656a);
  color: #fff;
  border-color: var(--danger);
}

.test-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.test-nav-center {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-marked {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: var(--warning) !important;
  color: var(--warning) !important;
}

/* MINI STATS */
.test-mini-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mini-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.mini-stat strong {
  color: var(--text);
}

.mini-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mini-answered {
  background: var(--success);
}

.mini-unanswered {
  background: var(--muted);
}

.mini-marked {
  background: var(--warning);
}

/* QUESTION DIFFICULTY TAG */
.question-diff-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.question-diff-tag.diff-beginner {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
}

.question-diff-tag.diff-intermediate {
  background: rgba(251, 191, 60, 0.15);
  color: var(--warning);
}

.question-diff-tag.diff-advanced {
  background: rgba(240, 101, 106, 0.15);
  color: var(--danger);
}

/* OPTION CHECKMARK */
.option-checkmark {
  margin-left: auto;
  font-size: 18px;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.option.selected .option-checkmark {
  opacity: 1;
}

/* QUESTION HINT */
.question-hint {
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
  border-left: 3px solid var(--primary);
}

/* QUESTION SLIDE IN */
@keyframes qSlideIn {
  from {
    opacity: 0;
    transform: translateX(15px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* NAVIGATOR LEGEND */
.navigator-header {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.navigator-legend {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.legend-correct {
  background: var(--success);
}

.legend-dot.legend-wrong {
  background: var(--danger);
}

.legend-dot.legend-marked {
  background: var(--warning);
}

/* MARKED QUESTION IN NAV */
.qn-btn.marked {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.qn-btn.marked.current {
  border-color: var(--warning);
}

/* ====================== RESULT PAGE ====================== */
.result-hero {
  text-align: center;
  padding: 40px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.result-emoji {
  font-size: 60px;
  margin-bottom: 12px;
  animation: emojiBounce 0.6s var(--bounce);
}

@keyframes emojiBounce {
  0% {
    transform: scale(0) rotate(-20deg);
  }

  60% {
    transform: scale(1.2) rotate(10deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

.result-hero h1 {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 4px;
  animation: countUp 0.5s ease 0.2s backwards;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-percent {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.result-status {
  display: inline-block;
  padding: 6px 24px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
}

.result-status.passed {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
  animation: statusPop 0.4s var(--bounce) 0.3s backwards;
}

.result-status.failed {
  background: rgba(240, 101, 106, 0.15);
  color: var(--danger);
  animation: statusPop 0.4s var(--bounce) 0.3s backwards;
}

@keyframes statusPop {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.result-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  animation: cardSlideIn 0.5s ease backwards;
}

.result-stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.result-stat-card:nth-child(2) {
  animation-delay: 0.15s;
}

.result-stat-card:nth-child(3) {
  animation-delay: 0.2s;
}

.result-stat-card:nth-child(4) {
  animation-delay: 0.25s;
}

.result-stat-card:nth-child(5) {
  animation-delay: 0.3s;
}

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

.result-stat-card .val {
  font-size: 22px;
  font-weight: 700;
}

.result-stat-card .lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.review-card {
  display: none;
}

.review-card.active {
  display: block;
}

.review-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child {
  border-bottom: none;
}

.review-q {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
}

.review-ans {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  align-items: center;
}

.review-ans .label {
  color: var(--muted);
  min-width: 140px;
}

.review-ans .ans {
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.review-correct {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
}

.review-wrong {
  background: rgba(240, 101, 106, 0.15);
  color: var(--danger);
}

.review-status {
  font-weight: 700;
  margin: 8px 0;
}

.review-status.correct {
  color: var(--success);
}

.review-status.incorrect {
  color: var(--danger);
}

/* Ripple effect for buttons */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.review-explanation {
  margin-top: 8px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
}

/* ====================== RESULTS TABLE ====================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  padding: 14px 18px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: all 0.25s ease;
}

tbody tr:hover {
  background: var(--card-hover);
  transform: scale(1.005);
}

/* ====================== LEADERBOARD ====================== */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  animation: cardSlideIn 0.4s ease backwards;
  position: relative;
  overflow: hidden;
}

.rank-item:nth-child(1) {
  animation-delay: 0.05s;
}

.rank-item:nth-child(2) {
  animation-delay: 0.1s;
}

.rank-item:nth-child(3) {
  animation-delay: 0.15s;
}

.rank-item:nth-child(4) {
  animation-delay: 0.2s;
}

.rank-item:nth-child(5) {
  animation-delay: 0.25s;
}

.rank-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-soft);
}

.rank-item.you {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.rank-position {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.rank-position.gold {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #fff;
}

.rank-position.silver {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
  color: #fff;
}

.rank-position.bronze {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
}

.rank-info {
  flex: 1;
}

.rank-name {
  font-weight: 600;
  font-size: 15px;
}

.rank-level {
  font-size: 12px;
  color: var(--muted);
}

.rank-xp {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}

/* ====================== PODIUM & LEADER LIST ====================== */
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 0;
}

.podium-place {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px 16px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  animation: cardSlideIn 0.5s var(--bounce) backwards;
}

.podium-place:nth-child(1) {
  animation-delay: 0.1s;
}

.podium-place:nth-child(2) {
  animation-delay: 0.2s;
}

.podium-place:nth-child(3) {
  animation-delay: 0.3s;
}

.podium-place:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}

.podium-place.place-1 {
  order: 2;
  padding-bottom: 28px;
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary-soft), var(--shadow-soft);
}

.podium-place.place-1 .avatar {
  width: 72px;
  height: 72px;
  font-size: 22px;
  background: linear-gradient(135deg, #5b7cfa, #8b5cf6);
  color: #fff;
}

.podium-place.place-2 {
  order: 1;
}

.podium-place.place-2 .avatar {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
  color: #fff;
}

.podium-place.place-3 {
  order: 3;
}

.podium-place.place-3 .avatar {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
}

.podium-medal {
  font-size: 28px;
  margin-bottom: 6px;
}

.podium-place .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-weight: 700;
  font-size: 18px;
  margin: 6px auto;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.p-name {
  font-weight: 700;
  font-size: 14px;
  margin-top: 6px;
}

.p-username {
  font-size: 11px;
  margin: 2px 0 6px;
}

.p-pts {
  margin-top: 4px;
  font-size: 14px;
}

.p-pts strong {
  color: var(--primary);
  font-size: 18px;
}

.leader-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  animation: cardSlideIn 0.35s ease backwards;
}

.leader-row:nth-child(1) {
  animation-delay: 0.05s;
}

.leader-row:nth-child(2) {
  animation-delay: 0.1s;
}

.leader-row:nth-child(3) {
  animation-delay: 0.15s;
}

.leader-row:nth-child(4) {
  animation-delay: 0.2s;
}

.leader-row:nth-child(5) {
  animation-delay: 0.25s;
}

.leader-row:hover {
  transform: translateX(4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.leader-row.me {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.lr-rank {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.lr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.lr-info {
  flex: 1;
}

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

.lr-name .me-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  margin-left: 6px;
  font-weight: 500;
}

.lr-user {
  font-size: 12px;
  margin-top: 2px;
}

.lr-pts {
  text-align: right;
  font-size: 13px;
}

.lr-pts strong {
  color: var(--primary);
  font-size: 18px;
  display: block;
}

@media (max-width: 768px) {
  .podium {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .podium-place.place-1 {
    order: 1;
  }

  .podium-place.place-2 {
    order: 2;
  }

  .podium-place.place-3 {
    order: 3;
  }
}

/* ====================== ACHIEVEMENTS ====================== */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.achievement-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: all var(--transition);
}

.achievement-card.unlocked {
  border-color: rgba(91, 124, 250, 0.3);
}

.achievement-card.unlocked:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow);
}

.achievement-card.unlocked:hover .achievement-icon {
  transform: scale(1.2) rotate(-10deg);
}

.achievement-card.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.achievement-icon {
  font-size: 40px;
  margin-bottom: 12px;
  transition: transform 0.4s var(--bounce);
}

.achievement-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.achievement-card p {
  font-size: 12px;
  color: var(--muted);
}

.achievement-status {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 8px;
  display: inline-block;
}

.achievement-status.unlocked {
  background: rgba(45, 212, 167, 0.15);
  color: var(--success);
}

.achievement-status.locked {
  background: var(--bg);
  color: var(--muted);
}

/* Legacy achievement class for compatibility */
.achievement {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.achievement.unlocked {
  border-color: rgba(91, 124, 250, 0.3);
}

.achievement.unlocked:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow);
}

.achievement.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.ach-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.ach-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ach-desc {
  font-size: 12px;
  color: var(--muted);
}

/* ====================== PROFILE ====================== */
.profile-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 8px 30px rgba(91, 124, 250, 0.3);
  animation: avatarIn 0.6s var(--bounce);
}

@keyframes avatarIn {
  from {
    transform: scale(0) rotate(-180deg);
  }

  to {
    transform: scale(1) rotate(0);
  }
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
}

.profile-username {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.profile-email {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.profile-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 20px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.profile-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  animation: cardSlideIn 0.4s ease backwards;
}

.profile-stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.profile-stat-card .val {
  font-size: 24px;
  font-weight: 700;
}

.profile-stat-card .lbl {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.profile-actions {
  text-align: center;
}

/* Additional profile stat styling for compatibility */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Profile stat shorthand */
.profile-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.25s ease;
}

.profile-stat:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.profile-stat .stat-label {
  color: var(--muted);
}

.profile-stat .stat-value {
  font-weight: 700;
}

/* Avatar option button */
.avatar-opt {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: all 0.3s var(--bounce);
  cursor: pointer;
}

.avatar-opt:hover {
  border-color: var(--primary);
  transform: scale(1.15) rotate(5deg);
}

.avatar-opt.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.1);
}

/* ====================== SETTINGS ====================== */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row span {
  font-size: 14px;
}

/* ====================== MODALS ====================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.15);
  animation: slideUp 0.45s var(--transition);
}

.modal-sm {
  max-width: 400px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px) scale(0.97);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  font-size: 20px;
  opacity: 0.6;
  transition: all 0.25s ease;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  opacity: 1;
  background: var(--bg);
  transform: rotate(90deg);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.9);
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.start-test-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.start-test-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.start-test-info-row .lbl {
  color: var(--muted);
  font-size: 14px;
}

.start-test-info-row .val {
  font-weight: 600;
  font-size: 14px;
}

.start-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.start-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.start-info-row span {
  color: var(--muted);
}

.start-info-row strong {
  color: var(--text);
}

/* AVATAR PICKER */
.avatar-picker {
  margin-bottom: 20px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
}

.avatar-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-option {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: all 0.3s var(--bounce);
  cursor: pointer;
}

.avatar-option:hover {
  border-color: var(--primary);
  transform: scale(1.15) rotate(5deg);
}

.avatar-option:active {
  transform: scale(0.9);
}

.avatar-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.1);
}

/* ACHIEVEMENT MODAL */
.achievement-modal-body {
  text-align: center;
  padding: 32px 24px;
}

.achievement-modal-body .ach-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.achievement-modal-body h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.achievement-modal-body p {
  color: var(--muted);
}

/* ====================== TOAST ====================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  animation: toastIn 0.35s var(--transition);
  min-width: 280px;
  max-width: 400px;
}

.toast.success {
  border-left: 4px solid var(--success);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), var(--card));
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.toast.error {
  border-left: 4px solid var(--danger);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--card));
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.toast.info {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), var(--card));
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

@keyframes toastIn {
  from {
    transform: translateY(15px) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.toast.removing {
  animation: toastOut 0.25s var(--transition) forwards;
}

@keyframes toastOut {
  to {
    transform: translateY(10px) scale(0.95);
    opacity: 0;
  }
}

/* ====================== LOADING ====================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 3000;
}

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

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay p {
  color: var(--muted);
  font-size: 14px;
}

/* ====================== MOBILE BASELINE ====================== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

body,
p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
td,
th,
button,
input,
textarea,
select {
  overflow-wrap: anywhere;
  word-break: break-word;
}

img,
svg,
canvas,
video,
iframe {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

.btn,
.nav-item,
.icon-btn,
.user-chip,
.modal-close,
.hamburger,
.auth-tab,
.pwd-toggle {
  min-height: 44px;
}

/* ====================== RESPONSIVE ====================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .hamburger {
    display: block;
  }

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

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .test-body {
    grid-template-columns: 1fr;
  }

  /* Kichik ekranlarda navigator panel OQIM ICHIDA (stack) bo'ladi —
     floating overlay emas, savolni yopmaydi */
  .test-sidebar,
  .navigator-area {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  #topbarUsername {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .page,
  .card,
  .content,
  .main {
    min-width: 0;
  }

  .card {
    overflow: hidden;
  }

  .card-header,
  .card-body,
  .modal-header,
  .modal-body,
  .modal-footer,
  .welcome-banner,
  .question-area {
    padding-left: 16px;
    padding-right: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .welcome-banner {
    flex-direction: column;
    text-align: center;
  }

  .welcome-level {
    width: 100%;
    justify-content: center;
  }

  #page-result .result-hero {
    padding: 28px 16px;
  }

  #page-result .result-emoji {
    font-size: 44px;
  }

  #page-result .result-hero h1 {
    font-size: 34px;
  }

  #page-result .result-percent {
    font-size: 22px;
  }

  #page-result .result-status {
    padding: 6px 18px;
    font-size: 14px;
  }

  #page-result .result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #page-result .result-stat-card .val {
    font-size: 20px;
  }

  .test-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }

  .test-header-info {
    min-width: 0;
  }

  .test-header-info h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .test-timer {
    text-align: center;
    flex-shrink: 0;
  }

  .question-area {
    padding: 18px;
  }

  .question-text {
    font-size: 16px;
  }

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

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: auto;
  }

  .notif-dropdown {
    width: 280px;
    right: -60px;
  }

  .sidebar {
    width: min(82vw, 320px);
  }

  .sidebar-header,
  .sidebar-nav,
  .sidebar-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .nav-item,
  .btn,
  .auth-tab,
  .pwd-toggle,
  .hamburger,
  .icon-btn {
    min-height: 46px;
  }

  .btn {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .modal {
    max-height: 88vh;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
  }

  .question-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  /* Raqamlar (1,2,3...) har doim to'liq ko'rinsin */
  .qn-btn {
    min-width: 34px;
    font-size: 13px;
    line-height: 1;
  }

  .auth-card {
    padding: 20px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-left h2 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .welcome-banner {
    padding: 24px 16px;
  }

  .welcome-banner h1 {
    font-size: 24px;
  }

  .content {
    padding: 12px 10px 88px;
  }

  .result-hero {
    padding: 24px 14px;
  }

  .result-hero h1 {
    font-size: 28px;
  }

  .result-percent {
    font-size: 18px;
  }

  .result-stat-card .val {
    font-size: 18px;
  }

  .question-area {
    padding: 16px 12px;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}

/* ====================== DUEL REJIMI STYLES ====================== */
.duel-welcome {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border);
}

.duel-setup-card {
  margin-top: 24px;
}

.duel-setup-card .form-control {
  width: 100%;
  padding: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 16px;
  margin-top: 8px;
  outline: none;
  transition: border-color var(--transition);
}

.duel-setup-card .form-control:focus {
  border-color: var(--primary);
}

.duel-history-card {
  margin-top: 24px;
}

.duel-history-table {
  width: 100%;
  border-collapse: collapse;
}

.duel-history-table th,
.duel-history-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.duel-history-table th {
  color: var(--muted);
  font-weight: 600;
}

.duel-history-table tr:last-child td {
  border-bottom: none;
}

.duel-history-win {
  color: var(--success);
  font-weight: 600;
}

.duel-history-loss {
  color: var(--danger);
  font-weight: 600;
}

.duel-history-draw {
  color: var(--warning);
  font-weight: 600;
}

/* Matchmaking Screen */
.duel-matchmaking {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.matchmaking-container {
  width: 100%;
  max-width: 600px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
  text-align: center;
}

.matchmaking-status {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 30px;
  letter-spacing: -0.5px;
  color: var(--primary-hover);
}

.matchmaking-players {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 30px;
}

.m-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
}

.m-avatar {
  width: 80px;
  height: 80px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.pulse-avatar {
  animation: pulseAvatar 1.5s infinite;
  border-color: var(--primary);
}

@keyframes pulseAvatar {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }

  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 12px rgba(99, 102, 241, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

.m-name {
  font-weight: 600;
  margin-bottom: 6px;
}

.m-status {
  font-size: 12px;
}

.matchmaking-vs {
  font-size: 24px;
  font-weight: 800;
  color: var(--muted);
  font-style: italic;
}

.matchmaking-progress-bar {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
}

.mm-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.1s linear;
}

/* Gameplay Screen */
.tow-visualizer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
}

.tow-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  min-width: 140px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.tow-player.leading {
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.tow-avatar {
  font-size: 28px;
}

.tow-info {
  display: flex;
  flex-direction: column;
}

.tow-username {
  font-size: 14px;
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tow-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-hover);
}

.tow-rope-container {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 0 20px;
  position: relative;
}

.tow-rope-line {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  opacity: 0.6;
}

.tow-rope-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  user-select: none;
}

/* Quiz Card & Options */
.duel-quiz-card {
  margin-top: 16px;
}

.duel-quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.duel-timer-badge {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  color: var(--warning);
  font-size: 14px;
  min-width: 42px;
  text-align: center;
}

.duel-timer-badge.warning {
  color: var(--danger);
  border-color: var(--danger);
  animation: timerPulse 0.5s infinite alternate;
}

@keyframes timerPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.1);
  }
}

.duel-q-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.6;
}

.duel-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.duel-opt-btn {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 15px;
  transition: all var(--transition);
  position: relative;
  width: 100%;
}

.duel-opt-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
}

.duel-opt-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.duel-opt-btn.correct {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  font-weight: 600;
}

.duel-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.duel-opt-badge {
  position: absolute;
  right: 16px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.duel-opt-badge.c-badge {
  background: var(--success);
  color: white;
}

.duel-opt-badge.w-badge {
  background: var(--danger);
  color: white;
}

.duel-opt-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  transition: all var(--transition);
}

.duel-opt-btn:hover:not(:disabled) .duel-opt-mark {
  background: var(--primary);
  color: white;
}

.duel-status-banner {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.3s;
  opacity: 0;
}

.duel-status-banner.show {
  opacity: 1;
}

.duel-status-banner.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.duel-status-banner.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.duel-status-banner.neutral {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Duel Result Page */
.duel-result #duelResultHero {
  border-bottom: 1px solid var(--border);
}

.duel-rewards-card {
  margin-top: 24px;
}

.rewards-grid {
  display: flex;
  justify-content: space-around;
  gap: 16px;
}

.reward-item {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
}

.reward-item .r-icon {
  font-size: 32px;
}

.reward-item .r-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
}

/* Floating Confetti Particle Styling */
.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-50px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .tow-visualizer {
    flex-direction: column;
    gap: 16px;
  }

  .tow-rope-container {
    width: 100%;
    margin: 10px 0;
    height: 8px;
  }

  .tow-player {
    width: 100%;
    justify-content: center;
  }

  .rewards-grid {
    flex-direction: column;
  }
}

/* ====================== DUEL REJOIN MODES & UI ====================== */
.duel-mode-chips,
.duel-diff-chips {
  display: flex;
  gap: 8px;
  background: var(--bg-alt);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 6px;
}

.duel-chip {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  transition: all 0.2s var(--transition);
  text-align: center;
}

.duel-chip:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.duel-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transform: scale(1.05);
}

/* Premium Animation Enhancements */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.premium-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
  }

  50% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
  }
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Success Animation */
@keyframes success-bounce {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

.success-bounce {
  animation: success-bounce 0.4s ease;
}

/* Confetti Animation */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 3s linear forwards;
  pointer-events: none;
  z-index: 9999;
}

/* XP Float Animation */
@keyframes xp-float {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateY(-30px) scale(1.2);
    opacity: 0;
  }
}

.xp-float {
  position: absolute;
  font-weight: 700;
  color: var(--success);
  animation: xp-float 1s ease-out forwards;
  pointer-events: none;
  z-index: 100;
}

/* Loading Skeleton */
@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--card-hover) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

/* Toast Animations */
@keyframes toast-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast {
  animation: toast-in 0.3s ease forwards;
}

.toast.toast-hiding {
  animation: toast-out 0.3s ease forwards;
}

/* Visual Timer Bar */
.duel-timer-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.duel-timer-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--success) 0%, var(--warning) 60%, var(--danger) 100%);
  transition: width 0.1s linear;
}

/* Real 2 Player Split Layout */
.duel-double-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
}

.duel-player-panel {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.panel-player-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-hover);
}

.panel-player-keys {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Selection glows before evaluation */
.duel-opt-btn.p1-selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25) !important;
  background: rgba(99, 102, 241, 0.06) !important;
}

.duel-opt-btn.p2-selected {
  border-color: var(--secondary) !important;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25) !important;
  background: rgba(6, 182, 212, 0.06) !important;
}

.duel-opt-btn.both-selected {
  border-color: var(--warning) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25) !important;
  background: rgba(245, 158, 11, 0.06) !important;
}

/* Live Score Pop Anim */
.pop-score {
  animation: scorePopEffect 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scorePopEffect {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.4);
    color: var(--success);
    text-shadow: 0 0 8px var(--success);
  }

  100% {
    transform: scale(1);
  }
}

/* Premium Duel Result Layout */
.duel-result-players-scores {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 24px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.duel-res-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 160px;
  padding: 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.duel-res-player.winner-card {
  border-color: var(--success);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  transform: translateY(-5px);
}

.duel-res-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-soft);
}

.duel-res-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duel-res-score-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-hover);
}

.duel-res-player.winner-card .duel-res-score-num {
  color: var(--success);
}

.duel-res-vs {
  font-size: 18px;
  font-weight: 800;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 768px) {
  .duel-double-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .duel-result-players-scores {
    flex-direction: column;
    gap: 16px;
  }

  .duel-res-player {
    width: 100%;
    max-width: none;
  }
}



/* ====================== SHOP & REWARDS ====================== */

/* Shop Balance Card */
.shop-balance-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  color: white;
  margin-bottom: 2rem;
  border: none;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.shop-balance-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

.balance-label {
  font-size: 1.1rem;
  font-weight: 500;
}

.balance-value {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.balance-unit {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Shop Filters */
.shop-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.filter-chip {
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-chip:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Shop Grid */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.reward-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.reward-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.reward-card.owned {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: var(--success);
}

.reward-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }
}

.reward-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.reward-rarity {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.reward-rarity.common {
  background: #9ca3af;
  color: white;
}

.reward-rarity.rare {
  background: #3b82f6;
  color: white;
}

.reward-rarity.epic {
  background: #a855f7;
  color: white;
}

.reward-rarity.legendary {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.reward-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.reward-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.btn-buy {
  flex: 1;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-buy:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.btn-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-buy.owned {
  background: var(--success);
}

/* Purchase Modal */
.purchase-confirm-content {
  text-align: center;
}

.purchase-item-preview {
  margin-bottom: 1.5rem;
}

.purchase-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.purchase-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.purchase-details {
  background: var(--bg);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.purchase-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 1rem;
}

.purchase-row.purchase-after {
  border-top: 2px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 1rem;
  font-weight: 600;
}

.purchase-price {
  color: var(--primary);
  font-weight: 600;
}

.purchase-after-balance {
  color: var(--success);
  font-weight: 700;
  font-size: 1.1rem;
}

.purchase-question {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

/* Purchase Success Animation */
@keyframes purchaseSuccess {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.purchase-success {
  animation: purchaseSuccess 0.5s ease-out;
}

/* ====================== AVATAR STUDIO ====================== */

/* Avatar Preview Card */
.avatar-preview-card {
  margin-bottom: 2rem;
}

.avatar-preview-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.avatar-display {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--accent-bg) 100%);
  border-radius: 50%;
  border: 4px solid var(--primary);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.avatar-base {
  font-size: 6rem;
  z-index: 1;
}

.avatar-equipped-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.equipped-item-overlay {
  position: absolute;
  font-size: 3rem;
  animation: itemEquip 0.3s ease-out;
}

@keyframes itemEquip {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.equipped-item-overlay.hat {
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
}

.equipped-item-overlay.glasses {
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
}

.equipped-item-overlay.badge {
  bottom: 5%;
  right: 5%;
  font-size: 2rem;
}

.equipped-item-overlay.frame {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 8rem;
  opacity: 0.6;
}

/* Equipped List */
.equipped-list {
  width: 100%;
  max-width: 500px;
}

.equipped-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.equipped-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.equipped-item-icon {
  font-size: 1.5rem;
}

.equipped-item-name {
  font-weight: 500;
}

.btn-unequip {
  background: var(--error);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-unequip:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* Inventory Section */
.inventory-section {
  margin-bottom: 2rem;
}

.inventory-section h2 {
  margin-bottom: 1.5rem;
  color: var(--text);
}

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

.inventory-item {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.inventory-item:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.inventory-item.equipped {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: var(--primary);
}

.inventory-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

.inventory-name {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.inventory-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.btn-equip {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-equip:hover {
  background: var(--primary-dark);
}

.btn-equip.equipped {
  background: var(--success);
}

.empty-inventory {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-inventory-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
  .shop-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .reward-icon {
    font-size: 3rem;
  }

  .balance-value {
    font-size: 2rem;
  }

  .avatar-display {
    width: 150px;
    height: 150px;
  }

  .avatar-base {
    font-size: 4rem;
  }

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #ffffff;
  }

  .btn,
  .option,
  .card {
    border-width: 2px;
  }
}

/* ====================== STORE & DO'KON SECTION ====================== */
.store-hero {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.85) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.store-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-hover);
  text-transform: uppercase;
}

.store-hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-top: 4px;
  color: #fff;
}

.store-hero p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.store-balance {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.store-balance span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.store-balance strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--warning);
  margin-top: 2px;
}

.store-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.store-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.store-card-heading {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 20px;
}

.store-live {
  color: var(--success);
  animation: pulseLive 1.5s infinite alternate;
}

@keyframes pulseLive {
  0% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.store-avatar-stage {
  position: relative;
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.08));
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  overflow: visible;
}

.store-avatar-stage:hover {
  transform: scale(1.03);
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.2);
}

.store-avatar-base {
  font-size: 4.5rem;
  z-index: 1;
}

.store-avatar-item {
  position: absolute;
  font-size: 2.2rem;
  display: none;
  animation: itemEquip 0.3s var(--bounce);
  z-index: 2;
}

.store-avatar-item.visible {
  display: block;
}

.store-avatar-hat {
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
}

.store-avatar-glasses {
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
}

.store-avatar-clothes {
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
}

.store-avatar-badge {
  bottom: 10px;
  right: 10px;
  font-size: 1.5rem;
  z-index: 3;
}

/* Background Effects styled via stage classes */
.store-avatar-stage.store-bg-galaxy {
  background: radial-gradient(circle, #2e1065 0%, #0f172a 100%);
  border-color: #a855f7;
}

.store-avatar-stage.store-bg-ocean {
  background: radial-gradient(circle, #0e7490 0%, #0f172a 100%);
  border-color: #06b6d4;
}

.store-avatar-stage.store-bg-sunset {
  background: radial-gradient(circle, #b45309 0%, #0f172a 100%);
  border-color: #f59e0b;
}

.store-avatar-stage.store-frame-diamond {
  border: 4px solid #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

.store-avatar-stage.store-frame-fire {
  border: 4px solid #f97316;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.4);
}

.store-avatar-stage.store-frame-gold {
  border: 4px solid #fbbf24;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.store-avatar-stage.store-frame-silver {
  border: 4px solid #9ca3af;
  box-shadow: 0 0 20px rgba(156, 163, 175, 0.4);
}

.store-avatar-stage.store-effect-sparkle::before {
  content: '✨';
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 1.2rem;
  animation: float 2s infinite ease-in-out;
}

.store-avatar-stage.store-effect-glow {
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.45);
}

.store-avatar-stage.store-effect-rainbow {
  animation: rainbowGlow 5s linear infinite;
}

@keyframes rainbowGlow {

  0%,
  100% {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  }

  33% {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  }

  66% {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  }
}

#storeAvatarName {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

.store-equipped {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  width: 100%;
}

.store-equipped-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.store-equipped-pill:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
  transform: translateY(-1px);
}

.store-equipped-pill b {
  font-weight: 800;
  margin-left: 4px;
  opacity: 0.7;
}

.store-inventory-title {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 24px;
  margin-bottom: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.store-inventory {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.store-inventory-item {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.store-inventory-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: scale(1.05);
}

.store-inventory-item.equipped {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.store-inventory-item span {
  font-size: 28px;
}

.store-inventory-item small {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
}

.store-inventory-item.equipped small {
  color: var(--primary-hover);
}

.store-empty-equipped,
.store-empty-inventory {
  font-size: 13px;
  color: var(--muted);
  padding: 12px;
  width: 100%;
}

.store-empty-inventory {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 0;
}

/* Store Catalog (Right side) */
.store-catalog {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.store-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.store-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.store-tab {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.store-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.store-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.store-catalog-count {
  font-size: 13px;
  color: var(--muted);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.store-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transition: all 0.25s var(--transition);
  position: relative;
  overflow: hidden;
}

.store-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.store-item:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.store-item:hover::before {
  transform: scaleX(1);
}

.store-item-art {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease;
}

.store-item:hover .store-item-art {
  transform: scale(1.08) rotate(3deg);
}

/* Rarity classes styling */
.store-item-art.rarity-common {
  background: rgba(156, 163, 175, 0.08);
  border-color: rgba(156, 163, 175, 0.15);
}

.store-item-art.rarity-rare {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.15);
}

.store-item-art.rarity-epic {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.15);
}

.store-item-art.rarity-legendary {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.15);
}

.store-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.store-rarity {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rarity-text-common {
  color: #9ca3af;
}

.rarity-text-rare {
  color: #60a5fa;
}

.rarity-text-epic {
  color: #c084fc;
}

.rarity-text-legendary {
  color: #fbbf24;
}

.store-item-type {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.store-item h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.store-item p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

.store-owned-status {
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 12px;
}

.store-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.store-item-footer strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--warning);
}

.store-item-action {
  flex: 1;
  background: var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.15);
}

.store-item-action:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.store-item-action:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: not-allowed;
}

.store-item-action.owned {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
  box-shadow: none;
}

.store-item-action.owned:hover {
  background: var(--success);
  color: #fff;
}

.store-item-action.locked {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

@media (max-width: 768px) {
  .store-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .store-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 16px;
    gap: 14px;
    min-width: 0;
  }

  .store-hero h1 {
    font-size: clamp(22px, 6vw, 28px);
  }

  .store-balance {
    align-items: flex-start;
    width: 100%;
    padding: 12px 14px;
  }

  .store-balance strong {
    font-size: clamp(20px, 7vw, 24px);
  }

  .store-preview,
  .store-catalog,
  .store-hero,
  .store-toolbar,
  .store-item,
  .store-tabs,
  .store-item-footer,
  .store-item-action {
    min-width: 0;
  }

  .store-preview {
    padding: 18px 14px;
  }

  .store-avatar-stage {
    width: 130px;
    height: 130px;
    margin-bottom: 12px;
  }

  .store-avatar-base {
    font-size: 4rem;
  }

  .store-equipped {
    justify-content: center;
  }

  .store-inventory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .store-inventory-item {
    min-height: 80px;
  }

  .store-toolbar {
    align-items: stretch;
  }

  .store-tabs {
    width: 100%;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }

  .store-tab {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .store-item {
    padding: 14px 12px;
  }

  .store-item h3 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .store-item p {
    font-size: 11px;
    min-height: 0;
  }

  .store-item-meta {
    gap: 8px;
    flex-wrap: wrap;
  }

  .store-item-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .store-item-footer strong {
    font-size: 15px;
  }

  .store-item-action {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.2;
  }
}

@media (max-width: 480px) {
  .store-hero {
    padding: 16px 14px;
  }

  .store-grid {
    grid-template-columns: 1fr;
  }

  .store-inventory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-item-action {
    font-size: 11px;
  }

  .store-tabs {
    gap: 4px;
  }

  .store-tab {
    padding: 8px 10px;
    font-size: 11px;
  }

  .store-catalog-count {
    font-size: 12px;
  }

  .store-avatar-stage {
    width: 116px;
    height: 116px;
  }

  .store-card-heading,
  .store-inventory-title {
    font-size: 10px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }
}

/* ====================== PREMIUM HERO BANNER & ANIMATIONS ====================== */
/* ====================== PREMIUM HERO BANNER & ANIMATIONS ====================== */
.hero-premium {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 2;
  min-width: 0;
}

.hero-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary-hover);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
  max-width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: normal;
}

.hero-top-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulseBadge 1.5s infinite alternate;
}

@keyframes pulseBadge {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.3);
    opacity: 1;
  }
}

.hero-title {
  font-size: clamp(22px, 2.5vw, 32px) !important;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
  color: #fff;
  word-break: break-word;
}

.hero-gradient-text {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.hero-subtitle {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 520px;
  margin-top: 4px;
}

.hero-bottom-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.hero-user-row {
  display: flex;
  align-items: center;
}

.hero-user-text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.hero-right {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  width: 100%;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-main-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hero-image-wrap:hover .hero-main-image {
  transform: scale(1.05);
}

.hero-ring-glow {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: 0.15;
  filter: blur(10px);
  pointer-events: none;
}

.hero-code-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 3;
}

.hero-code-badge:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.hero-code-html {
  top: 8%;
  left: 5px;
}

.hero-code-py {
  bottom: 12%;
  left: 5px;
}

.hero-code-js {
  top: 8%;
  right: 5px;
}

.hero-code-java {
  bottom: 12%;
  right: 5px;
}

.hero-code-sql {
  top: 45%;
  right: 5px;
}

@media (max-width: 1100px) {
  .hero-premium {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 20px;
  }

  .hero-right {
    display: flex;
    justify-content: center;
  }

  .hero-code-badge {
    display: none;
  }
}

/* ====================== CODE PLAYGROUND & CODING SECTION (PROFESSIONAL IDE) ====================== */
.coding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  margin-bottom: 16px;
}

.coding-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.coding-editor-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.coding-tab {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}

.coding-tab:hover {
  color: var(--text);
}

.coding-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.coding-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coding-select-wrap select {
  min-width: 170px;
}

.coding-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.coding-runtime-status {
  color: var(--success, #34d399);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}

.coding-runtime-status[data-state="running"] {
  color: var(--warning, #fbbf24);
}

.coding-runtime-status[data-state="warning"] {
  color: var(--danger, #fb7185);
}

/* Auto Run Switch */
.auto-run-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.auto-run-switch input {
  display: none;
}

.auto-run-switch .slider {
  width: 36px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  transition: background-color 0.2s ease;
  border: 1px solid var(--border);
}

.auto-run-switch .slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background-color: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.auto-run-switch input:checked+.slider {
  background-color: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}

.auto-run-switch input:checked+.slider::before {
  transform: translateX(16px);
  background-color: var(--success);
}

.auto-run-switch input:checked~.switch-label {
  color: var(--success);
}

.coding-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coding-workspace {
  display: grid;
  grid-template-columns: 180px minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 220px);
  align-items: stretch;
}

.coding-explorer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-bottom: 0;
  overflow: hidden;
  background: #111827;
}

.coding-explorer-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.coding-project-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 7px;
  font: 12px/1.5 'Consolas', 'Monaco', monospace;
}

.coding-tree-root,
.coding-tree-folder {
  padding: 5px 7px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coding-file {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px 7px 20px;
  border-radius: 5px;
  color: var(--text);
  text-align: left;
  font: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coding-file:hover,
.coding-file.active {
  background: rgba(99, 102, 241, .18);
  color: #fff;
}

.coding-explorer-footer {
  margin-top: auto;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  font-size: 10px;
}

.coding-editor-panel,
.coding-output-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-bottom: 0;
  overflow: hidden;
}

.editor-header,
.output-tabs {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.editor-shortcuts {
  font-size: 11px;
}

.editor-body {
  flex: 1;
  position: relative;
  background: #090d16;
  overflow: hidden;
}

.editor-view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.editor-view.active {
  display: flex;
  z-index: 10;
  pointer-events: auto;
}

.editor-container {
  flex: 1;
  display: flex;
  position: relative;
  background: #090d16;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  height: 100%;
  overflow: hidden;
  pointer-events: auto;
}

.line-numbers {
  width: 48px;
  padding: 16px 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  font-family: inherit;
  overflow: hidden;
  box-sizing: border-box;
}

.editor-surface {
  position: relative;
  flex: 1;
  height: 100%;
  background: #090d16;
  overflow: hidden;
}

.editor-highlight,
.code-textarea {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 16px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  word-wrap: normal;
  overflow: auto;
}

.editor-highlight {
  pointer-events: none;
  color: #e2e8f0;
  background: transparent;
  z-index: 1;
  overflow: hidden;
}

.editor-highlight .token-html-tag,
.editor-highlight .token-html-attr-name,
.editor-highlight .token-html-attr-value,
.editor-highlight .token-html-comment,
.editor-highlight .token-html-text,
.editor-highlight .token-css-selector,
.editor-highlight .token-css-property,
.editor-highlight .token-css-value,
.editor-highlight .token-css-at-rule,
.editor-highlight .token-css-media,
.editor-highlight .token-css-variable,
.editor-highlight .token-css-class,
.editor-highlight .token-css-id,
.editor-highlight .token-css-pseudo,
.editor-highlight .token-css-comment,
.editor-highlight .token-css-string,
.editor-highlight .token-js-keyword,
.editor-highlight .token-js-function,
.editor-highlight .token-js-variable,
.editor-highlight .token-js-string,
.editor-highlight .token-js-number,
.editor-highlight .token-js-boolean,
.editor-highlight .token-js-operator,
.editor-highlight .token-js-comment,
.editor-highlight .token-js-builtin,
.editor-highlight .token-js-property,
.editor-highlight .token-js-template,
.editor-highlight .token-js-console,
.editor-highlight .token-python-keyword,
.editor-highlight .token-python-function,
.editor-highlight .token-python-string,
.editor-highlight .token-python-number,
.editor-highlight .token-python-comment,
.editor-highlight .token-python-class,
.editor-highlight .token-python-variable,
.editor-highlight .token-java-keyword,
.editor-highlight .token-java-class,
.editor-highlight .token-java-method,
.editor-highlight .token-java-string,
.editor-highlight .token-java-number,
.editor-highlight .token-java-comment,
.editor-highlight .token-cpp-keyword,
.editor-highlight .token-cpp-type,
.editor-highlight .token-cpp-function,
.editor-highlight .token-cpp-string,
.editor-highlight .token-cpp-number,
.editor-highlight .token-cpp-comment,
.editor-highlight .token-csharp-keyword,
.editor-highlight .token-csharp-type,
.editor-highlight .token-csharp-function,
.editor-highlight .token-csharp-string,
.editor-highlight .token-csharp-number,
.editor-highlight .token-csharp-comment,
.editor-highlight .token-sql-keyword,
.editor-highlight .token-sql-table,
.editor-highlight .token-sql-field,
.editor-highlight .token-sql-string,
.editor-highlight .token-sql-number,
.editor-highlight .token-sql-comment,
.editor-highlight .token-sql-function {
  font-family: inherit;
}

.editor-highlight .token-html-tag { color: #67e8f9; }
.editor-highlight .token-html-attr-name { color: #fbbf24; }
.editor-highlight .token-html-attr-value { color: #fca5a5; }
.editor-highlight .token-html-comment { color: #34d399; }
.editor-highlight .token-html-text { color: #e2e8f0; }

.editor-highlight .token-css-selector { color: #c4b5fd; }
.editor-highlight .token-css-property { color: #7dd3fc; }
.editor-highlight .token-css-value { color: #fbbf24; }
.editor-highlight .token-css-at-rule { color: #a78bfa; }
.editor-highlight .token-css-media { color: #a78bfa; }
.editor-highlight .token-css-variable { color: #f9a8d4; }
.editor-highlight .token-css-class { color: #f9a8d4; }
.editor-highlight .token-css-id { color: #fca5a5; }
.editor-highlight .token-css-pseudo { color: #f0abfc; }
.editor-highlight .token-css-comment { color: #34d399; }
.editor-highlight .token-css-string { color: #fda4af; }
.editor-highlight .token-css-number { color: #fca5a5; }

.editor-highlight .token-js-keyword { color: #c084fc; }
.editor-highlight .token-js-function { color: #7dd3fc; }
.editor-highlight .token-js-variable { color: #f8fafc; }
.editor-highlight .token-js-string { color: #fbbf24; }
.editor-highlight .token-js-number { color: #fca5a5; }
.editor-highlight .token-js-boolean { color: #c084fc; }
.editor-highlight .token-js-operator { color: #cbd5e1; }
.editor-highlight .token-js-comment { color: #34d399; }
.editor-highlight .token-js-builtin { color: #7dd3fc; }
.editor-highlight .token-js-property { color: #a5f3fc; }
.editor-highlight .token-js-template { color: #fcd34d; }
.editor-highlight .token-js-console { color: #7dd3fc; }

.editor-highlight .token-python-keyword { color: #c084fc; }
.editor-highlight .token-python-function { color: #7dd3fc; }
.editor-highlight .token-python-string { color: #fbbf24; }
.editor-highlight .token-python-number { color: #fca5a5; }
.editor-highlight .token-python-comment { color: #34d399; }
.editor-highlight .token-python-class { color: #f9a8d4; }
.editor-highlight .token-python-variable { color: #f8fafc; }

.editor-highlight .token-java-keyword { color: #c084fc; }
.editor-highlight .token-java-class { color: #f9a8d4; }
.editor-highlight .token-java-method { color: #7dd3fc; }
.editor-highlight .token-java-string { color: #fbbf24; }
.editor-highlight .token-java-number { color: #fca5a5; }
.editor-highlight .token-java-comment { color: #34d399; }

.editor-highlight .token-cpp-keyword { color: #c084fc; }
.editor-highlight .token-cpp-type { color: #7dd3fc; }
.editor-highlight .token-cpp-function { color: #60a5fa; }
.editor-highlight .token-cpp-string { color: #fbbf24; }
.editor-highlight .token-cpp-number { color: #fca5a5; }
.editor-highlight .token-cpp-comment { color: #34d399; }

.editor-highlight .token-csharp-keyword { color: #c084fc; }
.editor-highlight .token-csharp-type { color: #7dd3fc; }
.editor-highlight .token-csharp-function { color: #60a5fa; }
.editor-highlight .token-csharp-string { color: #fbbf24; }
.editor-highlight .token-csharp-number { color: #fca5a5; }
.editor-highlight .token-csharp-comment { color: #34d399; }

.editor-highlight .token-sql-keyword { color: #c084fc; }
.editor-highlight .token-sql-table { color: #7dd3fc; }
.editor-highlight .token-sql-field { color: #a5f3fc; }
.editor-highlight .token-sql-string { color: #fbbf24; }
.editor-highlight .token-sql-number { color: #fca5a5; }
.editor-highlight .token-sql-comment { color: #34d399; }
.editor-highlight .token-sql-function { color: #60a5fa; }

.code-textarea {
  flex: 1;
  background: transparent;
  color: transparent;
  caret-color: #f1f5f9;
  border: none;
  outline: none;
  resize: none;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  z-index: 2;
  overflow: auto;
  text-shadow: none;
}

.code-textarea::selection {
  background: rgba(148, 163, 184, 0.25);
}

/* ==========================================================
   LAYER HIERARCHY & CLICK AUDIT
   Maqsad: dekorativ elementlar HECH QACHON button/link/text
   clickini ushlab qolmasin. Hierarchy:
     background/dekor      → z-index: auto/0  + pointer-events: none
     content (cards/hero)  → z-index: 1–10
     topbar                → z-index: 90
     sidebar (drawer)      → z-index: 100
     modal                 → z-index: 1000
     toast                 → z-index: 2000
     loading               → z-index: 3000
     confetti (decor)      → z-index: 9999 (pointer-events: none)
   ========================================================== */

/* --- Dekorativ pseudo-elementlar / overlaylar: faqat vizual --- */
.auth-bg::after,
.auth-bg .orb,
.welcome-banner::before,
.welcome-banner::after,
.btn::after,
.xp-bar-fill::after,
.progress-fill::after,
.subject-card::before,
.store-item::before,
.store-avatar-stage.store-effect-sparkle::before,
.sidebar .nav-item.active::before,
.hero-ring-glow {
  pointer-events: none;
}

/* Hero'dagi suzuvchi kod badge'lari — aria-hidden dekoratsiyalar:
   ular :hover'ga ega, lekin clickni ushlab qolmasin. */
.hero-code-badge {
  pointer-events: none;
}

/* Header ichidagi barcha interactive elementlar aniq clickable
   (transparent overlay ular ustida qolmasin): */
.topbar .hamburger,
.topbar .icon-btn,
.topbar .notif-btn,
.topbar .user-chip,
.topbar .ux-user-dropdown .ux-menu-item {
  position: relative;
  z-index: 2;
  cursor: pointer;
}

/* Header background/border qatlami — elementlar ostida, click to'siq emas */
.topbar::before {
  content: none;
}

/* Scroll'da header Ostidagi content hech qachon ko'rinmasin:
   sticky header oqimda — padding-top hack talab etilmadi.
   (fixed header variantida mobile safe-area header ICHIDA hisoblanadi) */

.code-textarea:focus {
  outline: none;
}

/* RC7: color: transparent bilan birga placeholder ham ko'rinadigan bo'lishi kerak */
.code-textarea::placeholder {
  color: #475569;
  opacity: 1;
}

/* ====================== REAL EXECUTION (Worker runtime) ====================== */
/* stdin paneli — Python input() / C++ cin uchun */
.stdin-panel {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.stdin-textarea {
  width: 100%;
  height: 72px;
  background: #090d16;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}

.stdin-textarea:focus {
  border-color: rgba(99, 102, 241, 0.4);
}

/* STDOUT / STDERR bo'limlari */
.console-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.console-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.6);
  color: #94a3b8;
}

.console-section-title.stdout { color: #34d399; }
.console-section-title.stderr { color: #f87171; }

.console-section-body {
  padding: 8px 10px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
  max-height: 240px;
  overflow: auto;
}

/* SQL real query natijalari */
.sql-result-table {
  border-collapse: collapse;
  margin: 8px 0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  max-width: 100%;
}

.sql-result-table th,
.sql-result-table td {
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  text-align: left;
}

.sql-result-table th {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  font-weight: 700;
}

.sql-result-table td {
  color: #e2e8f0;
}

/* Output Panel Tabs */
.output-tabs {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.output-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.output-tab:hover {
  color: var(--text);
}

.output-tab.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-hover);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.output-body {
  flex: 1;
  position: relative;
  background: #090d16;
  overflow: hidden;
}

.output-view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.output-view.active {
  display: flex;
  flex-direction: column;
}

#codingIframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* DevTools Console & Error logs */
.console-toolbar {
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.console-logs {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.console-line {
  padding: 6px 10px;
  border-radius: 4px;
  word-break: break-all;
  font-family: inherit;
}

.console-line.log {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}

.console-line.warn {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.console-line.error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border-left: 3px solid #ef4444;
  font-weight: 500;
}

.console-line.info {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.06);
}

/* Mobile responsive split */
@media (max-width: 992px) {
  .coding-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .coding-explorer {
    min-height: 0;
  }

  .coding-project-tree {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .coding-tree-root,
  .coding-tree-folder {
    display: none;
  }

  .coding-file {
    width: auto;
    padding: 7px 10px;
  }

  .coding-editor-panel {
    height: 450px;
  }

  .coding-output-panel {
    height: 450px;
  }
}

/* ====================== CERTIFICATE STYLING ====================== */
.cert-page-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px;
}

.cert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.cert-header-left h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.cert-header-left p {
  color: var(--muted);
  font-size: 14px;
}

.cert-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cert-card-wrapper {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

.cert-card-border {
  border: 4px double var(--primary);
  border-radius: var(--radius);
  padding: 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(56, 189, 248, 0.05));
  position: relative;
}

.cert-card-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  text-align: center;
}

.cert-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cert-badge-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.cert-id-tag {
  font-family: monospace;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.cert-main-title h2 {
  font-size: 32px;
  letter-spacing: 4px;
  color: var(--primary);
  margin-bottom: 4px;
}

.cert-subtitle {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 600;
}

.cert-given-to {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.cert-student-name {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-underline-offset: 8px;
}

.cert-achievement-text {
  max-width: 680px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.cert-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cert-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.cert-meta-lbl {
  color: var(--muted);
}

.cert-meta-val {
  color: var(--text);
}

.cert-status-ok {
  color: var(--success);
}

.cert-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.cert-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.cert-qr-svg {
  width: 60px;
  height: 60px;
  border-radius: 6px;
}

.cert-signature-box {
  text-align: right;
  font-size: 13px;
}

.cert-sig-line {
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--text);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.cert-sig-title {
  color: var(--muted);
  font-size: 12px;
}

@media print {
  body * {
    visibility: hidden;
  }
  #certPrintArea, #certPrintArea * {
    visibility: visible;
  }
  #certPrintArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

/* Developer Tools guard overlay — desktopda faqat DevTools aniqlanganda ko'rinadi. */
#devtoolsGuard { position:fixed; inset:0; z-index:2147483647; display:grid; place-items:center; padding:24px; background:rgba(3,10,25,.94); backdrop-filter:blur(12px); color:#f8fafc; }
#devtoolsGuard[hidden] { display:none; }
.devtools-guard__card { width:min(420px,100%); padding:30px; border:1px solid rgba(96,165,250,.4); border-radius:22px; background:linear-gradient(145deg,#102650,#09182f); box-shadow:0 24px 70px rgba(0,0,0,.45); text-align:center; }
.devtools-guard__icon { display:grid; width:52px; height:52px; place-items:center; margin:0 auto 15px; border-radius:16px; background:rgba(59,130,246,.2); color:#60a5fa; font:800 19px/1 ui-monospace,monospace; }
.devtools-guard__card h2 { margin:0 0 8px; font-size:20px; color:#fff; }.devtools-guard__card p { margin:0; color:#b8c7df; line-height:1.55; }
