/* ============================================================
   Learn AI — Chiang Rai AI Think Tank
   Redesigned — Modern Educational Platform
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Chiang Rai AI Think Tank palette */
  --navy: #0B1D3A;
  --navy-dark: #060E1B;
  --navy-light: #1A1A2E;
  --blue: #2E7CF6;
  --blue-dark: #1A63E0;
  --blue-light: #5B9DF8;
  --blue-bg: rgba(46, 124, 246, 0.08);
  --gold: #F5A623;
  --gold-dark: #E09510;
  --white: #FFFFFF;
  --gray-50: #F7F9FC;
  --gray-100: #F0F2F5;
  --gray-200: #E4E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #A0A6B2;
  --gray-500: #6B7280;
  --gray-600: #4A4A55;
  --gray-700: #374151;
  --gray-800: #1E1E1E;

  /* Semantic */
  --success: #22C55E;
  --success-bg: #F0FDF4;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --error: #EF4444;
  --error-bg: #FEF2F2;

  /* Layout */
  --max-width: 1120px;
  --header-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(11, 29, 58, 0.06);
  --shadow-md: 0 4px 16px rgba(11, 29, 58, 0.08);
  --shadow-lg: 0 8px 30px rgba(11, 29, 58, 0.1);
  --shadow-xl: 0 16px 48px rgba(11, 29, 58, 0.12);

  /* Transitions */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--blue-dark);
}

a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol {
  list-style: none;
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--white);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: var(--white);
  box-shadow: 0 4px 20px rgba(46, 124, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(46, 124, 246, 0.4);
  color: var(--white);
}

.btn-accent {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy);
  box-shadow: 0 4px 20px rgba(245, 166, 35, 0.3);
}

.btn-accent:hover {
  box-shadow: 0 6px 28px rgba(245, 166, 35, 0.4);
  color: var(--navy);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

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

.btn-outline {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
}

.btn-outline:hover {
  background: var(--blue);
  color: var(--white);
}

.btn-outline-navy {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-outline-navy:hover {
  background: var(--navy);
  color: var(--white);
}

.btn-outline-accent {
  background: transparent;
  color: var(--gold-dark);
  border-color: var(--gold-dark);
}

.btn-outline-accent:hover {
  background: var(--gold-dark);
  color: var(--white);
}

.btn-sm {
  padding: 0.5rem 1.125rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  height: var(--header-height);
  transition: opacity 0.2s ease;
}

/* Hide header until JS replaces the logo to prevent flash of wrong icon */
.site-header.is-loading {
  visibility: hidden;
}

.site-header.is-loaded {
  visibility: visible;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.3px;
  flex: 0 0 auto;
  max-width: 230px;
}

.site-logo .brand-mark {
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(11, 29, 58, 0.2);
  display: block;
  flex: 0 0 48px;
  height: 32px !important;
  max-height: 32px;
  max-width: 48px !important;
  min-width: 48px;
  object-fit: cover;
  width: 48px !important;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.08;
}

.brand-parent {
  color: var(--gray-600);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-product {
  color: var(--navy);
  font-size: 1.08rem;
  font-weight: 800;
  margin-top: 0.18rem;
  white-space: nowrap;
}

.site-logo svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--blue);
}

.site-logo:hover {
  color: var(--blue);
}

/* ---------- Navigation ---------- */
.main-nav {
  display: flex;
  align-items: center;
  min-width: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-parent-item {
  border-left: 1px solid var(--gray-200);
  margin-left: 0.25rem;
  padding-left: 0.5rem;
}

.nav-parent-link {
  color: var(--navy);
  font-weight: 700;
}

.nav-parent-link span {
  color: var(--gold-dark);
}

.nav-guides-menu {
  position: relative;
}

.nav-guides-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.nav-guides-toggle span {
  font-size: 0.7rem;
  margin-left: 0.25rem;
  transition: transform var(--transition);
}

.nav-guides-menu.open .nav-guides-toggle span {
  transform: rotate(180deg);
}

.nav-guides-dropdown {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  left: 0;
  min-width: 250px;
  padding: 0.5rem;
  position: absolute;
  top: calc(100% + 0.25rem);
  z-index: 1100;
}

.nav-guides-menu.open .nav-guides-dropdown,
.nav-guides-menu:focus-within .nav-guides-dropdown {
  display: block;
}

.nav-guides-link {
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.7rem 0.75rem;
  white-space: nowrap;
}

.nav-guides-link:hover,
.nav-guides-link:focus,
.nav-guides-link.active {
  background: var(--blue-bg);
  color: var(--blue);
}

.nav-link:hover {
  background: var(--gray-50);
  color: var(--navy);
}

.nav-link[aria-current="page"],
.nav-link.active {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.mobile-menu-toggle:hover {
  background: var(--gray-100);
}

.hamburger {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  position: relative;
  transition: background var(--transition);
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: transform var(--transition);
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

.mobile-menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile nav overlay */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  transition: opacity var(--transition);
}

.mobile-nav-overlay.visible {
  display: block;
}

/* Mobile nav panel - slides in from right */
.mobile-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  z-index: 1001;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow-y: auto;
  padding-top: var(--header-height);
}

.mobile-nav-panel.open {
  transform: translateX(0);
}

.mobile-nav-panel .nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem 0;
}

.mobile-nav-panel .nav-link {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  padding: 0.875rem 1.25rem;
  font-size: 0.95rem;
  border-radius: 0;
  min-height: 52px;
}

.mobile-nav-panel .nav-link:hover {
  background: var(--gray-50);
}

.mobile-nav-panel .nav-link.active,
.mobile-nav-panel .nav-link[aria-current="page"] {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  background:
    linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 40%, var(--navy-light) 100%);
  color: var(--white);
  padding: 5rem 1.25rem 4rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* Gradient orbs */
.hero::after {
  content: "";
  position: absolute;
  top: -30%;
  right: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(46, 124, 246, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-orb-2 {
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--blue-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 2rem;
  line-height: 1.7;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

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

/* Sub-page hero */
.hero-inner {
  padding: 3rem 1rem;
}

.hero-inner h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 0.75rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  opacity: 0;
  transition: opacity var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: transparent;
}

.card:hover::before {
  opacity: 1;
}

.card-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(46, 124, 246, 0.08), rgba(245, 166, 35, 0.08));
  color: var(--blue);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  transition: all var(--transition);
}

.card:hover .card-icon {
  background: linear-gradient(135deg, rgba(46, 124, 246, 0.15), rgba(245, 166, 35, 0.15));
  transform: scale(1.05);
}

.card-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--gray-600);
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
}

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

