:root {
  --bg: #070d18;
  --bg-2: #0d1626;
  --card: rgba(255, 255, 255, 0.055);
  --card-solid: #101a2b;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eaf0fb;
  --muted: #93a1b8;
  --amber: #ffb020;
  --amber-2: #ff7a18;
  --green: #34d399;
  --red: #fb7185;
  --blue: #38bdf8;
  --violet: #a78bfa;
  --radius: 20px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(56, 189, 248, 0.16), transparent 62%),
    radial-gradient(720px 480px at 100% 2%, rgba(255, 176, 32, 0.13), transparent 58%),
    linear-gradient(180deg, #070d18 0%, #0b1220 42%, #070d18 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 18%, #000 0%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 18%, #000 0%, transparent 78%);
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px
    calc(32px + env(safe-area-inset-bottom));
}

.screen {
  animation: screenIn 0.28s ease both;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button {
  font-family: inherit;
}

a {
  color: var(--blue);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 10px;
  margin-bottom: 4px;
  background: linear-gradient(
    180deg,
    rgba(7, 13, 24, 0.96) 0%,
    rgba(7, 13, 24, 0.82) 68%,
    rgba(7, 13, 24, 0) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 18px;
  background: linear-gradient(135deg, #ffcf5c, #ff7a18);
  box-shadow: 0 8px 20px rgba(255, 140, 30, 0.32);
}

.brand small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--muted);
}

.appbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.amber {
  color: #ffd58a;
  border-color: rgba(255, 176, 32, 0.35);
  background: rgba(255, 176, 32, 0.1);
}

.chip.green {
  color: #9df0c9;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}

.chip.red {
  color: #ffb4c0;
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.1);
}

.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card-pad {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 2px 12px;
  font-size: 15px;
  font-weight: 700;
  color: #c9d5e8;
}

.section-title .link {
  border: none;
  background: none;
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 2px;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.2px;
  cursor: pointer;
  color: #10131a;
  background: #fff;
  transition: transform 0.12s ease, filter 0.18s ease, background 0.18s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #ffcf5c, #ff8a1f);
  color: #1c1304;
  box-shadow: 0 12px 28px rgba(255, 145, 30, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  color: #ffb4c0;
  border-color: rgba(251, 113, 133, 0.35);
}

.btn-sm {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.btn .sub {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

.hero {
  overflow: hidden;
  padding: 20px;
  background:
    radial-gradient(420px 180px at 90% -20%, rgba(255, 176, 32, 0.28), transparent 70%),
    linear-gradient(155deg, rgba(255, 176, 32, 0.13), rgba(56, 189, 248, 0.07) 58%, rgba(255, 255, 255, 0.03));
}

.hero::after {
  content: "95+";
  position: absolute;
  right: 8px;
  bottom: -26px;
  font-size: 108px;
  font-weight: 900;
  letter-spacing: -6px;
  color: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}

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

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--line-strong);
}

.avatar .lv {
  position: absolute;
  right: -6px;
  bottom: -6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #0b1220;
  border: 1px solid var(--line-strong);
  font-size: 10px;
  font-weight: 800;
  color: var(--amber);
}

.hero-name {
  flex: 1;
  min-width: 0;
}

.hero-name h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-name p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.xpbar {
  height: 8px;
  margin-top: 16px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.xpbar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  transition: width 0.6s ease;
}

.xp-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.streak-box {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 15px;
  border: 1px solid rgba(255, 140, 40, 0.26);
  background: rgba(255, 120, 30, 0.09);
}

.streak-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.streak-top strong {
  font-size: 14px;
  color: #ffd9a8;
}

.dots {
  display: flex;
  gap: 7px;
}

.dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  transition: 0.25s;
}

.dot.on {
  border-color: transparent;
  background: linear-gradient(135deg, #ffcf5c, #ff7a18);
  box-shadow: 0 0 12px rgba(255, 140, 30, 0.75);
  animation: dotPop 0.4s ease both;
}

@keyframes dotPop {
  0% {
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

.streak-note {
  margin-top: 8px;
  font-size: 12px;
  color: #d9b78c;
  line-height: 1.5;
}

.hero-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, border-color 0.18s;
}

.quick-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
}

.quick-btn:active {
  transform: scale(0.98);
}

.quick-btn .qi {
  font-size: 22px;
  line-height: 1.2;
}

.quick-btn .ql {
  font-size: 14.5px;
  font-weight: 700;
}

.quick-btn .qm {
  font-size: 11.5px;
  color: var(--muted);
}

.daily {
  margin-top: 12px;
  padding: 16px;
}

.daily-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.daily-row:first-of-type {
  margin-top: 10px;
}

.daily-label {
  width: 76px;
  font-size: 12.5px;
  color: var(--muted);
  flex: none;
}

.daily-bar {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.daily-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #34d399, #38bdf8);
}

.daily-num {
  width: 40px;
  text-align: right;
  font-size: 12px;
  color: #c9d5e8;
  font-weight: 700;
}

.foot {
  margin-top: 26px;
  padding: 0 4px;
  color: #6f7d93;
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.foot b {
  color: #93a1b8;
}

.chapter {
  margin-bottom: 16px;
  overflow: hidden;
}

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

.chapter-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.chapter-title {
  flex: 1;
  min-width: 0;
}

.chapter-title h3 {
  font-size: 16px;
  font-weight: 750;
}

.chapter-title p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.chapter-progress {
  flex: none;
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
}

.chapter-progress b {
  display: block;
  color: var(--amber);
  font-size: 15px;
}

.levels {
  position: relative;
  padding: 8px 14px 14px 14px;
}

.levels::before {
  content: "";
  position: absolute;
  left: 38px;
  top: 20px;
  bottom: 26px;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(255, 176, 32, 0.35),
    rgba(255, 255, 255, 0.08)
  );
}

.level {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px 10px 0;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.15s;
}

.level:hover {
  background: rgba(255, 255, 255, 0.04);
}

.level:active {
  transform: scale(0.995);
}

.level-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 800;
  background: #0c1524;
  border: 2px solid var(--line-strong);
  color: var(--muted);
}

.level.done .level-node {
  border-color: rgba(52, 211, 153, 0.6);
  color: #9df0c9;
  background: rgba(52, 211, 153, 0.1);
}

.level.next .level-node {
  border-color: var(--amber);
  color: #ffd58a;
  background: rgba(255, 176, 32, 0.12);
  box-shadow: 0 0 0 6px rgba(255, 176, 32, 0.1);
  animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
  0%,
  100% {
    box-shadow: 0 0 0 5px rgba(255, 176, 32, 0.1);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 176, 32, 0.03);
  }
}

