:root {
  --bg: #f7f1e5;
  --paper: #fffdf8;
  --paper-warm: #fff9ec;
  --ink: #29314f;
  --ink-soft: #7d7f92;
  --ink-faint: #a89c89;
  --orange: #ff835a;
  --orange-deep: #ef6b40;
  --yellow: #ffd166;
  --mint: #8fe0c3;
  --mint-deep: #3bb990;
  --blue: #8ccdf5;
  --pink: #ffb5c7;
  --line: rgba(41, 49, 79, 0.12);
  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-display: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-ui);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 6% 12%, rgba(255, 209, 102, 0.33), transparent 25%),
    radial-gradient(circle at 96% 8%, rgba(140, 205, 245, 0.24), transparent 24%),
    radial-gradient(circle at 90% 94%, rgba(143, 224, 195, 0.22), transparent 26%),
    linear-gradient(155deg, #fcf7ed 0%, #f7f1e5 54%, #f4ecde 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(rgba(41, 49, 79, 0.1) 1px, transparent 1px);
  background-size: 25px 25px;
  opacity: 0.15;
  pointer-events: none;
  content: "";
}

body.is-modal-open {
  overflow: hidden;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #2f6fed;
  outline-offset: 3px;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--ink);
  background: var(--yellow);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Backdrop decoration */

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

.blob {
  position: absolute;
  opacity: 0.72;
  border-radius: 46% 54% 61% 39% / 48% 38% 62% 52%;
  filter: blur(1px);
  animation: blobFloat 16s ease-in-out infinite alternate;
}

.blob--peach {
  top: 23%;
  left: -170px;
  width: 390px;
  height: 350px;
  background: rgba(255, 181, 199, 0.28);
  rotate: -12deg;
}

.blob--mint {
  right: -160px;
  bottom: 8%;
  width: 430px;
  height: 390px;
  background: rgba(143, 224, 195, 0.25);
  rotate: 18deg;
  animation-delay: -5s;
}

.blob--blue {
  top: -150px;
  right: 12%;
  width: 420px;
  height: 340px;
  background: rgba(140, 205, 245, 0.18);
  rotate: 8deg;
  animation-delay: -10s;
}

.doodle {
  position: absolute;
  color: rgba(41, 49, 79, 0.12);
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1;
  user-select: none;
}

.doodle--plus {
  top: 39%;
  left: 3.3%;
  color: rgba(255, 131, 90, 0.22);
  font-size: 70px;
  rotate: -11deg;
}

.doodle--minus {
  top: 67%;
  left: 7%;
  color: rgba(41, 49, 79, 0.13);
  font-size: 48px;
  rotate: 13deg;
}

.doodle--equals {
  top: 46%;
  right: 4.2%;
  color: rgba(59, 185, 144, 0.2);
  font-size: 58px;
  rotate: 8deg;
}

.doodle--number {
  right: 8.5%;
  bottom: 15%;
  color: rgba(255, 131, 90, 0.14);
  font-size: 76px;
  rotate: 16deg;
}

.doodle--star {
  top: 15%;
  left: 12%;
  color: rgba(255, 193, 77, 0.45);
  font-size: 26px;
  rotate: 10deg;
}

.doodle--star-small {
  right: 14%;
  bottom: 29%;
  color: rgba(255, 193, 77, 0.42);
  font-size: 16px;
}

/* Header */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  color: #fffdf8;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: linear-gradient(145deg, #ff9b70, #ff7b52);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-plus {
  position: absolute;
  top: 4px;
  left: 9px;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
}

