:root {
  color-scheme: dark;
  --burgundy: #6b2436;
  --ivory: #f4e8c8;
  --sky: #7eb8c9;
  --coral: #d46a5a;
  --yamabuki: #e6b84a;
  --teal: #3d8b7a;
  --wood: #5c3d2e;
  --tin: #c4b89a;
  --ink: #f4e8c8;
  --muted: #d7c4b0;
  --font: "Hiragino Mincho ProN", "Yu Mincho", "Hiragino Sans", serif;
}

* { box-sizing: border-box; }

html { overflow-x: clip; overflow-y: scroll; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 16% -8%, rgba(230, 184, 74, 0.18), transparent 22rem),
    radial-gradient(circle at 92% 8%, rgba(126, 184, 201, 0.16), transparent 20rem),
    linear-gradient(180deg, #3a1a22 0%, #5c3d2e 42%, #2a1418 100%);
}

a { color: inherit; }
button { font: inherit; color: inherit; }

a:focus-visible,
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--yamabuki);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(212, 106, 90, 0.35);
}

.site-header,
main {
  width: min(94vw, 1080px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
}

.site-header a {
  color: var(--yamabuki);
  font-weight: 800;
  text-decoration: none;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font: 700 0.72rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.1em;
}

main {
  display: grid;
  gap: 12px;
  padding: 0 0 72px;
}

.intro {
  background: rgba(92, 61, 46, 0.78);
  border: 1px solid rgba(196, 184, 154, 0.4);
  border-radius: 6px 22px 6px 22px;
  padding: 10px 16px 12px;
}

.eyebrow {
  margin: 0;
  color: var(--yamabuki);
  font: 800 0.68rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.16em;
}

.intro h1 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1;
}

.intro h1 span { color: var(--sky); }

.intro p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.layout { display: grid; gap: 14px; }

.game-panel {
  display: grid;
  gap: 8px;
  background: rgba(42, 20, 24, 0.9);
  border: 1px solid rgba(196, 184, 154, 0.3);
  border-radius: 16px;
  padding: 10px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.hud p {
  margin: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(244, 232, 200, 0.08);
}

.hud span {
  display: block;
  color: var(--muted);
  font: 700 0.62rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.08em;
}

.hud strong { font-size: 1.02rem; color: var(--ivory); }

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #2a1814;
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  height: min(72vh, 720px);
  touch-action: none;
  cursor: ew-resize;
}

.banner {
  position: absolute;
  left: 12%;
  right: 18%;
  top: 8%;
  margin: 0;
  padding: 8px 12px;
  text-align: center;
  font-weight: 800;
  color: #3a1a22;
  background: rgba(244, 232, 200, 0.92);
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}

.hint-line {
  position: absolute;
  left: 14%;
  right: 18%;
  bottom: 12%;
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ivory);
  pointer-events: none;
}

.tilt-guide {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 72px;
  height: 18px;
  margin-left: -36px;
  border-radius: 999px;
  border: 2px solid rgba(244, 232, 200, 0.55);
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 6px;
  padding: 18px 18px 16%;
  background: linear-gradient(180deg, transparent 38%, rgba(42, 20, 24, 0.78) 100%);
  text-align: center;
  z-index: 3;
}

.overlay[hidden] { display: none !important; }

.overlay-kicker {
  margin: 0;
  color: var(--yamabuki);
  font: 800 0.7rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.14em;
}

.overlay-lead { margin: 0; font-size: 1.28rem; font-weight: 900; }
.overlay-note { margin: 0 0 8px; color: var(--muted); }

.start, .share-x, .reset, .sound-btn, .act-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.start {
  background: var(--yamabuki);
  color: #3a1a22;
  font-weight: 900;
  padding: 10px 22px;
}

.tool-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.sound-btn, .act-btn, .reset {
  background: rgba(244, 232, 200, 0.12);
  padding: 6px 12px;
  font-weight: 800;
}

.level-chip { margin: 0; font-size: 0.78rem; color: var(--muted); }
.live { margin: 0 4px; min-height: 1.4em; color: var(--muted); font-size: 0.86rem; }

.share-x {
  background: var(--teal);
  color: var(--ivory);
  font-weight: 800;
  padding: 8px 16px;
}

.help {
  display: grid;
  gap: 10px;
  padding: 12px 14px 16px;
  background: rgba(92, 61, 46, 0.72);
  border-radius: 16px;
}

.help h2 { margin: 4px 0 0; font-size: 1.12rem; }
.help ol { margin: 0; padding: 0; display: grid; gap: 8px; }

.help li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  list-style: none;
  color: var(--muted);
}

.help li span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yamabuki);
  color: #3a1a22;
  font-weight: 900;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--yamabuki);
  color: #3a1a22;
  font-size: 0.78em;
}

.save-note, .key-hint, .records {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gallery button {
  padding: 8px 6px;
  border: 1px solid rgba(196, 184, 154, 0.4);
  border-radius: 10px;
  background: #2a1814;
  color: var(--ivory);
}

.gallery button[disabled] { opacity: 0.55; }

html[data-capture] [data-account],
html[data-capture] .site-header,
html[data-capture] .intro,
html[data-capture] .help,
html[data-capture] .live,
html[data-capture] .end-actions,
html[data-capture] .hud,
html[data-capture] .tool-row,
html[data-capture] .hint-line,
html[data-capture] .overlay {
  display: none !important;
}

html[data-capture],
html[data-capture] body {
  height: 100%;
  overflow: hidden;
  background: #2a1814;
}

html[data-capture] main,
html[data-capture] .layout,
html[data-capture] .game-panel {
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
  background: transparent;
  border: 0;
}

html[data-capture] .stage { height: 100dvh; border-radius: 0; }
html[data-capture] #game { width: 100%; height: 100dvh; }
html[data-capture] .banner { top: 10%; left: 10%; right: 18%; }

@media (min-width: 880px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
  }
  #game { height: min(76vh, 740px); }
}

@media (max-width: 430px) {
  .intro h1 { font-size: 1.34rem; }
  .hud { gap: 4px; }
  .hud strong { font-size: 0.9rem; }
  #game { height: min(66vh, 560px); }
  .overlay-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .banner { transition: none; }
}
