/* ============================================================
   CortexNotes — "Dark Academic Observatory"
   ============================================================ */

/* --- Google Fonts (loaded in base.html, declared here for reference) --- */
/* Playfair Display (display), Source Serif 4 (body), IBM Plex Mono (UI/mono) */

/* ============================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-deep: #0B0E11;
  --bg-surface: #141920;
  --bg-elevated: #1C2430;

  /* Accents */
  --accent: #E8A838;
  --accent-hover: #F0B84E;
  --accent-muted: rgba(232, 168, 56, 0.15);
  --secondary: #B07050;
  --secondary-muted: rgba(176, 112, 80, 0.15);
  --success: #4CAF82;
  --danger: #C44B4B;

  /* Text */
  --text-primary: #E8E0D4;
  --text-secondary: #9A917F;
  --text-tertiary: #6B6358;

  /* Borders */
  --border: rgba(232, 168, 56, 0.1);
  --border-hover: rgba(232, 168, 56, 0.25);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: 4px 0 16px rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Serif 4', 'Georgia', serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-md: 300ms var(--ease-out);
}

/* ============================================================
   2. BASE RESET & TYPOGRAPHY
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

small, .text-sm {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

::selection {
  background: var(--accent-muted);
  color: var(--accent);
}

/* ============================================================
   3. NAVBAR
   ============================================================ */
.cn-navbar {
  background: rgba(11, 14, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.cn-navbar .navbar-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.375rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cn-navbar .navbar-brand .brand-dot {
  color: var(--accent);
}

.cn-navbar .nav-link {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem !important;
  position: relative;
  transition: color var(--transition-fast);
}

.cn-navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-md);
}

.cn-navbar .nav-link:hover,
.cn-navbar .nav-link.active {
  color: var(--text-primary);
}

.cn-navbar .nav-link:hover::after,
.cn-navbar .nav-link.active::after {
  transform: scaleX(1);
}

.cn-search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  width: 200px;
  transition: all var(--transition-md);
}

.cn-search-input:focus {
  outline: none;
  border-color: var(--accent);
  width: 280px;
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.cn-search-wrap {
  position: relative;
}

.cn-search-wrap .bi-search {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

/* Avatar dropdown */
.cn-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.cn-avatar:hover {
  border-color: var(--accent-hover);
}

/* Bootstrap dropdown-toggle injects a ::after caret — hide it on the avatar circle */
.cn-avatar.dropdown-toggle::after {
  display: none;
}

/* Bootstrap dropdown-toggle adds a ::after caret — hide it on the avatar */
.cn-avatar.dropdown-toggle::after {
  display: none;
}

/* ============================================================
   4. NOTE CARDS
   ============================================================ */
.cn-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  position: relative;
  transition: transform var(--transition-md), box-shadow var(--transition-md),
              border-color var(--transition-md);
  overflow: hidden;
}

/* Colored left-edge "page pull" shadow */
.cn-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  transition: width var(--transition-md);
}

.cn-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.cn-card:hover::before {
  width: 6px;
}

/* Difficulty colors */
.cn-card-easy::before { background: var(--success); }
.cn-card-medium::before { background: var(--accent); }
.cn-card-hard::before { background: var(--danger); }

.cn-card__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.cn-card__title a {
  color: inherit;
  transition: color var(--transition-fast);
}
.cn-card__title a:hover {
  color: var(--accent);
}

