/* ===================================================
   YQUIZ LAB - BRIGHT & MODERN LIGHT THEME
   유튜브 영상 기반 인터랙티브 퀴즈 & 해설 플랫폼
=================================================== */

:root {
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --primary-light: #fef2f2;
  --primary-ring: rgba(239, 68, 68, 0.25);

  --secondary: #2563eb;
  --secondary-light: #eff6ff;
  
  --accent-green: #10b981;
  --accent-green-light: #ecfdf5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;

  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-hover: #f8fafc;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-white: #ffffff;

  --border-light: #e2e8f0;
  --border-focus: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 12px rgba(15, 23, 42, 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

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

.brand-info h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

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

.btn-nav {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}

.btn-nav:hover {
  background: var(--bg-muted);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-nav.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

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

/* MAIN LAYOUT */
.main-wrapper {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

/* VIDEO SELECTOR CAROUSEL */
.video-catalog-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.catalog-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.catalog-chips {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scrollbar-width: thin;
}

.video-chip {
  flex: 0 0 auto;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-muted);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.video-chip:hover {
  background: #f8fafc;
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.video-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.12);
}

.chip-thumb {
  width: 52px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: #cbd5e1;
}

.chip-info {
  overflow: hidden;
}

.chip-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.chip-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* HERO SECTION */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0;
}

@media (max-width: 960px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
}

.video-player-box {
  background: #000;
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
}

.video-player-box iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-details-box {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
}

.video-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.badge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--secondary-light);
  color: var(--secondary);
}

.badge-tag.highlight {
  background: var(--primary-light);
  color: var(--primary);
}

.video-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.video-author-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.author-name {
  font-weight: 700;
  color: var(--text-main);
}

.hero-quote-card {
  background: var(--bg-muted);
  border-left: 4px solid var(--primary);
  padding: 0.9rem 1.1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
  font-style: italic;
}

.hero-stats-row {
  display: flex;
  gap: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

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

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

/* TAB NAVIGATION */
.tabs-nav {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.2rem;
}

.tab-btn {
  padding: 0.75rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* QUIZ CONTAINER */
.quiz-section {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .quiz-section {
    grid-template-columns: 1fr;
  }
}

.quiz-main-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.quiz-progress-bar-wrap {
  margin-bottom: 1.8rem;
}

.quiz-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.question-badge-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.q-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: #475569;
}

.q-timestamp-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
}

.q-timestamp-badge:hover {
  background: #fee2e2;
  transform: scale(1.03);
}

.question-title {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 1.8rem;
}

/* OPTIONS LIST */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-main);
  user-select: none;
}

.option-item:hover:not(.disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(4px);
}

.option-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-text {
  flex: 1;
  line-height: 1.45;
}

/* SELECTED & ANSWER STATES */
.option-item.selected {
  border-color: var(--secondary);
  background: var(--secondary-light);
}

.option-item.selected .option-num {
  background: var(--secondary);
  color: white;
}

.option-item.correct {
  border-color: var(--accent-green) !important;
  background: var(--accent-green-light) !important;
  color: #065f46 !important;
}

.option-item.correct .option-num {
  background: var(--accent-green) !important;
  color: white !important;
}

.option-item.wrong {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
  color: #991b1b !important;
}

.option-item.wrong .option-num {
  background: var(--primary) !important;
  color: white !important;
}

.option-item.disabled {
  cursor: default;
}

/* EXPLANATION ACCORDION CARD */
.explanation-card {
  display: none;
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-top: 1.2rem;
  animation: fadeIn 0.3s ease;
}

.explanation-card.show {
  display: block;
}

.explanation-card.correct-border {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.explanation-card.wrong-border {
  border-color: #fecaca;
  background: #fef2f2;
}

.exp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.exp-status-tag {
  font-size: 0.85rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.exp-status-tag.correct {
  color: #059669;
}

.exp-status-tag.wrong {
  color: #dc2626;
}

.exp-jump-btn {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary);
  background: white;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
}

.exp-jump-btn:hover {
  background: #dbeafe;
}

.exp-body {
  font-size: 0.94rem;
  color: #334155;
  line-height: 1.6;
}

/* QUIZ ACTIONS ROW */
.quiz-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.btn-primary {
  padding: 0.85rem 1.6rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.32);
}

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  padding: 0.85rem 1.4rem;
  background: var(--bg-muted);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* QUIZ SIDEBAR */
.quiz-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.side-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.side-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.q-nav-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-muted);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.q-nav-btn:hover {
  border-color: var(--border-focus);
  background: white;
}

.q-nav-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.q-nav-btn.correct {
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

.q-nav-btn.wrong {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* SCORE SUMMARY CARD */
.result-card {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
  animation: fadeIn 0.4s ease;
}

.result-card.show {
  display: block;
}

.result-badge-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 1.2rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 4px solid #f59e0b;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

.result-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.result-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

.score-display-box {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 1rem 2.5rem;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.score-num {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--primary);
}

.score-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* SUMMARY TAB CONTENT */
.summary-container {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.3s ease;
}

.summary-container.show {
  display: block;
}

.summary-heading {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.summary-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  padding-left: 2rem;
  border-left: 3px solid #e2e8f0;
  margin-bottom: 2.5rem;
}

.timeline-point {
  position: relative;
}

.timeline-point::before {
  content: '';
  position: absolute;
  left: -2.45rem;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.timeline-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* EXTENSIBILITY GUIDE TAB */
.guide-container {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.3s ease;
}

.guide-container.show {
  display: block;
}

.code-snippet {
  background: #1e293b;
  color: #f8fafc;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  margin-top: 3rem;
  background: white;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
}

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

.footer-links a:hover {
  color: var(--primary);
}

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