:root {
  color-scheme: dark;
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --line: #2e3048;
  --accent: #6842ff;
  --accent-2: #8f73ff;
  --text: #fff;
  --muted: #aaadbe;
  --pc: #6842ff;
  --die: 56px;
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-weight: 700;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
body {
  overflow-x: hidden;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
:focus-visible {
  outline: 3px solid #ffd35c;
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
kbd {
  font: inherit;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
}

.app {
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 10px;
}

/* ------------------------------------------------------------------ HUD */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: linear-gradient(180deg, #fff 30%, #c9bcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-die {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(145deg, #fff, #dcd6f2);
  box-shadow:
    inset 0 -3px 0 #b9b0dc,
    0 3px 8px rgba(0, 0, 0, 0.4);
  transform: rotate(-10deg);
}
.brand-die i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2a2350;
}
.brand-die i:nth-child(1) {
  left: 5px;
  top: 5px;
}
.brand-die i:nth-child(2) {
  right: 5px;
  top: 5px;
}
.brand-die i:nth-child(3) {
  left: 12px;
  top: 12px;
  background: #ff4f7b;
}
.brand-die i:nth-child(4) {
  left: 5px;
  bottom: 5px;
}
.brand-die i:nth-child(5) {
  right: 5px;
  bottom: 5px;
}
.chips {
  display: flex;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  line-height: 1.1;
}
.chip span {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}
.chip strong {
  font-size: 1.02rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.chip-score strong {
  color: #cdbfff;
}
.chip.bump strong {
  animation: bump 0.4s ease-out;
}
.hud-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--panel-2);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn .spk {
  fill: #fff;
}
.icon-btn .mute {
  display: none;
}
.icon-btn[aria-pressed="false"] .wave {
  display: none;
}
.icon-btn[aria-pressed="false"] .mute {
  display: inline;
  stroke: #ff6f8f;
}

/* ---------------------------------------------------------------- board */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  gap: 12px;
  align-items: start;
}
.play,
.card {
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.play {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.turn-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}
.turn-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pc) 28%, #1a1b28);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 70%, transparent);
  font-weight: 900;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
}
.turn-who b {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dot {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff8, transparent 45%), var(--pc);
  box-shadow: 0 0 10px var(--pc);
}
.turn-msg {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

/* tray */
.tray-wrap {
  perspective: 900px;
}
.tray {
  position: relative;
  height: clamp(190px, 44vh, 300px);
  border-radius: 20px;
  padding: 10px;
  background: linear-gradient(160deg, #3d2d74, #22184a);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -4px 0 rgba(0, 0, 0, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}
.tray.shake {
  animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.tray-felt {
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  background:
    radial-gradient(
      ellipse at 50% 40%,
      rgba(255, 255, 255, 0.14),
      transparent 60%
    ),
    repeating-radial-gradient(
      circle at 30% 30%,
      rgba(0, 0, 0, 0.05) 0 1px,
      transparent 1px 3px
    ),
    linear-gradient(180deg, #11a877, #077150);
  box-shadow:
    inset 0 8px 18px rgba(0, 0, 0, 0.45),
    inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
.tray-felt::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.12);
}
.tray-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 20px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: opacity 0.25s;
}
.tray-prompt b {
  color: #fff27a;
}
.tray-prompt.gone {
  opacity: 0;
}
.combo {
  position: absolute;
  left: 50%;
  top: 14%;
  z-index: 5;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 900;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffe26b, #ffae1f);
  color: #4a2600;
  box-shadow:
    0 4px 0 #c46d00,
    0 10px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.combo.show {
  animation: combo 1.6s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.dice {
  position: absolute;
  inset: 10px;
}

/* dice */
.die {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--die);
  height: var(--die);
  padding: 0;
  border: 0;
  background: none;
  border-radius: 16px;
  transform-style: preserve-3d;
  will-change: transform;
}
.die:disabled {
  cursor: default;
}
.die.hidden {
  opacity: 0;
  pointer-events: none;
}
.die-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -12%;
  height: 26%;
  border-radius: 50%;
  background: rgba(0, 20, 12, 0.55);
  filter: blur(4px);
}
.die-glow {
  position: absolute;
  inset: -10px;
  border-radius: 22px;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--pc) 85%, #fff 0%),
    transparent
  );
  opacity: 0;
  transition: opacity 0.2s;
}
.die.held .die-glow {
  opacity: 0.9;
  animation: glow 1.4s ease-in-out infinite;
}
.die-body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: translate 0.18s ease-out;
}
.die.held .die-body {
  translate: 0 -7px;
}
.cube {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.face,
.core {
  position: absolute;
  inset: 0;
  border-radius: 20%;
  backface-visibility: hidden;
}
.core {
  border-radius: 8%;
  background: #d9d3ef;
  backface-visibility: visible;
}
.face {
  background:
    radial-gradient(circle at 30% 22%, #fff 0 22%, transparent 60%),
    linear-gradient(145deg, #ffffff, #e4def7 70%, #cfc7ea);
  box-shadow:
    inset 0 -3px 5px rgba(80, 60, 150, 0.25),
    inset 0 2px 2px rgba(255, 255, 255, 0.9);
}
.die.held .face {
  box-shadow:
    inset 0 0 0 3px var(--pc),
    inset 0 -3px 5px rgba(80, 60, 150, 0.25);
}
.pip {
  position: absolute;
  width: 19%;
  height: 19%;
  margin: -9.5% 0 0 -9.5%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4b3f86, #1e1640 70%);
  box-shadow:
    inset 0 1px 1px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.8);
}
.face-1 .pip {
  width: 25%;
  height: 25%;
  margin: -12.5% 0 0 -12.5%;
  background: radial-gradient(circle at 40% 35%, #ff7d9c, #d1134a 70%);
}
.held-tag {
  position: absolute;
  left: 50%;
  bottom: -26px;
  transform: translateX(-50%) scale(0.6);
  opacity: 0;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--pc);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition:
    opacity 0.15s,
    transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
  pointer-events: none;
}
.die.held .held-tag {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* controls */
.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.rolls {
  display: flex;
  gap: 6px;
}
.rolls i {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(145deg, #fff, #cfc7ea);
  box-shadow: 0 2px 0 #8d84b8;
  transition:
    transform 0.25s,
    opacity 0.25s;
}
.rolls i.used {
  opacity: 0.18;
  transform: scale(0.75);
}
.keys {
  margin: 0;
  justify-self: end;
  color: var(--muted);
  font-size: 0.75rem;
}
.btn {
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 26px;
  font-weight: 900;
  font-size: 1.05rem;
  transition:
    transform 0.12s,
    filter 0.12s,
    opacity 0.2s;
}
.btn:active:not(:disabled) {
  transform: translateY(3px);
}
.btn-primary {
  background: linear-gradient(180deg, #8466ff, var(--accent));
  box-shadow:
    0 5px 0 #4424c4,
    0 10px 18px rgba(104, 66, 255, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:active:not(:disabled) {
  box-shadow:
    0 2px 0 #4424c4,
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
.btn-secondary {
  background: #2a2b3d;
  box-shadow:
    0 4px 0 #17182a,
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn:disabled {
  filter: grayscale(0.8) brightness(0.7);
}
.btn-roll {
  min-width: 170px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.25rem;
}
.btn-roll.pulse:not(:disabled) {
  animation: pulse 1.3s ease-in-out infinite;
}
.roll-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    radial-gradient(circle, #6842ff 0 2px, transparent 2.5px) 4px 4px / 7px 7px,
    #fff;
  transform: rotate(12deg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

/* -------------------------------------------------------------- scorecard */
.card {
  padding: 10px;
}
.card-head {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.pl {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 12px;
  background: #15162340;
  box-shadow: inset 0 0 0 2px transparent;
  transition:
    box-shadow 0.2s,
    background 0.2s;
}
.pl.active {
  background: color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--c);
}
.pl .dot {
  --pc: var(--c);
  width: 12px;
  height: 12px;
}
.pl-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
}
.pl.active .pl-name {
  color: #fff;
}
.pl-total {
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.pl-star {
  font-size: 0.7rem;
  color: #ffd35c;
}
.card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.half {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 0 4px 0 6px;
  border: 0;
  border-radius: 11px;
  background: #15162399;
  text-align: left;
  transition:
    background 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
.row:disabled {
  opacity: 1;
}
.row.can {
  background: #2a2b45;
  box-shadow: inset 0 0 0 1.5px #3d3f63;
}
.row.can:hover,
.row.can:focus-visible {
  background: #34366a;
}
.row.best {
  box-shadow:
    inset 0 0 0 2px #ffd35c,
    0 0 14px rgba(255, 211, 92, 0.35);
}
.row.zero .preview {
  color: #6f7190;
}
.row.ai-pick {
  background: color-mix(in srgb, var(--pc) 45%, #1a1b28);
  box-shadow: inset 0 0 0 2px var(--pc);
  transform: scale(1.03);
}
.row.flash {
  animation: rowflash 0.7s ease-out;
}
.row-ico {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 900;
  color: #2a2350;
  background: linear-gradient(145deg, #fff, #d6cff0);
  position: relative;
}
.row-ico.lower {
  color: #fff;
  background: linear-gradient(145deg, #8b72ff, #5534e0);
}
.mini-pip {
  position: absolute;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #2a2350;
}
.row-label {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-label .s {
  display: none;
}
.cells {
  display: flex;
  gap: 2px;
}
.cell {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.cell.mine {
  background: rgba(0, 0, 0, 0.18);
}
.cell.empty {
  color: #4a4c68;
}
.cell .preview {
  color: #ffe27a;
}
.cell.scored-zero {
  color: #75788f;
}
.cell.pop {
  animation: bump 0.45s ease-out;
}
.bonus-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 4px 0 6px;
  border-radius: 11px;
  background: linear-gradient(90deg, #2b2248, #1d1a33);
}
.bonus-row .row-label {
  font-size: 0.74rem;
  color: #d8ccff;
}
.bonus-cell {
  position: relative;
  width: 34px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 900;
  background: #11121d;
}
.bonus-cell .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #5a3cf0, #9d86ff);
  transition: width 0.5s ease-out;
}
.bonus-cell.got .fill {
  background: linear-gradient(90deg, #ffb31f, #ffe06b);
}
.bonus-cell.got {
  color: #4a2600;
}
.bonus-cell span {
  position: relative;
}

/* players >= 3: compact labels */
.card[data-players="3"] .row-label .l,
.card[data-players="4"] .row-label .l {
  display: none;
}
.card[data-players="3"] .row-label .s,
.card[data-players="4"] .row-label .s {
  display: inline;
}
.card[data-players="3"] .cell,
.card[data-players="4"] .cell,
.card[data-players="3"] .bonus-cell,
.card[data-players="4"] .bonus-cell {
  width: 30px;
  font-size: 0.8rem;
}

/* -------------------------------------------------------------- overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 10px;
  background: rgba(10, 10, 24, 0.72);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 100vmax rgba(10, 10, 24, 0.72);
  animation: fade 0.25s ease-out;
}
.overlay[hidden] {
  display: none;
}
.panel {
  width: min(460px, 100%);
  padding: 20px 20px 18px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(180deg, #26274a, #1a1b28);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px #34365a;
  animation: popin 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.logo {
  position: relative;
  height: 118px;
  display: grid;
  place-items: center;
}
.logo-text {
  position: relative;
  z-index: 2;
  font-size: 2.9rem;
  line-height: 0.88;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow:
    0 3px 0 #b8a8ff,
    0 6px 0 #5534e0,
    0 12px 18px rgba(0, 0, 0, 0.5);
  transform: rotate(-3deg);
}
.logo-text em {
  font-style: normal;
  color: #ffe06b;
  text-shadow:
    0 3px 0 #ffae1f,
    0 6px 0 #b85b00,
    0 12px 18px rgba(0, 0, 0, 0.5);
}
.logo-die {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 15px;
  background:
    radial-gradient(circle, #2a2350 0 5px, transparent 5.5px) 50% 50% / 100%
      100% no-repeat,
    linear-gradient(145deg, #fff, #d6cff0);
  box-shadow:
    inset 0 -5px 0 #b0a6d6,
    0 10px 20px rgba(0, 0, 0, 0.45);
  animation: floaty 3s ease-in-out infinite;
}
.ld1 {
  left: 12%;
  top: 22px;
  transform: rotate(-18deg);
  background:
    radial-gradient(circle, #2a2350 0 5px, transparent 5.5px) 14px 14px / 28px
      28px,
    linear-gradient(145deg, #fff, #d6cff0);
}
.ld2 {
  right: 12%;
  top: 40px;
  transform: rotate(16deg);
  animation-delay: -1.5s;
  background:
    radial-gradient(circle, #d1134a 0 7px, transparent 7.5px) 50% 50% / 100%
      100% no-repeat,
    linear-gradient(145deg, #fff, #d6cff0);
}
.tagline {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}
.seg,
.sub {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #11121d;
  margin: 0 auto 8px;
}
.seg button,
.sub button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.88rem;
  padding: 0 6px;
  white-space: nowrap;
}
.seg button[aria-pressed="true"] {
  background: linear-gradient(180deg, #8466ff, var(--accent));
  color: #fff;
  box-shadow: 0 3px 0 #4424c4;
}
.sub {
  width: 88%;
}
.sub button[aria-pressed="true"] {
  background: #2f3150;
  color: #fff;
  box-shadow: inset 0 0 0 2px #8f73ff;
}
.sub[hidden] {
  display: none;
}
.sub-note {
  min-height: 1.2em;
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}
.btn-big {
  min-width: 220px;
  min-height: 58px;
  font-size: 1.35rem;
}
#play-btn {
  animation: pulse 1.6s ease-in-out infinite;
}
.record {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 18px;
}
.stat {
  padding: 7px 4px;
  border-radius: 14px;
  background: #11121d;
}
.stat b {
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
}
.stat span {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.trophies {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}
.trophy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #11121d;
  color: #5d6080;
}
.trophy i {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-style: normal;
  font-size: 0.66rem;
  background: #24253a;
}
.trophy.on {
  color: #fff;
  background: linear-gradient(90deg, #3b2a0c, #1d1a2e);
}
.trophy.on i {
  background: linear-gradient(180deg, #ffe06b, #ffae1f);
  color: #5a3000;
}
.end-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}
.end-panel h2 {
  margin: 4px 0 0;
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffe06b;
  text-shadow:
    0 3px 0 #b85b00,
    0 8px 16px rgba(0, 0, 0, 0.4);
}
.end-score {
  margin: 4px 0;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}
.end-score small {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.new-best {
  display: inline-block;
  margin: 6px 0 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff7d9c, #e0245e);
  font-weight: 900;
  animation: bump 0.8s ease-out infinite alternate;
}
.new-best[hidden] {
  display: none;
}
.standings {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.standings li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 14px;
  background: #11121d;
  font-weight: 900;
}
.standings li:first-child {
  background: linear-gradient(90deg, #4a3510, #1d1a2e);
  box-shadow: inset 0 0 0 2px #ffcf4a;
}
.standings .rk {
  width: 22px;
  color: var(--muted);
}
.standings .nm {
  flex: 1;
  text-align: left;
}
.end-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.unlocks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}
.unlocks .trophy {
  animation: popin 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.end-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
  padding: 20px 0;
}
.banner span {
  opacity: 0;
  padding: 12px 34px;
  border-radius: 999px;
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--pc) 80%, #fff 20%),
    var(--pc)
  );
  box-shadow:
    0 6px 0 color-mix(in srgb, var(--pc) 60%, #000),
    0 16px 30px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.banner.show span {
  animation: banner 1.2s cubic-bezier(0.2, 1.2, 0.4, 1) forwards;
}
.banner.gold span {
  --pc: #ffae1f;
  color: #4a2600;
  font-size: 2.4rem;
}

.coach {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  width: 0;
  height: 0;
}
.coach[hidden] {
  display: none;
}
.coach-hand {
  position: absolute;
  left: -14px;
  top: -4px;
  width: 44px;
  height: 52px;
  fill: #fff;
  stroke: #2a2350;
  stroke-width: 2.5;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  animation: tap 1.1s ease-in-out infinite;
}
.coach-bubble {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 14px;
  background: #fff;
  color: #2a2350;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  animation: floaty 2s ease-in-out infinite;
}

.pops {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 35;
  overflow: hidden;
}
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffe06b;
  text-shadow:
    0 3px 0 #b85b00,
    0 6px 12px rgba(0, 0, 0, 0.5);
  animation: rise 1.1s ease-out forwards;
  white-space: nowrap;
}
.pop.small {
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 2px 0 #4424c4;
}
.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ------------------------------------------------------------ keyframes */
@keyframes bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}
@keyframes glow {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}
@keyframes shake {
  10%,
  90% {
    transform: translate(-2px, 1px);
  }
  20%,
  80% {
    transform: translate(4px, -2px);
  }
  30%,
  50%,
  70% {
    transform: translate(-6px, 2px);
  }
  40%,
  60% {
    transform: translate(6px, -1px);
  }
}
@keyframes combo {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(-8deg);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1) rotate(2deg);
  }
  25% {
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(0.9);
  }
}
@keyframes rowflash {
  0% {
    background: #ffe06b;
  }
  100% {
    background: #15162399;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes popin {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(10px);
  }
}
@keyframes floaty {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -6px;
  }
}
@keyframes banner {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  18% {
    opacity: 1;
    transform: scale(1.08);
  }
  28% {
    transform: scale(1);
  }
  78% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}
@keyframes tap {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  45% {
    transform: translate(0, 6px) scale(0.92);
  }
}
@keyframes rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(1);
  }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 760px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
  }
  .tray {
    height: clamp(170px, 30vh, 230px);
  }
  .keys {
    display: none;
  }
  .brand h1 {
    font-size: 1.05rem;
  }
}
@media (max-width: 460px) {
  .app {
    padding: 8px;
  }
  .brand h1 {
    display: none;
  }
  .chip {
    min-width: 0;
    padding: 3px 10px;
  }
  .card {
    padding: 8px;
  }
  .card-body {
    gap: 6px;
  }
  .row-ico {
    display: none;
  }
  .row-label {
    font-size: 0.78rem;
  }
  .cell {
    width: 34px;
  }
  .btn-roll {
    min-width: 140px;
  }
  .turn-msg {
    font-size: 0.8rem;
  }
  .seg button {
    font-size: 0.78rem;
  }
  .logo-text {
    font-size: 2.4rem;
  }
}
@media (max-width: 360px) {
  .row-label .l {
    display: none;
  }
  .row-label .s {
    display: inline;
  }
  .card[data-players] .cell,
  .card[data-players] .bonus-cell {
    width: 28px;
  }
  .chip {
    padding: 3px 8px;
  }
  .record,
  .end-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.start-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.die {
  transition: opacity 0.25s;
}
.logo .ld1 {
  background:
    radial-gradient(circle at 27% 27%, #2a2350 0 5px, transparent 5.5px),
    radial-gradient(circle at 50% 50%, #2a2350 0 5px, transparent 5.5px),
    radial-gradient(circle at 73% 73%, #2a2350 0 5px, transparent 5.5px),
    linear-gradient(145deg, #fff, #d6cff0);
}
@media (max-width: 460px) {
  .card[data-players="3"] .card-body,
  .card[data-players="4"] .card-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .card[data-players="3"] .row-label .l,
  .card[data-players="4"] .row-label .l {
    display: inline;
  }
  .card[data-players="3"] .row-label .s,
  .card[data-players="4"] .row-label .s {
    display: none;
  }
}