.cn-card__preview {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cn-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cn-card__author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cn-card__author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.cn-card__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Note grid */
.cn-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ============================================================
   5. TAG PILLS
   ============================================================ */
.cn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.cn-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  background: var(--secondary-muted);
  color: var(--secondary);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.cn-tag:hover {
  background: var(--secondary);
  color: var(--bg-deep);
  border-color: var(--secondary);
}

.cn-tag-active {
  background: var(--accent);
  color: var(--bg-deep);
}

.cn-tag .cn-tag__remove {
  margin-left: 0.375rem;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.cn-tag .cn-tag__remove:hover {
  opacity: 1;
}

/* ============================================================
   6. LIKE / BOOKMARK BUTTONS
   ============================================================ */
.cn-like-btn,
.cn-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cn-like-btn:hover {
  color: var(--danger);
  background: rgba(196, 75, 75, 0.1);
}

.cn-like-btn-active {
  color: var(--danger);
}

.cn-like-btn-active .bi-heart {
  display: none;
}
.cn-like-btn-active .bi-heart-fill {
  display: inline;
}
.cn-like-btn:not(.cn-like-btn-active) .bi-heart-fill {
  display: none;
}

.cn-bookmark-btn:hover {
  color: var(--accent);
  background: var(--accent-muted);
}

.cn-bookmark-btn-active {
  color: var(--accent);
}

.cn-bookmark-btn-active .bi-bookmark {
  display: none;
}
.cn-bookmark-btn-active .bi-bookmark-fill {
  display: inline;
}
.cn-bookmark-btn:not(.cn-bookmark-btn-active) .bi-bookmark-fill {
  display: none;
}

/* ============================================================
   7. FORMS — Amber Bottom-Border Float Labels
   ============================================================ */
.cn-form-group {
  position: relative;
  margin-bottom: 1.75rem;
}

.cn-form-input {
  width: 100%;
  padding: 0.875rem 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition-md);
  outline: none;
}

.cn-form-input:focus {
  border-bottom-color: var(--accent);
}

.cn-form-label {
  position: absolute;
  left: 0;
  top: 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  pointer-events: none;
  transition: all var(--transition-md);
}

.cn-form-input:focus ~ .cn-form-label,
.cn-form-input:not(:placeholder-shown) ~ .cn-form-label {
  top: -0.75rem;
  font-size: 0.6875rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cn-form-error {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.375rem;
}

/* ============================================================
   8. BUTTONS
   ============================================================ */
.cn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.cn-btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
}
.cn-btn-primary:hover {
  background: var(--accent-hover);
  color: var(--bg-deep);
  box-shadow: 0 4px 16px rgba(232, 168, 56, 0.3);
}

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

.cn-btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(196, 75, 75, 0.3);
}
.cn-btn-danger:hover {
  background: var(--danger);
  color: white;
}

.cn-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}
.cn-btn-ghost:hover {
  color: var(--accent);
  background: var(--accent-muted);
}

.cn-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.cn-btn-lg {
  padding: 0.75rem 2rem;
  font-size: 0.875rem;
}

/* ============================================================
   9. CORNELL NOTE EDITOR
   ============================================================ */
.cn-editor {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cn-editor__header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.cn-editor__title-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  outline: none;
}

.cn-editor__title-input::placeholder {
  color: var(--text-tertiary);
}

.cn-editor__body {
  display: grid;
  grid-template-columns: 30% 1fr;
  min-height: 400px;
}

.cn-editor__cue,
.cn-editor__notes {
  position: relative;
  padding: 1.25rem;
}

/* Amber divider between columns */
.cn-editor__cue {
  border-right: 2px solid rgba(232, 168, 56, 0.15);
}

/* Ruled-paper lines */
.cn-editor__notes {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 31px,
    rgba(232, 168, 56, 0.06) 31px,
    rgba(232, 168, 56, 0.06) 32px
  );
  background-size: 100% 32px;
  background-position: 0 0;
}

.cn-editor__textarea {
  width: 100%;
  min-height: 300px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 32px; /* matches ruled lines */
  resize: vertical;
  outline: none;
}

.cn-editor__textarea::placeholder {
  color: var(--text-tertiary);
}

.cn-editor__cue .cn-editor__textarea {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--accent);
}

.cn-editor__summary {
  border-top: 2px solid rgba(232, 168, 56, 0.15);
  padding: 1.25rem;
}

.cn-editor__summary .cn-editor__textarea {
  min-height: 100px;
}

.cn-editor__section-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
  display: block;
}

.cn-editor__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cn-editor__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   10. DIFFICULTY SELECTOR
   ============================================================ */
.cn-difficulty {
  display: inline-flex;
  gap: 0.25rem;
}

.cn-difficulty__option {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  color: var(--text-secondary);
}

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

.cn-difficulty__option input[type="radio"] {
  display: none;
}

.cn-difficulty__option-easy.active,
.cn-difficulty__option-easy:has(input:checked) {
  background: var(--success);
  color: var(--bg-deep);
  border-color: var(--success);
}

