:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, 'Hiragino Kaku Gothic ProN', sans-serif;
  color: #2a2328;
  background: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  height: 100svh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
.game-nav-header { flex-shrink: 0; }
button {
  font: inherit;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: #f3f4f6;
  touch-action: manipulation;
}
button:disabled { opacity: .5; }
button:focus-visible { outline: 2px solid #657e50; outline-offset: 2px; }
.shell {
  flex: 1;
  min-height: 0;
  max-width: 450px;
  width: 100%;
  margin: auto;
  padding: 4px 12px max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stage {
  position: relative;
  flex: 1;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.hud button { margin-left: auto; }
.order {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
#timer { font-variant-numeric: tabular-nums; }
#board {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.feedback { padding-top: 4px; text-align: center; }
#feedback { margin: 0; min-height: 1.5em; font-size: 14px; font-weight: 700; }
#combo { margin: 2px 0 0; min-height: 1.4em; font-size: 12px; color: #6e626a; }
#wrap {
  flex-shrink: 0;
  min-height: 52px;
  font-weight: 700;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#wrap[aria-pressed=true] { background: #e8eddf; }
.shell:has(#panel:not([hidden])) > #wrap { display: none; }
.shell:has(#panel:not([hidden])) .companion img { display: none; }
.companion { display: flex; gap: 8px; align-items: center; min-height: 48px; }
.companion img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.companion b { font-size: 11px; color: #6e626a; }
.companion p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; }
#save-note { margin: 0; font-size: 11px; line-height: 1.4; color: #6e626a; }
.panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  padding: 16px 8px;
  overflow: auto;
  background: #fff;
}
.panel-content {
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.panel h2 { margin: 0; font-size: 20px; }
.panel p { margin: 0; max-width: 310px; font-size: 13px; line-height: 1.6; }
.panel img { width: 80px; height: 80px; object-fit: contain; }
.panel button { width: 100%; min-height: 48px; font-weight: 700; }
#record { color: #6e626a; }
@media (max-height: 620px) {
  .shell { gap: 6px; padding-top: 2px; }
  .hud { gap: 8px; }
  .panel-content { gap: 8px; }
  .panel img { width: 64px; height: 64px; }
  .panel h2 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
