:root {
  --bg: #f6f3ee;
  --ink: #1d1b19;
  --muted: #7a736b;
  --line: #d9d2c8;
  --slot: #ffffff;
  --accent: #ea580c;
  --accent-soft: #fde4d3;
  --locked: #16a34a;
  --stage: min(92vw, 72vh, 640px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161412; --ink: #f2ede6; --muted: #9b948b; --line: #3a3530;
    --slot: #f7f5f2; --accent-soft: #3d2414;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px; gap: 8px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.top { width: var(--stage); display: flex; justify-content: space-between; align-items: baseline; }
.top h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.round { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  width: var(--stage); height: var(--stage);
  cursor: pointer;
}
/* the shot itself lives in scene.css */

/* ---------- slots ---------- */
.slot {
  --size: calc(var(--stage) * 0.26);
  position: absolute;
  width: var(--size);
  left: calc(50% + var(--x) * var(--stage) - var(--size) / 2);
  top: calc(50% + var(--y) * var(--stage) - var(--size) / 2);
  display: flex; flex-direction: column; align-items: center;
  border: 0; padding: 0; background: none; color: inherit; font: inherit;
  cursor: pointer;
}
.slot .disc {
  position: relative;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: var(--slot);
  border: 3px dashed var(--line);
  overflow: hidden;
  display: grid; place-items: center;
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.slot .disc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .disc img.contain { object-fit: contain; padding: 14%; }
.slot .disc img.product { object-fit: contain; padding: 6%; }
.slot .placeholder { font-size: calc(var(--size) * 0.36); opacity: .55; }
.slot .label {
  margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.slot .name {
  font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2;
  min-height: 2.4em; max-width: calc(var(--size) * 1.3);
}

.slot.filled .disc { border-style: solid; border-color: var(--line); }
.stage.choosing .slot:not(.locked) .disc {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 1.4s ease-in-out infinite;
}
.stage.choosing .slot:not(.locked):hover .disc { transform: scale(1.07); animation: none; }
.slot.locked .disc { border: 4px solid var(--locked); box-shadow: 0 0 0 4px rgba(22,163,74,.18); }
.slot.locked::after {
  content: "✓"; position: absolute; top: -4px; right: calc(50% - var(--size) / 2 - 4px);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--locked); color: #fff; font-weight: 800;
  display: grid; place-items: center; font-size: 15px; z-index: 2;
}
.slot.spinning .disc img { animation: flicker .09s linear infinite; }
.slot.landed .disc { animation: pop .3s ease-out; }
.stage.choosing .slot.locked, .stage.rolling .slot { cursor: default; }

@keyframes pulse { 50% { box-shadow: 0 0 0 9px var(--accent-soft); } }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes flicker { 50% { opacity: .75; } }

.cta {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 22px; font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(234,88,12,.35);
  z-index: 3;
}
.stage:not(.idle) .cta { visibility: hidden; }

.hint { margin: 4px 0 0; color: var(--muted); text-align: center; min-height: 1.4em; }
.credits { margin-top: auto; font-size: 12px; }
.credits a { color: var(--muted); }

/* ---------- result ---------- */
.result {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; padding: 16px; z-index: 10;
  animation: fade .3s;
}
.result[hidden] { display: none; }
.card {
  background: var(--bg); border-radius: 20px; padding: 24px;
  width: min(100%, 520px); max-height: 100%; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.card h2 { margin: 0; }
.tagline { margin: 4px 0 16px; color: var(--muted); }
.setup { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.setup li { display: flex; align-items: center; gap: 12px; }
.setup .thumb {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--slot); border: 2px solid var(--line);
}
.setup .thumb img { width: 100%; height: 100%; object-fit: cover; }
.setup .thumb img.contain { object-fit: contain; padding: 10px; }
.setup .thumb img.product { object-fit: contain; padding: 4px; }
.setup small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.setup strong { display: block; }
.setup em { color: var(--muted); font-size: 14px; }
.again {
  margin-top: 20px; width: 100%;
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 12px; font: inherit; font-weight: 700; cursor: pointer;
}
@keyframes fade { from { opacity: 0; } }

@media (max-width: 520px) {
  .slot .name { font-size: 11px; }
  .slot .label { font-size: 9px; }
}

/* Keep slot text readable where it overlaps the backdrop circle. */
.slot { z-index: 2; }
.slot .label, .slot .name:not(:empty) { background: var(--bg); padding: 0 6px; border-radius: 6px; white-space: nowrap; }
.slot .name { min-height: 0; margin-top: 1px; }
@media (max-width: 520px) {
  .slot .name:not(:empty) { white-space: normal; max-width: calc(var(--size) * 1.25); }
  body { overflow-x: hidden; }
}

.verdict { margin: 6px 0 0; font-size: 22px; font-weight: 800; color: var(--accent); }
