:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d9e1ec;
  --text: #18202c;
  --muted: #667085;
  --blue: #2563eb;
  --blue-dark: #1746b7;
  --green: #0f9f6e;
  --red: #d84b4b;
  --yellow: #b7791f;
  --shadow: 0 18px 48px rgba(22, 34, 51, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -18px;
  width: 9px;
  height: 16px;
  border-radius: 2px;
  opacity: .95;
  animation: confetti-fall 1.9s ease-in forwards;
}

.encourage-pop {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  min-width: 220px;
  text-align: center;
  color: #1746b7;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(201, 216, 255, .9);
  border-radius: 18px;
  padding: 14px 18px;
  font-weight: 900;
  box-shadow: 0 20px 48px rgba(37, 99, 235, .16);
  animation: encourage-pop 2.4s ease forwards;
}

.encourage-dot {
  position: absolute;
  top: 34%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #60a5fa;
  opacity: .9;
  animation: encourage-float 1.9s ease-out forwards;
}

@keyframes encourage-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(18px) scale(.94); }
  16%, 78% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.98); }
}

@keyframes encourage-float {
  0% { transform: translate3d(0, 0, 0) scale(.75); opacity: 0; }
  20% { opacity: .9; }
  100% { transform: translate3d(var(--drift, 0), -100px, 0) scale(1.2); opacity: 0; }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(var(--drift, 24px), 105vh, 0) rotate(540deg);
    opacity: 0;
  }
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}

button:hover { background: var(--blue-dark); }
button.secondary { background: #eef3ff; color: var(--blue); border: 1px solid #c9d8ff; }
button.secondary:hover { background: #dfe9ff; }
button.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { background: var(--surface-soft); }
button.danger { background: var(--red); }
button.danger:hover { background: #b91c1c; }
button.small-danger {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
  justify-self: end;
}
button:disabled { opacity: .5; cursor: not-allowed; }

.hidden { display: none !important; }

.shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  padding: 40px;
}

.brand {
  width: min(780px, 100%);
  display: flex;
  align-items: center;
  gap: 18px;
}

.mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(37, 99, 235, .24);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 32px; letter-spacing: 0; }
h2 { font-size: 25px; }
h3 { font-size: 18px; }
p { color: var(--muted); margin-top: 8px; }

.login-card {
  width: min(780px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
}

.login-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: #eef3ff;
  border: 1px solid #d7e2ff;
}

.login-tab {
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.login-tab:hover {
  background: rgba(255, 255, 255, .72);
  color: var(--blue);
}

.login-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22), inset 0 1px 0 rgba(255, 255, 255, .35);
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  min-height: 48px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86), 0 6px 14px rgba(22, 34, 51, .04);
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.login-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.check-row input {
  width: auto;
}

.hint {
  color: var(--muted);
  line-height: 1.7;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.text-link {
  min-height: auto;
  margin-top: 8px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 900;
}

.text-link:hover {
  color: var(--blue-dark);
  background: transparent;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .38);
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(720px, 86vh);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(201, 216, 255, .88);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
  border-bottom: 1px solid var(--line);
}