.level.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.level.boss .level-node {
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 207, 92, 0.25), rgba(255, 122, 24, 0.12));
  border-color: rgba(255, 176, 32, 0.5);
  color: #ffd58a;
}

.level-info {
  flex: 1;
  min-width: 0;
}

.level-info h4 {
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.level-info p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.level-stars {
  flex: none;
  font-size: 13px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}

.level-stars .on {
  color: #ffcf5c;
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.55);
}

.boss-tag {
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #2a1a02;
  background: linear-gradient(135deg, #ffcf5c, #ff8a1f);
}

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  background: linear-gradient(
    180deg,
    rgba(7, 13, 24, 0.98) 0%,
    rgba(7, 13, 24, 0.9) 78%,
    rgba(7, 13, 24, 0) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.quiz-title {
  flex: 1;
  min-width: 0;
}

.quiz-title h2 {
  font-size: 15.5px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-title p {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer.urgent {
  color: #ffb4c0;
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
  animation: timerPulse 1.2s ease-in-out infinite;
}

@keyframes timerPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.62;
  }
}

.quiz-progress {
  height: 5px;
  margin-bottom: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.quiz-progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ffcf5c, #ff7a18);
  transition: width 0.25s ease;
}

.qcard {
  padding: 16px;
}

.qmeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.qtext {
  margin: 12px 0 15px;
  font-size: 18.5px;
  line-height: 1.58;
  font-weight: 650;
  letter-spacing: 0.2px;
  word-break: break-word;
}

.qimg-wrap {
  position: relative;
  margin: 0 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #08101c;
  overflow: hidden;
}

.qimg {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  padding: 6px;
  cursor: zoom-in;
}

.qimg-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #c9d5e8;
  font-size: 10.5px;
  pointer-events: none;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  margin-bottom: 9px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
}

.opt:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
}

.opt:active {
  transform: scale(0.995);
}