.brand-minus {
  position: absolute;
  right: 9px;
  bottom: 7px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.86;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-title {
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1.2;
}

.brand-sub {
  color: var(--ink-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  line-height: 1.4;
}

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

.icon-button,
.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  color: var(--ink);
  border: 1.5px solid rgba(41, 49, 79, 0.13);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 3px 0 rgba(41, 49, 79, 0.07);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.icon-button {
  width: 48px;
  padding: 0;
}

.icon-button:hover,
.toolbar-button:hover {
  border-color: rgba(41, 49, 79, 0.24);
  background: #fffdf8;
  box-shadow: 0 5px 0 rgba(41, 49, 79, 0.09);
  transform: translateY(-2px);
}

.icon-button:active,
.toolbar-button:active {
  box-shadow: 0 2px 0 rgba(41, 49, 79, 0.07);
  transform: translateY(1px);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.toolbar-button {
  gap: 8px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 800;
}

.toolbar-button svg {
  width: 19px;
  height: 19px;
}

.toolbar-button:disabled {
  opacity: 0.55;
  box-shadow: 0 3px 0 rgba(41, 49, 79, 0.05);
  cursor: default;
  pointer-events: none;
  transform: none;
}

/* Main layout */

.main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 18px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

/* Status bar */

.status-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 22px;
  border: 1px solid rgba(41, 49, 79, 0.09);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 10px 28px rgba(41, 49, 79, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.status-progress {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.status-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8c8b9c;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 131, 90, 0.12);
}

.status-count {
  color: #77798d;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-count strong {
  margin: 0 2px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
}

.status-slash {
  margin: 0 3px;
  color: #c2b6a3;
}

.progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede5d7;
  box-shadow: inset 0 1px 2px rgba(41, 49, 79, 0.08);
}

.progress-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffc04d 0%, #ff835a 100%);
  transition: width 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-fill::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  content: "";
  transform: translateX(-100%);
  animation: progressShine 2.8s ease-in-out infinite;
}

.status-divider {
  width: 1px;
  height: 44px;
  border-left: 1px dashed rgba(41, 49, 79, 0.14);
}

.timer-block {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  min-width: 150px;
}

.timer-icon {
  display: grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  place-items: center;
  color: var(--orange-deep);
  border: 1px solid rgba(255, 131, 90, 0.15);
  border-radius: 14px;
  background: #fff5dc;
}

.timer-icon svg {
  width: 22px;
  height: 22px;
}

.timer-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.timer-label {
  color: #9b8e79;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.2;
}

.timer-value {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.035em;
  line-height: 1.12;
}

/* Game card */

.game-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.8fr);
  min-height: clamp(480px, 54vh, 545px);
  overflow: hidden;
  border: 1px solid rgba(41, 49, 79, 0.12);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: 0 10px 0 rgba(41, 49, 79, 0.045), 0 26px 60px rgba(41, 49, 79, 0.09);
}

.game-card:focus {
  outline: none;
}

.question-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 92px 48px 32px;
  background:
    radial-gradient(circle at 10% 16%, rgba(255, 209, 102, 0.3), transparent 28%),
    radial-gradient(circle at 94% 86%, rgba(143, 224, 195, 0.2), transparent 26%),
    var(--paper-warm);
}

.question-panel::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(390px, 74%);
  aspect-ratio: 1;
  border: 2px dashed rgba(255, 131, 90, 0.14);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translate(-50%, -49%) rotate(-7deg);
}

.question-panel::after {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(41, 49, 79, 0.12) 1px, transparent 1px);
  background-size: 19px 19px;
  opacity: 0.22;
  pointer-events: none;
  content: "";
  mask-image: radial-gradient(circle at 50% 52%, #000 0, transparent 68%);
  -webkit-mask-image: radial-gradient(circle at 50% 52%, #000 0, transparent 68%);
}

.mascot--game {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 2;
  width: 86px;
  height: 86px;
  filter: drop-shadow(0 5px 0 rgba(41, 49, 79, 0.07));
  transform: rotate(-8deg);
  animation: mascotBob 4.8s ease-in-out infinite;
}

.mode-chip {
  position: absolute;
  top: 29px;
  right: 28px;
  z-index: 2;
  padding: 7px 15px;
  color: #206e57;
  border: 1px solid rgba(32, 110, 87, 0.15);
  border-radius: 999px;
  background: #ddf6ec;
  box-shadow: 0 3px 0 rgba(32, 110, 87, 0.07);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease;
}

.mode-chip.is-subtract {
  color: #a94734;
  border-color: rgba(169, 71, 52, 0.14);
  background: #ffe6e0;
  box-shadow: 0 3px 0 rgba(169, 71, 52, 0.06);
}

.question-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.question-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 15px;
  color: #8c806d;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.question-label span {
  display: block;
  width: 25px;
  height: 1px;
  background: #d8ccb9;
}

