.world-game {
  --game-ink: #271744;
  --game-accent: #7048db;
  --game-fill: #ded1ff;
  --game-scene: #30216d;
  --game-light: #a783ff;
  width: min(1160px,calc(100% - 28px));
  margin: 6px auto clamp(24px,5vw,50px);
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: clamp(10px, 2vw, 18px);
  padding: clamp(10px,2vw,22px);
  overflow: hidden;
  border: 1px solid #9884cb70;
  border-radius: 31px;
  color: var(--game-ink);
  background: linear-gradient(130deg,#f2e8ff,#f7f3ff 72%,#fff0e7);
  font-family: Fredoka,system-ui,sans-serif;
}
.world-game[data-lumi-game="eat"] {
  --game-accent: #167456;
  --game-fill: #d0f2d0;
  --game-scene: #075841;
  --game-light: #70c057;
  background: linear-gradient(130deg,#fff3d7,#ecfbe0 72%,#d6f4dd);
}
.world-game-info { padding: 6px 0 0; text-align: center; min-width: 0; }
.world-game-info h1 { margin: 0; font-size: clamp(1.95rem,5.5vw,3.9rem); line-height: 1; letter-spacing: -.035em; }
.world-game-rule { margin: 8px auto 3px; font-size: clamp(1rem,2.1vw,1.18rem); }
.world-game-meter { display: flex; align-items: center; gap: 10px; width: min(100%, 310px); margin-inline: auto; font-weight: 650; }
.world-game-meter span { width: 54px; text-align: end; flex: none; }
.world-game-meter progress { width: 100%; height: 12px; margin: 0; accent-color: var(--game-accent); }
.world-game-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px 14px; margin-top: 8px; }
.world-game-buttons button {
  min-height: 46px; padding: 8px 16px; touch-action: manipulation; cursor: pointer;
  border: 1px solid var(--game-ink); border-radius: 99px; background: var(--game-fill);
  color: var(--game-ink); font: 650 1rem Fredoka,system-ui,sans-serif; box-shadow: 0 3px var(--game-ink);
}
.world-game-buttons button:active { transform: translateY(2px); box-shadow: 0 1px var(--game-ink); }
.world-game-buttons a { color: inherit; font-weight: 600; text-underline-offset: 4px; }
.world-game :is(a,button):focus-visible { outline: 3px solid var(--game-accent); outline-offset: 3px; }
.world-game-status { min-height: 1.5em; margin: 6px 0 0; text-align: center; line-height: 1.35; font-weight: 600; }
.world-game-stage {
  isolation: isolate; position: relative; min-height: clamp(224px,34vw,355px); overflow: hidden; border-radius: 22px;
  background: radial-gradient(ellipse at 50% 50%,var(--game-light),transparent 56%),var(--game-scene);
}

.world-game-art { position: absolute; inset: 0; }
.world-game-hit { position: absolute; z-index: 4; inset: 0; width: 100%; border: 0; border-radius: inherit; background: transparent; cursor: pointer; touch-action: manipulation; }
.world-game .world-game-hit:focus-visible { outline-color: #fff5ba; outline-offset: -5px; }
.world-game-stage::before {
  position: absolute; content: ""; inset: 0;
  background-image: radial-gradient(#fff7 1px, transparent 1px); background-size: 22px 22px; opacity: .65;
}
.game-lumi {
  position: absolute; z-index: 2; left: 50%; bottom: 25%;
  width: clamp(118px, 23vw, 207px);
  transform-origin: center bottom; translate: -50% 0;
}
.game-avatar :is(svg, img) { display: block; width: 100%; overflow: visible; }
.game-shoe {
  position: absolute; bottom: 4%; width: 23%; height: 11%; border: 2px solid #23183f;
  border-radius: 55% 60% 25% 30%; background: #4cc8ff; left: 28%; z-index: -1;
}
.game-shoe:last-child { left: 50%; background: #ffb251; }
.game-treadmill {
  position: absolute; height: 14%; width: 65%; border-radius: 16px; bottom: 15%; left: 12%;
  border: 2px solid #190f35; background: #8a81be; box-shadow: 0 7px #19122e;
}
.game-treadmill i {
  position: absolute; overflow: hidden; inset: 1px 3px 33%; border-radius: 11px;
  background: repeating-linear-gradient(110deg,#3d3159 0 14px,#675189 14px 17px,#3d3159 17px 30px);
  background-size: 32px 100%;
}
.game-treadmill::after {
  position: absolute; content: ""; left: 100%; width: 11%; bottom: 55%; height: clamp(45px,9vw,92px);
  border-right: 8px solid #a99fe6; border-top: 9px solid #a99fe6; border-radius: 0 11px 0 0; transform: skew(-13deg);
}
[data-phase="play"] .game-treadmill i { animation: tape var(--game-speed) linear infinite; }
[data-phase="play"] .game-shoe { animation: shoe var(--game-speed) ease-in-out infinite alternate; }
[data-phase="play"] .game-shoe:last-child { animation-direction: alternate-reverse; }
[data-lumi-game="run"][data-phase="play"] .game-lumi { animation: lumi-run var(--game-speed) ease-in-out infinite alternate; }
@keyframes tape { to { background-position-x: -32px; } }
@keyframes shoe { to { transform: translate(10px,-6px) rotate(-18deg); } }
@keyframes lumi-run { to { transform: translateY(-6px) rotate(7deg); } }
.game-plate {
  position: absolute; display: flex; justify-content: center; align-content: center; flex-wrap: wrap; gap: 0 4px;
  left: 50%; bottom: 10%; width: min(62%,224px); min-height: 23%; padding: 5px 20px;
  transform: translateX(-50%); background: #fff5d9; border: 5px double #dcaa77; border-radius: 50%;
  font-size: clamp(.9rem,2.1vw,1.38rem); box-shadow: 0 6px #153f2c7d;
}
.game-plate i,.game-burst i { font-style: normal; }
[data-lumi-game="eat"] .game-lumi { bottom: 31%; scale: var(--lumi-size,1); transition: scale 135ms ease-out; }
.game-burst { position: absolute; z-index: 3; inset: 0; pointer-events: none; visibility: hidden; }
.game-burst i { position: absolute; left: 48%; top: 47%; color: hsl(var(--hue) 100% 74%); font-size: 1.5rem; }
[data-phase="win"] .game-burst { visibility: visible; }
[data-phase="win"] .game-burst i { animation: game-pop .68s cubic-bezier(.08,.65,.35,1) both; }
[data-lumi-game="run"][data-phase="win"] .game-avatar { filter: drop-shadow(0 0 16px #ffde40) drop-shadow(0 0 33px #ffd155); }
[data-lumi-game="run"][data-phase="win"] .game-lumi { transform: scale(1.12); }
[data-lumi-game="eat"][data-phase="win"] .game-lumi { scale: 1; animation: lumi-pop .52s ease-out; }
@keyframes game-pop { from { opacity: 0; } 25% {opacity: 1} to { transform: translate(var(--x),var(--y)) rotate(30deg); opacity: 0; } }
@keyframes lumi-pop { 0% {transform: scale(1.26)} 28% {transform: scale(.1);opacity:0} 100% {transform: scale(1);opacity:1} }
@media (prefers-reduced-motion: reduce) {
  .world-game [aria-hidden="true"] *, .world-game .game-lumi { animation: none !important; transition: none !important; }
  [data-phase="win"] .game-burst i { transform: translate(var(--x),var(--y)); }
}
[data-lumi-game="run"][data-phase="win"] .game-lumi::before {
  content: ""; position: absolute; z-index: -1; inset: -26% -30% -6%;
  background: radial-gradient(ellipse,#fffbe4 10%,#ffda39 54%,#ff9f2e 100%);
  clip-path: polygon(50% 0,59% 17%,77% 5%,76% 24%,96% 22%,86% 41%,100% 57%,84% 65%,95% 88%,74% 83%,64% 100%,52% 87%,36% 100%,26% 85%,6% 90%,15% 66%,0 54%,16% 42%,3% 24%,23% 26%,23% 5%,41% 18%);
  opacity: .86;
}

.world-game {
  box-sizing: border-box;
  width: min(900px, calc(100% - 28px));
  overflow: visible;
}
.world-game[data-lumi-game="run"] {
  --game-accent: #9c2342;
  --game-fill: #ffcedc;
  --game-scene: #52223c;
  --game-light: #f58bb3;
  background: linear-gradient(135deg, #fff4e8, #ffe5ed);
}
.world-game[data-lumi-game="sleep"] {
  --game-accent: #3556ab;
  --game-fill: #d7e8ff;
  --game-scene: #151735;
  --game-light: #525ab3;
  background: linear-gradient(145deg, #f4f6ff, #e7eaff);
}
.world-game-controls { padding-bottom: 8px; }
.world-game button[hidden] { display: none; }
.world-game-buttons .world-game-replay {
  background: #fff;
  box-shadow: none;
}
.world-game-buttons a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.world-game-hit:active { cursor: grabbing; }
.game-avatar :is(svg, img) { height: auto; }
[data-lumi-game="sleep"] .game-lumi { bottom: 19%; }
.game-pillow {
  position: absolute;
  left: 50%;
  bottom: 17%;
  translate: -50% 0;
  width: min(55%, 264px);
  height: 17%;
  border: 3px solid #251d57;
  border-radius: 44% 42% 36% 42%;
  background: linear-gradient(160deg, #f7f0ff, #b6a3ee);
  rotate: -5deg;
}
.game-moon {
  position: absolute;
  right: 12%;
  top: 8%;
  color: #ffdc80;
  font-size: clamp(2.8rem, 8vw, 5.25rem);
  line-height: 1;
}
[data-lumi-game="sleep"][data-phase="win"] .game-lumi { animation: game-wake .42s ease-out; }
@keyframes game-wake { 60% { transform: translateY(-22%) rotate(-7deg); } }
[data-lumi-game="sleep"]:not([data-phase="win"]) .game-avatar svg .lz { fill: #eff0ff; }
[data-lumi-game="sleep"][data-phase="ready"] .game-avatar { animation: game-breathe 2.6s ease-in-out infinite; }
@keyframes game-breathe { 50% { scale: 1.047; } }

.world-game-dialog {
  position: fixed;
  box-sizing: border-box;
  width: min(100% - 28px, 500px);
  max-height: calc(100dvh - 30px);
  margin: auto;
  padding: clamp(15px, 4vw, 28px);
  border: 2px solid var(--game-ink);
  border-radius: 24px;
  background: #fffcf8;
  color: var(--game-ink);
  text-align: center;
  overscroll-behavior: contain;
}
.world-game-dialog::backdrop { background: #140d2daa; }
.world-game-dialog h2 { margin: 3px 0 9px; font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.08; }
.world-game-dialog h2:focus { outline: none; }
.world-dialog-copy { margin: 0 0 14px; line-height: 1.42; font-size: 1.08rem; }
.world-dialog-avatar { width: 78px; margin: 0 auto; }
.world-dialog-avatar :is(svg, img) { display: block; width: 100%; height: auto; }
.world-dialog-actions { display: grid; gap: 7px; }
.world-game-dialog :is(button,a) {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--game-ink);
  border-radius: 14px;
  color: inherit;
  background: var(--game-fill);
  font: 600 1rem/1.2 Fredoka,system-ui,sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.world-dialog-actions > :nth-child(n + 2) { background: white; }
.world-game-dialog .world-game-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  padding: 0;
  border: 0;
  background: #fce2f0;
  font-size: 1.4rem;
}
@media (max-width: 380px) {
  .world-game { width: calc(100% - 18px); border-radius: 20px; }
  .world-game-stage { border-radius: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .world-game :is(.game-avatar, .game-lumi) { animation: none !important; }
}
