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

/* ============================================================
   Design Tokens
   ============================================================ */

:root {
  /* Colors */
  --color-bg-deep: #020617;
  --color-bg-dark: #0f172a;
  --color-bg-card: #1e293b;
  --color-border: #334155;
  --color-border-light: #4b5563;
  --color-text: #e5e7eb;
  --color-text-muted: #94a3b8;
  --color-text-faint: #64748b;
  --color-accent: #38bdf8;
  --color-accent-dark: #0ea5e9;
  --color-success: #22c55e;
  --color-success-dark: #10b981;
  --color-success-bg: #065f46;
  --color-error: #ef4444;
  --color-error-bg: #7f1d1d;
  --color-error-text: #fecaca;
  --color-warning: #f59e0b;
  --color-purple: #a855f7;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #38bdf8, #0ea5e9);
  --gradient-success: linear-gradient(135deg, #22c55e, #10b981);
  --gradient-score: linear-gradient(90deg, #22c55e, #38bdf8);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 40px;

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Font */
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Shared brand background — radial gradients matching landing page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 15% 0%, rgba(56,189,248,0.12), transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 30%, rgba(129,140,248,0.10), transparent 60%),
    radial-gradient(ellipse 600px 500px at 50% 100%, rgba(192,132,252,0.08), transparent 60%);
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html {
  background: #07090f;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: transparent;
  color: var(--color-text);
  overflow-x: hidden;
}

/* ============================================================
   Floating Particles Background
   ============================================================ */

.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float-up linear infinite;
  will-change: transform, opacity;
  contain: strict;
}

@keyframes float-up {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-100vh) scale(0.5); opacity: 0; }
}

/* Ensure content stays above particles */
.top-nav, main, .loading-overlay, .toast-container, .auth-page {
  position: relative;
  z-index: 1;
}

/* ============================================================
   Focus & Accessibility
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   Transitions (interactive elements)
   ============================================================ */

a,
button,
input,
textarea,
select,
.choice,
.difficulty-card,
.pricing-card,
.tab-btn,
.diff-label,
.btn-nav {
  transition: all 0.2s ease;
}

/* ============================================================
   Top Navigation
   ============================================================ */

.top-nav {
  background: rgba(7, 9, 15, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav.sticky {
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
}

.logo-icon {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Cell membrane (two lipid bilayer lines) */
.logo-icon__membrane {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-border-light);
  border-radius: 1px;
}

.logo-icon__membrane::before,
.logo-icon__membrane::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-border-light);
  border-radius: 1px;
}

.logo-icon__membrane::before { top: -5px; }
.logo-icon__membrane::after { top: 5px; }

/* Channel protein gap */
.logo-icon__channel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 14px;
  background: var(--color-bg-card);
  border-left: 2px solid var(--color-accent);
  border-right: 2px solid var(--color-accent);
  border-radius: 2px;
  z-index: 1;
}

/* Particle moving through channel */
.logo-icon__particle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 4px var(--color-success);
  z-index: 2;
  animation: particle-transport 2s ease-in-out infinite;
  will-change: top, opacity;
}

@keyframes particle-transport {
  0%   { top: -2px; opacity: 0; }
  15%  { opacity: 1; }
  50%  { top: 50%; transform: translate(-50%, -50%); opacity: 1; }
  85%  { opacity: 1; }
  100% { top: calc(100% + 2px); opacity: 0; }
}

