/* ==========================================================================
   DBMS Exam Mastery Platform - Apple Design System & HIG Theme
   SF Typography, Frosted Glass Vibrancy, Segmented Controls, Refined Shadows
   ========================================================================== */

:root,
body.dark-theme {
  /* Apple System Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Apple Dark Theme Palette (True Black & Layered Materials) */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-elevated: #3a3a3c;
  --bg-hover: #323236;
  --bg-glass: rgba(22, 22, 24, 0.82);
  --bg-recessed: rgba(118, 118, 128, 0.24);
  --bg-code: #0c0c0e;
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #0a84ff;
  --focus-ring: 0 0 0 3px rgba(10, 132, 255, 0.35);

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-muted: #6e6e73;
  --text-link: #2997ff;

  /* Apple Vibrant Accent Colors */
  --accent-primary: #0a84ff;
  --accent-hover: #409cff;
  --accent-subtle: rgba(10, 132, 255, 0.16);
  --accent-glow: 0 0 20px rgba(10, 132, 255, 0.3);

  --success-color: #30d158;
  --success-subtle: rgba(48, 209, 88, 0.16);
  --warning-color: #ff9f0a;
  --warning-subtle: rgba(255, 159, 10, 0.16);
  --danger-color: #ff453a;
  --danger-subtle: rgba(255, 69, 58, 0.16);
  --purple-color: #bf5af2;
  --purple-subtle: rgba(191, 90, 242, 0.16);
  --teal-color: #40c8e0;
  --indigo-color: #5e5ce6;

  /* Squircle Border Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* Layered Ambient Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.45);

  /* Apple Spring Easing */
  --apple-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --header-height: 64px;
}

body.light-theme {
  /* Apple Light Theme Palette (System Grouped Gray & Elevated White) */
  --bg-primary: #f2f2f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f8fc;
  --bg-elevated: #ffffff;
  --bg-hover: #e5e5ea;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-recessed: rgba(118, 118, 128, 0.12);
  --bg-code: #ffffff;

  --border-color: rgba(60, 60, 67, 0.14);
  --border-subtle: rgba(60, 60, 67, 0.08);
  --border-focus: #007aff;
  --focus-ring: 0 0 0 3px rgba(0, 122, 255, 0.25);

  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-muted: #8e8e93;
  --text-link: #0071e3;

  /* Apple Vibrant Accent Colors (WCAG Compliant Tones) */
  --accent-primary: #007aff;
  --accent-hover: #0062cc;
  --accent-subtle: rgba(0, 122, 255, 0.10);
  --accent-glow: 0 0 18px rgba(0, 122, 255, 0.2);

  --success-color: #28cd41;
  --success-subtle: rgba(40, 205, 65, 0.12);
  --warning-color: #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.12);
  --danger-color: #d70015;
  --danger-subtle: rgba(215, 0, 21, 0.10);
  --purple-color: #af52de;
  --purple-subtle: rgba(175, 82, 222, 0.12);
  --teal-color: #30b0c7;
  --indigo-color: #5856d6;

  /* Layered Ambient Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Base Reset, Typography & Accessibility
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Universal High-Contrast Focus Ring */
:focus-visible {
  outline: 2px solid var(--accent-primary) !important;
  outline-offset: 2px !important;
  box-shadow: var(--focus-ring);
}

/* Apple Sleek Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

@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;
  }
}

code, pre, textarea.form-code {
  font-family: var(--font-mono);
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ==========================================================================
   macOS Window Accents (Traffic Lights)
   ========================================================================== */

.macos-traffic-lights {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 10px;
}

.traffic-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s var(--apple-spring);
}
.traffic-dot:hover {
  transform: scale(1.1);
}
.traffic-dot.red { background-color: #ff5f56; }
.traffic-dot.yellow { background-color: #ffbd2e; }
.traffic-dot.green { background-color: #27c93f; }

/* ==========================================================================
   Header & Apple Segmented Navigation
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background-color: var(--bg-glass);
  backdrop-filter: blur(25px) saturate(190%);
  -webkit-backdrop-filter: blur(25px) saturate(190%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  gap: 16px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 20px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 149, 0, 0.15));
  border: 1px solid rgba(255, 159, 10, 0.35);
  border-radius: 10px;
  padding: 5px 8px;
  box-shadow: 0 2px 8px rgba(255, 159, 10, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.logo-text .highlight {
  color: var(--accent-primary);
  font-weight: 800;
}

.logo-text .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  letter-spacing: -0.01em;
}

/* Apple Segmented Control Navigation */
.main-nav {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 3px;
  gap: 3px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 15px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s var(--apple-spring);
  position: relative;
  user-select: none;
  letter-spacing: -0.01em;
}

.nav-tab:hover {
  color: var(--text-primary);
  background-color: rgba(118, 118, 128, 0.08);
}

.nav-tab:active {
  transform: scale(0.975);
}

.nav-tab.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

body.light-theme .nav-tab.active {
  background-color: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.nav-tab .badge {
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  background-color: rgba(118, 118, 128, 0.2);
  color: var(--text-secondary);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  border: none;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.nav-tab.active .badge {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success-color);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--success-color);
  animation: appleStatusPulse 2s infinite ease-in-out;
}

@keyframes appleStatusPulse {
  0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-shortcuts-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  letter-spacing: 0.02em;
}

.screenshot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
  white-space: nowrap;
}

.screenshot-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.screenshot-btn:active {
  transform: scale(0.97);
}

.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s var(--apple-spring);
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.96);
}

