/* ============================================================
   元件樣式：按鈕、卡片、答題、數字鍵盤、對話框、結算、圖鑑
   ============================================================ */

/* ---------- 按鈕 ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 20px;
  border: 3px solid transparent;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #8467ff, var(--violet-dark));
  box-shadow: 0 5px 0 #3b25a3, 0 8px 16px rgba(82, 54, 212, 0.3);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--primary:active:not(:disabled) { box-shadow: 0 2px 0 #3b25a3; transform: translateY(3px); }
.btn--soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--ink); }
.btn--soft:hover:not(:disabled) { filter: brightness(0.97); }
.btn--ghost { background: rgba(255, 255, 255, 0.92); border-color: var(--line); }
.btn--ghost:hover:not(:disabled) { border-color: var(--violet); }
.btn--danger { color: #fff; background: var(--red); box-shadow: 0 4px 0 #a02845; }
.btn--xl { min-height: 64px; padding: 12px 38px; font-size: 24px; }
.btn--sm { min-height: 44px; padding: 6px 14px; font-size: 15px; }
.btn--icon { min-width: 48px; min-height: 48px; padding: 0; font-size: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.94); border-color: var(--line); }

.icon-btn {
  position: relative;
  overflow: hidden;
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--violet-dark);
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: var(--violet-soft); }
.icon-btn:active { transform: scale(0.92); }

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(109, 74, 255, 0.28);
  transform: scale(0);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--line);
  font-weight: 800;
}
.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

/* ---------- 關卡卡片 ---------- */
.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 150px;
  padding: 12px 12px 10px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.level-card:hover:not(.level-card--locked) { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--zone, var(--violet)); }
