/* Candy Land — a light, sugary retheme of the shared tokens, plus board and HUD. */

:root {
  color-scheme: light;

  --bg: #fff4f9;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #fff3f8;
  --panel-3: #ffe3ef;
  --line: rgb(122 46 87 / 0.12);
  --line-strong: rgb(122 46 87 / 0.22);
  --text: #3d1a35;
  --muted: #8d6583;

  --primary: #ff4f9a;
  --primary-hover: #ff6aab;
  --primary-ink: #ffffff;
  --speed-bolt: #f59f00;

  --font: 'Fredoka', 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --sprinkles:
    radial-gradient(circle at 20% 30%, #ff8fc7 0 2px, transparent 2.5px),
    radial-gradient(circle at 70% 60%, #8ad3ff 0 2px, transparent 2.5px),
    radial-gradient(circle at 40% 80%, #ffd23f 0 2px, transparent 2.5px),
    radial-gradient(circle at 85% 15%, #a8e6b8 0 2px, transparent 2.5px);
}

.sprites {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.overlay {
  background: rgb(92 24 66 / 0.32);
}

.panel {
  box-shadow: 0 24px 70px rgb(122 46 87 / 0.25);
}

.brand,
.topbar-brand .bolt {
  color: #f59f00;
}

.eyebrow,
.field-label {
  font-weight: 600;
}

/* ---------- Setup ---------- */

.setup {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--sprinkles), linear-gradient(160deg, #ffe0ef, #e3f6ff 55%, #e6fbe9);
  background-size: 90px 90px, 90px 90px, 90px 90px, 90px 90px, auto;
}

.setup-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 560px);
}

.setup-title {
  margin: 4px 0 0;
  font-size: clamp(2.8rem, 12vw, 4.4rem);
  font-weight: 700;
  line-height: 0.95;
  text-align: center;
  letter-spacing: 0.01em;
}

.setup-title span {
  display: inline-block;
  color: var(--letter);
  text-shadow: 0 3px 0 color-mix(in srgb, var(--letter) 55%, #3d1a35);
  transform: rotate(var(--tilt, 0deg));
}

.setup-lede {
  margin: -8px 0 0;
  color: var(--muted);
  text-align: center;
}

.step {
  display: grid;
  gap: 8px;
}

.step .field-label {
  margin: 0;
}

.count-switch {
  justify-self: start;
}

.count-switch button {
  min-width: 3.2em;
  font-size: 1rem;
}

.player-rows {
  display: grid;
  gap: 10px;
}

.player-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.row-pawn {
  width: 40px;
  height: 40px;
  color: var(--pawn);
}

.player-row .input {
  padding: 0.6em 0.85em;
  font-size: 1rem;
}

.swatches {
  display: flex;
  gap: 5px;
}

.swatch {
  appearance: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch[aria-checked='true'] {
  box-shadow: 0 0 0 2.5px var(--swatch);
  transform: scale(1.12);
}

/* ---------- Game screen ---------- */

.topbar {
  background: rgb(255 255 255 / 0.92);
}

.topbar-brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 3px 10px 5px 4px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.chip-pawn {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--pawn);
}

.chip-name {
  max-width: 10ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-stuck {
  color: #2b1b24;
  font-size: 0.72rem;
  font-weight: 600;
}

/* How far along the path, as a thin bar along the chip's bottom edge. */
.chip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(var(--progress, 0) * 100%);
  height: 3px;
  background: var(--pawn);
  transition: width 0.3s var(--ease-out);
}

.chip.active {
  border-color: var(--pawn);
  background: color-mix(in srgb, var(--pawn) 12%, #fff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pawn) 25%, transparent);
}

.chip.winner {
  border-color: var(--pawn);
  background: color-mix(in srgb, var(--pawn) 22%, #fff);
}

.topbar .stats {
  margin: 0;
}

.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--sprinkles), radial-gradient(120% 100% at 50% 40%, #f2fff6, #d7f3e3);
  background-size: 110px 110px, 110px 110px, 110px 110px, 110px 110px, auto;
}

.board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.road-edge {
  fill: none;
  stroke: #f3cf9e;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.road {
  fill: none;
  stroke: #fff6e6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tiles {
  filter: drop-shadow(0 2px 0 rgb(80 30 60 / 0.2));
}

.bridge {
  fill: none;
  stroke-linecap: round;
}

.bridge-label {
  fill: #7a2e57;
  font-family: var(--font);
  font-weight: 600;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.start-label {
  fill: #7a2e57;
  font-family: var(--font);
  font-weight: 700;
}

.pawn-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.pawn.active .pawn-body {
  filter: drop-shadow(0 0 4px rgb(255 255 255 / 0.95));
}

/* ---------- HUD: the drawn card, in the clearing at the middle of the spiral ---------- */

.hud {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
}

.hud.wide {
  flex-direction: row;
  gap: clamp(14px, 3vw, 32px);
  text-align: left;
}

/* Backed, so the text stays readable when a shortcut arc runs behind it. */
.hud-text {
  min-width: 0;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgb(255 255 255 / 0.86);
  box-shadow: 0 4px 14px rgb(122 46 87 / 0.1);
}

.hud-turn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.15;
}

.hud:not(.wide) .hud-turn {
  justify-content: center;
}

.hud-turn svg {
  width: 1.5em;
  height: 1.5em;
  flex: none;
  color: var(--pawn);
}

.hud-note {
  margin: 2px 0 0;
  min-height: 1.3em;
  color: var(--text);
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  font-weight: 500;
}

.hud-deck {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.cl-card {
  --card-h: 160px;
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  align-content: center;
  gap: calc(var(--card-h) * 0.05);
  width: calc(var(--card-h) * 0.72);
  height: var(--card-h);
  border: calc(var(--card-h) * 0.035) solid #fff;
  border-radius: calc(var(--card-h) * 0.08);
  background: #fffaf2;
  box-shadow: 0 0 0 1.5px #f6c1d9, 0 10px 26px rgb(122 46 87 / 0.25);
}

.cl-card.empty {
  background:
    repeating-linear-gradient(45deg, #ff9fc9 0 8px, #ffc8df 8px 16px);
}

.block {
  width: calc(var(--card-h) * 0.42);
  height: calc(var(--card-h) * 0.3);
  border-radius: calc(var(--card-h) * 0.05);
  background: var(--block);
  box-shadow: inset 0 calc(var(--card-h) * -0.025) 0 rgb(0 0 0 / 0.15), inset 0 calc(var(--card-h) * 0.02) 0 rgb(255 255 255 / 0.35);
}

.cl-card.single .block {
  height: calc(var(--card-h) * 0.42);
}

.cl-card.picture .block {
  display: grid;
  place-items: center;
  width: calc(var(--card-h) * 0.5);
  height: calc(var(--card-h) * 0.5);
  background: #ff8fc7;
}

.cl-card.picture .block svg {
  width: 80%;
  height: 80%;
}

.cl-card .card-caption {
  font-size: calc(var(--card-h) * 0.085);
  font-weight: 600;
  line-height: 1.1;
}

.cl-card.stuck svg {
  width: 55%;
  height: 40%;
}

/* ---------- Result ---------- */

.result-art {
  position: relative;
  width: 120px;
  height: 92px;
  margin: -6px auto 6px;
}

.result-castle {
  position: absolute;
  left: 18px;
  width: 84px;
  height: 84px;
}

.result-pawn {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 46px;
  height: 46px;
  color: var(--pawn);
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .roster {
    order: 4;
    flex-basis: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    margin: 0;
    overflow-x: auto;
  }

  .topbar .stats {
    display: none;
  }

  .chip {
    font-size: 0.78rem;
  }

  .chip-name {
    max-width: 7ch;
  }

  .player-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .row-pawn {
    width: 34px;
    height: 34px;
  }

  .swatches {
    grid-column: 2;
    flex-wrap: wrap;
  }
}
