:root {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #25352b;
  background: var(--field, #c7dda0);
  font-synthesis: none;
  --pink: #df633e;
  --sage: #416538;
  --line: #9ab477;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--field, #c7dda0);
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: default;
  opacity: 0.42;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #3b817b;
  outline-offset: 4px;
}
button {
  touch-action: manipulation;
}
.site-header {
  max-width: 1200px;
  margin: auto;
  padding: 25px 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand {
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
  color: #25352b;
}
.brand-mark {
  background: #f4ce55;
  width: 38px;
  height: 38px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 30px;
}
.brand-mark svg {
  width: 75%;
  height: 75%;
}
.brand-en {
  font-size: 8px;
  letter-spacing: 2px;
  width: 80px;
  line-height: 1.7;
  text-align: left;
  margin-left: 8px;
  color: #415c36;
}
nav {
  display: flex;
  gap: 25px;
}
nav button {
  background: none;
  border: 0;
  color: #25352b;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
}
nav button:last-child {
  font-size: 24px;
}
main {
  max-width: 1120px;
  margin: auto;
  min-height: calc(100vh - 177px);
}
.home {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  text-align: center;
  max-width: 640px;
  margin: auto;
  padding: 12px 24px 40px;
}
.home .scene {
  width: min(100%, 300px);
}
.home .eyebrow {
  justify-content: center;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--sage);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow:before {
  content: "";
  display: inline-block;
  width: 25px;
  height: 1px;
  background: var(--sage);
}
h1 {
  font-size: 42px;
  line-height: 1.2;
  letter-spacing: -1px;
  margin: 12px 0;
  font-weight: 850;
}
h1 em {
  font-style: normal;
  color: var(--pink);
}
.intro {
  font-size: 15px;
  line-height: 2;
  color: #415c36;
}
.primary {
  background: #f4ce55;
  border: 2px solid #25352b;
  color: #25352b;
  padding: 16px 28px;
  border-radius: 5px;
  box-shadow: 0 5px 0 #25352b;
  font-weight: 700;
  font-size: 15px;
  min-height: 50px;
  transition: transform 0.15s;
}
.primary:hover {
  transform: translateY(-2px);
}
.primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #25352b;
}
.secondary {
  background: #fff8d8;
  color: #25352b;
  border: 2px solid #25352b;
  border-radius: 5px;
  padding: 12px 18px;
  min-height: 46px;
}
.home .primary {
  margin-top: 21px;
  min-width: 230px;
}
.little-note {
  margin-top: 22px;
  color: #415c36;
  font-size: 11px;
  letter-spacing: 1px;
}
.scene {
  position: relative;
}
.scene img {
  width: 100%;
  display: block;
}
.scene-tag {
  position: absolute;
  bottom: 3%;
  right: 8%;
  background: #fff8d8;
  border: 2px solid #25352b;
  border-radius: 5px;
  padding: 12px 22px;
  transform: rotate(-5deg);
  font-size: 12px;
  color: #415c36;
  box-shadow: 0 5px 0 #25352b;
}
.scene-tag strong {
  color: #25352b;
}
.site-footer {
  max-width: 1120px;
  margin: auto;
  padding: 23px 30px;
  display: flex;
  justify-content: space-between;
  color: #415c36;
  font-size: 10px;
  letter-spacing: 1px;
}
.play-layout {
  max-width: 450px;
  margin: auto;
  padding: 16px 12px 24px;
}
.story-panel {
  display: none;
}
.story-panel h1 {
  font-size: 42px;
  letter-spacing: -2px;
  margin: 20px 0;
}
.story-panel .hint {
  font-size: 14px;
  color: #967c76;
  line-height: 1.9;
  max-width: 280px;
}
.story-panel img {
  width: 260px;
  display: block;
  margin: 15px 0 0;
}
.chapter-track {
  display: flex;
  gap: 6px;
  margin-top: 26px;
}
.chapter-track i {
  width: 18px;
  height: 5px;
  background: #e4d7c7;
  border-radius: 4px;
}
.chapter-track i.done {
  background: #9eafa0;
}
.chapter-track i.current {
  background: var(--pink);
  width: 30px;
}
.back-home {
  margin-top: 15px;
  border: 0;
  background: none;
  color: #987c73;
  font-size: 12px;
  padding: 12px 0;
}
.game-card {
  padding: 12px;
}
.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.level-pill {
  background: #fff8d8;
  color: #25352b;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 5px;
}
.mini-controls {
  display: flex;
  gap: 6px;
}
.mini-controls button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #25352b;
  font-size: 17px;
}
.meter-row {
  display: flex;
  justify-content: space-between;
  color: #415c36;
  font-size: 10px;
  margin: 10px 2px 7px;
}
.meter {
  height: 5px;
  background: #a9c282;
  border-radius: 5px;
  overflow: hidden;
}
.meter div {
  height: 100%;
  background: #416538;
  border-radius: 5px;
  transition: width 0.2s;
}
.board {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 300/340;
  margin: 8px auto 0;
}
.board canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 5px;
}
.tile-hit {
  position: absolute;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0;
  color: transparent;
  outline-offset: 0 !important;
}
.tile-hit:focus-visible {
  outline: 3px solid #347e77;
  background: #5caa951b;
}
.tile-hit:disabled {
  opacity: 1;
}
.tray-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  margin: 6px 2px 9px;
}
.tray-caption span {
  font-size: 10px;
  color: #415c36;
  font-weight: 400;
}
.tray {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  background: #bb8956;
  border: 2px solid #25352b;
  border-radius: 5px;
  box-shadow: 0 4px 0 #25352b;
}
.slot {
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  background: #e1b57d;
  border: 1px solid #87653e;
  display: grid;
  place-items: center;
}
.slot svg {
  width: 92%;
  height: 92%;
  animation: arrive 0.18s ease-out;
}
.slot.filled {
  background: #fff8d8;
  box-shadow: 0 2px 0 #25352b;
}
.tray.warning {
  border-color: var(--pink);
  background: #ed9672;
}
.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.tool {
  border: 2px solid #25352b;
  border-radius: 5px;
  background: #fff8d8;
  min-height: 57px;
  color: #25352b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
}
.tool b {
  font-size: 21px;
  font-weight: 400;
  color: #25352b;
}
.tool small {
  color: #415c36;
  font-size: 10px;
}
.pocket {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  background: #b5cd8d;
  padding: 6px 9px;
  border-radius: 5px;
}
.pocket span {
  font-size: 10px;
  color: #415c36;
  margin-right: auto;
}
.pocket button {
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 1px dashed #415c36;
  border-radius: 5px;
  background: #fff8d8;
}
.pocket svg {
  width: 100%;
}
.mobile-hint {
  text-align: center;
  font-size: 12px;
  color: #415c36;
  line-height: 1.6;
  min-height: 20px;
}
dialog {
  border: 2px solid #25352b;
  border-radius: 5px;
  background: #fff8d8;
  color: #25352b;
  padding: 27px;
  width: min(470px, calc(100% - 28px));
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 6px 6px 0 #25352b;
}
dialog::backdrop {
  background: #43333568;
}
dialog h2 {
  font-size: 27px;
  margin: 6px 0 13px;
  letter-spacing: -1px;
}
dialog p {
  color: #415c36;
  font-size: 13px;
  line-height: 1.85;
}
.dialog-close {
  float: right;
  border: 0;
  background: transparent;
  color: #25352b;
  font-size: 23px;
  width: 36px;
  height: 36px;
}
.dialog-kicker {
  font-size: 10px;
  letter-spacing: 2px;
  color: #415c36;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 23px;
}
.map-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  margin: 23px 0;
}
.level-button {
  border: 2px solid #25352b;
  border-radius: 5px;
  background: #fff8d8;
  color: #25352b;
  min-height: 70px;
}
.level-button strong {
  display: block;
  font-size: 22px;
}
.level-button span {
  display: block;
  color: #92630b;
  font-size: 10px;
  margin-top: 5px;
}
.level-button.current {
  background: var(--field, #c7dda0);
  border-color: #25352b;
}
.stars {
  color: #b67908;
  font-size: 36px;
  letter-spacing: 7px;
  margin: 12px 0;
}
.result {
  text-align: center;
}
.result-art {
  width: 190px;
  height: 175px;
  object-fit: cover;
  object-position: center 65%;
  margin: -8px auto 0;
  display: block;
}
.result .badge {
  border: 1px dashed #25352b;
  background: #f4ce55;
  padding: 12px;
  border-radius: 5px;
  font-size: 13px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #a8b583;
  padding: 17px 0;
  font-size: 14px;
  min-height: 55px;
}
.setting-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--sage);
}
.storage-buttons {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}
.storage-buttons button {
  flex: 1;
  font-size: 12px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 20px 0;
}
.stat-grid div {
  background: #e3e8b6;
  padding: 15px 6px;
  text-align: center;
  border-radius: 5px;
  font-size: 10px;
  color: #415c36;
}
.stat-grid strong {
  display: block;
  font-size: 23px;
  color: #25352b;
}
.badge-list {
  display: grid;
  gap: 8px;
}
.badge-row {
  background: #e3e8b6;
  border-radius: 5px;
  padding: 11px 14px;
  font-size: 12px;
}
.badge-row.locked {
  opacity: 0.5;
}
.badge-row small {
  display: block;
  color: #415c36;
  margin-top: 5px;
}
.tutorial-demo {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 17px;
  background: #e3e8b6;
  border-radius: 5px;
}
.tutorial-demo svg {
  width: 45px;
  height: 45px;
}
.tutorial-demo .empty {
  width: 45px;
  height: 45px;
  border: 1px dashed #415c36;
  border-radius: 5px;
}
.notice {
  font-size: 11px !important;
  color: #8b432a !important;
}
.file-input {
  display: none;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 15px);
  background: #25352b;
  color: #fff8d8;
  border-radius: 5px;
  padding: 12px 22px;
  font-size: 12px;
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 99;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.reduced * {
  animation: none !important;
  transition: none !important;
}
.contrast .game-card,
.contrast .tile-hit:focus-visible {
  border-color: #25352b;
}
.contrast {
  --line: #9e8973;
  color: #302327;
}
.contrast .intro,
.contrast .hint,
.contrast dialog p {
  color: #56434a;
}
@keyframes arrive {
  from {
    transform: translateY(-10px) scale(0.8);
    opacity: 0.5;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (max-width: 680px) {
  .site-header {
    padding: 12px 17px;
  }
  .brand {
    font-size: 19px;
    padding: 0;
    gap: 7px;
  }
  .brand-mark {
    width: 29px;
    height: 29px;
    font-size: 23px;
  }
  .brand-en {
    display: none;
  }
  nav {
    gap: 12px;
  }
  nav button {
    font-size: 11px;
  }
  nav button:last-child {
    font-size: 20px;
  }
  .home {
    display: flex;
    flex-direction: column-reverse;
    gap: 0;
    padding: 14px 25px 30px;
    min-height: auto;
  }
  .scene {
    width: min(100%, 255px);
  }
  .scene-tag {
    font-size: 10px;
    padding: 9px 16px;
  }
  .home-copy {
    width: 100%;
    max-width: 340px;
  }
  .home h1 {
    font-size: 32px;
    line-height: 1.2;
    margin: 17px 0 10px;
    letter-spacing: -2px;
  }

  .intro {
    font-size: 12px;
    margin: 10px 0;
  }
  .home .primary {
    width: 100%;
    margin-top: 10px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .little-note {
    font-size: 10px;
    margin-top: 18px;
  }
  .site-footer {
    padding: 20px 18px;
    gap: 10px;
    font-size: 9px;
    letter-spacing: 0;
  }
  .site-footer span:last-child {
    text-align: right;
  }
  .play-layout {
    display: block;
    padding: 10px 8px 17px;
    max-width: 410px;
    margin: auto;
  }
  .story-panel {
    display: none;
  }
  .game-card {
    padding: 11px;
    border-radius: 5px;
  }
  .board {
    max-width: 360px;
    margin-top: 1px;
  }
  .mobile-hint {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #415c36;
    line-height: 1.6;
    margin: 0 5px 7px;
    min-height: 18px;
  }
  .game-top {
    height: 37px;
  }
  .tools {
    margin-top: 12px;
  }
  .tool {
    min-height: 49px;
  }
  .meter-row {
    margin-top: 8px;
  }
  .tray-caption {
    margin-top: 3px;
  }
  main {
    min-height: calc(100dvh - 135px);
  }
}

.map-chapter h3 {
  margin-bottom: 8px;
  font-size: 15px;
}
.map-chapter .map-grid {
  margin: 10px 0 24px;
}
.chapter-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chapter-gallery figure {
  margin: 12px 0;
  text-align: center;
  font-size: 11px;
}
.chapter-gallery img {
  width: 100%;
}

/* Handwritten invitations stay legible on narrow screens. */
.friend-entry {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.friend-entry .secondary {
  background: #fff9df;
  font-weight: 800;
  transform: rotate(-1deg);
  box-shadow: 3px 3px 0 #25352b;
}
.friend-entry .back-home {
  margin: 0;
  padding: 8px;
}
.challenge-label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin: 14px 0 8px;
}
.join-row {
  display: flex;
  gap: 8px;
}
.join-row input,
.join-row select,
#invite-link {
  min-width: 0;
  width: 100%;
  padding: 12px 8px;
  border: 2px solid #25352b;
  border-radius: 6px;
  background: #fffdf0;
  color: #25352b;
  font: inherit;
  font-size: 14px;
}
.join-row .primary {
  padding: 10px 16px;
  white-space: nowrap;
}
.invite-stamp {
  display: inline-block;
  padding: 7px 12px;
  color: #954625;
  border: 2px dashed #ad613d;
  transform: rotate(-2deg);
  font-size: 12px;
  font-weight: 800;
}
.invite-code {
  font: 800 clamp(22px, 5vw, 32px) monospace;
  letter-spacing: 2px;
  background: #f4ce55;
  padding: 12px;
  border-radius: 5px;
  text-align: center;
}
.small-note {
  font-size: 12px;
  line-height: 1.7;
  color: #53654d;
}
#challenge-error {
  font-size: 13px;
  color: #a43527;
}
.challenge-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  background: #fff7da;
  border: 1px dashed #987c53;
  padding: 6px;
  margin-top: 6px;
}
.challenge-strip button,
.challenge-current {
  border: 0;
  color: #684528;
  background: transparent;
  text-decoration: underline;
  min-height: 36px;
  font-size: 12px;
}

