/* Yahtzee-only styles (loaded after shared/style.css). */

/* ---- no layout jiggle: fixed-height status + equal fixed-height rows ---- */
.yz .statusbar { height: 2.55em; overflow: hidden; }
.yz .statusbar .sub { height: 1.3em; }
.yz-card { position: relative; }
table.score { height: auto; }
.score tbody th, .score tbody td { height: var(--rh, 24px); padding-top: 0; padding-bottom: 0; }
.opt { height: calc(min(var(--rh, 24px), 30px) - 5px); line-height: 1; padding: 0 .2em; vertical-align: middle; }

/* ---- dice ---- */
.dice { --d: clamp(42px, min(15.5vw, 8.2dvh), 64px); perspective: 520px; padding-top: 10px; overflow: visible; }
.dslot { position: relative; width: var(--d); height: calc(var(--d) + 20px); display: flex; flex-direction: column; align-items: center; flex: none;
  --dur: calc(640ms + var(--k, 0) * 85ms); }
.dslot .die { position: relative; z-index: 1; flex: none;
  transition: transform .22s cubic-bezier(.3, 1.5, .5, 1), background .2s, border-color .2s, box-shadow .2s; }
.dslot .die.tappable:active { transform: scale(.94); }
.dshadow { position: absolute; left: 8%; right: 8%; top: calc(var(--d) - 3px); height: 9px; border-radius: 50%;
  background: radial-gradient(closest-side, #000b, transparent); transition: transform .22s, opacity .22s; }

/* held: lifted, blue, locked, labeled */
.dslot.held .die { transform: translateY(-11px); background: linear-gradient(145deg, #eef6ff, #b9d9ff); border-color: var(--held);
  box-shadow: 0 4px 0 #2b6fc0, 0 0 18px #4da3ffb0; }
.dslot.held .dshadow { transform: scale(.7); opacity: .45; }
.lock { position: absolute; top: -9px; right: -9px; width: 21px; height: 21px; border-radius: 50%; background: var(--held);
  display: grid; place-items: center; font-size: 10px; box-shadow: 0 2px 4px #0007; border: 2px solid #fff;
  transform: scale(0); transition: transform .22s cubic-bezier(.3, 1.8, .5, 1); }
.dslot.held .lock { transform: scale(1); }
.htag { margin-top: auto; font-size: .58rem; font-weight: 800; letter-spacing: .09em; color: #fff; background: var(--held);
  border-radius: 6px; padding: 1px 6px; opacity: 0; transform: translateY(5px); transition: opacity .2s, transform .2s; }
.dslot.held .htag { opacity: 1; transform: none; }

/* roll: toss up, tumble in 3D, land with a squash */
.dslot.rolling .die { animation: toss var(--dur) cubic-bezier(.25, .6, .35, 1) both; }
.dslot.rolling .dshadow { animation: tshadow var(--dur) ease-in-out both; }
@keyframes toss {
  0%   { transform: translateY(0) rotateX(0) rotateZ(0); }
  20%  { transform: translateY(-58px) rotateX(170deg) rotateZ(-70deg) scale(1.08); }
  42%  { transform: translateY(-72px) rotateX(340deg) rotateZ(-150deg) scale(1.1); }
  70%  { transform: translateY(-6px) rotateX(560deg) rotateZ(-260deg); }
  82%  { transform: translateY(0) rotateX(700deg) rotateZ(-340deg) scale(1.08, .88); }
  92%  { transform: translateY(-7px) rotateX(720deg) rotateZ(-356deg); }
  100% { transform: translateY(0) rotateX(720deg) rotateZ(-360deg); } }
@keyframes tshadow { 42% { transform: scale(.4); opacity: .3; } 82% { transform: scale(1.15); opacity: 1; } }
.dslot.land .die { animation: settle .3s ease-out; }
@keyframes settle { 0% { transform: scale(1.12, .86); } 60% { transform: scale(.96, 1.04); } 100% { transform: none; } }

/* ---- Yahtzee celebration ---- */
.dice.yahtzee .die { background: linear-gradient(145deg, #fff8d6, #ffd36b); border-color: var(--accent);
  box-shadow: 0 4px 0 #b9801a, 0 0 22px #ffc145; animation: yzdance .42s ease-in-out 5 alternate; }
.dice.yahtzee .dslot:nth-child(2) .die { animation-delay: .07s; }
.dice.yahtzee .dslot:nth-child(3) .die { animation-delay: .14s; }
.dice.yahtzee .dslot:nth-child(4) .die { animation-delay: .21s; }
.dice.yahtzee .dslot:nth-child(5) .die { animation-delay: .28s; }
@keyframes yzdance { from { transform: translateY(0) rotate(-7deg); } to { transform: translateY(-18px) rotate(7deg); } }
.yz-celebrate { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #ffc14548, transparent 60%); animation: fade .25s; }
.yz-celebrate .rays { position: absolute; width: 160vmax; height: 160vmax; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(#ffc14530 0 9deg, transparent 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 40%); mask-image: radial-gradient(circle, #000 0, transparent 40%);
  animation: rays 7s linear infinite; }
@keyframes rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.yz-celebrate .word { position: absolute; top: 32%; left: 0; right: 0; text-align: center; font-family: var(--fun); font-weight: 700;
  font-size: clamp(3rem, 17vw, 5.2rem); color: var(--accent); letter-spacing: .02em;
  text-shadow: 0 5px 0 #b9801a, 0 0 34px #ffc145, 0 10px 24px #000; animation: yzword .7s cubic-bezier(.3, 1.6, .5, 1) both; }
.yz-celebrate .who { position: absolute; top: calc(32% + clamp(3.6rem, 19vw, 6rem)); left: 0; right: 0; text-align: center;
  font-family: var(--fun); font-size: 1.15rem; color: #fff; text-shadow: 0 2px 6px #000; animation: yzword .6s .2s both; }
.yz-celebrate .who b { color: var(--good); }
@keyframes yzword { from { transform: scale(.2) rotate(-12deg); opacity: 0; } }
.yz-celebrate.bye { animation: yzbye .5s forwards; }
@keyframes yzbye { to { opacity: 0; } }

/* ---- emotes ---- */
th.mecol { cursor: pointer; }
th.mecol small { opacity: .9; }
.emote-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.emote { position: absolute; top: 4px; font-size: 2.3rem; line-height: 1; filter: drop-shadow(0 3px 6px #000a);
  animation: emote 3s ease-out both; }
@keyframes emote {
  0%   { transform: translate(-50%, 10px) scale(.2); opacity: 0; }
  12%  { transform: translate(-50%, 0) scale(1.3); opacity: 1; }
  22%  { transform: translate(-50%, 0) scale(1) rotate(-6deg); }
  32%  { transform: translate(-50%, 4px) rotate(6deg); }
  80%  { transform: translate(-50%, 46px) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, 76px) scale(.9); opacity: 0; } }
.emote-picker { position: absolute; z-index: 6; left: 6px; right: 6px; top: 46px; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 4px; padding: 8px; background: #2e2548f2; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px #000a;
  animation: up .18s ease-out; }
.emote-picker[hidden] { display: none; }
.emote-picker button { font-size: 1.6rem; width: 46px; height: 46px; padding: 0; border-radius: 12px; background: #ffffff10; border: none; }
