:root {
  --bg: #eef3fb;
  --bg-strong: #f8fbff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft: #f4f7fd;
  --text: #152033;
  --text-muted: #5a667a;
  --line: rgba(21, 32, 51, 0.1);
  --line-strong: rgba(21, 32, 51, 0.18);
  --primary: #1a73e8;
  --primary-soft: rgba(26, 115, 232, 0.12);
  --primary-strong: #1557b0;
  --success: #137333;
  --success-soft: rgba(19, 115, 51, 0.12);
  --danger: #b3261e;
  --danger-soft: rgba(179, 38, 30, 0.12);
  --warning: #b06f00;
  --warning-soft: rgba(176, 111, 0, 0.12);
  --shadow-1: 0 12px 30px rgba(24, 37, 60, 0.08);
  --shadow-2: 0 24px 60px rgba(24, 37, 60, 0.12);
  --font-body: "Google Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-code: "Cascadia Code", "Fira Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(26, 115, 232, 0.09), transparent 26%),
    radial-gradient(circle at top right, rgba(19, 115, 51, 0.06), transparent 18%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 56%, #eaf0fb 100%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  padding: 12px;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.topbar,
.filter-panel,
.question-stage,
.stats-panel,
.history-filter-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px);
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 40;
}

.app-shell.view-docs .site-header {
  position: static;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 28px;
}

.topbar-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-mark {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.topnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topnav-button,
.auth-button,
.toggle-button,
.ghost-toggle,
.filter-chip,
.question-chip,
.favorite-button,
.nav-button,
.segmented-button,
.danger-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.topnav-button:hover,
.auth-button:hover,
.toggle-button:hover,
.ghost-toggle:hover,
.filter-chip:hover,
.question-chip:hover,
.favorite-button:hover,
.nav-button:hover,
.segmented-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(24, 37, 60, 0.08);
}

.topnav-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--text-muted);
}

.topnav-button.is-active {
  border-color: rgba(26, 115, 232, 0.22);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-guest,
.auth-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-input,
.select-input {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.auth-input {
  flex: 1 1 140px;
  min-width: 0;
}

.auth-button,
.toggle-button,
.favorite-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 600;
}

.auth-button.primary,
.nav-button.primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.auth-user {
  align-items: flex-start;
}

.user-menu {
  position: relative;
}

.user-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.user-chip-button {
  min-width: 160px;
  text-align: left;
  cursor: pointer;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(380px, calc(100vw - 32px));
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(21, 32, 51, 0.14);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.user-config-form {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.user-config-title {
  padding: 4px 4px 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.user-config-field {
  --select-height: 52px;
  --select-radius: 18px;
}

.user-config-save {
  width: 100%;
}

.user-dropdown-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.user-dropdown-item:hover {
  background: var(--surface-soft);
}

.user-subline,
.auth-message,
.filter-meta,
.record-meta,
.record-detail,
.section-tip,
.stat-subvalue {
  color: var(--text-muted);
  font-size: 13px;
}

.auth-message.is-error {
  color: var(--danger);
}

.main-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
  padding-top: 0;
}

.app-shell.view-docs .main-view {
  margin-top: 20px;
}

.history-tabbar {
  display: flex;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-1);
}

.history-tab {
  flex: 1 1 0;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.history-tab.is-active {
  background: var(--surface-strong);
  color: var(--primary-strong);
  border-color: rgba(26, 115, 232, 0.18);
  box-shadow: 0 10px 24px rgba(26, 115, 232, 0.12);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.filter-panel,
.question-stage,
.stats-panel,
.history-filter-panel {
  border-radius: 28px;
  padding: 16px;
}

.filter-panel-head,
.filter-strip-head,
.question-stage-head,
.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-direction: column;
}

.filter-grid,
.history-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-strip,
.question-rail-panel {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  border-radius: 24px;
  padding: 14px;
}

.chip-row,
.question-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.filter-chip,
.question-chip,
.segmented-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}

.filter-chip.is-active,
.segmented-button.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: rgba(26, 115, 232, 0.22);
}

.ghost-toggle {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
}

.essay-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.ai-regenerate-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(248, 251, 255, 0.9);
}

.ai-regenerate-button {
  width: 100%;
}

.question-chip {
  min-width: 48px;
  justify-content: center;
}

.question-chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