/* Gradient text for the brand name */
.logo-text {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.badge {
  background: var(--color-border);
  padding: 3px 10px;
  border-radius: var(--radius-md);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.badge.pro {
  background: var(--gradient-success);
  color: white;
}

.usage {
  display: flex;
  gap: var(--space-md);
  font-size: 0.8rem;
}

.usage span {
  color: var(--color-text-faint);
}

.usage span.warning { color: var(--color-warning); }
.usage span.danger { color: var(--color-error); font-weight: 600; }

.nav-right,
.nav-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.btn-nav {
  padding: 6px var(--space-md);
  border-radius: var(--radius-xl);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--color-border);
  color: var(--color-text);
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn-nav:hover {
  background: var(--color-border-light);
}

.btn-upgrade {
  background: var(--gradient-success);
  color: white;
}

.btn-upgrade:hover {
  transform: translateY(-1px);
}

.btn-logout {
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

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

/* ============================================================
   Auth Page Layout (login, signup, redeem)
   ============================================================ */

.auth-page {
  background: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 20px;
}
.auth-page > footer { width: 100%; max-width: 1100px; }

.auth-container {
  max-width: 420px;
  width: 100%;
  background: var(--color-bg-dark);
  border: 2px solid var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-container.wide {
  max-width: 450px;
  text-align: center;
  background: var(--color-bg-card);
  border-color: var(--color-border);
  padding: 48px;
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-header h1 {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.auth-header p {
  color: #9ca3af;
  font-size: 0.95rem;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-bg-card);
  color: #9ca3af;
  font-size: 0.9rem;
}

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

.auth-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   Alerts / Messages
   ============================================================ */

.alert {
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
  border-left: 4px solid;
}

.alert-error {
  background: var(--color-error-bg);
  border-color: #991b1b;
  color: var(--color-error-text);
}

.alert-success {
  background: var(--color-success-bg);
  border-color: #047857;
  color: #a7f3d0;
}

.alert a {
  color: #fcd34d;
  font-weight: 600;
  text-decoration: underline;
}

.error-message {
  background: var(--color-error-bg);
  border: 1px solid #991b1b;
  color: var(--color-error-text);
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.success-message {
  background: var(--color-success-bg);
  border: 1px solid #047857;
  color: #a7f3d0;
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: var(--space-md) var(--space-md);
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-help {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: var(--space-xs);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: var(--space-md);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  color: #0a0e16;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(56,189,248,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(56,189,248,0.45);
}

.button-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 12px var(--space-xl);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  position: relative;
  overflow: hidden;
}

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

@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}

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

.btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  color: #0a0e16;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(56, 189, 248, 0.45);
}

.btn-secondary {
  background: var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-border-light);
}

.btn-ghost {
  background: transparent;
  color: #9ca3af;
  border: 1px solid var(--color-border-light);
}

.btn-ghost:hover {
  color: var(--color-text);
  border-color: #6b7280;
}

.btn-success {
  background: var(--gradient-success);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

/* ============================================================
   Features List (signup, redeem)
   ============================================================ */

.features-list {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

.features-list h3 {
  color: var(--color-success);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.features-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.features-list li {
  color: #d1d5db;
  font-size: 0.85rem;
  padding: 6px 0;
  padding-left: var(--space-lg);
  position: relative;
}

.features-list li::before {
  content: "\2713";
  color: var(--color-success);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* ============================================================
   Container & Section Cards
   ============================================================ */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
}

.section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: var(--space-lg);
  margin-bottom: 20px;
  transition: border-color 0.3s, transform 0.3s;
}

.section:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* ============================================================
   Header
   ============================================================ */

.header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.header h1 {
  font-size: 2rem;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  font-weight: 700;
}

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

/* ============================================================
   Hero Section (index page)
   ============================================================ */

.hero {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-xl);
  margin-bottom: var(--space-lg);
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(168, 85, 247, 0.04) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.hero-logo {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  z-index: 1;
}

.hero-logo .logo-icon__membrane {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-border-light);
  border-radius: 2px;
}

.hero-logo .logo-icon__membrane::before,
.hero-logo .logo-icon__membrane::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-border-light);
  border-radius: 2px;
}

.hero-logo .logo-icon__membrane::before { top: -12px; }
.hero-logo .logo-icon__membrane::after { top: 12px; }

.hero-logo .logo-icon__channel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 30px;
  background: var(--color-bg-dark);
  border-left: 3px solid var(--color-accent);
  border-right: 3px solid var(--color-accent);
  border-radius: 4px;
  z-index: 1;
}

.hero-logo .logo-icon__particle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  z-index: 2;
  animation: particle-transport 2s ease-in-out infinite;
  will-change: top, opacity;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 1;
}

.hero-subtitle {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.hero-subtitle .typewriter {
  border-right: 2px solid var(--color-accent);
  animation: blink-caret 0.8s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--color-accent); }
}

