:root {
  /* Jam Supermarket - #175B35 is the brand green (freshness) */
  --brand: #175B35;
  --brand-deep: #0E3D23;
  --brand-lift: #1F7A47;
  --bg: #08210F;
  --bg-2: #0E3D23;
  --ink: #F3FAF4;
  --ink-dim: #A8C9B4;
  --gold: #F5C542;
  --gold-deep: #D9A21B;
  --win: #5FE08A;
  --lose: #FF9A8A;
  --card: #0F3524;
  --line: rgba(255, 255, 255, .14);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

/* Author display rules (.result-img, .overlay) beat the UA's [hidden] rule,
   so hiding a styled element needs this guard. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 50% -10%, var(--brand) 0%, transparent 62%),
    linear-gradient(170deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ----------------------------------------------------------------- brand */

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 10px;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.15;
}

.brand-name span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .28em;
  color: var(--gold);
}

/* ------------------------------------------------------------------ head */

.head { text-align: center; }

h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 8vw, 40px);
  letter-spacing: -.5px;
  background: linear-gradient(120deg, var(--gold) 20%, #fff6dd 50%, var(--gold-deep) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.5;
}

/* ----------------------------------------------------------------- wheel */

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 14px 34px rgba(0, 0, 0, .5));
}

/* The library draws into a canvas it appends here. It sets the canvas size
   itself from the container, so pin it down: an unconstrained canvas that
   overshoots widens the page, which makes the next measurement bigger again. */
.wheel canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.wheel-fallback {
  position: absolute;
  color: var(--ink-dim);
  font-size: 14px;
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--gold);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6));
  z-index: 3;
}

.stage.spinning .wheel { filter: drop-shadow(0 14px 40px rgba(245, 197, 66, .38)); }

/* Brand hub at the axle. Kept under 17% of the stage so it clears the
   innermost edge of the prize pictures. */
.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 17%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 5px;
  background: var(--brand);
  border: 3px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
  z-index: 2;
  overflow: hidden;
}

.hub img { width: 100%; height: 100%; object-fit: contain; }

.hub-text {
  font-size: clamp(8px, 2.4vw, 12px);
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--gold);
  text-align: center;
  line-height: 1;
}

/* ----------------------------------------------------------------- panel */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.code-input {
  width: 100%;
  padding: 14px 12px;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .35em;
  text-indent: .35em;
  color: var(--ink);
  background: rgba(0, 0, 0, .3);
  border: 2px solid var(--line);
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

.code-input::placeholder { color: rgba(255, 255, 255, .18); }
.code-input:focus { outline: none; border-color: var(--gold); }
.code-input.shake { animation: shake .4s; border-color: var(--lose); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.text-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

.text-input:focus { outline: none; border-color: var(--gold); }

.msg {
  min-height: 20px;
  margin: 10px 0;
  font-size: 14px;
  text-align: center;
  color: var(--lose);
}

.msg.ok { color: var(--win); }

.tries {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
}

.result-tries {
  margin: 0 0 14px;
  padding: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(245, 197, 66, .12);
  border-radius: 10px;
}

.fineprint {
  margin: 12px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--ink-dim);
  opacity: .8;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s, filter .12s, opacity .12s;
}

.btn:active { transform: scale(.98); }

.btn-primary {
  color: #2a1a00;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep));
  box-shadow: 0 8px 22px rgba(232, 165, 22, .35);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-primary[disabled] {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  margin-top: 8px;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
}

/* -------------------------------------------------------------- overlays */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 20, 10, .8);
  backdrop-filter: blur(6px);
  animation: fade .25s ease;
}

.overlay[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.card {
  width: 100%;
  max-width: 420px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 26px 22px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: pop .35s cubic-bezier(.2, 1.4, .5, 1);
}

@keyframes pop {
  from { transform: scale(.85) translateY(16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.card h2 { margin: 0 0 6px; font-size: 26px; }

.result-img {
  display: block;
  width: 130px;
  height: 130px;
  margin: 0 auto 12px;
  object-fit: contain;
  border-radius: 14px;
  animation: pop .45s cubic-bezier(.2, 1.4, .5, 1);
}

.emoji {
  font-size: 60px;
  line-height: 1;
  margin-bottom: 8px;
  animation: bounce .9s ease-in-out 2;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-14px) rotate(-8deg); }
  60% { transform: translateY(-6px) rotate(8deg); }
}

.prize {
  margin: 6px 0;
  font-size: 30px;
  font-weight: 800;
  color: var(--gold);
}

.desc {
  margin: 0 0 18px;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.5;
}

.claim {
  margin: 0 0 18px;
  padding: 14px;
  background: rgba(255, 201, 77, .1);
  border: 1px dashed var(--gold);
  border-radius: 12px;
}

.claim-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-dim);
}

.claim-ref {
  display: block;
  margin: 6px 0 10px;
  font-size: 26px;
  letter-spacing: .06em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.card-brand {
  margin: 16px 0 0;
  padding-top: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
}

.claim-msg {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-dim);
}

/* --------------------------------------------------------------- reviews */

.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.star {
  font-size: 34px;
  line-height: 1;
  padding: 2px 4px;
  color: rgba(255, 255, 255, .2);
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform .12s, color .12s;
}

.star.on { color: var(--gold); }
.star:hover { transform: scale(1.15); }

.reviews h2 {
  margin: 0 0 12px;
  font-size: 18px;
  text-align: center;
  color: var(--ink-dim);
  font-weight: 600;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review {
  padding: 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.review-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-dim);
}

.review-name { font-weight: 700; color: var(--ink); }
.review-stars { color: var(--gold); letter-spacing: .05em; }

.review-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ foot */

.foot {
  text-align: center;
  font-size: 12px;
  color: var(--ink-dim);
  opacity: .65;
}

.foot a { color: inherit; }

/* Phones: give the wheel every pixel available - a bigger wheel is a
   bigger label band, which is the only thing that makes the text larger. */
@media (max-width: 430px) {
  .shell { padding: 16px 10px 32px; gap: 16px; }
  .stage { max-width: 100%; }
  .panel { padding: 16px 14px; }
}

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