:root {
  --wine: #6f132d;
  --wine-dark: #45091a;
  --rose: #b63e61;
  --cream: #fff7ec;
  --gold: #d8a84e;
  --ink: #2c1720;
  --muted: #7f6871;
  --danger: #b5232b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 20%, rgba(216,168,78,.18), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(182,62,97,.15), transparent 24%),
    linear-gradient(135deg, #fff8ee, #f9ebdd);
  overflow-x: hidden;
}

button { font: inherit; }

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.game-card {
  width: min(100%, 840px);
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(111,19,45,.12);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 26px 80px rgba(91, 42, 47, .18);
  backdrop-filter: blur(12px);
}

.topbar {
  padding: 24px 26px 14px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  color: var(--rose);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 2px;
}

h1, h2 { font-family: "Playfair Display", serif; }

h1 {
  margin: 2px 0 4px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1;
  color: var(--wine-dark);
}

h1 span { color: var(--gold); }
.topbar p { margin: 0; color: var(--muted); font-size: 14px; }

.sound-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(111,19,45,.13);
  background: #fff;
  cursor: pointer;
  transition: .2s ease;
}
.sound-btn:hover { transform: translateY(-2px); }

.stats-row {
  padding: 4px 26px 15px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(111,19,45,.10);
  background: #fffaf4;
}
.stat-box.highlight { background: #fff2f5; }
.stat-label { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.3px; }
.stat-box strong { display: block; margin-top: 2px; font-size: 23px; color: var(--wine); }

.timer-track {
  height: 7px;
  margin: 0 26px 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1ded9;
}
.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--rose), var(--wine));
  transform-origin: left center;
}

.game-area {
  position: relative;
  height: 500px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(rgba(255,247,236,.93), rgba(255,247,236,.93)),
    repeating-linear-gradient(45deg, rgba(111,19,45,.06) 0 1px, transparent 1px 18px);
  border-top: 1px solid rgba(111,19,45,.08);
  border-bottom: 1px solid rgba(111,19,45,.08);
}

.pattern { position: absolute; z-index: -1; border-radius: 50%; opacity: .14; }
.pattern-a { width: 260px; height: 260px; left: -120px; top: -80px; border: 30px double var(--gold); }
.pattern-b { width: 230px; height: 230px; right: -110px; bottom: -90px; border: 26px double var(--rose); }

.start-screen, .end-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  z-index: 20;
}

.hero-icon, .result-icon { font-size: 58px; filter: drop-shadow(0 10px 12px rgba(0,0,0,.10)); }
.start-screen h2, .end-screen h2 { margin: 8px 0 7px; color: var(--wine-dark); font-size: clamp(30px, 5vw, 44px); }
.start-screen > p { max-width: 540px; margin: 0 auto 22px; color: var(--muted); }

.legend {
  width: min(100%, 590px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.legend div {
  padding: 13px 6px;
  border-radius: 15px;
  border: 1px solid rgba(111,19,45,.10);
  background: rgba(255,255,255,.82);
}
.legend span { display: block; font-size: 25px; }
.legend b { display: block; margin-top: 3px; font-size: 12px; }
.legend small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); }
.legend .danger { border-color: rgba(181,35,43,.16); background: #fff3f3; }

.primary-btn, .secondary-btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 21px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--wine), var(--rose));
  box-shadow: 0 10px 24px rgba(111,19,45,.25);
}
.secondary-btn {
  color: var(--wine);
  background: #fff;
  border: 1px solid rgba(111,19,45,.15);
}
.primary-btn:hover, .secondary-btn:hover { transform: translateY(-2px); }
.microcopy { margin-top: 10px; color: var(--muted); font-size: 11px; }

.falling-item {
  position: absolute;
  top: -70px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  background: rgba(255,255,255,.94);
  border: 2px solid rgba(111,19,45,.12);
  box-shadow: 0 10px 25px rgba(83,31,42,.16);
  font-size: 31px;
  animation: fall linear forwards;
  will-change: transform;
  z-index: 5;
}
.falling-item:hover { border-color: rgba(216,168,78,.8); }
.falling-item.bomb { background: #fff0f0; border-color: rgba(181,35,43,.35); }
.falling-item.clicked {
  pointer-events: none;
  animation: pop .22s ease forwards !important;
}

@keyframes fall {
  from { transform: translateY(-75px) rotate(0deg); }
  to { transform: translateY(620px) rotate(270deg); }
}
@keyframes pop {
  to { transform: scale(1.55); opacity: 0; }
}

.float-score {
  position: absolute;
  font-size: 16px;
  font-weight: 900;
  color: var(--wine);
  pointer-events: none;
  z-index: 12;
  animation: scoreFloat .7s ease forwards;
}
@keyframes scoreFloat {
  to { transform: translateY(-46px) scale(1.1); opacity: 0; }
}

.end-screen {
  background: rgba(255,247,236,.95);
  backdrop-filter: blur(8px);
}
.result-kicker { margin-top: 9px; font-size: 11px; letter-spacing: 2px; font-weight: 900; color: var(--rose); }
.final-score { font-size: 28px; font-weight: 900; color: var(--wine); }
.final-score span { font-size: 50px; }
.discount-copy { margin: 8px 0; color: var(--muted); }
.discount-copy b { color: var(--wine); font-size: 21px; }
.coupon { margin: 2px 0 18px; padding: 9px 16px; border: 1px dashed var(--gold); border-radius: 12px; background: #fff; font-weight: 800; letter-spacing: 1px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.footer-note {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  justify-content: center;
  padding: 14px 18px 17px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.danger-text { color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #2c1720;
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 100;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }

.shake { animation: shake .38s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-5px); }
}

@media (max-width: 650px) {
  .page-shell { padding: 0; }
  .game-card { min-height: 100vh; border-radius: 0; }
  .topbar { padding: 18px 16px 12px; }
  .stats-row { padding: 2px 16px 12px; gap: 6px; }
  .stat-box { padding: 10px 9px; }
  .stat-box strong { font-size: 19px; }
  .timer-track { margin: 0 16px 14px; }
  .game-area { height: 520px; }
  .legend { grid-template-columns: repeat(2, 1fr); }
  .falling-item { width: 54px; height: 54px; font-size: 29px; }
}
