@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

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

:root {
  --primary: #7f5af0;
  --bg-primary: #0f0e17;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text-main: #fffffe;
  --text-secondary: #a7a9be;
  --text-muted: #72757e;
  --accent: #7f5af0;
  --accent-light: #a7a9be;
  --accent2: #2cb67d;
  --accent3: #ef4565;
  --accent4: #f9bc60;
  --sidebar-width: 280px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,0.3);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --gradient: linear-gradient(135deg, #7f5af0 0%, #2cb67d 100%);
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 15px; }

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  width: 100%;
}

body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 20% 20%, rgba(127,90,240,0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(44,182,125,0.06) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

/* === LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
  position: fixed;
  right: 0;
  top: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  text-align: center; padding: 16px 0 32px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 24px;
}

.sidebar-logo h1 {
  font-size: 1.5rem; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}

.sidebar-logo p { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition); font-size: 0.95rem; font-weight: 500;
  border: none; background: none; width: 100%; text-align: right;
  font-family: inherit;
}

.nav-item i { width: 20px; height: 20px; opacity: 0.7; }

.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.nav-item.active {
  background: rgba(127,90,240,0.15); color: var(--accent-light);
  border-right: 3px solid var(--accent);
}

.nav-item.active i { opacity: 1; }

.main-content {
  flex: 1; margin-right: var(--sidebar-width);
  padding: 32px; min-height: 100vh;
}

/* === HEADER === */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}

.page-header h2 { font-size: 1.8rem; font-weight: 700; }

.page-header p { color: var(--text-secondary); margin-top: 4px; }

/* === CARDS === */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { background: var(--bg-card-hover); transform: translateY(-2px); box-shadow: var(--shadow); }

/* === STAT CARDS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 32px; }

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.purple { background: rgba(127,90,240,0.15); color: var(--accent); }
.stat-icon.green { background: rgba(44,182,125,0.15); color: var(--accent2); }
.stat-icon.red { background: rgba(225,97,98,0.15); color: var(--accent3); }
.stat-icon.yellow { background: rgba(249,188,96,0.15); color: var(--accent4); }

.stat-info h3 { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-info p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(127,90,240,0.4); }

.btn-success { background: var(--accent2); color: #fff; }
.btn-success:hover { background: #239e6c; }

.btn-danger { background: var(--accent3); color: #fff; }
.btn-danger:hover { background: #c94e4f; }

.btn-warning { background: var(--accent4); color: #1a1a2e; }

.btn-outline {
  background: transparent; color: var(--accent-light);
  border: 1px solid var(--accent); 
}
.btn-outline:hover { background: rgba(127,90,240,0.1); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

.btn-icon {
  width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}

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

.form-group label {
  display: block; margin-bottom: 8px;
  font-weight: 600; font-size: 0.9rem; color: var(--text-secondary);
}

.form-control {
  width: 100%; padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(127,90,240,0.15); }

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

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a7a9be' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px center;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* === RADIO/CHECK CARDS === */
.option-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.option-card {
  padding: 20px; border-radius: var(--radius-sm);
  border: 2px solid var(--glass-border);
  background: var(--bg-card);
  cursor: pointer; text-align: center;
  transition: var(--transition);
}

.option-card:hover { border-color: var(--accent); background: rgba(127,90,240,0.05); }

.option-card.selected { border-color: var(--accent); background: rgba(127,90,240,0.1); }

.option-card .icon { font-size: 2rem; margin-bottom: 8px; }
.option-card .label { font-weight: 600; font-size: 0.95rem; }
.option-card .desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* === TABLES === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--glass-border); }

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 14px 16px; text-align: right;
  background: var(--bg-secondary); color: var(--text-secondary);
  font-weight: 600; font-size: 0.85rem;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.9rem;
}

tbody tr:hover { background: var(--bg-card-hover); }

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

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}

