:root {
  --indigo: #1a2a4a;
  --mint: #5eb8a8;
  --coral: #d4574a;
  --lemon: #ffe566;
  --paper: #f5efe0;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--paper);
  background: var(--indigo);
  line-height: 1.5;
}

.masthead {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 1rem;
}

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

main {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 0 0.75rem 2rem;
}

.intro {
  text-align: center;
  margin-bottom: 0.5rem;
}

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

.play-shell {
  position: relative;
}

.live {
  text-align: center;
  font-weight: 700;
  margin: 0 0 0.35rem;
  min-height: 1.5em;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  text-align: center;
}

.hud small {
  display: block;
  font-size: 0.65rem;
  opacity: 0.8;
}

.hud strong {
  font-size: 1.2rem;
  color: var(--lemon);
}

.stage-wrap {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 2px solid rgba(94, 184, 168, 0.35);
  touch-action: manipulation;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 540 / 760;
  background: #0f1830;
}

.burapi {
  position: absolute;
  left: 4%;
  bottom: 8%;
  width: clamp(72px, 20vw, 96px);
  background: transparent;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.combo-word {
  position: absolute;
  top: 38%;
  left: 50%;
  translate: -50% -50%;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--lemon);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.next-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.35rem;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0.5rem;
}

.next-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.next-balls {
  display: flex;
  gap: 0.35rem;
}

.next-balls span {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.col-taps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.col-taps button {
  min-height: 3rem;
  border: none;
  border-radius: 0.55rem;
  background: rgba(94, 184, 168, 0.25);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.col-taps button.hint-col {
  animation: pulse-col 0.9s ease-in-out infinite;
  background: rgba(255, 229, 102, 0.35);
  outline: 2px solid var(--lemon);
}

.col-taps button.shake {
  animation: shake-col 0.35s ease;
}

@keyframes pulse-col {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes shake-col {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.start-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(180deg, var(--lemon), #d4a017);
  color: var(--indigo);
  cursor: pointer;
}

.start-btn[hidden] {
  display: none !important;
}

.result-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
  background: rgba(26, 42, 74, 0.94);
}

.result-panel[hidden] {
  display: none !important;
}

.share {
  background: var(--lemon);
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.guide {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  font-size: 0.9rem;
}

.records {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.reset {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.4rem;
  border: 1px dashed var(--mint);
  background: transparent;
  color: inherit;
  border-radius: 0.4rem;
  cursor: pointer;
  font: inherit;
}

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

html[data-promo="shot"] .intro,
html[data-promo="shot"] .guide,
html[data-promo="shot"] .masthead {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .col-taps button.hint-col {
    animation: none;
    outline-width: 3px;
  }
}