.equation {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.36em;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  will-change: transform;
}

.eq-number {
  font-size: clamp(4.4rem, 8.2vw, 7.4rem);
  font-weight: 900;
  letter-spacing: -0.055em;
}

.eq-operator {
  margin: 0 0.09em;
  color: var(--orange);
  font-size: clamp(3rem, 5.3vw, 4.9rem);
  font-weight: 900;
  transform: translateY(-0.02em);
}

.eq-equals {
  margin: 0 0.12em 0 0.18em;
  color: #a99d88;
  font-size: clamp(2.8rem, 4.8vw, 4.4rem);
  font-weight: 900;
}

.eq-unknown {
  display: grid;
  width: 1.27em;
  height: 1.27em;
  place-items: center;
  color: var(--orange);
  border: 3px dashed rgba(255, 131, 90, 0.72);
  border-radius: 27%;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 6px 0 rgba(255, 131, 90, 0.09);
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 4.8vw, 4.4rem);
  font-weight: 900;
  line-height: 1;
  animation: unknownPulse 2.8s ease-in-out infinite;
}

.equation.is-correct .eq-unknown {
  color: #1b654f;
  border-color: #3bb990;
  border-style: solid;
  background: #d7f7eb;
  box-shadow: 0 5px 0 rgba(59, 185, 144, 0.16);
  animation: correctUnknown 450ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.equation.is-shaking {
  animation: equationShake 380ms ease;
}

.mascot--game.is-cheering {
  animation: mascotCheer 650ms ease;
}

.feedback {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 25px;
  margin-top: 24px;
  color: #928570;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: color 180ms ease;
}

.feedback-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8cab2;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.feedback.is-correct {
  color: #268266;
  font-weight: 800;
}

.feedback.is-correct .feedback-dot {
  background: var(--mint-deep);
  box-shadow: 0 0 0 5px rgba(59, 185, 144, 0.14);
  animation: dotPop 350ms ease;
}

.feedback.is-wrong {
  color: #cf543e;
  font-weight: 800;
}

.feedback.is-wrong .feedback-dot {
  background: #ff8269;
  box-shadow: 0 0 0 5px rgba(255, 131, 90, 0.14);
  animation: dotPop 350ms ease;
}

/* Answers */

.answer-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px clamp(24px, 3.2vw, 40px) 28px;
  border-left: 1px dashed #e4d8c5;
  background: linear-gradient(180deg, #fffdf8 0%, #fffcf5 100%);
}

.answer-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.answer-kicker {
  margin: 0 0 5px;
  color: #a59883;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.answer-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.answer-range {
  flex: 0 0 auto;
  padding: 6px 12px;
  color: #8c7d64;
  border: 1px solid rgba(140, 125, 100, 0.08);
  border-radius: 999px;
  background: #f6eedf;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.answer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.answer-button {
  position: relative;
  flex: 0 0 calc((100% - 30px) / 4);
  min-height: 78px;
  padding: 0;
  color: var(--ink);
  border: 1.5px solid rgba(41, 49, 79, 0.14);
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 4px 0 rgba(41, 49, 79, 0.085);
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.3vw, 2.15rem);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease, opacity 160ms ease, color 160ms ease;
}

.answer-button:nth-child(4n + 1) {
  background: #fff8e4;
}

.answer-button:nth-child(4n + 2) {
  background: #f1f9ff;
}

.answer-button:nth-child(4n + 3) {
  background: #f1fbf6;
}

.answer-button:nth-child(4n) {
  background: #fff3f6;
}

.answer-button:hover:not(:disabled) {
  z-index: 1;
  border-color: rgba(41, 49, 79, 0.34);
  box-shadow: 0 7px 0 rgba(41, 49, 79, 0.11);
  transform: translateY(-3px);
}

.answer-button:active:not(:disabled) {
  box-shadow: 0 2px 0 rgba(41, 49, 79, 0.09);
  transform: translateY(1px);
}

.answer-button:disabled {
  cursor: default;
}

