/* DentPass Modern Design System - dt.shanghai.co.kr */
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --font-brand: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Light */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Subject Accent Colors */
  --ortho-color: #0284c7;
  --ortho-bg: #e0f2fe;
  --oralmed-color: #059669;
  --oralmed-bg: #d1fae5;
  --prostho-color: #d97706;
  --prostho-bg: #fef3c7;
  --pediatric-color: #db2777;
  --pediatric-bg: #fce7f3;
  --conserve-color: #4f46e5;
  --conserve-bg: #e0e7ff;

  /* UI Tokens */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent-gold: #f59e0b;
  --accent-red: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.2);

  --font-scale: 1;
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.88);
  --border-subtle: #1e293b;
  --border-medium: #334155;

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1e40af, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

[data-theme="dark"] .brand-text h1 {
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
}

/* Nav Actions & Controls */
.nav-center {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
}

.search-trigger kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.btn-pill {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pill:hover, .btn-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Subject Switcher Bar */
.subject-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.subject-bar::-webkit-scrollbar {
  display: none;
}

.subject-tab {
  flex-shrink: 0;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
}

.subject-tab .icon {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subject-tab .meta {
  display: flex;
  flex-direction: column;
}

.subject-tab .title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.subject-tab .badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.subject-tab:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.subject-tab.active {
  border-color: var(--active-color, var(--primary));
  background: var(--bg-secondary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.subject-tab.active .title {
  color: var(--active-color, var(--primary));
}

.subject-tab.active::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--active-color, var(--primary));
}

/* App Main Layout */
.app-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 125px);
}

/* Sidebar Chapter List */
.sidebar {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  padding: 1.25rem 1rem;
  height: calc(100vh - 125px);
  position: sticky;
  top: 125px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.sidebar-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.chapter-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  list-style: none;
}

.chapter-nav-item {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.chapter-nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.chapter-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  border-left: 3px solid var(--primary);
}

.chapter-nav-item .count {
  font-size: 0.6875rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Main Content Area */
.content-area {
  padding: 2rem 3rem;
  max-width: 1050px;
}

/* Hero Banner */
.subject-hero {
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.subject-hero-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  opacity: 0.95;
}

.subject-hero-content {
  position: relative;
  z-index: 1;
}

.subject-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.subject-hero h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.subject-hero p {
  font-size: 0.9375rem;
  opacity: 0.92;
  max-width: 700px;
  line-height: 1.5;
}

/* Control Toolbar */
.study-toolbar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.mode-switches {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mode-btn {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.mode-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Chapter Section */
.chapter-container {
  margin-bottom: 3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}

.chapter-title-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-subtle);
}

.chapter-title-bar h3 {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Exam Item Card */
.exam-item {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  font-size: calc(0.9375rem * var(--font-scale));
}

.exam-item:hover {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-medium);
}

.exam-item.star-3 {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
}

.exam-item.star-2 {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}

.exam-item.star-1 {
  border-left-color: #3b82f6;
}

.exam-item.is-jokbo {
  border-left-color: #10b981;
}

.item-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.5rem;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.2;
}

.badge-tag.star-3 {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-tag.star-2 {
  background: #fef3c7;
  color: #b45309;
}

.badge-tag.star-1 {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-tag.jokbo {
  background: #dcfce7;
  color: #15803d;
}

.badge-tag.recent {
  background: #f3e8ff;
  color: #7e22ce;
}

.item-text {
  display: inline;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.65;
}

/* Interactive Cloze / Recall Masking */
.cloze-word {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  margin: 0 0.15rem;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  color: transparent;
  user-select: none;
  cursor: pointer;
  border: 1px dashed #94a3b8;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
}

[data-theme="dark"] .cloze-word {
  background: #334155;
  border-color: #64748b;
}

.cloze-word::after {
  content: '???';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.cloze-word.revealed {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

[data-theme="dark"] .cloze-word.revealed {
  background: #064e3b;
  color: #a7f3d0;
  border-color: #059669;
}

.cloze-word.revealed::after {
  display: none;
}

/* Clinical Tables */
.table-wrapper {
  margin: 1.5rem 0;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
  background: var(--bg-secondary);
}

.exam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(0.875rem * var(--font-scale));
  text-align: left;
  background: var(--bg-secondary);
}

/* Banner Title on Table */
.exam-table .table-banner-th {
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-size: calc(0.95rem * var(--font-scale));
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  border-bottom: 2px solid var(--border-medium);
  white-space: normal;
  line-height: 1.5;
  text-align: left;
}

/* Column Header Row */
.exam-table .table-col-header-row th {
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-medium);
  border-right: 1px solid var(--border-subtle);
  white-space: normal;
  text-align: center;
}

.exam-table th {
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-medium);
  border-right: 1px solid var(--border-subtle);
  white-space: normal;
}

.exam-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
  white-space: pre-line;
}

