:root {
  --ink: #17251f;
  --paper: #f4efe5;
  --card: #fbf8f1;
  --lime: #c7ff38;
  --lime-dark: #a7de20;
  --coral: #ff6b4a;
  --line: rgba(23, 37, 31, 0.16);
  --muted: #6f766f;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

aside {
  margin-bottom: 8px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(199, 255, 56, 0.13), transparent 27rem),
    var(--paper);
  font-family: "Noto Sans JP", sans-serif;
  min-height: 100vh;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "DM Mono", monospace;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.site-header {
  min-height: 80px;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 6px;
}

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

.ad-section {
  width: 100%;
  min-height: 112px;
  margin-bottom: 22px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.58);
  text-align: center;
}

.ad-label {
  margin: 0 0 8px;
  color: var(--muted);
  font: 500 0.56rem/1 "DM Mono", monospace;
  letter-spacing: 0.14em;
}

.start-gate-message {
  position: relative;
  z-index: 2;
  margin: -12px 0 18px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.start-gate-message.ready {
  display: none;
}

.start-gate-message.blocked {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #a43825;
  font-weight: 700;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  margin: 0;
  min-height: 520px;
  position: relative;
  overflow: hidden;
}

.card-topline {
  height: 58px;
  padding: 0 28px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow,
.round-counter {
  margin: 0;
  font: 500 0.7rem/1 "DM Mono", monospace;
  letter-spacing: 0.12em;
}

.round-counter {
  background: var(--ink);
  color: var(--card);
  padding: 7px 10px;
}

.screen[hidden] {
  display: none;
}

.intro-screen {
  min-height: 480px;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  grid-template-rows: 1fr auto;
  padding: clamp(40px, 6vw, 78px);
  gap: 28px 54px;
}

.intro-copy h1 {
  font-size: clamp(3rem, 6.5vw, 6rem);
  line-height: 1.05;
  letter-spacing: -0.065em;
  margin: 0 0 28px;
  font-weight: 900;
}

.intro-copy p {
  margin: 0;
  line-height: 2;
  font-size: 0.94rem;
  color: var(--muted);
}

.dial-wrap {
  display: grid;
  place-items: center;
}

.dial {
  width: min(310px, 28vw);
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  border-radius: 50%;
  position: relative;
  background:
    repeating-conic-gradient(from -0.5deg, var(--ink) 0deg 1deg, transparent 1deg 30deg);
  box-shadow: inset 0 0 0 13px var(--card);
}

.dial::before {
  content: "";
  position: absolute;
  inset: 20px;
  background: var(--card);
  border-radius: inherit;
}

.dial-number {
  position: absolute;
  font: 400 0.64rem/1 "DM Mono", monospace;
  z-index: 2;
}

.n12 { top: 28px; left: 50%; transform: translateX(-50%); }
.n3 { right: 28px; top: 50%; transform: translateY(-50%); }
.n6 { bottom: 28px; left: 50%; transform: translateX(-50%); }
.n9 { left: 28px; top: 50%; transform: translateY(-50%); }

.dial-hand {
  position: absolute;
  z-index: 3;
  width: 2px;
  height: 34%;
  background: var(--coral);
  left: calc(50% - 1px);
  top: 17%;
  transform: rotate(25deg);
  transform-origin: bottom;
}

.dial-pin {
  position: absolute;
  width: 14px;
  aspect-ratio: 1;
  background: var(--ink);
  border: 4px solid var(--lime);
  border-radius: 50%;
  left: calc(50% - 7px);
  top: calc(50% - 7px);
  z-index: 4;
}

.dial-caption {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 62%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  font: 500 0.62rem/1.5 "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.intro-actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

.primary-button,
.secondary-button,
.share-button {
  border: 1px solid var(--ink);
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  min-width: 270px;
  min-height: 62px;
  background: var(--lime);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 24px;
  box-shadow: 5px 5px 0 var(--ink);
}

.primary-button:disabled {
  background: #d8d8cf;
  color: #777b76;
  box-shadow: 3px 3px 0 #777b76;
  cursor: not-allowed;
  filter: grayscale(1);
  transform: none;
}

.primary-button:disabled .button-arrow {
  border-color: currentColor;
}

.primary-button:hover,
.secondary-button:hover,
.share-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.primary-button:active,
.secondary-button:active,
.share-button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ink);
}

.primary-button:disabled:hover,
.primary-button:disabled:active {
  transform: none;
  box-shadow: 3px 3px 0 #777b76;
}

.button-arrow {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 1.2rem;
}

.hint {
  color: var(--muted);
  font-size: 0.73rem;
}

.hint span {
  font-family: "DM Mono", monospace;
  margin-right: 8px;
}

.countdown-screen,
.play-screen {
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.instruction,
.play-prompt {
  margin: 0 0 20px;
  font-weight: 700;
}

.countdown-value {
  font: 500 clamp(7rem, 20vw, 13rem)/0.95 "DM Mono", monospace;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  width: min(430px, 80%);
  background: #dedbd2;
  margin-top: 38px;
  overflow: hidden;
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: var(--coral);
  transform-origin: left;
}

.countdown-note,
.play-note {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 22px 0 0;
}

.result-flash {
  min-height: 34px;
  margin: 0 0 10px;
  font: 500 1.4rem/1 "DM Mono", monospace;
  color: var(--coral);
}

.result-flash.just {
  color: var(--ink);
  background: var(--lime);
  padding: 7px 13px;
  transform: rotate(-2deg);
}

.play-prompt {
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
}

.tap-button {
  width: min(270px, 64vw);
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 10px var(--card), 0 0 0 11px var(--ink), 10px 12px 0 11px var(--ink);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 100ms ease, background 120ms ease, box-shadow 100ms ease;
  user-select: none;
  touch-action: manipulation;
}

.tap-button:hover {
  background: #d5ff68;
  transform: scale(1.025);
}

.tap-button:active {
  transform: translate(6px, 7px) scale(0.98);
  box-shadow: 0 0 0 10px var(--card), 0 0 0 11px var(--ink), 4px 5px 0 11px var(--ink);
}

.tap-button.finished,
.tap-button.finished:hover,
.tap-button.finished:active {
  background: #c9cbc7;
  cursor: default;
  transform: none;
}

.tap-button.finished .tap-sub {
  display: none;
}

.tap-label {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.08em;
}

.tap-sub {
  font: 500 0.7rem/1 "DM Mono", monospace;
  letter-spacing: 0.2em;
  margin-top: 8px;
}

.round-dots {
  display: flex;
  gap: 8px;
  margin-top: 40px;
}

.round-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.round-dot.done {
  background: var(--ink);
}

.round-dot.current {
  background: var(--coral);
  border-color: var(--coral);
  transform: scale(1.35);
}

.results-screen {
  min-height: 530px;
  padding: clamp(28px, 5vw, 60px);
}

.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}

.results-heading h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.06em;
  margin: 10px 0 0;
}