/* ---------- Section ---------- */
.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--gray-50);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.75rem;
  letter-spacing: -0.3px;
}

.section-header p {
  font-size: 1.05rem;
  color: var(--gray-500);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

/* ---------- Path Cards ---------- */
.path-card {
  text-align: center;
  padding: 2rem 1.5rem;
}

.path-card .path-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-full);
  font-size: 1.75rem;
}

.path-card .path-icon.beginner {
  background: var(--success-bg);
  color: var(--success);
}

.path-card .path-icon.business {
  background: var(--blue-bg);
  color: var(--blue);
}

.path-card .path-icon.power {
  background: var(--warning-bg);
  color: var(--gold-dark);
}

.path-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.path-card ul {
  text-align: left;
  margin: 1rem 0;
}

.path-card ul li {
  padding: 0.35rem 0;
  color: var(--gray-600);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.path-card ul li::before {
  content: "\2713";
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---------- Steps ---------- */
.steps {
  counter-reset: step;
}

.step-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--gray-200);
}

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

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: var(--white);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
}

.step-content h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.step-content p {
  color: var(--gray-600);
  font-size: 0.9rem;
}

/* ---------- Progress Summary ---------- */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.progress-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all var(--transition);
}

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

.progress-card .progress-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.progress-card .progress-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.375rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Guide Sections ---------- */
.guide-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition);
}

.guide-section:hover {
  box-shadow: var(--shadow-sm);
}

.guide-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.guide-section h3 svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  stroke: var(--blue);
  stroke-width: 2;
  fill: none;
}

.guide-section h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.25rem 0 0.5rem;
}

