* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #1e1b26; }
body { margin: 0; color: #ece6d8; font-family: 'Pixelify Sans', ui-monospace, monospace; -webkit-tap-highlight-color: transparent; }
main { max-width: 648px; margin: 0 auto; padding: 32px 16px 40px; display: flex; flex-direction: column; gap: 22px; }

header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 0 4px; }
header h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: 1px; }
header p { margin: 0; font-size: 16px; color: #a59fb4; }

.bezel { background: #2c2836; border-radius: 18px; padding: clamp(8px, 3vw, 20px); box-shadow: inset 0 0 0 2px #3a3546, 0 10px 0 #14121a; }
.screen { position: relative; width: 100%; aspect-ratio: 576 / 480; overflow: hidden; background: #0d0c12; outline: none; }
.screen:focus-visible { box-shadow: 0 0 0 4px #f0b43c; }
.stage { position: absolute; left: 0; top: 0; width: 576px; height: 480px; transform-origin: 0 0; transform: scale(var(--s, 1)); image-rendering: pixelated; }
.room { position: absolute; left: 0; top: 0; display: block; }

.actor { position: absolute; left: 0; top: 0; width: 48px; height: 48px; }
.live .actor { transition: left 170ms linear, top 170ms linear; }
.actor .shade { position: absolute; left: 9px; top: 42px; width: 30px; height: 6px; background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.px { position: absolute; left: -3px; top: -3px; width: 3px; height: 3px; }
.emote { position: absolute; z-index: 300; }

.box { position: absolute; z-index: 350; background: #fbfbf6; border-radius: 6px; border: 4px solid #4a5a82; box-shadow: 0 0 0 3px #fbfbf6, 0 0 0 6px #2a2333; color: #3a3a44; text-shadow: 2px 2px 0 #d4d0c4; }
.dialog { left: 14px; right: 14px; bottom: 14px; height: 116px; padding: 14px 52px 14px 22px; }
.dialog p { margin: 0; font-size: 24px; line-height: 1.4; white-space: pre-wrap; }
.next { position: absolute; right: 20px; bottom: 14px; animation: bob 0.7s steps(2) infinite; }
.menu { right: 14px; bottom: 150px; z-index: 400; min-width: 200px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px; font: inherit; font-size: 24px; color: inherit; text-decoration: none; text-shadow: inherit; background: none; border: 0; text-align: left; cursor: pointer; }
.opt:hover { background: #ece8dc; }
.opt:focus-visible { outline: 3px solid #f0b43c; outline-offset: 2px; }
.opt svg { visibility: hidden; flex: none; }
.opt.on svg { visibility: visible; }


.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 8px; }
.dpad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); touch-action: none; }
.pad, .hub { border: 0; background: #2c2836; box-shadow: 0 4px 0 #14121a; }
.pad { cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad svg { fill: #6c6680; }
.pad:active, .pad.held { background: #14121a; }
.pad.up { border-radius: 6px 6px 0 0; }
.pad.down { border-radius: 0 0 6px 6px; }
.pad.left { border-radius: 6px 0 0 6px; }
.pad.right { border-radius: 0 6px 6px 0; }
.hint { display: flex; flex-direction: column; gap: 8px; font-size: 16px; color: #a59fb4; text-align: center; line-height: 1.3; }
.hint b { color: #ece6d8; font-weight: 400; }
.ab { display: flex; gap: 18px; align-items: center; }
.btn { width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-size: 22px; font-weight: 600; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.btn:active { transform: translateY(2px); }
.btn.a { background: #c8383c; box-shadow: 0 5px 0 #7a1e22; color: #fbfbf6; margin-bottom: 30px; }
.btn.b { background: #e3b33a; box-shadow: 0 5px 0 #8f6c1c; color: #2a2333; margin-top: 30px; }
.pad:focus-visible, .btn:focus-visible { outline: 3px solid #f0b43c; outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

@media (max-width: 560px) {
  main { padding-top: 20px; gap: 18px; }
  header h1 { font-size: 24px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .actor { transition: none; }
  .next { animation: none; }
}
