:root {
  color-scheme: light;
  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; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
  color: #2a2328;
  font: inherit;
  font-weight: 700;
  touch-action: manipulation;
}
button:disabled { opacity: .4; }
[hidden] { display: none !important; }
main {
  max-width: 450px;
  height: calc(100dvh - var(--nav-height, 52px));
  min-height: 360px;
  margin: auto;
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
}
.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: #146b87;
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.hud {
  position: absolute;
  inset: 0 0 auto;
  height: 52px;
  padding: 4px 8px 4px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.hud strong { font-size: 20px; white-space: nowrap; }
#distance { margin-left: auto; font-size: 13px; white-space: nowrap; }
#health { color: #ae4352; font-size: 16px; white-space: nowrap; }
.hud button { width: 44px; flex-shrink: 0; font-size: 20px; pointer-events: auto; }
.progress { position: absolute; top: 52px; inset-inline: 0; height: 3px; background: #e9eff1; }
.progress i { display: block; height: 100%; width: 0; background: #16829e; }
#notice {
  position: absolute;
  top: 68px;
  inset-inline: 8px;
  min-height: 22px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #102f4a80;
}
.panel {
  width: min(100%, 304px);
  max-height: 100%;
  overflow: auto;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.panel p { margin: 0; line-height: 1.6; }
#status { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 700; }
.identity { display: flex; align-items: center; gap: 8px; }
.hero { width: 64px; height: 64px; object-fit: contain; }
.cast { font-size: 13px; }
#summary { font-size: 14px; white-space: pre-line; }
#best { font-size: 12px; color: #6e626a; }
#storage { font-size: 12px; color: #8b4b20; }
#storage:empty, #reaction:empty { display: none; }
#reaction { font-size: 13px; }
.panel button { width: 100%; min-height: 48px; }
.buddy { display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 60px; background: #fff; }
.buddy img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.buddy strong { display: block; font-size: 11px; line-height: 1.5; font-weight: 600; color: #6e626a; }
.buddy p { margin: 0; font-size: 13px; line-height: 1.5; }
.hint { margin: 0; padding: 0 12px 8px; text-align: center; color: #6e626a; font-size: 12px; }
main:not([data-state="playing"]) .buddy,
main:not([data-state="playing"]) .hint { display: none; }
button:focus-visible, a:focus-visible { outline: 2px solid #16829e; outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }
