/* Anki Review UI Styles */
:root {
  --anki-bg: var(--bg, var(--bg-main, #f5f7fb));
  --anki-surface: var(--card-bg, var(--bg-card, #ffffff));
  --anki-surface-soft: var(--panel-bg, #f8fafc);
  --anki-surface-strong: var(--track-bg, #f3f4f6);
  --anki-text: var(--text-main, #111827);
  --anki-muted: var(--text-sub, var(--text-muted, #6b7280));
  --anki-border: var(--border, var(--border-color, #e5e7eb));
  --anki-primary: var(--primary, #2563eb);
  --anki-primary-weak: var(--primary-soft, #dbeafe);
  --anki-success: var(--success, #16a34a);
  --anki-warn: var(--warning, #f59e0b);
  --anki-danger: var(--danger, #ef4444);
  --anki-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 18px 120px;
  background: var(--bg-grad, radial-gradient(1200px 600px at 30% -20%, #eef4ff 0%, var(--anki-bg) 55%));
  color: var(--anki-text);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--anki-muted);
}

.top-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.ghost-btn,
.btn,
.start-btn,
.grade-btn {
  border: 1px solid var(--anki-border);
  background: var(--anki-surface);
  color: var(--anki-text);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.ghost-btn:hover,
.btn:hover,
.start-btn:hover,
.grade-btn:hover {
  filter: brightness(1.06);
}

.btn.btn-primary,
.start-btn {
  border-color: var(--anki-primary);
  background: var(--anki-primary);
  color: #fff;
}

.start-btn {
  font-weight: 700;
}

.card {
  background: var(--anki-surface);
  border: 1px solid var(--anki-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--anki-shadow);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  border: 1px solid var(--anki-border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  background: var(--anki-surface);
}

.status {
  font-size: 13px;
  color: var(--anki-muted);
}

.status.ok {
  color: var(--anki-success);
}

.status.bad {
  color: var(--anki-danger);
}

.muted,
.tiny {
  color: var(--anki-muted);
}

.tiny {
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.tab {
  border: 1px solid var(--anki-border);
  background: var(--anki-surface);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--anki-primary);
  background: var(--anki-primary-weak);
  color: var(--anki-text);
}

.anki-home-top,
.anki-home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.anki-home-title {
  font-weight: 700;
}

.anki-home-panel {
  margin: 10px 0;
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--anki-surface);
}

.anki-table {
  width: 100%;
  border-collapse: collapse;
}

.anki-table th,
.anki-table td {
  border-bottom: 1px solid var(--anki-border);
  padding: 10px;
  text-align: left;
  font-size: 14px;
}

.anki-table th {
  background: var(--anki-surface-soft);
  color: var(--anki-text);
}

.anki-table .num,
.anki-num {
  text-align: center;
}

.deck-row {
  cursor: pointer;
}

.deck-row:hover {
  background: var(--anki-surface-soft);
}

.deck-row.active {
  background: var(--anki-primary-weak);
}

.anki-deck-name {
  font-weight: 600;
}

.anki-home-hint {
  color: var(--anki-muted);
  font-size: 13px;
}

.home-study-time-box {
  margin: 8px 0 12px;
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--anki-primary) 10%, var(--anki-surface)), var(--anki-surface));
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-study-time-label {
  font-size: 12px;
  color: var(--anki-muted);
  font-weight: 700;
}

.home-study-time-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--anki-text);
}

.home-study-time-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--anki-muted);
}

.study-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.study-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.study-card {
  margin-top: 8px;
}

.hr {
  border-top: 1px dashed var(--anki-border);
  margin: 10px 0;
}

.big-front,
.back {
  min-height: 120px;
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 14px;
  background: var(--anki-surface);
}

.back {
  margin-top: 10px;
  display: none;
}

.rate {
  font-size: 12px;
  color: var(--anki-muted);
}

.stats-hero {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.stats-sync-card {
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--anki-primary) 10%, var(--anki-surface)), var(--anki-surface));
}

.stats-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stats-section-title {
  font-size: 1.02rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stats-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.streak-box,
.today-box {
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 10px;
  background: var(--anki-surface);
}

.streak-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streak-num {
  font-size: 1.3rem;
  font-weight: 800;
}

.today-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.today-num {
  font-size: 1.25rem;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stats-grid-strong {
  margin-top: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-item {
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 10px;
  background: var(--anki-surface);
  text-align: center;
}

.stat-icon {
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--anki-surface-soft);
}

.stat-icon.new { background: color-mix(in srgb, #60a5fa 18%, var(--anki-surface)); }
.stat-icon.review { background: color-mix(in srgb, #38bdf8 18%, var(--anki-surface)); }
.stat-icon.learn { background: color-mix(in srgb, #f59e0b 18%, var(--anki-surface)); }
.stat-icon.hard { background: color-mix(in srgb, #ef4444 16%, var(--anki-surface)); }
.stat-icon.easy { background: color-mix(in srgb, #14b8a6 18%, var(--anki-surface)); }
.stat-icon.mastered { background: color-mix(in srgb, #8b5cf6 18%, var(--anki-surface)); }
.stat-icon.total { background: color-mix(in srgb, #6366f1 18%, var(--anki-surface)); }

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.stats-summary {
  margin-top: 10px;
  color: var(--anki-muted);
  font-size: 13px;
}

.card-distribution {
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 10px;
  background: var(--anki-surface);
}

.dist-bar {
  height: 16px;
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  background: var(--anki-surface-strong);
}

.dist-segment.new { background: #60a5fa; }
.dist-segment.learn { background: #f59e0b; }
.dist-segment.young { background: #22c55e; }
.dist-segment.mature { background: #a78bfa; }

.dist-legend {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.legend-item {
  font-size: 12px;
  color: var(--anki-muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.dot.new { background: #60a5fa; }
.dot.learn { background: #f59e0b; }
.dot.young { background: #22c55e; }
.dot.mature { background: #a78bfa; }

.dist-total {
  margin-top: 8px;
  font-size: 13px;
}

.card-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.card-focus-card {
  border: 1px solid var(--anki-border);
  border-radius: 14px;
  padding: 12px;
  background: var(--anki-surface);
}

.card-focus-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-focus-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.card-focus-desc {
  color: var(--anki-muted);
  font-size: 12px;
  line-height: 1.45;
}

.card-focus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.card-focus-pill {
  border: 1px solid var(--anki-border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.3;
  background: var(--anki-surface-soft);
}

.card-focus-pill.deck {
  background: color-mix(in srgb, var(--anki-primary) 10%, var(--anki-surface));
}

.card-focus-empty {
  color: var(--anki-muted);
  font-size: 13px;
}

.card-focus-toggle {
  margin-top: 10px;
  padding: 7px 10px;
}

.cal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px;
  border: 1px solid var(--anki-border);
  border-radius: 10px;
  padding: 8px;
  background: var(--anki-surface);
}

.cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--anki-surface-soft);
}

.cell.l1 { background: #bbf7d0; }
.cell.l2 { background: #86efac; }
.cell.l3 { background: #4ade80; }
.cell.l4 { background: #16a34a; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--anki-muted);
  font-size: 12px;
}

#focusStudyOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
}

#focusStudyOverlay.active {
  display: flex;
}

.focus-wrap {
  width: min(1080px, 100%);
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.focus-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.focus-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: 700;
}

.focus-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.focus-right .badge {
  background: var(--anki-surface);
}

.focus-study-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.focus-quest-study-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(100%, 320px);
  white-space: nowrap;
}

.focus-study-time-badge b {
  font-variant-numeric: tabular-nums;
}

.focus-quest-study-time-badge b {
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.focus-card {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--anki-border);
  border-radius: 16px;
  background: var(--anki-surface);
  padding: 14px;
  overflow: auto;
}

.focus-front,
.focus-back {
  border: 1px solid var(--anki-border);
  border-radius: 12px;
  padding: 16px;
  min-height: 140px;
  background: var(--anki-surface);
}

.focus-back {
  margin-top: 10px;
  display: none;
}

.focus-hint {
  margin-top: 8px;
  color: var(--anki-muted);
  font-size: 13px;
}

.focus-done {
  margin-top: 10px;
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #166534;
  border-radius: 10px;
  padding: 10px;
}

.focus-bottom {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border: 1px solid var(--anki-border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  margin-top: auto;
}

.focus-bottom .inner {
  padding: 10px;
}

.focus-counts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.focus-counts .num {
  min-width: 52px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, background-color .16s ease;
}

.focus-counts .num.new { color: #93c5fd; }
.focus-counts .num.learn { color: #fcd34d; }
.focus-counts .num.rev { color: #86efac; }
.focus-counts .plus {
  color: #94a3b8;
  font-weight: 700;
  opacity: .9;
}

.focus-counts.active-new .num,
.focus-counts.active-learn .num,
.focus-counts.active-rev .num {
  opacity: .5;
}

.focus-counts.active-new .num.new,
.focus-counts.active-learn .num.learn,
.focus-counts.active-rev .num.rev {
  opacity: 1;
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
}

.focus-counts.active-new + .focus-labels span:nth-child(1),
.focus-counts.active-learn + .focus-labels span:nth-child(2),
.focus-counts.active-rev + .focus-labels span:nth-child(3) {
  color: #ffffff;
  font-weight: 700;
}

.focus-counts.pulse {
  animation: countPulse .25s ease;
}

@keyframes countPulse {
  from { transform: scale(0.98); }
  to { transform: scale(1); }
}

.focus-labels {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  font-size: 12px;
  color: #cbd5e1;
}

.focus-count-details {
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: #e2e8f0;
}

.focus-grade {
  margin-top: 10px;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.focus-bottom.show-grades .focus-grade {
  display: grid;
}

.grade-btn {
  width: 100%;
  font-weight: 800;
  min-height: 54px;
  border-width: 1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 24px rgba(15, 23, 42, 0.18);
}

.grade-btn small {
  display: block;
  margin-top: 3px;
}

.grade-again { border-color: #fb7185; background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%); }
.grade-hard { border-color: #fbbf24; background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%); }
.grade-good { border-color: #60a5fa; background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%); }
.grade-easy { border-color: #34d399; background: linear-gradient(180deg, #10b981 0%, #047857 100%); }
.grade-again,
.grade-hard,
.grade-good,
.grade-easy {
  transform: translateY(0);
}
.grade-again,
.grade-good,
.grade-easy {
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.28);
}
.grade-hard {
  color: #1f2937;
}
.grade-again small,
.grade-good small,
.grade-easy small {
  color: rgba(248, 250, 252, 0.82);
}
.grade-hard small {
  color: rgba(31, 41, 55, 0.78);
}

.bottom-chips {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--anki-surface);
  border-top: 1px solid var(--anki-border);
  backdrop-filter: blur(6px);
  padding: 8px 10px;
}

.bottom-chips .wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.counts-wrap {
  margin-bottom: 6px;
}

.chip {
  border: 1px solid var(--anki-border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--anki-surface);
}

.chip small {
  margin-left: 4px;
  color: var(--anki-muted);
  font-size: 11px;
}

.chip.active {
  border-color: var(--anki-primary);
  background: var(--anki-primary-weak);
}

#bottomGradeWrap {
  display: none;
}

.bottom-chips.show-grades #bottomGradeWrap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 820px) {
  body {
    padding: 14px 12px 124px;
  }
  .study-top {
    flex-direction: column;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid-strong {
    grid-template-columns: 1fr 1fr;
  }
  .stats-hero {
    grid-template-columns: 1fr;
  }
  .stats-section-head {
    flex-direction: column;
  }
  .card-focus-grid {
    grid-template-columns: 1fr;
  }
  .home-study-time-box {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .home-study-time-hint {
    margin-left: 0;
    width: 100%;
  }
  .heatmap {
    grid-template-columns: repeat(27, 1fr);
  }
  .bottom-chips.show-grades #bottomGradeWrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* Mockup-aligned student Anki shell */
:root {
  --anki-bg: var(--bg, var(--bg-main, #07111f));
  --anki-surface: color-mix(in srgb, var(--card-bg, rgba(22, 35, 54, .94)) 94%, rgba(255, 255, 255, .04));
  --anki-surface-soft: color-mix(in srgb, var(--card-bg, rgba(28, 45, 68, .95)) 86%, rgba(255, 255, 255, .06));
  --anki-surface-strong: color-mix(in srgb, var(--card-bg, rgba(13, 27, 45, .95)) 76%, var(--bg-main, #07111f));
  --anki-border: color-mix(in srgb, var(--border, rgba(148, 163, 184, .24)) 80%, rgba(255, 255, 255, .18));
  --anki-primary: var(--primary, #8072ff);
  --anki-primary-weak: color-mix(in srgb, var(--primary, #8072ff) 24%, transparent);
  --anki-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

html[data-theme="light-mode"] {
  --anki-surface: color-mix(in srgb, var(--card-bg, #ffffff) 94%, transparent);
  --anki-surface-soft: color-mix(in srgb, var(--card-bg, #ffffff) 86%, var(--primary-soft, rgba(37, 99, 235, .14)));
  --anki-surface-strong: color-mix(in srgb, var(--bg-main, #fffaf2) 44%, var(--card-bg, #ffffff));
}

body.anki-review-page {
  min-height: 100vh;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px 16px 104px;
  background:
    radial-gradient(900px 360px at 18% -12%, color-mix(in srgb, var(--primary, #8072ff) 22%, transparent), transparent 64%),
    radial-gradient(600px 340px at 100% 0%, color-mix(in srgb, var(--success, #22c55e) 10%, transparent), transparent 58%),
    var(--bg-grad, linear-gradient(180deg, #0a1626 0%, #07111f 100%));
  font-family: var(--font-body, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif);
}

.anki-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.anki-top-left,
.anki-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.anki-title-wrap {
  min-width: 0;
}

.anki-title-wrap h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
  font-weight: 900;
}

.anki-title-wrap .subtitle {
  margin: 4px 0 0;
  font-size: 14px;
}

.anki-back-btn,
.anki-code-btn,
.small-btn {
  border-radius: 14px;
  font-weight: 800;
  white-space: nowrap;
  background: color-mix(in srgb, var(--anki-surface) 82%, transparent);
}

.anki-identity {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.anki-login-badge.ok,
.badge.status.ok {
  border-color: color-mix(in srgb, var(--success, #22c55e) 48%, var(--anki-border));
  color: color-mix(in srgb, var(--success, #22c55e) 70%, var(--anki-text));
}

.anki-login-badge.bad,
.badge.status.bad {
  border-color: color-mix(in srgb, var(--danger, #ef4444) 48%, var(--anki-border));
  color: color-mix(in srgb, var(--danger, #ef4444) 70%, var(--anki-text));
}

.anki-top-tabs {
  margin: 0 0 14px;
}

.anki-top-tabs .tab,
.anki-bottom-tab {
  border-radius: 14px;
  font-weight: 900;
  color: var(--anki-muted);
  background: color-mix(in srgb, var(--anki-surface) 82%, transparent);
}

.anki-top-tabs .tab.active,
.anki-bottom-tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--anki-primary), color-mix(in srgb, var(--anki-primary) 78%, #ffffff));
  color: #fff;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--anki-primary) 28%, transparent);
}

#tab-deck.card,
#tab-study.card,
#tab-stats.card {
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--anki-surface) 96%, transparent), color-mix(in srgb, var(--anki-surface-strong) 95%, transparent));
}

.anki-home-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.anki-home-copy {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--anki-border);
  border-radius: 22px;
  padding: 20px;
  background:
    radial-gradient(380px 160px at 24% 0%, color-mix(in srgb, var(--anki-primary) 25%, transparent), transparent 70%),
    color-mix(in srgb, var(--anki-surface) 70%, transparent);
}

.anki-home-title {
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1.1;
  font-weight: 900;
}

.anki-home-copy p {
  margin: 8px 0 0;
  color: var(--anki-muted);
  line-height: 1.45;
}

.anki-home-action-card {
  min-width: 230px;
  border: 1px solid var(--anki-border);
  border-radius: 22px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 10px;
  background: color-mix(in srgb, var(--anki-surface) 72%, transparent);
}

.anki-home-action-card span {
  color: var(--anki-muted);
  font-size: 14px;
}

.anki-home-action-card strong {
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
}

.anki-home-panel {
  border: 0;
  background: transparent;
  overflow: visible;
  margin: 0;
}

.anki-table,
.anki-table tbody,
.anki-table tr,
.anki-table td {
  display: block;
}

.anki-table thead {
  display: none;
}

#deckChooserBody {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.anki-table td {
  border-bottom: 0;
  padding: 0;
}

.deck-row {
  min-width: 0;
}

.anki-deck-card {
  min-height: 230px;
  height: 100%;
  border: 1px solid var(--anki-border);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035)),
    color-mix(in srgb, var(--anki-surface-strong) 92%, transparent);
  transition: transform .14s ease, border-color .14s ease, background-color .14s ease;
}

.deck-row:hover .anki-deck-card,
.deck-row.active .anki-deck-card {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--anki-primary) 68%, var(--anki-border));
}

.deck-row.active .anki-deck-card {
  outline: 2px solid color-mix(in srgb, var(--anki-primary) 60%, transparent);
  background:
    radial-gradient(240px 130px at 20% 0%, color-mix(in srgb, var(--anki-primary) 24%, transparent), transparent 70%),
    color-mix(in srgb, var(--anki-surface-strong) 96%, transparent);
}

.deck-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.deck-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--anki-primary), color-mix(in srgb, var(--success, #22c55e) 52%, var(--anki-primary)));
}

.anki-deck-name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
}

.deck-sub {
  color: var(--anki-muted);
  font-size: 13px;
}

.due-big {
  text-align: center;
  margin: 12px 0 14px;
}

.due-big span {
  display: block;
  color: var(--anki-muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.due-big strong {
  display: block;
  font-size: 38px;
  line-height: 1.05;
  font-weight: 900;
}

.count-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

.count {
  border: 1px solid var(--anki-border);
  border-radius: 14px;
  padding: 8px 6px;
  text-align: center;
  background: color-mix(in srgb, var(--anki-surface) 54%, transparent);
}

.count span {
  display: block;
  color: var(--anki-muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.count b {
  font-size: 17px;
}

.deck-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.anki-home-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-card {
  border: 1px solid var(--anki-border);
  border-radius: 18px;
  padding: 14px;
  min-height: 102px;
  background: color-mix(in srgb, var(--anki-surface) 60%, transparent);
}

.summary-card .emoji {
  font-size: 21px;
  margin-bottom: 8px;
}

.summary-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
}

.summary-card span {
  display: block;
  margin-top: 3px;
  color: var(--anki-muted);
  font-size: 13px;
}

.anki-quest-study-card strong {
  font-size: 20px;
}

.study-card {
  min-height: 52vh;
  border-radius: 26px;
  background:
    radial-gradient(360px 190px at 50% 8%, color-mix(in srgb, var(--success, #22c55e) 13%, transparent), transparent 72%),
    color-mix(in srgb, var(--anki-surface-strong) 72%, transparent);
  display: grid;
}

.big-front,
.back,
.focus-front,
.focus-back {
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.25;
  background: color-mix(in srgb, var(--anki-surface) 70%, transparent);
}

.back,
.focus-back {
  font-size: 20px;
  line-height: 1.35;
}

.big-front img,
.back img,
.focus-front img,
.focus-back img {
  max-width: min(100%, 720px);
  max-height: 54vh;
  object-fit: contain;
}

.stat-item[role="button"] {
  cursor: pointer;
  text-align: left;
  transition: transform .14s ease, border-color .14s ease, background-color .14s ease;
}

.stat-item[role="button"]:hover,
.stat-item[role="button"]:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--anki-primary) 58%, var(--anki-border));
  outline: none;
}

.stats-detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
}

.stats-detail-sheet.open {
  display: block;
}

.stats-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .68);
  backdrop-filter: blur(8px);
}

.stats-detail-dialog {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  max-height: min(78vh, 720px);
  overflow: auto;
  border: 1px solid var(--anki-border);
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--anki-surface) 98%, transparent), color-mix(in srgb, var(--anki-surface-strong) 96%, transparent));
  box-shadow: var(--anki-shadow);
}

.stats-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stats-detail-kicker {
  color: var(--anki-muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-detail-head h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.stats-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.stats-detail-metric {
  border: 1px solid var(--anki-border);
  border-radius: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--anki-surface) 64%, transparent);
}

.stats-detail-metric span,
.stats-detail-list-item small,
.stats-detail-note,
.stats-detail-empty {
  color: var(--anki-muted);
}

.stats-detail-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.stats-detail-list {
  display: grid;
  gap: 8px;
}

.stats-detail-list-item {
  border: 1px solid var(--anki-border);
  border-radius: 14px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--anki-surface) 52%, transparent);
}

.stats-detail-list-item span,
.stats-detail-list-item small {
  display: block;
}

.stats-detail-list-item span {
  font-weight: 800;
}

.stats-detail-list-item small {
  margin-top: 3px;
  line-height: 1.35;
}

.anki-bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  width: min(720px, calc(100% - 24px));
  margin: 0 auto;
  border: 1px solid var(--anki-border);
  border-radius: 22px;
  padding: 8px;
  display: flex;
  gap: 6px;
  background: color-mix(in srgb, var(--bg-main, #07111f) 82%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--anki-shadow);
}

.anki-bottom-tab {
  flex: 1;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px;
  font-size: 12px;
}

.anki-bottom-tab span {
  display: block;
}

.bottom-chips {
  display: none;
}

body[data-anki-tab="study"] .bottom-chips {
  display: block;
}

body.focus-active .bottom-chips {
  display: none;
}

body[data-anki-tab="study"] .anki-bottom-nav {
  display: none;
}

@media (min-width: 561px) and (max-width: 820px) {
  .big-front,
  .focus-front {
    font-size: 44px;
    line-height: 1.22;
  }

  .back,
  .focus-back {
    font-size: 24px;
    line-height: 1.35;
  }
}

@media (min-width: 821px) {
  .big-front,
  .focus-front {
    font-size: 54px;
    line-height: 1.2;
  }

  .back,
  .focus-back {
    font-size: 28px;
    line-height: 1.35;
  }
}

@media (min-width: 821px) and (max-width: 1260px) {
  .back,
  .focus-back {
    font-size: 24px;
  }
}

@media (max-width: 900px) {
  #deckChooserBody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .anki-home-hero {
    display: block;
  }

  .anki-home-action-card {
    margin-top: 10px;
    min-width: 0;
  }
}

@media (max-width: 680px) {
  body.anki-review-page {
    padding: 12px 12px 102px;
  }

  .anki-topbar {
    align-items: flex-start;
  }

  .anki-identity {
    gap: 6px;
  }

  .anki-identity #localDeckMsg,
  .anki-top-tabs,
  .anki-title-wrap .subtitle {
    display: none;
  }

  #tab-deck.card,
  #tab-study.card,
  #tab-stats.card {
    padding: 12px;
  }

  #deckChooserBody,
  .anki-home-summary-grid,
  .stats-detail-metrics {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
  }

  .summary-card .emoji {
    margin: 0;
  }

  .focus-wrap {
    width: 100%;
  }

  .focus-top,
  .focus-right {
    flex-wrap: wrap;
  }

  .focus-card {
    min-height: 52vh;
    border-radius: 26px;
  }

  .focus-grade {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