.cn-difficulty__option-medium.active,
.cn-difficulty__option-medium:has(input:checked) {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}

.cn-difficulty__option-hard.active,
.cn-difficulty__option-hard:has(input:checked) {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* ============================================================
   11. FEED TABS
   ============================================================ */
.cn-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.cn-tab {
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

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

.cn-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================================
   12. STATS PANEL
   ============================================================ */
.cn-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  transition: border-color var(--transition-md);
}

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

.cn-stat__icon {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.cn-stat__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.cn-stat__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.cn-stat__trend {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  margin-top: 0.375rem;
}

.cn-stat-trend-up {
  color: var(--success);
}

.cn-stat-trend-down {
  color: var(--danger);
}

/* Stats grid */
.cn-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* ============================================================
   13. STUDY HEATMAP
   ============================================================ */
.cn-heatmap {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
}

.cn-heatmap__cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--bg-elevated);
  transition: background var(--transition-fast);
}

.cn-heatmap__cell.level-1 { background: rgba(232, 168, 56, 0.2); }
.cn-heatmap__cell.level-2 { background: rgba(232, 168, 56, 0.4); }
.cn-heatmap__cell.level-3 { background: rgba(232, 168, 56, 0.65); }
.cn-heatmap__cell.level-4 { background: var(--accent); }

.cn-heatmap__cell:hover {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* ============================================================
   14. DASHBOARD SECTIONS
   ============================================================ */
.cn-dashboard-greeting {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
}

.cn-dashboard-greeting strong {
  font-weight: 700;
}

.cn-dashboard-subtitle {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.cn-section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.cn-chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

/* Fire flicker for streak */
.cn-streak-fire {
  display: inline-block;
  animation: fireFlicker 1.5s ease-in-out infinite alternate;
}

/* Due for review panel */
.cn-due-panel {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.cn-due-panel::-webkit-scrollbar {
  width: 4px;
}
.cn-due-panel::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
.cn-due-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Review progress bar */
.cn-review-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.cn-review-progress-bar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s var(--ease-out);
  min-width: 0;
}

/* Rating grid — 6-column (3x2 on mobile) */
.cn-rating-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

/* Rating button — column layout with number + label */
.cn-rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cn-rating-btn__num {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.cn-rating-btn__label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  line-height: 1;
}

/* Fail: 0, 1, 2 — danger tint */
.cn-rating-btn--fail {
  border-color: rgba(196, 75, 75, 0.25);
}
.cn-rating-btn--fail:hover {
  border-color: var(--danger);
  background: rgba(196, 75, 75, 0.1);
}
.cn-rating-btn--fail:hover .cn-rating-btn__num { color: var(--danger); }
.cn-rating-btn--fail:hover .cn-rating-btn__label { color: var(--danger); }

/* Hard: 3 — amber/accent tint */
.cn-rating-btn--hard {
  border-color: rgba(232, 168, 56, 0.25);
}
.cn-rating-btn--hard:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.cn-rating-btn--hard:hover .cn-rating-btn__num { color: var(--accent); }
.cn-rating-btn--hard:hover .cn-rating-btn__label { color: var(--accent); }

/* Good: 4 — success tint */
.cn-rating-btn--good {
  border-color: rgba(76, 175, 130, 0.25);
}
.cn-rating-btn--good:hover {
  border-color: var(--success);
  background: rgba(76, 175, 130, 0.1);
}
.cn-rating-btn--good:hover .cn-rating-btn__num { color: var(--success); }
.cn-rating-btn--good:hover .cn-rating-btn__label { color: var(--success); }

/* Easy: 5 — success glow */
.cn-rating-btn--easy {
  border-color: rgba(76, 175, 130, 0.25);
}
.cn-rating-btn--easy:hover {
  border-color: var(--success);
  background: rgba(76, 175, 130, 0.15);
  box-shadow: 0 0 12px rgba(76, 175, 130, 0.2);
}
.cn-rating-btn--easy:hover .cn-rating-btn__num { color: var(--success); }
.cn-rating-btn--easy:hover .cn-rating-btn__label { color: var(--success); }

/* Review buttons (note detail page) */
.cn-review-btns {
  display: flex;
  gap: 0.375rem;
}

.cn-review-btns > .cn-review-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-direction: row;
  gap: 0;
}

.cn-review-btns > .cn-review-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* ============================================================
   14b. REVIEW MODE — State Machine Visual Layer
   ============================================================ */

/* Maskable content: blur transitions */
.cn-review-maskable {
  transition: filter 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}

.cn-detail.review-mode .cn-review-maskable {
  filter: blur(7px);
  opacity: 0.5;
  user-select: none;
  pointer-events: none;
}

.cn-detail.review-revealed .cn-review-maskable {
  filter: none;
  opacity: 1;
  user-select: auto;
  pointer-events: auto;
}

/* Reveal overlay — absolute over the Notes column */
.cn-review-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  background: rgba(11, 14, 17, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}

.cn-detail.review-mode .cn-review-overlay {
  opacity: 1;
  pointer-events: auto;
}

.cn-detail.review-revealed .cn-review-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Reveal Answer button */
.cn-review-reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
              transform 0.2s var(--ease-out);
  box-shadow: 0 4px 20px rgba(232, 168, 56, 0.35);
}

