:root {
  --ink: #1e2a3a;
  --moon: #f5d78a;
  --mint: #5eead4;
  --night: #1a2848;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  background: linear-gradient(180deg, #0f1830 0%, #243858 45%, #1a2848 100%);
  color: #f5f0e8;
  min-height: 100dvh;
}

.masthead {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
}

.masthead a {
  color: #f5f0e8;
  text-decoration: none;
}

#sound {
  border: 2px solid #f5f0e8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f0e8;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 0.5rem 1.25rem;
}

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

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

.intro h1 {
  margin: 0.15rem 0;
  font-size: 1.35rem;
}

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

.intro p {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  opacity: 0.9;
}

.play-shell {
  position: relative;
  background: linear-gradient(180deg, rgba(30, 42, 68, 0.55) 0%, rgba(20, 32, 52, 0.75) 100%);
  border: 3px solid rgba(245, 215, 138, 0.5);
  border-radius: 18px;
  padding: 0.5rem 0.55rem 0.75rem;
  box-shadow:
    0 8px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 248, 235, 0.08);
}

.hud {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

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

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

.stage-wrap {
  border-radius: 12px;
  overflow: hidden;
  touch-action: manipulation;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #1c2a44;
  cursor: pointer;
}

.drop-btn {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  border: 2px solid var(--moon);
  border-radius: 14px;
  background: rgba(245, 215, 138, 0.2);
  color: #fff8ef;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem;
  cursor: pointer;
}

.panel {
  position: absolute;
  inset: 0.5rem 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(15, 24, 48, 0.92);
  border-radius: 14px;
  padding: 1rem;
  z-index: 4;
  color: #f5f0e8;
}

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

.panel.summary {
  inset: auto;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.65rem;
  top: auto;
  max-height: 48%;
  justify-content: flex-start;
  border: 2px solid rgba(245, 215, 138, 0.5);
}

.summary .rank {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.2rem 0 0.6rem;
  color: var(--moon);
}

.stats {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
}

.btn-primary,
.btn-ghost {
  border: 2px solid var(--moon);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--mint);
  color: var(--ink);
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: #f5f0e8;
  margin-top: 0.5rem;
}

.records {
  margin-top: 0.65rem;
  text-align: center;
  font-size: 0.82rem;
}

.linkish {
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.82rem;
  color: #f5f0e8;
}

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

html[data-capture="1"] body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f1830;
}

html[data-capture="1"] main {
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

html[data-capture="1"] .play-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: max(env(safe-area-inset-top), 6px) 0.35rem 0.5rem;
}

html[data-capture="1"] .capture-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

html[data-capture="1"] .hud {
  position: absolute;
  z-index: 5;
  left: 0.45rem;
  right: 0.45rem;
  top: 0.35rem;
  background: rgba(255, 248, 235, 0.94);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 0.35rem 0.5rem;
}

html[data-capture="1"] .live {
  position: absolute;
  z-index: 5;
  top: 3.2rem;
  left: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 248, 235, 0.88);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.8rem;
}

html[data-capture="1"] .capture-stage {
  position: relative;
}

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

html[data-capture="1"] #share-x,
html[data-capture="1"] .summary-actions .btn-primary {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

@media (min-width: 720px) {
  .drop-btn {
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }
}

html[data-promo-shot="1"] body {
  margin: 0;
  width: 540px;
  height: 620px;
  min-height: 620px;
  overflow: hidden;
  background: #0a1028;
}

html[data-promo-shot="1"] .masthead,
html[data-promo-shot="1"] .intro,
html[data-promo-shot="1"] .hud,
html[data-promo-shot="1"] .live,
html[data-promo-shot="1"] .records,
html[data-promo-shot="1"] .drop-btn,
html[data-promo-shot="1"] .panel {
  display: none !important;
}

html[data-promo-shot="1"] main,
html[data-promo-shot="1"] .play-shell {
  max-width: none;
  width: 540px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

html[data-promo-shot="1"] canvas {
  border-radius: 0;
}