.header .difficulty {
  color: var(--color-accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.subtitle {
  margin: var(--space-sm) 0 0;
  font-size: 0.95rem;
  color: #9ca3af;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: rgba(15, 23, 42, 0.96);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) 20px 20px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(148, 163, 184, 0.06);
}

/* ============================================================
   Textarea & Inputs
   ============================================================ */

textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  background: var(--color-bg-dark);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

textarea::placeholder {
  color: #475569;
}

input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-bg-dark);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.95rem;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

input[type="text"].topic-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #374151;
  background: var(--color-bg-deep);
  padding: 10px var(--space-md);
  color: var(--color-text);
  font-size: 0.92rem;
}

input[type="text"].topic-input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* ============================================================
   File Upload
   ============================================================ */

.file-upload {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-dark);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.file-upload:hover {
  border-color: var(--color-accent);
}

.file-upload input[type="file"] {
  display: none;
}

.file-upload .file-label {
  flex: 1;
  color: var(--color-text-faint);
  font-size: 0.9rem;
}

.file-btn {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Old-style file upload (style.css original) */
.file-upload-area {
  position: relative;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-label-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) 20px;
  border: 2px dashed #374151;
  border-radius: var(--radius-lg);
  background: var(--color-bg-deep);
  cursor: pointer;
}

.file-label-block:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-dark);
}

.file-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.file-text {
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.file-hint {
  font-size: 0.8rem;
  color: #6b7280;
}

.file-name-display {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: #1f2937;
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-size: 0.85rem;
  display: none;
}

/* ============================================================
   Difficulty Selector (index.html)
   ============================================================ */

.difficulty-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.difficulty-option {
  cursor: pointer;
}

.difficulty-option input[type="radio"] {
  display: none;
}

.difficulty-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  position: relative;
}

.difficulty-option input[type="radio"]:checked + .difficulty-card {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-bg-dark));
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.difficulty-option:not(.difficulty-locked):hover .difficulty-card {
  border-color: var(--color-border-light);
  transform: translateY(-2px);
}

.difficulty-locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.difficulty-locked .difficulty-card {
  background: var(--color-bg-dark);
}

.difficulty-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px var(--space-sm);
  border-radius: 10px;
  background: var(--color-border);
  color: var(--color-text-muted);
}

.difficulty-badge.pro {
  background: var(--gradient-success);
  color: white;
}

.difficulty-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.difficulty-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

#custom-prompt {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-bg-dark);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: auto;
}

#custom-prompt:focus {
  outline: none;
  border-color: var(--color-accent);
}

.pro-notice {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-error-bg);
  border-left: 3px solid var(--color-error);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  color: #fca5a5;
}

.pro-notice a {
  color: #fcd34d;
  font-weight: 600;
}

.pro-badge-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gradient-success);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-md);
  font-weight: 700;
}

.btn-secondary.pro-feature {
  position: relative;
}

/* Tutor Mode Toggle */
.tutor-toggle {
  margin-top: 20px;
  padding: var(--space-md);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.tutor-toggle label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
}

.tutor-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.tutor-toggle-title {
  font-weight: 600;
  color: var(--color-accent);
  font-size: 0.95rem;
}

.tutor-toggle-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Recommendation Banner */
.recommendation-banner {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-md);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-bg-dark));
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.recommendation-banner .rec-icon {
  font-size: 1.2rem;
}

.recommendation-banner .rec-content {
  flex: 1;
}

