:root {
  --ink: #1e2430;
  --mist: #8a9bb5;
  --sand: #d4c4a8;
  --stone: #6b7d8f;
  --glow: #f5d76e;
  --mint: #7ee0c9;
  --sky: #4a6a8a;
  --dusk: #c97b5a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", sans-serif;
  color: #f4efe6;
  background: linear-gradient(165deg, #2a3548 0%, #1a2230 45%, #3d2e28 100%);
}

a {
  color: var(--mint);
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 2px;
}

.masthead {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.intro {
  padding: 0 1rem 0.5rem;
  text-align: center;
}

.intro .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--mist);
}

.intro h1 {
  margin: 0.25rem 0;
  font-size: clamp(1.5rem, 5vw, 1.85rem);
}

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

.intro p {
  margin: 0;
  font-size: 0.95rem;
  color: #c8d0dc;
}

.play-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 0.5rem 1.5rem;
}

.live {
  margin: 0.35rem 0;
  text-align: center;
  font-size: 0.95rem;
  min-height: 1.4em;
}

.hud {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--mist);
}

.hud strong {
  display: block;
  font-size: 1.35rem;
  color: #fff;
}

.stage-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  cursor: pointer;
  background: #3a4658;
}

.burapi {
  position: absolute;
  right: 4%;
  bottom: 2%;
  width: 72px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.start-btn {
  display: block;
  width: min(100%, 320px);
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--glow), #e8b84a);
  cursor: pointer;
}

.result-panel {
  margin-top: 1rem;
  padding: 1rem;
  text-align: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.rank-badge {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--glow);
}

.result-panel h2 {
  margin: 0.25rem 0;
}

.guide {
  max-width: 560px;
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
  font-size: 0.9rem;
  color: #b8c4d4;
}

.guide h2 {
  font-size: 1rem;
  color: #e8eef5;
}

.guide ul {
  padding-left: 1.2rem;
}

.records {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0;
}

.records dt {
  font-size: 0.75rem;
  color: var(--mist);
}

.records dd {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
}

.reset,
.share {
  margin: 0.35rem 0.25rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #5a6a7a;
  background: transparent;
  color: #dce4ee;
  cursor: pointer;
}

.share {
  border-color: var(--mint);
  color: var(--mint);
}

html[data-capture="1"] .capture-hide {
  display: none !important;
}

html[data-capture="1"] .play-shell {
  max-width: 100%;
  padding: 0;
}

html[data-capture="1"] body {
  background: #1a2230;
}

html[data-capture="1"] .hud {
  padding-top: 0.5rem;
}

html[data-capture="1"] .stage-wrap {
  max-width: min(100vw, 420px);
  margin: 0 auto;
}

html[data-capture="1"] #game {
  aspect-ratio: 9 / 16;
  max-height: min(92dvh, 760px);
  object-fit: contain;
}

@media (min-width: 720px) {
  main {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1rem;
    max-width: 920px;
    margin: 0 auto;
    align-items: start;
  }

  .intro {
    grid-column: 1 / -1;
  }

  .play-shell {
    grid-column: 1;
  }

  .guide {
    grid-column: 2;
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