.modal-close {
  min-height: 34px;
  padding: 7px 12px;
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.modal-body p {
  margin: 0;
  line-height: 1.75;
}

.app-view {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.profile span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.rank-scroll {
  position: relative;
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(180, 132, 54, .34);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(180, 132, 54, .10), transparent 16%, transparent 84%, rgba(180, 132, 54, .10)),
    linear-gradient(180deg, #fffaf0 0%, #f8fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 8px 18px rgba(120, 75, 20, .08);
}

.rank-scroll::before,
.rank-scroll::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b7791f, #facc15, #b7791f);
  opacity: .72;
}

.rank-scroll::before { left: 4px; }
.rank-scroll::after { right: 4px; }

.profile .profile-rank-line {
  color: #8a4b0f;
  font-weight: 900;
  font-size: 12px;
}

.profile .profile-next-line {
  color: #1746b7;
  font-size: 12px;
  font-weight: 900;
}

.profile-stats {
  display: grid;
  gap: 3px;
  color: #344054;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
  border: 1px solid #c9d8ff;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

.profile-stats span {
  margin-top: 0;
  font-size: 12px;
  font-weight: 800;
}

.avatar,
.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #e7efff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.profile-avatar .rank-avatar {
  width: 54px;
  height: 54px;
}

.profile-avatar .image-avatar {
  border-color: rgba(201, 216, 255, .86);
}

.profile-avatar .q-face {
  left: 14px;
  top: 15px;
}

.profile-avatar .q-hair {
  left: 13px;
  top: 9px;
}

.profile-avatar .q-body {
  left: 13px;
}

nav {
  display: grid;
  gap: 10px;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-group-title {
  display: block;
  align-items: center;
  padding: 4px 4px 0;
}

.nav-group-title strong {
  color: #172033;
  font-size: 14px;
  line-height: 1.35;
}

.nav-tree-toggle {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #172033;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  border: 1px solid rgba(201, 216, 255, .88);
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: 0 8px 18px rgba(22, 34, 51, .06), inset 0 1px 0 rgba(255, 255, 255, .88);
}

.nav-tree-toggle:hover,
.nav-group.active .nav-tree-toggle {
  color: #1746b7;
  background: linear-gradient(135deg, #f8fbff 0%, #dbeafe 100%);
  transform: translateY(-1px);
}

.nav-plus {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  font-weight: 900;
  line-height: 1;
}

.nav-tree-toggle small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.nav-sub-list {
  display: grid;
  gap: 8px;
  padding-left: 12px;
  border-left: 2px solid rgba(37, 99, 235, .18);
}

.nav-topic {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 28px;
  padding: 5px 8px;
  color: #98a2b3;
  background: rgba(248, 250, 252, .62);
  border: 1px solid rgba(217, 225, 236, .72);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.nav-topic:hover,
.nav-topic.available:hover {
  color: #1746b7;
  background: linear-gradient(135deg, #f8fbff 0%, #dbeafe 100%);
  border-color: rgba(37, 99, 235, .38);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(37, 99, 235, .10);
}

.nav-topic.lit {
  color: #0f766e;
  background: #ecfdf5;
  border-color: rgba(15, 159, 110, .24);
  font-weight: 800;
}

.nav-topic.current-topic {
  color: #7c2d12;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: rgba(217, 119, 6, .42);
  box-shadow: 0 10px 20px rgba(217, 119, 6, .12), inset 0 1px 0 rgba(255, 255, 255, .82);
  font-weight: 900;
}

.nav-topic.dim {
  opacity: .52;
  cursor: not-allowed;
}

.topic-main {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 6px;
}

.topic-text {
  min-width: 0;
}

.topic-action {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0 0 0 24px;
  padding: 0 10px;
  justify-self: start;
  color: #fff;
  background: linear-gradient(135deg, #172033 0%, #334155 100%);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255, 255, 255, .18);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  transform: translateY(8px);
  transition: max-height .28s ease, opacity .24s ease, margin-top .28s ease, padding .28s ease, transform .28s ease;
}

.nav-topic:hover .topic-action {
  max-height: 34px;
  opacity: 1;
  margin-top: 8px;
  padding: 7px 12px;
  transform: translateY(0);
}

.nav-topic.lit .topic-action {
  background: linear-gradient(135deg, #0f766e 0%, #10b981 100%);
  color: #fff;
}

.nav-topic.dim .topic-action {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
  color: #fff;
}

.topic-dot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #98a2b3;
  background: #eef2f7;
  font-size: 11px;
  font-weight: 900;
}

.nav-topic.lit .topic-dot {
  color: #fff;
  background: #0f9f6e;
}

.nav-topic.current-topic .topic-dot {
  color: #fff;
  background: #d97706;
}

#openRankPage,
#openTaskPage {
  position: relative;
  overflow: hidden;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 48%, #0f9f6e 100%);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .26), inset 0 1px 0 rgba(255, 255, 255, .45);
}

#openRankPage::before,
#openTaskPage::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 46%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0));
  pointer-events: none;
}

#openRankPage:hover,
#openTaskPage:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 48%, #0f9f6e 100%);
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(37, 99, 235, .32), inset 0 1px 0 rgba(255, 255, 255, .5);
}

#openTaskPage {
  background: linear-gradient(135deg, #7c3aed 0%, #60a5fa 48%, #2563eb 100%);
  box-shadow: 0 12px 26px rgba(124, 58, 237, .22), inset 0 1px 0 rgba(255, 255, 255, .45);
}

#openTaskPage:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #3b82f6 48%, #1d4ed8 100%);
}

.nav-item {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f2f6fb 100%);
  color: var(--text);
  border: 1px solid rgba(201, 216, 255, .72);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(22, 34, 51, .06), inset 0 1px 0 rgba(255, 255, 255, .85);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-height: 38px;
  padding: 7px 10px;
  gap: 8px;
  font-size: 12px;
  line-height: 1.25;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 42%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.nav-item:hover {
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, .12), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.nav-item.active {
  border-color: rgba(37, 99, 235, .68);
  background: linear-gradient(135deg, #eef4ff 0%, #dbeafe 100%);
  color: #1746b7;
  box-shadow: 0 14px 30px rgba(37, 99, 235, .18), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.nav-practice-action {
  border-color: rgba(217, 225, 236, .88);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: #344054;
}

.nav-practice-action.available {
  border-color: rgba(37, 99, 235, .58);
  background: linear-gradient(135deg, #f8fbff 0%, #dbeafe 100%);
  color: #1746b7;
  box-shadow: 0 14px 26px rgba(37, 99, 235, .16), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.nav-practice-action.passed {
  border-color: rgba(15, 159, 110, .42);
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #0f766e;
  box-shadow: 0 14px 26px rgba(15, 159, 110, .14), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.nav-practice-action.dim {
  opacity: .55;
}

.lock {
  color: var(--yellow);
  font-size: 11px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.nav-item span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
}

.rank-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(22, 34, 51, .05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.rank-card p {
  line-height: 1.7;
}

.rank-current {
  border-color: #c9d8ff;
  background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%);
}

.rank-title {
  color: var(--blue);
  font-size: 21px;
  font-weight: 900;
}

.rank-hero {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.star-meter {
  margin: 12px 0 8px;
  color: #f59e0b;
  font-size: 21px;
  letter-spacing: 2px;
}

.star-list,
.rank-levels,
.leader-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.star-row,
.rank-level {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-soft);
}

.growth-card {
  grid-column: 1 / -1;
}

.growth-card .rank-levels {
  grid-template-columns: 1fr;
  gap: 14px;
}

.growth-card .rank-level {
  position: relative;
  grid-template-columns: 86px 1fr;
  justify-items: start;
  text-align: left;
  align-content: center;
  min-height: 112px;
  padding: 18px;
}

.growth-card .rank-level::after {
  content: "";
  position: absolute;
  left: 42px;
  bottom: -15px;
  width: 2px;
  height: 14px;
  background: rgba(96, 165, 250, .5);
}

.growth-card .rank-level:last-child::after {
  display: none;
}

.star-row.passed {
  border-color: rgba(245, 158, 11, .45);
  background: #fffbeb;
}

.star-row.locked {
  opacity: .55;
}

.star-symbol {
  color: #f59e0b;
  font-size: 24px;
  line-height: 1;
}

.star-row small,
.rank-level small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.rank-level p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.rank-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 10px 20px rgba(22, 34, 51, .12);
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.image-avatar {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, .52);
}

.image-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

.rank-avatar.blue { background: #2563eb; }
.rank-avatar.green { background: #0f9f6e; }
.rank-avatar.gold { background: #d97706; }
.rank-avatar.violet { background: #7c3aed; }
.rank-avatar.red { background: #dc2626; }
.rank-avatar.dark { background: #1f2937; }

.q-avatar::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04));
}

.q-glow {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 26%, rgba(255, 255, 255, .38), transparent 54%);
}

.q-face {
  position: absolute;
  left: 17px;
  top: 18px;
  width: 30px;
  height: 29px;
  border-radius: 48% 48% 54% 54%;
  background: #ffe1bd;
  box-shadow: inset 0 -2px 0 rgba(120, 65, 28, .08);
  z-index: 2;
}

.q-face i {
  position: absolute;
  top: 10px;
  width: 4px;
  height: 5px;
  border-radius: 50%;
  background: #1f2937;
}

.q-face i:first-child { left: 8px; }
.q-face i:nth-child(2) { right: 8px; }

.q-face b {
  position: absolute;
  left: 11px;
  bottom: 7px;
  width: 8px;
  height: 3px;
  border-radius: 0 0 8px 8px;
  background: #d9776a;
}

.q-hair {
  position: absolute;
  left: 16px;
  top: 11px;
  width: 32px;
  height: 20px;
  border-radius: 16px 16px 9px 9px;
  background: #243041;
  z-index: 3;
}

.q-hair::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 24px;
  height: 8px;
  border-radius: 0 0 12px 12px;
  background: inherit;
  transform: rotate(-8deg);
}

.q-body {
  position: absolute;
  left: 16px;
  bottom: 5px;
  width: 32px;
  height: 18px;
  border-radius: 14px 14px 9px 9px;
  background: rgba(255, 255, 255, .32);
  z-index: 1;
}

.q-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, .7);
  box-shadow: 0 4px 8px rgba(22, 34, 51, .16);
}

.q-badge::before {
  position: absolute;
  inset: -1px;
  display: grid;
  place-items: center;
  color: #1f2937;
  font-size: 11px;
  line-height: 1;
}

.q-avatar.seed .q-badge::before { content: "1"; }
.q-avatar.book .q-badge::before { content: "2"; }
.q-avatar.sword .q-badge::before { content: "3"; }
.q-avatar.mage .q-badge::before { content: "4"; }
.q-avatar.crown .q-badge::before { content: "5"; }
.q-avatar.master .q-badge::before { content: "6"; }

.q-avatar.seed .q-hair { background: #1e3a8a; }
.q-avatar.book .q-hair { background: #14532d; }
.q-avatar.sword .q-hair { background: #713f12; }
.q-avatar.mage .q-hair { background: #3b0764; }
.q-avatar.crown .q-hair { background: #7f1d1d; }
.q-avatar.master .q-hair { background: #111827; }

.q-avatar.sword::after,
.q-avatar.mage::after,
.q-avatar.crown::after,
.q-avatar.master::after {
  position: absolute;
  left: 23px;
  top: 4px;
  z-index: 2;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.q-avatar.sword::after { content: "◆"; color: #fde68a; }
.q-avatar.mage::after { content: "✦"; color: #ddd6fe; }
.q-avatar.crown::after { content: "◆"; color: #fecaca; }
.q-avatar.master::after { content: "★"; color: #dbeafe; font-size: 12px; }

.rank-level.active {
  border-color: var(--blue);
  background: #eef4ff;
}

.rank-stat {
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rank-stat strong {
  color: var(--blue);
  font-size: 24px;
}

.rank-stat span {
  color: var(--muted);
  font-weight: 700;
}

.rank-page {
  position: relative;
  display: grid;
  gap: 18px;
  margin: -28px;
  min-height: calc(100vh - 1px);
  padding: 28px;
  overflow: hidden;
  color: #e5eefc;
  background:
    linear-gradient(rgba(77, 163, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 163, 255, .08) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, .32), transparent 34%),
    radial-gradient(circle at 80% 12%, rgba(15, 159, 110, .18), transparent 32%),
    linear-gradient(135deg, #0b1220 0%, #111827 48%, #172033 100%);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
}

.rank-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .08) 42%, transparent 60%);
  transform: translateX(-45%);
  animation: scanner-sweep 5s ease-in-out infinite;
}

@keyframes scanner-sweep {
  0%, 55% { transform: translateX(-55%); opacity: 0; }
  70% { opacity: .7; }
  100% { transform: translateX(55%); opacity: 0; }
}

.rank-page-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(96, 165, 250, .38);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .26), inset 0 0 0 1px rgba(255, 255, 255, .04);
  backdrop-filter: blur(12px);
}

.rank-page-head h2 {
  color: #f8fbff;
}

.rank-page-head p {
  color: #9fb2cf;
}

.rank-page-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1280px;
}

.rank-page-content .rank-card:first-child {
  grid-column: 1 / -1;
}

.rank-page .rank-card {
  background: rgba(15, 23, 42, .78);
  border: 1px solid rgba(148, 163, 184, .22);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .24), inset 0 0 0 1px rgba(255, 255, 255, .04);
  backdrop-filter: blur(12px);
}

.rank-page .rank-card h3 {
  color: #f8fbff;
}

.rank-page .rank-card p,
.rank-page .rank-card small,
.rank-page .rank-sub,
.rank-page .rank-level small,
.rank-page .star-row small,
.rank-page .leader-row small {
  color: #9fb2cf;
}

.rank-page .rank-current {
  border-color: rgba(96, 165, 250, .55);
  background: linear-gradient(135deg, rgba(37, 99, 235, .26), rgba(15, 23, 42, .86) 45%, rgba(15, 159, 110, .18));
}

.rank-page .rank-title {
  color: #7dd3fc;
  text-shadow: 0 0 16px rgba(125, 211, 252, .45);
}

.rank-page .star-meter {
  color: #facc15;
  text-shadow: 0 0 14px rgba(250, 204, 21, .35);
}

.rank-page .star-row,
.rank-page .rank-level,
.rank-page .leader-row {
  background: rgba(15, 23, 42, .62);
  border-color: rgba(148, 163, 184, .18);
}

.rank-page .star-row.passed,
.rank-page .rank-level.active,
.rank-page .leader-row.self {
  background: rgba(37, 99, 235, .18);
  border-color: rgba(96, 165, 250, .55);
}

.rank-page .star-symbol,
.rank-page .leader-row b {
  color: #facc15;
}

.rank-page .leader-row b em {
  color: #fde68a;
}

.rank-page .leader-rank {
  background: linear-gradient(135deg, rgba(250, 204, 21, .95), rgba(217, 119, 6, .9));
  color: #311b04;
  border: 1px solid rgba(253, 224, 71, .78);
  box-shadow: 0 0 18px rgba(250, 204, 21, .24);
}

.rank-page .rank-avatar {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 12px 28px rgba(0, 0, 0, .28), 0 0 20px rgba(96, 165, 250, .2);
}

.rank-page .rank-card:hover,
.rank-page .rank-level:hover,
.rank-page .leader-row:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(125, 211, 252, .72);
  box-shadow: 0 24px 58px rgba(0, 0, 0, .34), 0 0 28px rgba(96, 165, 250, .18), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.rank-page .rank-level:hover .rank-avatar,
.rank-page .rank-card:hover .rank-hero .rank-avatar {
  transform: scale(1.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .24), 0 18px 36px rgba(0, 0, 0, .32), 0 0 30px rgba(125, 211, 252, .35);
}

.leader-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-soft);
}

.leaderboard-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(250, 204, 21, .28) !important;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .9), rgba(31, 41, 55, .82) 58%, rgba(92, 52, 10, .42)),
    radial-gradient(circle at 18% 10%, rgba(250, 204, 21, .16), transparent 28%);
}

.leaderboard-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.leaderboard-card h3::before,
.leaderboard-card h3::after {
  content: "◆";
  color: #facc15;
  font-size: 13px;
  text-shadow: 0 0 12px rgba(250, 204, 21, .5);
}

.leaderboard-card h3 span {
  letter-spacing: .08em;
  text-shadow: 0 0 18px rgba(250, 204, 21, .24);
}

.leaderboard-card::after {
  content: "剑";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: rgba(254, 243, 199, .72);
  border: 1px solid rgba(250, 204, 21, .24);
  background: rgba(120, 53, 15, .22);
  box-shadow: 0 0 24px rgba(250, 204, 21, .12);
  font-family: "Songti SC", "STSong", serif;
  font-weight: 900;
  pointer-events: none;
}

.leader-row.self {
  border-color: var(--blue);
  background: #eef4ff;
}

.leader-rank {
  width: 42px;
  min-width: 42px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff7cc, #f59e0b);
  color: #3b2103;
  font-weight: 900;
  font-size: 12px;
  font-family: "Songti SC", "STSong", serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 18px rgba(120, 53, 15, .16);
}

.leader-row.rank-1 {
  border-color: rgba(250, 204, 21, .58);
  background: linear-gradient(135deg, rgba(120, 53, 15, .28), rgba(15, 23, 42, .72));
}

.leader-row.rank-2 .leader-rank {
  background: linear-gradient(135deg, #f8fafc, #94a3b8);
  color: #172033;
}

.leader-row.rank-3 .leader-rank {
  background: linear-gradient(135deg, #fed7aa, #b45309);
  color: #2b1602;
}

.leader-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.leader-row b {
  color: var(--blue);
}

.leader-row b em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  margin-left: 2px;
}

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

.rank-rule-item {
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 12px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, .54);
}

.rank-rule-item strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #facc15;
  font-size: 16px;
}

.rank-rule-item strong::before {
  content: "◆";
  color: #60a5fa;
  font-size: 11px;
}

.rank-rule-item p {
  margin: 8px 0 0;
  color: #b7c5db;
}

.activity-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .88), rgba(15, 23, 42, .72)),
    url("./assets/ui/jianghu-notice-bg.svg") center / cover;
  border-color: rgba(250, 204, 21, .24) !important;
}

.activity-card h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fef3c7 !important;
  letter-spacing: .06em;
}