.answer-button.is-correct {
  z-index: 2;
  color: #134c3b;
  border-color: #1e7157;
  background: var(--mint) !important;
  box-shadow: 0 5px 0 #1e7157;
  transform: translateY(-1px) scale(1.025);
  animation: correctPop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.35);
}

.answer-button.is-correct::after {
  position: absolute;
  top: 7px;
  right: 10px;
  color: #155b45;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 900;
  content: "✓";
}

.answer-button.is-wrong {
  color: #ad4432;
  border-color: #dd745f;
  background: #ffe5df !important;
  box-shadow: none;
  opacity: 0.72;
  pointer-events: none;
  animation: wrongShake 380ms ease;
}

.answer-button.is-wrong::after {
  position: absolute;
  top: 5px;
  right: 10px;
  color: #c25945;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 800;
  content: "×";
}

.answer-grid.is-locked .answer-button {
  pointer-events: none;
}

.answer-grid.is-locked .answer-button:not(.is-correct) {
  opacity: 0.42;
  filter: saturate(0.65);
}

.answer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 20px 0 0;
  color: #a19480;
  font-size: 11.5px;
  font-weight: 600;
}

.answer-note svg {
  width: 14px;
  height: 14px;
  color: #b6a78e;
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px 28px;
  color: #a39784;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
}

.footer-spark {
  color: #e7b94b;
  font-size: 11px;
}

/* Overlays and modals */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  overflow-y: auto;
  padding: 24px;
  place-items: center;
  background: rgba(41, 49, 79, 0.43);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  animation: overlayIn 240ms ease both;
}

.modal {
  position: relative;
  z-index: 2;
  width: min(530px, 100%);
  padding: 32px 38px 28px;
  overflow: hidden;
  border: 2px solid rgba(41, 49, 79, 0.11);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 14px 0 rgba(24, 29, 48, 0.12), 0 36px 90px rgba(24, 29, 48, 0.3);
  text-align: center;
  animation: modalIn 420ms cubic-bezier(0.18, 0.9, 0.25, 1.16) both;
}

.modal::before {
  position: absolute;
  top: -110px;
  left: 50%;
  width: 300px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.21), transparent 68%);
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.modal-kicker {
  position: relative;
  margin: 0 0 7px;
  color: #a5967f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.modal h1,
.modal h2 {
  position: relative;
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 3vw, 33px);
  font-weight: 900;
  letter-spacing: 0.015em;
  line-height: 1.28;
}

.modal-description {
  position: relative;
  margin: 12px 0 0;
  color: #7e776b;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.82;
}

.modal-description strong {
  color: var(--ink);
  font-weight: 800;
}

.modal-footnote {
  position: relative;
  margin: 12px 0 0;
  color: #afa18d;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.start-badge {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  color: #7c5310;
  border: 1.5px solid rgba(125, 82, 12, 0.22);
  border-radius: 10px;
  background: #ffe6a3;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  rotate: -2deg;
}

.start-modal:focus {
  outline: none;
}

.start-mascot,
.finish-mascot {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff9e9 0 56%, transparent 57%),
    repeating-conic-gradient(from 0deg, rgba(255, 209, 102, 0.25) 0deg 8deg, transparent 8deg 22deg);
}

.start-mascot svg,
.finish-mascot svg {
  width: 94px;
  height: 94px;
  filter: drop-shadow(0 5px 0 rgba(41, 49, 79, 0.07));
  animation: mascotBob 4.5s ease-in-out infinite;
}

.finish-mascot {
  width: 132px;
  height: 132px;
  margin-top: 1px;
}

.finish-mascot svg {
  width: 106px;
  height: 106px;
}

.mascot-spark {
  position: absolute;
  z-index: 2;
  color: #f3b72f;
  font-size: 17px;
  animation: twinkle 2.2s ease-in-out infinite;
}

.mascot-spark--one {
  top: 5px;
  left: 5px;
}

.mascot-spark--two {
  right: 4px;
  bottom: 17px;
  font-size: 12px;
  animation-delay: -0.8s;
}

.mascot-spark--three {
  top: 17px;
  right: 15px;
  font-size: 12px;
  animation-delay: -1.4s;
}

