:root {
  color-scheme: light;
  --bg: #fff7e8;
  --ink: #392916;
  --muted: #8b7053;
  --line: #f0d8ab;
  --panel: #ffffff;
  --green: #29a86f;
  --gold: #f7bd32;
  --pink: #ff8fa3;
  --peach: #ffcf9f;
  --red: #d95d55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 12%, #ffe2e9 0 7rem, transparent 16rem),
    radial-gradient(circle at 86% 18%, #dff7d9 0 8rem, transparent 18rem),
    linear-gradient(180deg, #fffaf0 0%, var(--bg) 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(820px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 18px;
  align-content: center;
}

.scoreboard,
.settings {
  background: color-mix(in srgb, var(--panel) 90%, #fff1c9);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(130, 80, 24, 0.14);
}

.scoreboard {
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.settings {
  padding: 18px;
}

.settings {
  align-self: start;
}

.top-row,
.time-row,
.game-grid {
  display: grid;
  gap: 12px;
}

.top-row {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.eyebrow,
.panel-label,
.card-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 9vw, 4.8rem);
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.status-pill {
  min-width: 88px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fff0c8;
  color: var(--muted);
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(111, 77, 28, 0.08);
}

.status-pill[data-status='working'] {
  background: #d8f7df;
  color: var(--green);
}

.amount-panel {
  margin: 30px 0 8px;
  text-align: center;
}

.amount {
  min-height: 1.05em;
  font-size: clamp(3.1rem, 13vw, 7.6rem);
  line-height: 1.05;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #5f3512;
  text-shadow: 0 4px 0 rgba(247, 189, 50, 0.18);
}

.subline,
.progress-section p,
.error {
  margin: 8px 0 0;
  color: var(--muted);
}

.progress-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #f3e3c1;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--gold), var(--green));
  transition: width 300ms ease;
}

.game-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
}

.game-card {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf6;
}

.game-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.05rem;
  line-height: 1.25;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--green), #1f8f88);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(41, 168, 111, 0.22);
}

.error {
  min-height: 1.4em;
  color: var(--red);
}

.settings {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.settings h2,
.settings .error {
  grid-column: 1 / -1;
}

.time-row {
  grid-template-columns: 1fr 1fr;
}

.settings button {
  min-width: 112px;
}

.celebration {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translate(-50%, -90px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: none;
}

.celebration.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.treasure-scene {
  position: relative;
  width: min(360px, 100%);
  height: 226px;
  margin: 0 auto 20px;
  display: grid;
  place-items: end center;
}

.coin-rain {
  position: absolute;
  inset: 0 22px 66px;
  pointer-events: none;
}

.coin {
  position: absolute;
  top: -20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, #fff8a8 0 16%, transparent 17%),
    radial-gradient(circle at 50% 50%, #ffd958 0 46%, #eda11d 47% 72%, #a96213 73%);
  border: 4px solid #a96213;
  box-shadow: 0 5px 0 rgba(108, 62, 8, 0.14);
  opacity: 0;
  transform: translateY(-18px) rotate(0deg) scale(0.8);
}

.coin::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 3px solid rgba(120, 68, 12, 0.32);
  border-radius: inherit;
}

.coin::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 226, 0.82);
}

.coin-one {
  left: 18%;
}

.coin-two {
  left: 36%;
}

.coin-three {
  left: 54%;
}

.coin-four {
  left: 70%;
}

.coin-five {
  left: 48%;
}

.treasure-scene.is-earning .coin {
  animation: coin-drop 1.65s linear infinite;
  opacity: 1;
}

.treasure-scene.is-earning .coin-two {
  animation-delay: 0.25s;
}

.treasure-scene.is-earning .coin-three {
  animation-delay: 0.5s;
}

.treasure-scene.is-earning .coin-four {
  animation-delay: 0.78s;
}

.treasure-scene.is-earning .coin-five {
  animation-delay: 1.06s;
}

.treasure-scene.is-bursting .coin {
  animation: coin-burst 850ms ease-out both;
  opacity: 1;
}

