/* Words on Repeat — Mobile-first responsive design */
:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #475569;
  --radius: 10px;

  /* Type scale */
  --text-xs: 0.68rem;
  --text-sm: 0.75rem;
  --text-base: 0.85rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.6rem;
  --text-2xl: 2.2rem;
  --text-3xl: 2.75rem;

  /* Border radius tokens */
  --radius-sm: 6px;
  --radius-lg: 20px;
  --radius-full: 50%;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-right: auto;
  display: flex;
  align-items: center;
}

.brand-icon {
  width: 1.4rem;
  height: 1.4rem;
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.login-logo {
  display: block;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
}

nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}

nav a:hover, nav a.active {
  color: var(--text);
  background: var(--bg-input);
  text-decoration: none;
}

nav a.brand:hover {
  color: var(--primary);
  background: none;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Forms */
label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

input, textarea, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

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

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: #1e293b; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-input); color: var(--text); }

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

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Review card — 3D flip container */
.review-card {
  text-align: center;
  padding: 0;
  min-height: 200px;
  cursor: pointer;
  user-select: none;
  perspective: 1000px;
  border: none;
  background: none;
  margin-bottom: 1rem;
}

.rv-card-inner {
  position: relative;
  display: grid;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.rv-card-inner.rv-flipped {
  transform: rotateY(180deg);
}

.rv-card-front,
.rv-card-back {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.08);
  transition: box-shadow 0.3s;
}

.review-card:hover .rv-card-front,
.review-card:hover .rv-card-back {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
}

.rv-card-back {
  transform: rotateY(180deg);
}

/* Card entrance/exit animations */
.rv-card-enter {
  animation: rv-card-enter 0.4s ease-out both;
}

.rv-card-exit {
  animation: rv-card-exit 0.25s ease-in both;
}

@keyframes rv-card-enter {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes rv-card-exit {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-30px); }
}

.review-word {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.rv-tap-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1rem;
  animation: rv-pulse-hint 2s ease-in-out infinite;
}

.rv-back-word {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

@keyframes rv-pulse-hint {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.review-translation {
  font-size: 1.75rem;
  color: var(--success);
  margin-bottom: 0.75rem;
}

.review-example {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.rv-example-translation {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.75;
  padding-left: 0.75rem;
  border-left: 2px solid var(--text-muted);
  margin-bottom: 0.25rem;
}

.rv-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.review-hidden { display: none; }

/* Grade buttons — gradient style */
.grade-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.grade-btn {
  padding: 0.85rem 0.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
  position: relative;
}

.grade-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.grade-btn:active { transform: scale(0.95); }
.grade-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.grade-btn.again { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.grade-btn.hard { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1e293b; }
.grade-btn.good { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.grade-btn.easy { background: linear-gradient(135deg, #6366f1, #4f46e5); color: white; }

.grade-interval {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
}

.rv-key-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Grade button stagger animation */
.rv-btn-animate {
  animation: rv-btn-slide-up 0.3s ease-out both;
}
.rv-btn-animate:nth-child(1) { animation-delay: 0s; }
.rv-btn-animate:nth-child(2) { animation-delay: 0.08s; }
.rv-btn-animate:nth-child(3) { animation-delay: 0.16s; }
.rv-btn-animate:nth-child(4) { animation-delay: 0.24s; }

@keyframes rv-btn-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Enhanced progress bar */
.rv-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rv-progress-bar {
  flex: 1;
  height: 12px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
}

.rv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #22c55e);
  border-radius: 6px;
  transition: width 0.3s;
  position: relative;
}

.rv-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: rv-shimmer 2s infinite;
}

@keyframes rv-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.rv-progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 3rem;
  text-align: right;
}

/* Filter bar — pill style */
.rv-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rv-filter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rv-filter-bar select {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--bg-input);
}

.rv-filter-bar select:focus {
  border-color: var(--primary);
}

/* Session limit bar — prominent, separate row */
.rv-session-limit-bar {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rv-session-limit-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  margin-bottom: 0;
}

.rv-session-limit-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rv-session-limit-bar input[type="number"] {
  width: 5.5rem;
  margin: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  text-align: center;
  -moz-appearance: textfield;
}

.rv-session-limit-bar input[type="number"]::-webkit-outer-spin-button,
.rv-session-limit-bar input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rv-session-limit-bar input[type="number"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.rv-session-limit-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Reverse mode toggle */
.rv-reverse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
  user-select: none;
}

.rv-reverse-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.rv-reverse-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  margin-top: 0.25rem;
}

.rv-filter-clear {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.rv-filter-clear:hover {
  background: var(--bg-input);
  color: var(--text);
}

.rv-session-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Legend — collapsible toggle */
.rv-legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.4rem 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.15s;
}

.rv-legend-toggle:hover {
  background: var(--bg-input);
}

.rv-legend-icon {
  display: inline-block;
  transition: transform 0.25s;
  font-size: 0.7rem;
}

.rv-legend-open .rv-legend-icon {
  transform: rotate(90deg);
}

.rv-legend-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  margin-bottom: 0;
}

.rv-legend-open + .rv-legend-panel {
  max-height: 400px;
  opacity: 1;
  margin-bottom: 1rem;
}

.rv-legend-panel-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.7;
}

