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

:root {
  color-scheme: dark;
  --bg: #141018;
  --ink: #f8f0e4;
  --muted: #b8a8b8;
  --mint: #5ee0b8;
  --honey: #e8b848;
  --grape: #6b3a8a;
}

html {
  font-family: "Hiragino Sans", Meiryo, sans-serif;
  background: radial-gradient(ellipse at 30% 0%, #3a2848, var(--bg) 60%);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100dvh;
}

.masthead {
  padding: 10px 14px;
}

.back {
  color: var(--mint);
  font-weight: 700;
  text-decoration: none;
}

.app {
  max-width: 390px;
  margin: 0 auto;
  padding: 0 12px 24px;
}

.kicker {
  color: var(--honey);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

h1 {
  font-family: "Hiragino Mincho ProN", serif;
  line-height: 1.15;
}

h1 span {
  display: block;
}

.lede {
  color: var(--muted);
}

.btn-primary,
.btn-share,
.btn-sound,
.turn-btns button {
  font: inherit;
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  margin-top: 12px;
  border: none;
  font-weight: 800;
  background: linear-gradient(180deg, var(--grape), #3a2048);
  color: #fff8f0;
}

.btn-share {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--mint);
  background: rgba(94, 224, 184, 0.12);
  color: var(--mint);
  font-weight: 700;
}

.btn-sound {
  margin-top: 8px;
  border: 1px solid #6a5068;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  width: 100%;
}

.start-panel,
.result-panel {
  padding: 14px;
  border: 1px solid #6a5068;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.hud {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.canvas-stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #8a6888;
  border-radius: 14px;
  background: linear-gradient(180deg, #2a1830 0%, #3d2838 42%, #1a1418 100%);
  overflow: hidden;
  min-height: 0;
}

.stage-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.canvas-stage #game-canvas {
  position: relative;
  z-index: 1;
}

#game-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  touch-action: none;
  display: block;
  vertical-align: top;
}

.hint-line {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 8px 0;
}

.turn-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.turn-btns button {
  border: 1px solid #8a6888;
  background: rgba(107, 58, 138, 0.35);
  color: var(--ink);
  font-weight: 700;
}

.result-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--honey);
}

.btn-text {
  background: none;
  border: none;
  color: var(--mint);
  cursor: pointer;
  font: inherit;
}

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

html[data-capture="1"],
html[data-capture="1"] body {
  background: linear-gradient(180deg, #3a2838 0%, #2a1830 45%, #1a1418 100%);
  min-height: 844px;
}

html[data-capture="1"] .app {
  max-width: 390px;
  min-height: 844px;
  padding: 0 8px;
}

html[data-capture="1"] .play-panel {
  min-height: 844px;
  display: flex;
  flex-direction: column;
}

html[data-capture="1"] .canvas-stage {
  flex: 1;
  min-height: 0;
  border-color: transparent;
  border-radius: 0;
  margin: 0 -4px;
}

html[data-capture="1"] #game-canvas {
  max-height: calc(844px - 72px);
}

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

html[data-promo-shot="1"],
html[data-promo-shot="1"] body {
  background: linear-gradient(180deg, #3a2838 0%, #2a1830 40%, #1a1418 100%);
  min-height: 844px;
}

html[data-promo-shot="1"] .app {
  max-width: 390px;
  width: 390px;
  height: 844px;
  min-height: 844px;
  padding: 0;
  display: flex;
  flex-direction: column;
}

html[data-promo-shot="1"] .play-panel {
  flex: 1;
  min-height: 0;
  padding: 6px 6px 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

html[data-promo-shot="1"] .hud {
  flex: none;
  margin-bottom: 4px;
}

html[data-promo-shot="1"] .canvas-stage {
  flex: 1;
  min-height: 0;
  border-color: transparent;
  border-radius: 10px;
}

html[data-promo-shot="1"] #game-canvas {
  max-height: none;
}

@media (min-width: 720px) {
  .canvas-stage {
    max-width: 480px;
    margin: 0 auto;
  }
}

@media (min-width: 720px) {
  .app {
    max-width: 480px;
  }
  .hud {
    font-size: 1rem;
  }
}

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