:root {
  --ink: #2b1217;
  --muted: #755b60;
  --red: #bc1730;
  --red-dark: #7d0f21;
  --gold: #f5b91f;
  --cream: #fff9f4;
  --teal: #2e858a;
  --line: rgba(146, 31, 47, 0.18);
  --shadow: 0 24px 58px rgba(89, 20, 30, 0.16);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 188, 156, 0.34), transparent 25%),
    radial-gradient(circle at 88% 18%, rgba(74, 158, 163, 0.24), transparent 24%),
    linear-gradient(180deg, #fff8f5, #fffdf9 50%, #ffece8);
}

button, a { font: inherit; }

.game-shell {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.utility-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.utility-nav a,
.secondary-button,
.dialog-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red-dark);
  background: rgba(255, 255, 255, 0.82);
  font-weight: 850;
  text-decoration: none;
}

.game-panel {
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 15px;
}

.title-star {
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), #ff786d);
  box-shadow: 0 12px 24px rgba(188, 23, 48, 0.18);
  font-size: 2.5rem;
}

.eyebrow,
.dialog-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5.8vw, 4rem); line-height: 0.94; }
.game-header p { margin-top: 7px; color: var(--muted); font-weight: 650; }

.secondary-button {
  border: 0;
  cursor: pointer;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.stats span { display: block; color: var(--muted); font-size: 0.7rem; font-weight: 900; text-transform: uppercase; }
.stats strong { display: block; margin-top: 4px; font-size: clamp(1.15rem, 3vw, 1.6rem); }

.game-status-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px 12px;
  color: var(--muted);
}

.game-status-row > strong { flex: 0 0 auto; color: var(--teal); }

.whack-stage {
  position: relative;
  overflow: hidden;
  padding: clamp(12px, 2.5vw, 24px);
  border: 2px solid rgba(46, 133, 138, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255,255,255,0.32), rgba(255,255,255,0.32)),
    repeating-linear-gradient(45deg, #ffddd2 0 18px, #ffe8cf 18px 36px);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.hole-grid {
  width: min(100%, 680px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2.2vw, 20px);
}

.whack-hole {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 62%, #4d2529 0 34%, #6b3437 35% 48%, #f4b49e 49% 57%, #ffd9cb 58% 100%);
  box-shadow: inset 0 -8px 14px rgba(78, 24, 30, 0.15), 0 8px 18px rgba(83, 24, 31, 0.1);
  cursor: default;
  touch-action: manipulation;
}

.whack-hole.is-active { cursor: pointer; }

.target-item {
  position: absolute;
  inset: 9%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  transform: translateY(112%) scale(0.8);
  animation: target-pop 150ms ease-out forwards;
  pointer-events: none;
}

.target-item img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
}

.target-item.is-photo { padding: 5px; background: #fff; box-shadow: 0 8px 18px rgba(46, 20, 24, 0.22); }
.target-item.is-star { color: #fff; background: linear-gradient(135deg, #ffd038, #ef9d08); font-size: clamp(2.4rem, 8vw, 5.8rem); text-shadow: 0 3px 0 rgba(139, 83, 0, 0.2); }
.target-item.is-cloud { color: #71818d; background: #eef4f6; font-size: clamp(2.2rem, 7vw, 5rem); }
.whack-hole.is-hit .target-item { animation: target-hit 180ms ease forwards; }
.whack-hole.is-wrong { animation: wrong-tap 260ms ease; }

.start-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: #fff;
  text-align: center;
  background: rgba(50, 14, 20, 0.82);
  backdrop-filter: blur(5px);
}

.start-overlay[hidden] { display: none; }
.overlay-star { color: var(--gold); font-size: 4rem; line-height: 1; }
.start-overlay strong { font-size: clamp(1.8rem, 5vw, 3rem); }
.start-overlay p { max-width: 34ch; color: #ffe9df; line-height: 1.5; }
.start-overlay button,
.dialog-actions button {
  min-height: 48px;
  margin-top: 8px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  color: var(--red-dark);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
}

.start-overlay button:disabled { opacity: 0.62; cursor: wait; }

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(43, 18, 23, 0.7);
  font-size: clamp(5rem, 20vw, 10rem);
  font-weight: 900;
  text-shadow: 0 8px 24px rgba(0,0,0,0.24);
}

.countdown[hidden] { display: none; }

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

.target-legend span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 850;
}

.target-legend i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; font-style: normal; }
.legend-photo { background: center / cover url('https://res.cloudinary.com/mkf2w5rv/image/upload/v1784450443/12057_tbvllp.jpg'); }
.legend-star { color: #fff; background: var(--gold); }
.legend-cloud { color: #6f7f89; background: #e6eef1; }

.result-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 32px 80px rgba(42, 17, 21, 0.35);
  text-align: center;
}

.result-dialog::backdrop { background: rgba(32, 8, 12, 0.72); backdrop-filter: blur(4px); }
.dialog-star { display: block; color: var(--gold); font-size: 4.5rem; line-height: 1; }
.result-dialog h2 { margin-bottom: 10px; font-size: 2.1rem; }
.result-dialog p { color: var(--muted); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.dialog-actions button { margin: 0; color: #fff; background: var(--red); }

button:focus-visible, a:focus-visible { outline: 4px solid rgba(46, 133, 138, 0.32); outline-offset: 3px; }

@keyframes target-pop { to { transform: translateY(0) scale(1); } }
@keyframes target-hit { to { transform: translateY(-12%) scale(1.18); opacity: 0; } }
@keyframes wrong-tap { 50% { transform: scale(0.95); filter: saturate(1.6); } }

@media (max-width: 620px) {
  .game-shell { width: min(100% - 16px, 980px); padding-top: 10px; }
  .game-panel { padding: 13px; }
  .game-header { align-items: flex-start; }
  .title-star { width: 54px; height: 54px; flex-basis: 54px; font-size: 2rem; }
  .secondary-button { min-height: 38px; padding: 0 11px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .stats > div { padding: 9px 11px; }
  .game-status-row { align-items: flex-start; font-size: 0.88rem; }
  .whack-stage { padding: 10px; }
  .hole-grid { gap: 8px; }
  .target-item { inset: 7%; }
  .target-legend { gap: 7px; }
  .target-legend span { min-height: 36px; padding: 0 10px; font-size: 0.78rem; }
  .dialog-actions { flex-direction: column; }
}

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