* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.4 system-ui, sans-serif;
  background: #f3eef7;
  color: #2a1e2a;
}
.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
  padding: 24px 16px;
}
.device {
  width: 600px;
  max-width: 100%;
  padding: 90px 40px 50px;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: radial-gradient(circle at 35% 25%, #ffe3f0, #f48fb1 70%, #d81b60);
  box-shadow: inset -12px -16px 0 rgba(0, 0, 0, 0.12), 0 12px 30px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.bezel {
  display: inline-block;
  padding: 12px;
  border-radius: 18px;
  background: #2d2d44;
}
#screen {
  display: block;
  width: 480px;
  max-width: 100%;
  aspect-ratio: 240 / 280;
  image-rendering: pixelated;
  background: #000;
}
.buttons {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-top: 28px;
}
.hw {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: #fff4c2;
  box-shadow: 0 6px 0 #c9a227;
  font: bold 20px system-ui, sans-serif;
  cursor: pointer;
  touch-action: none;
}
.hw:active, .hw.down { transform: translateY(4px); box-shadow: 0 2px 0 #c9a227; }
.hint { font-size: 12px; opacity: 0.7; }
.shake { animation: shake 0.1s linear infinite; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-0.5deg); }
  75% { transform: translateX(4px) rotate(0.5deg); }
}
.debug {
  width: 420px;
  max-width: 100%;
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.debug h2 { margin: 16px 0 6px; font-size: 16px; }
.debug h3 { margin: 10px 0 4px; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.row input[type="number"] { width: 72px; }
.speed.on { background: #ffca28; }
pre { margin: 0; padding: 8px; max-height: 220px; overflow: auto; background: #f6f3f8; font-size: 12px; }
#log { max-height: 200px; overflow: auto; font: 12px ui-monospace, monospace; padding-left: 20px; }