.exam-table td:last-child,
.exam-table th:last-child {
  border-right: none;
}

.exam-table tr:hover td {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

/* Figures & Diagrams */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.25rem 0;
}

.figure-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  max-height: 320px;
  box-shadow: var(--shadow-sm);
}

.figure-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.figure-card img {
  max-width: 100%;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #ffffff;
  padding: 0.5rem;
  display: block;
}

/* Global Search Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5rem 1rem;
}

.modal-overlay.open {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 680px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.125rem;
  color: var(--text-main);
  outline: none;
  font-family: var(--font-sans);
}

.search-results {
  max-height: 480px;
  overflow-y: auto;
  padding: 0.75rem;
  list-style: none;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.search-result-item:hover, .search-result-item.selected {
  background: var(--bg-tertiary);
}

.result-location {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.result-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.result-text mark {
  background: #fef08a;
  color: #713f12;
  border-radius: 2px;
  padding: 0 2px;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 2rem;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background: white;
  padding: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .content-area {
    padding: 1.5rem 1rem;
  }
}

/* ========================================================
   6-Digit PIN Security Gate
   ======================================================== */
.pin-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #090d16 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.pin-lock-overlay.unlocked {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.05);
  pointer-events: none;
}

.pin-lock-card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pin-lock-header {
  margin-bottom: 2rem;
}

.pin-lock-shield {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #ffffff;
  margin: 0 auto 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
  transition: all 0.3s ease;
}

.pin-lock-header h2 {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.pin-lock-header p {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* 6 PIN Indicator Dots */
.pin-dots-container {
  display: flex;
  gap: 16px;
  margin-bottom: 1.25rem;
  align-items: center;
  justify-content: center;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
  transform: scale(1.15);
}

.pin-dot.success {
  background: #10b981;
  border-color: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.9);
  transform: scale(1.2);
}

.pin-dot.error {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.9);
}

/* Shake Animation */
.shake {
  animation: pinShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pinShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.pin-error-msg {
  min-height: 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f87171;
  margin-bottom: 1rem;
  display: none;
}

/* Virtual Keypad */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 270px;
  margin: 0 auto 1.5rem;
}

.pin-key {
  aspect-ratio: 1;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pin-key:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
}

.pin-key-action {
  font-size: 1.15rem;
  color: #94a3b8;
  background: transparent;
  border-color: transparent;
}

.pin-key-action:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

.pin-lock-footer {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========================================================
   Interactive Study Notes & Voice STT System
   ======================================================== */
.btn-sm-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sm-action:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* Item Action Bar (Inside exam-item) */
.item-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-subtle);
}

.item-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.item-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
  border-color: var(--border-subtle);
}

.item-action-btn.has-note {
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.item-action-btn.has-note:hover {
  background: rgba(245, 158, 11, 0.2);
}

/* User Note Card Attached to Item */
.user-note-card {
  margin-top: 0.85rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.4) 0%, rgba(253, 230, 138, 0.2) 100%);
  border-left: 4px solid #f59e0b;
  border-top: 1px solid rgba(245, 158, 11, 0.2);
  border-right: 1px solid rgba(245, 158, 11, 0.2);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.05);
}