.badge-quiz { background: rgba(127,90,240,0.15); color: var(--accent-light); }
.badge-review { background: rgba(44,182,125,0.15); color: var(--accent2); }
.badge-competition { background: rgba(249,188,96,0.15); color: var(--accent4); }
.badge-success { background: rgba(44,182,125,0.15); color: var(--accent2); }
.badge-danger { background: rgba(225,97,98,0.15); color: var(--accent3); }

/* === MODAL === */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px; width: 90%; max-width: 560px;
  max-height: 80vh; overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { font-size: 1.3rem; font-weight: 700; }

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

.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  color: var(--text-primary); font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 280px;
}

.toast.success { border-color: var(--accent2); }
.toast.error { border-color: var(--accent3); }

@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-20px); } }

/* === STEPS === */
.steps { display: flex; gap: 8px; margin-bottom: 32px; }

.step {
  flex: 1; padding: 12px; text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-muted);
  font-size: 0.85rem; font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
}

.step.active { background: rgba(127,90,240,0.15); color: var(--accent-light); border-color: var(--accent); }
.step.done { background: rgba(44,182,125,0.1); color: var(--accent2); }

/* === QUESTION CARD === */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px;
  transition: var(--transition);
}

.question-card:hover { border-color: rgba(127,90,240,0.3); }

.question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.question-number { font-weight: 700; color: var(--accent-light); font-size: 0.9rem; }
.question-actions { display: flex; gap: 8px; }

.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  cursor: pointer; transition: var(--transition);
}

.option-item:hover { border-color: var(--accent); background: rgba(127,90,240,0.05); }

.option-item.correct { border-color: var(--accent2); background: rgba(44,182,125,0.1); }
.option-item.wrong { border-color: var(--accent3); background: rgba(225,97,98,0.1); }
.option-item.selected { border-color: var(--accent); background: rgba(127,90,240,0.1); }

.option-radio {
  width: 20px; height: 20px;
  border: 2px solid var(--glass-border);
  border-radius: 50%; flex-shrink: 0;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.option-item.selected .option-radio { border-color: var(--accent); }
.option-item.selected .option-radio::after { content: ''; width: 10px; height: 10px; background: var(--accent); border-radius: 50%; }

/* === QUIZ TAKER PAGE === */
.quiz-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; z-index: 1;
}

.quiz-container { width: 100%; max-width: 720px; }

.quiz-header-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 40px;
  text-align: center; margin-bottom: 24px;
}

.quiz-header-card h1 { font-size: 1.8rem; margin-bottom: 8px; }

.quiz-progress { margin-bottom: 24px; }

.progress-bar {
  width: 100%; height: 8px;
  background: var(--bg-card); border-radius: 4px;
  overflow: hidden; margin-top: 8px;
}

.progress-fill {
  height: 100%; background: var(--gradient);
  border-radius: 4px; transition: width 0.4s ease;
}

.timer {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-radius: 20px;
  background: rgba(225,97,98,0.1); color: var(--accent3);
  font-weight: 700; font-size: 1.1rem;
}

.timer.warning { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.result-card {
  text-align: center; padding: 48px;
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.result-score {
  font-size: 4rem; font-weight: 900;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 16px 0;
}

.result-details { display: flex; justify-content: center; gap: 32px; margin: 24px 0; }
.result-detail { text-align: center; }
.result-detail .value { font-size: 1.5rem; font-weight: 700; }
.result-detail .label { font-size: 0.8rem; color: var(--text-secondary); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* === CHARTS === */
.chart-container { position: relative; height: 300px; }

/* === SHARE === */
.share-box {
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 24px; text-align: center;
}

.share-link {
  display: flex; gap: 8px; margin: 16px 0;
}

.share-link input {
  flex: 1; padding: 12px 16px;
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: inherit; font-size: 0.85rem;
  direction: ltr; text-align: left;
}

.share-buttons { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }

.qr-code { margin: 20px auto; display: flex; justify-content: center; }
.qr-code canvas { border-radius: var(--radius-sm); }

/* === LOADING === */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

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

.loading-text { text-align: center; color: var(--text-muted); margin-top: 12px; }

/* === ANIMATIONS === */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === PAGE SECTIONS === */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.3s ease; }

/* === CONTENT GRID === */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.content-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 24px;
  transition: var(--transition); cursor: pointer;
}

.content-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(127,90,240,0.3); }

