/* AI Curriculum — Futuristic Clean Design */

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --border: #1e1e2e;
  --border-bright: #2e2e4e;
  --accent: #7c6af7;
  --accent-bright: #9d8fff;
  --accent-glow: rgba(124, 106, 247, 0.15);
  --green: #22d3a0;
  --green-glow: rgba(34, 211, 160, 0.15);
  --yellow: #f0b429;
  --red: #ef4444;
  --text: #e2e2f0;
  --text-muted: #6b6b8a;
  --text-dim: #3a3a5c;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* ---- AUTH PAGES ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse at top, rgba(124,106,247,0.08) 0%, transparent 65%),
    var(--bg) url('../images/bg-subtle.png') center/cover;
}

.auth-layout {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  width: 100%;
  max-width: 860px;
}

.auth-pitch {
  flex: 1;
  min-width: 0;
}

.auth-pitch-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
}
.auth-pitch-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.auth-pitch-logo span {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text);
  line-height: 1;
}

.auth-pitch-logo .logo-mark {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.auth-pitch-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(124,106,247,0.12);
  border: 1px solid rgba(124,106,247,0.3);
  border-radius: 20px;
  padding: 0.2rem 0.75rem;
  margin-bottom: 1rem;
}

.auth-pitch-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 1rem;
}

.auth-pitch-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 340px;
  margin-bottom: 1.5rem;
}

.auth-pitch-stats {
  display: flex;
  gap: 1.75rem;
  margin-bottom: 1.25rem;
}

.auth-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

.auth-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.auth-pitch-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .auth-layout {
    flex-direction: column;
    gap: 2rem;
  }
  .auth-pitch { text-align: center; }
  .auth-pitch-logo { align-items: center; }
  .auth-pitch-title { font-size: 1.8rem; }
  .auth-pitch-desc { max-width: 100%; margin-left: auto; margin-right: auto; }
  .auth-pitch-stats { justify-content: center; }
  .auth-card { max-width: 100%; }
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-mark {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 12px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.auth-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

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

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

.auth-footer a {
  color: var(--accent-bright);
  text-decoration: none;
}

.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

/* ---- DASHBOARD LAYOUT ---- */
/* ---- SITE HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.header-brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.header-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- APP LAYOUT ---- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

.app-body {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.sidebar-logo .logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.sidebar-progress {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 0.15rem;
}

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

.nav-item.active {
  color: var(--accent-bright);
}

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: auto;
}

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

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  truncate: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.btn-logout {
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-logout:hover {
  border-color: var(--border-bright);
  color: var(--text);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

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

/* ---- MODULE GRID ---- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.module-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.module-card:hover::before {
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.module-card.status-passed::before {
  background: linear-gradient(90deg, var(--green), #10b981);
}

.module-card.status-viewed::before {
  background: linear-gradient(90deg, var(--accent), #818cf8);
}

.module-card.status-skipped::before {
  background: var(--border-bright);
}

.module-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.module-card.locked:hover {
  transform: none;
  box-shadow: none;
}

.module-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.module-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

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

.module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-passed {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(34, 211, 160, 0.2);
}

.badge-viewed {
  background: var(--accent-glow);
  color: var(--accent-bright);
  border: 1px solid rgba(124, 106, 247, 0.2);
}

.badge-skipped {
  background: rgba(107, 107, 138, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-new {
  background: rgba(240, 180, 41, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(240, 180, 41, 0.2);
}

.badge-locked {
  background: rgba(58, 58, 92, 0.3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ---- MODULE READER ---- */
.module-reader {
  max-width: 720px;
  overflow-x: hidden; /* contain wide tables — scroll within .table-wrapper */
}

.module-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

.module-back:hover { color: var(--text); }

.module-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.module-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.module-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.module-header .subtitle {
  color: var(--text-muted);
}

/* ---- CONTENT TYPOGRAPHY ---- */
.module-content {
  line-height: 1.8;
  color: #c8c8e0;
}

.module-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}

.module-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.module-content p {
  margin-bottom: 1rem;
}

.module-content ul, .module-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.module-content li {
  margin-bottom: 0.4rem;
}

.module-content strong {
  color: var(--text);
  font-weight: 600;
}

.module-content em {
  color: var(--accent-bright);
  font-style: italic;
}

.module-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--accent-bright);
  font-style: italic;
}

.module-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.875em;
  color: var(--green);
}

/* ---- TABLES ---- */
.module-content .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
}

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

.module-content .data-table thead {
  background: rgba(124, 106, 247, 0.12);
}