.cn-review-reveal-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 28px rgba(232, 168, 56, 0.5);
  transform: translateY(-2px);
}

/* Rating buttons — disabled/locked state */
.cn-review-btn--locked,
.cn-review-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Step progress indicator */
.cn-review-progress {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.cn-review-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  min-width: 90px;
}

.cn-review-progress__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.35s var(--ease-out), color 0.35s var(--ease-out),
              background 0.35s var(--ease-out);
}

.cn-review-progress__label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
  transition: color 0.35s var(--ease-out);
}

.cn-review-progress__step--active .cn-review-progress__num {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.cn-review-progress__step--active .cn-review-progress__label {
  color: var(--accent);
}

.cn-review-progress__connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 14px 0.5rem 0; /* 14px = half of 28px circle to align vertically */
  transition: background 0.35s var(--ease-out);
}

.cn-review-progress__connector--active {
  background: var(--accent);
}

/* Hint banner — shown in Step 1, hidden in Step 2 */
.cn-review-hint-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--accent-muted);
  border: 1px solid rgba(232, 168, 56, 0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.cn-review-hint-banner i {
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.cn-review-hint-banner strong {
  color: var(--text-primary);
}

/* Review result toast */
.cn-review-toast {
  position: fixed;
  bottom: 1.75rem;
  left: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(232, 168, 56, 0.25);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  z-index: 1050;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.cn-review-toast.cn-review-toast--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cn-review-toast__icon {
  color: var(--success);
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.cn-review-toast__nudge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}

/* ============================================================
   15. AUTH PAGES
   ============================================================ */
.cn-auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.cn-auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.cn-auth-card__title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cn-auth-card__subtitle {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Decorative quote */
.cn-auth-quote {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 3rem;
  color: rgba(232, 168, 56, 0.04);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  line-height: 1.3;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
}

.cn-auth-error {
  background: rgba(196, 75, 75, 0.1);
  border: 1px solid rgba(196, 75, 75, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

/* ============================================================
   16. SEARCH
   ============================================================ */
.cn-search-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.cn-search-hero__input {
  width: 100%;
  max-width: 600px;
  padding: 1rem 1.25rem 1rem 3rem;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.125rem;
  transition: all var(--transition-md);
  outline: none;
}

.cn-search-hero__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-muted);
}

.cn-search-hero__wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 600px;
}

.cn-search-hero__wrap .bi-search {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1rem;
}

/* Empty state */
.cn-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.cn-empty__icon {
  font-size: 3rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.cn-empty__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* ============================================================
   17. DETAIL PAGE — Read-Only Cornell View
   ============================================================ */
.cn-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cn-detail__header {
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cn-detail__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.cn-detail__meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cn-detail__body {
  display: grid;
  grid-template-columns: 30% 1fr;
  min-height: 300px;
}

.cn-detail__cue {
  padding: 1.5rem;
  border-right: 2px solid rgba(232, 168, 56, 0.15);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  line-height: 1.8;
}

.cn-detail__notes {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  line-height: 1.8;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 31px,
    rgba(232, 168, 56, 0.06) 31px,
    rgba(232, 168, 56, 0.06) 32px
  );
  background-size: 100% 32px;
}

.cn-detail__summary {
  padding: 1.5rem;
  border-top: 2px solid rgba(232, 168, 56, 0.15);
  background: rgba(232, 168, 56, 0.02);
}

.cn-detail__footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Difficulty badge */
.cn-badge {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cn-badge-easy {
  background: rgba(76, 175, 130, 0.15);
  color: var(--success);
}
.cn-badge-medium {
  background: var(--accent-muted);
  color: var(--accent);
}
.cn-badge-hard {
  background: rgba(196, 75, 75, 0.15);
  color: var(--danger);
}

/* ============================================================
   18. TOGGLE SWITCH
   ============================================================ */
.cn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cn-toggle input[type="checkbox"] {
  display: none;
}

.cn-toggle__track {
  width: 36px;
  height: 20px;
  background: var(--bg-elevated);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition-fast);
  border: 1px solid var(--border);
}

.cn-toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.cn-toggle input:checked ~ .cn-toggle__track {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.cn-toggle input:checked ~ .cn-toggle__track::after {
  left: 18px;
  background: var(--accent);
}

/* ============================================================
   19. BREADCRUMBS
   ============================================================ */
.cn-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 1.5rem;
}

.cn-breadcrumb a {
  color: var(--text-secondary);
}
.cn-breadcrumb a:hover {
  color: var(--accent);
}

.cn-breadcrumb__sep {
  color: var(--text-tertiary);
}

/* ============================================================
   20. SHIMMER / LOADING
   ============================================================ */
.cn-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    rgba(232, 168, 56, 0.08) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* HTMX indicator */
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--transition-md);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.cn-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================================
   21. COLLAPSIBLE SECTIONS
   ============================================================ */
.cn-collapsible__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.cn-collapsible__header:hover {
  color: var(--accent);
}

.cn-collapsible__header .bi {
  transition: transform var(--transition-md);
}

.cn-collapsible__header[aria-expanded="true"] .bi-chevron-right {
  transform: rotate(90deg);
}

/* ============================================================
   22. TAG INPUT COMPONENT
   ============================================================ */
.cn-tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px;
  cursor: text;
  transition: border-color var(--transition-md);
}

.cn-tag-input:focus-within {
  border-color: var(--accent);
}

.cn-tag-input__field {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  outline: none;
}

.cn-tag-input__field::placeholder {
  color: var(--text-tertiary);
}

/* ============================================================
   23. FOOTER
   ============================================================ */
.cn-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 4rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

/* ============================================================
   24. KEYFRAMES
   ============================================================ */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fireFlicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  25% { opacity: 0.85; transform: scale(1.05) rotate(-2deg); }
  50% { opacity: 1; transform: scale(0.98) rotate(1deg); }
  75% { opacity: 0.9; transform: scale(1.03) rotate(-1deg); }
}

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 168, 56, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(232, 168, 56, 0); }
}