.activity-card h3::before {
  content: "令";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #3b2103;
  background: linear-gradient(135deg, #fde68a, #d97706);
  font-family: "Songti SC", "STSong", serif;
  font-size: 14px;
  box-shadow: 0 0 18px rgba(250, 204, 21, .3);
}

.notice-scroll {
  display: grid;
  gap: 12px;
}

.notice-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(250, 204, 21, .18);
  border-radius: 14px;
  padding: 13px;
  background: rgba(15, 23, 42, .68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.notice-seal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff7ed;
  background: linear-gradient(135deg, #991b1b, #dc2626);
  border: 1px solid rgba(254, 202, 202, .32);
  font-family: "Songti SC", "STSong", serif;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(127, 29, 29, .28);
}

.notice-row strong {
  color: #fde68a;
}

.notice-row p {
  margin: 5px 0;
  color: #dbeafe;
}

.notice-row small,
.notice-empty {
  color: #9fb2cf;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 12px 30px rgba(22, 34, 51, .06);
}

.score-badge {
  min-width: 116px;
  text-align: center;
  border: 1px solid #c9d8ff;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--blue);
  background: #eef4ff;
  font-weight: 800;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.tab {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.quiz {
  display: grid;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(22, 34, 51, .05);
}

.card h3 {
  margin-bottom: 14px;
}

.question {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.question:first-of-type { border-top: 0; }
.question strong { display: block; margin-bottom: 10px; }

.options {
  display: grid;
  gap: 8px;
}

.options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
}

.options input {
  width: auto;
}

.code-task {
  display: grid;
  gap: 10px;
}

.code-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.scratch-editor {
  display: grid;
  grid-template-columns: minmax(220px, .9fr) minmax(260px, 1.1fr);
  gap: 14px;
  border: 1px solid #d7e2ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f6ff 100%);
  padding: 14px;
}

.scratch-title {
  display: block;
  margin-bottom: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.scratch-block-list,
.scratch-stack {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 96px;
}

.scratch-stack {
  min-height: 138px;
  padding: 12px;
  border: 1px dashed #b9c7dc;
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
}

.scratch-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.scratch-block {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(22, 34, 51, .10), inset 0 1px 0 rgba(255, 255, 255, .30);
}

.scratch-block:hover {
  transform: translateY(-1px);
}

.scratch-work-block span {
  margin-left: 8px;
  opacity: .78;
}

.scratch-block.event { background: #f59e0b; }
.scratch-block.motion { background: #2563eb; }
.scratch-block.looks { background: #7c3aed; }
.scratch-block.sound { background: #d946ef; }
.scratch-block.control { background: #f97316; }
.scratch-block.sensing { background: #0ea5e9; }
.scratch-block.operators { background: #16a34a; }
.scratch-block.variables { background: #dc2626; }
.scratch-block.pen { background: #0f766e; }

.scratch-clear {
  border-radius: 999px;
}

.attempts {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.attempt-rule {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.run-code {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f9f6e 0%, #34d399 52%, #60a5fa 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 159, 110, .24), inset 0 1px 0 rgba(255, 255, 255, .42);
}

.run-code::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 46%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .46), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.run-code:hover {
  background: linear-gradient(135deg, #0b8b61 0%, #10b981 52%, #3b82f6 100%);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(15, 159, 110, .3), inset 0 1px 0 rgba(255, 255, 255, .48);
}

.run-output {
  margin: 0;
  min-height: 52px;
  white-space: pre-wrap;
  line-height: 1.6;
  background: #f6f8fb;
  color: #1f2937;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.notice, .result {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  line-height: 1.7;
}

.result.pass {
  border-color: rgba(15, 159, 110, .45);
  background: #ecfdf5;
}

.result.fail {
  border-color: rgba(216, 75, 75, .45);
  background: #fff1f2;
}

.exam-history-card {
  margin-top: 18px;
}

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

.exam-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
}

.exam-history-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.exam-history-row b {
  color: var(--blue);
  font-size: 20px;
}

.exam-history-row b em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-left: 2px;
}

.exam-history-row span {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.exam-history-row.passed span {
  color: #047857;
  background: #d1fae5;
}

.exam-history-row.failed span {
  color: #be123c;
  background: #ffe4e6;
}

.compact-notice {
  padding: 12px;
}

.answer-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  line-height: 1.7;
  box-shadow: 0 10px 28px rgba(22, 34, 51, .05);
}

.answer-box h3 {
  margin-bottom: 4px;
}

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

.answer-grid section,
.answer-coding {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.answer-grid ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.answer-coding {
  margin-top: 16px;
}

.answer-code {
  margin-top: 12px;
}

.answer-code pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.teacher {
  display: grid;
  gap: 18px;
}

.create-student-form,
.answer-password-form,
.course-progress-form,
.teacher-task-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.answer-password-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.course-progress-form {
  grid-template-columns: minmax(0, 1fr);
}

.course-progress-form button {
  justify-self: start;
}

.teacher-task-form,
.points-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.teacher-task-form .wide-field {
  grid-column: 1 / -1;
}

.teacher-task-form button,
.points-form button {
  justify-self: start;
}

.task-page {
  display: grid;
  gap: 18px;
}

.task-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(22, 34, 51, .06);
}

.task-page-content {
  display: grid;
  gap: 16px;
}

.parent-message-card {
  border-color: rgba(124, 58, 237, .28);
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
}

.parent-message-content {
  margin-top: 14px;
  border-top: 1px solid rgba(124, 58, 237, .18);
  padding-top: 12px;
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-soft);
}

.task-card small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.task-card p {
  line-height: 1.7;
}

.request-list, .student-list {
  display: grid;
  gap: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admin-stat {
  border: 1px solid rgba(201, 216, 255, .82);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
}

.admin-stat strong {
  display: block;
  color: var(--blue);
  font-size: 22px;
}

.admin-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.admin-detail-grid h4 {
  margin: 0 0 10px;
  color: #172033;
}

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

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(217, 225, 236, .9);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.account-row strong {
  color: #1746b7;
}

.account-row span,
.account-row small {
  color: var(--muted);
  font-size: 12px;
}

.row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 840px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .rank-page-head { align-items: flex-start; flex-direction: column; }
  .task-page-head { align-items: flex-start; flex-direction: column; }
  .rank-page-content { grid-template-columns: 1fr; }
  .growth-card .rank-levels { grid-template-columns: 1fr; }
  .growth-card .rank-level::after { display: none; }
  .answer-grid { grid-template-columns: 1fr; }
  .scratch-editor { grid-template-columns: 1fr; }
  .admin-detail-grid,
  .admin-stats { grid-template-columns: 1fr; }
  .create-student-form,
  .answer-password-form,
  .course-progress-form,
  .teacher-task-form,
  .points-form { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body {
    background: #fff;
  }

  .login-view {
    padding: 22px;
    place-items: stretch;
  }

  .brand {
    align-items: flex-start;
  }

  h1 { font-size: 24px; }
  h2 { font-size: 21px; }
  h3 { font-size: 16px; }

  .login-card {
    padding: 20px;
  }

  .sidebar {
    position: relative;
    top: auto;
    z-index: 20;
    padding: 14px;
    gap: 12px;
    box-shadow: 0 10px 26px rgba(22, 34, 51, .08);
  }

  .profile {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    padding-bottom: 10px;
  }

  .profile-avatar,
  .profile-avatar .rank-avatar {
    width: 48px;
    height: 48px;
  }

  .rank-scroll {
    margin-top: 6px;
    padding: 7px 9px;
    border-radius: 10px;
  }

  .profile .profile-rank-line,
  .profile .profile-next-line {
    font-size: 11px;
    line-height: 1.35;
  }

  .profile-stats {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .profile-stats span {
    font-size: 14px;
    line-height: 1.45;
  }

  nav {
    display: grid;
    gap: 10px;
    overflow: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  .nav-group {
    gap: 6px;
    border: 1px solid rgba(201, 216, 255, .66);
    border-radius: 16px;
    padding: 9px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  }

  .nav-group-title {
    padding: 0 2px;
  }

  .nav-group-title strong {
    font-size: 15px;
  }

  .nav-tree-toggle {
    min-height: 42px;
    border-radius: 14px;
    grid-template-columns: 28px 1fr auto;
    padding: 8px 10px;
  }

  .nav-tree-toggle span:nth-child(2) {
    font-size: 14px;
    font-weight: 900;
  }

  .nav-sub-list {
    padding-left: 0;
    border-left: 0;
    gap: 7px;
  }

  .nav-item {
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    border-radius: 14px;
    scroll-snap-align: none;
  }

  .nav-topic {
    width: 100%;
    min-height: 42px;
    padding: 9px 10px;
    border-radius: 13px;
    font-size: 13px;
  }

  .topic-main {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
  }

  .topic-dot {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .topic-text {
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .topic-action {
    margin-left: 32px;
  }

  #openRankPage,
  #openTaskPage,
  #logoutBtn {
    width: 100%;
    min-height: 48px;
  }

  .content {
    padding: 16px;
    gap: 16px;
  }

  .topbar,
  .rank-page-head,
  .card,
  .notice,
  .result,
  .answer-box {
    border-radius: 14px;
    padding: 16px;
  }

  .score-badge {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab {
    min-width: 92px;
  }

  .options label {
    align-items: flex-start;
  }

  textarea {
    min-height: 180px;
    font-size: 16px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button,
  .code-actions button {
    width: 100%;
  }

  .code-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rank-page {
    margin: -16px;
    padding: 16px;
  }

  .rank-page-content {
    max-width: none;
  }

  .growth-card .rank-level {
    grid-template-columns: 68px 1fr;
    min-height: auto;
    padding: 14px;
  }

  .rank-avatar {
    width: 56px;
    height: 56px;
  }

  .leader-row {
    grid-template-columns: 42px 1fr;
  }

  .leader-row b {
    grid-column: 2;
    justify-self: start;
  }

  .exam-history-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .exam-history-row b,
  .exam-history-row span {
    justify-self: start;
  }

  .account-row {
    grid-template-columns: 1fr;
  }

  button.small-danger {
    justify-self: start;
  }
}
