/* CSS Variables - Dark Theme (default) */
:root {
  --bg: #0E0E16;
  --bg-secondary: #161623;
  --bg-tertiary: #1F1F30;
  --surface: #1F1F30;
  --surface-hover: #282845;
  --text: #E6E6F2;
  --text-secondary: #A8A8C0;
  --text-tertiary: #6C6C88;
  --text-muted: #4a4a60;
  --primary: #5D63FF;
  --primary-dark: #4C52D9;
  --primary-hover: #7479FF;
  --primary-muted: var(--primary-15);
  --success: #3DD68C;
  --warning: #FFC96B;
  --danger: #FF6B6B;
  --highlight: #FFC96B;
  --highlight-text: #FFD98A;
  --border: #2A2A42;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Primary opacity scale */
  --primary-8: var(--primary-8);
  --primary-10: var(--primary-10);
  --primary-12: var(--primary-12);
  --primary-15: var(--primary-15);
  --primary-20: var(--primary-20);
  --primary-30: var(--primary-30);
  --primary-40: var(--primary-40);
  --primary-50: var(--primary-50);
}

/* Light Theme */
[data-theme="light"] {
  --bg: #F6F6FB;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EDEDF5;
  --surface: #EDEDF5;
  --surface-hover: #E0E0EE;
  --text: #141424;
  --text-secondary: #5E5E78;
  --text-tertiary: #9090A8;
  --text-muted: #A8A8B8;
  --primary: #4C52D9;
  --primary-dark: #3C42B8;
  --primary-hover: #5D63FF;
  --primary-muted: rgba(76, 82, 217, 0.1);
  --success: #1DA563;
  --warning: #D4920A;
  --danger: #DC4444;
  --highlight: #D4920A;
  --highlight-text: #A87308;
  --border: #DDDDE8;
}

/* Light theme element overrides */
[data-theme="light"] .stat-card-main {
  background: rgba(76, 82, 217, 0.08);
  border-color: rgba(76, 82, 217, 0.2);
}

[data-theme="light"] .stat-card-progress {
  background: rgba(76, 82, 217, 0.15);
}

[data-theme="light"] .list-item-highlight {
  background: rgba(212, 146, 10, 0.12);
}

[data-theme="light"] .highlight-preview {
  background: rgba(212, 146, 10, 0.1);
}

[data-theme="light"] .deck-item {
  background: var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .deck-item:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .modal-content {
  background: #FFFFFF;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 40px var(--primary-8), 0 -1px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card-side {
  background: var(--bg-secondary);
}

[data-theme="light"] .card-context {
  background: var(--bg-tertiary);
}

[data-theme="light"] .tab-bar {
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .tag-filter-toggle {
  background: #f8f9fa;
}

[data-theme="light"] .tag-filter-content {
  background: #f8f9fa;
}

[data-theme="light"] .tag-filter-item {
  background: var(--bg-tertiary);
}

[data-theme="light"] .tag-filter-item.selected {
  background: var(--primary);
  color: white;
}

[data-theme="light"] .tag-filter-item.selected .tag-name {
  color: white;
}

[data-theme="light"] .tag-filter-item.selected .tag-count {
  color: rgba(255, 255, 255, 0.7);
}

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

/* Base */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Typography Scale */
h1, .h1 {
  font-size: 1.875rem; /* 30px */
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2, .h2 {
  font-size: 1.3125rem; /* 21px */
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3, .h3 {
  font-size: 1rem; /* 16px */
  font-weight: 500;
  line-height: 1.45;
}

.text-body {
  font-size: 0.9375rem; /* 15px */
  font-weight: 400;
  line-height: 1.5;
}

.text-small {
  font-size: 0.8125rem; /* 13px */
  font-weight: 500;
}

.text-tag {
  font-size: 0.75rem; /* 12px */
  font-weight: 600;
}

/* Utilities */
.hidden { display: none !important; }
.subtle { color: var(--text-secondary); }
.error { color: var(--danger); font-size: 0.875rem; }
.loading { color: var(--text-secondary); font-size: 0.875rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

/* Loading overlay for cards/sections */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.loading-overlay .spinner {
  margin-bottom: 4px;
}

/* Button with inline spinner */
.btn .spinner,
button .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Screen / Views */
.screen, .fullscreen-view {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
}

.screen.active { display: flex; }

.fullscreen-view {
  background: var(--bg);
  z-index: 150;
  display: flex;
  flex-direction: column;
}

.fullscreen-view.hidden {
  display: none;
}

/* Lock Screen */
#lock-screen {
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-secondary) 100%);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.lock-container {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.lock-container h1 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}

.lock-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lock-form p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Buttons */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-30);
}

.btn.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(93, 99, 255, 0.45);
}

.btn.primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
  box-shadow: 0 1px 4px var(--primary-30);
}

.btn.secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary-50);
}

.btn.secondary:hover {
  background: var(--primary-8);
  border-color: rgba(93, 99, 255, 0.7);
}

.btn.secondary:active {
  background: var(--primary-12);
  transform: scale(0.98);
}

.btn.tertiary {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 10px 16px;
}

.btn.tertiary:hover {
  color: var(--primary);
  background: var(--primary-8);
}

.btn.full-width {
  width: 100%;
}

.btn.large {
  padding: 18px 32px;
  font-size: 1.125rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1.5rem;
  padding: 8px;
  cursor: pointer;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text);
  font-size: 1rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  min-height: 300px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239090a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: calc(64px + var(--safe-bottom));
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
  position: relative;
  min-height: 48px; /* Minimum touch target */
  padding: 8px 0;
}

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
  transition: width 0.2s ease;
}

.tab-btn.active::before {
  width: 32px;
}

.tab-btn:active {
  background-color: var(--primary-8);
}

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

.tab-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.tab-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Tab Content */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg);
  z-index: 10;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.header-tagline {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin: 0 20px 10px;
  line-height: 1.4;
}

/* Search */
.search-container {
  padding: 0 20px;
  margin-bottom: 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.875rem;
  opacity: 0.6;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 70px 10px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9375rem;
  color: var(--text);
  transition: all 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--background);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-shortcut {
  position: absolute;
  right: 36px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input:focus + .search-shortcut {
  display: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--surface);
  color: var(--text);
}

/* Search Input Row with Filter Button */
.search-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input-row .search-input-wrapper {
  flex: 1;
}

.filter-icon-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.filter-icon-btn:hover {
  border-color: var(--primary);
  background: var(--bg-secondary);
}

.filter-icon-btn.active {
  background: var(--primary-15);
  border-color: var(--primary);
}

.filter-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-badge.hidden {
  display: none;
}