.recommendation-banner .rec-title {
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.recommendation-banner .rec-detail {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.recommendation-banner .rec-hint {
  color: var(--color-text-faint);
  font-size: 0.75rem;
  margin-top: var(--space-xs);
}

.recommendation-banner .rec-apply-btn {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-accent);
  color: var(--color-bg-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.recommendation-banner .rec-apply-btn:hover {
  background: var(--color-accent-dark);
}

/* Or-divider */
.or-divider {
  text-align: center;
  margin: var(--space-md) 0;
  color: var(--color-text-faint);
  font-size: 0.85rem;
}

/* Custom prompt container */
.custom-prompt-container {
  display: none;
  margin-top: var(--space-md);
}

.custom-prompt-hint {
  font-size: 0.85rem;
  color: var(--color-text-faint);
  margin-top: var(--space-sm);
}

/* Index action grid */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.actions-grid .btn-primary {
  grid-column: 1 / -1;
}

/* ============================================================
   Input Type Selector (tabs)
   ============================================================ */

.input-type-selector {
  margin-bottom: var(--space-md);
}

.tab-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.tab-btn {
  flex: 1;
  padding: 10px var(--space-md);
  border: 1px solid #374151;
  background: #111827;
  color: #9ca3af;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.tab-btn:hover {
  background: #1f2937;
  color: var(--color-text);
}

.tab-btn.active {
  background: linear-gradient(to right, var(--color-accent), var(--color-success));
  color: var(--color-bg-deep);
  border-color: transparent;
  font-weight: 600;
}

.input-tab {
  margin-top: var(--space-md);
}

.input-tab.hidden {
  display: none;
}

/* ============================================================
   Settings Sections
   ============================================================ */

.settings-section {
  padding: var(--space-md);
  background: rgba(17, 24, 39, 0.5);
  border-radius: var(--radius-lg);
  border: 1px solid #374151;
}

.section-title {
  margin: 0 0 var(--space-md) 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================================
   Difficulty Slider (alternative)
   ============================================================ */

.difficulty-section {
  margin-top: var(--space-md);
}

.difficulty-slider-wrapper {
  position: relative;
  margin: var(--space-md) 0;
}

.difficulty-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right,
    var(--color-success) 0%,
    var(--color-accent) 25%,
    var(--color-purple) 50%,
    var(--color-warning) 75%,
    var(--color-error) 100%
  );
  outline: none;
  cursor: pointer;
}

.difficulty-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--color-bg-card);
}

.difficulty-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.difficulty-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--color-bg-card);
}

.difficulty-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.difficulty-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding: 0 var(--space-xs);
}

.diff-label {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 50%;
  background: #111827;
  border: 2px solid #374151;
  color: #9ca3af;
  cursor: pointer;
}

.diff-label:hover {
  border-color: var(--color-accent);
  transform: scale(1.05);
}

.diff-label.active {
  background: linear-gradient(135deg, var(--color-accent), var(--color-success));
  border-color: var(--color-accent);
  color: var(--color-bg-deep);
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.difficulty-info {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid #374151;
}

.difficulty-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.difficulty-desc {
  font-size: 0.85rem;
  color: #9ca3af;
  line-height: 1.4;
}

/* ============================================================
   Field Layout (original style.css)
   ============================================================ */

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: flex-start;
}

.field {
  flex: 1 1 220px;
}

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

.label-sm {
  font-size: 0.8rem;
  font-weight: 600;
  color: #d1d5db;
  display: block;
  margin-bottom: var(--space-xs);
}

.hint {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.5;
  margin-top: var(--space-xs);
}

.hint p {
  margin: var(--space-xs) 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================
   Quiz Questions
   ============================================================ */

.question-card {
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

.question-card:hover:not(.graded) {
  border-color: rgba(56, 189, 248, 0.25);
}

.question-card.correct {
  border-color: var(--color-success);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-success-bg));
}

.question-card.incorrect {
  border-color: var(--color-error);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-error-bg));
}

.question-card.is-correct {
  border-color: var(--color-success);
  background: rgba(22, 163, 74, 0.08);
}

.question-card.is-wrong {
  border-color: var(--color-error);
  background: rgba(220, 38, 38, 0.06);
}

.question-card.is-unanswered {
  border-style: dashed;
}

.question-header {
  display: flex;
  gap: var(--space-md);
  margin-bottom: 20px;
  align-items: flex-start;
}

.q-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.q-text {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
}

/* ============================================================
   Choices
   ============================================================ */

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: 14px var(--space-md);
  background: var(--color-bg-dark);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.choice:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-card);
}

.choice input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--color-accent);
}

.choice-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--color-border);
  color: var(--color-text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.choice-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #d1d5db;
}

/* Selected choice */
.choice.selected {
  border-color: var(--color-accent);
  background: var(--color-bg-card);
}

