.fd {
  --on: #d9de3c;
  --on-lo: #c3c82e;
  --off: #222421;
  --off-lo: #191a18;
  --well: #070807;
  --board: #0d0e0d;
  /* a disc face: pivot notches on the diagonal, a soft rim, matte paint */
  --notch:
    radial-gradient(circle at 14.6% 14.6%, var(--well) 0 1px, #0000 1.4px),
    radial-gradient(circle at 85.4% 85.4%, var(--well) 0 1px, #0000 1.4px),
    radial-gradient(circle at 50% 50%, #0000 0 2.6px, #0000001c 3.4px);
  --face-off: var(--notch), linear-gradient(135deg, var(--off), var(--off-lo));
  --face-on: var(--notch), linear-gradient(135deg, var(--on), var(--on-lo));
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: var(--board);
  user-select: none;
}

.fd * { box-sizing: border-box; }

/* the resting discs: one 8px cell, repeated across the whole board */
.fd-board {
  position: absolute;
  inset: 2px;
  background:
    radial-gradient(circle at 19% 19%, var(--board) 0 1px, #0000 1.4px),
    radial-gradient(circle at 81% 81%, var(--board) 0 1px, #0000 1.4px),
    radial-gradient(circle at 50% 50%, #0000 0 3.3px, var(--board) 3.7px),
    radial-gradient(circle at 50% 50%, #0000 0 2.6px, #0000001c 3.4px),
    linear-gradient(135deg, var(--off), var(--off-lo));
  background-size: 8px 8px;
}

/* daylight falling across the board from the top left */
.fd::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(158deg, #ffffff0b, #0000 42%, #00000038);
  pointer-events: none;
}

.fd-stars {
  position: absolute;
  left: 10px;
  top: 162px;
  display: flex;
}

.fd-star {
  position: relative;
  display: block;
  width: 104px;
  height: 120px;
}

.fd-star [data-slot="rating-radio"] { outline: none; cursor: default; }

/* keyboard focus underlines the star with a row of discs */
.fd-star:has(:focus-visible)::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 112px;
  width: 88px;
  height: 8px;
  background: radial-gradient(circle at 50% 50%, var(--on) 0 3.3px, #0000 3.7px) 0 0 / 8px 8px;
}

.fd-shape {
  position: absolute;
  left: 8px;
  top: 16px;
  width: 88px;
  height: 88px;
  pointer-events: none;
}

.fd-score {
  position: absolute;
  left: 202px;
  top: 306px;
  width: 136px;
  height: 56px;
}

/* one disc in its well; the two faces turn about the pivot diagonal */
.fd-d {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle at 50% 50%, var(--well) 0 3.2px, var(--board) 3.6px);
}

.fd-d::before,
.fd-d::after {
  content: "";
  position: absolute;
  inset: 0.5px;
  border-radius: 50%;
  backface-visibility: hidden;
  transition: transform 70ms cubic-bezier(0.4, 0, 0.7, 1) var(--k, 0ms);
}

.fd-d::before {
  background: var(--face-off);
  transform: rotate3d(1, 1, 0, 0deg);
}

.fd-d::after {
  background: var(--face-on);
  transform: rotate3d(1, 1, 0, -180deg);
}

.fd-d.fd-on::before,
.fd-star[data-filled] .fd-in::before { transform: rotate3d(1, 1, 0, 180deg); }

.fd-d.fd-on::after,
.fd-star[data-filled] .fd-in::after { transform: rotate3d(1, 1, 0, 0deg); }
