:root {
  --paper: #f4eee3;
  --paper-2: #ebe3d4;
  --ink: #1d1b19;
  --muted: #6f675d;
  --line: #d9cfbe;
  --red: #e5484d;
  --yellow: #ffc53d;
  --green: #30a46c;
  --card: #fffaf2;
  --round: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  --display: "Dela Gothic One", "Hiragino Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1a17;
    --paper-2: #26231f;
    --ink: #f4eee3;
    --muted: #a59c8f;
    --line: #3a352e;
    --card: #24211d;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--round);
  font-weight: 500;
  line-height: 1.7;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

main,
.header,
.footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- header ---------- */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding-top: 20px;
  padding-bottom: 12px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 32px;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.logo__bang {
  margin-left: -0.3em;
  color: var(--red);
}

.logo__cam {
  position: relative;
  width: 36px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
}

.logo__cam::before {
  content: "";
  position: absolute;
  inset: 6px 11px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 4px var(--ink);
}

.logo__cam::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- game ---------- */
.game {
  padding: 16px;
  border-radius: 24px;
  background: var(--ink);
  color: #f4eee3;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 0 4px 10px;
  font-size: 14px;
}

.hud strong {
  color: var(--yellow);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #8fd3ff;
  aspect-ratio: 16 / 9;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.flash.on {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 0;
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(29, 27, 25, 0.55);
  backdrop-filter: blur(3px);
  text-align: center;
}

.overlay[hidden] {
  display: none;
}

.overlay__logo {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(40px, 9vw, 80px);
  line-height: 1.1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.overlay__logo span {
  margin-left: -0.3em;
  color: var(--red);
}

.overlay__lead {
  margin: 8px 0 16px;
  font-size: clamp(14px, 2.4vw, 18px);
}

.overlay__keys {
  margin: 12px 0 0;
  font-size: 12px;
  opacity: 0.8;
}

.touch-only {
  display: none;
}

@media (pointer: coarse) {
  .touch-only {
    display: block;
  }

  .pc-only {
    display: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
}

.btn--primary {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 0 #a8262b;
  font-size: 18px;
  padding: 12px 32px;
}

.btn--dark {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.btn--primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #a8262b;
}

.btn:focus-visible,
.shutter:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px 0 8px;
}

.btn--round {
  flex-direction: column;
  gap: 0;
  width: 64px;
  height: 64px;
  padding: 0;
  border-color: #4a453f;
  font-size: 20px;
  line-height: 1.2;
}

.btn--round small {
  font-size: 10px;
}

.btn--round[aria-pressed="false"] {
  opacity: 0.5;
}

.shutter {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 5px solid #f4eee3;
  border-radius: 50%;
  background: transparent;
}

.shutter span {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red);
  transition: transform 0.08s;
}

.shutter:active span {
  transform: scale(0.85);
}

.strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin: 8px 0 0;
  padding: 6px;
  border-radius: 6px;
  background: #2c2925;
  list-style: none;
}

.strip li {
  aspect-ratio: 3 / 2;
  border-radius: 2px;
  background: #3a3631;
  overflow: hidden;
}

.strip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: develop 0.6s ease-out;
}

@keyframes develop {
  from {
    filter: brightness(3) saturate(0);
  }
}

/* ---------- sections ---------- */
.section {
  margin: 40px 0 0;
}

h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
}

h2 small {
  font-family: var(--round);
  font-size: 14px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  font-size: 14px;
}

.steps b {
  display: block;
  font-size: 17px;
  font-weight: 800;
}

.steps__num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.tip {
  margin: 12px 0 0;
  font-size: 14px;
}

.lamp {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 4px;
  border-radius: 50%;
  vertical-align: middle;
}

.lamp--green {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.dex {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dex li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-size: 12px;
  text-align: center;
}

.dex .icon {
  font-size: 34px;
  line-height: 1.2;
}

.dex .locked .icon {
  filter: grayscale(1) brightness(0);
  opacity: 0.18;
}

.dex .locked {
  color: var(--muted);
}

.tech {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tech li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 13px;
}

.tech b {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.tech .locked b {
  color: var(--muted);
  letter-spacing: 0.2em;
}

.tech .locked {
  border-style: dashed;
  background: transparent;
}

.footer {
  padding-top: 40px;
  padding-bottom: 40px;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer strong {
  color: var(--red);
  font-size: 20px;
}

/* ---------- results ---------- */
.results {
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 24px;
  border: 0;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
}

.results::backdrop {
  background: rgba(20, 18, 16, 0.7);
  backdrop-filter: blur(4px);
}

.results__head {
  text-align: center;
}

.results__label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.results h2 {
  margin: 0;
  font-size: clamp(36px, 8vw, 56px);
  color: var(--red);
}

.results__rank {
  margin: 0;
  font-weight: 800;
  font-size: 18px;
}

.results__best {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.album li {
  position: relative;
  padding: 8px 8px 12px;
  border-radius: 4px;
  background: #fff;
  color: #1d1b19;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  transform: rotate(var(--tilt, 0deg));
}

.album img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #ddd;
}

.album .score {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  font-weight: 800;
}

.album .score strong {
  color: var(--red);
  font-size: 20px;
}

.album .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.album .tags span {
  padding: 0 8px;
  border-radius: 999px;
  background: #f1e9da;
  font-size: 11px;
}

.album .tags span.new {
  background: var(--yellow);
}

.album .comment {
  margin: 6px 0 0;
  padding-right: 44px;
  color: #6f675d;
  font-size: 12px;
}

.album .mini {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 0 8px;
  border: 1px solid #d9cfbe;
  border-radius: 999px;
  background: #fff;
  color: #6f675d;
  font-size: 11px;
}

.album .mini:hover {
  color: #1d1b19;
}

.album .crown {
  position: absolute;
  top: -14px;
  left: -10px;
  font-size: 28px;
  transform: rotate(-15deg);
}

.results__note {
  min-height: 1.7em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.results__actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .game {
    padding: 10px;
    margin: 0 -8px;
    border-radius: 18px;
  }

  .hud {
    font-size: 12px;
  }

  .hud strong {
    font-size: 15px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .strip {
    grid-template-columns: repeat(6, 1fr);
  }

  .controls {
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flash.on,
  .strip img {
    animation: none;
  }
}

.results h2:focus {
  outline: none;
}
