:root {
  --orange: #ff8200;
  --orange-dark: #cc5d00;
  --ink: #17222b;
  --cream: #fff8eb;
  --wall: #e9e4dc;
  --wall-shadow: #d4cdc4;
  --white: #fff;
  --danger: #c53a31;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 130, 0, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 130, 0, .07) 1px, transparent 1px),
    var(--cream);
  background-size: 32px 32px;
  font-family: Arial, Helvetica, sans-serif;
  user-select: none;
}

button,
a {
  font: inherit;
}

.game-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.game-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: 175px 1fr auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 12px;
}

.game-header img {
  width: 175px;
  height: auto;
}

.game-header p {
  margin: 0 0 2px;
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 42px);
  letter-spacing: -.045em;
}

.sound-button {
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.scoreboard > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--white);
  background: var(--ink);
}

.scoreboard span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.scoreboard strong {
  font-size: 24px;
}

.scoreboard .timer-box {
  background: var(--orange);
}

.game-stage {
  position: relative;
  min-height: min(660px, calc(100vh - 210px));
  overflow: hidden;
  border: 7px solid var(--ink);
  border-radius: 22px;
  background: var(--wall);
  box-shadow: 0 20px 55px rgba(23, 34, 43, .18);
  isolation: isolate;
}

.wall-texture {
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .6;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.8), transparent 18%),
    radial-gradient(circle at 72% 60%, rgba(210,203,194,.55), transparent 22%),
    repeating-linear-gradient(5deg, transparent 0 16px, rgba(160,150,141,.08) 17px 18px);
}

.game-stage.danger {
  box-shadow: inset 0 0 0 8px rgba(197, 58, 49, .35), 0 20px 55px rgba(23, 34, 43, .18);
}

.game-area {
  position: absolute;
  inset: 0 0 0 27%;
  cursor: crosshair;
}

.character {
  position: absolute;
  z-index: 3;
  left: -4%;
  bottom: -8%;
  width: 37%;
  pointer-events: none;
}

.character img {
  display: block;
  width: 100%;
  max-height: 610px;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 16px 17px rgba(23,34,43,.22));
}

.character p {
  position: absolute;
  top: 8%;
  right: -14%;
  max-width: 175px;
  margin: 0;
  padding: 11px 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.wall-warning {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  min-height: 28px;
  color: var(--danger);
  font-size: 15px;
  font-weight: 900;
}

.crack {
  position: absolute;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transform: translate(-50%, -50%) scale(var(--grow, .45)) rotate(var(--tilt));
  transition: transform .25s ease;
}

.crack::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(64, 56, 50, .18), transparent 68%);
  filter: blur(5px);
}

.crack i {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  width: var(--length);
  height: var(--weight);
  border-radius: 30% 80% 50% 20%;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.62) 0 18%,
      #5b514b 24% 48%,
      #272320 52% 100%
    );
  box-shadow:
    0 calc(var(--weight) * .55) 0 rgba(255,255,255,.5),
    0 0 calc(1px + var(--shade) * .35px) rgba(44, 38, 34, .22);
  transform-origin: left center;
  transform: rotate(var(--angle));
}

.crack.hard i {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.48) 0 15%,
      #473e39 21% 43%,
      #181614 48% 100%
    );
}

.crack.hit {
  animation: tap .18s ease;
}

.crack.fixed {
  pointer-events: none;
  animation: smooth .36s ease forwards;
}

.plaster-pop {
  position: absolute;
  z-index: 2;
  width: 78px;
  height: 42px;
  border-radius: 50%;
  background: #faf9f4;
  box-shadow: inset 0 -4px 8px #d8d4ca, 0 4px 9px rgba(23,34,43,.12);
  transform: translate(-50%, -50%) rotate(-8deg);
  animation: plaster .5s ease forwards;
  pointer-events: none;
}

.score-pop {
  position: absolute;
  z-index: 6;
  color: var(--orange-dark);
  font-size: 18px;
  font-weight: 900;
  animation: score-float .7s ease forwards;
  pointer-events: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(23, 34, 43, .78);
  backdrop-filter: blur(5px);
}

.game-overlay[hidden] {
  display: none;
}

.overlay-card {
  width: min(570px, 100%);
  padding: clamp(28px, 5vw, 52px);
  border: 6px solid var(--orange);
  border-radius: 24px;
  background: var(--white);
  box-shadow: 14px 14px 0 var(--ink);
  text-align: center;
}

.overlay-card .kicker {
  margin: 0 0 8px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
}

.overlay-card h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
  letter-spacing: -.05em;
}

.overlay-card > p:not(.kicker) {
  margin: 18px auto 24px;
  color: #5f6b73;
  line-height: 1.55;
}

.primary-button {
  padding: 16px 24px;
  border: 0;
  border-radius: 13px;
  color: var(--white);
  background: var(--orange);
  box-shadow: 0 7px 0 var(--orange-dark);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--orange-dark);
}

.final-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0;
}

.final-score span {
  color: #68747b;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.final-score strong {
  font-size: 38px;
}

footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 13px;
  font-size: 14px;
}

footer p {
  margin: 0;
  color: #64717a;
}

footer a {
  color: var(--ink);
  font-weight: 900;
}

@keyframes tap {
  50% { transform: translate(-50%, -50%) scale(calc(var(--grow) + .1)) rotate(var(--tilt)); }
}

@keyframes smooth {
  to { opacity: 0; transform: translate(-50%, -50%) scale(.15) rotate(var(--tilt)); }
}

@keyframes plaster {
  65% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(4deg); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(.8) rotate(8deg); }
}

@keyframes score-float {
  to { opacity: 0; transform: translateY(-55px) scale(1.25); }
}

@media (max-width: 700px) {
  body {
    padding: 9px;
  }

  .game-header {
    grid-template-columns: 105px 1fr auto;
    gap: 10px;
  }

  .game-header img {
    width: 105px;
  }

  .game-header p {
    display: none;
  }

  .sound-button {
    padding: 8px 10px;
    font-size: 11px;
  }

  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .scoreboard strong {
    font-size: 20px;
  }

  .game-stage {
    min-height: 610px;
    border-width: 5px;
  }

  .game-area {
    inset: 0;
  }

  .character {
    left: -16%;
    width: 48%;
    opacity: .9;
  }

  .character p {
    display: none;
  }

  footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
