:root {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  color: #2a2328;
  background: #fff;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
  color: #2a2328;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  touch-action: manipulation;
}
button:disabled { opacity: .45; }
button:focus-visible, a:focus-visible { outline: 2px solid #6e626a; outline-offset: -3px; }
main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: calc(100dvh - var(--nav-height, 66px));
  max-width: 450px;
  margin: auto;
  padding: 3px 6px max(4px, env(safe-area-inset-bottom));
}
.stage {
  position: relative;
  flex: 1;
  min-height: 275px;
  overflow: hidden;
  border-radius: 6px;
  background: #1c3445;
}
canvas { display: block; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud {
  position: absolute;
  top: 6px;
  left: 10px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 13px;
}
.hud b { color: #ffe1a0; }
.hud button { width: 44px; background: #304453; color: #fff; }
.progress {
  position: absolute;
  top: 56px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e7edf3;
  font-size: 11px;
}
.progress progress { flex: 1; width: 40px; height: 8px; accent-color: #eed299; }
.obstacle {
  position: absolute;
  top: 80px;
  left: 10px;
  right: 10px;
  color: #fff4ce;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.draw-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 18px;
  padding: 0 2px;
  font-size: 13px;
}
#draw-feedback { color: #6e626a; font-size: 12px; text-align: right; }
.pad-wrap {
  height: 150px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f4f6;
}
#pad { width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.buddy { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.buddy img { width: 52px; height: 52px; object-fit: contain; }
.buddy b { font-size: 12px; }
.buddy p { margin: 3px 0; font-size: 13px; line-height: 1.45; }
#storage { margin: 0; color: #7a422e; font-size: 12px; }
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  background: #07101ba6;
}
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 330px);
  max-height: 100%;
  overflow: auto;
  padding: 20px 16px;
  border-radius: 8px;
  background: #fff;
}
.panel h2 { margin: 0; font-size: 19px; }
.companion { display: flex; align-items: center; gap: 8px; }
.companion img { width: 52px; height: 52px; object-fit: contain; }
.companion b { font-size: 13px; }
.panel p { margin: 0; font-size: 13px; line-height: 1.65; text-align: center; white-space: pre-line; }
.panel button { width: 100%; }
.panel small { color: #6e626a; font-size: 12px; }
@media (max-height: 720px) {
  .pad-wrap { height: 120px; }
  .stage { min-height: 240px; }
  .panel { gap: 8px; padding: 14px 12px; }
  .panel h2 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}
