/* ==========================================================================
   한국사 93일 완성 마스터 앱 스타일시트 (Clean White Theme / Mobile First)
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-emerald: #059669;
  --accent-emerald-hover: #047857;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --border-color: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Nav */
.app-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  box-sizing: border-box;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.brand-flag {
  font-size: 22px;
  line-height: 1;
}

.brand-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.header-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

#header-today-watch-time {
  font-family: monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.user-badge {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.switch-icon {
  font-size: 11px;
  color: #2563eb;
  font-weight: 800;
}

.header-apk-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.dday-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: #cbd5e1;
}

/* Nav Tabs */
.nav-tabs-wrapper {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.nav-tabs {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  padding: 0 16px;
  gap: 8px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  color: var(--accent-blue);
  font-weight: 700;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--accent-blue);
  border-radius: 3px 3px 0 0;
}

/* Main Container */
main {
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
  width: 100%;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-content.active {
  display: block;
}

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

/* Cards & Grid */
.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.card-subtext {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Progress bar */
.progress-bar-bg {
  background-color: #e2e8f0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #2563eb, #059669);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Timeline & Schedule Cards */
.timeline-section {
  margin-top: 24px;
}

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

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.phase-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}

.phase-card.active-phase {
  border-color: #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.phase-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  background: #dbeafe;
  color: #1d4ed8;
}

.phase-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.phase-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.phase-btn {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.phase-btn:hover {
  background-color: var(--accent-blue-hover);
}

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

/* Robin Tab & Video Player */
.robin-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.video-wrapper {
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  padding-top: 56.25%;
  box-shadow: var(--shadow-md);
}

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

.robin-day-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.day-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.day-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  font-weight: 700;
}

.day-btn.completed {
  border-color: var(--accent-emerald);
  position: relative;
}

.day-btn.completed::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 900;
}

/* In-App HD Video Player */
.lecture-video-box {
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border: 1px solid #1e293b;
}

.lecture-video-element {
  width: 100%;
  max-height: 480px;
  background: #000000;
  display: block;
  outline: none;
}

.video-control-bar {
  background: #0f172a;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid #334155;
}

.video-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-file-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: #3b82f6;
  color: #ffffff;
}

.video-filename-text {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
}

.video-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.speed-btn {
  padding: 5px 10px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.speed-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* Lecture List & Split View */
.split-view-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: calc(100vh - 180px);
}

@media (max-width: 960px) {
  .split-view-container {
    grid-template-columns: 1fr;
  }
}

.lecture-sidebar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.sidebar-search {
  width: 100%;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-search:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--accent-blue);
}

.lecture-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lecture-item:hover {
  background: #f8fafc;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.lecture-item.active {
  border-color: #2563eb !important;
  background: #2563eb !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.lecture-item.active * {
  color: #ffffff !important;
}

.lecture-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.lecture-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2px 0;
  line-height: 1.4;
}

.lecture-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.lecture-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
}

.lecture-badge.done {
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
}

/* Lecture Content Detail */
.lecture-content-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lecture-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.lecture-header-info h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.lecture-header-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.lecture-actions {
  display: flex;
  gap: 10px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

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

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #cbd5e1;
}

/* Subnote & Summary Card */
.subnote-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.subnote-header {
  font-size: 15px;
  font-weight: 800;
  color: #1d4ed8;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subnote-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subnote-list li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  position: relative;
  padding-left: 20px;
}

.subnote-list li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: #2563eb;
  font-size: 18px;
  line-height: 1.2;
}

/* Quiz Box & Real CBT Exam Layout */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  margin-bottom: 20px;
}

.quiz-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.quiz-question-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-num-badge {
  background: #1e3a8a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: -0.2px;
}

.quiz-score-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.quiz-type-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.quiz-question {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 16px;
  word-break: keep-all;
}

