.nav-dropdown-wrap { position: relative; display: inline-flex; align-items: center; }
#learning-dropdown {
  position: fixed;
  right: auto;
  min-width: 176px;
  z-index: 60;
}
.type-mastery-list { display: flex; flex-direction: column; gap: 8px; }

.stats-subbar, .learning-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.stats-tab-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.stats-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.stats-tab-btn:hover { color: var(--ink); background: var(--surface-soft); }
.stats-tab-btn.active { background: var(--accent-soft); color: var(--accent-fg); }

.time-split-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin: 10px 0 8px;
}
.time-split-seg { height: 100%; min-width: 3px; transition: width 0.25s ease; }
.time-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.7813rem; color: var(--muted); }
.time-legend-item { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.time-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }

.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 3px;
  width: max-content;
}
.hm-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--surface-soft);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.hm-cell:hover { transform: scale(1.22); border-color: var(--accent); }
.hm-cell.l1 { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); border-color: transparent; }
.hm-cell.l2 { background: color-mix(in srgb, var(--accent) 48%, var(--surface)); border-color: transparent; }
.hm-cell.l3 { background: color-mix(in srgb, var(--accent) 74%, var(--surface)); border-color: transparent; }
.hm-cell.l4 { background: var(--accent); border-color: transparent; }
.hm-legend { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--muted); }

.dual-chart-svg { width: 100%; height: auto; aspect-ratio: 960 / 190; display: block; overflow: visible; }
.line-chart-svg { width: 100%; height: auto; aspect-ratio: 960 / 200; display: block; overflow: visible; }
.chart-tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}

.mastery-list { display: flex; flex-direction: column; gap: 10px; }
.mastery-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 14px;
}
.mastery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.25s ease; }
.progress-fill.ok { background: var(--ok); }
.progress-fill.warn { background: #d97706; }
.progress-fill.bad { background: var(--bad); }

.chapter-table { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.chapter-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 120px 80px auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 0.8125rem;
}
.chapter-row.is-weak { background: color-mix(in srgb, var(--bad) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 22%, transparent); }

.learning-item-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.learning-note-editor {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  font-size: 0.8438rem;
}

.stats-rank-list { max-height: 292px; }
.rank-sort-pills { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.rank-sort-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; cursor: pointer;
}
.rank-sort-btn.active { background: var(--surface); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.rank-sub-meta {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums;
}

@media (min-width: 961px) {
  .stats-grid { grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); }
}
.mobile-only-menu-item { display: none; }
@media (max-width: 1220px) {
  .top-nav { gap: 2px; }
  .top-nav-btn { padding: 6px 9px; font-size: 0.8125rem; }
}
@media (max-width: 860px) {
  .mobile-only-menu-item { display: block; }
}

.rank-self-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
}
.rank-self-banner.is-logged {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}
.ranking-table-wrap { overflow-x: auto; }
.ranking-table td, .ranking-table th { vertical-align: middle; }
.ranking-table tr.is-me-row td { background: color-mix(in srgb, var(--accent-soft) 52%, var(--surface)); }

.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.learn-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

@media (max-width: 720px) {
  .chapter-row { grid-template-columns: 1fr auto; gap: 6px; }
  .chapter-row .chapter-bar-cell { display: none; }
  .goal-grid { grid-template-columns: 1fr; }
}

.qs-native-select {
  position: fixed !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
:where(.qs-select-trigger) {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.qs-select-trigger:hover:not(:disabled) { border-color: var(--line-strong); }
.qs-select-trigger.is-open, .qs-select-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.qs-select-trigger:disabled { opacity: 0.45; cursor: not-allowed; }
.qs-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qs-select-menu {
  position: fixed;
  right: auto;
  z-index: 120;
  max-height: 280px;
  overflow-y: auto;
}
.qs-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.qs-select-option span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-select-option.is-selected {
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-weight: 600;
}
.qs-select-group {
  padding: 6px 10px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