.treasure-bowl {
  position: relative;
  width: 286px;
  height: 154px;
  animation: bowl-idle 2.4s ease-in-out infinite;
}

.bowl-body,
.bowl-lip,
.bowl-foot,
.bowl-shine,
.bowl-coin {
  position: absolute;
  display: block;
}

.bowl-body {
  left: 20px;
  right: 20px;
  bottom: 17px;
  height: 110px;
  border-radius: 38px 38px 124px 124px / 28px 28px 96px 96px;
  background:
    radial-gradient(ellipse at 72% 35%, rgba(255, 176, 113, 0.36) 0 9%, transparent 10%),
    radial-gradient(ellipse at 34% 48%, rgba(255, 174, 132, 0.46) 0 23%, transparent 24%),
    linear-gradient(155deg, #e95f62 0%, #c43640 48%, #8e1e29 100%);
  border: 6px solid #7c1b22;
  box-shadow: inset 0 -16px 0 rgba(92, 11, 20, 0.18), 0 17px 22px rgba(117, 47, 18, 0.17);
  z-index: 1;
}

.bowl-lip {
  left: 3px;
  right: 3px;
  bottom: 106px;
  height: 46px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 244, 170, 0.8) 0 32%, transparent 33%),
    linear-gradient(180deg, #ffe083, #f0ae2e 62%, #d78317);
  border: 6px solid #89500f;
  box-shadow: inset 0 7px 0 rgba(255, 255, 255, 0.32), 0 5px 0 rgba(102, 54, 10, 0.12);
  z-index: 5;
}

.bowl-foot {
  left: 82px;
  right: 82px;
  bottom: 0;
  height: 27px;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, #9b2530, #671923);
  border: 5px solid #7b1d22;
  border-top: 0;
  z-index: 0;
}

.bowl-shine {
  left: 82px;
  bottom: 64px;
  width: 84px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 222, 229, 0.46);
  transform: rotate(-24deg);
  z-index: 4;
}

.bowl-coin {
  bottom: 122px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, #fff8a8 0 16%, transparent 17%),
    radial-gradient(circle at 50% 50%, #ffd958 0 46%, #eda11d 47% 72%, #a96213 73%);
  border: 4px solid #9a5a13;
  box-shadow: inset 0 -4px 0 rgba(143, 78, 10, 0.18);
  z-index: 4;
}

.bowl-coin::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3px solid rgba(112, 64, 10, 0.3);
  border-radius: inherit;
}

.bowl-coin::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 226, 0.82);
}

.stack-one {
  left: 34px;
  bottom: 119px;
  transform: rotate(-20deg) scale(0.88);
}

.stack-two {
  left: 80px;
  bottom: 136px;
  transform: rotate(-8deg);
}

.stack-three {
  left: 130px;
  bottom: 142px;
  transform: rotate(6deg) scale(1.08);
}

.stack-four {
  right: 70px;
  bottom: 134px;
  transform: rotate(16deg);
}

.stack-five {
  right: 28px;
  bottom: 118px;
  transform: rotate(24deg) scale(0.86);
}

.treasure-scene.is-earning .treasure-bowl {
  animation: bowl-earning 900ms ease-in-out infinite;
}

@keyframes coin-drop {
  0% {
    opacity: 0;
    transform: translateY(-22px) rotate(0deg) scale(0.78);
  }
  14% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(134px) rotate(260deg) scale(1);
  }
}

@keyframes coin-burst {
  0% {
    opacity: 0;
    transform: translateY(48px) rotate(-80deg) scale(0.75);
  }
  35% {
    opacity: 1;
    transform: translateY(-38px) rotate(90deg) scale(1.16);
  }
  100% {
    opacity: 0;
    transform: translateY(128px) rotate(280deg) scale(0.88);
  }
}

@keyframes bowl-idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes bowl-earning {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-5px) scale(1.015);
  }
}

@media (max-width: 760px) {
  .app-shell {
    align-items: start;
    padding: 14px;
  }

  .settings {
    grid-template-columns: 1fr;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .treasure-scene {
    height: 188px;
  }

  .treasure-bowl {
    transform: scale(0.9);
  }
}