.accuracy-block {
  text-align: right;
}

.accuracy-value {
  display: block;
  font: 500 clamp(3.2rem, 7vw, 5.8rem)/0.85 "DM Mono", monospace;
  letter-spacing: -0.08em;
}

.accuracy-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.summary-strip {
  background: var(--lime);
  border: 1px solid var(--ink);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.summary-label {
  display: block;
  font: 500 0.62rem/1 "DM Mono", monospace;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

.summary-strip strong {
  font: 500 1.55rem/1 "DM Mono", monospace;
}

.summary-strip p {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th {
  font: 500 0.65rem/1 "DM Mono", monospace;
  color: var(--muted);
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  font: 400 0.88rem/1 "DM Mono", monospace;
}

td.deviation {
  font-weight: 500;
}

td.just-cell {
  color: #5a7914;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
}

.secondary-button,
.share-button {
  min-height: 48px;
  padding: 0 20px;
  box-shadow: 4px 4px 0 var(--ink);
}

.secondary-button {
  background: var(--card);
}

.share-button {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.share-button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

footer {
  /* border-top: 1px solid var(--ink); */
  min-height: 24px;
  margin-top: auto;
  color: var(--muted);
}

@media (max-width: 740px) {
  .app-shell {
    width: min(100% - 28px, 620px);
  }

  .site-header {
    min-height: 66px;
  }

  .edition {
    display: none;
  }

  .ad-section {
    min-height: 96px;
    margin-bottom: 18px;
    padding-inline: 10px;
  }

  .start-gate-message {
    margin-top: -9px;
  }

  .game-card {
    margin: 24px 0 34px;
    box-shadow: 5px 5px 0 var(--ink);
    min-height: 640px;
  }

  .card-topline {
    height: 50px;
    padding: 0 18px;
  }

  .intro-screen {
    min-height: 588px;
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    gap: 22px;
  }

  .intro-copy h1 {
    font-size: clamp(2.75rem, 15vw, 4.3rem);
    margin-bottom: 16px;
  }

  .intro-copy p {
    font-size: 0.82rem;
    line-height: 1.75;
  }

  .dial {
    width: min(210px, 55vw);
  }

  .n12 { top: 22px; }
  .n3 { right: 22px; }
  .n6 { bottom: 22px; }
  .n9 { left: 22px; }

  .intro-actions {
    margin-top: auto;
    flex-direction: column;
    gap: 13px;
  }

  .primary-button {
    width: 100%;
    min-width: 0;
  }

  .hint {
    margin: 0;
  }

  .countdown-screen,
  .play-screen {
    min-height: 588px;
  }

  .tap-button {
    width: min(230px, 62vw);
  }

  .results-screen {
    min-height: 588px;
    padding: 28px 18px;
  }

  .results-heading {
    align-items: flex-start;
  }

  .results-heading h2 {
    font-size: 1.75rem;
  }

  .accuracy-value {
    font-size: 3.3rem;
  }

  .summary-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions button {
    justify-content: center;
    width: 100%;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 0.75rem;
  }

  footer {
    font-size: 0.56rem;
  }
}

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