[data-theme="dark"] .user-note-card {
  background: linear-gradient(135deg, rgba(69, 26, 3, 0.3) 0%, rgba(120, 53, 15, 0.2) 100%);
  border-left: 4px solid #fbbf24;
  border-top: 1px solid rgba(251, 191, 36, 0.2);
  border-right: 1px solid rgba(251, 191, 36, 0.2);
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.note-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .note-card-title {
  color: #fbbf24;
}

.note-card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  margin-right: 10px;
}

.note-card-actions {
  display: flex;
  gap: 6px;
}

.note-card-actions button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.note-card-actions button:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .note-card-actions button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.note-card-body {
  font-size: calc(0.875rem * var(--font-scale));
  line-height: 1.55;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Note Modal Dialog */
.note-modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: modalSlideUp 0.25s ease-out;
}

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

.note-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.note-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.note-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

[data-theme="dark"] .note-icon-box {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.note-modal-title h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.note-target-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Quick Tags */
.note-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tag-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Voice STT Bar */
.voice-stt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.btn-voice-stt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  background: #2563eb;
  border: none;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-voice-stt:hover {
  background: #1d4ed8;
}

.btn-voice-stt.recording {
  background: #ef4444;
  animation: pulseVoice 1.5s infinite;
}

@keyframes pulseVoice {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Textarea Wrapper */
.note-textarea-wrapper textarea {
  width: 100%;
  height: 160px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.925rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.note-textarea-wrapper textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Modal Footer */
.note-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.btn-primary-pill {
  background: var(--primary);
  color: #ffffff !important;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary-pill:hover {
  background: var(--primary-hover);
}

/* ========================================================
   DentPass AI Tutor & YouTube Media Styles
   ======================================================== */
.ai-modal-card {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.25s ease-out;
}

.ai-modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.ai-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.ai-modal-title h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.ai-target-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

/* Prompt Chips */
.ai-prompt-chips {
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.785rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.prompt-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.prompt-chip.active i {
  color: #ffffff !important;
}

/* Custom Question Bar */
.ai-custom-bar {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.ai-custom-bar input {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.ai-custom-bar input:focus {
  border-color: var(--primary);
}

.btn-ai-mic {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-ai-mic:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-ai-mic.recording {
  background: #ef4444;
  color: #ffffff;
  animation: pulseVoice 1.5s infinite;
}

.btn-ai-ask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  background: #4f46e5;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ai-ask:hover {
  background: #4338ca;
}

/* Modal Body */
.ai-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: calc(90vh - 240px);
}

.ai-response-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  font-size: calc(0.925rem * var(--font-scale));
  line-height: 1.7;
  color: var(--text-main);
  min-height: 140px;
}

.ai-response-box h2,
.ai-response-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4f46e5;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.ai-response-box h2:first-child,
.ai-response-box h3:first-child {
  margin-top: 0;
}

.ai-response-box ul,
.ai-response-box ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.ai-response-box li {
  margin-bottom: 0.35rem;
}

.ai-response-box strong {
  color: var(--text-main);
  font-weight: 700;
}

.ai-response-box code {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* YouTube Section */
.youtube-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.youtube-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.youtube-section-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.yt-player-container {
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  background: #000000;
}

.yt-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #111827;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
}

.yt-player-header button {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
}

.yt-player-header button:hover {
  color: #ffffff;
}

.yt-iframe-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
}

.yt-iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.youtube-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.yt-video-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.yt-video-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #ef4444;
}

.yt-thumbnail-wrapper {
  position: relative;
  width: 100%;
  height: 130px;
  background: #000;
  overflow: hidden;
}

.yt-thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.yt-video-card:hover .yt-thumbnail-wrapper img {
  transform: scale(1.05);
}

.yt-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.yt-video-info {
  padding: 0.65rem 0.75rem;
}

.yt-video-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal Footer */
.ai-modal-footer {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-amber-pill {
  background: #f59e0b;
  color: #ffffff !important;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.btn-amber-pill:hover {
  background: #d97706;
}

.item-action-btn.ai-btn {
  color: #6366f1;
}

.item-action-btn.ai-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}