.opt .key {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.opt .txt {
  padding-top: 2px;
  word-break: break-word;
}

.opt.selected {
  border-color: rgba(255, 176, 32, 0.65);
  background: rgba(255, 176, 32, 0.1);
}

.opt.selected .key {
  background: var(--amber);
  color: #241604;
}

.opt.correct {
  border-color: rgba(52, 211, 153, 0.65);
  background: rgba(52, 211, 153, 0.12);
}

.opt.correct .key {
  background: var(--green);
  color: #052e1f;
}

.opt.wrong {
  border-color: rgba(251, 113, 133, 0.65);
  background: rgba(251, 113, 133, 0.12);
}

.opt.wrong .key {
  background: var(--red);
  color: #35060e;
}

.opt.dim {
  opacity: 0.55;
}

.feedback {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  animation: feedbackIn 0.22s ease both;
}

@keyframes feedbackIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback.ok {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.07);
}

.feedback.bad {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.07);
}

.feedback-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
}

.feedback.ok .feedback-head {
  color: #9df0c9;
}

.feedback.bad .feedback-head {
  color: #ffb4c0;
}

.feedback-head .ans {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: #c9d5e8;
}

.feedback h5 {
  margin: 12px 0 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--muted);
}

.exp {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.72;
  color: #c7d2e2;
  word-break: break-word;
}

.tipbox {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.07);
  font-size: 13px;
  line-height: 1.6;
  color: #bfe3f8;
}

.tipbox b {
  color: #8fd8ff;
}

.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 18;
  display: flex;
  gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  margin-top: 12px;
  background: linear-gradient(
    0deg,
    rgba(7, 13, 24, 0.98) 30%,
    rgba(7, 13, 24, 0.85) 72%,
    rgba(7, 13, 24, 0) 100%
  );
}

.actionbar .btn {
  flex: 1;
}

.actionbar .btn-icon {
  flex: 0 0 52px;
  padding: 0;
  font-size: 19px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin-top: 14px;
}

.palette-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.palette-cell.done {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
  color: #9df0c9;
}

.palette-cell.cur {
  border-color: var(--amber);
  color: #ffd58a;
  background: rgba(255, 176, 32, 0.16);
  box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.18);
}

.palette-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.palette-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 3px;
  vertical-align: middle;
}

.result-hero {
  padding: 24px 18px 20px;
  text-align: center;
  overflow: hidden;
}

.result-hero.fail {
  background: radial-gradient(420px 200px at 50% -10%, rgba(251, 113, 133, 0.22), transparent 70%),
    rgba(255, 255, 255, 0.04);
}

.result-hero.pass {
  background: radial-gradient(420px 200px at 50% -10%, rgba(52, 211, 153, 0.22), transparent 70%),
    rgba(255, 255, 255, 0.04);
}

.ring {
  position: relative;
  width: 164px;
  height: 164px;
  margin: 6px auto 4px;
  border-radius: 50%;
  background: conic-gradient(
    var(--ring-color, var(--green)) calc(var(--p, 0) * 1%),
    rgba(255, 255, 255, 0.08) 0
  );
  display: grid;
  place-items: center;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #0b1424;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ring-inner {
  position: relative;
  text-align: center;
}

.ring-inner strong {
  display: block;
  font-size: 46px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: -1px;
}

.ring-inner span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
}

.result-title {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 850;
}

.result-sub {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}

.stars-big {
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: 8px;
  color: rgba(255, 255, 255, 0.14);
  line-height: 1;
}

.stars-big .on {
  color: #ffcf5c;
  text-shadow: 0 0 18px rgba(255, 176, 32, 0.7);
  display: inline-block;
  animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.stars-big .on:nth-child(2) {
  animation-delay: 0.12s;
}

.stars-big .on:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes starPop {
  from {
    transform: scale(0) rotate(-40deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.stat {
  padding: 12px 8px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
}

.stat span {
  font-size: 11px;
  color: var(--muted);
}

.xp-gain {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.12);
  color: #cbbcfd;
  font-size: 12.5px;
  font-weight: 700;
}

.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.review-list {
  margin-top: 12px;
}

.review-item {
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 9px;
}

.review-item .rq {
  font-size: 14px;
  line-height: 1.55;
  color: #dbe4f3;
}

.review-item .ra {
  margin-top: 7px;
  font-size: 12.5px;
  color: #9df0c9;
}

.review-item .ra.miss {
  color: #ffb4c0;
}

.review-item .rexp {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
}

.streak-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 140, 40, 0.28);
  background: linear-gradient(150deg, rgba(255, 176, 32, 0.14), rgba(255, 122, 24, 0.05));
}

.streak-panel .dots {
  margin: 12px 0 4px;
}

.streak-panel h3 {
  font-size: 16px;
  color: #ffd9a8;
}

.streak-panel p {
  margin-top: 6px;
  font-size: 12.5px;
  color: #d9b78c;
  line-height: 1.6;
}

.cert-cta {
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 207, 92, 0.5);
  background: linear-gradient(140deg, rgba(255, 207, 92, 0.22), rgba(255, 122, 24, 0.1));
  text-align: center;
}