/* Authentic Historical Material Box ([자료] 사료 박스) */
.quiz-material-box {
  background: #fdfbf7;
  border: 1px solid #e2ded4;
  border-left: 4px solid #b45309;
  border-radius: 6px;
  padding: 16px 20px;
  margin: 14px 0 18px 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

.quiz-material-header {
  font-size: 13px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quiz-material-body {
  font-size: 14.5px;
  line-height: 1.8;
  color: #334155;
  word-break: keep-all;
  white-space: pre-line;
}

/* Historical Visual / Artifact / Diagram Container */
.quiz-visual-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0 16px 0;
}

.quiz-visual-svg-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 260px;
  min-height: 130px;
}

.quiz-visual-caption {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 3px 12px;
  border-radius: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.quiz-opt-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  text-align: left;
  font-size: 14.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  word-break: keep-all;
}

.quiz-opt-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #93c5fd;
  transform: translateX(2px);
}

.quiz-opt-btn .opt-num {
  font-weight: 800;
  color: #2563eb;
  font-size: 15px;
  min-width: 20px;
}

.quiz-opt-btn.correct {
  border-color: #059669 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
  font-weight: 700;
}

.quiz-opt-btn.correct .opt-num {
  color: #059669;
}

.quiz-opt-btn.wrong {
  border-color: #e11d48 !important;
  background: #fff1f2 !important;
  color: #9f1239 !important;
}

.quiz-opt-btn.wrong .opt-num {
  color: #e11d48;
}

.quiz-feedback {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--accent-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #1e293b;
  display: none;
  margin-top: 14px;
  animation: fadeIn 0.2s ease forwards;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.correct {
  border-left-color: #059669;
  background: #f0fdf4;
}

.quiz-feedback.wrong {
  border-left-color: #dc2626;
  background: #fef2f2;
}

/* Floating Draggable & Resizable Memo Window */
.memo-window {
  position: fixed;
  top: 90px;
  right: 40px;
  width: 740px;
  height: 620px;
  min-width: 340px;
  min-height: 400px;
  max-width: 96vw;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  resize: both;
  overflow: hidden;
  animation: memoPopupIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes memoPopupIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.memo-window.maximized {
  top: 10px !important;
  left: 10px !important;
  right: auto !important;
  width: calc(100vw - 20px) !important;
  height: calc(100vh - 20px) !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 8px;
  resize: none;
}

.memo-window-header {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
}

.memo-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-day-dropdown {
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e40af;
  outline: none;
  cursor: pointer;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.memo-day-dropdown:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.memo-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  transition: all 0.2s ease;
}

.memo-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.memo-win-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.memo-win-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.memo-win-btn.close:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Rich Toolbar */
.memo-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.memo-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.memo-tool-divider {
  width: 1px;
  height: 22px;
  background: #cbd5e1;
  margin: 0 4px;
}

.memo-tool-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  margin-right: 2px;
}

.memo-btn {
  padding: 4px 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12.5px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  min-width: 26px;
  height: 28px;
}

.memo-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.memo-color-picker {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.memo-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}

.memo-color-dot:hover {
  transform: scale(1.2);
}

.memo-hl-btn {
  padding: 3px 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  color: #1e293b;
  height: 26px;
  transition: transform 0.15s ease;
}

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

.memo-tool-label-btn {
  padding: 4px 10px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  transition: all 0.15s ease;
}

.memo-tool-label-btn:hover {
  background: #dbeafe;
}

.memo-tip-text {
  font-size: 11px;
  color: #64748b;
  margin-left: 6px;
}

/* Editor Container */
.memo-editor-container {
  flex: 1;
  overflow-y: auto;
  background: #ffffff;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
}

.memo-rich-editor {
  flex: 1;
  min-height: 260px;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  color: #0f172a;
  word-break: break-word;
}

.memo-rich-editor:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
  pointer-events: none;
  display: block;
}

.memo-rich-editor p {
  margin: 0 0 10px 0;
}

.memo-rich-editor ul, .memo-rich-editor ol {
  padding-left: 24px;
  margin: 8px 0;
}

.memo-rich-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 12px 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
}

/* Window Footer */
.memo-window-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.memo-resize-handle {
  font-size: 14px;
  color: #94a3b8;
  cursor: se-resize;
  user-select: none;
}