.feature-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 19px 0 0;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  color: #8a7d69;
  border: 1px solid rgba(41, 49, 79, 0.075);
  border-radius: 999px;
  background: #f8f2e7;
  font-size: 10.5px;
  font-weight: 700;
}

.feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.feature-dot--orange {
  background: var(--orange);
}

.feature-dot--mint {
  background: var(--mint-deep);
}

.feature-dot--blue {
  background: #55aae0;
}

.primary-button,
.secondary-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 18px;
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: 0.035em;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease, background-color 160ms ease;
}

.primary-button {
  color: #fff;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #ff966d, #ff7b52);
  box-shadow: 0 5px 0 var(--ink);
}

.primary-button:hover {
  box-shadow: 0 7px 0 var(--ink);
  filter: saturate(1.06);
  transform: translateY(-2px);
}

.primary-button:active {
  box-shadow: 0 2px 0 var(--ink);
  transform: translateY(3px);
}

.primary-button svg {
  width: 20px;
  height: 20px;
}

.start-button {
  width: min(306px, 100%);
  margin-top: 22px;
}

.start-button svg {
  transition: transform 180ms ease;
}

.start-button:hover svg {
  transform: translateX(3px);
}

.bank-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 7px 12px;
  color: #7f725d;
  border: 1px solid rgba(41, 49, 79, 0.1);
  border-radius: 999px;
  background: #faf5ea;
  box-shadow: 0 2px 0 rgba(41, 49, 79, 0.05);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.bank-link:hover {
  color: var(--ink);
  border-color: rgba(41, 49, 79, 0.18);
  background: #f6edde;
  box-shadow: 0 4px 0 rgba(41, 49, 79, 0.07);
  transform: translateY(-1px);
}

.bank-link:active {
  box-shadow: 0 1px 0 rgba(41, 49, 79, 0.05);
  transform: translateY(1px);
}

.bank-link-count {
  padding: 2px 7px;
  color: #9b7a3c;
  border: 1px solid rgba(155, 122, 60, 0.13);
  border-radius: 999px;
  background: #fff6df;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.secondary-button {
  color: var(--ink);
  border: 1.5px solid rgba(41, 49, 79, 0.17);
  background: #fffdf8;
  box-shadow: 0 4px 0 rgba(41, 49, 79, 0.09);
}

.secondary-button:hover {
  background: #faf4e9;
  box-shadow: 0 6px 0 rgba(41, 49, 79, 0.11);
  transform: translateY(-2px);
}

.secondary-button:active {
  box-shadow: 0 2px 0 rgba(41, 49, 79, 0.09);
  transform: translateY(1px);
}

/* Finish */

.finish-modal {
  width: min(510px, 100%);
  padding-top: 27px;
}

.finish-halo {
  position: absolute;
  top: -115px;
  left: 50%;
  width: 360px;
  height: 310px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.33), transparent 68%);
  pointer-events: none;
  transform: translateX(-50%);
}

.final-time-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(300px, 100%);
  margin: 20px auto 0;
  padding: 13px 20px 12px;
  border: 1.5px dashed rgba(215, 170, 73, 0.5);
  border-radius: 20px;
  background: #fff8e6;
}

.final-time-label {
  color: #a18d68;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.final-time-card strong {
  margin: 1px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.025em;
  line-height: 1.1;
}

.final-time-text {
  color: #a08d70;
  font-size: 11px;
  font-weight: 600;
}

.finish-modal .primary-button {
  width: min(280px, 100%);
  margin-top: 19px;
}

.button-spark {
  color: #ffe18d;
}

/* Confirm */

.confirm-modal {
  width: min(460px, 100%);
  padding-top: 30px;
}

.confirm-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 15px;
  place-items: center;
  color: var(--orange-deep);
  border: 1px solid rgba(255, 131, 90, 0.18);
  border-radius: 20px;
  background: #fff3da;
  box-shadow: 0 4px 0 rgba(255, 131, 90, 0.08);
  transform: rotate(-4deg);
}

.confirm-icon svg {
  width: 29px;
  height: 29px;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 23px;
}

/* Question bank */

.modal.bank-modal {
  display: flex;
  flex-direction: column;
  width: min(940px, 100%);
  max-height: min(88vh, 900px);
  max-height: min(88dvh, 900px);
  padding: 27px 32px 18px;
  overflow: hidden;
  text-align: left;
}