.db-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

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

.status-indicator.online {
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
  animation: appleStatusPulse 2s infinite ease-in-out;
}
.status-indicator.offline {
  background-color: var(--danger-color);
  box-shadow: 0 0 8px var(--danger-color);
}

/* ==========================================================================
   Main Content & Component Foundation
   ========================================================================== */

.app-main {
  min-height: calc(100% - var(--header-height));
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex: 1;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Apple Squircle Card */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--apple-spring);
}

.card:hover {
  border-color: var(--border-color);
}

/* Apple Styled Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
  user-select: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.975);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(0, 122, 255, 0.3);
  font-weight: 600;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 122, 255, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 500;
}
.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.2), rgba(255, 149, 0, 0.3));
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
  font-weight: 600;
}
.btn-warning:hover {
  background: var(--warning-color);
  color: #000;
  box-shadow: 0 4px 14px rgba(255, 159, 10, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--danger-color);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 69, 58, 0.3);
}
.btn-danger:hover {
  background-color: #ff5b52;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 69, 58, 0.45);
}

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

.btn-sm {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all 0.18s ease;
}
.btn-sm:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}
.btn-sm:active {
  transform: scale(0.96);
}

/* Apple Intelligence Shimmer Button */
.btn-ai-sparkle {
  background: linear-gradient(135deg, rgba(255, 107, 149, 0.18) 0%, rgba(144, 85, 255, 0.2) 50%, rgba(0, 166, 255, 0.18) 100%);
  border: 1px solid rgba(144, 85, 255, 0.4);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 13px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(144, 85, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
}
.btn-ai-sparkle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(144, 85, 255, 0.45);
  filter: brightness(1.1);
}
.btn-ai-sparkle:active {
  transform: scale(0.97);
}

.sparkle-icon {
  font-size: 13px;
}

/* Form Controls & Spotlight-Style Search */
.form-select, .form-input, .form-textarea {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.search-box input {
  width: 100%;
  background-color: var(--bg-tertiary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 15px 15px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 9px 16px 9px 36px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.search-box input:focus {
  background-color: var(--bg-secondary);
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

/* Apple Capsule Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-primary { background: var(--accent-subtle); color: var(--accent-primary); border: 1px solid rgba(10, 132, 255, 0.35); }
.badge-easy { background: var(--success-subtle); color: var(--success-color); border: 1px solid rgba(48, 209, 88, 0.35); }
.badge-medium { background: var(--warning-subtle); color: var(--warning-color); border: 1px solid rgba(217, 119, 6, 0.35); }
.badge-hard { background: var(--danger-subtle); color: var(--danger-color); border: 1px solid rgba(255, 69, 58, 0.35); }
.badge-favorite { background: var(--warning-subtle); color: var(--warning-color); border: 1px solid rgba(217, 119, 6, 0.4); }

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.85;
}
.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state p {
  max-width: 460px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

/* ==========================================================================
   TAB 1: Study & Concept Master
   ========================================================================== */

.study-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.study-sidebar {
  width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  flex-shrink: 0;
  overflow-y: auto;
}

.study-days-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.study-day-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--apple-spring);
}

.study-day-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.study-day-btn:active {
  transform: scale(0.98);
}

.study-day-btn.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.study-day-btn .day-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-primary);
  letter-spacing: 0.02em;
}