.question-chip.is-correct {
  background: var(--success-soft);
  border-color: rgba(19, 115, 51, 0.2);
  color: var(--success);
}

.question-chip.is-wrong {
  background: var(--danger-soft);
  border-color: rgba(179, 38, 30, 0.2);
  color: var(--danger);
}

.question-chip.is-favorite::after {
  content: "★";
  margin-left: 4px;
  font-size: 12px;
}

.question-stage-head {
  align-items: flex-end;
}

.question-stage h1,
.filter-panel h2,
.stats-panel h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.timer-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 14px;
  font-weight: 600;
}

.question-card {
  margin-top: 14px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.question-card-head,
.question-card-actions,
.record-pills,
.tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.question-card-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.question-card-code {
  font-size: 22px;
  font-weight: 700;
}

.timer-pill,
.tag-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 13px;
}

.favorite-button.is-active,
.status-pill.is-favorite {
  border-color: rgba(176, 111, 0, 0.24);
  background: var(--warning-soft);
  color: var(--warning);
}

.question-content {
  font-size: 16px;
  line-height: 1.85;
}

.question-section {
  margin-top: 22px;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-line h3,
.analytics-card h3 {
  margin: 0;
  font-size: 18px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 0 0 14px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body img,
.svg-inline-wrapper {
  display: block;
  max-width: 100%;
  margin: 16px auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.question-image {
  padding: 6px;
}

.svg-inline-wrapper {
  padding: 12px;
  overflow: auto;
}

.svg-inline-wrapper svg,
.inline-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.markdown-body code {
  font-family: var(--font-code);
}

.markdown-body pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f7faff;
}

.markdown-body pre code {
  display: block;
  white-space: pre;
}

.markdown-body table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.markdown-body th,
.markdown-body td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--surface-soft);
  font-weight: 700;
}

.markdown-body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-option {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 20px;
  text-align: left;
}

.choice-option:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.choice-option.is-selected {
  border-color: rgba(26, 115, 232, 0.22);
  background: var(--primary-soft);
}

.choice-option.is-correct {
  border-color: rgba(19, 115, 51, 0.22);
  background: var(--success-soft);
}

.choice-option.is-incorrect {
  border-color: rgba(179, 38, 30, 0.22);
  background: var(--danger-soft);
}

.choice-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.choice-text {
  align-self: center;
}

.choice-text p,
.choice-text ul {
  margin: 0;
}

.choice-feedback {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.choice-feedback.is-correct {
  background: var(--success-soft);
  border-color: rgba(19, 115, 51, 0.22);
}

.choice-feedback.is-incorrect {
  background: var(--danger-soft);
  border-color: rgba(179, 38, 30, 0.22);
}

.choice-feedback-title {
  font-weight: 700;
}

.choice-feedback-answer {
  margin-top: 6px;
}

.reveal-block {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
}

.reveal-content {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.reveal-content.is-blurred {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
}

.reveal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(248, 250, 255, 0.72);
  color: var(--primary-strong);
  font-weight: 700;
  text-align: center;
}

.stage-actions {
  position: sticky;
  bottom: 10px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.94);
  backdrop-filter: blur(18px);
}

.nav-button {
  min-height: 48px;
  border-radius: 16px;
  font-weight: 700;
}

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

.stats-grid,
.analytics-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stat-card,
.analytics-card,
.record-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 16px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}

.stat-subvalue {
  margin-top: 8px;
}

.history-filter-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.segmented-compact {
  width: 100%;
}

.constellation-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(26, 115, 232, 0.14), transparent 24%),
    radial-gradient(circle at 80% 30%, rgba(19, 115, 51, 0.12), transparent 18%),
    radial-gradient(circle at 50% 80%, rgba(176, 111, 0, 0.1), transparent 18%),
    linear-gradient(180deg, #0e1830 0%, #142447 44%, #10213d 100%);
  box-shadow: var(--shadow-2);
}

.overview-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 20, 40, 0.42);
  backdrop-filter: blur(16px);
}

.overview-toolbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.overview-toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.overview-toolbar-group.is-left {
  align-items: flex-start;
  flex: 1 1 360px;
}

.overview-toolbar-group.is-right {
  align-items: flex-end;
  flex: 1 1 320px;
}

.overview-toolbar-group.is-right .segmented {
  justify-content: flex-end;
}

