:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #31142f;
  color: #ffe9f4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font: inherit; }
button:focus-visible { outline: 3px solid #fff3be; outline-offset: 5px; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #62264f, #281226 80%);
}
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
}
.project-name {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: .025em;
}
.version-badge {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #aa598c;
  border-radius: 99px;
  background: #4c2145;
  color: #ffd6ed;
  font-size: 12px;
}
.stage-area {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}
.stage {
  container-type: inline-size;
  position: relative;
  flex: none;
  width: 100%;
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  background: #6a3153;
  border-radius: 12px;
  box-shadow: 0 0 0 1px #d56ab047, 0 16px 50px #10091280;
  isolation: isolate;
}
.world-layer, .desktop-background, .food-layer, .ui-layer, .ui-layer > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.world-layer {
  z-index: 0;
  transform-origin: center;
}
.desktop-background {
  display: block;
  object-fit: fill;
  pointer-events: none;
}
.food-layer { z-index: 1; }
.food {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0; padding: 0; background: transparent; color: inherit;
  cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.food:disabled { cursor: default; }
.food.is-held { cursor: grabbing; filter: drop-shadow(0 6px 8px #3a123577); }
.food.is-held .food-shadow { opacity: 0; }
.food.is-eaten { animation: swallow .32s ease-in forwards; }
@keyframes swallow { to { transform: translate(-50%, -30%) scale(.08); opacity: 0; } }
.food-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}
.food-shadow {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 34%;
  bottom: 15%;
  border-radius: 50%;
  background: #58324c2e;
  filter: blur(2.2px);
  pointer-events: none;
}
.food[data-standing="true"] .food-shadow {
  left: 14%;
  right: 14%;
  height: 11%;
  bottom: -2%;
}
.ui-layer {
  z-index: 2;
  pointer-events: none;
}
.ui-layer > img {
  display: block;
  user-select: none;
}
.ui-layer > svg { display: block; width: 100%; height: 100%; }
.scene-shade { position: absolute; inset: 0; z-index: 1; background: #08040c; opacity: 0; pointer-events: none; }
.hotspot { position: absolute; z-index: 4; border: 0; padding: 0; color: transparent; background: transparent; cursor: pointer; border-radius: 999px; touch-action: manipulation; }
.hotspot:disabled { cursor: default; }
.hotspot:hover:not(:disabled) { box-shadow: inset 0 0 0 2px #fff4c355; }
.hotspot:focus-visible { outline: 3px solid #fff3be; outline-offset: 0; }
.pause-hit { left: 71.35%; top: 2%; width: 11.01%; height: 8.72%; }
.restart-hit { left: 83.37%; top: 2%; width: 15.55%; height: 8.72%; }
.record-hit { left: 79.36%; top: 88.73%; width: 19.56%; height: 9.14%; }
.mouth-hit { left: 40.5%; top: 79.5%; width: 19%; height: 20%; border-radius: 45%; }
.mouth-hit.is-target { outline: 3px dashed #fff2b6; outline-offset: -5px; }
.drag-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.drag-layer .food { pointer-events: auto; }
.waiting-layer { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; background: radial-gradient(ellipse at center, #ffd7ec6b, transparent 48%); }
.waiting-clock { width: 23%; filter: drop-shadow(0 8px 20px #5e124c77); }
.waiting-label { margin-top: -1.3%; border: 2px solid #ffd8ef; border-radius: 99px; padding: .45% 2.5%; background: linear-gradient(#d13a91,#a32277); color: #fff6e8; font-weight: 800; font-size: clamp(12px, 2cqw, 28px); box-shadow: 0 3px 0 #7c225c; }
.feedback { position: absolute; z-index: 7; top: 13%; left: 50%; transform: translateX(-50%); margin: 0; padding: 9px 18px; max-width: 75%; width: max-content; border: 1px solid #ffcee5; border-radius: 99px; background: #5d1e51ee; color: #fff3dd; font-size: clamp(11px,1.35cqw,20px); text-align: center; pointer-events: none; }
.stage[data-suspended="true"] .food.is-eaten { animation-play-state: paused; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.portrait-hint { display: none; }

dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0; overflow: auto; color: #62204c; border: 5px solid #f653ab; border-radius: 34px; background: linear-gradient(145deg,#fff9ee 30%,#ffe5ed); box-shadow: 0 0 0 3px #65144f, 0 0 0 6px #ffb4e5, 0 18px 80px #160617aa; }
dialog::backdrop { background: #24102799; }
.panel-content { padding: 22px 30px 26px; border: 4px solid #ffd1e7; border-radius: 28px; text-align: center; }
.panel-emblem { color: #fb4aa1; font-size: 54px; line-height: 1; text-shadow: 0 2px 0 #8d256a, 2px 0 0 #fff, -2px 0 0 #fff; }
.panel-emblem.broken { color: #bb3b86; }
.panel-content h1 { font-size: clamp(25px,3vw,38px); line-height: 1.25; margin: 9px 0; color: #a71c6b; text-shadow: 0 2px 0 #fff; }
.panel-subtitle { margin: 8px auto 18px; line-height: 1.65; font-weight: 650; font-size: 15px; max-width: 540px; }
.panel-body { text-align: left; }
.instruction-list { list-style: none; margin: 8px 0 18px; padding: 0; display: grid; gap: 9px; }
.instruction-list li { display: flex; align-items: center; gap: 16px; border: 1px solid #f4b2d0; border-radius: 17px; padding: 13px 17px; background: #fff8f5a3; }
.instruction-list li > span { display: grid; place-items: center; flex-shrink: 0; width: 41px; height: 41px; border-radius: 50%; color: #fff4e8; background: linear-gradient(#e66db6,#ac3289); font-weight: 800; font-size: 17px; }
.instruction-list strong { font-size: 17px; }
.instruction-list p { font-size: 14px; margin: 5px 0 0; line-height: 1.5; }
.simulation-note { margin: 12px 8px; color: #84596f; font-size: 12px; line-height: 1.75; text-align: center; }
.panel-actions { margin-top: 19px; display: flex; flex-wrap: wrap; gap: 13px; justify-content: center; }
.candy-button { cursor: pointer; padding: 13px 26px; min-height: 48px; border: 2px solid #8c2268; border-radius: 99px; box-shadow: inset 0 0 0 3px #ffbfe5, inset 0 5px 2px #ffffff66, 0 4px 0 #861d63; background: linear-gradient(#ff87c7 0%,#f83798 60%,#d71d81); color: #fff8ea; font-size: 19px; font-weight: 800; text-shadow: 0 2px 0 #8a245c; }
.candy-button:hover { filter: brightness(1.07); }
.candy-button:active { transform: translateY(2px); box-shadow: inset 0 0 0 3px #ffbfe5, 0 2px 0 #861d63; }
.candy-button.secondary { background: linear-gradient(#c078f3,#9a3bd1 60%,#7730a9); border-color: #69288c; box-shadow: inset 0 0 0 3px #dab0f4, inset 0 5px 2px #ffffff55, 0 4px 0 #54216e; }
.record-table { overflow: auto; max-height: min(36dvh,320px); border: 1px solid #f099c2; border-radius: 16px; }
table { border-collapse: collapse; width: 100%; color: #65224b; font-size: 15px; }
th,td { padding: 12px 14px; border-bottom: 1px solid #f5bad4; text-align: center; }
thead { position: sticky; top: 0; background: #fac2dc; z-index: 1; }
tbody th { text-align: left; font-weight: 650; }
tbody th img { display: inline-block; width: 55px; height: 55px; object-fit: contain; vertical-align: middle; margin-right: 12px; }
tbody td:last-child { font-weight: 800; white-space: nowrap; }
.record-total { display: flex; justify-content: space-between; align-items: center; padding: 9px 22px; margin: 13px 0; border: 1px solid #ef9fc4; border-radius: 17px; background: #ffd2e6; font-weight: 750; font-size: 19px; }
.record-total strong { font-size: 30px; color: #d31975; }
.record-status { display: grid; gap: 10px; padding: 5px 18px; }
.status-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px; font-weight: 700; }
.mini-track { display: block; height: 23px; background: #5e1b60; border: 2px solid #bd4b9b; border-radius: 99px; overflow: hidden; }
.mini-track > span { display: block; height: 100%; background: linear-gradient(#fff290,#ffc335); border-radius: inherit; }
.mini-track > span.restored { background: linear-gradient(#b1f6be,#4dcd91); }
.empty-record { text-align: center; padding: 24px 5px; }
.loading-message {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  margin: 0;
  padding: 12px 20px;
  border: 1px solid #d176ae;
  border-radius: 14px;
  background: #3a1839f2;
  color: #ffedf5;
  font-size: 14px;
  text-align: center;
}
.loading-message[hidden] { display: none; }
.project-footer {
  padding: 11px 16px 13px;
  color: #d6a4c2;
  text-align: center;
  font-size: 12px;
}
.no-script { position: fixed; bottom: 20px; width: 100%; text-align: center; }
@media (max-width: 600px) {
  .project-header { padding: 12px; gap: 8px; }
  .project-name { font-size: 14px; }
  .version-badge { padding: 5px 8px; font-size: 10px; }
  .stage-area { padding: 0 8px; }
  .stage { border-radius: 7px; }
  .project-footer { font-size: 10px; padding: 10px 8px; }
  .panel-content { padding: 18px 15px; }
  .panel-subtitle { font-size: 13px; }
  .instruction-list li { padding: 11px; gap: 10px; }
  .instruction-list strong { font-size: 15px; }
  .instruction-list p { font-size: 12px; }
  .panel-actions { gap: 10px; }
  .candy-button { font-size: 16px; padding: 11px 20px; }
  th,td { padding: 9px 5px; font-size: 12px; }
  tbody th img { width: 34px; height: 34px; margin-right: 5px; }
  .record-total strong { font-size: 26px; }
}
@media (orientation: portrait) { .portrait-hint { display: inline; } }
@media (prefers-reduced-motion: reduce) { .food.is-eaten { animation-duration: .01s; } }
