:root {
  --paper: #edf1e7;
  --ink: #314438;
  --muted: #63715e;
  --line: #b8c6af;
  --cream: #fffef6;
  --accent: #b9513b;
  --sans:
    "Hiragino Sans", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei",
    system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.app-shell {
  width: min(1240px, calc(100% - 64px));
  height: 100dvh;
  min-height: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
}
.heading {
  height: 105px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: #ac4f3b;
  color: #fffdf5;
  width: 43px;
  height: 43px;
  border-radius: 15px 15px 15px 4px;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 3px 0 #8e44372b;
  transform: rotate(-5deg);
}
h1 {
  font-size: 23px;
  letter-spacing: 0.015em;
  margin: 0;
  font-weight: 750;
  line-height: 1.35;
}
h1 > span {
  font-size: 12px;
  margin-left: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}
.heading p {
  font-size: 10px;
  letter-spacing: 0.08em;
  margin: 5px 0 0;
  color: var(--muted);
}
.header-note {
  font-size: 11px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b5943;
  box-shadow: 0 0 0 4px #8b594310;
}
.game {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #afbf99;
  border: 1px solid #a5b99c;
  border-radius: 20px;
  box-shadow:
    0 5px 0 #ccd4bf,
    0 15px 45px #445c3220;
  touch-action: none;
}
.world-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1000px;
  height: 760px;
  transform-origin: 0 0;
  will-change: transform;
}
.map-art {
  position: absolute;
  inset: 0;
  width: 1000px;
  height: 760px;
  pointer-events: none;
}
.player {
  position: absolute;
  width: 64px;
  height: 104px;
  transform: translate(-50%, -100%);
  will-change: left, top;
  z-index: 2;
  pointer-events: none;
}
.player-shadow {
  position: absolute;
  bottom: -3px;
  left: 9px;
  width: 46px;
  height: 12px;
  border-radius: 50%;
  background: #52634535;
  filter: blur(1px);
}
.character-art {
  position: absolute;
  inset: 0;
  transform-origin: 50% 90%;
}
.character-art > svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
  filter: drop-shadow(0 2px 0 #354d3020);
}
.player-name {
  position: absolute;
  bottom: -19px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.05em;
  background: #fffdf1e8;
  color: #40563f;
  border: 1px solid #82987588;
  border-radius: 4px;
  padding: 2px 6px;
  box-shadow: 0 1px 3px #4c603014;
}
.map-corner-label {
  position: absolute;
  top: 22px;
  left: 25px;
  z-index: 3;
  display: flex;
  gap: 9px;
  align-items: center;
  color: #40593d;
  pointer-events: none;
}
.map-corner-label > span:first-child {
  font-size: 25px;
  color: #a45d47;
}
.map-corner-label > span:last-child {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
}
.map-corner-label small {
  display: block;
  font:
    7px ui-monospace,
    monospace;
  letter-spacing: 0.16em;
  color: #53694a;
  margin-top: 4px;
}
.map-edition {
  position: absolute;
  top: 26px;
  right: 27px;
  z-index: 3;
  font:
    8px ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  color: #465c3c;
  pointer-events: none;
}
.speech-bubble {
  position: absolute;
  z-index: 5;
  width: 350px;
  max-width: calc(100% - 28px);
  background: var(--cream);
  border: 2px solid #657a58;
  border-radius: 18px;
  padding: 19px 23px 15px;
  box-shadow:
    0 5px 0 #788b5950,
    0 12px 26px #3d4a2620;
  pointer-events: none;
  left: 50%;
  top: 15%;
  -webkit-user-select: text;
  user-select: text;
}
.bubble-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}
.speaker-name {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
}
.speech-tag {
  font-size: 8px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.speaking-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 8px;
}
.speaking-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #a15c43;
  opacity: 0.4;
}
.is-speaking .speaking-dots i {
  animation: speaking-dot 0.65s ease-in-out infinite;
}
.is-speaking .speaking-dots i:nth-child(2) {
  animation-delay: 0.12s;
}
.is-speaking .speaking-dots i:nth-child(3) {
  animation-delay: 0.24s;
}
.language-label {
  font-size: 8px;
  color: #65735d;
  letter-spacing: 0.06em;
}
#quote-ja {
  font-family: "Hiragino Sans", "Yu Gothic", var(--sans);
  font-size: 21px;
  line-height: 1.65;
  font-weight: 700;
  letter-spacing: 0.005em;
  margin: 7px 0 14px;
  overflow-wrap: anywhere;
}
#quote-ja.long {
  font-size: 19px;
}
.translation-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 8px;
  color: #63715e;
  letter-spacing: 0.05em;
}
.translation-divider:before,
.translation-divider:after {
  content: "";
  height: 1px;
  background: #e0e4d4;
  flex: 1;
}
.translation-divider:before {
  max-width: 18px;
}
#quote-zh {
  font-size: 14px;
  line-height: 1.85;
  margin: 8px 0 11px;
  font-weight: 500;
  color: #99533d;
  overflow-wrap: anywhere;
}
.source-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-top: 1px solid #e6e8db;
  padding-top: 9px;
  color: #66735c;
  font-size: 8px;
  line-height: 1.5;
}
.bubble-period {
  font:
    8px ui-monospace,
    monospace;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.bubble-tail {
  position: absolute;
  left: var(--tail-x, 50%);
  bottom: -12px;
  width: 20px;
  height: 20px;
  background: var(--cream);
  border-right: 2px solid #657a58;
  border-bottom: 2px solid #657a58;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 4px 0;
}
.tail-up .bubble-tail {
  top: -12px;
  bottom: auto;
  transform: translateX(-50%) rotate(225deg);
}
.dpad-wrap {
  position: absolute;
  bottom: 21px;
  left: 26px;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}
.dpad {
  width: 144px;
  height: 144px;
  display: grid;
  grid-template: repeat(3, 48px) / repeat(3, 48px);
  filter: drop-shadow(0 5px 0 #38503722);
  pointer-events: auto;
  touch-action: none;
}
.dpad button {
  position: relative;
  display: grid;
  place-items: center;
  border: 1.5px solid #718366;
  background: #fafbf1ed;
  color: #42583b;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  outline-offset: 2px;
  transition: background 0.1s;
  min-width: 0;
  padding: 0;
}
.dpad button:hover {
  background: #edf2e1;
}
.dpad button.pressed,
.dpad button:active {
  background: #c6d7af;
  box-shadow: inset 0 3px 0 #6e835239;
  transform: translateY(2px);
}
.dpad button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.dpad button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pad-up {
  grid-area: 1/2;
  border-radius: 12px 12px 0 0;
  border-bottom: 0 !important;
}
.pad-left {
  grid-area: 2/1;
  border-radius: 12px 0 0 12px;
  border-right: 0 !important;
}
.pad-right {
  grid-area: 2/3;
  border-radius: 0 12px 12px 0;
  border-left: 0 !important;
}
.pad-down {
  grid-area: 3/2;
  border-radius: 0 0 12px 12px;
  border-top: 0 !important;
}
.pad-center {
  grid-area: 2/2;
  display: grid;
  place-items: center;
  background: #fafbf1ed;
}
.pad-center > span {
  height: 13px;
  width: 13px;
  border: 1.5px solid #85967b;
  border-radius: 50%;
  background: #e1e9d8;
}
.dpad-wrap > p {
  font-size: 9px;
  color: #40563c;
  margin: 12px 0 0;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px #f7faed;
}
.scene-note {
  position: absolute;
  bottom: 35px;
  right: 33px;
  z-index: 3;
  color: #42563b;
  text-align: right;
  pointer-events: none;
}
.note-flower {
  font-size: 24px;
  color: #967442;
}
.scene-note p {
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  font-weight: 550;
  margin: 6px 0 12px;
  text-shadow: 0 1px 5px #e7eedc;
}
.scene-note-line {
  width: 20px;
  height: 2px;
  background: #859872;
  display: inline-block;
}
.loading-status {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 11px;
  background: #fffdf5e8;
  color: var(--ink);
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  z-index: 20;
}
.loading-status[hidden] {
  display: none;
}
footer {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.noscript {
  position: fixed;
  inset: auto 10px 20px;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--accent);
  padding: 20px;
  z-index: 30;
  border-radius: 10px;
  text-align: center;
}
#chibi-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 5.1s infinite;
}
#chibi-mouth-open {
  display: none;
}
.is-speaking #chibi-mouth-open {
  display: inline;
  transform-box: fill-box;
  transform-origin: 50% 30%;
  animation: mouth-talk 0.21s ease-in-out infinite alternate;
}
.is-speaking #chibi-mouth-closed {
  display: none;
}
.is-speaking #chibi-arm {
  transform-box: fill-box;
  transform-origin: 80% 10%;
  animation: hand-talk 0.7s ease-in-out infinite alternate;
}
.is-speaking #chibi-head {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  animation: head-talk 0.6s ease-in-out infinite alternate;
}
.is-moving .character-art {
  animation: walking 0.22s ease-in-out infinite alternate;
}
.is-moving #chibi-leg-left {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: leg-step 0.22s ease-in-out infinite alternate;
}
.is-moving #chibi-leg-right {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: leg-step 0.22s ease-in-out infinite alternate-reverse;
}
.facing-left .character-art {
  scale: -1 1;
}
.is-hidden * {
  animation-play-state: paused !important;
}
@keyframes blink {
  0%,
  43%,
  47%,
  100% {
    transform: scaleY(1);
  }
  45% {
    transform: scaleY(0.08);
  }
}
@keyframes mouth-talk {
  from {
    transform: scaleY(0.25);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes hand-talk {
  from {
    transform: rotate(-3deg);
  }
  to {
    transform: rotate(7deg);
  }
}
@keyframes head-talk {
  from {
    transform: rotate(-1deg);
  }
  to {
    transform: rotate(1.5deg);
  }
}
@keyframes walking {
  from {
    translate: 0 -2px;
    rotate: -2deg;
  }
  to {
    translate: 0 0;
    rotate: 2deg;
  }
}
@keyframes leg-step {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}
@keyframes speaking-dot {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(1px);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
@media (max-width: 700px) {
  .app-shell {
    width: calc(100% - 28px);
  }
  .heading {
    height: 88px;
  }
  .brand {
    gap: 10px;
  }
  .brand-icon {
    width: 35px;
    height: 35px;
    font-size: 22px;
    border-radius: 12px 12px 12px 3px;
  }
  h1 {
    font-size: 20px;
  }
  h1 > span {
    display: none;
  }
  .heading p {
    font-size: 8px;
    margin-top: 4px;
  }
  .header-note {
    font-size: 9px;
    max-width: 80px;
    line-height: 1.8;
    gap: 6px;
  }
  .game {
    border-radius: 15px;
  }
  .map-corner-label {
    left: 17px;
    top: 17px;
    gap: 7px;
  }
  .map-corner-label > span:first-child {
    font-size: 20px;
  }
  .map-corner-label > span:last-child {
    font-size: 10px;
  }
  .map-corner-label small {
    font-size: 6px;
  }
  .map-edition {
    right: 17px;
    top: 23px;
    font-size: 7px;
  }
  .speech-bubble {
    width: 326px;
    padding: 16px 18px 13px;
    border-radius: 16px;
  }
  .bubble-heading {
    margin-bottom: 12px;
  }
  .speaker-name {
    font-size: 10px;
  }
  .speech-tag {
    font-size: 7px;
  }
  #quote-ja {
    font-size: 20px;
    line-height: 1.65;
    margin: 7px 0 12px;
  }
  #quote-ja.long {
    font-size: 18px;
  }
  #quote-zh {
    font-size: 13px;
    line-height: 1.8;
    margin: 8px 0 10px;
  }
  .dpad-wrap {
    left: 17px;
    bottom: 20px;
  }
  .dpad {
    width: 138px;
    height: 138px;
    grid-template: repeat(3, 46px) / repeat(3, 46px);
  }
  .dpad-wrap > p {
    font-size: 8px;
    margin-top: 10px;
  }
  .scene-note {
    right: 22px;
    bottom: 35px;
  }
  .scene-note p {
    font-size: 10px;
  }
  .note-flower {
    font-size: 22px;
  }
  footer {
    height: 36px;
    font-size: 8px;
  }
  .bubble-period,
  .source-line {
    font-size: 7px;
  }
  .source-line {
    padding-top: 8px;
  }
}
@media (max-width: 360px) {
  .app-shell {
    width: calc(100% - 20px);
  }
  .heading {
    height: 80px;
  }
  .brand {
    gap: 7px;
  }
  h1 {
    font-size: 18px;
  }
  .heading p {
    font-size: 7px;
  }
  .header-note {
    font-size: 8px;
    max-width: 65px;
  }
  .speech-bubble {
    padding: 14px 15px 12px;
  }
  .speech-tag {
    font-size: 6px;
  }
  #quote-ja {
    font-size: 18px;
  }
  #quote-ja.long {
    font-size: 16px;
  }
  #quote-zh {
    font-size: 12px;
  }
  .dpad-wrap {
    left: 14px;
    bottom: 16px;
  }
  .dpad {
    width: 126px;
    height: 126px;
    grid-template: repeat(3, 42px) / repeat(3, 42px);
  }
  .scene-note {
    right: 18px;
    bottom: 28px;
  }
  .map-corner-label > span:last-child {
    font-size: 9px;
  }
  .map-edition {
    font-size: 6px;
  }
}
@media (max-height: 650px) and (min-width: 700px) {
  .heading {
    height: 70px;
  }
  footer {
    height: 30px;
  }
  .speech-bubble {
    width: 350px;
    padding: 13px 18px 10px;
  }
  #quote-ja {
    font-size: 17px;
    margin: 5px 0 9px;
  }
  #quote-zh {
    font-size: 12px;
    margin: 6px 0 7px;
  }
  .bubble-heading {
    margin-bottom: 7px;
  }
  .dpad {
    width: 114px;
    height: 114px;
    grid-template: repeat(3, 38px) / repeat(3, 38px);
  }
  .dpad-wrap {
    bottom: 14px;
  }
  .dpad-wrap > p {
    margin-top: 8px;
    font-size: 8px;
  }
  .source-line {
    padding-top: 6px;
  }
  .scene-note {
    bottom: 20px;
  }
}
.game {
  touch-action: pan-y;
}
.bubble-content {
  max-height: calc(var(--bubble-limit, 800px) - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  pointer-events: auto;
}
.compact-bubble .bubble-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 12px;
}
.compact-bubble .bubble-heading {
  grid-column: 1/-1;
  grid-row: 1;
  margin-bottom: 8px;
}
.compact-bubble .language-label {
  grid-column: 1;
  grid-row: 2;
  font-size: 7px;
}
.compact-bubble .translation-divider {
  grid-column: 2;
  grid-row: 2;
  display: block;
  font-size: 7px;
}
.compact-bubble .translation-divider:before,
.compact-bubble .translation-divider:after {
  display: none;
}
.compact-bubble #quote-ja {
  grid-column: 1;
  grid-row: 3;
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 9px;
}
.compact-bubble #quote-ja.long {
  font-size: 14px;
}
.compact-bubble #quote-zh {
  grid-column: 2;
  grid-row: 3;
  font-size: 12px;
  line-height: 1.6;
  margin: 6px 0 9px;
}
.compact-bubble .source-line {
  grid-column: 1/-1;
  grid-row: 4;
  padding-top: 6px;
  font-size: 7px;
}
.compact-landscape .speech-bubble {
  width: min(390px, calc(50% - 32px));
  padding: 14px 16px;
}
.compact-landscape .bubble-tail {
  left: -12px;
  top: var(--tail-y, 50%);
  bottom: auto;
  transform: translateY(-50%) rotate(135deg);
}
.compact-landscape .scene-note {
  display: none;
}
@media (max-height: 700px) and (max-width: 700px) {
  .heading {
    height: 68px;
  }
  footer {
    height: 28px;
  }
  .heading p {
    font-size: 7px;
  }
  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 19px;
  }
  h1 {
    font-size: 17px;
  }
  .header-note {
    font-size: 8px;
  }
  .compact-bubble .speech-bubble {
    padding: 13px 14px 11px;
  }
  .compact-bubble .speaker-name {
    font-size: 9px;
  }
  .compact-bubble .speech-tag {
    font-size: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
