:root {
  --storm: #5a6478;
  --sky: #8aa4c8;
  --paper: #e8ecf4;
  --ink: #2a3040;
  --attack: #e07058;
  --guard: #58a878;
  --magic: #6888e0;
  --gold: #d8b050;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #6a7a94 0%, var(--paper) 55%, #c8d8e8 100%);
}

a {
  color: #3a6a9a;
}

.masthead {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

#sound {
  border: 1px solid #7a8a9a;
  background: transparent;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

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

.intro .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  opacity: 0.75;
}

.intro h1 span {
  color: #4a78a8;
}

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

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.hud-block strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.1;
}

.hearts {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: #c84858;
}

.telegraph-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.25rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid rgba(42, 48, 64, 0.15);
  font-weight: 700;
  font-size: 1.05rem;
  min-height: 3rem;
}

.telegraph-shape {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--storm);
  position: relative;
}

.telegraph-shape[data-shape="gap"] {
  background: linear-gradient(180deg, #d8c878, #a89858);
  clip-path: polygon(50% 8%, 8% 92%, 92% 92%);
  border-radius: 0;
  box-shadow: inset 0 -6px 0 rgba(58, 40, 72, 0.15);
}

.telegraph-shape[data-shape="gap"]::before,
.telegraph-shape[data-shape="gap"]::after {
  content: "";
  position: absolute;
  top: 18%;
  width: 38%;
  height: 55%;
  background: #c8a838;
  clip-path: polygon(50% 0%, 0% 100%, 100% 70%);
}

.telegraph-shape[data-shape="gap"]::before {
  left: -8%;
  transform: rotate(-18deg);
}

.telegraph-shape[data-shape="gap"]::after {
  right: -8%;
  transform: rotate(18deg) scaleX(-1);
}

.telegraph-shape[data-shape="fire"] {
  background: radial-gradient(circle at 45% 75%, #fff0a0 0%, #ff8844 45%, #cc4422 85%);
  border-radius: 50% 50% 42% 42%;
  animation: tele-fire 0.55s ease-in-out infinite alternate;
}

@keyframes tele-fire {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  100% {
    transform: scale(1.06);
    filter: brightness(1.12);
  }
}

.telegraph-shape[data-shape="shield"] {
  background: radial-gradient(circle at 50% 40%, #e8f0ff 0%, #8898b8 70%);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45);
}

.telegraph-shape[data-shape="shield"]::after {
  content: "";
  position: absolute;
  inset: 22%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.live {
  text-align: center;
  font-size: 0.9rem;
  margin: 0.2rem 0 0.45rem;
  min-height: 1.35em;
}

.stage-wrap {
  position: relative;
  margin: 0 auto;
  max-width: 540px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 8px 24px rgba(30, 40, 60, 0.2),
    inset 0 0 0 3px rgba(200, 152, 48, 0.35);
  background: linear-gradient(180deg, rgba(232, 220, 200, 0.5), rgba(200, 180, 160, 0.35));
}

#game {
  display: block;
  width: 100%;
  height: auto;
  background: #6a7a90;
}

.burapi {
  position: absolute;
  left: 8%;
  bottom: 6%;
  width: 80px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
  transition: transform 0.25s ease;
}

.burapi.pose-cheer {
  transform: translateY(-8px) scale(1.05);
}

.burapi.pose-stumble {
  transform: translateY(4px) rotate(-6deg);
}

.move-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.move-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 4.25rem;
  padding: 0.5rem 0.35rem;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.move-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.move-btn:not(:disabled):active {
  transform: scale(0.96);
}

.move-btn.flash-ok {
  animation: flash-ok 0.35s ease;
}

.move-btn.flash-bad {
  animation: flash-bad 0.35s ease;
}

@keyframes flash-ok {
  0% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.45);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes flash-bad {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

.move-attack {
  background: linear-gradient(180deg, #f08870, var(--attack));
}

.move-guard {
  background: linear-gradient(180deg, #70c090, var(--guard));
}

.move-magic {
  background: linear-gradient(180deg, #88a0f0, var(--magic));
}

.move-key {
  font-size: 0.7rem;
  opacity: 0.85;
}

.special-btn {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #3a3010;
  background: linear-gradient(180deg, #ffe890, var(--gold));
  box-shadow: 0 0 0 3px rgba(255, 220, 100, 0.5), 0 6px 16px rgba(80, 60, 20, 0.25);
  cursor: pointer;
  animation: special-pulse 1.2s ease-in-out infinite;
}

.special-btn:disabled {
  animation: none;
  opacity: 0.5;
}

@keyframes special-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(255, 220, 100, 0.45), 0 6px 16px rgba(80, 60, 20, 0.2);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 230, 120, 0.55), 0 8px 20px rgba(80, 60, 20, 0.3);
  }
}

.start-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.85rem;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  background: #4a6888;
  color: #fff;
  cursor: pointer;
}

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

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

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

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

.guide h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

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

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

.records div {
  text-align: center;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 10px;
}

.records dt {
  font-size: 0.68rem;
  opacity: 0.8;
}

.records dd {
  margin: 0.15rem 0 0;
  font-weight: 800;
  font-size: 1.1rem;
}

.reset,
.share {
  font-family: inherit;
  cursor: pointer;
}

.reset {
  width: 100%;
  padding: 0.55rem;
  border: 1px dashed #7a8a9a;
  border-radius: 10px;
  background: transparent;
  font-size: 0.85rem;
}

.share {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.7rem;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  background: #1a1a1a;
  color: #fff;
}

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

@media (prefers-reduced-motion: reduce) {
  .special-btn {
    animation: none;
  }
  .move-btn.flash-ok,
  .move-btn.flash-bad {
    animation: none;
  }
  .telegraph-shape[data-shape="fire"] {
    animation: none;
  }
}

@media (min-width: 480px) {
  .move-btn {
    min-height: 4.5rem;
    font-size: 1.08rem;
  }
}
