/* Backgammon — umber board, cream and oxblood checkers, brass dice. */

.backgammon-frame {
  width: min(760px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(12px, 2.4vw, 18px);
}
.status-line {
  margin: 0;
  text-align: center;
  font-family: var(--hand);
  font-style: italic;
  font-size: clamp(14px, 2.1vw, 16.5px);
  color: var(--ink-soft);
  min-height: 22px;
}

.bg-table { display: flex; gap: 8px; align-items: stretch; }

.off-tray {
  width: clamp(34px, 6vw, 44px);
  border-radius: 8px;
  border: 1.5px dashed rgba(122, 104, 80, .4);
  background: rgba(58, 46, 34, .12);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 3px;
  cursor: default;
}
.off-tray.mine { cursor: pointer; }
.off-tray.can-to { border-color: var(--gold-bright); border-style: solid; box-shadow: 0 0 0 2px rgba(227, 183, 84, .35); }
.off-tray .bg-stack { flex-direction: column-reverse; }

.board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(30px, 7vw, 54px);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(217, 148, 65, 0.10), rgba(217, 148, 65, 0) 55%),
    linear-gradient(180deg, #3d2f20, #33261a);
  border-radius: 10px;
  padding: clamp(6px, 1.4vw, 12px);
  box-shadow: inset 0 0 0 2px rgba(200, 156, 58, .35), inset 0 10px 26px rgba(0, 0, 0, .4);
}

.bg-row { display: flex; gap: 2px; height: clamp(120px, 26vw, 190px); }
.bg-row.bottom { align-items: flex-end; }