.bank-header {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.bank-header h2 {
  text-align: left;
}

.bank-subtitle {
  position: relative;
  margin: 7px 0 0;
  color: #8f826e;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bank-subtitle strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
}

.bank-close {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #84765f;
  border: 1.5px solid rgba(41, 49, 79, 0.14);
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 3px 0 rgba(41, 49, 79, 0.07);
  font-family: var(--font-ui);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.bank-close:hover {
  color: var(--ink);
  background: #fbf5e9;
  box-shadow: 0 5px 0 rgba(41, 49, 79, 0.09);
  transform: translateY(-2px);
}

.bank-close:active {
  box-shadow: 0 1px 0 rgba(41, 49, 79, 0.08);
  transform: translateY(1px);
}

.bank-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: 14px -8px 0 0;
  padding-right: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d8ccb8 transparent;
  scrollbar-width: thin;
}

.bank-scroll:focus-visible {
  outline: 3px solid #2f6fed;
  outline-offset: 2px;
  border-radius: 8px;
}

.bank-scroll::-webkit-scrollbar {
  width: 7px;
}

.bank-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.bank-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #ded2bd;
}

.bank-section + .bank-section {
  margin-top: 21px;
  padding-top: 18px;
  border-top: 1px dashed #e4d8c5;
}

.bank-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.bank-section-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.bank-section-title > span {
  padding: 3px 9px;
  color: #9a8b73;
  border-radius: 999px;
  background: #f6eedf;
  font-size: 10px;
  font-weight: 700;
}

.bank-section-title strong {
  color: #7f715b;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.bank-item {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: 6px 8px;
  color: #3e4561;
  border: 1px solid rgba(41, 49, 79, 0.09);
  border-radius: 10px;
  background: #fbf7ee;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.bank-result {
  color: var(--orange-deep);
  font-weight: 900;
}

.bank-note {
  flex: 0 0 auto;
  margin: 14px 0 0;
  padding-top: 12px;
  color: #a19480;
  border-top: 1px dashed #e4d8c5;
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
}

/* Confetti */

.confetti-piece {
  position: fixed;
  z-index: 30;
  width: 9px;
  height: 13px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiBurst var(--duration, 900ms) cubic-bezier(0.1, 0.65, 0.3, 1) forwards;
}

.overlay .confetti-piece {
  z-index: 1;
}

.confetti-fall {
  position: fixed;
  top: -22px;
  z-index: 1;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall var(--duration, 2400ms) linear var(--delay, 0ms) forwards;
}

/* Animations */

@keyframes blobFloat {
  from {
    transform: translate3d(0, -10px, 0) scale(1);
  }
  to {
    transform: translate3d(20px, 18px, 0) scale(1.04);
  }
}

@keyframes progressShine {
  0%,
  55% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes mascotBob {
  0%,
  100% {
    transform: translateY(0) rotate(-8deg);
  }
  50% {
    transform: translateY(-7px) rotate(-4deg);
  }
}

@keyframes mascotCheer {
  0%,
  100% {
    transform: translateY(0) rotate(-8deg) scale(1);
  }
  30% {
    transform: translateY(-10px) rotate(5deg) scale(1.08);
  }
  62% {
    transform: translateY(-4px) rotate(-10deg) scale(1.02);
  }
}

@keyframes unknownPulse {
  0%,
  100% {
    box-shadow: 0 6px 0 rgba(255, 131, 90, 0.09), 0 0 0 0 rgba(255, 131, 90, 0.12);
  }
  50% {
    box-shadow: 0 6px 0 rgba(255, 131, 90, 0.09), 0 0 0 9px rgba(255, 131, 90, 0);
  }
}

@keyframes correctUnknown {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes equationShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px) rotate(-1deg);
  }
  42% {
    transform: translateX(7px) rotate(1deg);
  }
  64% {
    transform: translateX(-4px);
  }
  82% {
    transform: translateX(2px);
  }
}