.study-day-btn .day-title {
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
  color: var(--text-primary);
}

.study-day-btn.cheatsheet-day-btn {
  border-color: rgba(255, 159, 10, 0.4);
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.12), rgba(255, 149, 0, 0.05));
}
.study-day-btn.cheatsheet-day-btn .day-num {
  color: var(--warning-color);
}
.study-day-btn.cheatsheet-day-btn.active {
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.22), rgba(255, 149, 0, 0.12));
  border-color: var(--warning-color);
}

.quick-cheatsheet-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-subtle);
}

.quick-cheatsheet-card h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quick-link-btn {
  background: transparent;
  border: none;
  color: var(--text-link);
  font-size: 12.5px;
  text-align: left;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-link-btn:hover {
  background: var(--bg-hover);
  text-decoration: underline;
}
.quick-link-btn:active {
  transform: scale(0.98);
}

.study-body {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

.study-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.study-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.study-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.5;
}

.study-sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.study-section-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.study-section-card.collapsed .study-section-content {
  display: none !important;
}

.study-section-card.collapsed .study-section-header {
  border-bottom: none;
}

.study-section-header {
  padding: 14px 20px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.study-section-header:hover {
  background-color: var(--bg-hover);
}

.study-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.study-section-toggle-icon {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s var(--apple-spring);
}

.study-section-card.collapsed .study-section-toggle-icon {
  transform: rotate(-90deg);
}

.study-section-content {
  padding: 22px;
  font-size: 14px;
  line-height: 1.6;
}

.study-section-content h3 {
  font-size: 16px;
  margin-top: 16px;
  margin-bottom: 8px;
}
.study-section-content h3:first-child {
  margin-top: 0;
}

.study-section-content p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.study-section-content code {
  background-color: var(--bg-tertiary);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

.study-section-content pre {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 12px 0 16px;
  font-size: 12.5px;
  line-height: 1.5;
}

.study-notes-drawer {
  margin-top: 18px;
  padding: 14px;
  background-color: rgba(255, 159, 10, 0.08);
  border: 1px solid rgba(255, 159, 10, 0.25);
  border-radius: 11px;
}

.study-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--warning-color);
}

.study-notes-textarea {
  width: 100%;
  min-height: 70px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

/* ==========================================================================
   TAB 2: 303 Practice Arena
   ========================================================================== */

.practice-container {
  padding: 22px 28px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

.practice-filters-bar {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

/* Apple Segmented Filter Pill Group */
.day-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.day-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 7px 15px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--apple-spring);
  user-select: none;
}

.filter-pill:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.filter-pill:active {
  transform: scale(0.97);
}

.filter-pill.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.35);
}

.filter-controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.practice-search {
  flex: 1;
  min-width: 260px;
}

.practice-stats-strip {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.stats-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-bar-track {
  width: 100%;
  height: 7px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color), var(--accent-primary));
  border-radius: var(--radius-pill);
  transition: width 0.35s var(--apple-spring);
}

.practice-questions-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.question-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--apple-spring);
}

.question-card:hover {
  box-shadow: var(--shadow-md);
}

.question-card.completed {
  border-left: 4px solid var(--success-color);
}

.question-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.question-meta-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.question-actions-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bookmark-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}
.bookmark-btn:hover {
  color: var(--warning-color);
  transform: scale(1.15);
}
.bookmark-btn.active {
  color: var(--warning-color);
}

.question-prompt {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

.question-sql-answer {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-primary);
  overflow-x: auto;
  line-height: 1.5;
}

.question-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  background-color: var(--bg-tertiary);
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--accent-primary);
}

.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 26px 0;
}

/* ==========================================================================
   TAB 3: Live Playground (Decluttered & Apple Polished)
   ========================================================================== */

.playground-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.playground-topbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 9px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Apple Engine Segmented Control */
.engine-segmented-control {
  display: inline-flex;
  background-color: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.engine-tab {
  padding: 5px 13px;
  border-radius: 8px;
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s var(--apple-spring);
  user-select: none;
}

.engine-tab:hover {
  color: var(--text-primary);
}

.engine-tab:active {
  transform: scale(0.97);
}

.engine-tab.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

body.light-theme .engine-tab.active {
  background-color: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.engine-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

.engine-tab:not(.active) .engine-badge-dot {
  background-color: var(--text-muted);
  box-shadow: none;
}

.engine-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, 0.15);
}