.cert-cta .big {
  font-size: 30px;
}

.cert-cta h3 {
  margin-top: 6px;
  font-size: 18px;
  color: #ffe3a3;
}

.cert-cta p {
  margin-top: 5px;
  font-size: 12.5px;
  color: #e2c38a;
}

.terms {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: term;
}

.terms li {
  position: relative;
  padding: 0 0 0 34px;
  margin-bottom: 13px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #c9d5e8;
}

.terms li::before {
  counter-increment: term;
  content: counter(term);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: rgba(255, 176, 32, 0.15);
  border: 1px solid rgba(255, 176, 32, 0.32);
  color: #ffd58a;
  font-size: 11px;
  font-weight: 800;
}

.field {
  margin-top: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}

.field input:focus {
  border-color: rgba(255, 176, 32, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.12);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #c9d5e8;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--amber);
  flex: none;
}

.signed-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 15px;
  border: 1px dashed rgba(255, 176, 32, 0.4);
  background: rgba(255, 176, 32, 0.06);
}

.signed-box .sig {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #d9c39a;
}

.signed-box .sig b {
  color: #ffe3a3;
  font-weight: 800;
}

.history {
  margin-top: 12px;
}

.hrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.hrow:last-child {
  border-bottom: none;
}

.hrow .hdate {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}

.hrow .hscore {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hrow .hscore.ok {
  color: #9df0c9;
}

.hrow .hscore.no {
  color: #ffb4c0;
}

.hrow .htag {
  font-size: 10.5px;
  color: var(--muted);
}

.cert-wrap {
  padding: 4px;
}

.cert {
  position: relative;
  padding: 24px 20px 20px;
  border-radius: 18px;
  color: #3c2a10;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(150deg, #fffaf0 0%, #fdf1d6 55%, #f8e5bb 100%);
  border: 2px solid #d8ab52;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.cert::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(184, 134, 11, 0.45);
  border-radius: 12px;
  pointer-events: none;
}

.cert::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(184, 134, 11, 0.05) 0 2px,
    transparent 2px 9px
  );
  pointer-events: none;
}

.cert-head {
  position: relative;
  text-align: center;
}

.cert-head .kicker {
  font-size: 10.5px;
  letter-spacing: 4px;
  color: #a97b2a;
  font-weight: 700;
}

.cert-head h2 {
  margin-top: 6px;
  font-size: 27px;
  letter-spacing: 5px;
  font-weight: 900;
  color: #6b4a12;
}

.cert-head .rule {
  width: 64px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #c89a3c, transparent);
}

.cert-body {
  position: relative;
  margin-top: 18px;
  font-size: 13.5px;
  line-height: 1.9;
}

.cert-body .line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.cert-body .name {
  font-size: 17px;
  font-weight: 900;
  color: #7a1f12;
  border-bottom: 1.5px solid #c89a3c;
  padding: 0 8px;
  min-width: 90px;
  text-align: center;
}

.cert-scores {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 12px;
}

.cert-scores th,
.cert-scores td {
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(184, 134, 11, 0.35);
  text-align: center;
}

.cert-scores th {
  color: #8a6520;
  font-weight: 700;
  font-size: 11px;
}

.cert-scores td {
  font-variant-numeric: tabular-nums;
}

.cert-scores td.s {
  font-weight: 900;
  color: #7a1f12;
  font-size: 14px;
}