.choice.selected .choice-letter {
  background: var(--color-accent);
  color: white;
}

/* Correct/Incorrect states */
.choice.correct {
  border-color: var(--color-success);
  background: linear-gradient(135deg, var(--color-bg-dark), var(--color-success-bg));
}

.choice.correct .choice-letter {
  background: var(--color-success);
  color: white;
}

.choice.incorrect {
  border-color: var(--color-error);
  background: linear-gradient(135deg, var(--color-bg-dark), var(--color-error-bg));
}

.choice.incorrect .choice-letter {
  background: var(--color-error);
  color: white;
}

/* ============================================================
   Explanations
   ============================================================ */

.explanation {
  background: var(--color-bg-dark);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  display: none;
}

.explanation.show {
  display: block;
}

.explanation strong {
  color: var(--color-accent);
  font-weight: 600;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explanation-quote {
  display: block;
  margin: var(--space-md) 0;
  padding: var(--space-md) var(--space-md);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-bg-dark));
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius-sm);
  font-style: italic;
  color: var(--color-text);
  position: relative;
}

.explanation-quote::before {
  content: '\201C';
  position: absolute;
  left: 8px;
  top: 6px;
  font-size: 2rem;
  color: var(--color-success);
  opacity: 0.3;
  font-family: Georgia, serif;
}

.explanation-quote-intro {
  color: var(--color-success);
  font-weight: 600;
  font-style: normal;
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

/* ============================================================
   Score Box
   ============================================================ */

.score-box {
  position: relative;
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.score-main {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.score-label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.score-bar {
  width: 100%;
  height: 12px;
  background: var(--color-bg-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-md);
}

.score-fill {
  height: 100%;
  background: var(--gradient-score);
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
  width: 0;
}

#score-fill {
  height: 100%;
  width: 0;
  background: var(--gradient-score);
  transition: width 0.3s ease;
}

.score-breakdown {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  font-size: 0.85rem;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-item.correct { color: var(--color-success); }
.score-item.incorrect { color: var(--color-error); }

/* ============================================================
   Topic Tags
   ============================================================ */

.topic-tag {
  display: none;
  background: var(--color-border);
  color: var(--color-text-muted);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.question-card.graded .topic-tag {
  display: inline-block;
}

.missed-topic-tag {
  background: var(--color-border);
  color: #fbbf24;
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ============================================================
   Result Badge (Correct/Incorrect text labels)
   ============================================================ */

.result-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-xs);
  margin-left: var(--space-sm);
}

.result-badge--correct {
  background: rgba(34, 197, 94, 0.2);
  color: var(--color-success);
}

.result-badge--incorrect {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-error);
}

/* ============================================================
   Smart Anki Section
   ============================================================ */

.smart-anki-section {
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-success-bg));
  border: 2px solid var(--color-success);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
  text-align: center;
}

.smart-anki-section h3 {
  color: var(--color-success);
  font-size: 1.3rem;
  margin-bottom: var(--space-md);
}

.smart-anki-section p {
  color: var(--color-text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.missed-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: 20px;
}

.smart-anki-card {
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 14px;
  padding: 20px;
}

.smart-anki-card h3 {
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-accent);
  font-size: 1.1rem;
}

.smart-anki-card p {
  margin: 0 0 var(--space-md) 0;
  color: #d1d5db;
  line-height: 1.5;
}

.anki-card-selector {
  margin-bottom: var(--space-md);
}

.anki-count-input {
  width: 100px;
  margin-top: var(--space-xs);
}

.anki-loading {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
}

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

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-md);
  border-top-color: var(--color-accent);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================================
   Tutor Mode Feedback (results.html JS-generated)
   ============================================================ */

.tutor-feedback {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 2px solid;
}

.tutor-feedback--correct {
  border-color: var(--color-success);
  background: rgba(34, 197, 94, 0.1);
}

.tutor-feedback--incorrect {
  border-color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
}

.tutor-feedback__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.tutor-feedback__title--correct {
  color: var(--color-success);
}

.tutor-feedback__title--incorrect {
  color: var(--color-error);
}