.schema-selector-group, .preset-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schema-select-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.schema-dropdown, .preset-dropdown {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.schema-dropdown:focus, .preset-dropdown:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--focus-ring);
}

.btn-warning-soft {
  background-color: var(--warning-subtle);
  border: 1px solid rgba(255, 159, 10, 0.35);
  color: var(--warning-color);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s var(--apple-spring);
}

.btn-warning-soft:hover {
  background-color: rgba(255, 159, 10, 0.25);
  transform: translateY(-1px);
}
.btn-warning-soft:active {
  transform: scale(0.97);
}

.playground-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.playground-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
}

/* Code Editor Card - macOS Window Feel */
.editor-card {
  height: 48%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.editor-header {
  padding: 8px 14px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-dialect-pill {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
  border: 1px solid rgba(10, 132, 255, 0.3);
}

.editor-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.editor-hint kbd {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
}

.editor-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-run-query {
  font-weight: 600;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 8px;
}

/* Editor Snippets Bar */
.editor-snippets-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}
.editor-snippets-bar::-webkit-scrollbar {
  display: none;
}

.snippets-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.snippet-chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.18s var(--apple-spring);
  white-space: nowrap;
}

.snippet-chip:hover {
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}
.snippet-chip:active {
  transform: scale(0.96);
}

.editor-wrapper {
  flex: 1;
  position: relative;
}

.editor-wrapper textarea {
  width: 100%;
  height: 100%;
  background-color: var(--bg-code);
  color: var(--text-primary);
  border: none;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
}

.editor-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 14px;
  background-color: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.editor-clause-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.clause-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.clause-pill.active {
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
  border: 1px solid rgba(10, 132, 255, 0.35);
}

.clause-pill.idle {
  color: var(--text-muted);
}

/* Results Card & Segmented Multi-Tab Output */
.results-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow: hidden;
}