@keyframes dotPop {
  0% {
    transform: scale(0.6);
  }
  65% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes correctPop {
  0% {
    transform: translateY(-1px) scale(0.94);
  }
  55% {
    transform: translateY(-1px) scale(1.08);
  }
  100% {
    transform: translateY(-1px) scale(1.025);
  }
}

@keyframes wrongShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
}

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

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.8) rotate(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.15) rotate(16deg);
  }
}

@keyframes confettiBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(0.75);
  }
}

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

/* Responsive */

@media (max-width: 980px) {
  .game-card {
    grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
    min-height: clamp(460px, 53vh, 520px);
  }

  .question-panel {
    padding: 86px 32px 28px;
  }

  .answer-panel {
    padding: 28px 24px 24px;
  }

  .answer-button {
    min-height: 72px;
  }

  .mascot--game {
    width: 74px;
    height: 74px;
    top: 21px;
    left: 22px;
  }

  .mode-chip {
    top: 26px;
    right: 22px;
  }
}

@media (max-width: 820px) {
  .topbar,
  .main {
    width: calc(100% - 32px);
  }

  .game-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .question-panel {
    min-height: 340px;
    padding: 84px 32px 26px;
  }

  .answer-panel {
    padding: 24px 26px 23px;
    border-top: 1px dashed #e4d8c5;
    border-left: 0;
  }

  .answer-grid {
    gap: 8px;
  }

  .answer-button {
    flex-basis: calc((100% - 40px) / 6);
    min-height: 64px;
    border-radius: 15px;
    font-size: clamp(1.3rem, 3vw, 1.7rem);
  }

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

@media (max-width: 620px) {
  .topbar {
    width: calc(100% - 28px);
    padding: 17px 0 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .brand-plus {
    top: 2px;
    left: 7px;
    font-size: 27px;
  }

  .brand-minus {
    right: 8px;
    bottom: 5px;
    font-size: 21px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-sub {
    font-size: 9.5px;
    letter-spacing: 0.07em;
  }

  .toolbar {
    gap: 7px;
  }

  .icon-button,
  .toolbar-button {
    width: 44px;
    min-height: 44px;
    border-radius: 14px;
  }

  .toolbar-button {
    padding: 0;
  }

  .toolbar-button span {
    display: none;
  }

  .main {
    width: calc(100% - 24px);
    gap: 12px;
  }

  .status-bar {
    gap: 12px;
    padding: 12px 15px;
    border-radius: 18px;
  }

  .status-progress {
    gap: 7px;
  }

  .status-meta {
    gap: 8px;
  }

  .status-label {
    display: none;
  }

  .status-count {
    font-size: 12.5px;
  }

  .status-count strong {
    font-size: 18px;
  }

  .progress-track {
    height: 8px;
  }

  .status-divider {
    display: none;
  }

  .timer-block {
    gap: 8px;
    min-width: 0;
  }

  .timer-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .timer-icon svg {
    width: 18px;
    height: 18px;
  }

  .timer-label {
    font-size: 8.5px;
  }

  .timer-value {
    font-size: 21px;
  }

  .game-card {
    border-radius: 24px;
    box-shadow: 0 7px 0 rgba(41, 49, 79, 0.04), 0 18px 42px rgba(41, 49, 79, 0.08);
  }

  .question-panel {
    min-height: 290px;
    padding: 74px 18px 20px;
  }

  .mascot--game {
    top: 16px;
    left: 16px;
    width: 62px;
    height: 62px;
  }

  .mode-chip {
    top: 20px;
    right: 16px;
    padding: 6px 12px;
    font-size: 10.5px;
  }

  .question-label {
    gap: 8px;
    margin-bottom: 13px;
    font-size: 11.5px;
  }

  .question-label span {
    width: 17px;
  }

  .eq-number {
    font-size: clamp(3.35rem, 16vw, 4.5rem);
  }

  .eq-operator {
    font-size: clamp(2.4rem, 10vw, 3.2rem);
  }

  .eq-equals {
    font-size: clamp(2.2rem, 9vw, 2.9rem);
  }

  .eq-unknown {
    border-width: 2.5px;
    border-radius: 24%;
    font-size: clamp(2.2rem, 9vw, 2.9rem);
  }

  .feedback {
    min-height: 21px;
    margin-top: 17px;
    font-size: 12.5px;
  }

  .answer-panel {
    padding: 20px 16px 18px;
  }

  .answer-heading {
    margin-bottom: 15px;
  }

  .answer-kicker {
    font-size: 8.5px;
    margin-bottom: 3px;
  }

  .answer-heading h2 {
    font-size: 21px;
  }

  .answer-range {
    padding: 5px 10px;
    font-size: 10.5px;
  }

  .answer-grid {
    gap: 8px;
  }

  .answer-button {
    flex-basis: calc((100% - 24px) / 4);
    min-height: 58px;
    border-radius: 15px;
    font-size: 1.7rem;
  }

  .answer-button.is-correct::after {
    top: 4px;
    right: 7px;
    font-size: 11px;
  }

  .answer-note {
    margin-top: 14px;
    font-size: 10.5px;
  }

  .footer {
    padding: 16px 12px 22px;
    font-size: 10.5px;
  }

  .overlay {
    padding: 14px;
  }

  .modal {
    padding: 25px 20px 22px;
    border-radius: 26px;
  }

  .modal h1,
  .modal h2 {
    font-size: 24px;
  }

  .modal-description {
    margin-top: 9px;
    font-size: 12.5px;
    line-height: 1.72;
  }

  .start-mascot {
    width: 94px;
    height: 94px;
    margin-bottom: 9px;
  }

  .start-mascot svg {
    width: 76px;
    height: 76px;
  }

  .finish-mascot {
    width: 106px;
    height: 106px;
    margin-bottom: 7px;
  }

  .finish-mascot svg {
    width: 86px;
    height: 86px;
  }

  .start-badge {
    margin-bottom: 7px;
    font-size: 9.5px;
  }

  .feature-row {
    gap: 6px;
    margin-top: 15px;
  }

  .feature-pill {
    padding: 6px 9px;
    font-size: 9.5px;
  }

  .primary-button,
  .secondary-button {
    min-height: 51px;
    border-radius: 16px;
    font-size: 15px;
  }

  .start-button {
    margin-top: 17px;
  }

  .modal-footnote {
    margin-top: 9px;
    font-size: 9.5px;
  }

  .modal.bank-modal {
    max-height: calc(100dvh - 28px);
    padding: 22px 16px 14px;
  }

  .bank-header {
    gap: 12px;
  }

  .bank-subtitle {
    font-size: 11px;
  }

  .bank-close {
    width: 38px;
    height: 38px;
    font-size: 23px;
  }

  .bank-scroll {
    margin-top: 12px;
    padding-right: 6px;
  }

  .bank-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 7px;
  }

  .bank-item {
    min-height: 34px;
    padding: 5px 6px;
    font-size: 12.5px;
  }

  .bank-section + .bank-section {
    margin-top: 17px;
    padding-top: 15px;
  }

  .bank-note {
    margin-top: 11px;
    padding-top: 10px;
    font-size: 9.5px;
  }

  .finish-modal {
    padding-top: 22px;
  }

  .final-time-card {
    margin-top: 15px;
    padding: 11px 16px;
  }

  .final-time-card strong {
    font-size: 36px;
  }

  .finish-modal .primary-button {
    margin-top: 16px;
  }

  .confirm-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 12px;
    border-radius: 17px;
  }

  .confirm-actions {
    margin-top: 18px;
    gap: 8px;
  }

  .confirm-actions .primary-button,
  .confirm-actions .secondary-button {
    padding: 0 12px;
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .brand-title {
    font-size: 18px;
  }

  .status-count {
    font-size: 11.5px;
  }

  .timer-icon {
    display: none;
  }

  .timer-value {
    font-size: 20px;
  }

  .question-panel {
    min-height: 270px;
  }

  .eq-number {
    font-size: 3.25rem;
  }

  .eq-operator {
    font-size: 2.25rem;
  }

  .eq-equals {
    font-size: 2.05rem;
  }

  .eq-unknown {
    font-size: 2.05rem;
  }

  .answer-button {
    min-height: 54px;
  }

  .footer-spark {
    display: none;
  }
}

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

  .confetti-piece,
  .confetti-fall {
    display: none !important;
  }
}
