:root {
  --sea: #5a8fa8;
  --sea-deep: #2d5f78;
  --sand: #f4e8d4;
  --wood: #c49a6c;
  --wood-deep: #8a5a32;
  --mint: #7fd4b8;
  --ink: #1a2a32;
  --panel: rgba(255, 252, 245, 0.96);
  --line: rgba(45, 95, 120, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 252, 240, 0.9) 0%, transparent 55%),
    linear-gradient(180deg, #9ecfe0 0%, #d4ebe8 38%, var(--sand) 72%, #e8d4bc 100%);
  min-height: 100dvh;
}

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

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

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.masthead button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  color: var(--sea-deep);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 0.75rem 1.5rem;
}

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

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

.intro h1 {
  margin: 0.2rem 0;
  font-size: 1.55rem;
  line-height: 1.25;
}

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

.intro p {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: #3a4a52;
}

.play-shell {
  position: relative;
  background: var(--panel);
  border-radius: 1.1rem;
  border: 2px solid var(--line);
  box-shadow:
    0 12px 32px rgba(26, 42, 50, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 0.7rem 0.7rem 0.9rem;
}

.hud {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.hud span {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0.25rem;
  border-radius: 0.65rem;
  background: rgba(168, 212, 232, 0.22);
  border: 1px solid rgba(90, 143, 168, 0.2);
}

.hud small {
  display: block;
  color: #5a6a72;
  font-size: 0.72rem;
}

.hud strong {
  font-size: 1.15rem;
  color: var(--sea-deep);
}

.banner {
  margin: 0.25rem 0;
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(255, 120, 90, 0.15);
  color: #8a3018;
  font-size: 0.88rem;
  text-align: center;
}

.live {
  text-align: center;
  font-size: 0.9rem;
  margin: 0.2rem 0 0.45rem;
  min-height: 1.4em;
  color: var(--sea-deep);
}

.toolbar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.stage-wrap {
  display: flex;
  justify-content: center;
}

canvas {
  width: 100%;
  max-width: 540px;
  height: auto;
  touch-action: none;
  border-radius: 0.75rem;
  background: #c8e0ea;
  cursor: grab;
  box-shadow: 0 4px 16px rgba(45, 95, 120, 0.15);
}

canvas:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 2px;
}

.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.25rem;
  background: rgba(244, 232, 212, 0.94);
  border-radius: 1rem;
  text-align: center;
  z-index: 4;
  backdrop-filter: blur(4px);
}

.panel h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--sea-deep);
}

.panel p {
  margin: 0;
  max-width: 26em;
  line-height: 1.55;
  font-size: 0.92rem;
}

.btn-primary,
.btn-ghost {
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid var(--sea-deep);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(180deg, #3a7a98 0%, var(--sea-deep) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(45, 95, 120, 0.25);
}

.btn-ghost {
  background: #fff;
  color: var(--sea-deep);
}

.btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.summary .rank {
  font-size: 2rem;
  font-weight: 800;
  margin: 0.2rem 0;
  color: var(--sea-deep);
}

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

.summary .hint {
  font-size: 0.85rem;
  color: #4a5a62;
  max-width: 24em;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.records {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: #4a5a62;
}

.linkish {
  border: none;
  background: none;
  color: var(--sea-deep);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

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

html[data-capture="1"] .play-shell {
  max-width: min(100vw, calc(100dvh * 9 / 16));
  margin: 0 auto;
  border: none;
  box-shadow: none;
  background: transparent;
}

html[data-capture="1"] #summary {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 8%;
  width: auto;
  padding: 0.85rem 1rem;
  background: rgba(10, 32, 48, 0.88);
  border-radius: 0.75rem;
  z-index: 5;
}

html[data-capture="1"] .summary .rank {
  font-size: 2rem;
  margin: 0.15rem 0;
  color: #e8f8f4;
}

html[data-capture="1"] .summary h2,
html[data-capture="1"] .summary .stats {
  color: #e8f4f8;
}

html[data-promo="shot"] .promo-hide,
html[data-promo="shot"] .panel {
  display: none !important;
}

html[data-promo="shot"] body {
  margin: 0;
  min-height: auto;
  background: #d4ebe8;
}

html[data-promo="shot"] main {
  max-width: none;
  margin: 0;
  padding: 0;
  width: 540px;
}

html[data-promo="shot"] .play-shell {
  width: 540px;
  margin: 0;
  padding: 8px 0 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #f8f4ec;
}

html[data-promo="shot"] .hud {
  margin: 0 0 6px;
}

html[data-promo="shot"] .stage-wrap {
  margin: 0;
}

html[data-promo="shot"] canvas {
  width: 540px !important;
  max-width: none;
  height: 620px !important;
  display: block;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
}

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