.results-header {
  padding: 6px 14px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.results-tab-group {
  display: inline-flex;
  background-color: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.results-tab-btn {
  background: transparent;
  border: none;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s var(--apple-spring);
}

.results-tab-btn:hover {
  color: var(--text-primary);
}

.results-tab-btn.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.light-theme .results-tab-btn.active {
  background-color: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.tab-badge {
  font-size: 10px;
  background-color: rgba(118, 118, 128, 0.2);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-panes-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.rtab-panel {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.results-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

/* Apple Numbers Clean Table */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
}

.results-table th, .results-table td {
  border: 1px solid var(--border-subtle);
  padding: 7px 12px;
  text-align: left;
}

.results-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

body.light-theme .results-card {
  background-color: var(--bg-secondary);
}

body.light-theme .results-table th {
  background-color: #f2f2f7;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.results-table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}
body.light-theme .results-table tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

.results-table tr:hover {
  background-color: var(--bg-hover);
}

.null-pill {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  background-color: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
}

.results-success-msg {
  padding: 12px;
  background-color: var(--success-subtle);
  border: 1px solid var(--success-color);
  border-radius: var(--radius-md);
  color: var(--success-color);
  font-size: 13px;
  margin-bottom: 10px;
}

.results-error-msg {
  padding: 12px;
  background-color: var(--danger-subtle);
  border: 1px solid var(--danger-color);
  border-radius: var(--radius-md);
  color: var(--danger-color);
  font-size: 13px;
  font-family: var(--font-mono);
  margin-bottom: 10px;
  line-height: 1.5;
}

.empty-quick-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.empty-quick-actions button {
  font-size: 11.5px;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.empty-quick-actions button:hover {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* AI Query Structure & Stepwise Execution Plan Tab */
.query-plan-container {
  padding: 18px;
  max-width: 900px;
  margin: 0 auto;
}

.plan-pipeline-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.plan-pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.plan-pipeline-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-step-item {
  display: flex;
  gap: 12px;
  padding: 11px 13px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  align-items: flex-start;
  transition: all 0.2s var(--apple-spring);
}

.plan-step-item.active {
  border-color: var(--accent-primary);
  background-color: var(--accent-subtle);
}

.plan-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.plan-step-body {
  flex: 1;
}

.plan-step-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.plan-step-details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.plan-step-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 3px;
}

.plan-ai-tip {
  padding: 11px 15px;
  background-color: var(--purple-subtle);
  border: 1px solid rgba(191, 90, 242, 0.3);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

/* Raw Export Pane */
.raw-export-container {
  padding: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.export-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.raw-json-output {
  flex: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  overflow: auto;
  white-space: pre-wrap;
}

/* Schema Sidebar - macOS Finder Aesthetics */
.schema-sidebar {
  width: 320px;
  background-color: var(--bg-secondary);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
}

.schema-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.schema-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schema-title-wrap h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.schema-search-wrap {
  margin-bottom: 10px;
}

.schema-search-input {
  width: 100%;
  padding: 7px 11px;
  font-size: 12px;
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.schema-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.schema-table-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.schema-table-card:hover {
  border-color: var(--border-focus);
}

.schema-table-head {
  padding: 8px 11px;
  background-color: var(--bg-hover);
  font-weight: 600;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: color 0.15s ease;
}

.schema-table-head:hover {
  color: var(--accent-primary);
}

.schema-table-actions {
  display: flex;
  gap: 4px;
}

.schema-btn-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.schema-btn-chip:hover {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.schema-cols-list {
  padding: 7px 11px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-tertiary);
}

.schema-col-item {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  padding: 2px 0;
}

.schema-col-item .pk-tag {
  color: var(--warning-color);
  font-weight: 700;
  margin-left: 4px;
}

/* ==========================================================================
   TAB 4: Visual Learning Lab
   ========================================================================== */

.visual-container {
  padding: 22px 28px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Apple Segmented Visual Navigation */
.visual-tabs-nav {
  display: inline-flex;
  background-color: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.visual-tabs-nav::-webkit-scrollbar {
  display: none;
}

.vtab-btn {
  padding: 8px 16px;
  background-color: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s var(--apple-spring);
  white-space: nowrap;
}

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

.vtab-btn.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

body.light-theme .vtab-btn.active {
  background-color: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.vtab-panel {
  display: none;
}
.vtab-panel.active {
  display: block;
}

.panel-intro {
  margin-bottom: 22px;
}
.panel-intro h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.panel-intro p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* Pipeline Simulator Styles */
.pipeline-stepper-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  background-color: var(--bg-secondary);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.pipeline-step-indicator {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: var(--text-primary);
}

.pipeline-track {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.pipeline-track::-webkit-scrollbar {
  display: none;
}

.pipeline-node {
  flex: 1;
  min-width: 120px;
  padding: 11px 9px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
}

.pipeline-node:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.pipeline-node.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.4);
}

.pipeline-node.completed {
  border-color: var(--success-color);
  color: var(--success-color);
}

.pipeline-active-detail {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.pipeline-flow-diagram {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  padding: 16px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.flow-box {
  flex: 1;
  padding: 12px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  text-align: center;
}
.flow-arrow {
  font-size: 20px;
  color: var(--accent-primary);
}

/* 3VL Calculator Styles */
.logic-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.logic-inputs-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.input-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-box label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.logic-result-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.result-formula {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.result-arrow {
  font-size: 18px;
  color: var(--text-muted);
}

.result-badge {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-mono);
}
.result-badge.TRUE { background: var(--success-subtle); color: var(--success-color); border: 1px solid var(--success-color); }
.result-badge.FALSE { background: var(--danger-subtle); color: var(--danger-color); border: 1px solid var(--danger-color); }
.result-badge.UNKNOWN { background: var(--warning-subtle); color: var(--warning-color); border: 1px solid var(--warning-color); }

.logic-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Segmented Truth Table Tabs */
.tables-tabs {
  display: inline-flex;
  background-color: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  margin-bottom: 14px;
}

.tt-tab {
  padding: 5px 12px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
}

.tt-tab:hover {
  color: var(--text-primary);
}

.tt-tab.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.light-theme .tt-tab.active {
  background-color: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.truth-table-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
}

.truth-table-view th, .truth-table-view td {
  border: 1px solid var(--border-color);
  padding: 8px;
}

.truth-table-view th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
}

/* Joins Venn Explorer */
.joins-explorer-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}

.joins-selector-sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.join-type-btn {
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
}

.join-type-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.join-type-btn.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.joins-details-view {
  min-height: 400px;
}

/* Normalization Assistant */
.norm-assistant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

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

/* ==========================================================================
   TAB 5: MCQ Arena
   ========================================================================== */

.mcq-container {
  padding: 22px 28px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.mcq-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

/* Apple Fitness / Health Style Scoreboard */
.mcq-scoreboard {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.score-pill {
  font-size: 12.5px;
  padding: 3px 8px;
  font-weight: 500;
}

.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }

.mcq-card {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

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

.mcq-counter-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.mcq-question-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.mcq-options-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.mcq-option-btn {
  padding: 14px 18px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s var(--apple-spring);
  user-select: none;
}

.mcq-option-btn:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.mcq-option-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.mcq-option-btn:disabled {
  cursor: default;
}
.mcq-option-btn:disabled:not(.correct):not(.wrong) {
  opacity: 0.65;
}

.mcq-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mcq-option-btn.correct {
  background-color: var(--success-subtle);
  border-color: var(--success-color);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 14px rgba(48, 209, 88, 0.25);
}
.mcq-option-btn.correct .mcq-option-letter {
  background-color: var(--success-color);
  color: #fff;
  border-color: transparent;
}

.mcq-option-btn.wrong {
  background-color: var(--danger-subtle);
  border-color: var(--danger-color);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(255, 69, 58, 0.25);
}
.mcq-option-btn.wrong .mcq-option-letter {
  background-color: var(--danger-color);
  color: #fff;
  border-color: transparent;
}

.mcq-feedback-box {
  padding: 18px;
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: appleFeedbackSlide 0.25s var(--apple-spring);
}
.mcq-feedback-box.hidden {
  display: none;
}

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

.trap-warning-box {
  display: flex;
  gap: 10px;
  background-color: rgba(255, 159, 10, 0.12);
  border-left: 4px solid var(--warning-color);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

.explanation-box {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.mcq-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* ==========================================================================
   TAB 6: Exam Hall (Timed Simulation)
   ========================================================================== */

.exam-container {
  padding: 26px;
  max-width: 1220px;
  margin: 0 auto;
  width: 100%;
}

.exam-screen {
  display: none;
}
.exam-screen.active {
  display: block;
}

.exam-hero {
  text-align: center;
  padding: 40px 24px;
}

.exam-hero h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.exam-hero p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.exam-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  text-align: left;
}

.exam-mode-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: all 0.25s var(--apple-spring);
  box-shadow: var(--shadow-sm);
}

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

.exam-mode-card.featured {
  border-color: var(--accent-primary);
  background-color: var(--bg-elevated);
  box-shadow: 0 4px 20px rgba(0, 122, 255, 0.2);
}

.mode-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  align-self: flex-start;
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.mode-badge.popular {
  background: var(--accent-primary);
  color: #fff;
}
.mode-badge.hardcore {
  background: var(--purple-color);
  color: #fff;
}

.mode-specs {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
  font-weight: 500;
}

/* Active Exam Layout */
.exam-active-layout {
  display: flex;
  gap: 22px;
}

.exam-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.exam-timer-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--danger-subtle);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 69, 58, 0.2);
}

.exam-live-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.exam-option-item {
  width: 100%;
  padding: 14px 18px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s var(--apple-spring);
}
.exam-option-item:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}
.exam-option-item.selected {
  background-color: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(10, 132, 255, 0.25);
}

.exam-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
}

.exam-nav-btns {
  display: flex;
  gap: 10px;
}

.exam-palette-sidebar {
  width: 280px;
  flex-shrink: 0;
}

.palette-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin: 10px 0 14px 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.answered { background: var(--success-color); }
.legend-dot.flagged { background: var(--warning-color); }
.legend-dot.unvisited { background: var(--bg-tertiary); border: 1px solid var(--border-color); }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.palette-btn {
  aspect-ratio: 1;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.palette-btn:hover {
  transform: scale(1.05);
}
.palette-btn.current {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary);
}
.palette-btn.answered {
  background-color: var(--success-color);
  color: #fff;
  border-color: var(--success-color);
}
.palette-btn.flagged {
  background-color: var(--warning-color);
  color: #fff;
  font-weight: 700;
  border-color: var(--warning-color);
}

/* Scorecard Results - Apple Award Style */
.scorecard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

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

.stat-card {
  padding: 18px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; font-weight: 500; }
.stat-card strong { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }

.scorecard-diagnosis {
  margin-bottom: 24px;
}

.diagnosis-box {
  padding: 18px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  font-size: 13.5px;
  line-height: 1.6;
}

.scorecard-review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

/* Apple Floating Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(25px) saturate(190%);
  -webkit-backdrop-filter: blur(25px) saturate(190%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: appleSlideIn 0.25s var(--apple-spring);
}
.toast.success { border-color: var(--success-color); }
.toast.error { border-color: var(--danger-color); }

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

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

.highlight-glow {
  box-shadow: 0 0 0 3px var(--accent-primary), 0 0 24px rgba(10, 132, 255, 0.45) !important;
  transition: box-shadow 0.3s ease;
}

.markdown-list {
  margin: 8px 0 12px 20px;
  padding-left: 8px;
}

.markdown-list li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.bullet-item {
  list-style-type: disc;
}

.numbered-item {
  list-style-type: none;
}

/* ==========================================================================
   Day 6 Cheatsheet, Hands-on Scenarios & Multi-Select MCQ Enhancements
   ========================================================================== */

/* Hands-on Scenarios Filter Pill */
.filter-pill.handson-pill {
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.15), rgba(255, 149, 0, 0.15));
  border-color: rgba(255, 159, 10, 0.4);
  color: var(--warning-color);
  font-weight: 600;
}
.filter-pill.handson-pill.active {
  background: var(--warning-color);
  color: #ffffff;
  border-color: var(--warning-color);
  box-shadow: 0 2px 10px rgba(255, 159, 10, 0.4);
}

/* Scenario Schema Selector in Playground Topbar */
.schema-selector-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.schema-select-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.schema-dropdown {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Multi-Select MCQ Styles */
.mcq-option-btn.multi-option {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.mcq-option-btn.multi-option.selected {
  background-color: var(--accent-subtle);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}
.mcq-option-btn.multi-option.selected .mcq-option-letter {
  background-color: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}
.mcq-multi-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 6px;
  margin-bottom: 8px;
  gap: 12px;
}
.mcq-multi-action-bar.hidden {
  display: none;
}
.mcq-multi-hint {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Hands-on Scenario Badges */
.badge-scenario {
  background-color: rgba(10, 132, 255, 0.16);
  border: 1px solid rgba(10, 132, 255, 0.35);
  color: var(--text-link);
  font-weight: 600;
  font-size: 11px;
}
.badge-marks {
  background-color: rgba(255, 159, 10, 0.18);
  border: 1px solid rgba(255, 159, 10, 0.4);
  color: var(--warning-color);
  font-weight: 700;
  font-size: 11px;
}

/* Hands-on Verification Widget */
.handson-verify-box {
  margin-top: 14px;
  padding: 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.handson-verify-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.handson-verify-header h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.handson-verify-textarea {
  width: 100%;
  min-height: 85px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  resize: vertical;
}
.handson-verify-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--focus-ring);
}
.handson-verify-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.verify-status-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid;
}
.verify-status-banner.pass {
  background-color: var(--success-subtle);
  border-color: var(--success-color);
  color: var(--text-primary);
}
.verify-status-banner.pass strong {
  color: var(--success-color);
  font-size: 14px;
}
.verify-status-banner.fail {
  background-color: var(--danger-subtle);
  border-color: var(--danger-color);
  color: var(--text-primary);
}
.verify-status-banner.fail strong {
  color: var(--danger-color);
  font-size: 14px;
}
.verify-status-banner.info {
  background-color: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}
.verify-status-banner.info strong {
  color: var(--accent-primary);
  font-size: 14px;
}

/* Expected Output Table Preview */
.expected-table-container {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.expected-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.expected-table th, .expected-table td {
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  text-align: left;
}
.expected-table th {
  background-color: var(--bg-hover);
  color: var(--accent-primary);
  position: sticky;
  top: 0;
}

/* Day 6 Cheatsheet Top 20 Traps Cards */
.cs-traps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.cs-trap-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--warning-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--apple-spring), border-color 0.2s ease;
}
.cs-trap-card:hover {
  transform: translateY(-2px);
  border-color: var(--warning-color);
  box-shadow: var(--shadow-md);
}
.cs-trap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cs-trap-num {
  font-weight: 700;
  font-size: 12px;
  color: var(--warning-color);
}
.cs-trap-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.cs-trap-rule {
  font-family: var(--font-mono);
  font-size: 12px;
  background-color: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--danger-color);
  border-left: 3px solid var(--danger-color);
}
body.light-theme .cs-trap-rule {
  color: #d70015;
  background-color: rgba(215, 0, 21, 0.06);
  border-left: 3px solid #d70015;
}
.cs-trap-explanation {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 21-Step Decision Matrix Table */
.matrix-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 14px;
}
.decision-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.decision-matrix-table th, .decision-matrix-table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}
.decision-matrix-table th {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
}
.decision-matrix-table tr:hover {
  background-color: var(--bg-tertiary);
}
.clause-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
}

/* ==========================================================================
   Responsive Mobile Adjustments (Apple Human Interface Guidelines)
   ========================================================================== */

@media (max-width: 1024px) {
  .playground-container {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    overflow: visible;
  }
  .playground-layout {
    flex-direction: column;
    overflow: visible;
  }
  .playground-main-pane {
    border-right: none;
    overflow: visible;
  }
  .editor-card {
    height: auto;
    min-height: 260px;
  }
  .editor-wrapper textarea {
    min-height: 180px;
  }
  .results-card {
    height: auto;
    min-height: 380px;
    overflow: visible;
  }
  .results-panes-container {
    height: auto;
    min-height: 320px;
    overflow: visible;
  }
  .schema-sidebar {
    width: 100%;
    max-height: 380px;
    overflow-y: auto;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .study-container {
    flex-direction: column;
    height: auto;
  }
  .study-sidebar {
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .exam-active-layout {
    flex-direction: column;
    gap: 16px;
  }
  .exam-palette-sidebar {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    gap: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .header-left {
    width: auto;
    max-width: calc(100% - 210px);
    justify-content: flex-start;
  }
  .logo-text .subtitle {
    display: none;
  }
  .header-right {
    position: static;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }
  .header-shortcuts-badge {
    display: none;
  }
  .main-nav {
    order: 3;
    width: 100%;
    margin-top: 2px;
    padding: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .nav-tab {
    min-height: 40px;
    padding: 8px 13px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
  .study-sidebar {
    padding: 12px;
    gap: 10px;
  }
  .study-days-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .study-days-list::-webkit-scrollbar {
    display: none;
  }
  .study-day-btn {
    min-width: 165px;
    flex-shrink: 0;
  }
  .study-body {
    padding: 18px 16px;
  }
  .practice-container, .visual-container, .mcq-container, .exam-container {
    padding: 16px 14px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .filter-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-controls-row .form-select,
  .search-box.practice-search {
    width: 100%;
    min-width: 0;
  }
  .logic-calc-grid, 
  .norm-assistant-grid, 
  .joins-explorer-layout {
    grid-template-columns: 1fr;
    flex-direction: column;
    gap: 16px;
  }
  .joins-selector-sidebar {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    padding-bottom: 6px;
    width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .joins-selector-sidebar::-webkit-scrollbar {
    display: none;
  }
  .join-type-btn {
    min-width: 140px;
    flex-shrink: 0;
  }
  .mcq-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .mcq-scoreboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    gap: 8px;
  }
  .mcq-card-footer,
  .exam-actions-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .exam-modes-grid {
    grid-template-columns: 1fr;
  }
  .cs-traps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .logo-text h1 {
    font-size: 15px;
  }
  .main-nav {
    gap: 2px;
    padding: 2px;
  }
  .nav-tab {
    min-height: 42px;
    padding: 6px 10px;
    font-size: 12px;
  }
  .nav-tab .tab-icon {
    font-size: 14px;
  }
  .nav-tab .badge {
    font-size: 9.5px;
    padding: 1px 5px;
  }
  .study-day-btn {
    min-width: 145px;
    padding: 8px 10px;
  }
  .btn {
    min-height: 44px; /* Apple minimum touch target */
  }
  .screenshot-btn .btn-text {
    display: none;
  }
  .db-status-pill .status-text {
    display: none;
  }
  .scorecard-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .palette-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }
}\n