.guide-section p,
.guide-section li {
  color: var(--gray-600);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.guide-section ul,
.guide-section ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.guide-section li {
  margin-bottom: 0.5rem;
  list-style: disc;
}

.guide-section li strong {
  color: var(--gray-700);
}

/* Practical guide learning components */
.guide-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.guide-meta span {
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  font-weight: 600;
}

.guide-toc {
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.guide-toc h2 {
  color: var(--navy);
  font-size: 1rem;
  margin-bottom: 0.875rem;
}

.guide-toc ul,
.scenario-grid,
.related-guides,
.learning-objectives {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
}

.guide-toc li { list-style: none; }
.guide-toc a,
.related-guides a { font-weight: 600; }

.scenario-grid { margin: 1.25rem 0; }

.scenario-card {
  padding: 1.25rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.scenario-card h4 { margin-top: 0; }

.guide-callout,
.practice-box {
  margin: 1.25rem 0;
  padding: 1.25rem;
  background: var(--blue-bg);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
}

.guide-callout.warning {
  background: var(--warning-bg);
  border-left-color: var(--gold);
}

.guide-callout p,
.practice-box p { margin: 0; }

.guide-checklist { padding-left: 0 !important; }
.guide-checklist li {
  position: relative;
  list-style: none;
  padding-left: 1.75rem;
}
.guide-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 800;
}

.decision-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}
.decision-table th,
.decision-table td {
  border: 1px solid var(--gray-200);
  padding: 0.8rem;
  text-align: left;
  vertical-align: top;
}
.decision-table th { background: var(--navy); color: var(--white); }
.decision-table tr:nth-child(even) td { background: var(--gray-50); }

.related-guides a {
  padding: 0.875rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.lab-status {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}
.lab-status.success { color: #166534; background: var(--success-bg); }
.lab-status.error { color: #991B1B; background: var(--error-bg); }
.lab-status.neutral { color: var(--gray-600); background: var(--gray-100); }

.risk-meter {
  height: 12px;
  overflow: hidden;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  margin: 0.75rem 0;
}
.risk-meter-fill {
  height: 100%;
  width: 0;
  background: var(--success);
  transition: width var(--transition), background var(--transition);
}

/* Prompt comparison */
.prompt-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}

.prompt-before,
.prompt-after {
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.prompt-before {
  background: var(--error-bg);
  border: 1px solid #FECACA;
}

.prompt-after {
  background: var(--success-bg);
  border: 1px solid #BBF7D0;
}

.prompt-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.625rem;
}

.prompt-before .prompt-label {
  color: var(--error);
}

.prompt-after .prompt-label {
  color: var(--success);
}

.prompt-text {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--gray-700);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Prompt builder */
.prompt-builder {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 1.5rem 0;
}

.prompt-builder h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1.25rem;
}

.builder-field {
  margin-bottom: 1rem;
}

.builder-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.375rem;
}

.builder-field input,
.builder-field textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-height: 44px;
  background: var(--white);
  color: var(--gray-700);
}

.builder-field textarea {
  min-height: 80px;
  resize: vertical;
}

.builder-field input:focus,
.builder-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
  outline: none;
}

fieldset.builder-field {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 1rem;
}

fieldset.builder-field label {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin: 0.75rem 0;
  font-weight: 500;
}

fieldset.builder-field input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 0.1rem;
}

.builder-output {
  background: var(--navy);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 100px;
  margin-top: 1.25rem;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Scoring Tool */
.scoring-tool {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 1.5rem 0;
}

.scoring-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--gray-200);
}

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

.scoring-label {
  flex: 1 1 200px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
}

.scoring-slider {
  flex: 2 1 200px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.scoring-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(46, 124, 246, 0.3);
  transition: transform var(--transition);
}

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

.scoring-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: var(--radius-full);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(46, 124, 246, 0.3);
}

.scoring-value {
  flex-shrink: 0;
  width: 36px;
  text-align: center;
  font-weight: 700;
  color: var(--blue);
  font-size: 1rem;
}

.scoring-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  background: linear-gradient(135deg, var(--blue-bg), rgba(245, 166, 35, 0.06));
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--navy);
}

/* ---------- Glossary Controls ---------- */
.glossary-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.search-box {
  flex: 1 1 300px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: all var(--transition);
  min-height: 44px;
  color: var(--gray-700);
}

.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
  outline: none;
}

.search-box .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

.search-box .search-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.filter-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-group select {
  padding: 0.75rem 2rem 0.75rem 0.875rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  min-height: 44px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  color: var(--gray-700);
  transition: all var(--transition);
}

.filter-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
  outline: none;
}

/* A-Z Navigation */
.az-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

.az-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
}

.az-link:hover {
  background: var(--blue-bg);
  color: var(--blue);
}

.az-link.active {
  background: var(--blue);
  color: var(--white);
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  background: var(--white);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
}

.filter-tab:hover {
  border-color: var(--blue-light);
  color: var(--blue);
}

.filter-tab.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* Result count */
.result-count {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
  font-weight: 500;
}

/* Term Cards */
.term-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: all var(--transition);
}