.module-content .data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--accent-bright);
  border-bottom: 1px solid var(--border-bright);
  white-space: nowrap;
}

.module-content .data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: #c8c8e0;
  vertical-align: top;
}

.module-content .data-table tr:last-child td {
  border-bottom: none;
}

.module-content .data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* ---- RESOURCES ---- */
.resources-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.resources-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.resource-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resource-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.resource-link:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.resource-type {
  font-size: 0.75rem;
  color: var(--accent-bright);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.resource-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.resource-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- MODULE WRITTEN DATE ---- */
.module-written-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-style: italic;
}

/* ---- QUIZ ---- */
.quiz-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.quiz-header {
  margin-bottom: 1.5rem;
}

.quiz-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.quiz-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.question-number {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  line-height: 1.5;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
  line-height: 1.4;
}

.option:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.option.correct {
  border-color: var(--green);
  background: var(--green-glow);
  color: var(--text);
}

.option.incorrect {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.option-letter {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  text-transform: uppercase;
}

.explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: none;
}

.quiz-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-submit, .btn-next {
  padding: 0.75rem 2rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
}

.btn-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

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

.btn-next:hover { background: var(--bg-card-hover); }

.btn-skip {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-skip:hover { color: var(--text); border-color: var(--border-bright); }

/* Quiz result */
.quiz-result {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1.5rem;
}

.result-score {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.25rem;
}

.result-score.pass { color: var(--green); }
.result-score.fail { color: var(--red); }

.result-label {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* ---- LOADING ---- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- FEEDBACK ---- */
.feedback-section {
  color: var(--text-muted);
}

.points-rule-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  color: #f0b429;
  background: rgba(240,180,41,0.1);
  border: 1px solid rgba(240,180,41,0.25);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  letter-spacing: 0.01em;
}

/* ---- REFERRAL ---- */
.referral-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.referral-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.referral-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.referral-link-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: inherit;
  cursor: text;
}
.btn-copy-link {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-copy-link:hover { background: var(--surface-3); }
.referral-copied {
  font-size: 0.78rem;
  color: #22d3a0;
  margin-bottom: 0.75rem;
}
.btn-email-invite {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.btn-email-invite:hover { background: rgba(124,106,247,0.08); }

.feedback-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.feedback-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.star-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stars {
  display: flex;
  gap: 0.25rem;
}

.star {
  font-size: 1.5rem;
  color: var(--border-bright);
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  user-select: none;
  line-height: 1;
}

.star.active, .star.selected {
  color: var(--yellow);
}

.star:hover {
  transform: scale(1.15);
}

.feedback-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.feedback-field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.feedback-field textarea,
.feedback-field input[type="url"],
.feedback-field input[type="text"] {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.6rem 0.85rem;
  transition: border-color 0.2s;
  resize: vertical;
}

.feedback-field textarea:focus,
.feedback-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field-note {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-feedback-submit {
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 1.5rem;
  transition: border-color 0.2s, color 0.2s;
}

.btn-feedback-submit:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.feedback-thanks {
  font-size: 0.9rem;
  color: var(--green);
  padding: 0.75rem 0;
}

/* ---- POINTS ---- */
.sidebar-points {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.points-total {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.points-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.points-level-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.points-breakdown {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.mod-points-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--yellow);
  background: rgba(240, 180, 41, 0.1);
  border: 1px solid rgba(240, 180, 41, 0.2);
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
}

.points-earned-banner {
  display: inline-block;
  background: rgba(34, 211, 160, 0.15);
  border: 1px solid rgba(34, 211, 160, 0.3);
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.points-earned-inline {
  color: var(--green);
  font-weight: 600;
}

/* ---- ACHIEVEMENTS WIDGET (dashboard compact) ---- */
.achievements-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.achievements-widget-left {
  min-width: 100px;
}
.achievements-widget-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}
.achievements-widget-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.achievements-earned-icons {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
}
.achievements-earned-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.achievements-see-all {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
}
.achievements-see-all:hover { text-decoration: underline; }

/* ---- BADGES (achievements page) ---- */
.badges-section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.badges-grid {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  transition: border-color 0.2s;
  flex-wrap: wrap;
}

.badge-desc {
  display: block;
  width: 100%;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
  padding-left: calc(1.1rem + 0.5rem); /* align under name */
}

.badge-item.earned {
  border-color: rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.06);
}

.badge-item.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.badge-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.badge-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.badge-item.earned .badge-name {
  color: var(--text);
}

/* ---- LEADERBOARD ---- */
.leaderboard-section {
  margin-bottom: 2rem;
}

.leaderboard-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr 4rem 4.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.lb-row.lb-header {
  background: rgba(124, 106, 247, 0.07);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.lb-row.lb-me {
  background: var(--accent-glow);
}

.lb-rank {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
}

.lb-rank.top3 { color: var(--yellow); }

.lb-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-modules {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.lb-points {
  text-align: right;
  font-weight: 700;
  color: var(--accent-bright);
  font-size: 0.9rem;
}

/* ---- HERO ---- */
.hero-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
  min-height: 220px;
  border: 1px solid var(--border-bright);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('../images/bg-subtle.png');
  background-size: cover;
  background-position: center;
  opacity: 0.35;
  z-index: 0;
}

.hero-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(10,10,15,0.92) 40%, rgba(10,10,15,0.4) 100%);
  z-index: 1;
}

.hero-text {
  position: relative;
  z-index: 2;
  padding: 2rem 2rem 2rem 2.5rem;
  flex: 1;
  min-width: 0;
}

.hero-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  background: var(--accent-glow);
  border: 1px solid rgba(124, 106, 247, 0.3);
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  margin-bottom: 0.85rem;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 400px;
  margin-bottom: 1.25rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hero-stat-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-stat-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-beta-note {
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
  opacity: 0.8;
}

.hero-visual {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 320px;
  align-self: stretch;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
  mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
}

/* ---- MOBILE HEADER (module.html only, shown on mobile) ---- */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-back-btn {
  font-size: 0.875rem;
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
}

.mobile-mod-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.mobile-user {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ---- MOBILE TAB NAV ---- */
.mobile-tab-nav {
  display: none !important;
  margin-bottom: 1.25rem;
}
@media (max-width: 768px) {
  .mobile-tab-nav { display: block !important; }
}
.mobile-tab-nav-inner {
  display: flex;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
}
.mobile-tab-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.mobile-tab-item.active {
  background: var(--accent);
  color: #fff;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  /* Layout */
  .sidebar { display: none; }
  .main-content { padding: 1rem; overflow-x: hidden; }
  .mobile-header { display: flex; }
  .header-user-email { display: none; }
  .site-header { padding: 0 16px; }
  .mobile-tab-nav { display: block; }

  /* Hero on mobile — stack vertically */
  .hero-section {
    flex-direction: column;
    gap: 0;
    min-height: unset;
  }
  .hero-visual {
    width: 100%;
    height: 180px;
    order: -1; /* image on top */
  }
  .hero-img {
    object-position: center 20%;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
  }
  .hero-text {
    padding: 1.25rem;
  }
  .hero-title { font-size: 1.5rem; }
  .hero-desc { font-size: 0.85rem; max-width: 100%; }
  .hero-stats { gap: 1rem; }

  /* Module grid */
  .module-grid { grid-template-columns: 1fr; }

  /* Module reader */
  .module-reader { max-width: 100%; }
  .module-back { display: none; } /* replaced by mobile header */
  .module-header h1 { font-size: 1.35rem; }
  .module-header .subtitle { font-size: 0.875rem; }

  /* Tables — scroll within wrapper, no page-level scroll */
  .module-content .table-wrapper {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .module-content .data-table th,
  .module-content .data-table td {
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
  }

  /* Wide tables opted into stacking: each row becomes a labeled card on mobile
     instead of forcing horizontal scroll. Scoped to .data-table--stack so other
     tables are unaffected. Relies on data-label attributes on each <td>. */
  .module-content .data-table--stack { font-size: 0.85rem; }
  .module-content .data-table--stack thead { display: none; }
  .module-content .data-table--stack,
  .module-content .data-table--stack tbody,
  .module-content .data-table--stack tr,
  .module-content .data-table--stack td {
    display: block;
    width: 100%;
  }
  .module-content .data-table--stack tr {
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    margin-bottom: 0.85rem;
    overflow: hidden;
  }
  .module-content .data-table--stack td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    text-align: right;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
  }
  .module-content .data-table--stack tr td:last-child { border-bottom: none; }
  .module-content .data-table--stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--accent-bright);
    text-align: left;
    flex-shrink: 0;
  }

  /* Quiz */
  .question-card { padding: 1.1rem; }
  .option {
    padding: 0.85rem 0.75rem;
    font-size: 0.875rem;
  }
  .btn-submit, .btn-skip {
    width: 100%;
    text-align: center;
  }
  .quiz-actions { flex-direction: column; }
  .quiz-result { padding: 1.5rem 1rem; }

  /* Feedback */
  .feedback-section { margin-top: 2rem; }
  .star-rating { flex-wrap: wrap; gap: 0.5rem; }
}