.bg-point {
  flex: 1;
  position: relative;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  height: 100%;
}
.bg-point::before {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  height: 88%;
}
.bg-row.top .bg-point::before {
  top: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.bg-row.bottom .bg-point::before {
  bottom: 0;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}
.bg-point.a::before { background: linear-gradient(180deg, #8a6b46, #6f5434); }
.bg-point.b::before { background: linear-gradient(180deg, #52402a, #453522); }
.bg-point.can-from::before { filter: brightness(1.25); }
.bg-point.can-from { outline: 2px solid rgba(227, 183, 84, .45); outline-offset: -2px; border-radius: 4px; }
.bg-point.sel { outline: 3px solid rgba(227, 183, 84, .9); outline-offset: -2px; border-radius: 4px; }
.bg-point.can-to { outline: 2.5px dashed rgba(227, 183, 84, .8); outline-offset: -2px; border-radius: 4px; }

.bg-stack {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
}
.bg-row.top .bg-stack { top: 2px; }
.bg-row.bottom .bg-stack { bottom: 2px; flex-direction: column-reverse; }
.bg-checker {
  width: clamp(20px, 4.6vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 6px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .4);
}
.bg-checker.me { background: radial-gradient(circle at 36% 30%, var(--cream), var(--parchment-deep) 65%, var(--parchment-shadow)); }
.bg-checker.them { background: radial-gradient(circle at 36% 30%, var(--oxblood-bright), var(--oxblood) 60%, var(--oxblood-deep)); }
.bg-count {
  font-family: var(--display);
  font-size: 12px;
  color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
}

.bg-bar {
  width: clamp(22px, 4.4vw, 34px);
  position: relative;
  background: linear-gradient(180deg, rgba(26, 20, 16, .5), rgba(26, 20, 16, .65));
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(200, 156, 58, .25);
  cursor: pointer;
}
.bg-bar .bg-stack.in-bar { top: 50%; transform: translate(-50%, -50%); }
.bg-bar.can-from { box-shadow: inset 0 0 0 2px rgba(227, 183, 84, .6); }
.bg-bar.sel { box-shadow: inset 0 0 0 3px rgba(227, 183, 84, .95); }

.dice-row { display: flex; justify-content: center; min-height: 44px; }
.dice { display: flex; gap: 10px; align-items: center; }
.bg-die {
  font-size: 40px;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(246, 238, 214, .6);
  transition: opacity .2s var(--ease);
}
.bg-die.theirs { color: var(--oxblood); }
.bg-die.used { opacity: .3; }
.bg-doubles {
  font-family: var(--caps);
  font-style: normal;
  font-size: 13px;
  color: var(--ink-light);
}

.frame-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.pick-label {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 11px;
  color: var(--ink-light);
  margin: 12px 0 6px;
}
.pick-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pick {
  font-family: var(--body);
  font-size: 15px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1.5px solid rgba(122, 104, 80, .45);
  background: rgba(246, 238, 214, .6);
  cursor: pointer;
  color: var(--ink);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.pick:hover { border-color: var(--oxblood); }
.pick.picked { border-color: var(--oxblood); background: var(--cream); box-shadow: 0 0 0 2px rgba(90, 26, 31, .25); }

.help-body { text-align: left; font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); }
.help-body p { margin: 0 0 12px; }
.help-body b { color: var(--oxblood); }

/* ==== the open tables (multiplayer) ======================================= */

/* flex would beat the hidden attribute; keep hidden meaning hidden */
.mode-row[hidden], .mode-pick[hidden], .mode-at[hidden], .mp-roster[hidden], .mp-banner[hidden],
#mode-concede[hidden] { display: none; }

/* mode row: company for the night */
.mode-row { display: flex; justify-content: center; }
.mode-pick, .mode-at { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.mode-row__label {
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .18em;
  font-size: 11px; color: var(--ink-light); margin-right: 2px;
}
.mode-btn { font-size: 13px; padding: 6px 12px; }
.mode-btn.is-on { box-shadow: inset 0 0 0 1.5px rgba(90, 26, 31, .45); }

/* connection word from the shore */
.mp-banner {
  margin: 0; text-align: center;
  font-family: var(--hand); font-style: italic; font-size: 14.5px;
  color: var(--parchment); background: rgba(90, 26, 31, .88);
  border-radius: 8px; padding: 7px 12px;
  box-shadow: inset 0 0 0 1px rgba(200, 156, 58, .35);
}

/* the board rests, dimmed, while the line is cast and no practice is up */
.bg-table.is-waiting { opacity: .55; filter: saturate(.8); pointer-events: none; transition: opacity .3s var(--ease); }

/* a fresh roll drops onto the felt */
.bg-die.fresh { animation: bg-cast .38s var(--ease); }
@keyframes bg-cast {
  from { transform: translateY(-10px) rotate(-22deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-die.fresh { animation: none; }
}

/* roster strip: who sits where, and the turn clock */
.mp-roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mp-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 9px;
  background: rgba(26, 20, 16, .05);
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, .35);
}
.mp-chip b {
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .08em;
  font-size: 11px; color: var(--ink-soft); font-weight: 600;
  max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-chip i { font-family: var(--hand); font-style: italic; font-size: 11px; color: var(--ink-light); }
.mp-chip .r { font-size: 11.5px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.mp-chip.is-me b { color: var(--oxblood); }
.mp-chip.is-turn { background: rgba(227, 183, 84, .2); box-shadow: inset 0 0 0 1.5px rgba(200, 156, 58, .8); }
.mp-chip.is-gone { opacity: .55; }
/* the taproom cast wear a small portrait frame */
.mp-chip.is-cast {
  background: rgba(246, 238, 214, .55);
  box-shadow:
    inset 0 0 0 1px rgba(156, 120, 38, .75),
    inset 0 0 0 3px rgba(246, 238, 214, .9),
    inset 0 0 0 4px rgba(156, 120, 38, .4);
}
.mp-chip.is-cast.is-turn { box-shadow: inset 0 0 0 1.5px rgba(200, 156, 58, .9), inset 0 0 0 3px rgba(246, 238, 214, .9), inset 0 0 0 4px rgba(156, 120, 38, .4); }
.mp-clock {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  font-family: var(--display); font-size: 10px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
  background: conic-gradient(var(--gold) 1turn, rgba(26, 20, 16, .12) 0);
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, .35);
}
.mp-clock.is-warn { color: var(--oxblood-deep); box-shadow: inset 0 0 0 1px rgba(122, 34, 40, .7); }

/* the open-tables overlay panes */
.mp-note { font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 14px; }
.mp-note b { color: var(--oxblood); }
.mp-row { display: flex; gap: 8px; justify-content: center; margin: 0 0 6px; }
.mp-input {
  flex: 1; min-width: 0; max-width: 240px; padding: 9px 11px;
  font: inherit; font-size: 17px; color: var(--ink);
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(122, 104, 80, .55); border-radius: 8px;
}
.mp-input:focus { outline: 2px solid rgba(90, 26, 31, .4); }
.mp-input.code { max-width: 120px; text-align: center; text-transform: uppercase; letter-spacing: .3em; font-family: var(--display); font-weight: 600; }
.mp-err { color: var(--oxblood-bright); font-size: 14px; min-height: 1.2em; margin: 8px 0 0; }
.mp-code {
  font-family: var(--display); font-weight: 600; font-size: 38px;
  letter-spacing: .22em; color: var(--oxblood); margin: 2px 0 10px;
}
.mp-or { font-family: var(--caps); text-transform: uppercase; letter-spacing: .2em; font-size: 10.5px; color: var(--ink-light); margin: 12px 0; }

/* a word from the parlour, when the shared module has one */
.mp-parlour { margin: 14px 0 0; }
.mp-parlour:empty { display: none; }

/* the reckoning of a rated match */
.score-table { margin: 0 0 14px; }
.mpr-row {
  display: grid; grid-template-columns: 58px 1fr 44px 118px;
  gap: 8px; align-items: baseline;
  padding: 7px 10px; border-radius: 7px;
  font-size: 15px; color: var(--ink-soft); text-align: left;
}
.mpr-row.me { background: rgba(200, 156, 58, .16); }
.mpr-row .place { font-family: var(--caps); text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; color: var(--ink-light); }
.mpr-row .pts { text-align: right; font-variant-numeric: tabular-nums; }
.mpr-row .rate { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--ink-light); white-space: nowrap; }
.mpr-row .rate b { color: var(--oxblood); font-weight: 600; }
.mpr-row .rate .up { color: var(--forest-bright); }
.mpr-row .rate .down { color: var(--oxblood-bright); }
.mp-result-kind { font-family: var(--display); font-style: italic; font-size: 19px; color: var(--oxblood); margin: 0 0 12px; }
.mp-result-note { font-family: var(--hand); font-style: italic; font-size: 14px; color: var(--ink-light); margin: 0 0 16px; }
@media (max-width: 560px) {
  .mpr-row { grid-template-columns: 48px 1fr 38px 96px; font-size: 14px; }
  .mp-chip b { max-width: 9ch; }
}

/* ==== match play: the score line, the cube, the double button ============= */

.bg-matchline {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10.5px;
  color: var(--ink-soft);
}
.bg-matchline #ml-score b { color: var(--oxblood); font-family: var(--display); font-size: 14px; letter-spacing: 0; }
.bg-matchline .ml-to { color: var(--ink-light); font-size: 9.5px; }
.crawford-badge {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--parchment);
  background: rgba(90, 26, 31, .85);
  border-radius: 5px;
  padding: 2px 7px;
  box-shadow: inset 0 0 0 1px rgba(200, 156, 58, .4);
}

.dice-row { position: relative; }
.bg-cube {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: linear-gradient(160deg, #f4ead0, #e2d3ac);
  box-shadow: inset 0 0 0 1.5px rgba(122, 104, 80, .55), 0 2px 6px rgba(0, 0, 0, .25);
  color: var(--oxblood-deep, #4a1216);
}
.bg-cube b { font-family: var(--display); font-size: 15px; line-height: 1; }
.bg-cube span {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 6.5px;
  color: var(--ink-light);
}
.bg-cube.is-mine { box-shadow: inset 0 0 0 1.5px rgba(90, 26, 31, .65), 0 2px 6px rgba(0, 0, 0, .25); }
.bg-cube.is-offered { animation: cube-throb 1.1s ease-in-out infinite alternate; }
@keyframes cube-throb {
  from { box-shadow: inset 0 0 0 1.5px rgba(200, 156, 58, .8), 0 2px 6px rgba(0, 0, 0, .25); }
  to { box-shadow: inset 0 0 0 3px rgba(200, 156, 58, .95), 0 2px 10px rgba(0, 0, 0, .3); }
}

.double-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  padding: 6px 11px;
}

.cube-note { font-size: 15px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 6px; }
.game-detail { text-align: left; }
.game-detail .he-line { margin: 10px 0 2px; font-size: 14.5px; color: var(--ink-soft); }
.game-detail .he-line b { color: var(--oxblood); }
.game-detail .he-score { margin: 14px 0 0; text-align: center; font-size: 15px; color: var(--ink-soft); }
.game-detail .he-score b { color: var(--oxblood); font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
  .bg-cube { width: 34px; height: 34px; }
  .bg-cube b { font-size: 13px; }
  .double-btn { font-size: 11px; padding: 5px 8px; }
}