/* ============================================================
   25. REVEAL ANIMATION SYSTEM
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children helper */
.stagger-children > .reveal:nth-child(1) { --reveal-delay: 0s; }
.stagger-children > .reveal:nth-child(2) { --reveal-delay: 0.08s; }
.stagger-children > .reveal:nth-child(3) { --reveal-delay: 0.16s; }
.stagger-children > .reveal:nth-child(4) { --reveal-delay: 0.24s; }
.stagger-children > .reveal:nth-child(5) { --reveal-delay: 0.32s; }
.stagger-children > .reveal:nth-child(6) { --reveal-delay: 0.4s; }
.stagger-children > .reveal:nth-child(7) { --reveal-delay: 0.48s; }
.stagger-children > .reveal:nth-child(8) { --reveal-delay: 0.56s; }

/* ============================================================
   26. BOOTSTRAP DARK OVERRIDES
   ============================================================ */
.dropdown-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--accent-muted);
  color: var(--accent);
}

.dropdown-divider {
  border-color: var(--border);
}

/* Bootstrap collapse transitions */
.collapse:not(.show) {
  display: none;
}

.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease;
}

/* Alert overrides */
.alert {
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Tooltip */
[data-bs-toggle="tooltip"] {
  cursor: help;
}

/* ============================================================
   27. UTILITY CLASSES
   ============================================================ */
.text-accent { color: var(--accent) !important; }
.text-secondary-custom { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.bg-surface { background: var(--bg-surface) !important; }
.bg-elevated { background: var(--bg-elevated) !important; }
.border-accent { border-color: var(--accent) !important; }
.font-display { font-family: var(--font-display) !important; }
.font-mono { font-family: var(--font-mono) !important; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

/* ============================================================
   28. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .cn-notes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cn-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .cn-notes-grid {
    grid-template-columns: 1fr;
  }

  .cn-editor__body {
    grid-template-columns: 1fr;
  }

  .cn-editor__cue {
    border-right: none;
    border-bottom: 2px solid rgba(232, 168, 56, 0.15);
  }

  .cn-detail__body {
    grid-template-columns: 1fr;
  }

  .cn-detail__cue {
    border-right: none;
    border-bottom: 2px solid rgba(232, 168, 56, 0.15);
  }

  .cn-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cn-heatmap {
    grid-template-columns: repeat(26, 1fr);
  }

  .cn-search-input:focus {
    width: 200px;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .cn-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cn-auth-card {
    padding: 1.5rem;
  }

  .cn-editor__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .cn-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .cn-rating-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================
   29. PROFILE PAGE
   ============================================================ */
.cn-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  padding: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.cn-profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cn-profile-avatar__initials {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.cn-profile-info {
  flex: 1;
  min-width: 0;
}

.cn-profile-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0;
  line-height: 1.2;
}

.cn-profile-username {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.75rem;
}

.cn-profile-bio {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  max-width: 480px;
}

.cn-profile-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.cn-profile-meta strong {
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.cn-profile-meta__sep {
  color: var(--text-tertiary);
}

.cn-profile-actions {
  margin-top: 0.25rem;
}

.cn-profile-hint {
  background: var(--accent-muted);
  border: 1px solid rgba(232, 168, 56, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .cn-profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .cn-profile-meta {
    justify-content: center;
  }

  .cn-profile-bio {
    max-width: 100%;
  }
}

/* ── Follow List Modal ──────────────────────────────────── */
.cn-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.cn-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.cn-modal__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.cn-modal__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--transition-fast);
}

.cn-modal__close:hover {
  color: var(--text-primary);
}

.cn-modal__body {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.cn-modal__body::-webkit-scrollbar {
  width: 4px;
}
.cn-modal__body::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
.cn-modal__body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.cn-follow-list__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  transition: background var(--transition-fast);
}

.cn-follow-list__row:hover {
  background: var(--bg-elevated);
}

.cn-follow-list__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
}

.cn-follow-list__initials {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.cn-follow-list__info {
  flex: 1;
  min-width: 0;
}

.cn-follow-list__name {
  display: block;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.cn-follow-list__name:hover {
  color: var(--accent);
}

.cn-follow-list__username {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.cn-follow-list__action {
  flex-shrink: 0;
}

.cn-profile-follow-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.cn-profile-follow-link:hover {
  color: var(--accent);
}

.cn-profile-follow-link strong {
  color: inherit;
}

/* ============================================================
   30. FEED — Magazine Layout
   ============================================================ */

/* --- Editorial Header / Masthead --- */
.cn-feed-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
}

.cn-feed-header__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.cn-feed-header__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.125rem;
  line-height: 1.15;
}

.cn-feed-header__sub {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* --- Feed Grid (2-column) --- */
.cn-feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.cn-feed-sentinel {
  width: 100%;
}

.cn-feed-load-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(196, 75, 75, 0.35);
  border-radius: var(--radius-md);
  background: rgba(196, 75, 75, 0.12);
  color: #f0c5c5;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Hero wrapper — full width, single card */
.cn-feed-hero-wrap {
  margin-bottom: 1.5rem;
}

/* --- Feed Card (base) --- */
.cn-feed-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: transform var(--transition-md), box-shadow var(--transition-md),
              border-color var(--transition-md);
}

.cn-feed-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

/* --- Hero Variant --- */
.cn-feed-card-hero {
  background: linear-gradient(
    135deg,
    var(--bg-surface) 0%,
    rgba(232, 168, 56, 0.06) 100%
  );
  padding: 1.75rem;
  border-color: var(--border-hover);
}

.cn-feed-card-hero .cn-feed-card__title {
  font-size: 1.5rem;
}

.cn-feed-card-hero .cn-feed-card__avatar {
  width: 40px;
  height: 40px;
}

.cn-feed-card-hero .cn-feed-card__preview {
  -webkit-line-clamp: 4;
}

/* --- Author Row --- */
.cn-feed-card__author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cn-feed-card__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cn-feed-card__name {
  color: var(--text-primary);
  font-weight: 500;
}

.cn-feed-card__time {
  color: var(--text-tertiary);
}

.cn-feed-card__time::before {
  content: '\00b7\00a0';
}

/* --- Title --- */
.cn-feed-card__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.cn-feed-card__title a {
  color: inherit;
  transition: color var(--transition-fast);
}

.cn-feed-card__title a:hover {
  color: var(--accent);
}

/* --- Preview --- */
.cn-feed-card__preview {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Social Bar --- */
.cn-feed-card__social {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.375rem;
}

.cn-feed-card__social-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cn-feed-card__difficulty {
  flex-shrink: 0;
}

/* --- Feed Responsive --- */
@media (max-width: 768px) {
  .cn-feed-grid {
    grid-template-columns: 1fr;
  }

  .cn-feed-header__title {
    font-size: 2rem;
  }

  .cn-feed-card-hero .cn-feed-card__title {
    font-size: 1.25rem;
  }
}

/* ============================================================
   AI RESULTS PANEL
   ============================================================ */
.cn-ai-panel {
  margin: 1rem 1.5rem 1.5rem;
  border: 1px solid var(--accent-muted);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}

.cn-ai-panel--error {
  border-left-color: var(--danger);
}

.cn-ai-panel--error .cn-ai-panel__header {
  color: var(--danger);
}

.cn-ai-panel__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--accent-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.cn-ai-section {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.cn-ai-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cn-ai-section__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.cn-ai-section__content {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-line;
}

.cn-ai-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cn-ai-apply-btn:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.cn-ai-apply-btn.applied {
  color: var(--success);
  border-color: var(--success);
}

.cn-btn-accent {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  font-weight: 600;
}

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

/* ============================================================
   FLASHCARD FLIP CARD
   ============================================================ */
.cn-flashcard-flip--flipped .cn-flashcard-flip__inner {
  transform: rotateY(180deg);
}

/* ============================================================
   STUDY GUIDE
   ============================================================ */
.cn-study-guide__content {
  font-family: var(--font-body);
  line-height: 1.8;
  color: var(--text-primary);
}
.cn-study-guide__content h1,
.cn-study-guide__content h2,
.cn-study-guide__content h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.cn-study-guide__content ul,
.cn-study-guide__content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.cn-study-guide__sidebar {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
}

/* ============================================================
   SELECT MODE (my-notes)
   ============================================================ */
.cn-select-checkbox {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent);
  cursor: pointer;
  display: none;
}
.cn-select-mode .cn-select-checkbox {
  display: block;
}
.cn-select-mode .cn-card {
  cursor: pointer;
}
.cn-select-mode .cn-card.cn-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

/* ============================================================
   ATTACHMENTS
   ============================================================ */
.cn-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cn-attachment-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cn-attachment-row:hover {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent-muted);
}
.cn-attachment-row__icon {
  font-size: 1.35rem;
  color: var(--accent);
  flex-shrink: 0;
}
.cn-attachment-row__info {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.cn-attachment-row__name {
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}
.cn-attachment-row__name:hover {
  color: var(--accent);
}
.cn-attachment-row__size {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Delete button */
.cn-attachment-delete-form {
  margin-left: auto;
  flex-shrink: 0;
}
.cn-attachment-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.cn-attachment-delete:hover {
  color: var(--danger);
  background: rgba(196, 75, 75, 0.12);
}

/* Upload drop zone */
.cn-upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.cn-upload-zone:hover,
.cn-upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.cn-upload-zone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.cn-upload-zone__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  font-family: var(--font-mono);
}
.cn-upload-zone__icon {
  font-size: 1.75rem;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}
.cn-upload-zone__text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.cn-upload-zone__hint {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}
.cn-upload-zone__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
}
.cn-upload-zone__preview i {
  font-size: 1.25rem;
  color: var(--accent);
}
