:root {
  --ink: #30283f;
  --muted: #6b6478;
  --purple: #7042cb;
  --line: #e7e3ed;
  --lav: #f0eafa;
  font: 100%/1.5 "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f8f7fb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
p, h2 { margin: 0; }
h2 { font-size: 1.25rem; }
button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 3px solid #a882e5; outline-offset: 3px; }
.text-btn { min-height: 44px; color: var(--purple); }
main {
  width: 100%;
  max-width: 390px;
  margin: auto;
  text-align: center;
}
form { display: grid; gap: 12px; }
input, .primary {
  width: 100%;
  min-height: 48px;
  border-radius: 9px;
  font: inherit;
}
input { padding: 0 14px; border: 1px solid #c6bfce; background: white; color: var(--ink); }
input:focus-visible { outline: 3px solid #cbb1ec; outline-offset: 1px; }
.primary { font-weight: 700; background: var(--purple); color: white; }
#message:not(:empty) { margin-top: 12px; color: var(--muted); }
#stage { text-align: center; }
#draw { position: relative; display: block; margin: auto; padding: 0; border-radius: 12px; }
#draw-hint { position: absolute; z-index: 1; top: 8%; right: -48px; padding: 7px 12px; border-radius: 18px; color: white; background: var(--purple); font-size: .875rem; font-weight: 700; white-space: nowrap; animation: hint-bounce 2.4s ease-in-out infinite; }
@keyframes hint-bounce { 50% { transform: translateY(-6px); } }
#draw:disabled { opacity: 1; }
.machine { display: block; margin: 0 auto; width: min(210px, 51vw); height: auto; transform-origin: 50% 91%; }
#player { margin: 14px 0 20px; overflow-wrap: anywhere; }
#edit { margin-top: 5px; min-height: 44px; }
.drawing .machine { animation: rattle .75s ease-in-out infinite; }
@keyframes rattle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}
#dates { margin: 0 auto; max-width: 340px; }
#dates p { background: var(--lav); color: #513171; border-radius: 8px; padding: 12px; margin-top: 7px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .drawing .machine, #draw-hint { animation: none; } }