.overview-toolbar-label {
  color: rgba(236, 243, 255, 0.74);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.overview-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 245, 255, 0.86);
  font-size: 13px;
}

.overview-meta-pill strong {
  color: #fff;
}

.constellation-panel::before,
.constellation-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.constellation-panel::before {
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.48) 0 1px, transparent 1.5px);
  background-size: 130px 130px, 180px 180px, 220px 220px;
  background-position: 0 0, 48px 36px, 92px 18px;
  opacity: 0.65;
}

.constellation-note {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  color: rgba(235, 243, 255, 0.82);
  font-size: 14px;
}

.nebula-scene {
  --pointer-x: 0.5;
  --pointer-y: 0.5;
  position: relative;
  overflow: hidden;
  min-height: 880px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 12% 16%, rgba(90, 152, 255, 0.16), transparent 24%),
    radial-gradient(circle at 84% 14%, rgba(116, 226, 184, 0.12), transparent 22%),
    radial-gradient(circle at 24% 82%, rgba(255, 193, 98, 0.1), transparent 20%),
    radial-gradient(circle at 80% 78%, rgba(255, 142, 184, 0.11), transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(135, 118, 255, 0.08), transparent 34%),
    linear-gradient(180deg, #07111f 0%, #0a1730 36%, #0a1326 100%);
  box-shadow: inset 0 0 120px rgba(255, 255, 255, 0.02), 0 24px 60px rgba(7, 16, 34, 0.34);
}

.nebula-scene::before,
.nebula-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.nebula-scene::before {
  background:
    radial-gradient(circle at calc(var(--pointer-x) * 100%) calc(var(--pointer-y) * 100%), rgba(255,255,255,0.08), rgba(255,255,255,0) 18%),
    radial-gradient(circle at 30% 38%, rgba(255,255,255,0.05), rgba(255,255,255,0) 28%),
    radial-gradient(circle at 70% 62%, rgba(255,255,255,0.04), rgba(255,255,255,0) 24%);
  mix-blend-mode: screen;
  opacity: 0.85;
}

.nebula-scene::after {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.85) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255,255,255,0.45) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,0.3) 0 1px, transparent 1.6px);
  background-size: 140px 140px, 220px 220px, 280px 280px;
  background-position: 0 0, 42px 36px, 112px 60px;
  opacity: 0.3;
}

.nebula-grid {
  position: relative;
  z-index: 1;
  min-height: 880px;
}

.constellation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nebula-cluster {
  position: relative;
  width: min(430px, 76vw);
  aspect-ratio: 1 / 1;
  color: #f4f8ff;
  cursor: pointer;
  outline: none;
  transition: filter 0.35s ease;
  will-change: transform;
  transform:
    translate3d(var(--cluster-x, 0px), var(--cluster-y, 0px), 0)
    rotate(calc(var(--cluster-rot, 0deg) + var(--cluster-rot-offset, 0deg)));
}

.nebula-cluster::before,
.nebula-cluster::after {
  content: "";
  position: absolute;
  inset: 12% 10%;
  border-radius: 58% 42% 61% 39% / 42% 58% 44% 56%;
  pointer-events: none;
}

.nebula-cluster::before {
  filter: blur(34px);
  opacity: 0.82;
}

.nebula-cluster::after {
  inset: 16% 15%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04), rgba(255,255,255,0) 70%);
  opacity: 0.56;
}

.nebula-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 122px;
  height: 122px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  filter: blur(2px);
  z-index: 1;
  animation: pulse-core 7s ease-in-out infinite;
}

