:root {
  --ink: #2a2118;
  --muted: #6e5b48;
  --paper: #fffaf2;
  --sun: #ffc857;
  --sun-dark: #e39b16;
  --good: #218a52;
  --bad: #e15d4a;
  --line: #e6d7c3;
  --shadow: 0 14px 34px rgba(70, 42, 16, 0.12);
  font-family: "Fredoka", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: linear-gradient(#d5f1fb 0%, #fff4dc 48%, #e5f6c8 100%);
}

button { font: inherit; color: inherit; }

button, img { user-select: none; -webkit-user-select: none; }

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}

#app { min-height: 100dvh; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.screen.intro {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding-bottom: 28px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.05;
}

.blurb {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.35rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.samy {
  width: min(240px, 52vw);
  height: auto;
  display: block;
}

.samy.is-hop { animation: hop 1.15s ease-in-out infinite; }

.path-head .samy { width: 92px; }

.top, .path-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
}

.top-mid { text-align: center; flex: 1; }

.path-title h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }

.ghost, .btn, .num, .choice, .stone, .swatch, .dot {
  appearance: none;
  border: 0;
}

.ghost {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: 0 3px 0 rgba(70, 42, 16, 0.08);
}

.btn {
  background: var(--sun);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.5rem;
  border-radius: 999px;
  padding: 14px 36px;
  min-height: 64px;
  min-width: 180px;
  box-shadow: 0 6px 0 var(--sun-dark);
}

.ghost:active, .btn:active, .num:active, .choice:active, .stone:active, .swatch:active, .dot:active {
  translate: 0 3px;
}

.btn:active { box-shadow: 0 2px 0 var(--sun-dark); }

.stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 14px 22px;
}

.path {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(640px, 100%);
}

.stone {
  position: relative;
  overflow: hidden;
  background-color: #cbbba8;
  background-size: cover;
  background-position: center;
  border-radius: 26px;
  min-height: 196px;
  padding: 16px 10px 12px;
  box-shadow: 0 14px 28px rgba(40, 24, 10, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  color: white;
}

.stone-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(18, 10, 6, 0.82) 0%, rgba(18, 10, 6, 0.28) 34%, rgba(18, 10, 6, 0) 58%);
}

.stone .range,
.stone .place,
.stone .mini-pips,
.stone .tag { position: relative; z-index: 1; }