.cert-foot {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.cert-code {
  font-size: 11px;
  line-height: 1.8;
  color: #7d5a1b;
}

.cert-code b {
  display: block;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: #6b4a12;
}

.seal {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  flex: none;
  border: 3px solid #b52c20;
  border-radius: 50%;
  color: #b52c20;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  transform: rotate(-11deg);
  opacity: 0.88;
  box-shadow: inset 0 0 0 2px rgba(181, 44, 32, 0.18);
}

.seal span {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
}

.cert-amount {
  position: absolute;
  top: 62px;
  right: 16px;
  padding: 5px 10px;
  border: 1.5px solid #b52c20;
  border-radius: 6px;
  color: #b52c20;
  font-size: 15px;
  font-weight: 900;
  transform: rotate(4deg);
  opacity: 0.9;
}

.cert-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(184, 134, 11, 0.1);
  color: #7d5a1b;
  font-size: 10.5px;
  line-height: 1.6;
}

.cert-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.progress-cert {
  padding: 18px;
  text-align: center;
}

.progress-cert .big-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 8px;
}

.progress-cert .big-dots .dot {
  width: 30px;
  height: 30px;
}

.progress-cert h3 {
  font-size: 17px;
}

.progress-cert p {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.wrong-item {
  padding: 15px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 10px;
}

.wrong-item .wq {
  font-size: 14.5px;
  line-height: 1.6;
}

.wrong-item .wmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.wrong-item .wa {
  font-size: 12.5px;
  color: #9df0c9;
}

.wrong-item .wexp {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
}

.wrong-item details summary {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
}

.wrong-item details summary::-webkit-details-marker {
  display: none;
}

.empty {
  padding: 34px 18px;
  text-align: center;
}

.empty .eicon {
  font-size: 40px;
}

.empty h3 {
  margin-top: 8px;
  font-size: 17px;
}

.empty p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.tip-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
}

.tip-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
}

.tip-card .mnemonic {
  margin-top: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.09);
  color: #ffe0a3;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
}

.tip-card .detail {
  margin-top: 9px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(2, 6, 14, 0.66);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn 0.18s ease both;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line);
  background: #0f1828;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-head h3 {
  font-size: 18px;
  font-weight: 800;
}

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.modal-close {
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 90;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 18px;
  border-radius: 99px;
  background: rgba(15, 24, 40, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 5, 12, 0.94);
  animation: fadeIn 0.18s ease both;
}

.image-viewer img {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  background: #0a1322;
}

.image-viewer-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.confetti {
  position: fixed;
  top: -24px;
  z-index: 85;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 108vh, 0) rotate(720deg);
    opacity: 0.9;
  }
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 10px;
}

.small-note {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

@media (min-width: 720px) {
  #app {
    padding-top: 24px;
  }
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal {
    border-radius: 22px;
  }
}

@media (max-width: 360px) {
  .quick {
    grid-template-columns: 1fr;
  }
  .stat-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .ring {
    width: 146px;
    height: 146px;
  }
  .ring-inner strong {
    font-size: 40px;
  }
}

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

@media print {
  body {
    background: #fff;
  }
  body::before,
  .appbar,
  .actionbar,
  .no-print,
  .foot {
    display: none !important;
  }
  #app {
    max-width: none;
    padding: 0;
  }
  .screen {
    display: none !important;
    animation: none;
  }
  #screen-certificate {
    display: block !important;
  }
  #screen-certificate .appbar {
    display: none !important;
  }
  .cert {
    box-shadow: none;
    border-width: 2px;
    max-width: 520px;
    margin: 0 auto;
  }
  @page {
    margin: 12mm;
  }
}

body.modal-open {
  overflow: hidden;
}

.qtext {
  white-space: pre-wrap;
}

.opt .txt {
  white-space: pre-wrap;
}

.subject-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.subject-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.subject-tab small {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.72;
}

.subject-tab.on {
  color: #08111f;
  background: linear-gradient(135deg, var(--amber), var(--amber-2));
  box-shadow: 0 8px 20px rgba(255, 150, 30, 0.28);
}

.multihint {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
  color: #b8f5dd;
  font-size: 12.5px;
}

.login-wrap {
  padding-top: 8vh;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
  text-align: left;
}

.login-brand .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.login-brand div {
  font-size: 20px;
  font-weight: 800;
}

.login-brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.login-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.login-card .field {
  margin-top: 14px;
}

.login-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.5;
}