.nebula-title {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.nebula-title-main {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nebula-title-meta {
  color: rgba(241, 246, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
}

.asteroid-field {
  position: absolute;
  inset: 0;
}

.asteroid-empty {
  position: absolute;
  left: 50%;
  top: calc(50% + 110px);
  transform: translateX(-50%);
  color: rgba(241, 246, 255, 0.64);
  font-size: 13px;
}

.asteroid {
  position: absolute;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  left: calc(50% + var(--planet-x));
  top: calc(50% + var(--planet-y));
  padding: 0;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transform:
    translate(
      calc(-50% + var(--avoid-x, 0px) + var(--drift-x, 0px)),
      calc(-50% + var(--avoid-y, 0px) + var(--drift-y, 0px))
    );
  transition: filter 0.24s ease, opacity 0.24s ease;
  will-change: transform;
}

.asteroid:hover {
  filter: brightness(1.08);
}

.asteroid-body {
  width: var(--planet-size);
  height: calc(var(--planet-size) * 0.78);
  border-radius: 56% 44% 61% 39% / 43% 58% 42% 57%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 0 9px rgba(255, 255, 255, 0.028),
    0 0 42px rgba(255, 255, 255, 0.22);
}

.asteroid-label,
.asteroid-count {
  position: relative;
  z-index: 1;
}

.asteroid-label {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  color: rgba(242, 246, 255, 0.92);
  text-align: center;
}

.asteroid-count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(226, 233, 245, 0.72);
}

.asteroid-1 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(118,175,255,0.62)); transform: rotate(-16deg); }
.asteroid-2 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(140,219,186,0.58)); transform: rotate(14deg); }
.asteroid-3 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(255,197,103,0.6)); transform: rotate(-10deg); }
.asteroid-4 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(255,141,141,0.58)); transform: rotate(18deg); }
.asteroid-5 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(167,155,255,0.6)); transform: rotate(-22deg); }
.asteroid-6 .asteroid-body { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,1), rgba(114,228,247,0.6)); transform: rotate(8deg); }