.tutor-feedback__answers {
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-sm);
}

.tutor-feedback__explanation {
  color: var(--color-text);
  line-height: 1.7;
  padding: var(--space-md);
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-sm);
}

.tutor-complete {
  margin-top: var(--space-2xl);
  padding: var(--space-xl);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-border));
  border: 2px solid;
  border-radius: var(--radius-lg);
  text-align: center;
}

.tutor-complete__emoji {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.tutor-complete__heading {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.tutor-complete__score {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.tutor-complete__percent {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.tutor-weak-areas {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: rgba(249, 115, 22, 0.1);
  border: 2px solid #f97316;
  border-radius: var(--radius-md);
}

.tutor-weak-areas h3 {
  color: #f97316;
  margin-bottom: var(--space-md);
}

.tutor-weak-areas p {
  color: var(--color-text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.tutor-perfect {
  margin-top: var(--space-lg);
  color: var(--color-success);
  font-size: 1.1rem;
}

/* ============================================================
   Summary Content
   ============================================================ */

.summary-content {
  background: var(--color-bg-deep);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 0.95rem;
  color: #d1d5db;
}

.summary-content p {
  margin: 0 0 var(--space-md) 0;
  line-height: 1.7;
}

.summary-content h2 {
  color: var(--color-accent);
  font-size: 1.3rem;
  margin: 28px 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid #374151;
  font-weight: 700;
}

.summary-content h2:first-child {
  margin-top: 0;
}

.summary-content h3 {
  color: var(--color-success);
  font-size: 1.1rem;
  margin: 20px 0 var(--space-md) 0;
  font-weight: 600;
}

.summary-content ul,
.summary-content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.summary-content li {
  margin: 6px 0;
  line-height: 1.6;
}

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

.summary-content em {
  color: var(--color-purple);
  font-style: italic;
}

/* ============================================================
   Loading Overlay
   ============================================================ */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

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

.loading-card {
  background: rgba(15, 23, 42, 0.98);
  border-radius: 20px;
  padding: var(--space-2xl) var(--space-xl);
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  text-align: center;
}

.loading-animation {
  margin-bottom: var(--space-lg);
}

.loading-icon,
.brain-icon {
  font-size: 4rem;
  animation: pulse 2s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.loading-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.loading-card h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: 1.3rem;
  color: var(--color-accent);
  font-weight: 600;
}

.loading-card p {
  margin: 0 0 20px 0;
  color: #9ca3af;
  font-size: 0.95rem;
}

.progress-bar {
  width: 100%;
  height: var(--space-sm);
  background: var(--color-bg-card);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), var(--color-accent), var(--color-purple), var(--color-success));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--radius-pill);
  width: 100%;
}

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

.loading-tip {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.loading-tips {
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-lg);
}

.loading-tips .tip {
  margin: 0;
  color: #d1d5db;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeInTip 0.5s ease;
}

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

/* ============================================================
   Pricing Page (page-specific)
   ============================================================ */

.cta-button {
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: var(--space-lg);
}

.cta-button.primary {
  background: var(--gradient-success);
  color: white;
}

.cta-button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

.cta-button.secondary {
  background: var(--color-bg-card);
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}

.cta-button.secondary:hover {
  background: var(--color-accent);
  color: var(--color-bg-dark);
}

/* ============================================================
   Redeem Page Specific
   ============================================================ */

.redeem-code-input {
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 2px;
  font-weight: 600;
  font-size: 1.1rem;
}

.redeem-code-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-weight: normal;
  color: #475569;
}

.back-link {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.back-link a {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link a:hover {
  color: var(--color-accent-dark);
}

/* ============================================================
   Toast Notification System
   ============================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast--success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  color: #a7f3d0;
}

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

.toast--info {
  background: var(--color-bg-card);
  border: 1px solid var(--color-accent);
  color: var(--color-text);
}

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

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .actions-grid .btn-primary {
    grid-column: 1;
  }

  .question-header {
    flex-direction: column;
    gap: var(--space-md);
  }

  .score-breakdown {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

@media (max-width: 640px) {
  .card {
    padding: 18px 14px var(--space-md);
  }

  .question-card {
    padding: var(--space-md) 10px;
  }

  .settings-section {
    padding: var(--space-md);
  }

  .diff-label {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .tab-buttons {
    flex-direction: column;
  }

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

  .toast {
    min-width: auto;
    max-width: calc(100vw - 40px);
  }
}

@media (max-width: 480px) {
  .auth-container.wide {
    padding: var(--space-xl) var(--space-lg);
  }
}

/* ============================================================
   QBank Source Banner (results page)
   ============================================================ */

.qbank-source-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  font-size: 0.9rem;
  color: var(--color-text);
  font-weight: 500;
}

.qbank-source-banner__sep {
  color: var(--color-text-faint);
}

/* ============================================================
   QBank Source Badges (per-question)
   ============================================================ */

.qbank-source-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  align-self: center;
}

.qbank-source-badge--bank {
  background: rgba(168, 85, 247, 0.2);
  color: var(--color-purple);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.qbank-source-badge--new {
  background: rgba(56, 189, 248, 0.15);
  color: var(--color-accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ============================================================
   Rating Widget
   ============================================================ */

.rating-widget {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.rating-widget.submitted {
  border-color: var(--color-success);
  background: rgba(34, 197, 94, 0.05);
}

.rating-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.rating-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 70px;
}

.rating-stars {
  display: flex;
  gap: 2px;
}

.rating-star {
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-border-light);
  transition: color 0.15s, transform 0.15s;
  user-select: none;
}

.rating-star:hover,
.rating-star.hover {
  color: var(--color-warning);
  transform: scale(1.15);
}

.rating-star.active {
  color: var(--color-warning);
}

.rating-widget.submitted .rating-star.active {
  color: var(--color-success);
}

/* ============================================================
   QBank Browser - Filters
   ============================================================ */

.qbank-filters {
  margin-bottom: var(--space-xl);
}

.qbank-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.qbank-search {
  flex: 1 1 200px;
  padding: 8px 14px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.9rem;
}

.qbank-search:focus {
  outline: none;
  border-color: var(--color-accent);
}

.qbank-search::placeholder {
  color: var(--color-text-faint);
}

.qbank-select {
  padding: 8px 12px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.85rem;
  cursor: pointer;
}

.qbank-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ============================================================
   QBank Browser - Cards
   ============================================================ */

.qbank-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

.qbank-card--correct {
  border-color: var(--color-success);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-success-bg));
}

.qbank-card--incorrect {
  border-color: var(--color-error);
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-error-bg));
}

