:root {
  color-scheme: light;
  --ink: #243d32;
  --soft: #526452;
  --paper: #faf8ee;
  --green: #305d42;
  --line: #d6ddcb;
  --gold: #e1b662;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    17px/1.5 -apple-system,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
}
main {
  max-width: 720px;
  margin: auto;
  padding: 24px clamp(16px, 4vw, 34px) max(38px, env(safe-area-inset-bottom));
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.04em;
  margin: 14px 0 22px;
}
h2 {
  font-size: 23px;
  margin: 18px 0 10px;
}
h3 {
  font-size: 19px;
}
small,
.meta {
  color: var(--soft);
  font-size: 14px;
}
.top,
.line,
.actions,
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.top,
.line {
  justify-content: space-between;
}
.top {
  min-height: 44px;
}
.nav {
  justify-content: center;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
button,
.link {
  touch-action: manipulation;
  cursor: pointer;
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  min-height: 44px;
  line-height: 1.35;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:active:enabled {
  transform: scale(0.98);
  transition: transform 70ms;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #9c641e;
  outline-offset: 3px;
}
.primary {
  color: white;
  background: var(--green);
  border-color: var(--green);
  min-height: 48px;
  font-weight: 650;
}
.quiet {
  background: none;
  border-color: transparent;
}
.wallet {
  font-size: 15px;
  color: #795421;
  background: #f7eacb;
  padding: 5px 12px;
  border-radius: 20px;
}
.card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  border-radius: 22px;
  margin: 0 0 12px;
  padding: 20px 22px;
  background: #e5f1d8;
  border-color: #c2d9b7;
}
.card strong,
.card small {
  display: block;
}
.card strong {
  font-size: 29px;
  line-height: 1.35;
}
.card img,
.card svg {
  width: 94px;
  height: 90px;
  object-fit: contain;
}
.card.literacy {
  background: #eee8f5;
  border-color: #d9cde5;
}
.card.camp {
  background: #f9efd8;
  border-color: #e0cca5;
}
.card.camp strong {
  font-size: 24px;
}
.card.camp svg {
  height: 66px;
}
.cost {
  display: inline-block;
  font-size: 15px;
  margin-top: 8px;
  font-weight: 650;
}
.continue {
  margin-bottom: 14px;
  width: 100%;
}
.panel,
.result {
  background: #fffdf6;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 12px 0;
}
.panel p,
.result p {
  margin: 6px 0;
}
.actions {
  margin: 12px 0;
}
.question {
  font-size: clamp(28px, 7vw, 42px);
  overflow-wrap: anywhere;
}
.arena {
  position: relative;
  height: 130px;
  background: linear-gradient(#e1eedc 78%, #c6ddb4 78%);
  border-radius: 20px;
  overflow: hidden;
  margin: 12px 0;
}
.beast {
  position: absolute;
  right: 7%;
  bottom: 5px;
  width: 102px;
  height: 106px;
  transform-origin: 50% 90%;
}
.beast svg,
.ally svg,
.ally img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ally {
  position: absolute;
  bottom: 6px;
  left: 5%;
  width: 54px;
  height: 55px;
}
.barrel {
  position: absolute;
  left: 21%;
  bottom: 22px;
  width: 35px;
  height: 19px;
  border: 3px solid #34533a;
  background: #91ad81;
  border-radius: 4px;
  transform: rotate(-24deg);
}
.barrel:after {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  border: 4px solid #34533a;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  background: #d3c397;
}
.orb {
  position: absolute;
  z-index: 1;
  border-radius: 30px;
  padding: 1px 6px;
  color: #6c4c18;
  background: #ffdc78;
  pointer-events: none;
  font-size: 15px;
  font-weight: 700;
}
.options,
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.options button,
.tile {
  font-size: 18px;
}
.selected {
  border: 2px solid var(--green);
  background: #e7f2df;
}
.selected:before {
  content: '✓ ';
  font-weight: bold;
}
.grid button img,
.grid button svg {
  height: 65px;
  width: 100%;
  object-fit: contain;
  display: block;
}
.grid button small {
  display: block;
}
.tiles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.tile {
  min-width: 44px;
}
.slot {
  min-height: 50px;
  padding: 6px;
  border-bottom: 2px solid #758d71;
}
.board {
  width: min(100%, 242px);
  aspect-ratio: 1;
  margin: 10px auto;
  background:
    linear-gradient(90deg, transparent 49.7%, #d6dcc9 50%, transparent 50.3%),
    linear-gradient(transparent 49.7%, #d6dcc9 50%, transparent 50.3%), #fcfaed;
  border: 1px solid #d5d7bf;
  border-radius: 8px;
  touch-action: none;
}
.board svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.energy {
  width: 100%;
  height: 8px;
  background: #e2e5d5;
  border-radius: 10px;
  overflow: hidden;
}
.energy i {
  display: block;
  height: 100%;
  background: #578260;
  transition: width 120ms;
}
.start-point {
  transform-box: fill-box;
  transform-origin: center;
  animation: point 240ms both;
}
.step {
  color: var(--green);
  font-weight: 600;
}
.stamp {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid #95b58a;
  border-radius: 7px;
  color: var(--green);
}
dialog {
  max-width: min(92vw, 470px);
  max-height: 85vh;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
dialog::backdrop {
  background: #243d3255;
}
dialog h2 {
  margin: 4px 42px 14px 0;
}
.close {
  float: right;
}
.portrait {
  max-width: 150px;
  margin: auto;
}
.portrait svg,
.portrait img {
  display: block;
  width: 100%;
  height: auto;
}
.portrait.show {
  animation: nod 500ms;
}
.fields {
  display: grid;
  gap: 9px;
  margin: 10px 0;
}
.fields input,
select {
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  max-width: 100%;
  min-height: 44px;
}
.row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
#notice:not(:empty) {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  width: max-content;
  background: #243d32;
  color: white;
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 5;
}
.result.reveal {
  animation: reveal 220ms 500ms both;
}
.debit {
  animation: reveal 120ms;
}
.trace-demo {
  stroke-dashoffset: var(--distance);
  animation: trace 600ms linear forwards;
}
.dim {
  opacity: 0.54;
}
@keyframes trace {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes nod {
  50% {
    transform: translateY(-7px) rotate(-5deg);
  }
}
@keyframes point {
  from {
    transform: scale(0.85);
  }
  to {
    transform: scale(1);
  }
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.full-motion) *,
  body:not(.full-motion) *:before,
  body:not(.full-motion) *:after {
    animation: none !important;
    transition: none !important;
  }
}
.still * {
  animation: none !important;
  transition: none !important;
}
.card[aria-busy='true'] .cost {
  opacity: 0.6;
}
.card[aria-busy='true'] .cost:after {
  content: ' · 准备题目中';
}
.options .selected:before {
  display: inline-block;
  animation: point 120ms;
}
.slot button {
  animation: reveal 100ms;
}
.card:active:enabled img {
  transform: translateX(-2px);
}
#sheet-status:not(:empty) {
  padding-top: 10px;
  color: #804b1d;
}
.step {
  margin: 10px 0;
}
[hidden] {
  display: none !important;
}
.tile[draggable='true'] {
  touch-action: none;
}
.moving-letter {
  position: fixed;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -65%);
  background: #e5f1d8;
  border: 1px solid #95b58a;
  border-radius: 9px;
  padding: 6px 12px;
}
.listen-dots {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}
.listen-dots i {
  width: 12px;
  height: 12px;
  border: 2px solid #658066;
  border-radius: 50%;
  transition: background-color 120ms;
}
.listen-dots .done {
  background: #52744e;
}
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stamp svg {
  width: 38px;
  height: 36px;
}
.reveal .stamp {
  animation: stamp 160ms 720ms backwards;
}
.debit {
  display: block;
  animation:
    reveal 120ms,
    vanish 100ms 520ms forwards;
}
.question {
  animation: reveal 160ms;
}
.result.reveal ~ button {
  position: relative;
}
.primary:enabled {
  transition: background-color 160ms;
}
.board .start-point {
  animation-delay: 120ms;
}
.portrait {
  max-height: 180px;
}
@keyframes stamp {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1);
  }
}
@keyframes vanish {
  to {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.full-motion) .debit {
    animation: none;
  }
}
.still .debit {
  animation: none;
}