.level-card__num {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink-soft);
}
.level-card__icon { font-size: 34px; line-height: 1; }
.level-card__title { font-weight: 900; font-size: 17px; line-height: 1.25; }
.level-card__concept { font-size: 13px; line-height: 1.35; color: var(--ink-soft); font-weight: 600; flex: 1; }
.level-card__foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; min-height: 22px; }
.star { font-size: 20px; color: #c9bddb; }
.star--on { color: #f5a300; text-shadow: 0 1px 0 #fff3c4; }
.level-card--done { background: linear-gradient(180deg, #fff, var(--zone-soft, var(--violet-soft))); border-color: var(--zone-soft, var(--line)); }
.level-card--current {
  border-color: var(--zone, var(--violet));
  box-shadow: 0 0 0 4px var(--zone-soft, var(--violet-soft)), var(--shadow);
  animation: pulse-ring 2s ease-in-out infinite;
}
.level-card--locked { background: #efe9f6; color: #6a5d7e; cursor: pointer; }
.level-card--locked .level-card__icon { filter: grayscale(1); opacity: 0.55; }
.level-card__lock { font-size: 13px; font-weight: 800; color: #5f5075; }
.level-card__best { font-size: 12px; font-weight: 700; color: var(--ink-soft); }

/* ---------- 計時、分數、進度點 ---------- */
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dots__dot {
  width: 22px;
  height: 10px;
  border-radius: 6px;
  background: #e5dcf3;
  transition: background 0.2s ease, transform 0.2s ease;
}
.dots__dot.is-current { background: var(--accent); transform: scaleY(1.3); }
.dots__dot.is-correct { background: var(--green); }
.dots__dot.is-helped { background: var(--gold); }
.timer {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--line);
}
.timer__track { flex: 1; height: 14px; border-radius: 8px; background: #eadff7; overflow: hidden; }
.timer__bar { height: 100%; width: 100%; border-radius: 8px; background: var(--teal); transform-origin: left; transition: background 0.3s ease; }
.timer[data-state="warn"] .timer__bar { background: var(--gold); }
.timer[data-state="danger"] .timer__bar { background: var(--red); }
.timer[data-state="off"] .timer__bar { background: #b9aed0; }
.timer__text { min-width: 4.5em; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 15px; }
.timer[data-state="danger"] .timer__text { color: var(--red); }
.score-pop {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  font-weight: 900;
  font-size: 22px;
  color: var(--green);
  opacity: 0;
  pointer-events: none;
}
.score-pop.is-on { animation: score-pop 1.2s ease-out forwards; }
.hud__item--combo.is-hot { background: #fff1d6; border-color: #ffb454; }

/* ---------- 題目卡 ---------- */
.question-card {
  padding: 14px 16px 16px;
  border-radius: var(--radius);
  background: #fff;
  border: 3px solid var(--accent-soft);
  box-shadow: var(--shadow);
}
.question-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.question-card__tag { padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); font-weight: 800; font-size: 14px; }
.question-card__prompt { margin: 0; font-size: 21px; line-height: 1.7; font-weight: 700; }

/* 分數堆疊顯示 */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  line-height: 1.1;
  font-weight: 800;
}
.frac__n { padding: 0 4px 2px; border-bottom: 3px solid currentColor; }
.frac__d { padding: 2px 4px 0; }
.mixed { display: inline-flex; align-items: center; vertical-align: middle; margin: 0 2px; }
.frac__w { font-weight: 800; font-size: 1.15em; margin-right: 2px; }

/* ---------- 選擇題 ---------- */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 10px 14px 10px 40px;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}
.choice-btn:hover:not(:disabled) { border-color: var(--violet); background: var(--violet-soft); }
.choice-btn:active:not(:disabled) { transform: scale(0.97); }
.choice-btn__key {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 900;
}
.choice-btn__text { text-align: center; line-height: 1.35; }
.choice-btn__visual svg { width: 100%; max-width: 150px; height: auto; max-height: 100px; }
.choice-btn.is-correct { border-color: var(--green); background: var(--green-soft); animation: pop 0.45s ease; }
.choice-btn.is-wrong { border-color: var(--red); background: var(--red-soft); }
.choice-btn:disabled { cursor: default; }
.choices--visual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices--visual .choice-btn { min-height: 130px; }
.choices--long { grid-template-columns: 1fr; }

/* ---------- 答案區與數字鍵盤 ---------- */
.answer-area { min-width: 0; }
.numpad { padding: 12px; border-radius: var(--radius); background: #fff; border: 3px solid var(--accent-soft); box-shadow: var(--shadow); }
.numpad__fields { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.numpad__field {
  flex: 1 1 90px;
  max-width: 190px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font: inherit;
  color: var(--ink);
  background: #faf6ff;
  border: 3px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}
.numpad__field.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.15); }
.numpad__field-label { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.numpad__value { min-height: 34px; font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.numpad__field.is-active .numpad__value:empty::after { content: ""; display: inline-block; width: 3px; height: 28px; background: var(--accent); animation: blink 1s steps(2) infinite; vertical-align: middle; }
.numpad__unit { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.numpad__keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.numpad__key {
  min-height: 54px;
  padding: 6px;
  font: inherit;
  font-size: 24px;
  font-weight: 900;
  color: var(--ink);
  background: #f4efff;
  border: 3px solid #e1d6f7;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.15s ease;
}
.numpad__key:hover:not(:disabled) { background: var(--violet-soft); }
.numpad__key:active:not(:disabled) { transform: scale(0.94); }
.numpad__key:disabled { opacity: 0.35; }
.numpad__clear { font-size: 17px; background: var(--gold-soft); border-color: #f7da8a; }
.numpad__backspace { background: var(--red-soft); border-color: #f4b5c3; }
.numpad__submit { grid-column: span 3; font-size: 22px; color: #fff; background: linear-gradient(180deg, #8467ff, var(--violet-dark)); border-color: var(--violet-dark); }
.numpad__submit:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(180deg, #8467ff, var(--violet-dark)); }
.numpad--compact .numpad__key { min-height: 48px; font-size: 22px; }

.numpad-fallback { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 角度繪製的微調鈕 */
.angle-tools { padding: 12px; border-radius: var(--radius); background: #fff; border: 3px solid var(--accent-soft); box-shadow: var(--shadow); }
.angle-tools__row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.angle-tools__row .btn { min-width: 64px; }
.angle-tools__tip { margin: 0 0 8px; text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 15px; }
.manip--protractor.is-interactive { touch-action: none; cursor: grab; }
.manip--protractor.is-interactive:focus-visible { outline: 3px solid var(--violet); border-radius: 12px; }
.tick-hit { cursor: pointer; outline: none; }
.tick-hit:hover .tick-dot, .tick-hit:focus-visible .tick-dot { fill: var(--pink-soft); r: 13; }
.tick-hit.is-picked .tick-dot { fill: var(--pink); }
.tick-hit.is-correct .tick-dot { fill: #4cd49a; stroke: var(--green); r: 14; }
.tick-hit.is-wrong .tick-dot { fill: var(--red-soft); stroke: var(--red); }
.play-visual.is-highlighted { animation: glow 1.2s ease-in-out infinite; border-radius: 16px; }

/* 直式 */
.vertical-math {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fffdf5;
  border: 3px dashed #f0d79a;
  text-align: center;
}
.vm { display: inline-block; text-align: right; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 28px; font-weight: 800; white-space: pre; line-height: 1.4; }
.vm__row { display: flex; justify-content: flex-end; gap: 6px; }
.vm__op { width: 1.2em; text-align: center; color: var(--pink); }
.vm__line { height: 4px; border-radius: 2px; background: var(--ink); margin: 4px 0; }
.vertical-math__hint { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); font-weight: 700; }

/* ---------- 回饋面板 ---------- */
.feedback { display: none; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 3px solid var(--line); background: #fff; }
.feedback.is-visible { display: flex; animation: slide-up 0.25s ease both; }
.feedback--correct { background: var(--green-soft); border-color: #8fdcb5; }
.feedback--hint { background: var(--gold-soft); border-color: #f2d27a; }
.feedback--wrong { background: var(--red-soft); border-color: #f2a3b4; }
.feedback--info { background: var(--violet-soft); border-color: #cbbcff; }
.feedback__icon { font-size: 30px; line-height: 1; flex: 0 0 auto; }
.feedback__body { flex: 1; min-width: 0; }
.feedback__body p { margin: 4px 0 0; font-size: 17px; line-height: 1.6; }
.feedback__body strong { font-size: 18px; }
.feedback__small { font-size: 14px !important; color: var(--ink-soft); }
.feedback__next { flex: 0 0 auto; align-self: center; }
.feedback__streak { color: #b45f00; font-weight: 800; }

/* ---------- 分步引導 ---------- */
.steps-panel { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(59, 47, 74, 0.55); }
.steps-panel:not([hidden]) { display: flex; }
.steps__sheet { width: 100%; max-width: 520px; max-height: calc(100dvh - 80px); overflow: auto; padding: 18px; border-radius: 26px; background: #fff; box-shadow: var(--shadow-lg); border: 4px solid var(--gold-soft); animation: slide-up 0.3s ease both; }
.steps__kicker { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--gold-soft); font-weight: 800; font-size: 14px; }
.steps__head h2 { margin: 6px 0 2px; font-size: 22px; }
.steps__progress { font-weight: 800; color: var(--ink-soft); min-height: 1.5em; }
.step__prompt { margin: 8px 0 10px; font-size: 20px; font-weight: 700; line-height: 1.7; }
.step__choices { display: grid; gap: 10px; }
.step__feedback { min-height: 1.6em; margin: 8px 0 0; font-weight: 800; }
.step__feedback.is-correct { color: var(--green); }
.step__feedback.is-wrong { color: var(--red); }
.steps__foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.steps__done { text-align: center; }
.steps__done-icon { font-size: 52px; }
.steps__done p { font-size: 18px; line-height: 1.7; }

/* ---------- 結算 ---------- */
.result__stars { display: flex; justify-content: center; gap: 10px; margin: 8px 0; }
.result__star { font-size: 64px; line-height: 1; color: #d5cbe6; transform: scale(0.4); opacity: 0.2; }
.result__star.star--on { color: #f5a300; text-shadow: 0 3px 0 #fff3c4; animation: star-in 0.6s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: calc(var(--i, 0) * 0.35s + 0.25s); }
.result__star:not(.star--on) { animation: star-dim 0.4s ease forwards; animation-delay: 1.2s; }
.result__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { padding: 8px 6px; border-radius: 16px; background: var(--accent-soft); }
.stat__value { display: block; font-size: 24px; font-weight: 900; color: var(--ink); line-height: 1.2; }
.stat__label { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.stat--new { background: var(--gold-soft); }
.result__friend { margin-top: 10px; }

/* 谷中夥伴卡 */
.friend-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 12px 10px;
  text-align: center;
  font: inherit;
  color: var(--ink);
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
}
.friend-card--locked { background: #efe9f6; cursor: default; color: #5f5075; }
.friend-card--result { flex-direction: row; text-align: left; cursor: default; background: var(--accent-soft); border-color: var(--accent-soft); gap: 14px; }
.friend-card__emoji { font-size: 44px; line-height: 1.1; }
.friend-card--locked .friend-card__emoji { filter: grayscale(1); opacity: 0.5; }
.friend-card__level { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.friend-card__name { margin: 0; font-size: 18px; }
.friend-card__fact { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-soft); font-weight: 600; }
.friend-card:not(.friend-card--locked):not(.friend-card--result):hover { border-color: var(--violet); transform: translateY(-2px); }
.crystal-slot {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed #cbbfe0;
  font-size: 12px;
  font-weight: 900;
  color: #6a5d7e;
}
.crystal-slot img { width: 36px; height: 36px; object-fit: contain; }
.crystal-slot.is-on { border-style: solid; border-color: var(--pink); background: #fff; }

/* ---------- 對話框 ---------- */
.dialog {
  width: min(92vw, 520px);
  max-height: 88dvh;
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/*
 * 對話框開在最上層（top layer），會蓋過頁尾。讓遮罩與對話框都停在頁尾上方，
 * 設定、安裝說明、離開確認開啟時，版權頁尾仍清楚可見、不被變暗。
 * （::backdrop 不一定繼承 CSS 變數，所以這裡直接寫頁尾的最大高度 52px）
 */
.dialog::backdrop { background: rgba(59, 47, 74, 0.55); bottom: 52px; }
.dialog:modal { bottom: 52px; max-height: min(88dvh, calc(100dvh - 52px - 20px)); }
.dialog:modal .dialog__form { max-height: min(88dvh, calc(100dvh - 52px - 20px)); }
.dialog[open] { animation: slide-up 0.25s ease both; display: flex; flex-direction: column; }
.dialog__form { display: flex; flex-direction: column; min-height: 0; max-height: 88dvh; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 6px 20px; }
.dialog__head h2 { margin: 0; font-size: 22px; }
.dialog__body { padding: 8px 20px; overflow-y: auto; }
.dialog__foot { padding: 10px 20px 16px; display: flex; justify-content: flex-end; }
.dialog__foot--split { justify-content: space-between; gap: 10px; }
.dialog__hr { border: 0; border-top: 2px dashed var(--line); margin: 14px 0; }
.dialog__note { margin: 10px 0 4px; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.dialog__version { margin: 2px 0 6px; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.setting { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.setting__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: #f7f3ff;
  border: 3px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}
.setting__toggle[aria-pressed="false"] { background: #f1eef4; color: #5f5075; }
.setting__toggle[aria-pressed="true"] .setting__state { color: var(--green); }
.setting__toggle--danger { background: var(--red-soft); border-color: #f4b5c3; }
.setting__state { font-weight: 900; }
.setting__range { width: 100%; height: 36px; accent-color: var(--violet); cursor: pointer; }
.reset-confirm { margin-top: 8px; padding: 12px; border-radius: 16px; background: var(--red-soft); border: 3px solid #f4b5c3; }
.reset-confirm p { margin: 0 0 8px; font-weight: 700; }
.reset-confirm__actions { display: flex; gap: 10px; justify-content: flex-end; }
.install-steps { margin: 8px 0; padding-left: 22px; line-height: 1.9; font-size: 17px; }
.install-steps li { margin-bottom: 6px; }
.install-note { padding: 10px 12px; border-radius: 14px; background: var(--gold-soft); font-weight: 700; font-size: 15px; }

/* ---------- 其他 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + 18px);
  z-index: 120;
  max-width: min(92vw, 460px);
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--warn { background: #8a4b00; }
.toast--success { background: #12704a; }
.confetti-layer { position: fixed; inset: 0; z-index: 110; pointer-events: none; overflow: hidden; }
.confetti__piece { position: absolute; top: -20px; border-radius: 2px; animation: confetti-fall var(--d, 2s) ease-in forwards; }
.secret-banner { pointer-events: none; position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 20px; background: rgba(59, 47, 74, 0.6); }
.secret-banner__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 34px;
  text-align: center;
  border-radius: 30px;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #e63a8a);
  box-shadow: var(--shadow-lg);
  animation: banner-in 0.6s cubic-bezier(.2, 1.4, .4, 1) both;
}
.secret-banner__card strong { font-size: 30px; }
.secret-banner__card span { font-size: 19px; font-weight: 700; }
.secret-banner__icon { font-size: 44px; }
.noscript { position: fixed; left: 16px; right: 16px; bottom: 70px; z-index: 99; padding: 16px; border-radius: 12px; background: #fff; color: #111; }
.mascot { display: grid; place-items: center; font-size: 80px; }
.mascot__img { width: min(60%, 220px); height: auto; filter: drop-shadow(0 6px 8px rgba(59, 47, 74, 0.25)); }

/* ---------- 計算紙 ---------- */
.scratchpad-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 12px 12px calc(var(--footer-h) + 12px); background: rgba(59, 47, 74, 0.55); }
.scratchpad { width: 100%; max-width: 900px; height: min(560px, calc(100dvh - var(--footer-h) - 30px)); display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: #fff8e8; box-shadow: var(--shadow-lg); }
.scratchpad__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--gold-soft); }
.scratchpad__tip { flex: 1; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.scratchpad__tools { display: flex; gap: 8px; }
.scratchpad__tools .btn[aria-pressed="true"] { background: var(--violet); color: #fff; border-color: var(--violet); }
.scratchpad__canvas { flex: 1; width: 100%; min-height: 0; touch-action: none; cursor: crosshair; background-image: linear-gradient(#f1e6c8 1px, transparent 1px); background-size: 100% 34px; }

@media (max-width: 560px) {
  .question-card__prompt { font-size: 19px; }
  .choice-btn { font-size: 20px; padding-left: 36px; min-height: 64px; }
  .numpad__key { min-height: 52px; font-size: 23px; }
  .btn--xl { font-size: 22px; padding: 12px 28px; }
  .result__star { font-size: 54px; }
  .crystal-slot { width: 36px; height: 36px; }
  .crystal-slot img { width: 30px; height: 30px; }
  .vm { font-size: 24px; }
  /* 計算紙標題列：窄螢幕時說明文字自成一列，避免擠成直排 */
  .scratchpad__tip { order: 3; flex-basis: 100%; font-size: 13px; }
}

/* 分步引導裡的數字鍵盤縮小，確保一個畫面放得下 */
.steps__sheet .numpad { padding: 8px; box-shadow: none; }
.steps__sheet .numpad__field { min-height: 56px; }
.steps__sheet .numpad__keys { gap: 6px; margin-top: 6px; }
.steps__sheet .numpad__key { min-height: 46px; font-size: 21px; }
.steps__sheet .step__prompt { margin: 6px 0 8px; font-size: 19px; }