.qbank-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.qbank-card__number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.qbank-difficulty-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.qbank-difficulty-badge--1 {
  background: rgba(34, 197, 94, 0.2);
  color: var(--color-success);
}

.qbank-difficulty-badge--2 {
  background: rgba(56, 189, 248, 0.2);
  color: var(--color-accent);
}

.qbank-difficulty-badge--3 {
  background: rgba(168, 85, 247, 0.2);
  color: var(--color-purple);
}

.qbank-pct {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.qbank-pct--high {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.qbank-pct--mid {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.qbank-pct--low {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
}

.qbank-rating-info {
  font-size: 0.75rem;
  color: var(--color-warning);
  font-weight: 600;
}

.qbank-served-info {
  font-size: 0.7rem;
  color: var(--color-text-faint);
  margin-left: auto;
}

.qbank-card__text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  white-space: pre-wrap;
}

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

.qbank-interactive-choice {
  cursor: pointer;
}

.qbank-card__explanation {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-dark);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.qbank-card__result {
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   QBank Browser - Pagination
   ============================================================ */

.qbank-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-lg) 0;
}

.qbank-page-info {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.qbank-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-faint);
}

.qbank-empty p {
  margin-bottom: var(--space-lg);
  font-size: 1rem;
}

/* ============================================================
   QBank Responsive
   ============================================================ */

@media (max-width: 640px) {
  .qbank-filter-form {
    flex-direction: column;
  }

  .qbank-search,
  .qbank-select {
    width: 100%;
  }

  .rating-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .qbank-source-banner {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .qbank-source-banner__sep {
    display: none;
  }
}