/* A two-page field guide. One spread always holds at most six characters. */
.book {
  max-width: 570px;
  margin: 0 auto;
}
.book-heading,
.book-toolbar,
.book-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.book-heading h1 {
  margin: 6px 0 12px;
}
.book-heading > span {
  color: #74541e;
  font-weight: 700;
}
.book-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eaeade;
  border: 1px solid #d7d9c7;
  border-radius: 14px;
  padding: 3px;
  margin-bottom: 12px;
}
.book-tabs button {
  background: transparent;
  border: 0;
  font-weight: 650;
  border-radius: 11px;
}
.book-tabs [aria-pressed='true'] {
  color: #fffdf2;
  background: #345742;
}
.book-cover {
  position: relative;
  display: flex;
  align-items: center;
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  height: clamp(102px, 20vw, 130px);
  padding: 10px 20px;
  border-radius: 17px;
  background: #f6dfb8;
  border: 1px solid #e8c99f;
  color: #543c28;
}
.cover-monsters {
  background: #dce7ec;
  border-color: #bed2dd;
  color: #2e4956;
}
.cover-copy {
  display: grid;
  gap: 2px;
  z-index: 1;
}
.cover-copy small {
  font-size: 13px;
  color: inherit;
}
.cover-copy strong {
  font-size: clamp(21px, 5vw, 28px);
  font-weight: 750;
  letter-spacing: 0.03em;
}
.cover-copy > span {
  font-size: 14px;
}
.cover-art {
  width: 38%;
  max-width: 160px;
  height: 100%;
  position: absolute;
  right: 4%;
  bottom: 0;
}
.cover-art > *,
.entry-art > *,
.beast img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.cover-orbit {
  width: 185px;
  height: 185px;
  border: 1px solid #fff7dc;
  border-radius: 50%;
  position: absolute;
  right: -18px;
  top: -30px;
  background: #fff5d94d;
  box-shadow:
    0 0 0 12px #ffffff26,
    0 0 0 13px #ffffff43;
}
.book-toolbar {
  margin: 10px 0 8px;
}
.book-toolbar #book-filter {
  max-width: 170px;
  padding: 7px 9px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 16px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.entry {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  padding: 5px 3px 7px;
  background: #fffdf6;
  border-radius: 13px;
}
.entry-art {
  display: block;
  width: 100%;
  height: clamp(64px, 18vw, 99px);
  background: radial-gradient(ellipse at 50% 90%, var(--tint, #eee8d3), transparent 67%);
}
.tint-1,
.tint-4 {
  --tint: #f2dfe5;
}
.tint-2,
.tint-3 {
  --tint: #dbe9df;
}
.entry strong {
  font-size: clamp(14px, 3.8vw, 17px);
  line-height: 1.25;
}
.entry small {
  font-size: 13px;
  line-height: 1.3;
}
.book-pager {
  margin-top: 11px;
  font-size: 14px;
}
.book-pager button {
  font-size: 15px;
  padding: 7px 14px;
}
.book-empty {
  padding: 24px 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.book-empty button {
  margin-top: 10px;
}
.pet-story {
  margin: 8px 0;
  color: var(--soft);
}
.stamp img {
  width: 38px;
  height: 36px;
  object-fit: contain;
}
.earned-stars {
  display: inline-block;
}
.earned-stars button {
  padding: 3px 8px;
  min-height: 44px;
  color: #71501e;
  background: #fff4d6;
  font-weight: 600;
}
.earned-points {
  display: inline-block;
  margin-left: 6px;
}
.star-garden {
  padding: 16px;
  display: grid;
  text-align: center;
  gap: 4px;
  place-items: center;
  border-radius: 16px;
  background: #f8edcf;
  margin-bottom: 14px;
}
.flower-bed {
  display: flex;
  gap: 5px;
}
.flower-bed i {
  color: #cfc2a0;
  font-style: normal;
}
.flower-bed .bloom {
  color: #bd7829;
}
.star-garden > span {
  font-size: 31px;
  color: #b8792f;
  line-height: 1;
}
.star-garden strong {
  font-size: 22px;
}
.star-garden progress {
  width: 75%;
  height: 10px;
  accent-color: #8b6a32;
}
.star-rules {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  row-gap: 6px;
}
.star-rules dd {
  margin: 0;
  font-weight: 650;
}
@media (max-width: 360px) {
  .book-grid {
    gap: 5px;
  }
  .book-cover {
    height: 85px;
  }
  .entry strong {
    font-size: 14px;
  }
  .entry small {
    font-size: 12px;
  }
}

.skill-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 210px;
  border-radius: 18px;
  background: radial-gradient(ellipse at 48% 80%, #e4e3fc, #f5f3e7 65%);
}
.skill-stage .portrait {
  position: absolute;
  left: 2%;
  bottom: 16px;
  width: 54%;
  max-width: 175px;
}
.skill-target {
  position: absolute;
  right: 10%;
  top: 36%;
  font-size: 52px;
  color: #7897a2;
  opacity: 0.55;
}
.skill-fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
}
.skill-fx span {
  will-change: transform, opacity;
}
.entry-art img {
  object-fit: contain;
}
.book-search {
  display: block;
  margin-top: 10px;
}
.book-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 12px;
  background: #fffdf6;
}
.entry-art img,
.cover-art img,
.skill-stage .portrait img,
.beast img {
  mix-blend-mode: multiply;
}
.skill-fx span {
  font-weight: 900;
}
.skill-water span {
  -webkit-text-stroke: 1px #2a9ad1;
}
.skill-leaf span {
  -webkit-text-stroke: 1px #378458;
}
.skill-lightning span {
  -webkit-text-stroke: 1px #b97f22;
}

.rare-card {
  height: 260px;
  border: 2px solid #c9a45e;
  background: radial-gradient(ellipse at 75% 20%, #e0f8ff, #dbe2fa 52%, #f6e4f5);
  box-shadow: inset 0 0 25px #ffffffaa;
}
.rare-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #ffffffbb;
  border-radius: 12px;
  pointer-events: none;
}
.rare-card .portrait {
  width: 72%;
  max-width: 240px;
  left: 0;
  bottom: 2px;
}
.rare-entry {
  border-color: #cdbb87;
  background: linear-gradient(135deg, #fffdf1, #edf1fc 55%, #f7eefa);
}
.rare-card .portrait {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  left: 0;
  bottom: 0;
}
.rare-card .portrait img {
  height: 100%;
  object-fit: contain;
}
.rare-card .skill-target {
  display: none;
}

.filter-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  clear: both;
}
.filter-choices [aria-pressed="true"] {
  color: white;
  background: var(--green);
}
.cast-caption {
  position: absolute;
  z-index: 5;
  top: 8px;
  left: 8px;
  padding: 2px 10px;
  border-radius: 16px;
  color: white;
  background: var(--green);
  font-size: 15px;
  pointer-events: none;
}
#notice {
  pointer-events: none;
}

