/* =============================================================
   GAME: Yacht Dice
   ============================================================= */
.board-yacht {
  --yt-glow: #ff8f6b;
  --die: min(calc((100vw - 124px) / 5), 64px);
  width: min(calc(100vw - 44px), 520px);
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
}
.yt-top {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 10px 10px; border-radius: 16px; background: radial-gradient(ellipse at 50% 30%, #3a1430, #170818 75%);
  box-shadow: 0 0 0 2px var(--yt-glow), 0 0 26px rgba(255, 143, 107, .35);
}
.yt-dice { display: flex; justify-content: center; gap: 8px; }
.yt-die {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.yt-die:disabled { cursor: default; }
/* each die: a slot on the felt holding a 3D cube */
.yt-face {
  --c: calc(var(--die) * .66);
  position: relative; width: var(--die); height: var(--die); display: grid; place-items: center;
  border-radius: calc(var(--die) * .22); perspective: calc(var(--die) * 5);
  transition: transform .18s, box-shadow .18s, background .18s;
}
/* contact shadow on the felt */
.yt-face::before {
  content: ""; position: absolute; left: 14%; right: 14%; bottom: 2%; height: 22%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); transition: transform .18s, opacity .18s;
}
.yt-cube {
  position: relative; width: var(--c); height: var(--c); transform-style: preserve-3d;
  transition: transform .72s cubic-bezier(.2, .75, .3, 1.06), opacity .2s;
  transition-delay: calc(var(--k, 0) * 25ms);
}
.yt-die.instant .yt-cube { transition: none; }
.yt-side {
  position: absolute; inset: 0; padding: 15%; border-radius: 19%; backface-visibility: hidden;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center;
  background: radial-gradient(circle at 30% 25%, #fff, #f1edfb 55%, #d3cbe9);
  box-shadow: inset 0 0 0 1px rgba(40, 20, 80, .18), inset -2px -3px 5px rgba(60, 40, 110, .25), inset 2px 2px 4px #fff;
  transition: background .18s;
}
.yt-side.f1 { transform: translateZ(calc(var(--c) / 2)); }
.yt-side.f6 { transform: rotateY(180deg) translateZ(calc(var(--c) / 2)); }
.yt-side.f3 { transform: rotateY(90deg) translateZ(calc(var(--c) / 2)); }
.yt-side.f4 { transform: rotateY(-90deg) translateZ(calc(var(--c) / 2)); }
.yt-side.f2 { transform: rotateX(90deg) translateZ(calc(var(--c) / 2)); }
.yt-side.f5 { transform: rotateX(-90deg) translateZ(calc(var(--c) / 2)); }
.yt-side i { width: 74%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #4a3f7a, #120a26 70%); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .8); }
.yt-side.f1 i { width: 92%; background: radial-gradient(circle at 40% 35%, #ffa98c, #c2401a 70%); }
/* no value yet: an empty dashed slot */
.yt-die.blank .yt-face { box-shadow: inset 0 0 0 2px rgba(255, 143, 107, .3); background: rgba(42, 28, 64, .6); }
.yt-die.blank .yt-face::before { opacity: 0; }
.yt-die.blank .yt-cube { opacity: 0; }
.yt-die:not(:disabled):hover .yt-face { background: rgba(255, 143, 107, .12); }
.yt-die:focus-visible { outline: none; }
.yt-die:focus-visible .yt-face { outline: 3px solid var(--focus); outline-offset: 3px; }
/* held: lifted off the felt onto a glowing pad, faces warmed */
.yt-die.on .yt-face {
  transform: translateY(-5px); background: radial-gradient(closest-side, rgba(255, 143, 107, .4), rgba(255, 143, 107, .1));
  box-shadow: 0 0 0 2px var(--yt-glow), 0 0 16px rgba(255, 143, 107, .65);
}
.yt-die.on .yt-face::before { transform: translateY(5px) scale(.8); opacity: .5; }
.yt-die.on .yt-side { background: radial-gradient(circle at 30% 25%, #fff6f1, #ffe1d4 55%, #f3b9a3); }
.yt-held { font: 800 .68rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--yt-glow); visibility: hidden; }
.yt-die.on .yt-held { visibility: visible; }
/* rolling: tossed up and tumbling down (staggered per die) */
.yt-die.rolling .yt-face { animation: yt-toss .72s ease-out both; animation-delay: calc(var(--k, 0) * 25ms); }
@keyframes yt-toss {
  0% { transform: translateY(0); }
  30% { transform: translateY(-16px); }
  65% { transform: translateY(1px); }
  80% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}
.yt-rollrow { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.yt-roll { min-width: 150px; font-size: 1.05rem; }
.yt-left { color: var(--muted); font-weight: 700; font-size: .9rem; }
.yt-note { margin: 0; min-height: 1.4em; text-align: center; color: var(--muted); font-weight: 600; font-size: .9rem; }

/* score card */
.yt-card {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg); border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 143, 107, .55), 0 0 18px rgba(255, 143, 107, .18); font-variant-numeric: tabular-nums;
}
.yt-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.yt-card th, .yt-card td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.yt-card thead th { background: var(--surface-2); font: 800 .82rem var(--font-body); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; }
.yt-card thead th.cur { color: var(--ink); box-shadow: inset 0 -3px 0 var(--yt-glow); }
.yt-box { text-align: left; font-weight: 700; font-size: .92rem; line-height: 1.2; }
.yt-box small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.yt-pl { width: 27%; text-align: center; }
.yt-card thead .yt-pl.p1 { border-top: 3px solid var(--p1); }
.yt-card thead .yt-pl.p2 { border-top: 3px solid var(--p2); }
.yt-v { text-align: center; font-weight: 800; font-size: 1rem; height: 38px; }
.yt-v.cur { background: rgba(255, 143, 107, .07); }
.yt-v.zero { color: var(--muted); font-weight: 600; }
.yt-ghost { color: var(--muted); opacity: .55; font-weight: 600; }
.yt-pick {
  width: 100%; min-height: 32px; border: 0; border-radius: 8px; cursor: pointer; padding: 2px 4px;
  font: 800 1rem var(--font-body); color: #ffd2c2; background: rgba(255, 143, 107, .14); box-shadow: inset 0 0 0 1px rgba(255, 143, 107, .6);
}
.yt-pick:hover { background: rgba(255, 143, 107, .3); color: #fff; }
.yt-pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.yt-pick.zero { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.yt-v.just { animation: yt-flash 1s ease-out; }
@keyframes yt-flash { from { background: rgba(255, 143, 107, .55); } }
.yt-bonus th, .yt-bonus td { background: var(--surface); border-bottom: 2px solid rgba(255, 143, 107, .4); }
.yt-prog { color: var(--muted); font-weight: 600; font-size: .85rem; }
.yt-card tfoot th, .yt-card tfoot td { border-bottom: 0; background: var(--surface-2); font-size: 1.05rem; padding: 8px; }
.yt-total { color: #fff; }
@media (max-width: 480px) {
  .yt-box small { display: none; }
  .yt-card th, .yt-card td { padding: 3px 6px; }
  .yt-v { height: 36px; }
}
/* very small phones: a long "held" label (de, id) must not widen the die and push the row off-screen */
@media (max-width: 359px) {
  .board-yacht { --die: min(calc((100vw - 136px) / 5), 64px); }
  .yt-dice { gap: 12px; }
  .yt-die { width: var(--die); }
  .yt-held { display: flex; justify-content: center; width: 100%; font-size: .52rem; letter-spacing: 0; white-space: nowrap; }
}