.content-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.content-card-title { font-size: 1.1rem; font-weight: 700; }
.content-card-meta { display: flex; gap: 16px; color: var(--text-muted); font-size: 0.8rem; margin-top: 12px; }
.content-card-meta span { display: flex; align-items: center; gap: 4px; }
.content-card-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--glass-border); }

/* === AI SECTION === */
.ai-box {
  background: linear-gradient(135deg, rgba(127,90,240,0.1), rgba(44,182,125,0.1));
  border: 1px solid rgba(127,90,240,0.2);
  border-radius: var(--radius); padding: 32px;
  text-align: center;
}

.ai-box h3 { margin-bottom: 8px; }
.ai-box p { color: var(--text-secondary); margin-bottom: 20px; }

/* === STEP NAVIGATION === */
.step-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; gap: 12px; flex-wrap: wrap;
}

/* === QUESTIONS HEADER === */
.questions-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.questions-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }


/* === MOBILE MENU === */
.mobile-menu-btn {
  display: none;
  width: 44px; height: 44px;
  background: transparent; border: none;
  color: var(--text-main); font-size: 1.5rem;
  cursor: pointer; align-items: center; justify-content: center;
}

.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 998;
}
.sidebar-overlay.open { display: block; }

/* === MOBILE TOP BAR === */
.mobile-top-bar {
  display: none; position: fixed;
  top: 0; left: 0; right: 0; height: 65px;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 997; padding: 0 20px;
  align-items: center; justify-content: space-between;
}
.mobile-top-bar .logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.5px; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* === RESPONSIVE OVERHAUL (PREMIUM NATIVE MOBILE) === */
@media (max-width: 992px) {
  .app-layout { display: block !important; }
  .mobile-top-bar { display: flex !important; }
  .mobile-menu-btn { display: flex !important; }
  
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    transform: translateX(100%);
    width: 300px; max-width: 85vw; height: 100vh;
    box-shadow: -10px 0 40px rgba(0,0,0,0.6);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    background: var(--bg-secondary); border-left: 1px solid var(--glass-border);
    z-index: 999; /* Higher than overlay */
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-right: 0 !important;
    padding: 20px 16px !important;
    padding-top: 85px !important;
    padding-bottom: 80px !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .page-header { flex-direction: column; align-items: stretch; gap: 16px; text-align: center; margin-bottom: 24px; }
  .page-header h2 { font-size: 1.6rem; letter-spacing: -0.5px; }
  .page-header .btn { width: 100%; justify-content: center; height: 50px; font-size: 1.05rem; border-radius: 12px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
  .stat-card { padding: 20px 16px; flex-direction: column; text-align: center; gap: 8px; border-radius: 16px; background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%); border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
  .stat-icon { margin: 0 auto; width: 48px; height: 48px; font-size: 1.3rem; border-radius: 14px; }
  .stat-info h3 { font-size: 1.5rem; font-weight: 800; }
  .stat-info p { font-size: 0.8rem; opacity: 0.8; }

  .content-grid { grid-template-columns: 1fr; gap: 16px; }
  .content-card { padding: 20px; border-radius: 16px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
  .content-card-actions { flex-wrap: wrap; gap: 8px; }
  .content-card-actions .btn { flex: 1; min-width: 48%; justify-content: center; height: 44px; border-radius: 10px; }

  .table-wrapper { border: none; overflow: visible; background: transparent; padding: 0; box-shadow: none; }
  table, thead, tbody, th, td, tr { display: block; width: 100%; }
  thead { display: none; }
  tr { background: linear-gradient(to bottom right, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); transition: transform 0.2s ease; }
  tr:active { transform: scale(0.98); }
  td { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; align-items: center; }
  td:last-child { border-bottom: none; padding-top: 14px; margin-top: 4px; border-top: 1px dashed rgba(255,255,255,0.1); }
  td::before { content: attr(data-label); font-weight: 600; color: var(--text-secondary); margin-left: 12px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }

  .form-row { grid-template-columns: 1fr; gap: 16px; }
  .form-control { height: 50px; font-size: 1rem; border-radius: 12px; }
  .option-cards { grid-template-columns: 1fr; gap: 12px; }
  
  .steps { overflow-x: auto; gap: 8px; flex-wrap: nowrap; padding-bottom: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .step { min-width: 100px; padding: 12px; font-size: 0.85rem; border-radius: 12px; white-space: nowrap; }

  .card { padding: 20px; border-radius: 16px; }
  .modal { width: 92%; padding: 24px 20px; border-radius: 20px; }
  .share-link { flex-direction: column; gap: 12px; }
  .share-link input { width: 100%; font-size: 0.9rem; height: 48px; border-radius: 12px; text-align: center; }
  .share-link .btn { height: 48px; border-radius: 12px; font-size: 1rem; }
  .share-buttons { flex-direction: column; gap: 10px; }
  .share-buttons .btn { width: 100%; height: 44px; border-radius: 10px; }

  .quiz-page { padding: 16px; padding-top: 85px; align-items: flex-start; }
  .quiz-container { max-width: 100%; width: 100%; gap: 16px; }
  .quiz-header-card { padding: 30px 20px; border-radius: 20px; }
  .quiz-header-card h1 { font-size: 1.6rem; margin-bottom: 16px; }
  .result-card { padding: 32px 20px; border-radius: 24px; }
  .result-details { flex-direction: column; gap: 16px; }
  .result-score { font-size: 3.5rem; font-weight: 900; }
  .question-card { padding: 20px; border-radius: 16px; margin-bottom: 20px; }
  .option-item { padding: 16px; border-radius: 12px; margin-bottom: 12px; }

  .toast-container { left: 16px; right: 16px; top: 85px; }
  .toast { min-width: auto; width: 100%; justify-content: center; padding: 16px; border-radius: 14px; font-size: 0.95rem; }

  /* Step navigation on mobile */
  .step-nav { flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .step-nav .btn { flex: 1; min-width: 120px; justify-content: center; height: 48px; border-radius: 12px; font-size: 0.95rem; }

  /* Questions header on mobile */
  .questions-header { flex-direction: column; align-items: stretch; text-align: center; }
  .questions-header-actions { justify-content: center; }
  .questions-header-actions .btn { flex: 1; }

  /* General mobile overflow fixes */
  .create-step { overflow-x: hidden; }
  .ai-box { padding: 20px; }
  .ai-box > div { max-width: 100% !important; }
  
  /* Fix inline-style overrides */
  [style*="display:flex"][style*="justify-content:space-between"] { flex-wrap: wrap !important; gap: 8px !important; }
  [style*="display:flex"][style*="gap:8px"] { flex-wrap: wrap !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; text-align: right; padding: 20px; align-items: center; }
  .stat-icon { margin: 0 0 0 16px; }
  .stat-info { text-align: right; width: 100%; }
}

/* === HIDDEN === */
.hidden { display: none !important; }

/* === LOGIN === */
.login-overlay {
  position: fixed; inset: 0; background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000; padding: 20px;
}
.login-card {
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 36px 24px; text-align: center;
  width: 100%; max-width: 400px;
}
.login-logo { font-size: 3rem; margin-bottom: 12px; }
.login-title { font-size: 1.6rem; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-subtitle { color: var(--text-secondary); margin-top: 4px; font-size: 0.9rem; }