/* Printed-paper scenery, rough-edged labels and a small recurring comic actor. */
body {
  background-image: radial-gradient(#25352b0a 0.7px, transparent 0.7px);
  background-size: 6px 6px;
}
.scene-ticket {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 9%;
  transform: rotate(-9deg);
  padding: 9px 12px;
  background: #f5ce56;
  border: 2px solid #25352b;
  box-shadow: 3px 3px 0 #25352b;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 1px;
}
.scene-ticket b {
  font-size: 12px;
}
.scene-tag:before {
  content: "";
  position: absolute;
  width: 38px;
  height: 15px;
  background: #dba374b3;
  top: -9px;
  left: 42%;
  transform: rotate(5deg);
}
.game-card {
  background: #fff9df55;
  border: 2px solid #25352b;
  border-radius: 16px 8px 14px 9px;
  box-shadow: 5px 6px 0 #25352b25;
}
.cat-reaction {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 4px 0;
}
.cat-reaction svg {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  transform: rotate(-5deg);
}
.cat-reaction span {
  font-size: 11px;
  font-weight: 700;
}
.cat-reaction i {
  margin-left: auto;
  font-size: 8px;
  color: #607054;
  writing-mode: vertical-rl;
}
.music-label {
  padding: 13px;
  border: 2px dashed #987c53;
  background: #f5ce5655;
  font-size: 14px;
  font-weight: 800;
  transform: rotate(-1deg);
  margin: 8px 0 20px;
}
.music-label small {
  display: block;
  font-weight: normal;
  font-size: 11px;
  margin-top: 6px;
}
.slot.filled {
  animation: paw-pop 0.18s ease-out;
}
@keyframes paw-pop {
  from {
    transform: translateY(-5px) rotate(-5deg);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .slot.filled {
    animation: none;
  }
}
.reduced .slot.filled {
  animation: none;
}
