/* Dominó — a cantina table. The table, the chain and both hands keep their left-to-right order in Arabic. */
.dm-col { direction: ltr; gap: 6px; padding: 6px 6px 4px; max-width: 980px; margin: 0 auto; }

/* ---------------------------------------------------------------- the phone's hand and the boneyard */
.dm-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 36px; padding: 0 4px; }
.dm-opp { display: flex; align-items: center; gap: 3px; min-width: 0; }
.dm-opp.is-tight .dm-back, .dm-opp.is-tight .dm-mini { margin-right: -8px; }
.dm-back {
  flex: none; display: block; width: 17px; height: 34px; border-radius: 4px;
  background:
    radial-gradient(circle at 50% 50%, var(--w-marigold) 0 2.5px, transparent 3px),
    linear-gradient(160deg, #8B4AD0, #5A2A91);
  box-shadow: inset 0 0 0 1.5px rgba(255, 209, 102, 0.75), 0 2px 0 rgba(0, 0, 0, 0.35);
}
.dm-mini { flex: none; display: block; width: 17px; height: 34px; }
.dm-mini svg, .dm-tile svg, .dm-ct svg, .dm-mark svg { display: block; width: 100%; height: 100%; }
.dm-bone {
  flex: none; display: flex; align-items: center; gap: 7px; padding: 3px 12px 3px 8px; border-radius: 999px;
  background: rgba(27, 8, 41, 0.6); box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--gold-soft); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.dm-bone .dm-back { width: 13px; height: 26px; transform: rotate(14deg); }
.dm-bone.is-empty { opacity: 0.45; }

/* ---------------------------------------------------------------- the table */
.dm-table {
  position: relative; flex: 1 1 auto; width: 100%; min-height: 120px; overflow: hidden; border-radius: 18px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0) 0 22px, rgba(0, 0, 0, 0.07) 22px 23px, rgba(255, 255, 255, 0.025) 23px 47px),
    radial-gradient(120% 90% at 50% 40%, #1FA797, #0D6D66 62%, #084C4A);
  box-shadow: inset 0 0 0 3px #E0672F, inset 0 0 0 6px #FFB627, inset 0 0 0 8px rgba(27, 8, 41, 0.55), inset 0 10px 34px rgba(0, 0, 0, 0.35);
}
.dm-table.is-knock { animation: dm-knock 0.42s ease-out; }
.dm-chain { position: absolute; top: 50%; left: 50%; width: 0; height: 0; }
.dm-ct {
  position: absolute; top: -50px; left: -25px; width: 50px; height: 100px;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.4));
}
.dm-ct.is-new svg { animation: dm-drop 0.26s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
.dm-mark {
  position: absolute; top: 0; left: 0; padding: 14%; border: 0; border-radius: 50%;
  background: rgba(255, 246, 227, 0.2); box-shadow: inset 0 0 0 2px rgba(255, 246, 227, 0.7);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.dm-mark svg { filter: brightness(1.75) saturate(1.15); }
.dm-mark[data-n="0"]::after { content: ""; position: absolute; top: 50%; left: 50%; width: 30%; height: 30%; margin: -15%; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 246, 227, 0.75); }
.dm-mark.is-live {
  z-index: 3; cursor: pointer; background: #FFF6E3; box-shadow: 0 0 0 3px var(--w-pink), 0 0 0 6px var(--w-marigold), 0 6px 14px rgba(0, 0, 0, 0.5);
  animation: dm-glow 0.9s ease-in-out infinite;
}
.dm-mark.is-live svg { filter: none; }
.dm-mark.is-live[data-n="0"]::after { box-shadow: inset 0 0 0 2px #B99A63; }

/* ---------------------------------------------------------------- status, the draw button, your hand */
.dm-bar { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; width: 100%; min-height: 44px; direction: inherit; }
html[dir="rtl"] .dm-bar { direction: rtl; }
.dm-status { min-height: 30px; padding: 0 4px; font-size: 15px; }
.dm-act {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gold); color: var(--lapis-deep); font: inherit; font-weight: 800; font-size: 16px;
  box-shadow: 0 3px 0 #B77400, 0 0 0 4px rgba(255, 182, 39, 0.25);
  animation: dm-pulse 1s ease-in-out infinite;
}
.dm-act:active { transform: translateY(2px); box-shadow: 0 1px 0 #B77400; }
.dm-hand { --tw: 44px; flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: 100%; min-height: 60px; padding-bottom: 2px; }
.dm-tile {
  flex: none; width: var(--tw); height: calc(var(--tw) * 2); padding: 0; border: 0; border-radius: 16%/8%; background: none; cursor: pointer;
  opacity: 0.55; transition: transform 0.14s, opacity 0.2s;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4));
  -webkit-tap-highlight-color: transparent;
}
.dm-hand.is-wait .dm-tile { opacity: 0.8; }
.dm-tile.is-play { opacity: 1; }
.dm-tile.is-play:active { transform: translateY(-4px); }
.dm-tile.is-sel { transform: translateY(-8px); filter: drop-shadow(0 0 0 var(--w-pink)) drop-shadow(0 0 7px var(--w-marigold)); }
.dm-tile.is-new { animation: dm-drop 0.3s ease-out both; }
.dm-tile:focus-visible, .dm-mark:focus-visible, .dm-act:focus-visible { outline: 3px solid var(--w-turquoise); outline-offset: 2px; }

/* ---------------------------------------------------------------- what was left in the hands, on the round panel */
.dm-heldbox { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.dm-held { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mist); }
.dm-held__label { flex: 0 0 auto; }
.dm-held__tiles { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; direction: ltr; }
.dm-held__sum { flex: none; min-width: 28px; color: var(--gold-soft); font-size: 17px; text-align: center; }
.dm-note { margin: 0 0 10px; color: var(--mist); text-align: center; }

@keyframes dm-drop { from { transform: scale(1.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes dm-pulse { 50% { transform: scale(1.06); } }
@keyframes dm-glow { 50% { box-shadow: 0 0 0 5px var(--w-pink), 0 0 0 11px var(--w-marigold), 0 6px 14px rgba(0, 0, 0, 0.5); } }
@keyframes dm-knock { 20% { transform: translate(-3px, 2px); } 45% { transform: translate(3px, -2px); } 70% { transform: translate(-2px, 1px); } }
@media (max-height: 600px) { .dm-status { font-size: 14px; } .dm-bar { min-height: 36px; } .dm-act { min-height: 40px; } }
@media (prefers-reduced-motion: reduce) {
  .dm-ct, .dm-mark { transition: none; }
  .dm-ct.is-new svg, .dm-tile.is-new, .dm-act, .dm-mark.is-live, .dm-table.is-knock { animation: none; }
}