/* The same artwork and proportions are used in the battle arena and the preview card. */
.skill-signature {
  position: absolute;
  left: 57%;
  top: 21%;
  width: 34%;
  height: 57%;
  filter: drop-shadow(0 2px 1px #24345099) drop-shadow(0 0 6px var(--aura));
}
.skill-signature::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, white 12%, var(--aura) 48%, #374d88 100%);
}
.skill-lightning .skill-signature::before {
  background: linear-gradient(120deg, #fffbd1 30%, #ffe15e 56%, #a07be8 82%);
  clip-path: polygon(60% 0, 88% 0, 62% 35%, 91% 31%, 20% 100%, 43% 56%, 14% 60%);
}
.skill-ice .skill-signature::before {
  clip-path: polygon(0 52%, 23% 60%, 27% 19%, 41% 42%, 58% 0, 72% 37%, 100% 22%, 76% 78%, 49% 100%, 22% 88%);
}
.skill-flame .skill-signature::before {
  background: linear-gradient(15deg, #e84230, #ff9f38 48%, #fff9af 74%, #ff753c);
  clip-path: polygon(0 56%, 32% 55%, 11% 25%, 58% 45%, 42% 8%, 87% 38%, 100% 58%, 90% 76%, 57% 90%, 14% 84%, 35% 73%);
}
.skill-water .skill-signature::before {
  border-radius: 50%;
  transform: rotate(-27deg);
  background: radial-gradient(ellipse, transparent 36%, #c5ffff 38%, #29a4cf 50%, transparent 53%, transparent 60%, #98faff 62%, #3983ce 69%, transparent 72%);
}
.skill-leaf .skill-signature::before {
  border-radius: 85% 0 85% 0;
  background: linear-gradient(135deg, #367f73, #8ce688 45%, #faffce 48%, #58b96b 53%, #138667);
}
.skill-petal .skill-signature::before {
  background: radial-gradient(circle, #fff3a2 0 11%, transparent 13%),
    radial-gradient(ellipse at 50% 22%, #f383b5 0 19%, transparent 21%),
    radial-gradient(ellipse at 76% 43%, #ffbdd8 0 20%, transparent 22%),
    radial-gradient(ellipse at 65% 73%, #ee91c5 0 18%, transparent 20%),
    radial-gradient(ellipse at 34% 73%, #ffc4de 0 18%, transparent 20%),
    radial-gradient(ellipse at 24% 43%, #e487be 0 20%, transparent 22%);
}
.skill-star .skill-signature::before {
  clip-path: polygon(50% 0, 61% 33%, 90% 17%, 73% 43%, 100% 52%, 68% 63%, 78% 90%, 54% 75%, 40% 100%, 36% 69%, 4% 76%, 26% 53%, 0 38%, 36% 35%);
}
.skill-shield .skill-signature::before {
  clip-path: polygon(50% 0, 93% 18%, 88% 64%, 73% 82%, 50% 100%, 27% 82%, 12% 64%, 7% 18%);
  background: linear-gradient(100deg, #73ccd6 10%, #edffff 43%, #8ea7fc 51%, #5794aa);
}

.motion-settings {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
.motion-settings button {
  margin: 2px;
}
.motion-settings [aria-pressed="true"] {
  color: white;
  background: var(--green);
}
.charging .barrel {
  background: #fff0a1;
  box-shadow: 4px -2px 10px #ffbd42;
}
.barrel {
  transform-origin: 18% 72%;
}
.muzzle-flash {
  position: absolute;
  z-index: 3;
  width: 46px;
  height: 42px;
  background: radial-gradient(circle, white 14%, #fff097 36%, #ffab39 70%);
  clip-path: polygon(50% 0, 60% 27%, 91% 11%, 77% 40%, 100% 54%, 70% 62%, 82% 93%, 53% 77%, 30% 100%, 29% 68%, 0 61%, 26% 42%, 12% 17%, 40% 29%);
  pointer-events: none;
}
.orb {
  top: 0;
  left: 0;
  z-index: 5;
  color: #59390d;
  background: #fff1a7;
  border: 2px solid #f6b648;
  box-shadow: 0 0 9px #ffc34e;
}
.orb::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 30%;
  width: 25px;
  height: 40%;
  background: linear-gradient(90deg, transparent, #ffcb5e);
  border-radius: 80% 0 0 80%;
}

.shot-flying + .result {
  visibility: hidden;
}
