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

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d0d0d;
  color: #c9c3b7;
  font-synthesis: none;
}

body {
  min-width: 20rem;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: #0d0d0d;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.back-link {
  position: fixed;
  z-index: 2;
  inset-block-start: 1rem;
  inset-inline-start: 1rem;
  color: #777168;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  color: #c9c3b7;
}

.game-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  width: min(100%, 46rem);
  margin: 0 auto;
  padding: clamp(4rem, 9vh, 6rem) 1.25rem 2rem;
}

.game-header {
  text-align: center;
}

.game-label,
.subtitle,
.game-header h1 {
  margin: 0;
}

.game-label {
  color: #777168;
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.game-header h1 {
  margin-block-start: 0.35rem;
  color: #eee9df;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 400;
  line-height: 1;
}

.subtitle {
  margin-block-start: 0.65rem;
  color: #9c958a;
  font-size: clamp(0.82rem, 2.8vw, 1rem);
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 6vw, 2.5rem);
  width: 100%;
  margin-block-start: clamp(1.3rem, 4vh, 2.25rem);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: clamp(0.9rem, 5vw, 2.2rem);
  margin: 0;
}

.stats div {
  text-align: center;
}

.stats dt {
  color: #777168;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stats dd {
  min-width: 3ch;
  margin: 0.2rem 0 0;
  color: #c9c3b7;
  font-variant-numeric: tabular-nums;
}

.target-value {
  display: grid;
  place-items: center;
}

.target-coin {
  display: block;
  width: 1.5em;
  height: 1.5em;
  transform: rotate(90deg);
  transform-origin: 50% 50%;
}

.target-coin path {
  fill: none;
  stroke: #c9c3b7;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.mute-toggle,
#copy-share {
  border: 1px solid #4b4741;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.mute-toggle {
  padding: 0.48rem 0.7rem;
  color: #8f887d;
  font-size: 0.7rem;
  white-space: nowrap;
}

.mute-toggle:hover,
.mute-toggle:focus-visible,
#copy-share:hover,
#copy-share:focus-visible {
  border-color: #c9c3b7;
  color: #eee9df;
}

#game-surface {
  display: grid;
  place-items: center;
  margin-block-start: clamp(1.2rem, 4vh, 2.5rem);
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#game-surface:focus-visible {
  outline: 1px solid #777168;
  outline-offset: 0.65rem;
}

.coin-frame {
  display: grid;
  place-items: center;
  inline-size: min(68vw, 42vh, 24rem);
  aspect-ratio: 1;
  border-radius: 50%;
}

#coin {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
  user-select: none;
}

.is-buttoshi .coin-frame {
  animation: buttoshi-lock 180ms ease-out;
  box-shadow: 0 0 2.8rem rgba(255, 207, 85, 0.45);
}

.game-status {
  min-height: 1.5em;
  margin: clamp(1rem, 3vh, 1.6rem) 0 0;
  color: #c9c3b7;
  font-size: clamp(0.88rem, 3vw, 1.05rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.milestone {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
  color: #9c958a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-style: italic;
  text-align: center;
}

.share-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  width: min(100%, 34rem);
  margin-block-start: 1rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid #36332f;
}

.share-block label {
  grid-column: 1 / -1;
  color: #777168;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#share-text {
  width: 100%;
  min-height: 3.5rem;
  resize: none;
  border: 1px solid #4b4741;
  border-radius: 0.35rem;
  padding: 0.65rem;
  background: #151412;
  color: #c9c3b7;
  font-size: 0.78rem;
  line-height: 1.45;
}

#copy-share {
  align-self: stretch;
  padding: 0.55rem 0.8rem;
  color: #9c958a;
  font-size: 0.72rem;
}

.copy-feedback {
  grid-column: 1 / -1;
  min-height: 1.2em;
  margin: 0;
  color: #777168;
  font-size: 0.7rem;
}

.game-footer-controls {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-block-start: 1.25rem;
}

@keyframes buttoshi-lock {
  50% {
    transform: scale(1.025);
  }
}

@media (max-width: 30rem) {
  .game-shell {
    padding-inline: 1rem;
  }

  .stats {
    gap: clamp(0.5rem, 4vw, 1rem);
  }

  .share-block {
    grid-template-columns: 1fr;
  }

  .share-block label,
  .copy-feedback {
    grid-column: 1;
  }
}

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

  .is-buttoshi .coin-frame {
    animation: none;
  }
}
