:root {
  --forest: #1e3a2f;
  --moss: #3d6b52;
  --cream: #f4efe4;
  --acorn: #c47a3a;
  --dew: #9fd4e8;
  --ink: #142820;
  --panel: rgba(244, 239, 228, 0.96);
  --line: rgba(30, 58, 47, 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% 0%, rgba(168, 216, 232, 0.45), transparent 55%),
    linear-gradient(180deg, #b8dcc8 0%, #d8e8d4 35%, var(--cream) 100%);
  min-height: 100dvh;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--dew);
  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: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

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

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

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

.intro h1 {
  margin: 0.2rem 0;
  font-size: 1.5rem;
}

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

.intro p {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
}

.play-shell {
  position: relative;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(20, 40, 32, 0.03) 3px,
      rgba(20, 40, 32, 0.03) 4px
    ),
    var(--panel);
  border-radius: 1rem;
  border: 3px solid rgba(107, 74, 50, 0.35);
  box-shadow: 0 12px 32px rgba(20, 40, 32, 0.14);
  padding: 0.65rem 0.65rem 0.85rem;
}

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

.hud span {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0.25rem;
  border-radius: 0.65rem;
  background: rgba(159, 212, 232, 0.2);
  border: 1px solid rgba(61, 107, 82, 0.2);
}

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

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

.live {
  text-align: center;
  font-size: 0.9rem;
  margin: 0.15rem 0 0.4rem;
  min-height: 1.4em;
  color: var(--forest);
}

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

canvas {
  width: 100%;
  max-width: 540px;
  height: auto;
  touch-action: none;
  border-radius: 0.65rem;
  background: #2a5040;
  cursor: pointer;
}

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

.lane-btn {
  position: relative;
  border: 2px solid var(--forest);
  border-radius: 0.75rem;
  padding: 0.65rem 0.35rem 0.5rem;
  background: linear-gradient(180deg, #fff 0%, #e8e0d4 100%);
  font-size: 1rem;
  font-weight: 700;
  color: var(--forest);
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
}

.lane-btn.is-pulse {
  animation: lane-pulse 0.9s ease-in-out infinite;
  border-color: var(--dew);
  box-shadow: 0 0 0 2px rgba(159, 212, 232, 0.5);
}

.lane-btn.is-active {
  background: #d4ebe8;
}

.lane-reload {
  display: block;
  height: 4px;
  margin-top: 0.35rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--acorn), #e8b060);
  transform-origin: left center;
  transform: scaleX(0);
}

@keyframes lane-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

.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, 239, 228, 0.94);
  border-radius: 1rem;
  text-align: center;
  z-index: 4;
}

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

.panel p {
  margin: 0;
  max-width: 26em;
  line-height: 1.5;
  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(--forest);
  font-family: inherit;
}

.btn-primary {
  background: var(--forest);
  color: #fff;
}

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

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

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

.summary .hint {
  font-size: 0.85rem;
  color: #4a5a52;
  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: #4a5a52;
}

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

html[data-capture="1"] {
  --capture-shell-w: min(93vw, 1000px);
}

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

html[data-capture="1"] body {
  background: #1a3328;
  padding: 0;
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

html[data-capture="1"] main {
  max-width: none !important;
  width: 100%;
  padding: 0;
  margin: 0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-capture="1"] .play-shell {
  border: none;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
  width: var(--capture-shell-w) !important;
  max-width: 1000px !important;
  min-height: unset;
  padding: 0.55rem 0.65rem 0.7rem;
  transform: none !important;
  margin: 0 auto;
}

html[data-capture="1"] .capture-stage {
  width: 100%;
}

html[data-capture="1"] .stage-wrap {
  width: 100%;
}

html[data-capture="1"] canvas {
  width: 100% !important;
  max-width: none !important;
  height: auto;
  display: block;
  aspect-ratio: 540 / 560;
}

html[data-capture="1"] .hud {
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

html[data-capture="1"] .hud strong {
  font-size: 1.4rem;
}

html[data-capture="1"] .live {
  font-size: 1.02rem;
  margin-bottom: 0.5rem;
}

html[data-capture="1"] .lane-btn {
  padding: 0.8rem 0.35rem 0.6rem;
  font-size: 1.08rem;
}

html[data-capture="1"] .panel {
  border-radius: 0.75rem;
}

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

html[data-capture="1"] .summary .rank {
  font-size: 2.4rem;
}

html[data-capture="1"] .summary .stats {
  font-size: 1rem;
}

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