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

:root {
  color-scheme: dark;
  --bg: #14100c;
  --ink: #f8f0e4;
  --muted: #b8a898;
  --honey: #e8b848;
  --pumpkin: #d87828;
  --mint: #5ee0b8;
  --deep: #2a4a38;
}

html {
  font-family: "Hiragino Sans", Meiryo, sans-serif;
  background: radial-gradient(ellipse at 40% 0%, #3a2818, var(--bg) 58%);
  color: var(--ink);
  font-size: 16px;
}

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

.masthead {
  padding: 10px 14px;
}

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

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

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

.hero h1 {
  margin: 4px 0;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  line-height: 1.15;
  font-family: "Hiragino Mincho ProN", serif;
}

.hero h1 span {
  display: block;
}

.kicker {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--honey);
  font-family: ui-monospace, Menlo, monospace;
}

.lede {
  color: var(--muted);
  font-size: 1rem;
}

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

.btn-primary,
.btn-secondary,
.btn-share,
.btn-sound {
  font: inherit;
  font-size: 1rem;
  border-radius: 10px;
  min-height: 44px;
  padding: 12px 14px;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  margin-top: 10px;
  font-weight: 800;
  border: none;
  background: linear-gradient(180deg, var(--pumpkin), #8a4018);
  color: #fff8f0;
}

.btn-secondary {
  width: 100%;
  border: 1px solid #6a5040;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
}

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

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-share:focus-visible,
.btn-sound:focus-visible,
.btn-text:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 2px;
}

#game-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 2px solid #6a5040;
  touch-action: none;
  background: #0e0c0a;
}

.stroke-line {
  margin: 0 0 4px;
  font-weight: 800;
  color: var(--honey);
}

.metrics-line {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hint-line {
  margin: 8px 0;
  font-weight: 700;
  color: var(--mint);
}

.keys {
  font-size: 0.85rem;
  color: var(--muted);
}

.result-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--honey);
  margin: 8px 0;
}

.result-stats {
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.png-status {
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
}

.meta {
  margin-top: 18px;
  padding: 8px 12px;
  border: 1px solid #5a4840;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--muted);
}

.meta summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--ink);
}

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

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

html[data-capture="1"] .app {
  max-width: min(100%, 390px);
  padding-top: 10px;
}

html[data-capture="1"] .hero h1 {
  font-size: 1.2rem;
  text-align: center;
}

html[data-capture="1"] #game-canvas {
  max-height: min(72vh, 640px);
}

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, #3d2e22 0%, #2a2018 38%, #4a3828 100%);
  min-height: 844px;
}

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

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

html[data-promo-shot="1"] #game-canvas {
  flex: 1;
  width: 100%;
  min-height: 520px;
  max-height: calc(844px - 72px);
  border-radius: 14px;
  border-color: #8a6848;
  background: #2a2018;
}

html[data-promo-shot="1"] .stroke-line {
  font-size: 1rem;
}

html[data-promo-shot="1"] .metrics-line {
  font-size: 0.95rem;
  color: #e8dcc8;
}

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