:root { color-scheme: dark; font: 16px system-ui, sans-serif; background: #101116; color: #f5f5f5; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; }
.shell { width: min(980px, 100%); margin: 0 auto; padding: 1rem; }
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar > div { margin-right: auto; }
h1 { margin: 0; font-size: 1.25rem; }
p { margin: .25rem 0 0; color: #a8acb9; font-size: .9rem; }
.toolbar-divider { width: 1px; height: 1.8rem; background: #474c5b; }
.record-button { border-color: #b64b58; color: #ffb4bd; }
.record-button.recording { background: #9b303e; color: white; animation: recording-pulse 1.4s ease-in-out infinite; }
.recording-status { color: #a8acb9; font-size: .85rem; white-space: nowrap; }
@keyframes recording-pulse { 50% { box-shadow: 0 0 0 .22rem rgba(230, 76, 94, .2); } }
button, .file-button { position: relative; border: 1px solid #474c5b; border-radius: .45rem; background: #202532; color: inherit; padding: .55rem .8rem; font: inherit; cursor: pointer; touch-action: manipulation; user-select: none; }
button:hover, .file-button:hover, button:focus-visible, .file-button:focus-within { background: #30394c; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:active, button.pressed { background: #3c6590; }
input { display: none; }
.file-button input { display: block; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#rewind-button { touch-action: none; }
.screen-wrap { display: grid; place-items: center; width: 100%; padding: min(3vw, 2rem); border: 1px solid #303542; border-radius: .75rem; background: #050608; box-shadow: 0 12px 40px #0008; }
canvas { display: block; width: min(768px, 100%); height: auto; aspect-ratio: 256 / 224; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; }
.controls { display: grid; grid-template: "dpad center face" / 1fr auto 1fr; align-items: center; gap: 1rem; margin: 1rem auto; max-width: 760px; }
.dpad { grid-area: dpad; display: grid; grid-template: repeat(3, 2.8rem) / repeat(3, 2.8rem); gap: .25rem; justify-self: start; }
.dpad button:nth-child(1) { grid-area: 1 / 2; }.dpad button:nth-child(2) { grid-area: 2 / 1; }.dpad button:nth-child(3) { grid-area: 3 / 2; }.dpad button:nth-child(4) { grid-area: 2 / 3; }
.dpad button { padding: 0; }
.center-controls { grid-area: center; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.menu-buttons, .shoulder-buttons, .face-buttons { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.face-buttons { grid-area: face; display: grid; grid-template: repeat(3, 2.8rem) / repeat(3, 2.8rem); gap: .25rem; justify-self: end; }
.face-buttons button { width: 2.8rem; height: 2.8rem; padding: 0; border-radius: 50%; }
.face-buttons button[data-button="x"] { grid-area: 1 / 2; }
.face-buttons button[data-button="y"] { grid-area: 2 / 1; }
.face-buttons button[data-button="a"] { grid-area: 2 / 3; }
.face-buttons button[data-button="b"] { grid-area: 3 / 2; }
.hint { text-align: center; }
@media (max-width: 560px) {
  .toolbar > div { flex-basis: 100%; }
  .toolbar-divider { display: none; }
  .recording-status { flex-basis: 100%; }
  .controls { grid-template: "dpad face" auto "center center" auto / 1fr 1fr; align-items: end; }
  .center-controls { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .face-buttons { justify-self: end; }
}
