/* ===========================================================
   10K TAVERN — Dominoes (All Fives)
   Builds on /styles.css (rail, entry/lobby, open tables, modals).
   Ivory tiles with black pips on the felt.
   =========================================================== */
:root{
  --dm-tile: #F6F1E4;
  --dm-tile-edge: #B9AE96;
  --dm-pip: #1E1A16;
  --dm-glow: var(--brass-bright);
}
[data-theme="casino"]{
  --dm-tile: #F2ECDD;
  --dm-tile-edge: #8E8470;
}

.btn-link.dm-learn{
  background: none; border: none; padding: 0; margin-left: 4px;
  font: inherit; font-weight: 700; color: var(--brass-bright); cursor: pointer;
}
.btn-link.dm-learn:hover{ text-decoration: underline; }

/* -------------------- table options (start card + lobby) -------------------- */
.dm-options{ display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; }
.lobby-main .dm-options{ margin: 4px 0 6px; }
.dm-opt{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dm-opt-label{ font-size: 0.85rem; font-weight: 600; color: rgba(var(--ink-rgb),0.75); }
.lobby-main .dm-opt-label{ color: rgba(var(--fg-rgb),0.75); }
.dm-seg{ display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(var(--ink-rgb),0.2); }
.lobby-main .dm-seg{ border-color: rgba(var(--fg-rgb),0.25); }
.dm-seg button{
  font: inherit; font-size: 0.85rem; font-weight: 700;
  padding: 6px 13px; border: none; cursor: pointer;
  background: transparent; color: inherit;
}
.dm-seg button + button{ border-left: 1px solid rgba(var(--ink-rgb),0.15); }
.dm-seg button.on{ background: var(--brass); color: var(--felt-deep); }

/* -------------------- game layout -------------------- */
.dm-game{ display: flex; flex-direction: column; gap: 14px; max-width: 1000px; margin: 0 auto; width: 100%; }
.dm-game[hidden]{ display: none; }

.dm-scores{ display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.dm-score{
  background: var(--bone); color: var(--ink);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 8px 18px rgba(0,0,0,0.22);
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dm-score.turn{ border-color: var(--brass-bright); box-shadow: 0 0 0 3px rgba(var(--brass-rgb),0.35), 0 8px 18px rgba(0,0,0,0.22); }
.dm-score-name{ font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-score-name small{ font-weight: 500; color: rgba(var(--ink-rgb),0.6); }
.dm-score-name small.away{ color: var(--clay); }
.dm-score-num{ font-family: var(--display); font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.dm-score-bar{ height: 5px; border-radius: 3px; background: rgba(var(--ink-rgb),0.12); overflow: hidden; margin: 4px 0; }
.dm-score-bar span{ display: block; height: 100%; background: var(--pine); border-radius: 3px; transition: width 0.4s; }
.dm-score-tiles{ font-size: 0.75rem; color: rgba(var(--ink-rgb),0.6); }
@media (max-width: 640px){
  .dm-scores{ grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dm-score{ padding: 8px 11px; }
  .dm-score-num{ font-size: 1.35rem; }
}

/* -------------------- the table -------------------- */
.dm-board-wrap{
  position: relative;
  border-radius: 16px;
  padding: 12px;
  background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.06), rgba(0,0,0,0.25));
  border: 1px solid rgba(var(--fg-rgb),0.08);
  box-shadow: inset 0 2px 18px rgba(0,0,0,0.35);
}
.dm-board-info{ display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 6px; }
.dm-chip{
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.3); color: rgba(var(--fg-rgb),0.85);
}
.dm-board{ display: block; width: 100%; height: min(52vh, 460px); min-height: 220px; }
@media (max-width: 640px){ .dm-board{ height: 44vh; min-height: 200px; } }

.dm-tile rect{ fill: var(--dm-tile); stroke: var(--dm-tile-edge); stroke-width: 1.4; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35)); }
.dm-tile line{ stroke: rgba(30,26,22,0.45); stroke-width: 1.4; }
.dm-tile .dm-pips circle{ fill: var(--dm-pip); }
.dm-tile.spinner rect{ stroke: var(--brass); stroke-width: 2.4; }
.dm-tile.last rect{ stroke: var(--brass-bright); stroke-width: 3; }
.dm-empty{ fill: rgba(var(--fg-rgb),0.7); font-family: var(--display); font-size: 22px; }

.dm-ghost{ cursor: pointer; }
.dm-ghost rect{
  fill: rgba(var(--brass-rgb),0.22);
  stroke: var(--dm-glow); stroke-width: 2.5; stroke-dasharray: 6 4;
  animation: dm-ghost 1.1s ease-in-out infinite;
}
.dm-ghost text{ fill: var(--brass-bright); font-family: var(--mono); font-weight: 700; font-size: 15px; pointer-events: none; }
.dm-ghost:hover rect{ fill: rgba(var(--brass-rgb),0.4); }
@keyframes dm-ghost{ 0%,100%{ opacity: 0.75; } 50%{ opacity: 1; } }

.dm-pop{
  position: absolute; left: 50%; top: 45%;
  transform: translate(-50%, -50%);
  font-family: var(--display); font-weight: 700; font-size: 2rem;
  color: var(--brass-bright);
  text-shadow: 0 3px 12px rgba(0,0,0,0.6);
  pointer-events: none;
  white-space: nowrap;
}
.dm-pop.go{ animation: dm-pop 1.8s ease-out forwards; }
@keyframes dm-pop{
  0%{ opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15%{ opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70%{ opacity: 1; transform: translate(-50%, -70%) scale(1); }
  100%{ opacity: 0; transform: translate(-50%, -95%) scale(1); }
}

/* -------------------- your hand -------------------- */
.dm-hand-wrap{
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(var(--fg-rgb),0.08);
  border-radius: 14px;
  padding: 12px 14px 14px;
}
.dm-hand-head{ display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.dm-hand-label{ font-family: var(--display); font-weight: 600; font-size: 1.05rem; color: var(--fg); }
.dm-hand-hint{ font-family: var(--mono); font-size: 0.75rem; color: rgba(var(--fg-rgb),0.6); }
.dm-hand{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 92px; }
.dm-hand-tile{
  position: relative;
  width: 46px; height: 92px;
  padding: 0; border: none; background: none; cursor: pointer;
  border-radius: 7px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.dm-hand-tile svg{ width: 100%; height: 100%; display: block; }
.dm-hand-tile:disabled{ cursor: default; }
.dm-hand-tile.playable{ box-shadow: 0 0 0 3px var(--dm-glow), 0 0 16px rgba(var(--brass-rgb),0.55); }
.dm-hand-tile.playable:hover{ transform: translateY(-4px); }
.dm-hand-tile.selected{ transform: translateY(-10px); box-shadow: 0 0 0 4px var(--dm-glow), 0 10px 22px rgba(0,0,0,0.45); }
.dm-hand-tile.dim{ opacity: 0.45; }
.dm-badge{
  position: absolute; top: -9px; right: -10px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  background: var(--pine); color: #fff;
  padding: 2px 6px; border-radius: 999px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}
@media (max-width: 640px){
  .dm-hand{ gap: 8px; }
  .dm-hand-tile{ width: 38px; height: 76px; }
}
.dm-actions{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.dm-actions [hidden]{ display: none; }

/* -------------------- feed + chat -------------------- */
.dm-feed{ display: flex; flex-direction: column; gap: 8px; }
.dm-log{
  max-height: 150px; overflow-y: auto;
  font-size: 0.85rem; line-height: 1.5;
  color: rgba(var(--fg-rgb),0.75);
  padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,0.2);
}
.dm-line.chat b{ color: var(--brass-bright); }
.dm-chat{ display: flex; gap: 8px; }
.dm-chat input{
  flex: 1; min-width: 0;
  font: inherit; padding: 9px 12px; border-radius: 999px;
  border: 1px solid rgba(var(--fg-rgb),0.2); background: rgba(0,0,0,0.25); color: var(--fg);
}

/* -------------------- modals -------------------- */
.dm-howto{ padding-left: 20px; font-size: 0.9rem; line-height: 1.6; color: rgba(var(--ink-rgb),0.85); margin: 6px 0 12px; }
.dm-howto li{ margin-bottom: 7px; }
.dm-summary{ width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.88rem; }
.dm-summary td{ padding: 7px 4px; border-bottom: 1px solid rgba(var(--ink-rgb),0.1); vertical-align: middle; }
.dm-summary td:last-child{ text-align: right; font-family: var(--mono); }
.dm-summary tr.win td{ background: rgba(var(--pine-rgb),0.12); }
.dm-summary tr.win td:first-child{ font-weight: 700; }
.dm-mini-row{ display: inline-flex; gap: 3px; flex-wrap: wrap; }
.dm-mini{ width: 46px; height: 23px; }
.dm-mini .dm-tile rect{ filter: none; }
#modal-hand .modal-actions{ align-items: center; }