.stone .range {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.stone .place { color: rgba(255, 250, 242, 0.94); font-size: 1.05rem; }

.stone.is-done { box-shadow: inset 0 0 0 4px #7dcea0, 0 14px 28px rgba(40, 24, 10, 0.16); }

.stone.is-mark { outline: 4px solid var(--sun); outline-offset: 2px; }

.tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--sun);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.range-pill {
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pips, .mini-pips {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.mini-pips { gap: 3px; margin-top: 6px; max-width: 112px; flex-wrap: wrap; justify-content: center; }

.pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 2px rgba(42, 33, 24, 0.16);
}

.mini-pips .pip { width: 7px; height: 7px; background: rgba(255, 250, 242, 0.45); box-shadow: none; }

.pip.is-now { background: var(--sun); box-shadow: none; transform: scale(1.2); }

.pip.is-done, .mini-pips .pip.is-done { background: var(--good); box-shadow: none; }

.ask-row, .order, .fills, .seq, .palette, .choices-num {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.num {
  background: var(--paper);
  border-radius: 24px;
  min-width: 76px;
  min-height: 76px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 2.4rem;
  box-shadow: 0 6px 0 rgba(70, 42, 16, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.num.prompt {
  flex-direction: column;
  gap: 0;
  background: var(--sun);
  box-shadow: 0 8px 0 var(--sun-dark);
  min-width: 148px;
  min-height: 148px;
  font-size: clamp(3.4rem, 12vw, 4.8rem);
  border-radius: 42px;
  line-height: 0.9;
}

.seq .num.prompt {
  min-width: 84px;
  min-height: 84px;
  font-size: 2.6rem;
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--sun-dark);
}

.speaker { width: 28px; height: 28px; display: block; }

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(980px, 100%);
}

.choice {
  background: var(--paper);
  border-radius: 24px;
  min-height: 168px;
  padding: 10px 6px;
  box-shadow: 0 6px 0 var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-num {
  min-width: 96px;
  min-height: 104px;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
}

.arrow { font-size: 2rem; font-weight: 700; }

.blank {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  border: 3px dashed #b7a794;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--muted);
}

.bunch, .extra, .hands {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.thing {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.thing-box { width: 34px; height: 34px; display: block; }

.bunch[data-n="1"] .thing-box,
.bunch[data-n="2"] .thing-box,
.bunch[data-n="3"] .thing-box { width: 92px; height: 92px; }

.bunch[data-n="4"] .thing-box,
.bunch[data-n="5"] .thing-box { width: 64px; height: 64px; }

.frame { width: 100%; display: flex; flex-direction: column; gap: 4px; }

.ten {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 4px;
  background: white;
}

.slot {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.slot .thing-box { width: 88%; height: 88%; }

.extra .thing-box { width: 16%; height: auto; aspect-ratio: 1; }

.hand-photo {
  width: min(100%, 180px);
  height: 168px;
  object-fit: contain;
  object-position: center bottom;
  display: block;
}

.hands.is-pair .hand-photo { width: 48%; height: 132px; }

.die {
  width: min(42vw, 132px);
  height: min(42vw, 132px);
  margin: 6px auto 10px;
  position: relative;
  display: block;
  transform: perspective(420px) rotateX(16deg) rotateY(-18deg);
}

.die-face {
  position: absolute;
  inset: 0;
  border-radius: 22%;
  background: radial-gradient(120% 90% at 28% 18%, #fffefb 0%, #f3ecdf 46%, #e3d5c2 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -12px 18px rgba(90, 60, 30, 0.14),
    10px 18px 16px rgba(50, 32, 16, 0.2);
}

.die-side {
  position: absolute;
  left: 12%;
  right: 8%;
  top: 88%;
  height: 18%;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(#d7c6b0, #a89278);
  transform: skewX(-16deg);
  z-index: -1;
}

.pip3 {
  position: absolute;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 32%, #6a5648, #1a120e 72%);
  box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.28), 0 1px 0 rgba(255, 255, 255, 0.45);
}

.swatch, .dot {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  font-size: 1.8rem;
  font-weight: 700;
  box-shadow: 0 5px 0 rgba(70, 42, 16, 0.16);
  border: 3px solid white;
}

.fill {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px dashed #b7a794;
  background: transparent;
}

.fill.is-full { border-style: solid; border-color: white; }

.fill.is-now { border-color: var(--ink); }

.board {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dot {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
}

.num.is-now, .swatch.is-now { box-shadow: 0 0 0 4px var(--ink); }

.num.is-done { opacity: 0.45; }

.dot.is-done { outline: 4px solid var(--ink); }

.is-live { outline: 4px solid var(--ink); }

.is-good { outline: 4px solid var(--good); }

.is-hint { animation: pulse 0.9s ease-in-out infinite; }

.is-bad { animation: shake 0.32s linear; outline: 3px solid var(--bad); }

.stage.is-good { outline: 4px solid var(--good); outline-offset: 8px; border-radius: 28px; }

.veil {
  position: fixed;
  inset: 0;
  background: rgba(42, 33, 24, 0.38);
  display: grid;
  place-items: center;
  z-index: 5;
  padding: 18px;
}

.ask {
  background: var(--paper);
  border-radius: 28px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(360px, 100%);
}

.ask p {
  margin: 0 0 6px;
  font-size: 1.7rem;
  font-weight: 700;
}

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes shake {
  0%, 100% { translate: 0 0; }
  25% { translate: -8px 0; }
  75% { translate: 8px 0; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 87, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(255, 200, 87, 0.95); }
}

@media (max-width: 640px) {
  .choice { min-height: 132px; padding: 8px 4px; }
  .dot { width: 54px; height: 54px; }
  .swatch { width: 64px; height: 64px; }
  .stage { padding-left: 10px; padding-right: 10px; }
  .seq { gap: 6px; }
  .seq .num,
  .seq .num.prompt,
  .blank {
    min-width: 58px;
    min-height: 58px;
    width: 58px;
    font-size: 1.7rem;
    border-radius: 18px;
    padding: 0;
  }
  .arrow { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .samy.is-hop, .is-hint, .is-bad { animation: none; }
  .is-bad { outline: 3px solid var(--bad); }
  .is-hint { box-shadow: 0 0 0 6px var(--sun); }
}