/* Quick Filters */
.quick-filters {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-filters::-webkit-scrollbar {
  display: none;
}

.quick-filter {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.quick-filter:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.quick-filter:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.quick-filter.active {
  background: var(--primary-15);
  border-color: var(--primary);
  color: var(--primary);
}

/* Advanced Filter Popover */
.filter-popover {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 200;
  padding: 16px;
}

.filter-popover.hidden {
  display: none;
}

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

.filter-popover-header h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.filter-section {
  margin-bottom: 16px;
}

.filter-section:last-of-type {
  margin-bottom: 20px;
}

.filter-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.filter-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}

.filter-checkbox input[type="checkbox"],
.filter-checkbox input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Make search-container relative for popover positioning */
.search-container {
  position: relative;
}

/* Search Results */
.search-results {
  padding: 0 20px;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

#search-results-count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-bottom: 20px;
}

.search-result-item {
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-result-item:hover {
  background: var(--surface-hover);
}

.search-result-item:active {
  transform: scale(0.99);
}

.search-result-type {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.search-result-icon {
  font-size: 0.75rem;
}

.has-card-badge {
  background: rgba(61, 214, 140, 0.2);
  color: var(--success);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.625rem;
  margin-left: auto;
}

.search-result-title {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
}

.search-result-title mark {
  background: var(--primary-30);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.search-result-content {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.search-result-content mark {
  background: var(--primary-20);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.search-result-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
}

.search-result-source {
  color: var(--text-muted);
}

.search-result-tags {
  color: var(--primary);
}

.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.search-empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.search-empty p:first-of-type {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.search-empty .subtle {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

[data-theme="light"] .search-input {
  background: #fff;
}

[data-theme="light"] .search-result-item {
  background: #fff;
}

[data-theme="light"] .search-result-item:hover {
  background: #f8f9fa;
}

/* Getting Started Card */
.getting-started-card {
  position: relative;
  margin: 0 20px 16px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.getting-started-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.getting-started-card ol {
  margin: 0;
  padding-left: 20px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.getting-started-card li {
  margin-bottom: 6px;
}

.getting-started-card li:last-child {
  margin-bottom: 0;
}

.getting-started-card strong {
  color: var(--text);
}

.dismiss-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dismiss-btn:hover {
  background: var(--bg-tertiary);
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 12px;
  padding: 0 20px 16px;
}

.stat-box {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
}

.stat-box.orange { background: rgba(255, 201, 107, 0.15); }
.stat-box.green { background: rgba(61, 214, 140, 0.15); }
.stat-box.blue { background: var(--primary-15); }

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-box.orange .stat-value { color: var(--warning); }
.stat-box.green .stat-value { color: var(--success); }
.stat-box.blue .stat-value { color: var(--primary); }

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

/* Stats Cards */
.stats-cards {
  display: flex;
  gap: 10px;
  padding: 0 20px 12px;
  align-items: stretch;
}

.stat-card {
  flex: 1;
  padding: 16px 12px 14px;
  background: #1e1e35;
  border-radius: var(--radius);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.stat-card-main {
  flex: 1.5;
  padding: 20px 16px 16px;
  background: var(--primary-12);
  border: 1px solid var(--primary-30);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-card-main .stat-card-value {
  font-size: 2.25rem;
  color: var(--primary);
}

.stat-card-goal {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.stat-card-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 8px;
  font-weight: 600;
}

.stat-card-main .stat-card-label {
  color: var(--primary);
  opacity: 0.7;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-card-sublabel {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

.stat-card-sublabel.positive {
  color: var(--success);
}

.stat-card-sublabel.negative {
  color: var(--danger);
}

.stat-card-progress {
  width: 100%;
  height: 4px;
  background: var(--primary-20);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.stat-card-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.stat-card-progress-fill.complete {
  background: var(--success);
}

/* Weekly Chart */
/* Insights Section */
.insights-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-group {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
}

.insight-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.insight-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--background);
  border-radius: 16px;
  font-size: 0.8125rem;
  color: var(--text);
}

.insight-chip.topic {
  color: var(--primary);
}

.insight-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 8px;
}

/* Week graph */
.week-graph {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding-top: 4px;
}

.week-graph-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.week-graph-bar {
  width: 100%;
  min-height: 2px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}

.week-graph-label {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.week-graph-count {
  font-size: 0.625rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Retention bar */
.retention-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.retention-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.retention-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.retention-pct {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 40px;
}

.retention-breakdown {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.retention-breakdown span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.retention-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.retention-dot.again { background: var(--danger); }
.retention-dot.hard { background: var(--warning); }
.retention-dot.good { background: var(--success); }
.retention-dot.easy { background: var(--primary); }

/* Strength list */
.strength-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strength-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.strength-tag {
  flex: 1;
  color: var(--text);
}

.strength-bar {
  width: 60px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.strength-bar-fill.strong { background: var(--success); }
.strength-bar-fill.medium { background: var(--warning); }
.strength-bar-fill.weak { background: var(--danger); }

.strength-pct {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

/* Command Palette */
.command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.command-palette-content {
  width: 90%;
  max-width: 480px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.command-input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  outline: none;
  box-sizing: border-box;
}

.command-input::placeholder {
  color: var(--text-muted);
}

.command-results {
  max-height: 320px;
  overflow-y: auto;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.1s;
}

.command-item:hover,
.command-item.active {
  background: var(--bg-tertiary);
}

.command-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
}

.command-label {
  font-size: 0.875rem;
  color: var(--text);
}

.command-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Session Summary */
.session-summary {
  text-align: center;
}

.session-summary-main {
  font-size: 1.125rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.session-summary-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: 20px;
}

.summary-stat.positive {
  color: var(--success);
}

.summary-stat.neutral {
  color: var(--text-secondary);
}

.summary-stat.needs-work {
  color: var(--warning);
}

.summary-icon {
  font-size: 1rem;
}

[data-theme="light"] .insight-group {
  background: #f8f9fa;
}

[data-theme="light"] .insight-chip {
  background: #fff;
}

[data-theme="light"] .chart-bar {
  background: #e9ecef;
}

[data-theme="light"] .summary-stat {
  background: #f8f9fa;
}

/* Review Buttons */
.review-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px;
  margin-bottom: 12px;
}

/* Session Size Chips */
.session-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.session-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 64px;
}

.session-chip:hover {
  border-color: var(--primary-40);
  box-shadow: 0 0 8px var(--primary-15);
}

.session-chip.active {
  background: var(--primary);
  border-color: var(--primary);
}

.session-chip .chip-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.session-chip.active .chip-count {
  color: white;
}

.session-chip .chip-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.session-chip.active .chip-label {
  color: rgba(255, 255, 255, 0.8);
}

.session-chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Review Button Row */
.review-btn-row {
  display: flex;
  gap: 12px;
}

.review-main-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 24px;
  background: var(--primary);
  border: none;
  border-radius: 28px;
  cursor: pointer;
  box-shadow:
    0 4px 12px var(--primary-40),
    0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease;
}

.review-main-btn:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow:
    0 6px 16px var(--primary-50),
    0 3px 6px rgba(0, 0, 0, 0.25);
}

.review-main-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  transform: translateY(-1px) scale(1.015);
  box-shadow:
    0 6px 16px var(--primary-50),
    0 3px 6px rgba(0, 0, 0, 0.25);
}

.review-main-btn:active {
  transform: translateY(0);
  box-shadow:
    0 2px 8px var(--primary-30),
    0 1px 2px rgba(0, 0, 0, 0.15);
}

.review-main-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.review-main-btn-text {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.review-main-btn-caption {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
}

.review-main-btn-time {
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.focus-btn {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  font-size: 1.25rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Goal Complete Banner */
.goal-complete-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(61, 214, 140, 0.15), var(--primary-10));
  border: 1px solid rgba(61, 214, 140, 0.3);
  border-radius: var(--radius);
  animation: goalCelebrate 0.5s ease;
}

.goal-complete-banner.hidden {
  display: none;
}

@keyframes goalCelebrate {
  0% { transform: scale(0.95); opacity: 0; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

.goal-complete-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goal-complete-emoji {
  font-size: 1.5rem;
}

.goal-complete-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-complete-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--success);
}

.goal-complete-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tag Filter */
.tag-filter-section {
  padding: 0 20px;
  margin-bottom: 16px;
  position: relative;
  z-index: 5;
}

.tag-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.tag-filter-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.tag-filter-toggle.expanded {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.tag-filter-toggle span:first-child {
  font-weight: 600;
  color: var(--primary);
}

.tag-filter-toggle span:nth-child(2) {
  flex: 1;
  text-align: left;
}

.tag-filter-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.tag-filter-count.hidden {
  display: none;
}

.tag-filter-arrow {
  font-size: 0.625rem;
  transition: transform 0.2s ease;
}

.tag-filter-toggle.expanded .tag-filter-arrow {
  transform: rotate(180deg);
}

.tag-filter-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.tag-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-filter-empty {
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
  padding: 8px;
}

.tag-filter-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-detail-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-tertiary);
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.tag-detail-btn:hover {
  color: var(--primary);
}

/* Tag Detail Modal */
.tag-detail-cards {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 50vh;
  overflow-y: auto;
}

.tag-detail-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 32px 0;
  font-size: 0.875rem;
}

.tag-detail-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  transition: background 0.15s;
}

.tag-detail-card:hover {
  background: var(--surface-hover);
}

.tag-detail-card-content {
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.tag-detail-card-front {
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-detail-card-deck {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.tag-detail-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-tertiary);
  border-radius: 8px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.tag-detail-remove-btn:hover {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}

.tag-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.tag-filter-item:hover {
  border-color: var(--primary-40);
  box-shadow: 0 0 8px var(--primary-15);
}

.tag-filter-item.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.tag-filter-item.selected .tag-name {
  color: white;
}

.tag-filter-item.selected .tag-count {
  color: rgba(255, 255, 255, 0.7);
}

.tag-filter-item input[type="checkbox"] {
  display: none;
}

.tag-filter-item .tag-name {
  color: var(--text);
}

.tag-filter-item .tag-count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tag-filter-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.tag-filter-actions .btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 4px 8px;
}

.tag-filter-actions .btn-text:hover {
  color: var(--primary);
}

/* Sections */
.section {
  padding: 16px 20px;
}

.section h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p:first-of-type {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state .subtle {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  padding: 0 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Sort Select */
.sort-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Deck List */
#decks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.deck-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  padding-right: 12px;
  background: #1e1e35;
  border-radius: var(--radius);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.15s, transform 0.15s;
}

.deck-item:hover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.deck-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.15);
}

.deck-item:active {
  transform: scale(0.995);
}

.deck-item-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.deck-action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.deck-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.deck-action-btn:active {
  background: var(--border);
}

.deck-review-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.875rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.deck-review-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px var(--primary-40);
}

.deck-review-btn:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

/* Tooltip styling for desktop */
[title] {
  position: relative;
}

@media (hover: hover) {
  .deck-pin-btn[title]:hover::after,
  .deck-review-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-tertiary);
    color: var(--text);
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0;
    white-space: nowrap;
    border-radius: 6px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
  }
}

.deck-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.deck-item.has-due {
  border-left: 3px solid var(--warning);
}

.deck-item.has-due .deck-color {
  box-shadow: 0 0 0 2px rgba(255, 201, 107, 0.2);
}

.deck-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.deck-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.deck-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.3;
}

.deck-meta-due {
  color: var(--warning);
  font-weight: 600;
}

.deck-meta-new {
  color: var(--primary);
  font-weight: 500;
}

.deck-source-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 1px;
}

.deck-source {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Deck Icon with Source Type */
.deck-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.deck-source-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.deck-icon-wrap .deck-color {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* Deck Name Row with Pin */
.deck-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-pin-icon {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Deck Progress Bar */
.deck-progress {
  width: 100%;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.deck-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s ease;
  opacity: 0.7;
}

/* Deck Pin Button */
.deck-pin-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.875rem;
  opacity: 0.4;
  transition: all 0.15s ease;
}

.deck-pin-btn:hover {
  opacity: 0.8;
  background: var(--bg-tertiary);
}

.deck-pin-btn.active {
  opacity: 1;
}

/* Pinned Deck Highlight */
.deck-item.pinned {
  background: var(--primary-8);
  border-left: 3px solid var(--primary);
}

.deck-item.pinned.has-due {
  border-left: 3px solid var(--primary);
}

/* Source Group (for "By source" sorting) */
.deck-source-group {
  margin-bottom: 8px;
}

.deck-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.deck-source-header:hover {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.deck-source-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.deck-source-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
}

.deck-source-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.deck-source-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deck-source-group.collapsed .deck-source-items {
  display: none;
}

.deck-source-group.collapsed .deck-source-header {
  opacity: 0.7;
}

/* Segment Control */
.segment-control {
  display: flex;
  margin: 0 20px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 4px;
}

.segment {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.segment.active {
  background: var(--primary);
  color: white;
}

/* List Items */
.list-container {
  padding: 0 20px;
}

.list-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.list-item-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.list-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.list-item-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(253, 224, 71, 0.15);
  color: var(--highlight-text);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Library Layout - two-column on desktop */
.library-layout {
  display: flex;
  flex-direction: column;
}

.library-col-left,
.library-col-right {
  min-width: 0;
}

@media (min-width: 768px) {
  .library-layout {
    flex-direction: row;
    gap: 24px;
    padding: 0 20px;
  }

  .library-col-left {
    flex: 0 0 320px;
  }

  .library-col-right {
    flex: 1;
  }

  /* Remove inner horizontal padding on desktop since layout has padding */
  .library-layout .import-dashboard,
  .library-layout .tags-grid,
  .library-layout .tags-empty-card,
  .library-layout .library-decks-list,
  .library-layout .library-empty,
  .library-layout .bulk-toolbar {
    padding-left: 0;
    padding-right: 0;
  }

  .library-layout .library-group-header {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Library Groups */
.library-group {
  margin-bottom: 28px;
}

.library-group-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Import Dashboard */
.import-dashboard {
  padding: 0 20px;
}

.add-source-btn {
  margin-top: 12px;
}

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

.import-dashboard-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.btn-small.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 4px var(--primary-30);
}

.import-sources-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.import-source-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.import-source-card:hover {
  background: var(--bg-tertiary);
}

.import-source-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.import-source-info {
  flex: 1;
  min-width: 0;
}

.import-source-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.import-source-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.import-source-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.error {
  background: var(--danger);
}

.status-dot.warning {
  background: var(--warning);
}

.status-dot.inactive {
  background: var(--text-tertiary);
}

.import-source-arrow {
  color: var(--text-tertiary);
  font-size: 1rem;
}

.import-empty {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-secondary);
}

/* Library Decks List */
.library-decks-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-deck-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-deck-item:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.library-deck-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.library-deck-item:active {
  transform: scale(0.99);
}

.library-deck-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border-radius: 8px;
  flex-shrink: 0;
}

.library-deck-info {
  flex: 1;
  min-width: 0;
}

.library-deck-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-deck-meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.library-deck-type {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.3px;
}

.library-deck-due {
  color: var(--warning);
  font-weight: 500;
}

.library-deck-arrow {
  color: var(--text-tertiary);
  font-size: 1.25rem;
  font-weight: 300;
}

.library-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}

.library-empty-icon {
  font-size: 1.75rem;
  margin-bottom: 10px;
  opacity: 0.4;
}

.library-empty p {
  font-size: 0.8125rem;
}

[data-theme="light"] .library-deck-item {
  background: #fff;
}

[data-theme="light"] .library-deck-item:hover {
  background: #f8f9fa;
}

[data-theme="light"] .library-deck-icon {
  background: #f8f9fa;
}

/* Library Group Header with Bulk Select */
.library-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 12px;
}

.library-group-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.library-group-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.btn-text.small {
  font-size: 0.8125rem;
  padding: 6px 12px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.btn-text.small:hover {
  background: var(--primary-10);
  border-radius: 6px;
}

.btn-text.small.active {
  background: var(--primary-15);
  border-radius: 6px;
}

/* Bulk Selection Toolbar */
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-left: 20px;
  margin-right: 20px;
}

.bulk-toolbar.hidden {
  display: none;
}

.bulk-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.bulk-select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

#bulk-selected-count {
  color: var(--text-secondary);
}

.bulk-toolbar-actions {
  display: flex;
  gap: 8px;
}

.bulk-action-btn {
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.bulk-action-btn:hover {
  background: var(--primary);
  color: white;
}

.bulk-action-btn.danger:hover {
  background: var(--danger);
}

/* Library Deck Item with Bulk Selection */
.library-deck-item.bulk-mode {
  padding-left: 8px;
}

.library-deck-item.selected {
  background: var(--primary-10);
  border: 1px solid var(--primary);
}

.bulk-checkbox {
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.bulk-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Deck Menu Button */
.deck-menu-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.deck-menu-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

/* Action Sheet Modal (Bottom Sheet style) */
.modal-bottom .modal-content {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  border-radius: var(--radius) var(--radius) 0 0;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-action-sheet {
  padding: 0;
}

.action-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.action-sheet-title {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.action-sheet-options {
  padding: 8px 0;
}

.action-sheet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  font-size: 0.9375rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.action-sheet-option:hover {
  background: var(--bg-tertiary);
}

.action-sheet-option.danger {
  color: var(--danger);
}

.action-option-icon {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

/* Merge Preview */
.merge-preview {
  margin: 16px 0;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.merge-preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.merge-preview-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.875rem;
}

.merge-preview-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
}

.merge-label {
  color: var(--text-secondary);
  min-width: 60px;
  flex-shrink: 0;
}

/* Source Type Options */
.source-type-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.source-type-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.source-type-option:hover {
  background: var(--border);
}

.source-type-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.source-type-option input:checked + .source-type-icon + span {
  color: var(--primary);
  font-weight: 500;
}

.source-type-icon {
  font-size: 1.25rem;
}

[data-theme="light"] .bulk-toolbar {
  background: #f0f2f5;
}

[data-theme="light"] .library-deck-item.selected {
  background: rgba(76, 82, 217, 0.08);
}

[data-theme="light"] .source-type-option {
  background: #f0f2f5;
}

[data-theme="light"] .source-type-option:hover {
  background: #e4e7eb;
}

.import-empty p {
  margin-bottom: 8px;
}

.import-empty .subtle {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* Enhanced Source Cards */
.source-card {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.15s;
}

.source-card:hover {
  background: var(--bg-tertiary);
}

.source-card-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  min-width: 0;
}

.source-card-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
  flex-shrink: 0;
}

.source-card-info {
  flex: 1;
  min-width: 0;
}

.source-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.source-card-stats {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.source-card-sync {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.source-card-actions {
  display: flex;
  gap: 4px;
  padding-right: 12px;
}

.source-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.source-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.source-action-btn:active {
  transform: scale(0.95);
}

/* Source Detail Modal */
.source-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.source-detail-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.source-detail-header-text h2 {
  margin: 0;
  font-size: 1.125rem;
}

.source-detail-stats {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.source-detail-decks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
}

.source-detail-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
}

.source-deck-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.source-deck-item:hover {
  background: var(--border);
}

.source-deck-item:active {
  transform: scale(0.99);
}

.source-deck-color {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

.source-deck-info {
  flex: 1;
  min-width: 0;
}

.source-deck-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.source-deck-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.source-deck-due {
  color: var(--warning);
  font-weight: 500;
}

.source-deck-progress {
  flex-shrink: 0;
  width: 60px;
}

.source-deck-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.source-deck-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.source-deck-progress-label {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 2px;
}

.source-deck-arrow {
  color: var(--text-tertiary);
  font-size: 1.25rem;
  font-weight: 300;
  flex-shrink: 0;
}

[data-theme="light"] .source-card {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .source-card:hover {
  background: #f8f9fa;
}

[data-theme="light"] .source-card-icon,
[data-theme="light"] .source-detail-icon {
  background: #f0f2f5;
}

[data-theme="light"] .source-deck-item {
  background: #f8f9fa;
}

[data-theme="light"] .source-deck-item:hover {
  background: #eef1f5;
}

/* Source Options */
.source-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.source-option:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
}

.source-option-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.source-option-name {
  font-weight: 600;
  font-size: 0.9375rem;
  display: block;
  color: var(--text);
}

.source-option-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

/* Source Status */
.source-status {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.status-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.status-label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.status-value {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Checkbox List */
.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.checkbox-item:hover {
  background: var(--bg-secondary);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.checkbox-item label {
  flex: 1;
  cursor: pointer;
  font-size: 0.875rem;
}

/* Input with Button */
.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.mt-8 {
  margin-top: 8px;
}

/* Integration List */
.integration-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.integration-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.integration-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.integration-item.disabled {
  opacity: 0.6;
}

.integration-icon {
  font-size: 1.25rem;
}

.integration-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.integration-status {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

/* Error Box */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.error-icon {
  font-size: 1rem;
}

.error-text {
  font-size: 0.8125rem;
  color: var(--danger);
}

/* Library Sections */
.library-section {
  margin-bottom: 24px;
}

.library-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  margin-bottom: 12px;
}

.library-section-icon {
  font-size: 1.25rem;
}

.library-section-header h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.2px;
}

.library-section-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.library-list {
  padding: 0 20px;
}

/* Tags Grid - Chip Style */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 10px;
  background: var(--primary-20);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-chip .tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.tag-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.tag-chip:active {
  transform: scale(0.97);
}

.tag-chip-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.75rem;
}

.tag-chip-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.tag-chip-due {
  font-size: 0.6875rem;
  color: var(--warning);
  font-weight: 500;
}

/* Legacy tag-card support */
.tag-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.tag-card:active {
  transform: scale(0.98);
}

.tag-card-name {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.9375rem;
  margin-bottom: 6px;
  word-break: break-word;
}

.tag-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tag-card-stats .tag-due {
  color: var(--warning);
  font-weight: 500;
}

[data-theme="light"] .tag-chip {
  background: rgba(76, 82, 217, 0.12);
}

[data-theme="light"] .tag-chip:hover {
  background: rgba(76, 82, 217, 0.18);
}

[data-theme="light"] .tag-chip-count {
  background: rgba(76, 82, 217, 0.1);
}

.tags-empty {
  padding: 12px 20px;
  text-align: center;
}

/* Enhanced Tags Empty State */
.tags-empty-card {
  margin: 0 20px;
  padding: 24px 20px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.tags-empty-icon {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.5;
  margin-bottom: 12px;
}

.tags-empty-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.tags-empty-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tags-empty-text strong {
  color: var(--primary);
  font-weight: 500;
}

.tags-empty-card .btn.small {
  padding: 10px 16px;
  font-size: 0.8125rem;
}

[data-theme="light"] .tags-empty-card {
  background: #fff;
  border-color: #dde1e6;
}

[data-theme="light"] .tag-card {
  background: #fff;
}

.library-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.library-item:active {
  background: var(--bg-tertiary);
}

.library-item-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.library-item-info {
  flex: 1;
  min-width: 0;
}

.library-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.library-item-arrow {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}

.modal-content {
  width: 100%;
  max-height: 85vh;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  background: #161623;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  box-shadow: 0 -4px 40px var(--primary-12), 0 -1px 12px rgba(0, 0, 0, 0.4);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-sm {
  max-height: 60vh;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Import Sections */
.import-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.file-label {
  display: block;
  padding: 40px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-label:hover {
  border-color: var(--primary);
}

/* Preview List */
.preview-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 16px 0;
}

.preview-item {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.preview-front {
  font-weight: 500;
  margin-bottom: 4px;
}

.preview-back {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Reader */
/* ===== READING LIST TAB ===== */

.reading-list-actions {
  padding: 0 20px 16px;
}

.reading-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 100px;
}

.reading-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.reading-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.reading-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.reading-card.read {
  opacity: 0.65;
}

.reading-card-body {
  flex: 1;
  min-width: 0;
}

.reading-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reading-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.reading-card-meta .meta-dot {
  color: var(--text-muted);
}

.reading-card-highlights {
  color: var(--warning);
  font-weight: 500;
}

.reading-card-excerpt {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reading-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
}

.reading-card-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.reading-card-badge.read-badge {
  color: var(--success);
  background: rgba(6, 214, 160, 0.12);
}

.reading-card-delete {
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.reading-card-delete:hover {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}

[data-theme="light"] .reading-card {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .reading-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== IN-APP READER ===== */

/* Reading progress bar */
.reader-progress-wrapper {
  position: sticky;
  top: 0;
  z-index: 200;
  pointer-events: none;
}

.reader-progress-bar {
  height: 3px;
  background: var(--primary);
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

.reader-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  background: var(--reader-bg, #faf9f6);
  border-bottom: 1px solid var(--reader-border, #e8e5df);
  z-index: 10;
}

.reader-menu {
  position: absolute;
  top: calc(48px + var(--safe-top));
  right: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 20;
  overflow: hidden;
}

.reader-menu-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.reader-menu-item:hover {
  background: var(--bg-tertiary);
}

.detail-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.reader-header-info {
  flex: 1;
  min-width: 0;
}

#reader-title {
  display: block;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--reader-text, #2c2c2c);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#reader-subtitle {
  display: block;
  font-size: 0.6875rem;
  color: var(--reader-text-secondary, #888);
  margin-top: 1px;
}

.reader-percent {
  display: block;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--reader-text, #2c2c2c);
  padding: 6px 0 2px;
}

.reader-highlight-count {
  font-size: 0.6875rem;
  color: var(--reader-text-secondary, #888);
  background: var(--reader-surface, #f0ede8);
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Reader body — warm Pocket-like background */
#reader-view {
  --reader-bg: #faf9f6;
  --reader-text: #2c2c2c;
  --reader-text-secondary: #888;
  --reader-text-tertiary: #aaa;
  --reader-border: #e8e5df;
  --reader-surface: #f0ede8;
  background: var(--reader-bg);
}

/* Dark reader */
[data-theme="dark"] #reader-view {
  --reader-bg: #1a1a2e;
  --reader-text: #e0e0e8;
  --reader-text-secondary: #8888a0;
  --reader-text-tertiary: #5c5c70;
  --reader-border: #303050;
  --reader-surface: #252540;
}

/* Article metadata block */
.reader-meta {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

.reader-meta-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--reader-text);
  margin-bottom: 12px;
}

.reader-meta-byline {
  font-size: 0.8125rem;
  color: var(--reader-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reader-meta-byline .meta-dot {
  color: var(--reader-text-tertiary);
}

.reader-meta-divider {
  height: 1px;
  background: var(--reader-border);
  margin-top: 24px;
}

/* Reader content — clean serif typography */
.reader-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 24px 120px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--reader-font-size, 1.125rem);
  line-height: 1.9;
  color: var(--reader-text);
  user-select: text;
  -webkit-user-select: text;
}

.reader-content p {
  margin-bottom: 1.2em;
}

.reader-content h1, .reader-content h2, .reader-content h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 1.8em 0 0.6em;
  line-height: 1.3;
  color: var(--reader-text);
}

.reader-content h1 { font-size: 1.5rem; }
.reader-content h2 { font-size: 1.25rem; }
.reader-content h3 { font-size: 1.1rem; }

.reader-content blockquote {
  border-left: 3px solid var(--reader-border);
  padding-left: 16px;
  margin: 1.2em 0;
  color: var(--reader-text-secondary);
  font-style: italic;
}

.reader-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1em 0;
}

.reader-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reader-content ul, .reader-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.reader-content li {
  margin-bottom: 0.5em;
}

/* Inline highlights */
.reader-content mark {
  background: rgba(251, 191, 36, 0.35);
  color: var(--reader-text);
  padding: 2px 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s;
}

.reader-content mark:hover {
  background: rgba(251, 191, 36, 0.55);
}

.reader-content mark.just-created {
  animation: highlightFlash 0.6s ease;
}

@keyframes highlightFlash {
  0% { background: rgba(251, 191, 36, 0.7); }
  100% { background: rgba(251, 191, 36, 0.35); }
}

/* Reader font size variants */
#reader-view[data-reader-size="small"] .reader-content { --reader-font-size: 0.9375rem; }
#reader-view[data-reader-size="normal"] .reader-content { --reader-font-size: 1.125rem; }
#reader-view[data-reader-size="large"] .reader-content { --reader-font-size: 1.3125rem; }

/* Highlight selection toolbar */
.highlight-toolbar {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #2c2c2c;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  animation: toolbarSlideUp 0.2s ease;
}

@keyframes toolbarSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toolbar-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.toolbar-btn.primary {
  background: var(--primary);
  color: white;
}

.toolbar-btn.primary:hover {
  background: #5a7bf7;
}

/* Highlight popover (on tap of existing mark) */
.highlight-popover {
  position: fixed;
  z-index: 200;
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #2c2c2c;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: popoverFadeIn 0.15s ease;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.highlight-popover-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.highlight-popover-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.highlight-popover-btn.danger {
  color: #f87171;
}

/* Reader bottom toolbar */
.reader-bottom-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--reader-bg);
  border-top: 1px solid var(--reader-border);
  z-index: 10;
}

.reader-tool-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--reader-text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.reader-tool-btn:hover {
  background: var(--reader-surface);
  color: var(--reader-text);
}

.reader-tool-btn.active {
  color: var(--primary);
}

/* Toast notification */
.reader-toast {
  position: fixed;
  bottom: calc(60px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  background: #2c2c2c;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  transition: opacity 0.3s, transform 0.3s;
}

.reader-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Highlight Card Panel (Q&A creation) */
.highlight-card-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 16px 20px 24px;
  z-index: 1100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.highlight-card-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.highlight-card-panel-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.highlight-card-panel-x {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.highlight-card-panel-answer label,
.highlight-card-panel-question label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.highlight-card-answer-text {
  background: rgba(253, 224, 71, 0.15);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 100px;
  overflow-y: auto;
  margin-bottom: 12px;
  color: var(--text);
}
.highlight-card-panel-question input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 14px;
  box-sizing: border-box;
}
.highlight-card-panel-question input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Highlight Preview (modal fallback) */
.highlight-preview {
  padding: 16px;
  background: rgba(253, 224, 71, 0.15);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.highlight-preview p {
  color: var(--highlight-text);
}

/* Review Session */
.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: var(--bg);
}

.review-title {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.review-progress-container {
  padding: 0 16px 8px;
  background: var(--bg);
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar.full {
  flex: none;
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

#review-counter {
  font-size: 0.875rem;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: right;
}

.card-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

/* Card Mini Progress */
.card-progress-bar {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.card-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.card-progress-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.card-progress-dot {
  opacity: 0.5;
}

#card-deck-name {
  color: var(--text-secondary);
}

.card-side {
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  max-height: 40vh;
  overflow-y: auto;
}

.card-side.front {
  border-left: 4px solid var(--text-tertiary);
}

.card-side.back {
  border-left: 4px solid var(--success);
  max-height: none;
  flex: 1;
}

.card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.card-side.front .card-label { color: var(--text-secondary); }
.card-side.back .card-label { color: var(--success); }

.card-side.front .card-text {
  font-size: 1.5rem;
  line-height: 1.6;
  font-weight: 500;
}

@media (min-width: 768px) {
  .card-side.front .card-text {
    font-size: 1.75rem;
  }
}

.card-text {
  font-size: 1.125rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.card-text p {
  margin-bottom: 1em;
}

.card-text p:last-child {
  margin-bottom: 0;
}

.card-source {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-source::before {
  content: '📖';
  font-size: 0.875rem;
}

.card-extra {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.context-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}

.context-toggle-btn:hover {
  background: var(--border);
  color: var(--text);
}

.context-toggle-icon {
  font-size: 0.625rem;
  transition: transform 0.2s;
}

.card-context {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-tertiary);
}

.card-context-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--primary-muted);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.source-link:hover {
  opacity: 0.85;
}

.source-link-icon {
  font-size: 0.875rem;
}

/* Quick Actions */
.card-quick-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.card-tags:empty {
  display: none;
}

/* Shared pill-tag base (card-tag, card-tag-chip, topic-chip) */
.card-tag, .card-tag-chip, .topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  background: var(--primary-20);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.card-tag .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-action-buttons {
  display: flex;
  gap: 8px;
}

.card-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.card-action-btn:hover {
  background: var(--border);
  color: var(--text);
}

.card-action-btn .action-icon {
  font-size: 0.875rem;
}

/* Tags Input */
.tags-input-container {
  margin-bottom: 16px;
}

.edit-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.edit-tags-list:empty {
  display: none;
}

.edit-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  font-size: 0.8125rem;
  color: var(--text);
}

.edit-tag::before {
  content: '#';
  opacity: 0.5;
}

.edit-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--border);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
}

.edit-tag-remove:hover {
  background: var(--danger);
  color: white;
}

.tags-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
}

.tags-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Quick Tag Modal */
.quick-tag-current {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 32px;
}

.quick-tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.quick-tag-suggestions:empty {
  display: none;
}

.tag-suggestion {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tag-suggestion:hover {
  background: var(--primary-muted);
  border-color: var(--primary);
  color: var(--primary);
}

.tag-suggestion::before {
  content: '+ ';
  opacity: 0.6;
}

.review-actions {
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

#rating-buttons {
  display: flex;
  gap: 8px;
}

.rating-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px 10px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

.rating-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.rating-label {
  font-size: 0.9375rem;
  font-weight: 700;
}

.rating-desc {
  font-size: 0.625rem;
  opacity: 0.8;
  font-weight: 500;
}

.rating-interval {
  font-size: 0.625rem;
  opacity: 0.65;
  font-weight: 500;
  margin-top: 2px;
}

.rating-btn.again { background: rgba(255, 107, 107, 0.2); color: var(--danger); }
.rating-btn.hard { background: rgba(255, 201, 107, 0.2); color: var(--warning); }
.rating-btn.good { background: rgba(61, 214, 140, 0.2); color: var(--success); }
.rating-btn.easy { background: var(--primary-20); color: var(--primary); }

/* Keyboard Hints */
.keyboard-hint {
  display: none;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

/* Show keyboard hints on devices with hover (desktop) */
@media (hover: hover) and (pointer: fine) {
  .keyboard-hint {
    display: inline-block;
  }

  .rating-btn .keyboard-hint {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
  }

  .rating-btn {
    position: relative;
  }

  #show-answer-btn .keyboard-hint {
    margin-left: 8px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.6875rem;
  }
}

/* Card Front Tags & Source */
.card-front-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.card-tag-chip .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-source-front {
  display: block;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  opacity: 0.6;
}

/* Keyboard Hints Overlay (fades in then out) */
.keyboard-hints-overlay {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  opacity: 0;
  animation: fadeInOut 3.5s ease-in-out forwards;
  pointer-events: none;
}

[data-theme="dark"] .keyboard-hints-overlay {
  background: rgba(255, 255, 255, 0.06);
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  8% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.hint-key {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.7rem;
}

@media (hover: none) {
  .keyboard-hints-overlay { display: none; }
}

/* Dot Indicators */
.card-dots-indicator {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: center;
}

.card-dots-indicator::-webkit-scrollbar { display: none; }

.card-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s;
}

.card-dot.new { background: var(--primary); opacity: 0.5; }
.card-dot.review { background: var(--text-tertiary); opacity: 0.35; }
.card-dot.current { transform: scale(1.6); opacity: 1; }
.card-dot.done { opacity: 0.15; }

/* Card Flip Animation */
.card-side {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.card-side.flip-out {
  transform: rotateX(90deg);
  opacity: 0;
}

.card-side.flip-in {
  transform: rotateX(-90deg);
  opacity: 0;
}

@keyframes backgroundPulse {
  0% { background: var(--bg); }
  50% { background: var(--bg-secondary); }
  100% { background: var(--bg); }
}

.card-container.pulsing {
  animation: backgroundPulse 0.6s ease-in-out;
}

/* Rating Buttons Slide Up */
#rating-buttons {
  transition: transform 0.35s ease-out, opacity 0.35s ease-out;
}

#rating-buttons.slide-hidden {
  transform: translateY(20px);
  opacity: 0;
}

/* Progress Bar Glow */
.progress-fill.glowing {
  box-shadow: 0 0 8px var(--primary), 0 0 16px var(--primary-40);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px var(--primary), 0 0 16px var(--primary-40); }
  50% { box-shadow: 0 0 12px var(--primary), 0 0 24px rgba(93, 99, 255, 0.6); }
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Celebration Modal */
.celebration-modal {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 16px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--primary);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(93, 99, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease-out;
  z-index: 200;
  text-align: center;
}

.celebration-modal.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.celebration-modal-text {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.celebration-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Review Complete */
.complete-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
}

.complete-icon {
  width: 80px;
  height: 80px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.complete-content h2 {
  margin-bottom: 8px;
}

.complete-content p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.complete-big-number {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.complete-recall {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.complete-recall.high { color: var(--success); }
.complete-recall.mid { color: var(--warning); }
.complete-recall.low { color: var(--danger); }

.complete-topic-map {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
  max-width: 340px;
}

.topic-chip .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topic-chip.large {
  font-size: 0.8125rem;
  padding: 5px 12px;
  font-weight: 600;
}

.complete-deck-breakdown {
  width: 100%;
  max-width: 300px;
  margin-bottom: 24px;
  text-align: left;
}

.deck-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.deck-breakdown-item:last-child {
  border-bottom: none;
}

.deck-breakdown-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.deck-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.deck-breakdown-count {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 16px;
}

.complete-backlog-banner {
  margin-top: 8px;
  padding: 12px 16px;
  background: rgba(255, 201, 107, 0.1);
  border: 1px solid rgba(255, 201, 107, 0.25);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 340px;
}

.complete-backlog-banner strong {
  color: var(--warning);
}

/* Settings */
.settings-list {
  padding: 0 20px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.settings-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 8px;
}

.settings-btn .arrow {
  color: var(--text-tertiary);
}

.settings-btn.danger {
  color: var(--danger);
}

.settings-btn.danger .arrow {
  color: var(--danger);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.settings-row select {
  width: auto;
  padding: 8px 32px 8px 12px;
}

.settings-info {
  padding: 8px 0;
  font-size: 0.875rem;
}

/* Settings Button with Hint */
.settings-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.settings-btn-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Security Info Box */
.security-info-box {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--primary-8);
  border: 1px solid var(--primary-15);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.security-info-box .security-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.security-info-box p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* About Section */
.about-info {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.about-info .app-name {
  font-weight: 700;
  font-size: 1rem;
}

.about-info .version {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Font Size Variants */
[data-font-size="small"] {
  font-size: 14px;
}

[data-font-size="normal"] {
  font-size: 16px;
}

[data-font-size="large"] {
  font-size: 18px;
}

[data-font-size="large"] .card-text {
  font-size: 1.15rem;
}

[data-font-size="small"] .card-text {
  font-size: 0.85rem;
}

/* High Contrast Mode */
[data-high-contrast="true"] {
  --text: #ffffff;
  --text-secondary: #c0c0d0;
  --text-tertiary: #9090a8;
  --border: #404060;
  --bg-secondary: #1e1e35;
}

[data-high-contrast="true"][data-theme="light"] {
  --text: #000000;
  --text-secondary: #333340;
  --text-tertiary: #555568;
  --border: #a0a0b0;
  --bg-secondary: #ffffff;
}

[data-high-contrast="true"] .card-side {
  border: 2px solid var(--border);
}

[data-high-contrast="true"] .btn.primary {
  font-weight: 700;
}

[data-high-contrast="true"] .stat-card {
  border: 1px solid var(--border);
}

[data-theme="light"] .security-info-box {
  background: rgba(76, 82, 217, 0.06);
  border-color: rgba(76, 82, 217, 0.12);
}

[data-theme="light"] .about-info {
  background: #fff;
}

/* Highlights List */
#highlights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-item {
  padding: 16px;
  background: rgba(253, 224, 71, 0.1);
  border-radius: var(--radius);
}

.highlight-item-text {
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.highlight-item-source {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.highlight-item-btn {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}

/* Review button in main view */
#start-review-btn {
  margin: 0 20px 16px;
}

/* Deck Actions Menu */
.icon-btn-text {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  padding: 8px;
  cursor: pointer;
}

.deck-actions {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-btn {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
}

.action-btn:active {
  background: var(--border);
}

.action-btn.danger {
  color: var(--danger);
}

/* Cards List */
.cards-list {
  padding: 16px;
  padding-bottom: 100px;
}

.card-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 12px;
  cursor: pointer;
  border-left: 4px solid var(--primary);
}

.card-item-front {
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}

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

.card-item-source {
  font-size: 0.75rem;
  color: var(--primary);
  margin-top: 8px;
  opacity: 0.8;
}

/* Favorite star on card item */
.card-item-star {
  color: #FFC96B;
  margin-right: 6px;
}

/* Favorite button in modal */
.favorite-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  margin-right: 8px;
}

.favorite-btn.active {
  color: #FFC96B;
}

.review-header-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
}

.review-header-btn:active {
  color: var(--primary);
}

.favorite-btn-review {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
}

.favorite-btn-review.active {
  color: #FFC96B;
}

/* Section header with count */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.section-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.section-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-desc {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin: -8px 0 12px 0;
}

/* Triage Section */
.triage-preview {
  margin-bottom: 12px;
}

.triage-preview-item {
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 6px;
}

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

.triage-preview-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.triage-preview-more {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 8px;
}

/* Triage Modal */
.triage-progress {
  margin-bottom: 16px;
}

.triage-progress-bar {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.triage-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

#triage-progress-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.triage-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  min-height: 150px;
}

.triage-card-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.triage-card-content {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  max-height: 200px;
  overflow-y: auto;
}

.triage-card-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.triage-tag {
  font-size: 0.75rem;
  color: var(--primary);
  background: var(--primary-15);
  padding: 3px 8px;
  border-radius: 10px;
}

.triage-no-tags {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.triage-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.triage-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.triage-action-icon {
  font-size: 1.25rem;
}

.triage-action-btn.skip {
  background: var(--surface);
  color: var(--text-secondary);
}

.triage-action-btn.skip:hover {
  background: var(--surface-hover);
}

.triage-action-btn.delete {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.triage-action-btn.delete:hover {
  background: rgba(255, 107, 107, 0.25);
}

.triage-action-btn.tag {
  background: var(--primary-15);
  color: var(--primary);
}

.triage-action-btn.tag:hover {
  background: rgba(93, 99, 255, 0.25);
}

.triage-action-btn.keep {
  background: rgba(61, 214, 140, 0.15);
  color: var(--success);
}

.triage-action-btn.keep:hover {
  background: rgba(61, 214, 140, 0.25);
}

.triage-action-btn:active {
  transform: scale(0.95);
}

.triage-done {
  text-align: center;
  padding: 40px 20px;
}

.triage-done-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(61, 214, 140, 0.15);
  color: var(--success);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.triage-done h3 {
  margin: 0 0 8px;
}

.triage-done p {
  color: var(--text-secondary);
  margin: 0 0 20px;
}

[data-theme="light"] .triage-preview-item,
[data-theme="light"] .triage-card {
  background: #f8f9fa;
}

/* ===== SPLIT ATOMIC CARDS ===== */

/* Split suggestion banner (in card edit + triage) */
.split-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
}

.split-suggestion-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.split-suggestion-text {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.split-suggestion-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 14px;
  background: rgba(251, 191, 36, 0.2);
  color: #D4920A;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.split-suggestion-btn:hover {
  background: rgba(251, 191, 36, 0.35);
}

[data-theme="light"] .split-suggestion {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(212, 146, 10, 0.2);
}

[data-theme="light"] .split-suggestion-btn {
  background: rgba(212, 146, 10, 0.12);
  color: #A87308;
}

/* Split review modal */
.split-review-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(251, 191, 36, 0.1);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text);
}

.split-review-icon {
  font-size: 1.125rem;
}

.split-mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.split-mode-btn {
  flex: 1;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.split-mode-btn.active {
  background: var(--primary);
  color: #fff;
}

.split-card-q {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.split-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.split-card-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}

.split-card-item.unchecked {
  opacity: 0.4;
}

.split-card-item.unchecked .split-card-text {
  text-decoration: line-through;
}

.split-card-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.split-card-body {
  flex: 1;
  min-width: 0;
}

.split-card-number {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.split-card-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
}

.split-card-edit-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
}

.split-card-edit-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

/* Inline edit mode */
.split-card-edit-area {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}

/* Split icon in deck card list */
.card-split-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.15);
  color: #D4920A;
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.card-split-btn:hover {
  background: rgba(251, 191, 36, 0.3);
}

.card-item-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.card-item-meta .due {
  color: var(--warning);
}

.card-item-meta .new {
  color: var(--primary);
}

/* Input Labels */
.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 12px;
}

.input-label:first-of-type {
  margin-top: 0;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.modal-actions-right {
  flex-direction: row;
  justify-content: flex-end;
}

/* Danger Button */
.btn.danger {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
  border: 1.5px solid rgba(255, 107, 107, 0.3);
}

.btn.danger:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.5);
}

.btn.danger:active {
  background: rgba(255, 107, 107, 0.25);
  transform: scale(0.98);
}

/* Mobile optimizations */
@media (max-width: 400px) {
  .rating-btn {
    padding: 14px 4px;
    font-size: 0.75rem;
  }
}

/* ===== BACKLOG & VACATION BANNERS ===== */

.last-session-banner {
  padding: 10px 16px;
  margin: 8px 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  text-align: center;
}

.last-session-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.backlog-banner,
.vacation-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 16px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border-left: 3px solid var(--primary);
}

.backlog-banner.hidden,
.vacation-banner.hidden {
  display: none;
}

.backlog-banner-icon,
.vacation-banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.backlog-banner-content,
.vacation-banner-content {
  flex: 1;
  min-width: 0;
}

.backlog-banner-title,
.vacation-banner-title {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.backlog-banner-subtitle,
.vacation-banner-subtitle {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.vacation-banner {
  border-left-color: #FFC96B;
  background: rgba(255, 201, 107, 0.1);
}

.vacation-banner .btn.small {
  padding: 6px 12px;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}

/* ===== TOGGLE SWITCH ===== */

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: 0.2s;
  border-radius: 14px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Settings row with toggle */
.settings-row.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Vacation status */
.vacation-status {
  padding: 12px 16px;
  background: rgba(255, 201, 107, 0.1);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Small button variant */
.btn.small {
  padding: 8px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-pill);
}
