/* Stable desktop table: the shared session bar lives outside this shell. */
*{box-sizing:border-box}
:root{--session-background:#172520;--session-border:#46584a;--session-accent:#f2d29a;--session-text:#f5edd9}
html,body{margin:0;min-height:100%;width:100%}
body{background:#17231f;color:#f2ebd6;font:16px/1.35 Ubuntu,system-ui,sans-serif}
button,input,select{font:inherit}
button{cursor:pointer}
#shell{width:100%;max-width:1600px;margin:0 auto;padding:12px 20px;min-width:0}
#notice:not([hidden]){padding:8px 12px;color:#ffcb96}
#game[hidden],#lobby[hidden],#room-controls[hidden],#solo-toolbar[hidden]{display:none}
body:has(#game:not([hidden])){overflow:hidden}
body:has(#game:not([hidden])) #shell{height:calc(100dvh - var(--dmc-header-height, 50px));min-height:0}
#game{height:100%;min-height:0}
.dmc-table{display:grid;grid-template-rows:auto minmax(0,1fr) 246px;gap:12px;height:100%;min-height:0}
.player-rail{display:grid;grid-template-columns:repeat(var(--seat-columns,6),minmax(0,1fr));grid-template-rows:repeat(var(--seat-rows,1),minmax(0,1fr));gap:8px;min-height:0}
.player-rail.seats-3{--seat-columns:3}
.player-rail.seats-4{--seat-columns:4}
.player-rail.seats-5{--seat-columns:5}
.player-rail.seats-6{--seat-columns:6}
.player-rail.seats-7,.player-rail.seats-8{--seat-columns:4;--seat-rows:2}
.ui-section.seat{position:relative;min-width:0;min-height:0;padding:7px 12px 8px;border:1px solid #4e6458;border-radius:5px;background:#24392f;display:flex;align-items:stretch}
.seat .ui-section-body{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(20px,auto) 18px;align-items:center;gap:2px 8px;width:100%;min-width:0}
.seat.acting{border-color:#f0cb7c;box-shadow:inset 0 0 0 2px #f0cb7c}
.seat.claimant:not(.acting){border-color:#9db9ae}
.seat.eliminated{opacity:.6}
.seat-name{grid-column:1;grid-row:1;min-width:0;font-size:clamp(14px,1.15vw,17px);line-height:1.1;font-weight:700;overflow-wrap:anywhere}
.gem-count{grid-column:2;grid-row:1/3;align-self:center;color:#f6d184;font-size:clamp(16px,1.7vw,23px);line-height:1;letter-spacing:2px;white-space:nowrap;font-variant-numeric:tabular-nums}
.seat-role{grid-column:1;grid-row:2;color:#c4d0c6;text-transform:uppercase;font-size:11px;font-weight:700;letter-spacing:.07em}
.seat.acting .seat-role{color:#f0cb7c}
.ui-section.chest-center{position:relative;min-height:0;min-width:0;display:flex;align-items:center;justify-content:center;overflow:hidden;border:1px solid #725e40;border-radius:12px;background:radial-gradient(ellipse at center,#51452e 0%,#2b322b 75%);text-align:center;padding:10px 18px}
.chest-center .ui-section-body{height:100%;width:100%;display:grid;grid-template-rows:minmax(42px,1fr) 20px 112px minmax(40px,1fr);justify-items:center;align-items:center;gap:2px;min-width:0}
.chest-claim{font-size:clamp(30px,4.6vw,60px);font-weight:850;line-height:1;font-variant-numeric:tabular-nums;color:#fff2cf}
.chest-claim.is-draft{display:flex;align-items:center;justify-content:center;gap:14px;color:#ffe2a0;text-shadow:0 0 12px #efbc7655}
.draft-rank-pair{display:flex;gap:5px;align-items:center}
.draft-rank-pair .d6-face{width:36px;height:36px;padding:4px;border-width:2px;border-bottom-width:4px;border-radius:7px;box-shadow:0 2px 0 #725f46}
.draft-rank-pair .d6-pip{width:65%}
.chest-state{letter-spacing:.12em;font-size:13px;font-weight:800;color:#d7c18e}
.dice-stage{height:112px;display:flex;align-items:center;justify-content:center;width:100%}
.dice-stage .dice-pair{height:112px}
.result-slot{min-height:40px;align-self:stretch;display:flex;flex-direction:column;justify-content:center;align-items:center}
.challenge-result{font-size:16px;font-weight:800;font-variant-numeric:tabular-nums;letter-spacing:.03em}
.result-loser{color:#f5d28c;font-weight:700}
.stage-instruction{font-size:clamp(13px,1.3vw,17px);font-weight:700;color:#f1d9ac;max-width:620px;text-wrap:balance}
.ui-section.action-dock{min-width:0;min-height:0;display:flex;justify-content:center;padding:4px 0 0;border-top:1px solid #56644e}
.action-dock>.ui-section-body{display:grid;grid-template-rows:48px minmax(0,1fr);gap:7px;width:min(960px,100%);min-height:0}
.primary-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;gap:10px;min-height:48px}
.action-slot{min-width:0;min-height:48px;display:flex;align-items:stretch}
.action-slot .chest-action{width:100%;white-space:normal;line-height:1.1}
.chest-center>.chest-challenge{position:absolute;top:16px;right:18px;min-width:148px;min-height:48px;background:#eab09b;border-color:#bd705e;box-shadow:0 3px 0 #733f38}
.chest-center>.chest-challenge:hover{background:#ffd3b7}
.ui-section.bid-options{margin:0;min-height:0}
.bid-options>.ui-section-body{height:100%;display:grid;grid-template-rows:18px minmax(0,1fr);gap:4px}
.bid-heading{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;color:#d5bea0}
.bid-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-auto-rows:52px;gap:5px;align-content:start;min-height:0}
button.chest-action{min-width:0;min-height:44px;padding:6px 10px;border-radius:4px;color:#261f15;background:#f0d095;border:1px solid #ddad63;font-weight:800;white-space:nowrap}
button.chest-action:hover{background:#ffe2aa}
button.chest-action:focus-visible{outline:3px solid #fff;outline-offset:2px}
button.chest-action:disabled{opacity:.45;cursor:default}
.holding-action{box-shadow:inset 0 0 0 3px #fff8}
/* Twenty-one physical pair tiles: the actual roll is NEVER used here. */
.rank-tile.chest-action{position:relative;display:flex;align-items:center;justify-content:center;gap:8px;padding:4px 6px;color:#231d16;background:#e4d1a9;border:2px solid #b7a175;box-shadow:inset 0 1px #fff8,0 3px 0 #766141;overflow:hidden}
.rank-tile .rank-pair{display:flex;gap:3px;align-items:center;pointer-events:none}
.rank-pair .d6-face{width:26px;height:26px;padding:2px;border:1px solid #a39b8b;border-bottom-width:2px;border-radius:4px;box-shadow:0 1px 0 #6f6358}
.rank-pair .d6-pip{width:65%;box-shadow:none}
.rank-code{font-size:17px;font-weight:900;font-variant-numeric:tabular-nums}
.rank-tile.dead-man{background:#dfac6e;border-color:#f4d49b}
.rank-special{position:absolute;bottom:0;right:4px;font-size:10px;letter-spacing:.05em;font-weight:900;color:#4e231c}
.rank-tile.chest-action:disabled{opacity:.37;background:#857b6c;border-color:#9f998e;color:#231e19;box-shadow:none}
.rank-tile.chest-action:not(:disabled):hover{background:#ffe4a9}
/* Hint appears only while the viewer is permitted to see their own roll. */
.rank-tile.chest-action.is-safe:not(:disabled){background:#bfd9b0;border-color:#729b68;color:#193321}
.rank-tile.chest-action.is-safe:not(:disabled):hover{background:#d2edc0}
.rank-tile.chest-action.is-safe.is-selected:not(:disabled){background:#b8e39e;border-color:#fff2c7}
.rank-tile.chest-action.is-selected{outline:3px solid #fff2c7;outline-offset:-4px;border-color:#fff2c7;background:#f7d084;box-shadow:0 0 0 2px #a86432}
.rank-reference{position:absolute;top:12px;left:12px;z-index:12;text-align:left;max-width:min(360px,calc(100% - 24px))}
.rank-reference summary{cursor:pointer;display:inline-block;background:#25352f;border:1px solid #bda276;border-radius:4px;padding:6px 10px;color:#f7dda8;font-size:13px;font-weight:800}
.rank-reference summary:focus-visible{outline:3px solid #fff;outline-offset:2px}
.rank-reference-panel{width:min(330px,80vw);max-height:min(360px,60vh);overflow:auto;background:#1c2c27;border:1px solid #bda276;border-radius:5px;box-shadow:0 8px 26px #0009;padding:12px;font-variant-numeric:tabular-nums}
.rank-reference-panel strong{display:block;font-size:12px;color:#e9c791;letter-spacing:.03em}
.rank-reference-panel p{font-size:16px;font-weight:800;line-height:1.7;word-spacing:5px;margin:0 0 12px}
.rank-reference-panel p:last-child{margin-bottom:0}
#rules-dialog{width:min(700px,calc(100vw - 40px));max-width:none;max-height:min(82vh,760px);overflow:auto}
.rules-content{display:grid;gap:9px}
.rules-content h2{font-size:23px;margin:0}
.rules-content h3{font-size:16px;color:#f3d497;margin:9px 0 0}
.rules-content p{margin:0;line-height:1.45}
.rules-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;padding-bottom:8px;border-bottom:1px solid #596457}
.rules-heading .rules-close{flex:none;border-radius:4px;font-weight:800}
dialog{background:#20332e;color:inherit;border:1px solid #bda276;border-radius:9px;padding:24px;max-width:min(560px,calc(100vw - 40px))}
dialog::backdrop{background:#000b}
dialog button{background:#efd18f;color:#211c14;border:0;padding:10px}
@media(max-width:1100px){
  #shell{padding:10px 12px}
  .player-rail{gap:6px}
  .ui-section.seat{padding:6px 8px}
  .gem-count{letter-spacing:0}
  .rank-tile.chest-action{gap:5px;padding-inline:2px}
  .rank-pair .d6-face{width:24px;height:24px}
  .rank-code{font-size:16px}
}
@media(max-height:840px){
  .dmc-table{grid-template-rows:auto minmax(0,1fr) 240px;gap:8px}
  .ui-section.seat{padding-block:5px}
  .chest-center .ui-section-body{grid-template-rows:minmax(38px,1fr) 19px 112px minmax(36px,1fr)}
  .bid-grid{grid-auto-rows:50px}
}
@media(prefers-reduced-motion:reduce){.rank-tile,.chest-claim{transition:none!important}}
