:root {
  color-scheme: light;
  font-family:
    "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #4f3a32;
  background: #e8dcb8;
  -webkit-tap-highlight-color: transparent;
  --ink: #4f3a32;
  --muted-ink: #7d655a;
  --paper: #fff7e4;
  --paper-deep: #f7e9c7;
  --card: #f8e7bd;
  --card-deep: #efd69a;
  --coral: #e77b67;
  --coral-dark: #bd584c;
  --sunny: #f4c978;
  --sage: #92b49b;
  --sage-dark: #5f8e72;
  --sky: #c9e1de;
  --success: #55a66d;
  --error: #c95d55;
  --soft-shadow: 0 9px 22px rgb(91 67 43 / 14%);
  --card-shadow:
    0 4px 0 #dfc98f,
    0 9px 18px rgb(96 67 38 / 13%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(circle at 12% 18%, rgb(255 244 205 / 82%) 0 8%, transparent 8.3%),
    radial-gradient(circle at 88% 76%, rgb(205 226 211 / 74%) 0 10%, transparent 10.3%),
    linear-gradient(145deg, #eadfbe, #d9d7b8);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 4px solid #4f8f9e;
  outline-offset: 4px;
}

.music-toggle {
  position: fixed;
  z-index: 80;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: inline-flex;
  width: 58px;
  height: 58px;
  padding: 6px 5px 5px;
  border: 2px solid rgb(255 247 228 / 92%);
  border-radius: 18px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  background: linear-gradient(180deg, #fff7e4, #f4dfad);
  color: var(--ink);
  box-shadow:
    0 4px 0 #d6bd80,
    0 9px 18px rgb(91 67 43 / 17%);
  cursor: pointer;
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease,
    opacity 180ms ease;
}

.music-toggle:hover {
  filter: brightness(1.035) saturate(1.04);
}

.music-toggle:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #d6bd80,
    0 5px 11px rgb(91 67 43 / 15%);
}

.music-toggle[aria-pressed="false"] {
  background: linear-gradient(180deg, #f0e9da, #dbcfb6);
  color: #8a766c;
}

.music-toggle-icon {
  position: relative;
  display: block;
  width: 25px;
  height: 24px;
}

.music-note-head {
  position: absolute;
  right: 2px;
  bottom: 1px;
  width: 10px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  transform: rotate(-16deg);
}

.music-note-stem {
  position: absolute;
  right: 4px;
  bottom: 6px;
  width: 3px;
  height: 17px;
  border-radius: 3px;
  background: currentColor;
}

.music-note-flag {
  position: absolute;
  top: 1px;
  right: 4px;
  width: 12px;
  height: 6px;
  border-radius: 1px 5px 5px 1px;
  background: currentColor;
  transform: skewY(16deg);
  transform-origin: right center;
}

.music-toggle[aria-pressed="false"] .music-toggle-icon::after {
  position: absolute;
  top: 10px;
  left: -1px;
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: var(--error);
  box-shadow: 0 0 0 2px rgb(255 247 228 / 70%);
  content: "";
  transform: rotate(-42deg);
}

.music-toggle-label {
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.05em;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
}

.screen.is-active {
  display: flex;
}

/* 封面 */
.cover-screen {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 15% 12%, rgb(255 244 203 / 90%) 0 9%, transparent 9.3%),
    radial-gradient(circle at 90% 84%, rgb(219 158 123 / 24%) 0 12%, transparent 12.3%),
    #f4ce7d;
}

.cover-inner {
  position: relative;
  width: min(100%, 620px);
  height: 100%;
}

.cover-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.start-button {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(3.3dvh, 18px);
  min-width: min(78vw, 310px);
  min-height: 58px;
  padding: 0.72em 1.9em;
  transform: translateX(-50%);
  border: 3px solid #fff7e6;
  border-radius: 999px;
  background: linear-gradient(180deg, #ee8a74, var(--coral));
  color: #fffdf8;
  font-size: clamp(20px, 5.6vw, 29px);
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    0 7px 0 var(--coral-dark),
    0 13px 27px rgb(91 46 38 / 25%);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.start-button:hover {
  filter: brightness(1.035) saturate(1.03);
}

.start-button:active {
  transform: translate(-50%, 5px);
  box-shadow:
    0 2px 0 var(--coral-dark),
    0 7px 15px rgb(91 46 38 / 19%);
}

.start-button:disabled {
  cursor: default;
  filter: grayscale(0.65);
  opacity: 0.65;
}

/* 拼字画面 */
.game-screen {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 8% 16%, rgb(248 201 120 / 30%) 0 10%, transparent 10.4%),
    radial-gradient(circle at 92% 82%, rgb(146 180 155 / 28%) 0 12%, transparent 12.4%),
    #e6ddbd;
  user-select: none;
}

.game-shell {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 1080px;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 17px 17px, rgb(222 192 128 / 16%) 0 2px, transparent 2.5px)
      0 0 / 34px 34px,
    linear-gradient(160deg, #fff9e9 0%, #fbf0d6 100%);
}

.game-toolbar {
  z-index: 4;
  display: grid;
  min-height: clamp(172px, 24dvh, 228px);
  padding:
    max(12px, env(safe-area-inset-top))
    clamp(12px, 3.6vw, 30px)
    12px;
  grid-template-columns: minmax(68px, 1fr) auto minmax(68px, 1fr);
  align-items: center;
  gap: clamp(7px, 2vw, 18px);
}

.game-progress {
  justify-self: start;
  padding: 0.48em 0.72em;
  border-radius: 999px;
  background: rgb(255 255 255 / 58%);
  color: var(--muted-ink);
  font-size: clamp(13px, 3.5vw, 18px);
  font-weight: 750;
  box-shadow: 0 4px 12px rgb(104 75 43 / 8%);
  white-space: nowrap;
}

.game-progress strong {
  color: var(--coral-dark);
  font-size: 1.12em;
}

.progress-separator {
  margin: 0 0.12em;
  color: #b9a58e;
}

.picture-card {
  position: relative;
  display: grid;
  width: clamp(132px, 35vw, 194px);
  aspect-ratio: 1;
  place-items: center;
  overflow: visible;
  background: transparent;
}

.picture-card::after {
  content: none;
}

.question-picture {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.speaker-button {
  display: grid;
  min-width: clamp(58px, 16vw, 86px);
  padding: 9px 8px 8px;
  justify-self: end;
  place-items: center;
  gap: 4px;
  border: 0;
  border-radius: 20px;
  background: #e0eee3;
  color: #4f745d;
  box-shadow:
    0 4px 0 #a7c5ad,
    0 9px 17px rgb(66 99 77 / 12%);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.speaker-button:hover {
  background: #e8f4ea;
}

.speaker-button:active {
  transform: translateY(3px) scale(0.98);
  box-shadow:
    0 1px 0 #a7c5ad,
    0 5px 10px rgb(66 99 77 / 10%);
}

.speaker-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.speaker-glyph {
  position: relative;
  display: block;
  width: 31px;
  height: 24px;
}

.speaker-cone {
  position: absolute;
  top: 8px;
  left: 2px;
  width: 8px;
  height: 9px;
  border-radius: 3px 0 0 3px;
  background: currentColor;
}

.speaker-cone::after {
  position: absolute;
  top: -5px;
  left: 6px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-right: 11px solid currentColor;
  border-bottom: 9px solid transparent;
  content: "";
}

.speaker-wave {
  position: absolute;
  top: 3px;
  right: 1px;
  width: 12px;
  height: 18px;
  border-right: 3px solid currentColor;
  border-radius: 0 50% 50% 0;
}

.speaker-wave::before {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 10px;
  border-right: 3px solid currentColor;
  border-radius: 0 50% 50% 0;
  content: "";
}

.speaker-label {
  font-size: clamp(11px, 2.8vw, 14px);
  font-weight: 850;
  letter-spacing: 0.04em;
}

.puzzle-zone {
  position: relative;
  display: grid;
  min-height: 0;
  padding:
    4px
    clamp(10px, 2.8vw, 28px)
    max(14px, env(safe-area-inset-bottom));
  grid-template-columns:
    clamp(88px, 25.5vw, 128px)
    minmax(28px, 1fr)
    clamp(154px, 42vw, 222px);
  align-items: center;
  gap: clamp(7px, 2.1vw, 22px);
}

.options-panel {
  display: grid;
  width: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  align-items: center;
}

.section-label,
.composition-title {
  color: var(--muted-ink);
  font-size: clamp(13px, 3.6vw, 18px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.section-label {
  padding: 5px 0 8px;
}

.left-options {
  display: grid;
  min-height: 0;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-content: center;
  gap: clamp(9px, 1.7dvh, 16px);
}

.part-option {
  display: flex;
  width: 100%;
  height: clamp(104px, 18dvh, 148px);
  max-height: 100%;
  padding: clamp(7px, 1.8vw, 12px);
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  border: 0;
  border-radius: clamp(17px, 4.8vw, 24px);
  background: linear-gradient(150deg, #fff0ca, var(--card));
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    filter 150ms ease,
    opacity 180ms ease;
}

.part-image-wrap {
  display: grid;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
}

.part-image-wrap img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  clip-path: inset(1.7%);
  filter: contrast(1.04);
  mix-blend-mode: multiply;
  pointer-events: none;
  transform: scale(1.035);
}

/*
 * 换题时先准备整组图片，再一次显示，避免手机短暂混合上一题图片与下一题部件。
 */
.game-screen.is-question-loading .picture-card img,
.game-screen.is-question-loading .part-image-wrap img,
.game-screen.is-question-loading .right-part,
.game-screen.is-question-loading .assembled-left {
  visibility: hidden;
}

.part-option:hover {
  transform: translateY(-3px);
  box-shadow:
    0 6px 0 #dec485,
    0 13px 24px rgb(96 67 38 / 17%);
}

.part-option:active {
  transform: translateY(3px) scale(0.975);
  box-shadow:
    0 1px 0 #dec485,
    0 5px 10px rgb(96 67 38 / 12%);
}

.part-option:disabled {
  cursor: default;
}

.part-option:disabled:hover {
  transform: none;
  box-shadow: var(--card-shadow);
}

.puzzle-zone.is-waiting .part-option {
  filter: saturate(0.6);
  opacity: 0.58;
}

.part-option.is-correct {
  animation: correct-card-pulse 410ms ease-out;
}

.part-option.is-flying-source,
.part-option.is-flying-source .part-image-wrap {
  z-index: 30;
  overflow: visible;
}

.part-option.is-flying-source img {
  position: relative;
  z-index: 31;
  will-change: transform;
}

.part-option.is-wrong {
  animation: wrong-shake 390ms ease-in-out;
}

.flight-space {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.4vw, 11px);
}

.flight-space span {
  width: clamp(6px, 1.6vw, 11px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d8b86f;
  box-shadow: 0 2px 0 rgb(114 81 39 / 12%);
  opacity: 0.45;
}

.flight-space span:nth-child(2) {
  opacity: 0.66;
}

.flight-space span:nth-child(3) {
  opacity: 0.88;
}

.composition-box {
  display: grid;
  width: 100%;
  padding: clamp(9px, 2.4vw, 16px);
  grid-template-rows: auto minmax(0, 1fr);
  align-self: center;
  overflow: hidden;
  border-radius: clamp(24px, 6vw, 34px);
  background: linear-gradient(155deg, #f2c8a0, #e8a98d);
  box-shadow:
    0 7px 0 #d78e76,
    0 16px 30px rgb(113 70 50 / 17%);
}

.composition-title {
  display: flex;
  padding: 2px 0 clamp(8px, 1.6dvh, 13px);
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #714b3f;
}

.composition-title span {
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff2cf;
  box-shadow: 13px 0 0 #fff2cf;
  transform: translateX(-6px);
}

.composition-board {
  position: relative;
  display: grid;
  container-type: inline-size;
  min-height: clamp(192px, 33dvh, 286px);
  place-items: center;
  overflow: hidden;
  border-radius: clamp(18px, 4.8vw, 26px);
  background:
    linear-gradient(rgb(213 176 105 / 10%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(213 176 105 / 10%) 1px, transparent 1px),
    #fff2d5;
  background-size: 24px 24px;
  box-shadow:
    inset 0 0 0 3px rgb(255 255 255 / 52%),
    inset 0 5px 12px rgb(120 78 46 / 8%);
}

.assembled-character {
  position: relative;
  display: block;
  width: max-content;
  max-width: 96%;
  height: min(clamp(104px, 28vw, 172px), 60cqw);
}

.assembled-part-crop {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  height: 100%;
  overflow: hidden;
}

.right-part,
.assembled-left {
  position: absolute;
  top: 0;
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  object-fit: contain;
  filter: contrast(1.04);
  mix-blend-mode: multiply;
}

.assembled-left {
  visibility: hidden;
}

.assembled-character.is-complete .assembled-left {
  visibility: visible;
  animation: joined-glow 620ms ease both;
}

.assembled-character.is-complete .right-part {
  animation: joined-glow 620ms ease both;
}

.mini-speaker-button {
  min-width: clamp(78px, 21vw, 112px);
  padding: 7px 8px 6px;
  justify-self: center;
  border-radius: 18px;
}

.mini-speaker-button .speaker-glyph {
  width: 27px;
  height: 21px;
  transform: scale(0.9);
}

.mini-speaker-button .speaker-label {
  font-size: clamp(10px, 2.7vw, 13px);
}

.composition-helper {
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  color: #a27b63;
  font-size: clamp(10px, 2.7vw, 13px);
  font-weight: 750;
  letter-spacing: 0.03em;
  text-align: center;
  transition: opacity 180ms ease;
}

.assembled-character.is-complete + .composition-helper {
  opacity: 0;
}

.feedback {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  min-width: 7em;
  padding: 0.42em 0.7em;
  transform: translate(-50%, -50%) scale(0.9);
  border-radius: 999px;
  background: rgb(255 248 229 / 94%);
  color: var(--error);
  font-size: clamp(22px, 6vw, 38px);
  font-weight: 950;
  text-align: center;
  opacity: 0;
  box-shadow: var(--soft-shadow);
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.feedback.is-visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* 掉落小游戏 */
.mini-screen {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 18%, rgb(255 228 164 / 50%) 0 10%, transparent 10.4%),
    radial-gradient(circle at 92% 82%, rgb(146 180 155 / 32%) 0 13%, transparent 13.4%),
    #deddbd;
  user-select: none;
}

.mini-shell {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1080px;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background: #f8f0d7;
}

.mini-header {
  position: relative;
  z-index: 5;
  display: grid;
  min-height: clamp(228px, 29dvh, 270px);
  padding:
    max(12px, env(safe-area-inset-top))
    clamp(13px, 3.6vw, 34px)
    13px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 4vw, 36px);
  background:
    radial-gradient(circle at 16px 16px, rgb(219 183 113 / 15%) 0 2px, transparent 2.5px)
      0 0 / 32px 32px,
    linear-gradient(145deg, #fff8e6, #f5e6bf);
  box-shadow: 0 7px 18px rgb(91 68 44 / 10%);
}

.mini-prompt {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto;
  align-content: center;
  justify-items: start;
  gap: clamp(7px, 1.2dvh, 11px);
}

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

.mini-prompt-copy span {
  color: var(--muted-ink);
  font-size: clamp(17px, 4.6vw, 27px);
  font-weight: 800;
}

.mini-prompt-copy strong {
  color: var(--coral-dark);
  font-size: clamp(25px, 6.7vw, 40px);
  font-weight: 950;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mini-reference-card {
  display: grid;
  width: clamp(74px, 19vw, 104px);
  min-width: clamp(74px, 19vw, 104px);
  height: clamp(98px, 15dvh, 128px);
  padding: 7px;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: auto;
  justify-self: center;
  overflow: hidden;
  border-radius: clamp(18px, 5vw, 26px);
  background: linear-gradient(150deg, #fff0ca, var(--card));
  box-shadow: var(--card-shadow);
}

.reference-label {
  color: #8c715f;
  font-size: clamp(10px, 2.5vw, 13px);
  font-weight: 850;
  letter-spacing: 0.08em;
  text-align: center;
}

.reference-image-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
}

.mini-target {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: clamp(82px, 14dvh, 126px);
  object-fit: contain;
  clip-path: inset(1.7%);
  filter: contrast(1.04);
  mix-blend-mode: multiply;
  transform: scale(1.035);
}

.mini-controls {
  display: grid;
  align-items: center;
  align-self: end;
  padding-top: clamp(58px, 8dvh, 72px);
}

.falling-field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 12% 14%, rgb(255 255 255 / 50%) 0 8%, transparent 8.5%),
    radial-gradient(ellipse at 86% 25%, rgb(255 255 255 / 44%) 0 10%, transparent 10.5%),
    linear-gradient(180deg, #cde5df 0%, #e8efcf 76%, #c5dca8 100%);
}

.falling-field::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 9%;
  background:
    radial-gradient(circle at 8px 0, #aac887 0 8px, transparent 8.5px) 0 0 / 30px 18px
      repeat-x,
    #b9d393;
  content: "";
  pointer-events: none;
}

.field-hint {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 50%;
  padding: 0.45em 0.9em;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgb(255 249 229 / 62%);
  color: #69806e;
  font-size: clamp(11px, 2.9vw, 14px);
  font-weight: 750;
  white-space: nowrap;
  opacity: 0.82;
  pointer-events: none;
}

.falling-part {
  position: absolute;
  z-index: 2;
  top: 0;
  left: var(--left);
  width: var(--part-width);
  height: var(--part-height);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  animation: fall-down var(--fall-duration) linear forwards;
  will-change: transform;
}

.falling-card-inner {
  display: grid;
  width: 100%;
  height: 100%;
  padding: clamp(5px, 1.4vw, 9px);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
  border-radius: clamp(14px, 3.6vw, 20px);
  background: linear-gradient(150deg, #fff0ca, var(--card));
  box-shadow:
    0 4px 0 #d9c184,
    0 8px 16px rgb(70 68 44 / 16%);
  transition:
    background 170ms ease,
    box-shadow 170ms ease,
    opacity 190ms ease,
    transform 190ms ease;
}

.falling-part img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  clip-path: inset(1.9%);
  filter: contrast(1.05);
  mix-blend-mode: multiply;
  pointer-events: none;
  transform: scale(1.04);
}

.falling-part:hover .falling-card-inner {
  filter: brightness(1.025);
}

.falling-part:active .falling-card-inner {
  transform: scale(0.96);
}

.falling-part.is-hit {
  animation-play-state: paused;
  pointer-events: none;
}

.falling-part.is-hit .falling-card-inner {
  background: #a9d7a9;
  box-shadow:
    0 0 0 5px rgb(76 157 99 / 28%),
    0 9px 18px rgb(54 110 70 / 18%);
  opacity: 0;
  transform: scale(1.1);
}

.falling-part.is-miss .falling-card-inner {
  animation: mini-wrong-shake 300ms ease-in-out;
  background: #f4d6b9;
}

.mini-feedback {
  position: absolute;
  z-index: 10;
  top: 54%;
  left: 50%;
  padding: 0.18em 0.45em;
  border-radius: 999px;
  background: rgb(247 255 239 / 90%);
  color: var(--success);
  font-size: clamp(32px, 10vw, 62px);
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
}

.mini-feedback.is-visible {
  animation: score-pop 500ms ease-out;
}

.mini-round-result {
  position: absolute;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(255 247 228 / 58%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.mini-round-result p {
  margin: 0;
  padding: 0.58em 0.9em;
  border-radius: 999px;
  background: #fff4d6;
  color: var(--coral-dark);
  font-size: clamp(34px, 10vw, 64px);
  font-weight: 950;
  line-height: 1;
  box-shadow:
    0 7px 0 #d9bd79,
    0 18px 36px rgb(91 67 43 / 20%);
  transform: scale(0.88);
  transition: transform 260ms cubic-bezier(.2, .8, .25, 1);
}

.mini-round-result.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mini-round-result.is-visible p {
  transform: scale(1);
}

/* 结果页 */
.result-screen {
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding:
    max(20px, env(safe-area-inset-top))
    18px
    max(20px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 13% 18%, #f7cc7e 0 7%, transparent 7.3%),
    radial-gradient(circle at 88% 79%, #abc8ad 0 10%, transparent 10.3%),
    linear-gradient(145deg, #f5e8c5, #e1d9b5);
  text-align: center;
}

.result-shell {
  position: relative;
  flex: 0 0 auto;
  width: min(92vw, 660px);
  margin-block: auto;
  padding: clamp(34px, 7vw, 62px) clamp(22px, 7vw, 70px);
  overflow: hidden;
  border-radius: clamp(28px, 7vw, 44px);
  background:
    radial-gradient(circle at 14px 14px, rgb(222 192 128 / 16%) 0 2px, transparent 2.5px)
      0 0 / 28px 28px,
    #fff7e4;
  box-shadow:
    0 10px 0 #d6c49b,
    0 24px 48px rgb(82 62 42 / 18%);
}

.result-decoration {
  display: flex;
  margin-bottom: 12px;
  justify-content: center;
  gap: 10px;
}

.result-decoration span {
  width: 13px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sunny);
}

.result-decoration span:nth-child(2) {
  background: var(--coral);
}

.result-decoration span:nth-child(3) {
  background: var(--sage);
}

.result-kicker {
  margin: 0 0 4px;
  color: var(--muted-ink);
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-screen h1 {
  margin: 0 0 clamp(24px, 5dvh, 42px);
  color: var(--coral-dark);
  font-size: clamp(43px, 12vw, 72px);
  line-height: 1.1;
}

.result-counts {
  display: grid;
  margin-bottom: clamp(28px, 6dvh, 50px);
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 3vw, 20px);
}

.result-counts p {
  display: grid;
  margin: 0;
  padding: clamp(16px, 4vw, 24px) 10px;
  gap: 6px;
  border-radius: 24px;
  color: var(--ink);
  font-size: clamp(16px, 4.6vw, 23px);
  font-weight: 850;
  box-shadow: 0 5px 13px rgb(91 67 43 / 8%);
}

.result-correct {
  background: #dfeeda;
}

.result-radical-score {
  background: #f7dcc2;
}

.result-counts strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  color: var(--coral-dark);
  font-size: clamp(35px, 10vw, 55px);
  line-height: 1;
}

.result-counts strong small {
  font-size: 0.42em;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.result-actions button {
  width: min(100%, 430px);
  min-height: 56px;
  padding: 0.78em 1.1em;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ee8a74, var(--coral));
  color: #fffdf8;
  font-size: clamp(17px, 4.7vw, 24px);
  font-weight: 900;
  box-shadow:
    0 5px 0 var(--coral-dark),
    0 10px 20px rgb(91 46 38 / 15%);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.result-actions button:hover {
  filter: brightness(1.04);
}

.result-actions button:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 var(--coral-dark),
    0 5px 10px rgb(91 46 38 / 12%);
}

.result-actions .secondary-button {
  background: #dbe9dc;
  color: #4f745d;
  box-shadow:
    0 5px 0 #9ebb9f,
    0 10px 18px rgb(57 92 65 / 12%);
}

.result-actions button:disabled {
  cursor: default;
  filter: grayscale(0.6);
  opacity: 0.48;
  transform: none;
}

.result-actions .home-button {
  display: flex;
  width: min(100%, 430px);
  min-height: 52px;
  padding: 0.72em 1.1em;
  align-items: center;
  justify-content: center;
  border: 2px solid rgb(255 247 228 / 92%);
  border-radius: 999px;
  background: linear-gradient(180deg, #f5d48e, #edc06c);
  color: #694f34;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 900;
  text-decoration: none;
  box-shadow:
    0 5px 0 #c89d51,
    0 10px 18px rgb(91 67 43 / 13%);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.result-actions .home-button:hover {
  filter: brightness(1.04);
}

.result-actions .home-button:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #c89d51,
    0 5px 10px rgb(91 67 43 / 11%);
}

.result-actions .home-button:focus-visible {
  outline: 4px solid #4f8f9e;
  outline-offset: 4px;
}

@keyframes wrong-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px) rotate(-2deg);
  }
  50% {
    transform: translateX(7px) rotate(2deg);
  }
  75% {
    transform: translateX(-4px) rotate(-1deg);
  }
}

@keyframes mini-wrong-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes correct-card-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  55% {
    transform: scale(1.085);
    box-shadow:
      0 0 0 6px rgb(82 166 109 / 24%),
      0 7px 0 #87bb91,
      0 13px 24px rgb(60 118 75 / 17%);
  }
}

@keyframes joined-glow {
  0% {
    filter: contrast(1.04) drop-shadow(0 0 0 rgb(255 204 91 / 0%));
  }
  55% {
    filter: contrast(1.04) drop-shadow(0 0 13px rgb(255 196 68 / 90%));
  }
  100% {
    filter: contrast(1.04) drop-shadow(0 0 4px rgb(255 196 68 / 30%));
  }
}

@keyframes fall-down {
  from {
    transform: translateY(calc(-1 * var(--part-height))) rotate(var(--rotation));
  }
  to {
    transform: translateY(var(--travel)) rotate(var(--end-rotation));
  }
}

@keyframes score-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.65);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.18);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -95%) scale(1);
    opacity: 0;
  }
}

/* 平板 */
@media (min-width: 600px) {
  .game-toolbar {
    min-height: clamp(190px, 24dvh, 250px);
    padding-right: clamp(24px, 5vw, 52px);
    padding-left: clamp(24px, 5vw, 52px);
  }

  .picture-card {
    width: clamp(174px, 25vw, 216px);
  }

  .puzzle-zone {
    padding-right: clamp(26px, 5vw, 56px);
    padding-left: clamp(26px, 5vw, 56px);
    grid-template-columns:
      clamp(132px, 19vw, 180px)
      minmax(70px, 1fr)
      clamp(230px, 32vw, 310px);
  }

  .options-panel {
    width: min(100%, 175px);
    justify-self: center;
  }

  .part-option {
    height: clamp(130px, 18dvh, 170px);
  }

  .composition-board {
    min-height: clamp(270px, 38dvh, 350px);
  }

  .assembled-character {
    height: min(clamp(170px, 23vw, 232px), 60cqw);
  }

  .mini-header {
    min-height: clamp(240px, 27dvh, 280px);
  }

  .mini-reference-card {
    width: clamp(100px, 14vw, 126px);
    min-width: clamp(100px, 14vw, 126px);
    height: clamp(120px, 15dvh, 144px);
  }
}

/* 桌面版：内容集中在中央教材画布，不拉满整页。 */
@media (min-width: 900px) and (min-height: 650px) {
  .game-screen,
  .mini-screen {
    padding: clamp(22px, 4dvh, 50px) clamp(26px, 4vw, 70px);
  }

  .game-shell,
  .mini-shell {
    width: min(94vw, 1060px);
    height: min(92dvh, 900px);
    border-radius: 38px;
    box-shadow:
      0 12px 0 rgb(154 132 89 / 34%),
      0 28px 58px rgb(72 57 39 / 19%);
  }

  .game-toolbar {
    min-height: 210px;
    padding: 20px 58px 16px;
    grid-template-columns: 1fr auto 1fr;
  }

  .picture-card {
    width: 188px;
  }

  .game-progress {
    font-size: 17px;
  }

  .speaker-button {
    min-width: 82px;
  }

  .puzzle-zone {
    padding: 10px 64px 38px;
    grid-template-columns: 176px minmax(120px, 1fr) 310px;
    gap: 34px;
  }

  .part-option {
    height: min(16.5dvh, 150px);
    min-height: 116px;
  }

  .composition-box {
    padding: 16px;
  }

  .composition-board {
    min-height: min(40dvh, 340px);
  }

  .assembled-character {
    height: min(25dvh, 226px, 60cqw);
  }

  .mini-header {
    min-height: 250px;
    padding: 22px 64px 18px;
  }

  .mini-prompt {
    gap: 12px;
  }

  .falling-field {
    margin: 0 20px 20px;
    border-radius: 28px;
    box-shadow: inset 0 0 0 3px rgb(255 255 255 / 34%);
  }
}

/* 较矮的横屏和桌面窗口 */
@media (max-height: 700px) {
  .result-screen {
    padding:
      max(10px, env(safe-area-inset-top))
      12px
      max(16px, env(safe-area-inset-bottom));
  }

  .result-shell {
    padding: 24px 20px 30px;
  }

  .result-decoration {
    margin-bottom: 6px;
  }

  .result-screen h1 {
    margin-bottom: 18px;
  }

  .result-counts {
    margin-bottom: 20px;
  }

  .result-actions {
    gap: 10px;
  }

  .result-actions button {
    min-height: 50px;
  }

  .result-actions .home-button {
    min-height: 48px;
  }

  .game-toolbar {
    min-height: 126px;
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: 7px;
  }

  .picture-card {
    width: min(20dvh, 132px);
    border-radius: 20px;
  }

  .puzzle-zone {
    padding-top: 2px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .left-options {
    gap: 7px;
  }

  .part-option {
    height: min(18dvh, 100px);
    min-height: 64px;
    border-radius: 16px;
  }

  .composition-board {
    min-height: min(46dvh, 270px);
  }

  .assembled-character {
    height: min(31dvh, 170px, 60cqw);
  }

  .mini-header {
    min-height: 154px;
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: 7px;
  }

  /* 矮横屏采用紧凑的左右排列，避免标题和参考卡挤压掉落区域。 */
  .mini-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .mini-reference-card {
    width: min(18dvh, 94px);
    min-width: min(18dvh, 94px);
    height: min(18dvh, 94px);
  }

  .mini-target {
    max-height: min(14dvh, 82px);
  }
}

@media (max-width: 374px) {
  .music-toggle {
    width: 50px;
    height: 50px;
    padding: 4px;
    border-radius: 15px;
  }

  .music-toggle-icon {
    transform: scale(0.88);
  }

  .music-toggle-label {
    font-size: 10px;
  }

  .game-toolbar {
    min-height: 166px;
  }

  .picture-card {
    width: 126px;
  }

  .puzzle-zone {
    grid-template-columns: 84px minmax(24px, 1fr) 148px;
    gap: 6px;
  }

  .part-option {
    height: clamp(98px, 18dvh, 134px);
    padding: 6px;
  }

  .composition-box {
    padding: 8px;
  }

  .composition-board {
    min-height: 182px;
  }

  .assembled-character {
    height: min(99px, 60cqw);
  }

  .mini-header {
    gap: 8px;
  }

  .mini-prompt {
    gap: 9px;
  }

  .mini-reference-card {
    width: 70px;
    min-width: 70px;
    height: 92px;
  }

  .mini-controls {
    padding-top: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .part-option,
  .feedback,
  .falling-part,
  .falling-card-inner,
  .assembled-left,
  .right-part,
  .start-button,
  .speaker-button,
  .music-toggle,
  .result-actions button,
  .result-actions .home-button {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