.rv-legend-item {
  margin-bottom: 0.25rem;
}

.rv-legend-note {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* Completion / empty state overhaul */
.rv-completion {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.rv-completion h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.rv-completion-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  animation: rv-check-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.rv-checkmark {
  width: 36px;
  height: 36px;
  stroke: white;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes rv-check-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.rv-session-summary {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.rv-summary-count {
  color: var(--success);
  font-size: 1.1rem;
  font-weight: 600;
}

.rv-summary-time {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Streak nudge on review completion */
.rv-streak-nudge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 24px;
  animation: rv-streak-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  animation-delay: 0.3s;
}

@keyframes rv-streak-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.rv-streak-fire {
  font-size: 1.3rem;
}

.rv-streak-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--warning);
}

.rv-streak-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rv-completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Review setup view */
.rv-setup {
  max-width: 500px;
  margin: 2rem auto;
}

.rv-setup-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.rv-setup-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.rv-setup-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.rv-due-count {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
}

.rv-due-count.rv-due-none {
  color: var(--text-muted);
}

.rv-setup-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.rv-setup-actions {
  text-align: center;
}

.rv-start-btn {
  padding: 0.85rem 2.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Review header (during active session) */
.rv-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.rv-review-header-left {
  flex: 1;
  min-width: 0;
}

.rv-active-filters {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-review-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.rv-session-timer {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rv-stop-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.rv-review-body {
  max-width: 100%;
}

/* Summary details */
.rv-summary-details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  text-align: left;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.rv-summary-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

.rv-summary-detail-row + .rv-summary-detail-row {
  border-top: 1px solid var(--border);
}

.rv-summary-detail-label {
  color: var(--text-muted);
}

.rv-next-due {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Progress bar — keep old classes for compatibility */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-bottom: 1rem;
  overflow: hidden;
}

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

/* Table */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
}

td { font-size: 0.9rem; }

tr:hover { background: rgba(59, 130, 246, 0.05); }

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-item:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

/* Chart placeholder */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chart-container:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.chart-container h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
}

.bar-chart .bar {
  flex: 1;
  background: var(--primary);
  opacity: 0.7;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  transition: height 0.3s, opacity 0.15s;
}

.bar-chart .bar:hover { opacity: 1; z-index: 10; }

.bar-chart .bar .bar-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.bar-chart .bar:hover .bar-tooltip { display: block; }

/* Forecast calendar strip */
.forecast-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.forecast-day {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.25rem;
  text-align: center;
  transition: border-color 0.15s;
}

.forecast-day-today {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
}

.forecast-day-zero {
  opacity: 0.45;
}

.forecast-day-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.forecast-day-count {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--warning);
  margin: 0.2rem 0;
  letter-spacing: -0.02em;
}

.forecast-day-zero .forecast-day-count {
  color: var(--text-muted);
}

.forecast-day-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Import modal tabs */
.import-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.import-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

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

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

.import-tab-content {
  display: none;
}

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

/* Search bar */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-bar input {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Messages */
.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.message-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.message-success { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }

.hidden { display: none !important; }

/* Session info */
.session-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

/* Login page */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.login-container h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.login-container p {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  /* Nav mobile */
  nav { font-size: 0.8rem; gap: 0.5rem; padding: 0.5rem 0.75rem; }
  nav a { padding: 0.2rem 0.4rem; font-size: 0.8rem; }

  /* Layout mobile */
  .container { padding: 1.25rem 0.75rem; }
  .search-bar { flex-direction: column; }
  .search-bar input { min-width: 0; }

  /* Modal mobile */
  .modal { max-width: calc(100vw - 1.5rem); margin: 0.75rem auto; }

  /* Table mobile — scroll indicator */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Stats tabs mobile */
  .stats-tabs { display: flex; width: 100%; }
  .stats-tab { flex: 1; text-align: center; padding: 0.5rem 0.5rem; font-size: 0.8rem; }

  .review-word { font-size: 2rem; }
  .review-translation { font-size: 1.3rem; }
  .grade-buttons { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-strip { gap: 0.25rem; }
  .forecast-day { padding: 0.4rem 0.15rem; }
  .forecast-day-count { font-size: 1.1rem; }

  /* Review mobile adjustments */
  .review-card { perspective: 600px; }
  .rv-card-front,
  .rv-card-back { padding: 2rem 1rem; }
  .review-card:hover .rv-card-front,
  .review-card:hover .rv-card-back { box-shadow: 0 0 20px rgba(59, 130, 246, 0.08); }
  .rv-progress-bar { height: 10px; }
  .rv-filter-bar { border-radius: var(--radius); padding: 0.5rem 0.75rem; }
  .rv-completion-check { width: 64px; height: 64px; }
  .rv-checkmark { width: 28px; height: 28px; }

  @keyframes rv-card-enter {
    from { opacity: 0; transform: translateX(25px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes rv-card-exit {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-20px); }
  }

  .rv-progress-fill::after { animation: none; }

  .grade-btn:hover { transform: none; filter: none; }
  .grade-btn:active { transform: scale(0.93); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .rv-card-inner { transition-duration: 0.01s; }
  .rv-card-enter, .rv-card-exit { animation-duration: 0.01s; }
  .rv-btn-animate { animation-duration: 0.01s; }
  .rv-tap-hint { animation: none; opacity: 0.7; }
  .rv-progress-fill::after { animation: none; }
  .rv-completion-check { animation-duration: 0.01s; }
  .rv-legend-panel { transition-duration: 0.01s; }
}

/* Speak button (TTS) */
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  margin-left: 0.4rem;
  border-radius: var(--radius-sm);
  vertical-align: middle;
  transition: color 0.15s, background 0.15s;
}

.speak-btn:hover {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.speak-btn svg {
  width: 1.1em;
  height: 1.1em;
}

.speak-btn-inline svg {
  width: 0.9em;
  height: 0.9em;
}

/* Tag chips */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--bg-input);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.tag-clickable { cursor: pointer; }
.tag-clickable:hover { background: var(--primary); color: white; }

/* Legend dots */
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* State badges */
.state-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.state-new { background: rgba(59,130,246,0.2); color: #93c5fd; }
.state-learning { background: rgba(245,158,11,0.2); color: #fcd34d; }
.state-review { background: rgba(34,197,94,0.2); color: #86efac; }
.state-relearning { background: rgba(239,68,68,0.2); color: #fca5a5; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* API key display */
.api-key-display {
  font-family: monospace;
  background: var(--bg-input);
  padding: 0.75rem;
  border-radius: var(--radius);
  word-break: break-all;
  margin: 0.75rem 0;
  border: 1px solid var(--success);
}

/* Settings sections */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section h2 {
  font-size: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.4rem 0.75rem;
}

/* Deck grid */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.deck-card {
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.deck-card .deck-select-btn {
  margin-top: auto;
  width: 100%;
}

.deck-card .deck-card-stats {
  margin-bottom: 0.75rem;
}

.deck-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.deck-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.deck-card-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.deck-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.deck-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

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

/* Deck selector in nav */
#deck-selector {
  max-width: 200px;
}

/* Nav user display */
.nav-user {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

/* Shared deck badge */
.shared-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Status badges for admin */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-active { background: rgba(34,197,94,0.2); color: #86efac; }
.status-locked { background: rgba(245,158,11,0.2); color: #fcd34d; }
.status-inactive { background: rgba(148,163,184,0.2); color: #94a3b8; }

/* Landing page */
.landing-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  max-width: 700px;
  margin: 0 auto;
}

.landing-logo {
  display: block;
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.5rem;
}

.landing-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.landing-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.landing-subtitle strong {
  color: var(--text);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.landing-feature h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.landing-feature p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.landing-also {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.landing-also p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.35rem 0;
}

@media (max-width: 600px) {
  .landing-hero h1 { font-size: 1.5rem; }
  .landing-subtitle { font-size: 1rem; }
  .landing-features { grid-template-columns: 1fr; }
}

/* Dashboard */
.dash {
  max-width: 680px;
  margin: 0 auto;
}

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(34, 197, 94, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 2rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.dash-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dash-hero-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-due-count {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.dash-due-number {
  display: block;
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.2rem;
  letter-spacing: -0.03em;
}

.dash-due-zero {
  color: var(--success);
  font-weight: 600;
  font-size: 1.2rem;
}

.dash-review-btn {
  padding: 0.7rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.dash-review-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.dash-hero-right {
  text-align: center;
  padding: 1rem 1.25rem;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 12px;
  min-width: 100px;
}

.dash-streak {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
}

.dash-streak-fire {
  font-size: 1.4rem;
}

.dash-streak-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: #f59e0b;
  line-height: 1;
  letter-spacing: -0.03em;
}

.dash-streak-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.dash-streak-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* Dashboard metrics row */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 0.75rem;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dash-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dash-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-card-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

/* Dashboard card states — inline pill row */
.dash-states {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.dash-state {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
}

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

.dash-state-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.dash-state-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard weekly activity */
.dash-week {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-week-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.dash-week-header h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.dash-week-total {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
}

.dash-week-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 72px;
}

.dash-week-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.dash-week-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dash-week-bar {
  width: 100%;
  max-width: 48px;
  background: rgba(59, 130, 246, 0.6);
  border-radius: 4px 4px 0 0;
  min-height: 0;
  transition: height 0.3s, background 0.15s;
}

.dash-week-bar-group:hover .dash-week-bar {
  background: rgba(59, 130, 246, 0.85);
}

.dash-week-today .dash-week-bar {
  background: rgba(34, 197, 94, 0.7);
}

.dash-week-today:hover .dash-week-bar {
  background: rgba(34, 197, 94, 0.9);
}

.dash-week-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.dash-week-today .dash-week-label {
  color: var(--success);
  font-weight: 700;
}

/* Dashboard forecast */
.dash-forecast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.dash-forecast h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.dash-forecast-row {
  display: flex;
  gap: 0.6rem;
}

.dash-forecast-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.85rem 0.5rem;
  background: var(--bg-input);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.dash-forecast-item:hover {
  border-color: var(--border);
}

.dash-forecast-today {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.06);
}

.dash-forecast-count {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.dash-forecast-today .dash-forecast-count {
  color: var(--primary);
}

.dash-forecast-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 500;
}

@media (max-width: 600px) {
  .dash-hero { flex-direction: column; gap: 1.5rem; text-align: center; padding: 1.5rem; }
  .dash-hero-left { align-items: center; }
  .dash-hero-right { padding: 0.75rem 1.5rem; min-width: auto; }
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-states { flex-wrap: wrap; gap: 0.4rem; }
  .dash-due-number { font-size: 2.2rem; }
  .dash-streak-num { font-size: 1.8rem; }
  .dash-week-chart { height: 60px; }
  .dash-forecast-count { font-size: 1.3rem; }
}

/* Stats Tabs */
.stats-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.stats-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.stats-tab:hover {
  color: var(--text);
  background: var(--bg-input);
}

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

/* Streak banner */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(234, 88, 12, 0.04) 100%);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.streak-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.streak-fire {
  font-size: 1.75rem;
}

.streak-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--warning);
}

.streak-value-sm {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.streak-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.streak-item-secondary {
  opacity: 0.7;
}

/* Scope toggle */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chart-header h3 {
  margin-bottom: 0;
}

.scope-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.scope-btn {
  padding: 0.3rem 0.6rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.scope-btn:hover {
  background: var(--bg-input);
  color: var(--text);
}

.scope-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

/* Answer distribution */
.answer-dist {
  margin-top: 0.5rem;
}

.answer-bar {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.answer-seg {
  min-width: 2px;
  transition: width 0.3s;
}

.answer-seg.answer-again { background: #ef4444; }
.answer-seg.answer-hard { background: #f59e0b; }
.answer-seg.answer-good { background: #22c55e; }
.answer-seg.answer-easy { background: #6366f1; }

.answer-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.answer-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

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

.answer-dot.answer-again { background: #ef4444; }
.answer-dot.answer-hard { background: #f59e0b; }
.answer-dot.answer-good { background: #22c55e; }
.answer-dot.answer-easy { background: #6366f1; }

/* Heatmap */
.heatmap-wrapper {
  overflow-x: auto;
}

.heatmap-months {
  position: relative;
  height: 1.25rem;
  margin-bottom: 0.25rem;
  margin-left: 0;
}

.heatmap-month {
  position: absolute;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  min-width: 680px;
}

.heatmap-cell {
  width: 100%;
  aspect-ratio: 1;
  min-width: 10px;
  min-height: 10px;
  border-radius: 2px;
  background: var(--bg-input);
}

.heatmap-cell.heatmap-empty {
  background: transparent;
}

.heatmap-level-0 { background: var(--bg-input); }
.heatmap-level-1 { background: #1a4d2e; }
.heatmap-level-2 { background: #2d7a4a; }
.heatmap-level-3 { background: #3fb868; }
.heatmap-level-4 { background: #6ee7a0; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 0.5rem;
  justify-content: flex-end;
}

.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  aspect-ratio: unset;
}

.heatmap-legend-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0.25rem;
}

/* Distribution charts (FSRS) */
.chart-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}

.chart-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dist-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 100px;
  padding-bottom: 2.5rem;
  position: relative;
}

.dist-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}

.dist-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dist-bar {
  width: 70%;
  max-width: 40px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s;
}

.dist-bar-stab { background: var(--primary); }
.dist-bar-diff { background: var(--warning); }

.dist-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
}

.dist-bar-count {
  font-size: 0.7rem;
  color: var(--text);
  font-weight: 600;
}

/* Leech table */
.leech-table {
  font-size: 0.85rem;
}

.leech-table th {
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .stats-tabs { overflow-x: auto; }
  .stats-tab { white-space: nowrap; padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .streak-banner { padding: 0.75rem 1rem; gap: 1rem; }
  .streak-value { font-size: 1.5rem; }
  .streak-fire { font-size: 1.3rem; }
  .chart-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .heatmap-grid { min-width: 580px; }
  .answer-labels { gap: 0.5rem; }
  .dist-chart { gap: 0.25rem; }
}
