/* Learning System Features CSS */

/* Confirm button (appears near selection) */
.hl-confirm {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 250;
  animation: fadeInConfirm 0.2s ease;
}
.hl-confirm-btn {
  background: oklch(20% 0.01 60);
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-family: var(--sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.2);
}
.hl-confirm-btn:first-child { border-radius: 8px 0 0 8px; }
.hl-confirm-btn:last-child { border-radius: 0 8px 8px 0; }
.hl-confirm-btn:active { background: oklch(30% 0.01 60); }
@keyframes fadeInConfirm { from { opacity: 0; transform: translateX(-50%) translateY(4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Toast */
.hl-toast {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: oklch(20% 0.01 60);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: var(--sans);
  z-index: 350;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.2);
}
.hl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-undo {
  background: none;
  border: none;
  color: oklch(75% 0.12 220);
  font-size: 0.875rem;
  font-family: var(--sans);
  cursor: pointer;
  font-weight: 500;
  padding: 0;
}

/* Highlight tap menu */
.hl-menu-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.3);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeInOverlay 0.15s ease;
}
.hl-menu {
  background: white;
  width: 100%;
  max-width: 400px;
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(16px + env(safe-area-inset-bottom));
}
.hl-menu-text {
  font-size: 0.8125rem;
  color: var(--text3);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 8px;
}
.hl-menu-note {
  font-size: 0.875rem;
  color: var(--text2);
  padding: 8px 12px;
  background: oklch(96% 0.005 60);
  border-radius: 6px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.hl-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hl-menu-actions button {
  background: none;
  border: none;
  text-align: left;
  padding: 12px 8px;
  font-size: 0.9375rem;
  font-family: var(--sans);
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.hl-menu-actions button:active { background: oklch(96% 0.005 60); }
.hl-menu-actions button.danger { color: oklch(50% 0.18 25); }

/* Highlight marks */
.hl-mark {
  background: oklch(92% 0.08 80);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.hl-mark:hover { background: oklch(88% 0.10 80); }
.hl-mark.has-note {
  background: oklch(90% 0.10 200);
  border-bottom: 2px solid oklch(60% 0.12 200);
}
.hl-mark.has-note:hover { background: oklch(86% 0.12 200); }

/* Note overlay (bottom sheet) */
.note-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.4);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeInOverlay 0.15s ease;
}
.note-card {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 16px 16px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
}
.note-quote {
  font-size: 0.8125rem;
  color: var(--text3);
  font-style: italic;
  margin-bottom: 12px;
  line-height: 1.5;
}
.note-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.7;
  resize: none;
  background: var(--bg);
  color: var(--text);
}
.note-textarea:focus { outline: none; border-color: var(--text3); }
.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.note-cancel, .note-save {
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--sans);
  cursor: pointer;
}
.note-cancel { background: oklch(92% 0.005 60); color: var(--text2); }
.note-save { background: var(--text); color: white; }

/* Retelling section */
.retelling-section {
  max-width: 640px;
  margin: 64px auto 0;
  padding: 0 clamp(20px, 5vw, 48px);
}
.retelling-section .section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.retelling-section .section-title {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.retelling-section .section-desc {
  font-size: 0.875rem;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.7;
}
.retell-record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity 0.15s;
}
.retell-record:hover { opacity: 0.8; }
.retell-record.recording {
  background: oklch(50% 0.2 25);
  animation: pulse 1.5s infinite;
}
.retell-status {
  font-size: 0.8125rem;
  color: var(--text3);
  margin-top: 8px;
  min-height: 20px;
}
.retell-transcript {
  display: none;
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--note-bg, oklch(96% 0.008 60));
  border-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
}
.retell-done {
  display: none;
  margin-top: 12px;
  font-size: 0.8125rem;
  color: oklch(50% 0.12 150);
}
.retell-done.show { display: block; }
.retell-or {
  font-size: 0.8125rem;
  color: var(--text3);
  margin: 16px 0 8px;
}
.retell-text-input {
  width: 100%;
  min-height: 80px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.7;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}
.retell-text-input:focus {
  outline: none;
  border-color: var(--text3);
}
.retell-text-save {
  margin-top: 8px;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: var(--sans);
  cursor: pointer;
}
.retell-text-save:hover { opacity: 0.8; }

/* QA section */
.qa-section {
  max-width: 640px;
  margin: 48px auto 0;
  padding: 0 clamp(20px, 5vw, 48px);
}
.qa-section .section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.qa-section .section-title {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 24px;
}
.qa-item {
  margin-bottom: 28px;
}
.qa-q {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.7;
  margin-bottom: 10px;
}
.qa-a {
  display: none;
  padding: 12px 16px;
  background: var(--note-bg, oklch(96% 0.008 60));
  border-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: 8px;
}
.qa-a.show { display: block; }
.qa-input {
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}
.qa-input:focus {
  outline: none;
  border-color: var(--text3);
}
.qa-save {
  margin-top: 6px;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: var(--sans);
  cursor: pointer;
}
.qa-save:hover { opacity: 0.8; }

/* Tags */
.tag-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 100px;
  color: white;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Status badge */
.status-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 100px;
}
.status-badge.unread { background: oklch(92% 0.005 60); color: var(--text3); }
.status-badge.reading { background: oklch(90% 0.08 220); color: oklch(40% 0.12 220); }
.status-badge.read { background: oklch(90% 0.08 150); color: oklch(40% 0.12 150); }
.status-badge.retold { background: oklch(90% 0.08 280); color: oklch(40% 0.12 280); }

/* Level badge */
.level-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: oklch(92% 0.005 60);
  color: var(--text3);
}
.level-badge.l1 { background: oklch(90% 0.06 80); color: oklch(45% 0.1 80); }
.level-badge.l2 { background: oklch(90% 0.08 150); color: oklch(40% 0.12 150); }
.level-badge.l3 { background: oklch(90% 0.08 220); color: oklch(40% 0.12 220); }
.level-badge.l4 { background: oklch(90% 0.08 280); color: oklch(40% 0.12 280); }

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 3px;
  background: oklch(92% 0.005 60);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