.term-card:hover {
  box-shadow: var(--shadow-sm);
}

.term-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  gap: 1rem;
  min-height: 44px;
  user-select: none;
}

.term-card-header:hover {
  background: var(--gray-50);
}

.term-card-header:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.term-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.term-card-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-category {
  background: var(--blue-bg);
  color: var(--blue);
}

.badge-difficulty-beginner {
  background: var(--success-bg);
  color: var(--success);
}

.badge-difficulty-intermediate {
  background: var(--warning-bg);
  color: var(--gold-dark);
}

.badge-difficulty-advanced {
  background: var(--error-bg);
  color: var(--error);
}

.term-card-toggle {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: transform var(--transition);
}

.term-card.expanded .term-card-toggle {
  transform: rotate(180deg);
}

.term-card-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--gray-100);
}

.term-card.expanded .term-card-body {
  display: block;
}

.term-short-def {
  color: var(--gray-700);
  margin: 0.75rem 0;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.term-full-def {
  color: var(--gray-600);
  margin: 0.75rem 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.term-example {
  background: var(--gray-50);
  border-left: 3px solid var(--blue);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.65;
}

.term-example strong {
  color: var(--navy);
}

.term-related {
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.term-related a {
  color: var(--blue);
  font-weight: 500;
}

.term-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--gray-300);
}

.empty-state h3 {
  font-size: 1.125rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

/* ---------- Flashcard Setup ---------- */
.flashcard-setup {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.setup-help {
  color: var(--gray-600);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.study-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.study-dashboard > div {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.study-dashboard strong,
.study-dashboard span { display: block; }
.study-dashboard strong { color: var(--navy); font-size: 1.25rem; }
.study-dashboard span { color: var(--gray-500); font-size: 0.75rem; }

[hidden] { display: none !important; }

.session-summary {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--blue-light);
  border-radius: var(--radius-lg);
  background: var(--blue-bg);
  text-align: center;
}

.session-summary p { margin: 0.5rem 0 1rem; }

.setup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.setup-row:last-child {
  margin-bottom: 0;
}

.setup-group {
  flex: 1 1 200px;
}

.setup-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.375rem;
}

.setup-label-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 1.5rem;
  margin-bottom: 0.375rem;
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 600;
}

.text-button {
  border: 0;
  padding: 0.15rem;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}

.setup-label-row .text-button:first-of-type { margin-left: auto; }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  color: var(--gray-700);
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  transition: all var(--transition);
  min-height: 44px;
}

.checkbox-label:hover {
  border-color: var(--blue-light);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.checkbox-label.checked {
  background: var(--blue-bg);
  border-color: var(--blue-light);
  color: var(--blue);
}

select.setup-input {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  min-height: 44px;
  color: var(--gray-700);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: all var(--transition);
}

select.setup-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
  outline: none;
}

/* Flashcard display */
.flashcard-container {
  perspective: 1200px;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  min-height: 320px;
}

.flashcard {
  width: 100%;
  min-height: 320px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.flashcard-back {
  transform: rotateY(180deg);
}

.flashcard-term {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.flashcard-hint {
  font-size: 0.85rem;
  color: var(--gray-400);
}

.flashcard-definition {
  font-size: 1.0625rem;
  color: var(--gray-700);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.flashcard-example {
  background: var(--gray-50);
  border-left: 3px solid var(--blue);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: var(--gray-600);
  text-align: left;
  width: 100%;
  line-height: 1.65;
}

.flashcard-related {
  color: var(--gray-500);
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

.flashcard-category {
  margin-top: 1rem;
}

/* Flashcard navigation */
.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.flashcard-progress {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.flashcard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.rating-prompt {
  flex-basis: 100%;
  margin: 0;
  text-align: center;
  color: var(--navy);
  font-weight: 600;
}

.flashcard-actions .btn small { display: block; font-size: 0.68rem; }
.flashcard-actions .btn kbd { margin-right: 0.3rem; }
.rating-again { background: #fff1f2; border: 1px solid #fda4af; color: #9f1239; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.flashcard-actions .btn {
  flex: 1 1 auto;
  min-width: 140px;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: var(--radius-full);
  transition: width var(--transition);
}

/* Keyboard hints */
.keyboard-hints {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

/* Mobile flashcard swipe hint */
.flashcard-swipe-hint {
  display: none;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

/* Mobile flashcard nav improvements */
.flashcard-nav .btn {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
}

.flashcard-nav .btn svg {
  flex-shrink: 0;
}

.keyboard-hints kbd {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  margin: 0 0.125rem;
}

/* ---------- Quiz ---------- */
.quiz-setup {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.quiz-area {
  max-width: 720px;
  margin: 0 auto;
}

.quiz-question-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.quiz-question-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 0.75rem;
}

.quiz-question-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1.5rem;
  line-height: 1.55;
}

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

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  font-size: 0.9375rem;
  color: var(--gray-700);
  text-align: left;
  width: 100%;
  font-family: 'Inter', sans-serif;
}

.quiz-option:hover {
  border-color: var(--blue-light);
  background: var(--blue-bg);
}

.quiz-option.selected {
  border-color: var(--blue);
  background: var(--blue-bg);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
}

.quiz-option-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
}

.quiz-option.selected .quiz-option-letter {
  background: var(--blue);
  color: var(--white);
}

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

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

.quiz-option-text {
  flex: 1;
  padding-top: 4px;
}

.quiz-feedback {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.65;
}

.quiz-feedback.correct {
  background: var(--success-bg);
  border: 1px solid #BBF7D0;
  color: #166534;
}

.quiz-feedback.incorrect {
  background: var(--error-bg);
  border: 1px solid #FECACA;
  color: #991B1B;
}

.quiz-feedback strong {
  display: block;
  margin-bottom: 0.375rem;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Quiz Results */
.quiz-results {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.quiz-score-circle {
  width: 130px;
  height: 130px;
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  font-weight: 800;
}

.quiz-score-circle.pass {
  background: var(--success-bg);
  color: var(--success);
  border: 3px solid var(--success);
}

.quiz-score-circle.fail {
  background: var(--warning-bg);
  color: var(--gold-dark);
  border: 3px solid var(--gold);
}

.quiz-score-circle small {
  font-size: 0.8rem;
  font-weight: 600;
}

.quiz-results h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.quiz-results .results-message {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.results-breakdown {
  text-align: left;
  margin: 1.5rem 0;
}

.results-breakdown h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 1rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.breakdown-item .label {
  color: var(--gray-600);
}

.breakdown-item .value {
  font-weight: 700;
  color: var(--navy);
}

.missed-terms {
  text-align: left;
  margin: 1.5rem 0;
}

.missed-terms h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.missed-terms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.missed-term-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.missed-term-tag a {
  color: var(--error);
  font-weight: 600;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.5);
  padding: 2.5rem 1rem;
  margin-top: 3rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.footer-inner p {
  font-size: 0.875rem;
  line-height: 1.7;
}

.footer-inner a {
  color: var(--blue-light);
}

.footer-inner a:hover {
  color: var(--gold);
}

.footer-inner .footer-brand {
  align-items: center;
  color: var(--white);
  display: inline-flex;
  gap: 0.75rem;
  justify-content: center;
}

.footer-inner .footer-brand img {
  border-radius: 5px;
  display: block;
  flex: 0 0 48px;
  height: 32px !important;
  max-height: 32px;
  max-width: 48px !important;
  object-fit: cover;
  width: 48px !important;
}

.footer-brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  text-align: left;
}

.footer-brand small {
  color: var(--gray-400);
  display: block;
  font-size: 0.72rem;
}

.footer-inner .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: center;
  margin: 0.75rem 0;
}

.footer-divider {
  width: 60px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 1rem auto;
  border-radius: var(--radius-full);
}

/* ========== RESPONSIVE ========== */

/* Desktop: hide mobile panel and overlay */
.mobile-nav-panel {
  display: none;
}

.mobile-nav-overlay {
  display: none;
}

/* Tablet */
@media (max-width: 1120px) {
  .main-nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-nav-panel {
    display: block;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .prompt-comparison {
    grid-template-columns: 1fr;
  }
}

/* Tablet and mobile */
@media (max-width: 768px) {
  .section {
    padding: 3rem 0;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Hide desktop nav, show mobile toggle */
  .main-nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  /* Show mobile panel container (but it's hidden by transform) */
  .mobile-nav-panel {
    display: block;
  }

  .mobile-nav-overlay {
    display: none;
  }

  /* Hero mobile */
  .hero {
    padding: 3.5rem 1.25rem 3rem;
  }

  .hero::after {
    width: 300px;
    height: 300px;
  }

  .hero-orb-2 {
    width: 250px;
    height: 250px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 300px;
  }

  /* Grid mobile */
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

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

  /* Progress grid mobile */
  .progress-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Prompt builder mobile */
  .builder-actions {
    flex-direction: column;
  }

  .builder-actions .btn {
    width: 100%;
  }

  /* Scoring tool mobile */
  .scoring-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .scoring-label {
    flex: none;
  }

  .scoring-slider {
    flex: none;
  }

  .scoring-total {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  /* Quiz options mobile */
  .quiz-question-card {
    padding: 1.5rem 1.25rem;
  }

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

  /* Glossary controls mobile */
  .glossary-controls {
    flex-direction: column;
  }

  .search-box {
    flex: none;
    width: 100%;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select {
    flex: 1;
    min-width: 140px;
  }

  /* Flashcard setup mobile */
  .setup-row {
    flex-direction: column;
  }

  .setup-group {
    flex: none;
    width: 100%;
  }

  .flashcard-actions .btn {
    min-width: 120px;
  }

  .study-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Steps mobile */
  .step-item {
    gap: 1rem;
  }

  .step-number {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .step-content h3 {
    font-size: 0.95rem;
  }

  .step-content p {
    font-size: 0.875rem;
  }

  /* Guide sections mobile */
  .guide-section {
    padding: 1.5rem 1.25rem;
  }

  .guide-toc ul,
  .scenario-grid,
  .related-guides,
  .learning-objectives,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .decision-table { display: block; overflow-x: auto; }

  .prompt-comparison {
    grid-template-columns: 1fr;
  }

  /* Path cards mobile */
  .path-card {
    padding: 1.5rem 1.25rem;
  }

  /* Prompt builder mobile */
  .prompt-builder {
    padding: 1.25rem;
  }

  /* Flashcard setup mobile */
  .flashcard-setup,
  .quiz-setup {
    padding: 1.5rem 1.25rem;
  }

  /* Footer mobile */
  .site-footer {
    padding: 2rem 1rem;
  }

  /* Sub-page hero mobile */
  .hero-inner {
    padding: 2.5rem 1rem;
  }

  /* Flashcard mobile improvements */
  .flashcard-container {
    min-height: 360px;
  }

  .flashcard {
    min-height: 360px;
  }

  .flashcard-nav {
    gap: 0.75rem;
  }

  .flashcard-nav .btn {
    flex: 0 1 auto;
    min-width: 100px;
    min-height: 52px;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  .flashcard-nav .btn svg {
    width: 20px;
    height: 20px;
  }

  .flashcard-progress {
    font-size: 1rem;
    min-width: 90px;
  }

  .flashcard-actions .btn {
    flex: 1 1 100%;
    min-width: 100%;
    min-height: 52px;
    font-size: 0.95rem;
  }

  .flashcard-term {
    font-size: 1.35rem;
  }

  .flashcard-definition {
    font-size: 1rem;
  }

  .flashcard-hint {
    font-size: 0.9rem;
  }

  .flashcard-swipe-hint {
    display: block;
  }

  .keyboard-hints {
    display: none;
  }

  .flashcard-face {
    padding: 2rem 1.5rem;
  }

  .flashcard-back-face {
    padding: 2rem 1.5rem;
  }

  .flashcard-example {
    font-size: 0.85rem;
  }
}

/* Small phones */
@media (max-width: 480px) {
  :root {
    --header-height: 60px;
  }

  html {
    font-size: 15px;
  }

  .hero {
    padding: 3rem 1rem 2.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .progress-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .progress-card {
    padding: 1.25rem 0.75rem;
  }

  .progress-card .progress-value {
    font-size: 1.75rem;
  }

  .card {
    padding: 1.5rem;
  }

  .flashcard-face {
    padding: 2rem 1.5rem;
  }

  .flashcard-term {
    font-size: 1.25rem;
  }

  .quiz-score-circle {
    width: 110px;
    height: 110px;
    font-size: 2rem;
  }

  .quiz-results {
    padding: 2rem 1.5rem;
  }

  .site-logo {
    font-size: 1rem;
  }

  .brand-parent {
    display: none;
  }

  .nav-link {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }
}

/* ========== ANIMATIONS ========== */

/* Card entrance animation */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeUp 0.5s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .flashcard {
    transition: none;
  }

  .flashcard.flipped { transform: none; }
  .flashcard-face { display: none; transform: none; }
  .flashcard:not(.flipped) .flashcard-front { display: flex; }
  .flashcard.flipped .flashcard-back { display: flex; transform: none; }

  .mobile-nav-panel {
    transition: none;
  }

  .card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }

  .card {
    animation: none;
  }
}
