/* Yatzy page – the game box is css/game-stage.css, the look shared with the other robot games (names at the top,
   bubbles, menus, big text, back button) css/holo-games.css. The dice are drawn on the canvas; the card and the
   "Kasta" button are HTML, placed by yatzy.js layout() through the variables --card-* and --roll-*. */

/* Held upright: a taller box, the dice on top and the card under them (a phone's box is taller still – the card
   needs its 19 rows) */
@media (max-aspect-ratio: 1/1) {
  .stage {
    --aspect: 3 / 4;
  }
}

@media (max-aspect-ratio: 1/1) and (max-width: 600px) {
  .stage {
    --aspect: 9 / 16;
  }
}

/* A side's total, in the name box (it pops a little when it changes) */
.yz-total {
  flex: none;
  min-width: 2em;
  margin-left: 0.15rem;
  padding: 0 0.3em;
  font-style: normal;
  font-weight: 900;
  text-align: center;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 233, 77, 0.6);
  background: rgba(255, 255, 255, 0.06);
}

.yz-total.pop {
  animation: yz-pop 0.3s ease-out;
}

@keyframes yz-pop {
  from { transform: scale(1.4); }
  to { transform: scale(1); }
}

/* ---------- The card ---------- */

.yz-card {
  position: absolute;
  left: var(--card-x, 1rem);
  top: var(--card-y, 4rem);
  width: var(--card-w, 18rem);
  height: var(--card-h, 20rem);
  font-size: var(--card-font, 0.9rem);
  padding: 0.25em 0.4em;
  background: linear-gradient(rgba(94, 240, 255, 0.1), rgba(94, 240, 255, 0.04));
  border: 2px solid rgba(94, 240, 255, 0.55);
  box-shadow: 0 0 14px rgba(94, 240, 255, 0.25), inset 0 0 18px rgba(94, 240, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 0.8rem) 0, 100% 0.8rem, 100% 100%, 0.8rem 100%, 0 calc(100% - 0.8rem));
  box-sizing: border-box;
}

.yz-card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.yz-card th,
.yz-card td {
  height: var(--card-row, 1.4em);              /* every row the same height (yatzy.js layout) */
  padding: 0 0.35em;
  line-height: 1;
  white-space: nowrap;
}


.yz-card th:first-child {
  width: 54%;
}

.yz-card .yz-col-1,
.yz-card .yz-col-2 {
  text-align: center;
}

.yz-card thead .holo-dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
}

/* A row: a small picture (dice for Ettor … Sexor), the box's name, and each player's number */
.yz-row td {
  border-top: 1px solid rgba(94, 240, 255, 0.12);
}

.yz-label {
  display: flex;
  align-items: center;
  gap: 0.4em;
  overflow: hidden;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
  text-overflow: ellipsis;
}

.yz-label svg {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

/* A WRITTEN number is strong cyan (owner, 2026-11-12): it is locked in. What a box WOULD give is a medium yellow,
   and a box that would give 0 a weak magenta – so the three never look alike. */
.yz-cell {
  text-align: center;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(94, 240, 255, 0.55);
}

/* The column of the player whose turn it is glows a little */
.yz-card.turn-1 .yz-col-1,
.yz-card.turn-2 .yz-col-2 {
  background: rgba(94, 240, 255, 0.07);
}

/* What you would get: a faint yellow number in every open box once the dice are thrown (show, don't tell) */
.yz-cell.is-offer {
  color: rgba(255, 233, 77, 0.62);
  font-weight: 700;
  text-shadow: none;
  cursor: pointer;
}

.yz-cell.is-offer.is-zero {
  color: rgba(255, 63, 180, 0.42);
}

/* After the last throw the offers breathe: write somewhere now */
.yz-card.must-write .yz-cell.is-offer {
  animation: yz-breathe 1.4s ease-in-out infinite;
}

@keyframes yz-breathe {
  50% { text-shadow: 0 0 10px rgba(255, 233, 77, 0.9); }
}

/* The row you point at (mouse, finger's first tap or the arrow keys): a strong magenta frame, like the board games */
.yz-row.is-chosen td {
  background: rgba(255, 63, 180, 0.16);
  box-shadow: inset 0 2px 0 var(--magenta), inset 0 -2px 0 var(--magenta);
}

.yz-row.is-chosen .yz-cell.is-offer {
  color: var(--yellow);
  font-size: 1.15em;
  text-shadow: 0 0 10px rgba(255, 233, 77, 0.8);
}

.yz-row.is-chosen .yz-cell.is-offer.is-zero {
  color: var(--magenta);
}

/* A number just written pops in */
.yz-cell.is-new {
  animation: yz-written 0.6s ease-out;
}

@keyframes yz-written {
  0% { transform: scale(1.9); text-shadow: 0 0 16px #fff; }
  100% { transform: scale(1); }
}

/* A crossed-out box (written with 0) */
.yz-cell.is-crossed {
  color: rgba(94, 240, 255, 0.45);
  text-shadow: none;
}

/* The sum, bonus and total rows */
.yz-sum td {
  border-top: 2px solid rgba(94, 240, 255, 0.45);
  color: var(--text-muted);
  font-weight: 700;
  text-shadow: none;
}

.yz-sum .yz-label {
  color: var(--text-muted);
}

.yz-sum .yz-cell small {
  font-size: 0.7em;
  opacity: 0.7;
}

.yz-cell.has-bonus {
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 233, 77, 0.7);
}

.yz-total-row td {
  border-top: 2px solid var(--cyan);
  font-size: 1.1em;
  color: var(--yellow);
}

/* ---------- "Kasta" ---------- */

.yz-roll {
  position: absolute;
  left: var(--roll-x, 50%);
  top: var(--roll-y, 70%);
  width: var(--roll-w, 12rem);
  translate: -50% 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  font-size: var(--roll-font, 1.2rem);
  padding: 0.45em 1em;
}

.yz-roll.is-ready {
  animation: yz-ready 1.6s ease-in-out infinite;
}

@keyframes yz-ready {
  50% { filter: brightness(1.35); box-shadow: 0 0 22px rgba(94, 240, 255, 0.8); }
}

.yz-roll:disabled {
  opacity: 0.35;
  animation: none;
}

/* Three lamps: the throws left this turn */
.yz-lamps {
  display: inline-flex;
  gap: 0.25em;
}

.yz-lamps i {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.35;
}

.yz-lamps i.is-on {
  background: currentColor;
  opacity: 1;
  box-shadow: 0 0 8px currentColor;
}