.pretty-select {
  --select-height: 60px;
  --select-radius: 24px;
  --select-pad-x: 18px;
  --select-border: rgba(26, 115, 232, 0.12);
  --select-glow: rgba(26, 115, 232, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.pretty-select-label {
  color: rgba(90, 102, 122, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-left: 6px;
}

.pretty-select::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: calc(var(--select-height) - 10px);
  border-radius: calc(var(--select-radius) - 4px);
  background: linear-gradient(180deg, rgba(26, 115, 232, 0.12), rgba(26, 115, 232, 0));
  filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pretty-select::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: calc(8px + (var(--select-height) / 2) - 5px);
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(21, 87, 176, 0.72);
  border-bottom: 2px solid rgba(21, 87, 176, 0.72);
  transform: rotate(45deg);
  pointer-events: none;
  opacity: 0.92;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.pretty-select:focus-within::before {
  opacity: 1;
}

.pretty-select:focus-within::after {
  transform: rotate(45deg) translateY(1px);
}

.pretty-select-input-shell::after {
  display: none;
}

.pretty-select select,
.pretty-select .select-input {
  min-height: var(--select-height);
  width: 100%;
  padding: 0 54px 0 var(--select-pad-x);
  border-radius: var(--select-radius);
  border: 1px solid var(--select-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.95)),
    radial-gradient(circle at top left, rgba(26, 115, 232, 0.11), transparent 42%),
    radial-gradient(circle at bottom right, rgba(19, 115, 51, 0.06), transparent 30%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(26, 115, 232, 0.04),
    0 10px 24px rgba(24, 37, 60, 0.05),
    0 2px 8px rgba(24, 37, 60, 0.04);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.pretty-select select {
  cursor: pointer;
}

.pretty-select .select-input {
  background-image: none;
}

.pretty-select .select-input::-webkit-search-cancel-button {
  appearance: none;
}

.pretty-select:hover select,
.pretty-select:hover .select-input,
.pretty-select select:hover,
.pretty-select .select-input:hover {
  transform: translateY(-1px);
  border-color: rgba(26, 115, 232, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(26, 115, 232, 0.06),
    0 16px 32px rgba(26, 115, 232, 0.1),
    0 6px 18px rgba(24, 37, 60, 0.05);
}

.pretty-select select:focus,
.pretty-select .select-input:focus {
  outline: none;
  border-color: rgba(26, 115, 232, 0.32);
  box-shadow:
    0 0 0 4px rgba(26, 115, 232, 0.1),
    0 18px 36px rgba(26, 115, 232, 0.14);
}

.history-filter-grid {
  display: grid;
  gap: 14px;
}

.history-export-row {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.export-button {
  width: 100%;
}

.pretty-select-hero {
  --select-height: 62px;
  --select-radius: 26px;
}

.knowledge-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.knowledge-filter-panel,
.knowledge-card-shell,
.knowledge-rail {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.knowledge-card-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.knowledge-meta-row,
.knowledge-tag-row,
.knowledge-question-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.knowledge-filter-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.knowledge-layout {
  display: grid;
  gap: 14px;
}

.knowledge-single-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px;
}

.knowledge-single-label {
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 700;
}

.knowledge-single-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.knowledge-layout-single {
  display: block;
}

.knowledge-search-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.knowledge-search-shell::before {
  content: "";
  position: absolute;
  right: 98px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: linear-gradient(180deg, rgba(26, 115, 232, 0), rgba(26, 115, 232, 0.18), rgba(26, 115, 232, 0));
  pointer-events: none;
}

.knowledge-search-input {
  width: 100%;
  padding-right: 112px !important;
}

.knowledge-search-button {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 84px;
  min-height: calc(var(--select-height) - 14px);
  padding: 0 18px;
  border-radius: 18px;
  border: 0;
  background:
    linear-gradient(180deg, rgba(26, 115, 232, 1), rgba(17, 96, 202, 1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 22px rgba(26, 115, 232, 0.24);
}

.knowledge-search-button:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 14px 28px rgba(26, 115, 232, 0.3);
}

.knowledge-card-subject {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.knowledge-card-shell {
  padding: 20px;
}

.knowledge-card-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.knowledge-section {
  margin-top: 20px;
}

.knowledge-section h3,
.knowledge-panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.knowledge-grid {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.knowledge-panel {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
}

.knowledge-panel-item + .knowledge-panel-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.knowledge-checklist {
  margin: 0;
  padding-left: 22px;
}

.knowledge-review-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-card-shell .markdown-body {
  color: var(--text);
}

.knowledge-card-shell .markdown-body p:last-child {
  margin-bottom: 0;
}

.mastery-button {
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.mastery-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.04) brightness(1.02);
}

.mastery-button:active {
  transform: translateY(0);
}

.mastery-button-1 {
  background: linear-gradient(180deg, #ef5350 0%, #d93025 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 26px rgba(217, 48, 37, 0.24);
}

.mastery-button-2 {
  background: linear-gradient(180deg, #fb8c00 0%, #ef6c00 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 26px rgba(239, 108, 0, 0.24);
}

.mastery-button-3 {
  background: linear-gradient(180deg, #9ccc65 0%, #7cb342 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 26px rgba(124, 179, 66, 0.24);
}

.mastery-button-4 {
  background: linear-gradient(180deg, #34a853 0%, #188038 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 26px rgba(24, 128, 56, 0.24);
}

.knowledge-empty-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.knowledge-return-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.docs-page {
  display: grid;
  gap: 18px;
  padding-top: 0;
}

.docs-sidebar,
.docs-content {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.docs-sidebar {
  padding: 18px;
}

.docs-sidebar-head,
.docs-article-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.docs-sidebar-head h2,
.docs-article-head h2 {
  margin: 0;
}

.docs-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.docs-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(26, 115, 232, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,250,255,0.92));
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.docs-item strong {
  color: var(--text);
  font-size: 15px;
}

.docs-item span {
  color: var(--text-muted);
  font-size: 12px;
}

.docs-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(24, 37, 60, 0.08);
  border-color: rgba(26, 115, 232, 0.16);
}

.docs-item.is-active {
  border-color: rgba(26, 115, 232, 0.26);
  background:
    linear-gradient(180deg, rgba(218,232,255,0.88), rgba(231,240,255,0.76)),
    var(--primary-soft);
  box-shadow: 0 16px 30px rgba(26, 115, 232, 0.12);
}

.docs-content {
  padding: 24px 26px;
  min-height: 520px;
}

.docs-article {
  max-width: 860px;
}

.docs-article-head {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.docs-article h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.docs-article .markdown-body {
  margin-top: 0;
}

.tag-badge-button {
  cursor: pointer;
  border: 1px solid rgba(26, 115, 232, 0.12);
}

.tag-badge-button:hover {
  background: rgba(26, 115, 232, 0.14);
  color: var(--primary-strong);
}

.status-pill-button {
  cursor: pointer;
  border: 1px solid var(--line);
}

.status-pill-button:hover {
  transform: translateY(-1px);
}

.active-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.cluster-1::before { background: radial-gradient(circle at 50% 50%, rgba(109, 175, 255, 0.32), rgba(109, 175, 255, 0.11) 36%, rgba(109, 175, 255, 0)); }
.cluster-1 .nebula-core { background: radial-gradient(circle, rgba(122, 187, 255, 0.4), rgba(122, 187, 255, 0.12) 44%, rgba(122, 187, 255, 0)); }

.cluster-2::before { background: radial-gradient(circle at 50% 50%, rgba(118, 228, 186, 0.3), rgba(118, 228, 186, 0.11) 36%, rgba(118, 228, 186, 0)); }
.cluster-2 .nebula-core { background: radial-gradient(circle, rgba(118, 228, 186, 0.38), rgba(118, 228, 186, 0.12) 44%, rgba(118, 228, 186, 0)); }

.cluster-3::before { background: radial-gradient(circle at 50% 50%, rgba(255, 195, 104, 0.3), rgba(255, 195, 104, 0.11) 36%, rgba(255, 195, 104, 0)); }
.cluster-3 .nebula-core { background: radial-gradient(circle, rgba(255, 195, 104, 0.38), rgba(255, 195, 104, 0.12) 44%, rgba(255, 195, 104, 0)); }

.cluster-4::before { background: radial-gradient(circle at 50% 50%, rgba(255, 151, 183, 0.3), rgba(255, 151, 183, 0.11) 36%, rgba(255, 151, 183, 0)); }
.cluster-4 .nebula-core { background: radial-gradient(circle, rgba(255, 151, 183, 0.38), rgba(255, 151, 183, 0.12) 44%, rgba(255, 151, 183, 0)); }

@keyframes pulse-core {
  0%,
  100% { transform: translate(-50%, -50%) scale(0.98); opacity: 0.84; }
  50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.metric-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.75;
}

.record-pills {
  margin-top: 12px;
}

.status-pill.is-correct {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(19, 115, 51, 0.22);
}

.status-pill.is-wrong,
.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.22);
}

.record-detail {
  margin-top: 8px;
  line-height: 1.7;
}

.empty-state {
  padding: 22px 16px;
  border-radius: 22px;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  color: var(--text-muted);
  text-align: center;
}

.compact-empty {
  min-height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 840px) {
  body {
    padding: 22px;
  }

  .topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 20px;
  }

  .auth-panel {
    width: min(100%, 560px);
    align-items: flex-end;
  }

  .auth-user {
    flex-direction: row;
    align-items: center;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .history-filter-row {
    flex-direction: row;
  }

  .history-section-head {
    flex-direction: row;
    align-items: center;
  }

  .segmented-compact {
    width: auto;
  }

  .overview-toolbar-row {
    flex-wrap: nowrap;
  }

  .constellation-board {
    grid-template-columns: 1fr;
  }

  .nebula-scene,
  .nebula-grid {
    min-height: 960px;
  }

  .nebula-cluster {
    position: absolute;
    width: 40%;
    aspect-ratio: 1 / 1;
  }

  .history-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .history-export-row {
    grid-template-columns: 1.1fr 1fr auto;
    align-items: end;
  }

  .export-button {
    width: auto;
    min-width: 260px;
  }

  .knowledge-filter-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .knowledge-search {
    grid-column: span 1;
  }

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

  .docs-page {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
  }

  .cluster-1 {
    left: 4%;
    top: 8%;
    --cluster-rot: -8deg;
  }

  .cluster-2 {
    right: 5%;
    top: 6%;
    --cluster-rot: 7deg;
  }

  .cluster-3 {
    left: 8%;
    bottom: 7%;
    --cluster-rot: 5deg;
  }

  .cluster-4 {
    right: 7%;
    bottom: 9%;
    --cluster-rot: -6deg;
  }
}

@media (max-width: 839px) {
  .overview-toolbar-group.is-right {
    align-items: flex-start;
  }

  .overview-toolbar-group.is-right .segmented {
    justify-content: flex-start;
  }

  .pretty-select {
    --select-height: 56px;
    --select-radius: 22px;
  }

  .pretty-select::after {
    right: 20px;
    bottom: calc(8px + (var(--select-height) / 2) - 5px);
  }

  .knowledge-filter-panel {
    grid-template-columns: 1fr;
  }

  .knowledge-search-shell::before {
    right: 92px;
  }

  .knowledge-search-button {
    min-width: 78px;
    padding: 0 16px;
  }

  .knowledge-single-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .knowledge-review-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-card-head h2 {
    font-size: 24px;
  }
}