@media (max-width: 640px) {
  .memo-window {
    top: 5% !important;
    left: 2% !important;
    right: auto !important;
    width: 96% !important;
    height: 88% !important;
    max-width: 96vw !important;
    max-height: 90vh !important;
  }

  .memo-tip-text {
    display: none;
  }
}

/* Flashcards */
.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.flashcard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

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

.flashcard-category {
  font-size: 11px;
  font-weight: 700;
  color: #6d28d9;
  background: #ede9fe;
  padding: 3px 8px;
  border-radius: 4px;
}

.flashcard-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.flashcard-era {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.flashcard-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.flashcard-points li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-left: 16px;
  position: relative;
}

.flashcard-points li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--accent-emerald);
  font-size: 11px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(2px);
}

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

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Secondary Button */
.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Fullscreen CBT Mode */
.fullscreen-cbt-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: #f8fafc !important;
  overflow-y: auto !important;
  padding: 24px 32px !important;
  margin: 0 !important;
}

.fullscreen-cbt-active .lecture-sidebar {
  display: none !important;
}

.fullscreen-cbt-active .split-view-container {
  grid-template-columns: 1fr !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
}

/* Review Filter & Cards */
.review-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.filter-btn.active {
  background: #2563eb;
  color: #ffffff !important;
  border-color: #2563eb;
}

.review-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.badge-correct {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
}

.badge-wrong {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
}

/* Twin Similar Question Drill Box */
.twin-drill-box {
  margin-top: 16px;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border: 2px solid #86efac;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
  animation: fadeIn 0.3s ease;
}

.twin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

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

/* Mobile optimizations: Ultra-clean & Simple Header */
@media (max-width: 640px) {
  .header-container {
    padding: 6px 12px;
    gap: 8px;
    min-height: 48px;
  }
  
  .header-brand {
    gap: 6px;
  }

  .brand-flag {
    font-size: 19px !important;
  }

  .brand-title {
    font-size: 15px !important;
    font-weight: 800;
  }

  .header-actions {
    gap: 6px;
  }

  .header-timer-badge {
    padding: 3px 8px !important;
    font-size: 11.5px !important;
  }

  .user-badge {
    padding: 3px 8px !important;
    font-size: 12px !important;
  }

  .header-apk-link {
    display: none !important;
  }
  
  main {
    padding: 14px 10px;
  }
  
  .quiz-card {
    padding: 16px;
  }
  
  .tab-btn {
    padding: 12px 14px;
    font-size: 13px;
  }

  .video-control-bar {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .video-status-info {
    justify-content: space-between;
  }

  .video-action-buttons {
    justify-content: space-between;
    width: 100%;
  }

  .speed-btn {
    flex: 1;
    text-align: center;
    padding: 7px 4px;
    font-size: 11.5px;
  }

  .lecture-actions {
    width: 100%;
  }

  #btn-play-day-video {
    width: 100%;
    font-size: 15px !important;
    padding: 12px 16px !important;
  }

  #folder-connect-banner {
    padding: 12px !important;
  }

  #folder-connect-banner button {
    width: 100%;
  }
}

/* ==========================================================================
   Real Exam CBT Solver Styles
   ========================================================================== */

.cbt-practice-card {
  transition: all 0.2s ease-in-out;
}

.cbt-practice-card:hover {
  border-color: #2563eb !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12) !important;
}

.omr-choice-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease-in-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.omr-choice-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-2px);
}

.omr-choice-btn.selected {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.omr-choice-btn.correct {
  border-color: #10b981 !important;
  background: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35) !important;
}

.omr-choice-btn.incorrect {
  border-color: #ef4444 !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
}

.cbt-progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.cbt-progress-dot:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.cbt-progress-dot.active {
  border-color: #2563eb;
  border-width: 2.5px;
  color: #2563eb;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.cbt-progress-dot.correct {
  background: #dcfce7;
  border-color: #10b981;
  color: #047857;
}

.cbt-progress-dot.incorrect {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}


