* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #eff2f9;
  --card: #ffffff;
  --primary: #2b5cff;
  --primary-2: #7a4dff;
  --primary-soft: rgba(43, 92, 255, 0.08);
  --accent: #ff7a45;
  --text: #101828;
  --text-2: #475467;
  --muted: #8a94a6;
  --line: #e7eaf3;
  --ok: #12b76a;
  --bad: #f04438;
  --gold: #f5b301;
  --silver: #9aa6bd;
  --bronze: #c07a45;
  --radius: 18px;
  --shadow-sm: 0 2px 8px rgba(23, 43, 99, 0.06);
  --shadow: 0 10px 28px rgba(23, 43, 99, 0.09);
  --shadow-lg: 0 18px 44px rgba(23, 43, 99, 0.16);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; }

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ---------------- top bar ---------------- */
.topbar {
  flex: 0 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(231, 234, 243, 0.9);
  position: relative;
  z-index: 20;
}
.topbar[hidden] { display: none; }
.topbar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.topbar-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
}
.topbar-btn:active { background: rgba(16, 24, 40, 0.06); }
.topbar-btn--ghost { pointer-events: none; }

.view {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  animation: viewIn 0.28s ease both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  padding: 30px 22px 68px;
  background: linear-gradient(135deg, #2b5cff 0%, #5a49ff 52%, #9a3ff0 100%);
  color: #fff;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}
.hero::before { width: 190px; height: 190px; right: -60px; top: -70px; }
.hero::after { width: 120px; height: 120px; left: -50px; bottom: -40px; background: rgba(255, 255, 255, 0.09); }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  letter-spacing: 1px;
  backdrop-filter: blur(4px);
}
.hero-title {
  margin: 14px 0 6px;
  font-size: 27px;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.hero-sub {
  font-size: 13.5px;
  opacity: 0.88;
  letter-spacing: 0.3px;
}
.hero-org {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.7;
}

.hero-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: -46px 18px 0;
  padding: 16px 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b {
  display: block;
  font-size: 21px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.stat span { font-size: 11.5px; color: var(--muted); }

/* ---------------- panels ---------------- */
.panel {
  margin: 16px 18px 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.panel-head i {
  width: 4px;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  display: inline-block;
}
.rules {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rule;
}
.rules li {
  position: relative;
  padding-left: 26px;
  margin: 9px 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.rules li::before {
  counter-increment: rule;
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.tip-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #b54708;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------------- buttons ---------------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, opacity 0.2s;
  cursor: pointer;
}
.btn:active { transform: scale(0.975); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2b5cff, #6a4cff);
  box-shadow: 0 10px 22px rgba(43, 92, 255, 0.32);
}
.btn-primary[disabled] { opacity: 0.5; box-shadow: none; }
.btn-ghost {
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-plain {
  color: var(--text-2);
  background: #f2f4f9;
}
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }
.action-area {
  margin: 20px 18px 0;
  display: grid;
  gap: 10px;
}
.link-rank {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 14px 0 4px;
}
.link-rank button {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
}

/* ---------------- form ---------------- */
.form-panel { margin-top: 16px; }
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}
.field .req { color: var(--bad); margin-left: 2px; }
.input {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fbfcff;
  border-radius: 13px;
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.input::placeholder { color: #b4bccb; }
.input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(43, 92, 255, 0.1);
}
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--bad); margin-top: 6px; display: none; }
.field.has-error .input { border-color: var(--bad); background: #fff5f4; }
.field.has-error .field-error { display: block; }

.identity-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(43, 92, 255, 0.08), rgba(122, 77, 255, 0.08));
  margin-bottom: 16px;
}
.identity-card .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b5cff, #7a4dff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex: 0 0 auto;
}
.identity-card .meta b { font-size: 15px; }
.identity-card .meta span { display: block; font-size: 12px; color: var(--muted); }

.attempt-dots { display: inline-flex; gap: 5px; vertical-align: middle; }
.attempt-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dfe4f0;
}
.attempt-dots i.on { background: linear-gradient(135deg, #2b5cff, #7a4dff); }

/* ---------------- quiz ---------------- */
.quiz-bar {
  position: sticky;
  top: 0;
  z-index: 12;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  padding: 12px 18px 10px;
  border-bottom: 1px solid rgba(231, 234, 243, 0.8);
}
.quiz-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.quiz-count b { color: var(--primary); font-size: 17px; font-weight: 700; }
.quiz-count em { font-style: normal; color: var(--muted); font-size: 11.5px; margin-left: 3px; }
.timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.timer.warn { background: #fff1f0; color: var(--bad); }
.progress {
  height: 6px;
  border-radius: 999px;
  background: #e9edf7;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b5cff, #7a4dff);
  transition: width 0.3s ease;
}

.q-wrap { padding: 16px 18px 0; }
.q-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  animation: cardIn 0.26s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.q-tags { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  letter-spacing: 0.3px;
}
.tag-single { background: rgba(43, 92, 255, 0.1); color: #2b5cff; }
.tag-multiple { background: rgba(255, 122, 69, 0.13); color: #d9531a; }
.tag-judge { background: rgba(18, 183, 106, 0.12); color: #0d9155; }
.tag-score { background: #f2f4f9; color: var(--muted); margin-left: auto; }

.q-stem {
  font-size: 16.5px;
  line-height: 1.62;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
  word-break: break-word;
}
.q-stem .qno {
  display: inline-block;
  min-width: 24px;
  color: var(--primary);
  font-weight: 700;
}

.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #fbfcff;
  text-align: left;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.5;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, transform 0.12s;
  width: 100%;
  cursor: pointer;
}
.option:active { transform: scale(0.99); }
.option .badge {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1.5px solid #ccd4e6;
  color: #97a2b8;
  font-size: 12.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: all 0.16s;
  background: #fff;
}
.option.multi .badge { border-radius: 8px; }
.option .text { flex: 1; padding-top: 1px; }
.option.selected {
  border-color: var(--primary);
  background: rgba(43, 92, 255, 0.055);
  box-shadow: 0 6px 16px rgba(43, 92, 255, 0.12);
  color: var(--text);
}
.option.selected .badge {
  border-color: transparent;
  background: linear-gradient(135deg, #2b5cff, #6a4cff);
  color: #fff;
}
.judge-options { grid-template-columns: 1fr 1fr; }
.judge-options .option { justify-content: center; padding: 16px 12px; font-weight: 600; }
.judge-options .option .text { flex: 0 0 auto; }

.quiz-foot {
  margin: 18px 18px 0;
  display: flex;
  gap: 10px;
}
.quiz-foot .btn { flex: 1; }
.quiz-foot .btn-nav { flex: 0 0 96px; }

/* ---------------- bottom sheet ---------------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-height: 78vh;
  overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.sheet-close {
  border: 0;
  background: #f2f4f9;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.nav-cell {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fbfcff;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.nav-cell.answered {
  border-color: rgba(43, 92, 255, 0.4);
  background: rgba(43, 92, 255, 0.09);
  color: var(--primary);
}
.nav-cell.current {
  border-color: transparent;
  background: linear-gradient(135deg, #2b5cff, #6a4cff);
  color: #fff;
  box-shadow: 0 8px 18px rgba(43, 92, 255, 0.3);
}
.legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------- result ---------------- */
.result-hero {
  position: relative;
  padding: 26px 22px 30px;
  background: linear-gradient(140deg, #2b5cff 0%, #5a49ff 55%, #9a3ff0 100%);
  border-radius: 0 0 30px 30px;
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.result-hero::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  right: -80px;
  top: -110px;
}
.ring-wrap { position: relative; width: 156px; height: 156px; margin: 0 auto 6px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: #fff;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  flex-direction: column;
}
.ring-score { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.ring-score small { font-size: 15px; font-weight: 500; opacity: 0.8; margin-left: 2px; }
.ring-label { font-size: 12px; opacity: 0.85; margin-top: 6px; letter-spacing: 2px; }
.result-title { font-size: 17px; font-weight: 600; margin-top: 8px; }
.result-desc { font-size: 12.5px; opacity: 0.82; margin-top: 4px; }
.rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 600;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: -22px 18px 0;
  padding: 16px 8px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.result-grid .cell { text-align: center; }
.result-grid .cell + .cell { border-left: 1px solid var(--line); }
.result-grid b { display: block; font-size: 18px; font-weight: 700; }
.result-grid span { font-size: 11.5px; color: var(--muted); }

.type-stats { display: grid; gap: 10px; }
.type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-2);
}
.type-row .bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: #eef1f8;
  margin: 0 12px;
  overflow: hidden;
}
.type-row .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2b5cff, #7a4dff); }
.type-row .val { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

.analysis-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fbfcff;
}
.analysis-item.ok { border-color: rgba(18, 183, 106, 0.32); background: rgba(18, 183, 106, 0.04); }
.analysis-item.bad { border-color: rgba(240, 68, 56, 0.3); background: rgba(240, 68, 56, 0.035); }
.analysis-head { display: flex; gap: 8px; margin-bottom: 8px; }
.analysis-head .idx {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--muted);
}
.analysis-item.ok .analysis-head .idx { background: var(--ok); }
.analysis-item.bad .analysis-head .idx { background: var(--bad); }
.analysis-head .stem { font-size: 13.8px; font-weight: 600; line-height: 1.55; }
.analysis-line { font-size: 12.5px; color: var(--text-2); margin-top: 5px; }
.analysis-line b { color: var(--text); }
.analysis-line .ok { color: var(--ok); font-weight: 600; }
.analysis-line .bad { color: var(--bad); font-weight: 600; }

/* ---------------- leaderboard ---------------- */
.rank-hero {
  padding: 22px 20px 44px;
  background: linear-gradient(140deg, #2b5cff, #6a4cff 60%, #9a3ff0);
  color: #fff;
  border-radius: 0 0 28px 28px;
  text-align: center;
}
.rank-hero h2 { margin: 0; font-size: 19px; letter-spacing: 1px; }
.rank-hero p { margin: 6px 0 0; font-size: 12.5px; opacity: 0.82; }

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: -26px 16px 0;
  position: relative;
  z-index: 2;
}
.podium-item {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 14px 8px;
  text-align: center;
}
.podium-item.first {
  padding-top: 20px;
  padding-bottom: 20px;
  box-shadow: 0 12px 28px rgba(245, 179, 1, 0.22);
}
.podium-item .crown {
  font-size: 18px;
  height: 30px;
  line-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.mini-medal {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #3d4a63;
  background: #e6ebf5;
  border: 1px solid rgba(61, 74, 99, 0.14);
}
.mini-medal.m0 {
  width: 24px;
  height: 24px;
  font-size: 14px;
  color: #6b3d00;
  background: linear-gradient(135deg, #ffd166, #f0a500);
  border: none;
  box-shadow: 0 4px 10px rgba(245, 179, 1, 0.45);
}
.mini-medal.m2 {
  color: #8a4b1f;
  background: #f6e5d6;
  border-color: rgba(138, 75, 31, 0.18);
}
.podium-item .p-name { font-size: 14px; font-weight: 700; margin-top: 2px; }
.podium-item .p-dept { font-size: 11px; color: var(--muted); margin-top: 1px; }
.podium-item .p-score { font-size: 19px; font-weight: 700; color: var(--primary); margin-top: 6px; }
.podium-item .p-time { font-size: 11px; color: var(--muted); }
.podium-rank {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2f4f9;
  color: var(--text-2);
}
.podium-item.first .podium-rank { background: rgba(245, 179, 1, 0.16); color: #a97a00; }

.rank-list { margin: 16px 18px 0; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.rank-row.me { box-shadow: 0 0 0 2px rgba(43, 92, 255, 0.5); }
.rank-row .no {
  width: 26px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.rank-row .no.g1 { color: var(--gold); }
.rank-row .no.g2 { color: var(--silver); }
.rank-row .no.g3 { color: var(--bronze); }
.rank-row .who { flex: 1; min-width: 0; }
.rank-row .who b { font-size: 14.5px; font-weight: 600; }
.rank-row .who span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .sc { text-align: right; flex: 0 0 auto; }
.rank-row .sc b { font-size: 17px; color: var(--primary); font-variant-numeric: tabular-nums; }
.rank-row .sc span { display: block; font-size: 11px; color: var(--muted); }

.my-rank {
  margin: 16px 18px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(43, 92, 255, 0.09), rgba(122, 77, 255, 0.09));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
}
.my-rank b { color: var(--primary); font-size: 18px; }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
  font-size: 13.5px;
}
.empty .icon { font-size: 34px; opacity: 0.5; margin-bottom: 8px; }

/* ---------------- toast / modal ---------------- */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  background: rgba(16, 24, 40, 0.88);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 76vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

body.modal-open .quiz-foot,
body.modal-open .link-rank {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 30, 0.62);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 26px 26px 88px;
}
.modal[hidden] { display: none; }
#modal.sheet-mode {
  background: transparent;
  backdrop-filter: none;
  padding: 0;
}
#modal.sheet-mode .sheet-mask { background: rgba(9, 15, 30, 0.55); }
.modal-box {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px 16px;
  text-align: center;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 16.5px; font-weight: 600; }
.modal-text { font-size: 13.5px; color: var(--text-2); margin: 10px 0 18px; line-height: 1.6; }
.modal-actions { display: grid; gap: 8px; }

.loading {
  display: grid;
  place-items: center;
  padding: 60px 0;
  color: var(--muted);
  font-size: 13px;
  gap: 12px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid #dfe4f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-title {
  margin: 22px 20px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { width: 4px; height: 14px; border-radius: 4px; background: linear-gradient(180deg, var(--primary), var(--primary-2)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
