/* Commander Client V3 ------------------------------------------------------
   Responsive product shell layered over the existing game components.
   The rules UI keeps its original DOM hooks; this file only changes layout. */

:root {
  --v3-bg: var(--ds-table);
  --v3-panel: var(--ds-panel);
  --v3-panel-2: #12191a;
  --v3-line: #273032;
  --v3-line-soft: #1c2426;
  --v3-text: var(--ds-text);
  --v3-muted: #8f9998;
  --v3-gold: var(--ds-accent);
  --v3-gold-bright: var(--ds-accent-bright);
  --v3-green: #809a72;
  --v3-radius: 12px;
}

* { box-sizing: border-box; }
#desktop-only { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Main page --------------------------------------------------------------- */

body:has(#setup) {
  background: var(--v3-bg) !important;
}

body:has(#setup)::before,
#setup::before {
  content: none !important;
  display: none !important;
}

body:not(.game-active) #game { display: none !important; }
body.game-active #setup { display: none !important; }
body.game-active #game { display: grid !important; }

#setup {
  width: min(100%, 1560px) !important;
  max-width: none !important;
  min-height: calc(100 * var(--dvhu));
  margin: 0 auto !important;
  padding: 0 28px 72px !important;
  color: var(--v3-text);
  background: var(--v3-bg) !important;
}

#setup .menuhead {
  min-height: 0 !important;
  margin: 0 -28px 34px !important;
  padding: 18px 28px 30px !important;
  display: grid !important;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr) !important;
  grid-template-areas:
    "brand steps mana"
    "hero hero hero" !important;
  align-items: center !important;
  gap: 28px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--v3-line) !important;
  border-radius: 0 !important;
  background:
    linear-gradient(180deg, transparent 50%, var(--v3-bg) 100%),
    linear-gradient(90deg, rgba(var(--ds-panel-rgb), .98) 0%, rgba(var(--ds-panel-rgb), .94) 56%, rgba(var(--ds-panel-rgb), .86) 100%) !important;
  box-shadow: 0 16px 54px rgba(0, 0, 0, .24) !important;
}

@media (min-width: 1280px) {
  #setup .menuhead {
    background:
      linear-gradient(180deg, transparent 50%, var(--v3-bg) 100%),
      linear-gradient(90deg, rgba(var(--ds-panel-rgb), .98) 0%, rgba(var(--ds-panel-rgb), .94) 56%, rgba(var(--ds-panel-rgb), .86) 100%),
      url('../assets/backgrounds/commander-war-room.jpg') center 18% / cover no-repeat !important;
  }
}

#setup .setupbrand {
  grid-area: brand;
  display: grid;
  grid-template-columns: 34px auto;
  grid-template-rows: auto auto;
  align-items: center;
  width: max-content;
  font-family: var(--ds-font-display);
  letter-spacing: .13em;
}

#setup .setupbrand .menumark {
  grid-row: 1 / 3;
  width: 22px;
  height: 22px;
  display: block;
  border: 1px solid var(--v3-gold);
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 5px var(--ds-panel), inset 0 0 0 6px rgba(var(--ds-accent-rgb), .55);
}

#setup .setupbrand b { font-size: 13px; line-height: 1; }
#setup .setupbrand small { color: var(--v3-muted); font-size: 8px; letter-spacing: .23em; }

#setup .setupsteps {
  grid-area: steps;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

#setup .setupstep {
  position: relative;
  min-width: 108px;
  min-height: 44px;
  padding: 0 22px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  font: 700 10px/1 var(--ds-font-display);
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
}

#setup .setupstep:disabled {
  color: var(--ds-muted);
  cursor: not-allowed;
  opacity: .62;
}
#setup .setupstep:disabled span { border-color: #293132; background: var(--ds-panel); }

#setup .setupstep:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -8px;
  width: 16px;
  height: 1px;
  background: var(--v3-line);
}

#setup .setupstep span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #3a4445;
  border-radius: 50%;
  font-size: 9px;
}

#setup .setupstep.on { color: var(--v3-text); }
#setup .setupstep.on span { color: var(--ds-accent-ink); background: var(--v3-gold-bright); border-color: var(--v3-gold-bright); }

#setup .menu-mana-showcase {
  grid-area: mana;
  justify-self: end;
  display: flex !important;
  gap: 6px;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
}

#setup .menu-mana-showcase img { width: 19px !important; height: 19px !important; opacity: .72; }

#setup .setuphero {
  grid-area: hero;
  max-width: 680px;
  padding-top: 26px;
}

#setup .menu-kicker,
#setup .eyebrow {
  color: var(--v3-gold);
  font: 700 9px/1 var(--ds-font-display);
  letter-spacing: .24em;
  text-transform: uppercase;
}

#setup .setuphero .title {
  margin: 9px 0 7px !important;
  color: var(--v3-text) !important;
  font: 400 clamp(34px, 4 * var(--vwu), 56px)/1.03 var(--ds-font-display) !important;
  letter-spacing: -.025em !important;
  text-transform: none !important;
}

#setup .setuphero .subtitle {
  max-width: 560px;
  margin: 0 !important;
  color: var(--v3-muted) !important;
  font: 400 14px/1.55 var(--ds-font-body);
}

#setup .setupgrid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 410px !important;
  align-items: start !important;
  gap: 28px !important;
}

#setup .setupleft { min-width: 0; }

#setup .deckexplorerhead {
  min-height: 54px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

#setup .deckexplorerhead h2 {
  margin: 7px 0 0;
  font: 400 25px/1.05 var(--ds-font-display);
}

#setup .deckexploreractions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#setup .debugimportbtn {
  min-height: 40px;
  padding: 0 13px;
  color: #c9d0cd;
  background: var(--ds-panel);
  border: 1px solid var(--v3-line);
  border-radius: 7px;
  font: 700 9px/1 var(--ds-font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

#setup .debugimportbtn:hover,
#setup .debugimportbtn:focus-visible {
  color: var(--v3-gold-bright);
  border-color: rgba(var(--ds-accent-rgb), .58);
  outline: 0;
}

#setup .debugimportbtn:disabled { opacity: .55; cursor: wait; }

#setup .debugimportstatus {
  margin: -7px 0 14px;
  padding: 9px 11px;
  color: #a9cdb7;
  background: rgba(74, 128, 95, .1);
  border: 1px solid rgba(102, 164, 123, .3);
  border-radius: 7px;
  font: 600 10px/1.4 var(--ds-font-body);
}

#setup .debugimportstatus.error {
  color: #e6aaa2;
  background: rgba(142, 61, 52, .12);
  border-color: rgba(196, 91, 78, .38);
}

#setup .deckresultcount {
  padding-bottom: 3px;
  color: var(--v3-muted);
  font: 600 10px/1 var(--ds-font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
}

#setup .decktools {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) repeat(3, auto) auto;
  gap: 8px;
  margin-bottom: 15px;
}

#setup .decktools label,
#setup .decktools button { min-width: 0; }

#setup .decksearch {
  position: relative;
  display: flex;
  align-items: center;
}

#setup .decksearch > span {
  position: absolute;
  left: 13px;
  z-index: 1;
  color: #8c9695;
  font-size: 20px;
  transform: rotate(-18deg);
}

#setup .decktools input,
#setup .decktools select,
#setup .favoritefilter {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: #c8cecc;
  background: var(--ds-panel);
  border: 1px solid var(--v3-line);
  border-radius: 8px;
  outline: 0;
  font: 600 11px/1 var(--ds-font-body);
}

#setup .decktools input { padding-left: 40px; }
#setup .decktools select { min-width: 102px; cursor: pointer; }
#setup .favoritefilter { width: auto; white-space: nowrap; cursor: pointer; }
#setup .favoritefilter.on { color: var(--v3-gold-bright); border-color: rgba(var(--ds-accent-rgb), .58); background: rgba(var(--ds-accent-rgb), .08); }
#setup .decktools input:focus,
#setup .decktools select:focus,
#setup .favoritefilter:focus-visible { border-color: var(--v3-gold); box-shadow: 0 0 0 2px rgba(var(--ds-accent-rgb), .15); }

#setup .decklist {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  counter-reset: none !important;
}

#setup .deckentry {
  position: relative;
  min-width: 0;
}

#setup .deckentry[hidden] { display: none !important; }
#setup .liveplayercount[hidden],
#setup .btnrow[hidden],
#setup .seclabel[hidden],
#setup .botstyles[hidden],
#setup .cmdcheck[hidden] { display: none !important; }

#setup .decklist.noresults::after {
  content: 'No decks match these filters.';
  grid-column: 1 / -1;
  padding: 64px 20px;
  color: var(--v3-muted);
  text-align: center;
  border: 1px dashed var(--v3-line);
  border-radius: var(--v3-radius);
}

#setup .deckcard {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 214px !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: 142px minmax(0, 1fr) !important;
  gap: 0 !important;
  overflow: hidden !important;
  color: var(--v3-text) !important;
  text-align: left !important;
  background: linear-gradient(135deg, #101718, #0a0e0f) !important;
  border: 1px solid var(--v3-line-soft) !important;
  border-radius: var(--v3-radius) !important;
  box-shadow: none !important;
  transform: none !important;
}

#setup .deckcard::before,
#setup .deckcard::after { display: none !important; }

#setup .deckcard:hover {
  border-color: #435052 !important;
  background: linear-gradient(135deg, #141c1d, #0c1112) !important;
  transform: translateY(-1px) !important;
}

#setup .deckcard.selected {
  border-color: var(--v3-gold) !important;
  box-shadow: 0 0 0 1px rgba(var(--ds-accent-rgb), .3), 0 14px 35px rgba(0, 0, 0, .2) !important;
}

#setup .deckcard.selected::after {
  content: none !important;
  display: none !important;
}

#setup .deckart {
  width: 142px !important;
  height: 100% !important;
  min-height: 214px !important;
  object-fit: cover !important;
  object-position: 50% 38% !important;
  border-radius: 0 !important;
  filter: saturate(.85) contrast(1.03) !important;
}

#setup .deckcard:hover .deckart,
#setup .deckcard.selected .deckart { transform: none !important; filter: saturate(1) contrast(1.04) !important; }

#setup .deckinfo {
  min-width: 0;
  padding: 17px 17px 15px !important;
  display: flex !important;
  flex-direction: column !important;
}

#setup .decktopline { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
#setup .decktitle { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
#setup .deckname { color: var(--v3-text) !important; font: 400 20px/1.05 var(--ds-font-display) !important; }
#setup .deckselectedmark {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--ds-accent-ink);
  background: linear-gradient(180deg, var(--ds-accent-bright), var(--ds-accent));
  border: 1px solid var(--ds-accent-bright);
  border-radius: 999px;
  font: 800 7px/1 var(--ds-font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
}
#setup .deckselectedmark b { font-size: 9px; }
#setup .deckcard.selected .deckselectedmark { display: inline-flex; }
#setup .deckyear { color: var(--ds-muted); font: 700 8px/1 var(--ds-font-display); letter-spacing: .1em; }
#setup .deckcmd { margin-top: 7px !important; color: #98a3a1 !important; font: 500 10px/1.3 var(--ds-font-body); }
#setup .deckcmd span { display: none !important; }
#setup .deckcmd b { color: #c3cbc8; font-weight: 600; }
#setup .deckcolors { margin-top: 11px !important; display: flex !important; align-items: center !important; gap: 4px !important; }
#setup .deckmana { width: 16px !important; height: 16px !important; }
#setup .deckstyle {
  margin-left: 5px !important;
  padding: 4px 7px !important;
  color: #aeb8b5 !important;
  background: #151d1e !important;
  border: 1px solid #293334 !important;
  border-radius: 999px !important;
  font: 600 8px/1 var(--ds-font-display) !important;
  letter-spacing: .04em !important;
}
#setup .deckblurb { margin-top: 11px !important; color: #788280 !important; font: 400 11px/1.42 var(--ds-font-body); }
#setup .deckset {
  margin-top: auto !important;
  padding-top: 12px !important;
  display: flex !important;
  justify-content: space-between !important;
  gap: 8px !important;
  color: var(--ds-muted) !important;
  font: 600 8px/1.2 var(--ds-font-display) !important;
  letter-spacing: .04em !important;
}
#setup .deckset span { color: var(--v3-gold); white-space: nowrap; }

#setup .deckfavorite {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #899190;
  background: rgba(var(--ds-table-rgb), .78);
  border: 1px solid rgba(138, 148, 146, .28);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  cursor: pointer;
}
#setup .deckfavorite[aria-pressed="true"] { color: var(--v3-gold-bright); }

#setup .setupright {
  position: sticky !important;
  top: 18px !important;
  z-index: 7;
  max-height: calc(100 * var(--dvhu) - 36px);
  padding: 0 20px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: auto;
  background: rgba(var(--ds-panel-rgb), .97) !important;
  border: 1px solid var(--v3-line) !important;
  border-radius: var(--v3-radius) !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .3) !important;
}

#setup .setupright > * { width: 100% !important; flex-shrink: 0; }
#setup .controlintro {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -20px 12px !important;
  padding: 20px !important;
  background: rgba(var(--ds-panel-rgb), .98) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--v3-line-soft) !important;
}
#setup .controlintro > span { color: var(--v3-gold) !important; font: 700 8px/1 var(--ds-font-display) !important; letter-spacing: .2em !important; text-transform: uppercase; }
#setup .controlintro h2 { margin: 7px 0 4px !important; color: var(--v3-text) !important; font: 400 25px/1.05 var(--ds-font-display) !important; }
#setup .controlintro p { margin: 0 !important; color: var(--v3-muted) !important; font: 400 11px/1.45 var(--ds-font-body); }
#setup .podclose { display: none; }
#setup .debugreplaynotice {
  margin: 0 0 4px;
  padding: 11px 12px;
  display: grid;
  gap: 4px;
  color: #dce5e0;
  background: linear-gradient(135deg, rgba(67, 119, 91, .17), rgba(var(--ds-accent-rgb), .07));
  border: 1px solid rgba(110, 171, 132, .35);
  border-radius: 8px;
}
#setup .debugreplaynotice[hidden] { display: none !important; }
#setup .debugreplaynotice small { color: #86c39d; font: 800 7px/1 var(--ds-font-display); letter-spacing: .17em; }
#setup .debugreplaynotice b { color: #eef3ef; font: 700 12px/1.25 var(--ds-font-body); }
#setup .debugreplaynotice span { color: #c3a97d; font: 700 9px/1.3 var(--ds-font-display); letter-spacing: .05em; }
#setup .debugreplaynotice p { margin: 3px 0 0; color: #7f8d88; font: 500 9px/1.4 var(--ds-font-body); }
#setup .seclabel { margin: 15px 0 8px !important; color: #a2acaa !important; font: 700 9px/1 var(--ds-font-display) !important; letter-spacing: .12em !important; text-transform: uppercase; }
#setup .seclabel i { color: var(--v3-gold) !important; background: none !important; font-style: normal; }
#setup .seclabel em { color: var(--ds-muted) !important; }

#setup .cmdbox,
#setup .botconfig,
#setup .advancedrules {
  background: var(--ds-panel) !important;
  border: 1px solid var(--v3-line-soft) !important;
  border-radius: 9px !important;
}

#setup .cmdbox { padding: 10px !important; }
#setup .cmdchosen { margin: 0 !important; }
#setup .cmdchip { background: var(--ds-dialog) !important; border: 0 !important; border-radius: 7px !important; }
#setup .cmdchip img { width: 58px !important; height: 70px !important; object-fit: cover !important; }
#setup .cmdhint { color: #76807f !important; font-size: 9px !important; }
#setup .botstyles { display: grid !important; gap: 7px !important; }
#setup .botconfig { padding: 9px !important; }
#setup .styledesc { display: none !important; }
#setup .botstylerow { gap: 7px !important; }
#setup .botidentity { min-width: 76px !important; }
#setup .botidentity .botname,
#setup .botidentity small { display: block; }
#setup .botidentity small { margin-top: 3px; }
#setup .botfield > span { font-size: 7px !important; }
#setup .styleselect { min-height: 44px !important; border-radius: 6px !important; }

#setup .advancedrules { margin-top: 15px; overflow: hidden; }
#setup .selecteddecksummary {
  min-width: 0;
  margin-bottom: 8px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #dce2df;
  background: rgba(var(--ds-accent-rgb), .07);
  border: 1px solid rgba(var(--ds-accent-rgb), .22);
  border-radius: 7px;
}
#setup .selecteddecksummary span { min-width: 0; display: grid; gap: 3px; }
#setup .selecteddecksummary small { color: #7d8985; font: 800 7px/1 var(--ds-font-display); letter-spacing: .16em; text-transform: uppercase; }
#setup .selecteddecksummary b { overflow: hidden; font: 700 12px/1.15 var(--ds-font-body); text-overflow: ellipsis; white-space: nowrap; }
#setup .selecteddecksummary em { flex: none; padding: 4px 6px; color: var(--ds-accent); background: rgba(217, 178, 114, .08); border-radius: 999px; font: 800 7px/1 var(--ds-font-display); font-style: normal; letter-spacing: .12em; text-transform: uppercase; }
#setup .advancedrules summary {
  position: relative;
  min-height: 56px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #c3cbc8;
  cursor: pointer;
  list-style: none;
}
#setup .advancedrules summary::-webkit-details-marker { display: none; }
#setup .advancedrules summary::after { content: '+'; position: absolute; right: 14px; color: var(--v3-gold); font-size: 20px; }
#setup .advancedrules[open] summary::after { content: '−'; }
#setup .advancedrules summary span { font: 700 10px/1.2 var(--ds-font-display); letter-spacing: .08em; text-transform: uppercase; }
#setup .advancedrules summary small { margin-top: 4px; color: var(--ds-muted); font-size: 9px; }
#setup .advancedbody { padding: 0 12px 12px; border-top: 1px solid var(--v3-line-soft); }
#setup .cmdcheck { margin-top: 10px !important; background: var(--ds-panel-raised) !important; border: 1px solid #20292a !important; border-radius: 7px !important; }
#setup .pbtn.start {
  min-height: 52px !important;
  margin-top: 14px !important;
  color: var(--ds-accent-ink) !important;
  background: linear-gradient(180deg, #e3b774, #c99250) !important;
  border: 1px solid #f2cf96 !important;
  border-radius: 8px !important;
  font: 800 11px/1 var(--ds-font-display) !important;
  letter-spacing: .14em !important;
  text-transform: uppercase;
}
#setup .pbtn.start:disabled { color: var(--ds-muted) !important; background: #151b1c !important; border-color: #263031 !important; }
#setup .credits { margin-top: 12px !important; color: var(--ds-muted) !important; font-size: 8px !important; }
#setup .setupmobilebar { display: none; }

@media (max-width: 1279px) {
  #setup { display: block !important; }

  #setup { padding-inline: 22px !important; }
  #setup .menuhead {
    margin-inline: -22px !important;
    padding-inline: 22px !important;
  }
  #setup .setupgrid { grid-template-columns: minmax(0, 1fr) !important; }
  #setup .setupright {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 120 !important;
    width: min(430px, 92 * var(--vwu)) !important;
    max-height: none !important;
    border-radius: 0 !important;
    transform: translateX(104%);
    transition: transform .25s ease;
  }
  #setup .setupright .controlintro { width: calc(100% + 40px) !important; }
  #setup .setupright.mobile-open { transform: translateX(0); }
  #setup .setupright.mobile-open::before {
    content: '';
    position: fixed;
    inset: 0 100% 0 calc(-100 * var(--vwu));
    background: rgba(0, 0, 0, .66);
  }
  #setup .podclose {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #aeb8b5;
    background: #13191a;
    border: 1px solid var(--v3-line);
    border-radius: 50%;
    font-size: 21px;
    cursor: pointer;
  }
}

@media (min-width: 701px) and (max-width: 1279px) {
  #setup .menuhead {
    background:
      linear-gradient(180deg, transparent 48%, var(--v3-bg) 100%),
      linear-gradient(90deg, rgba(var(--ds-panel-rgb), .98) 0%, rgba(var(--ds-panel-rgb), .93) 58%, rgba(var(--ds-panel-rgb), .84) 100%),
      url('../assets/backgrounds/commander-war-room.jpg') center 18% / 140% auto no-repeat !important;
  }
}

@media (max-width: 900px) {
  #setup .menuhead {
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "brand mana" "steps steps" "hero hero" !important;
    gap: 20px !important;
  }
  #setup .setupsteps { justify-content: flex-start; }
  #setup .setupstep { min-width: 94px; justify-content: flex-start; padding-left: 0; }
  #setup .decktools { grid-template-columns: minmax(220px, 1fr) repeat(2, auto); }
  #setup .decktools label:nth-of-type(4),
  #setup .favoritefilter { grid-row: 2; }
  #setup .decktools label:nth-of-type(4) { grid-column: 1; }
  #setup .favoritefilter { grid-column: 2; }
}

@media (max-width: 700px) {
  body { background: var(--v3-bg) !important; }
  #setup { padding: 0 14px 96px !important; }
  #setup .menuhead {
    margin: 0 -14px 23px !important;
    padding: 15px 14px 24px !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "brand mana" "steps steps" "hero hero" !important;
    background:
      radial-gradient(circle at 84% 24%, rgba(78, 91, 60, .13), transparent 34%),
      linear-gradient(180deg, var(--ds-table) 0%, var(--v3-bg) 100%) !important;
  }
  #setup .setupbrand { grid-template-columns: 28px auto; }
  #setup .setupbrand .menumark { width: 18px; height: 18px; }
  #setup .menu-mana-showcase img { width: 16px !important; height: 16px !important; }
  #setup .menu-mana-showcase img:nth-last-child(-n + 3) { display: none; }
  #setup .setupsteps { width: 100%; }
  #setup .setupstep { flex: 1; min-width: 0; justify-content: center; padding: 0 6px; }
  #setup .setupstep b { font-size: 8px; }
  #setup .setupstep:not(:last-child)::after { right: -4px; width: 8px; }
  #setup .setuphero { padding-top: 4px; }
  #setup .setuphero .title { font-size: 34px !important; }
  #setup .setuphero .subtitle { font-size: 12px !important; }
  #setup .deckexplorerhead { min-height: 44px; }
  #setup .deckexplorerhead h2 { font-size: 21px; }
  #setup .deckexploreractions { flex-direction: column; align-items: flex-end; gap: 6px; }
  #setup .debugimportbtn { min-height: 44px; }
  #setup .decktools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-bottom: 5px;
  }
  #setup .decksearch { grid-column: 1 / -1; min-width: 0 !important; }
  #setup .decktools label:nth-of-type(2) { grid-column: 1; grid-row: 2; }
  #setup .decktools label:nth-of-type(3) { grid-column: 2; grid-row: 2; }
  #setup .decktools label:nth-of-type(4) { grid-column: 1; grid-row: 3; }
  #setup .decktools .favoritefilter { grid-column: 2; grid-row: 3; }
  #setup .decktools label,
  #setup .decktools select,
  #setup .favoritefilter { width: 100%; min-width: 0 !important; }
  #setup .decklist { grid-template-columns: minmax(0, 1fr) !important; gap: 9px !important; }
  #setup .deckcard { min-height: 148px !important; grid-template-columns: 105px minmax(0, 1fr) !important; }
  #setup .deckart { width: 105px !important; min-height: 148px !important; }
  #setup .deckinfo { padding: 13px 13px 11px !important; }
  #setup .deckname { padding-right: 25px; font-size: 17px !important; }
  #setup .deckcmd { margin-top: 5px !important; }
  #setup .deckcolors { margin-top: 8px !important; }
  #setup .deckmana { width: 14px !important; height: 14px !important; }
  #setup .deckstyle { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #setup .deckblurb { display: none !important; }
  #setup .deckset { padding-top: 8px !important; }
  #setup .deckset span { display: none; }
  #setup .deckfavorite { top: 5px; right: 5px; width: 44px; height: 44px; }
  #setup .setupmobilebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    min-height: 76px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(var(--ds-panel-rgb), .96);
    border-top: 1px solid var(--v3-line);
    backdrop-filter: blur(18px);
  }
  #setup .mobiledeck { min-width: 0; flex: 1; display: flex; align-items: center; gap: 9px; }
  #setup .mobiledeck img { width: 42px; height: 50px; object-fit: cover; border-radius: 5px; }
  #setup .mobiledeck span { min-width: 0; display: flex; flex-direction: column; }
  #setup .mobiledeck small { color: var(--ds-muted); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
  #setup .mobiledeck b { overflow: hidden; color: #dce1df; font: 400 14px/1.3 var(--ds-font-display); text-overflow: ellipsis; white-space: nowrap; }
  #setup .setupmobilebar > .pbtn { width: auto !important; min-width: 112px; min-height: 46px; margin: 0 !important; }
  #setup:has(.podbuilder.mobile-open) .setupmobilebar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #setup .setupright { transition: none; }
  #setup .deckcard { transition: none !important; }
}

/* Arena ------------------------------------------------------------------- */

#game {
  --v3-rail: 48px;
  color: var(--v3-text);
  background:
    radial-gradient(ellipse 75% 55% at 48% 50%, rgba(69, 83, 51, .2), transparent 70%),
    linear-gradient(180deg, rgba(3, 6, 7, .64), rgba(3, 6, 7, .13) 42%, rgba(3, 6, 7, .78)),
    var(--v3-bg) !important;
}

body.game-active #game {
  background:
    radial-gradient(ellipse 75% 55% at 48% 50%, rgba(69, 83, 51, .2), transparent 70%),
    linear-gradient(180deg, rgba(3, 6, 7, .64), rgba(3, 6, 7, .13) 42%, rgba(3, 6, 7, .78)),
    url('../assets/backgrounds/commander-arena-table.jpg') center / cover no-repeat,
    var(--v3-bg) !important;
}

#game .mobileviewtabs { display: none; }

#game .arenaheader {
  grid-area: topbar;
  min-width: 0;
  min-height: 58px;
  padding: 7px calc(var(--v3-rail) + 10px) 7px 16px !important;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(var(--ds-table-rgb), .92) !important;
  border-bottom: 1px solid rgba(var(--ds-accent-soft-rgb), .16) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3) !important;
  backdrop-filter: blur(17px) saturate(.9);
}

#game .arenaheader .phasewrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
}

#game .arenaheader .phase {
  min-width: 214px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #9da5a2;
  font: 600 10px/1 var(--ds-font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
}

#game .arenaheader .phase b {
  display: inline !important;
  margin: 0 !important;
  color: var(--v3-text) !important;
  font: 400 17px/1 var(--ds-font-display) !important;
  letter-spacing: 0 !important;
  text-transform: none;
}

#game .arenaheader .phase span::before,
#game .arenaheader .phase em::before { content: '/'; margin-right: 8px; color: var(--ds-muted); }
#game .arenaheader .phase em { color: var(--v3-gold-bright); font-style: normal; }

#game .arenaheader .stepper { min-width: 0; flex: 1; display: flex; justify-content: center; gap: 3px; }
#game .arenaheader .stepper .step {
  min-width: 30px !important;
  height: 28px;
  padding: 0 8px !important;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  background: rgba(255, 255, 255, .016) !important;
  border: 1px solid rgba(var(--ds-accent-soft-rgb), .09) !important;
  border-radius: 5px !important;
  font: 800 8px/1 var(--ds-font-display);
  letter-spacing: .08em;
}
#game .arenaheader .stepper .step.on {
  min-width: 48px !important;
  color: var(--ds-accent-ink) !important;
  background: linear-gradient(180deg, var(--ds-accent-bright), var(--ds-accent)) !important;
  border-color: var(--ds-accent-bright) !important;
  transform: none !important;
  box-shadow: 0 6px 20px rgba(var(--ds-accent-rgb), .22) !important;
}

#game .arenaheader .topbtns { flex: 0 0 auto; gap: 6px; }
#game .arenaheader .hudaction {
  min-width: 64px;
  min-height: 44px;
  padding: 0 12px !important;
  color: #b8bfbc !important;
  background: rgba(255, 255, 255, .025) !important;
  border: 1px solid rgba(var(--ds-accent-soft-rgb), .18) !important;
  border-radius: 7px !important;
  font: 800 8px/1 var(--ds-font-display) !important;
  letter-spacing: .13em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#game .arenaheader .hudaction > .gameicon { width: 15px; height: 15px; color: var(--v3-gold); }
#game .arenaheader .hudaction:hover,
#game .arenaheader .hudaction.on,
#game .arenaheader .hudaction.armed { color: var(--v3-gold-bright) !important; border-color: rgba(var(--ds-accent-rgb), .62) !important; background: rgba(var(--ds-accent-rgb), .09) !important; }
#game .arenaheader .menubutton::before { display: none; }

#game .arenaheader .monarchstatus {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 5px 9px !important;
  border-radius: 7px !important;
}
#game .arenaheader .monarchstatus > span { display: grid; place-items: center; font-size: 21px !important; }
#game .arenaheader .monarchstatus .gameicon { width: 21px; height: 21px; }
#game .arenaheader .monarchstatus > div { display: flex; flex-direction: column; }

#game .politicsstatus {
  flex: 0 0 auto;
  min-width: 126px;
  min-height: 44px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9d2cf;
  background: linear-gradient(180deg, rgba(40, 64, 58, .66), rgba(12, 24, 22, .9));
  border: 1px solid rgba(110, 171, 148, .42);
  border-radius: 7px;
  cursor: pointer;
}
#game .politicsstatus:hover,
#game .politicsstatus.ready { border-color: rgba(136, 203, 177, .72); background: linear-gradient(180deg, rgba(51, 80, 71, .78), rgba(13, 28, 25, .94)); }
#game .politicsstatus.incoming { border-color: var(--v3-gold-bright); box-shadow: 0 0 0 2px rgba(var(--ds-accent-rgb), .12), 0 0 24px rgba(var(--ds-accent-rgb), .16); }
#game .politicsstatus.locked { opacity: .82; }
#game .politicsstatus > span { font-size: 19px; }
#game .politicsstatus .gameicon { width: 19px; height: 19px; }
#game .politicsstatus > div { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
#game .politicsstatus small { color: #7da495; font: 800 6px/1 var(--ds-font-display); letter-spacing: .12em; }
#game .politicsstatus b { color: #eef3f0; font: 800 8px/1 var(--ds-font-display); letter-spacing: .1em; }

#game .opprow.has-effects { border-top-color: rgba(var(--ds-accent-rgb), .64) !important; }
#game .meinfo.has-effects { border-color: rgba(var(--ds-accent-rgb), .52); }
#game .opphead .tbtn.small { width: 36px; min-height: 36px; }
#game .opplife,
#game .melife { min-height: 36px; display: inline-flex; align-items: center; }
#game .zbtn { min-width: 40px; min-height: 36px; }
#game .activeaitag {
  position: absolute;
  z-index: 4;
  width: max-content;
  white-space: nowrap;
}
@media (min-width: 1025px) {
  #game .opprow.activeai .personachip { display: none; }
  #game .opprow.activeai .activeaitag {
    position: static;
    grid-area: persona;
    justify-self: start;
    padding: 2px 5px;
    box-shadow: none;
  }
}
#game .playereffectsbadge {
  min-width: 0;
  min-height: 22px;
  margin-left: 4px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ds-accent-bright);
  background: rgba(90, 62, 23, .44);
  border: 1px solid rgba(var(--ds-accent-rgb), .54);
  border-radius: 999px;
  vertical-align: middle;
  cursor: pointer;
}
#game .playereffectsbadge:hover { background: rgba(120, 83, 31, .58); border-color: #e8bb76; }
#game .playereffectsbadge > span { font-size: 10px; }
#game .playereffectsbadge > span .gameicon { width: 10px; height: 10px; }
#game .playereffectsbadge > b { color: #fff1d4; font: 800 8px/1 var(--ds-font-display); }
#game .playereffectsbadge > small { color: #b99a69; font: 800 6px/1 var(--ds-font-display); letter-spacing: .08em; }
#game .playereffectsbadge.mine { min-height: 34px; margin: 0; padding-inline: 8px; }

#game .playerstatuspanel {
  flex: 0 0 auto;
  margin: 8px 0 10px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(23, 31, 30, .96), rgba(var(--ds-panel-rgb), .96));
  border: 1px solid rgba(var(--ds-accent-rgb), .32);
  border-radius: 9px;
}
#game .playerstatushead {
  min-height: 38px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ddb366;
  border-bottom: 1px solid rgba(var(--ds-accent-rgb), .16);
  font: 800 8px/1 var(--ds-font-display);
  letter-spacing: .13em;
}
#game .playerstatushead b {
  min-width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  color: var(--ds-accent-ink);
  background: #e5b86f;
  border-radius: 50%;
  font-size: 8px;
}
#game .playerstatuslist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 9px; }
#game .playerstatusitem {
  min-width: 0;
  min-height: 74px;
  padding: 9px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  color: #dbe2df;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(var(--ds-accent-soft-rgb), .12);
  border-radius: 7px;
}
#game .playerstatusitem.kind-choice { border-color: rgba(var(--ds-accent-rgb), .28); }
#game .playerstatusitem.kind-agreement { border-color: rgba(110, 171, 148, .34); }
#game .playerstatusicon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ds-accent-bright);
  background: rgba(var(--ds-accent-rgb), .09);
  border: 1px solid rgba(var(--ds-accent-rgb), .2);
  border-radius: 50%;
  font-size: 14px;
}
#game .playerstatusitem > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#game .playerstatusitem b { color: #f2eee4; font: 700 11px/1.2 var(--ds-font-body); }
#game .playerstatusitem p { margin: 0; color: #9da9a6; font: 500 10px/1.35 var(--ds-font-body); }
#game .playerstatusitem small { color: #c39e66; font: 800 7px/1.2 var(--ds-font-display); letter-spacing: .08em; }
#game .playerstatusitem em { color: var(--ds-muted); font: 600 8px/1.2 var(--ds-font-body); font-style: normal; }
#game .playerstatusnone { padding: 14px; color: #76817e; font-size: 10px; }

#game .utilityrail {
  position: fixed !important;
  z-index: 28 !important;
  top: 58px;
  right: 0;
  bottom: 0;
  width: var(--v3-rail);
  padding: 12px 5px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(var(--ds-table-rgb), .92);
  border-left: 1px solid rgba(var(--ds-accent-soft-rgb), .14);
  backdrop-filter: blur(15px);
}

#game .utilitybutton {
  position: relative;
  width: 44px;
  min-height: 56px;
  padding: 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #78817f;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}
#game .utilitybutton .utilityicon { color: #9b8a68; font: 400 18px/1 var(--ds-font-display); }
#game .utilitybutton .utilityicon .gameicon { width: 19px; height: 19px; }
#game .utilitybutton .utilitylabel { font: 800 7px/1 var(--ds-font-display); letter-spacing: .1em; text-transform: uppercase; }
#game .utilitybutton b {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  color: var(--ds-accent-ink);
  background: var(--v3-gold-bright);
  border-radius: 50%;
  font: 800 7px/1 var(--ds-font-display);
}
#game .utilitybutton:hover,
#game .utilitybutton.on { color: var(--v3-gold-bright); background: rgba(var(--ds-accent-rgb), .08); border-color: rgba(var(--ds-accent-rgb), .3); }
#game .utilitybutton:hover .utilityicon,
#game .utilitybutton.on .utilityicon { color: var(--v3-gold-bright); }

#game .oppsizebar,
#game .oppresize { display: none !important; }

#game .playerrail {
  position: sticky;
  right: 0;
  z-index: 5;
  margin-left: auto;
  padding-left: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  background: linear-gradient(90deg, transparent, rgba(5, 9, 10, .94) 12px);
}

#game .landstrip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
}

#game .librarytoppeek {
  width: 220px;
  min-height: 58px;
  padding: 4px 8px 4px 4px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: #cbd3d0;
  text-align: left;
  background: linear-gradient(120deg, rgba(22, 31, 30, .97), rgba(8, 13, 14, .98));
  border: 1px solid rgba(132, 158, 143, .38);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
#game .librarytoppeek:hover,
#game .librarytoppeek:focus-visible { border-color: rgba(190, 216, 201, .7); outline: 0; box-shadow: 0 0 0 2px rgba(132, 158, 143, .16), 0 10px 28px rgba(0, 0, 0, .32); }
#game .librarytoppeek.playable { border-color: rgba(105, 193, 122, .78); box-shadow: 0 0 0 1px rgba(105, 193, 122, .14), 0 0 22px rgba(59, 148, 78, .2); }
#game .librarytoppeek.used { border-color: rgba(183, 143, 80, .46); }
#game .librarytoppeek img { width: 42px; height: 50px; object-fit: cover; object-position: center 18%; border-radius: 5px; }
#game .librarytoppeek > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#game .librarytoppeek small { color: #82918c; font: 800 7px/1 var(--ds-font-display); letter-spacing: .16em; }
#game .librarytoppeek b { overflow: hidden; color: #f0f2ed; font: 600 11px/1.1 var(--ds-font-body); text-overflow: ellipsis; white-space: nowrap; }
#game .librarytoppeek em { color: #8ec99a; font: 800 7px/1 var(--ds-font-display); font-style: normal; letter-spacing: .1em; }
#game .librarytoppeek.used em { color: #c7a469; }
#game .librarytoppeek i { overflow: hidden; color: var(--ds-muted); font: 500 8px/1.1 var(--ds-font-body); text-overflow: ellipsis; white-space: nowrap; }

body.game-active .toastmsg,
body:has(#game .overlay) .toastmsg {
  top: 74px;
  bottom: auto;
}

#game .sidebar {
  position: fixed !important;
  z-index: 30 !important;
  top: 58px !important;
  right: var(--v3-rail) !important;
  bottom: 0 !important;
  width: min(370px, calc(100 * var(--vwu) - var(--v3-rail))) !important;
  max-width: none !important;
  padding: 0 12px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 9px !important;
  overflow-y: auto !important;
  background: rgba(7, 11, 12, .98) !important;
  border: 0 !important;
  border-left: 1px solid rgba(var(--ds-accent-soft-rgb), .16) !important;
  box-shadow: -28px 0 75px rgba(0, 0, 0, .5) !important;
  transform: translateX(calc(100% + var(--v3-rail) + 4px));
  transition: transform .24s ease;
  backdrop-filter: blur(20px);
}

#game.sidebar-open .sidebar { transform: translateX(0); }
#game.nosidebar .sidebar { display: flex !important; }

#game .utilitydrawerhead {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 66px;
  margin: 0 -12px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 11, 12, .98);
  border-bottom: 1px solid var(--v3-line);
}
#game .utilitydrawerhead > div { display: flex; flex-direction: column; gap: 5px; }
#game .utilitydrawerhead span { color: var(--v3-gold); font: 800 7px/1 var(--ds-font-display); letter-spacing: .18em; text-transform: uppercase; }
#game .utilitydrawerhead b { color: var(--v3-text); font: 400 18px/1 var(--ds-font-display); }
#game .utilitydrawerclose,
#game .quickmenuclose {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #aeb6b4;
  background: var(--ds-dialog);
  border: 1px solid var(--v3-line);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
#game .sidebartabs { position: sticky; top: 66px; z-index: 2; display: flex; padding: 8px 0; background: rgba(7, 11, 12, .98); }
#game .sidebartab { min-height: 44px; flex: 1; color: #77817f; background: transparent; border: 0; border-bottom: 1px solid #232c2d; font: 800 8px/1 var(--ds-font-display); letter-spacing: .13em; cursor: pointer; }
#game .sidebartab.on { color: var(--v3-gold-bright); border-bottom-color: var(--v3-gold); }
#game .stackpanel,
#game .cmddmgpanel,
#game .threatpanel,
#game .sidelog { flex: 0 0 auto !important; border-radius: 8px !important; background: #0c1213 !important; }
#game .diplomacylog { flex: 1 1 auto !important; min-height: 0; }
#game .threatrow {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 70px 30px;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border-radius: 5px;
  font-size: 11px;
}
#game .tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#game .tbarwrap { display: block; height: 7px; overflow: hidden; }
#game .tbar { display: block; height: 100%; }
#game .tscore { text-align: right; font-size: 10px; }

#game .quickmenuov {
  position: fixed !important;
  inset: 0;
  z-index: 145 !important;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(7px);
}
body:has(#game .quickmenuov) > .effectnoticestack,
body:has(#game .quickmenuov) > .spellcopynoticestack,
body:has(#game .quickmenuov) > .toastmsg {
  visibility: hidden;
}
body:has(#game .lastresortconfirm) > .effectnoticestack,
body:has(#game .lastresortconfirm) > .spellcopynoticestack,
body:has(#game .lastresortconfirm) > .toastmsg,
body:has(#game.last-resort-active .overlay) > .effectnoticestack,
body:has(#game.last-resort-active .overlay) > .spellcopynoticestack,
body:has(#game.last-resort-active .overlay) > .toastmsg {
  visibility: hidden;
}
#game .quickmenu {
  width: min(440px, 100%);
  max-height: min(680px, calc(100 * var(--dvhu) - 36px));
  overflow: auto;
  background: linear-gradient(145deg, var(--ds-dialog), #080c0d);
  border: 1px solid rgba(var(--ds-accent-rgb), .34);
  border-radius: 13px;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .72);
}
#game .quickmenuhead { padding: 19px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--v3-line); }
#game .quickmenuhead span { color: var(--v3-gold); font: 800 8px/1 var(--ds-font-display); letter-spacing: .18em; text-transform: uppercase; }
#game .quickmenuhead h2 { margin: 6px 0 0; color: var(--v3-text); font: 400 24px/1 var(--ds-font-display); }
#game .quickmenulist { padding: 7px; }
#game .quickmenuitem {
  width: 100%;
  min-height: 56px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #d9dfdc;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #192122;
  text-align: left;
  cursor: pointer;
}
#game .quickmenuitem:hover { background: rgba(var(--ds-accent-rgb), .07); }
#game .quickmenuitem span { font: 600 12px/1.2 var(--ds-font-body); }
#game .quickmenuitem small { color: #74807d; font: 600 9px/1.2 var(--ds-font-display); text-align: right; }
#game .quickmenuitem.lastresortmenu { color: #f2c1ae; border: 1px solid rgba(221, 83, 48, .24); background: rgba(123, 31, 20, .12); }
#game .quickmenuitem.lastresortmenu:hover,
#game .quickmenuitem.lastresortmenu.active { background: rgba(164, 46, 27, .26); border-color: rgba(255, 115, 77, .52); }
#game .quickmenuitem.lastresortmenu small { color: #d9866d; }
#game .lastresortbutton,
#game .lastresortbutton.on { color: #ffe0d4; border-color: rgba(255, 105, 68, .75); background: rgba(129, 34, 20, .55); box-shadow: 0 0 22px rgba(235, 67, 34, .2); }
#game.last-resort-active .arenaheader { border-bottom-color: rgba(255, 100, 65, .5); box-shadow: inset 0 -2px rgba(184, 50, 27, .22); }

@media (min-width: 1280px) {
  #game {
    position: relative;
    isolation: isolate;
    width: 100% !important;
    max-width: none !important;
    height: calc(100 * var(--dvhu)) !important;
    min-height: 620px;
    margin: 0 !important;
    padding: 0 var(--v3-rail) 0 0 !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 58px 24px minmax(150px, .72fr) auto minmax(166px, 1fr) auto 132px !important;
    grid-template-areas: "topbar" "ticker" "opps" "center" "mine" "prompt" "hand" !important;
    row-gap: 0 !important;
    column-gap: 0 !important;
  }
  #game::before { left: 12px !important; right: calc(var(--v3-rail) + 12px) !important; top: 82px !important; bottom: 126px !important; }
  #game .ticker { grid-area: ticker; padding: 0 16px !important; font-size: 10px !important; }
  #game .oppsouter { grid-area: opps; min-height: 0; padding: 8px 10px 0 12px !important; }
  #game .oppswrap,
  #game .oppswrap.active-ai-turn { min-height: 0; height: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
  #game .opprow,
  #game .oppswrap.active-ai-turn .opprow { min-height: 0; border-radius: 8px !important; }
  #game .opphead { min-height: 48px !important; padding: 5px 7px !important; }
  #game .activeaitag { top: 47px !important; }
  #game .oppstrip { padding-top: 17px !important; }
  #game .center { grid-area: center; min-height: 0; padding: 2px 10px 2px 12px !important; }
  #game .myboard { grid-area: mine; min-height: 0; margin: 0 10px 0 12px !important; padding: 27px 10px 6px 16px !important; border-radius: 8px !important; }
  #game .myboard::before { top: 8px; left: 16px; content: 'YOUR BATTLEFIELD' !important; }
  #game .cardrow { min-height: 100px !important; }
  #game .landrow { min-height: 42px !important; }
  #game .promptbar {
    grid-area: prompt;
    min-height: 48px;
    margin: 0 10px 0 12px !important;
    padding: 7px 10px !important;
    border: 1px solid rgba(var(--ds-accent-rgb), .25) !important;
    border-radius: 8px 8px 0 0 !important;
    background: rgba(9, 14, 15, .94) !important;
    box-shadow: 0 -14px 34px rgba(0, 0, 0, .32) !important;
  }
  #game .promptbar .ptext { color: #c3cbc8; font-size: 11px !important; }
  #game .promptbar .btnrow { margin-top: 3px; }
  #game .promptbar .pbtn { min-height: 34px; padding: 7px 12px; border-radius: 6px !important; font-size: 10px; }
  #game .handwrap { grid-area: hand; padding: 8px 14px 5px !important; }
  #game .hand { min-height: 116px !important; height: 116px; padding: 0 50px !important; gap: 8px !important; }
  #game .hcard { width: 81px !important; height: 112px !important; }
}

@media (min-width: 1280px) and (max-height: 700px) {
  #game {
    grid-template-rows: 58px 20px minmax(118px, .55fr) auto minmax(210px, 1fr) auto 108px !important;
  }
  #game::before { top: 78px !important; bottom: 104px !important; }
  #game .oppsouter { padding-top: 5px !important; }
  #game .opphead { min-height: 44px !important; }
  #game .oppstrip { padding-top: 12px !important; }
  #game .mini.sm { width: calc(48px * var(--opp-scale, 1)) !important; height: calc(65px * var(--opp-scale, 1)) !important; }
  #game .permanentpile.sm { width: calc(48px * var(--opp-scale, 1)) !important; }
  #game .myboard { padding: 24px 10px 4px 16px !important; }
  #game .myboard::before { top: 7px; }
  #game .cardrow { min-height: 78px !important; }
  #game .mini { width: 58px; height: 78px; }
  #game .permanentpile { width: 58px; }
  #game .landrow { min-height: 38px !important; }
  #game .landrow:has(.playerrail.has-library-top) { min-height: 48px !important; flex-shrink: 0; }
  #game .librarytoppeek { width: 200px; min-height: 44px; padding: 2px 6px 2px 2px; grid-template-columns: 34px minmax(0, 1fr); gap: 6px; }
  #game .librarytoppeek img { width: 34px; height: 38px; }
  #game .librarytoppeek > span { gap: 2px; }
  #game .librarytoppeek i { display: none; }
  #game .czrow { padding-top: 1px; }
  #game .czcard { min-height: 44px; }
  #game .czcard > img { width: 31px; height: 42px; }
  #game .promptbar { padding-block: 5px !important; }
  #game .handwrap { padding: 6px 12px 3px !important; }
  #game .hand { min-height: 96px !important; height: 96px; padding-inline: 38px !important; }
  #game .hcard { width: 68px !important; height: 94px !important; }
  #game .sheetimg:not(.noimg) { width: min(30 * var(--vhu), 200px); max-height: 280px; object-fit: contain; }
}

@media (min-width: 768px) and (max-width: 1279px) {
  #game {
    width: 100% !important;
    max-width: none !important;
    height: calc(100 * var(--dvhu)) !important;
    margin: 0 !important;
    padding: 0 var(--v3-rail) 0 0 !important;
    overflow: hidden !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 58px 24px minmax(145px, .75fr) auto minmax(170px, 1fr) auto 130px !important;
    grid-template-areas: "topbar" "ticker" "opps" "center" "mine" "prompt" "hand" !important;
  }
  #game .arenaheader .phase { min-width: 180px; }
  #game .arenaheader .stepper .step { min-width: 27px !important; padding-inline: 6px !important; }
  #game .arenaheader .hudaction { min-width: 56px; padding-inline: 8px !important; }
  #game .ticker { grid-area: ticker; }
  #game .oppsouter { grid-area: opps; min-height: 0; padding: 7px 8px 0 !important; }
  #game .oppswrap,
  #game .oppswrap.active-ai-turn { min-height: 0; max-height: none !important; height: 100%; padding: 0 !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; overflow: hidden; }
  #game .opprow { min-width: 0; height: 100%; }
  #game .opphead {
    display: grid;
    grid-template-columns: 10px 23px minmax(56px, 1fr) auto 36px;
    grid-template-areas: "chev seat name name info" "chev seat meta life cmd";
  }
  #game .opphead .chev { grid-area: chev; }
  #game .seatindex { grid-area: seat; }
  #game .oppname { grid-area: name; }
  #game .opplife { grid-area: life; }
  #game .oppmeta { grid-area: meta; }
  #game .oppcmd { grid-area: cmd; }
  #game .opphead .tbtn.small { grid-area: info; }
  #game .opphead .personachip { display: none; }
  #game .oppname { font-size: 10px; }
  #game .oppmeta { justify-self: start; }
  #game .opplife { font-size: 17px; }
  #game .opphead .tbtn.small { width: 36px; min-height: 36px; }
  #game .activeaitag { top: 68px; left: 8px; }
  #game .center { grid-area: center; min-height: 0; }
  #game .myboard { grid-area: mine; min-height: 0; margin: 0 8px; padding: 25px 8px 5px !important; }
  #game .promptbar { grid-area: prompt; margin: 0 8px; padding: 6px 8px; }
  #game .handwrap { grid-area: hand; padding: 7px 9px; }
  #game .hand { min-height: 112px; height: 112px; }
  #game .hcard { width: 80px; height: 108px; }
}

@media (min-width: 768px) and (max-width: 1279px) and (max-height: 760px) {
  #game .landrow:has(.playerrail.has-library-top) { min-height: 48px !important; flex-shrink: 0; }
  #game .librarytoppeek { width: 210px; min-height: 46px; padding: 2px 6px 2px 2px; grid-template-columns: 36px minmax(0, 1fr); gap: 6px; }
  #game .librarytoppeek img { width: 36px; height: 40px; }
  #game .librarytoppeek > span { gap: 2px; }
  #game .librarytoppeek i { display: none; }
}

@media (max-width: 767px) {
  #game {
    --v3-rail: 0px;
    width: 100% !important;
    max-width: none !important;
    height: calc(100 * var(--dvhu)) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 76px 48px 108px minmax(158px, 1fr) auto 130px !important;
    grid-template-areas: "topbar" "tabs" "opps" "mine" "prompt" "hand" !important;
    background-position: 50% 50% !important;
  }
  #game::before,
  #game::after { display: none !important; }
  #game .arenaheader { min-height: 76px; padding: 7px 8px !important; flex-wrap: wrap; align-content: center; gap: 5px; }
  #game .arenaheader .phasewrap { width: 100%; flex: 1 1 100%; gap: 6px; flex-wrap: wrap; }
  #game .arenaheader .phase { min-width: 0; flex: 1; font-size: 8px; gap: 5px; }
  #game .arenaheader .phase { flex: 0 1 calc(100% - 256px); padding-right: 0; overflow: hidden; }
  #game .arenaheader .phase b { flex: 0 0 auto; }
  #game .arenaheader .phase em { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #game .arenaheader .phase span::before,
  #game .arenaheader .phase em::before { margin-right: 5px; }
  #game .arenaheader .phase b { font-size: 14px !important; }
  #game .arenaheader .stepper { order: 3; flex: 1 1 100%; justify-content: stretch; }
  #game .arenaheader .stepper { margin-top: 23px; }
  #game .arenaheader .stepper .step { min-width: 0 !important; height: 20px; flex: 1; padding: 0 2px !important; font-size: 7px; border-radius: 3px !important; }
  #game .arenaheader .stepper .step.on { min-width: 0 !important; }
  #game .arenaheader .topbtns { position: absolute; top: 5px; right: 7px; gap: 4px; }
  #game .arenaheader .hudaction { min-width: 44px; min-height: 44px; padding: 0 6px !important; font-size: 6.5px !important; }
  #game .arenaheader .menubutton::before { display: none; }
  #game .arenaheader .monarchstatus { position: absolute; top: 4px; right: 151px; padding: 3px 5px !important; }
  #game .arenaheader .monarchstatus small { display: none; }
  #game .arenaheader .monarchstatus > span { font-size: 17px !important; }
  #game .politicsstatus { display: none !important; }

  #game .ticker { display: none !important; }
  #game .mobileviewtabs {
    grid-area: tabs;
    display: flex;
    padding: 5px 8px 0;
    background: rgba(var(--ds-table-rgb), .9);
    border-bottom: 1px solid var(--v3-line-soft);
  }
  #game .mobileviewtab { min-height: 44px; flex: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--ds-muted); background: transparent; border: 0; border-bottom: 2px solid transparent; font: 800 8px/1 var(--ds-font-display); letter-spacing: .13em; }
  #game .mobileviewtab .gameicon { width: 13px; height: 13px; margin-right: 5px; color: currentColor; }
  #game .mobileviewtab.on { color: var(--v3-gold-bright); border-bottom-color: var(--v3-gold); }
  #game .mobileviewtab.politics { color: #7da495; }
  #game .mobileviewtab.politics.on { color: #bce1d1; border-bottom-color: #6eab94; }
  #game .utilityrail { display: none !important; }

  #game .oppsouter { grid-area: opps; min-height: 0; padding: 6px 8px !important; overflow: hidden; }
  #game .oppswrap,
  #game .oppswrap.active-ai-turn { min-height: 0; max-height: none !important; height: 100%; padding: 0 !important; display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 6px; overflow-y: auto !important; }
  #game .opprow,
  #game .oppswrap.active-ai-turn .opprow { min-height: 98px; height: auto; }
  #game .oppswrap:has(.opprow.active) .opprow.active { order: -1; }
  #game:not(.command-table)[data-mobile-view="mine"] .oppswrap:has(.opprow.active) .opprow:not(.active),
  #game:not(.command-table)[data-mobile-view="mine"] .oppswrap:not(:has(.opprow.active)) .opprow:not(:first-child) { display: none !important; }
  #game .opphead {
    min-height: 44px !important;
    padding: 4px 6px !important;
    grid-template-areas: "chev seat name life info" "chev seat meta meta cmd";
  }
  #game .opphead .personachip { display: none; }
  #game .oppmeta { justify-self: start; }
  #game .opphead .tbtn.small { width: 44px; min-height: 44px; }
  #game .opplife { min-height: 44px; display: inline-flex; align-items: center; }
  #game .oppstrip { min-height: 53px !important; padding: 4px 6px 5px !important; }
  #game .mini.sm { width: 38px !important; height: 51px !important; }
  #game .oppsizebar { display: none !important; }
  #game .activeaitag { top: 37px; left: 6px; padding: 2px 5px; font-size: 6px; }
  #game .center { display: none !important; }
  #game .myboard { grid-area: mine; min-height: 0; margin: 0 8px !important; padding: 24px 7px 5px !important; justify-content: flex-start; overflow-y: auto !important; overscroll-behavior: contain; border-radius: 7px !important; }
  #game .myboard::before { top: 7px; left: 8px; content: 'YOUR BATTLEFIELD' !important; font-size: 7px; }
  #game .cardrow { min-height: 87px; flex-shrink: 0; }
  #game .mini { width: 58px; height: 78px; }
  #game .landrow { min-height: 52px; flex-shrink: 0; }
  #game .playerrail { padding-left: 5px; gap: 5px; }
  #game .landrow:has(.playerrail.has-library-top) { flex-direction: column; align-items: stretch; overflow-x: visible; }
  #game .landrow:has(.playerrail.has-library-top) .landstrip { width: 100%; flex: 0 0 auto; }
  #game .playerrail.has-library-top { width: 100%; padding-left: 0; flex-direction: column; align-items: stretch; background: none; }
  #game .playerrail.has-library-top .meinfo { width: 100%; margin-left: 0; justify-content: space-between; }
  #game .librarytoppeek { width: 100%; min-height: 52px; grid-template-columns: 36px minmax(0, 1fr); gap: 6px; padding: 3px 6px 3px 3px; }
  #game .librarytoppeek img { width: 36px; height: 44px; }
  #game .librarytoppeek b { font-size: 9px; }
  #game .librarytoppeek i { display: none; }
  #game .zbtns { display: flex; gap: 4px; }
  #game .zbtns .zbtn { min-width: 44px; min-height: 44px; padding-inline: 5px; }
  #game .czrow { flex-shrink: 0; }
  #game .czcard { flex-basis: 210px; min-height: 48px; }
  #game .meinfo { gap: 7px !important; align-items: center !important; padding: 5px 7px !important; }
  #game .playereffectsbadge.mine > small { display: none; }
  #game .seatyou { width: 31px; height: 31px; display: grid !important; place-content: center; }
  #game .seatyou span,
  #game .seatyou small { display: block; text-align: center; }
  #game .melife { display: flex !important; align-items: end !important; gap: 3px !important; font-size: 30px !important; }
  #game .melife small { padding-bottom: 3px; }
  #game .promptbar {
    grid-area: prompt;
    z-index: 8;
    min-height: 54px;
    max-height: calc(34 * var(--dvhu));
    margin: 0 8px !important;
    padding: 7px 8px !important;
    overflow-y: auto;
    border: 1px solid rgba(var(--ds-accent-rgb), .28) !important;
    border-radius: 8px 8px 0 0 !important;
    background: rgba(8, 13, 14, .97) !important;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .44) !important;
  }
  #game .promptbar .ptext { font-size: 10px; }
  #game .promptbar .pbtn { min-height: 44px; padding: 8px 10px; font-size: 10px; }
  #game .sheet .pbtn { min-height: 44px; }
  #game .promptbar .btnrow { flex-wrap: wrap; gap: 5px; }
  #game .handwrap { grid-area: hand; min-height: 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)) !important; }
  #game .hand { min-height: 114px; height: 114px; padding: 0 !important; gap: 6px; }
  #game .hcard { width: 78px; height: 108px; }
  #game .playerstatuslist { grid-template-columns: minmax(0, 1fr); }
  body.game-active .toastmsg,
  body:has(#game .overlay) .toastmsg { top: 128px; bottom: auto; }
  .effectnoticestack,
  .spellcopynoticestack {
    left: 8px;
    right: 8px;
    top: 128px;
    bottom: auto;
    z-index: 160;
    width: auto;
    max-width: none;
    gap: 5px;
  }
  .effectnotice { padding: 9px 11px; font-size: 10px; }
  .spellcopynotice { min-height: 72px; }
  body:has(.spellcopynoticestack) .effectnoticestack { top: 208px; }

  #game[data-mobile-view="table"] {
    grid-template-rows: 76px 48px minmax(0, 1fr) auto !important;
    grid-template-areas: "topbar" "tabs" "opps" "prompt" !important;
  }
  #game[data-mobile-view="table"] .myboard,
  #game[data-mobile-view="table"] .handwrap { display: none !important; }
  #game[data-mobile-view="table"] .oppswrap { align-content: start; grid-auto-rows: 150px; }
  #game[data-mobile-view="table"] .opprow {
    display: flex !important;
    flex-direction: column !important;
    min-height: 150px;
    height: auto !important;
  }
  #game[data-mobile-view="table"] .opphead { width: 100%; flex: 0 0 auto; }
  #game[data-mobile-view="table"] .oppstrip { width: 100%; flex: 1 1 auto; }
  #game[data-mobile-view="table"] .oppresourcelane {
    flex-basis: 78px;
    min-width: 78px;
    max-width: 78px;
  }

  #game[data-mobile-view="stack"] {
    grid-template-rows: 76px 48px minmax(0, 1fr) auto !important;
    grid-template-areas: "topbar" "tabs" "stack" "prompt" !important;
  }
  #game[data-mobile-view="stack"] .oppsouter,
  #game[data-mobile-view="stack"] .myboard,
  #game[data-mobile-view="stack"] .handwrap { display: none !important; }
  #game[data-mobile-view="stack"] .sidebar {
    grid-area: stack;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 2 !important;
    width: 100% !important;
    min-height: 0;
    padding: 0 10px 12px !important;
    transform: none !important;
    box-shadow: none !important;
  }
  #game[data-mobile-view="stack"] .utilitydrawerclose { display: none; }

  #game .sidebar {
    top: 0 !important;
    right: 0 !important;
    z-index: 130 !important;
    width: min(390px, 100 * var(--vwu)) !important;
    transform: translateX(104%);
  }
  #game.sidebar-open:not([data-mobile-view="stack"]) .sidebar { transform: translateX(0); }
  #game .quickmenuov { align-items: end; padding: 0; }
  #game .quickmenu { width: 100%; max-height: calc(84 * var(--dvhu)); border-radius: 14px 14px 0 0; }
  #game .quickmenuitem { min-height: 54px; }
}

@media (max-width: 420px) {
  #setup .setupright { background: var(--ds-panel) !important; }
  #setup .botconfig { width: 100%; min-width: 0; max-width: 100%; }
  #setup .botstylerow {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center;
  }
  #setup .botidentity { min-width: 0 !important; }
  #setup .botfields { grid-column: 1 / -1; width: 100%; min-width: 0; }
  #setup .botfield { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 4px !important; }
  #setup .botfield .styleselect { width: 100% !important; max-width: none !important; }
  #game .arenaheader .phase { flex-basis: calc(100% - 230px); }
  #game .arenaheader .phase span { display: none; }
  #game .arenaheader .phase em::before { content: '/'; }
  #game .arenaheader .hudaction { min-width: 44px; }
  #game .arenaheader .monarchstatus { display: none; }
}

@media (max-width: 420px) and (max-height: 700px) {
  #game .sheetimg:not(.noimg) { width: min(46 * var(--vwu), 150px); max-height: 210px; object-fit: contain; }
  #game .myboard:has(.playerrail.has-library-top) { padding-top: 20px !important; }
  #game .myboard:has(.playerrail.has-library-top) .landrow { order: -1; }
  #game .myboard:has(.playerrail.has-library-top) .playerrail { order: -1; }
}

@media (max-width: 767px) and (max-height: 700px) {
  #game:not(.command-table)[data-mobile-view="mine"]:has(.promptbar .btnrow .pbtn) {
    grid-template-rows: 76px 48px 96px minmax(112px, 1fr) 96px 108px !important;
  }
  #game:has(.promptbar .btnrow .pbtn) .opprow,
  #game:has(.promptbar .btnrow .pbtn) .oppswrap.active-ai-turn .opprow { min-height: 84px; }
  #game:has(.promptbar .btnrow .pbtn) .promptbar { min-height: 96px; max-height: 96px; }
  #game:has(.promptbar .btnrow .pbtn) .handwrap { padding-top: 5px !important; padding-bottom: 3px !important; }
  #game:has(.promptbar .btnrow .pbtn) .hand { min-height: 98px; height: 98px; }
  #game:has(.promptbar .btnrow .pbtn) .hcard { width: 70px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  #game .sidebar { transition: none; }
}

/* COMMANDER LIVE — the same warm brass / black-green war-room system as the
   existing setup and battlefield, with room state kept visually explicit. */
#setup .matchtype {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(var(--ds-accent-rgb), .22);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(20, 27, 25, .9), rgba(7, 11, 12, .92));
}
#setup .matchtypecopy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#setup .matchtypecopy span,
.online-section-title,
.online-lobby small,
.online-remote-game small { color: #bca172; font-size: 9px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
#setup .matchtypecopy b { color: #efe6d2; font-size: 12px; }
#setup .matchtypechoices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#setup .matchtypebtn {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 11px 12px;
  text-align: left;
  color: #a8a294;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
}
#setup .matchtypebtn strong { color: #ddd3bf; font-size: 11px; }
#setup .matchtypebtn small { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
#setup .matchtypebtn.selected { border-color: var(--ds-accent); background: rgba(var(--ds-accent-rgb), .1); box-shadow: inset 0 0 0 1px rgba(var(--ds-accent-rgb), .12); }
#setup .matchtypebtn.live strong { display: flex; align-items: center; gap: 6px; }
#setup .matchtypebtn.live i,
.online-room-state i,
.onlineseatstatus i,
.online-guest-wait i,
.online-decision.waiting i,
.online-waiting-game i,
.online-unavailable-card > i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #67bd82;
  box-shadow: 0 0 12px rgba(103, 189, 130, .8);
}
#setup .liveplayercount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(103, 189, 130, .24);
  border-radius: 8px;
  background: rgba(27, 66, 44, .12);
}
#setup .liveplayercount > span { display: grid; gap: 2px; }
#setup .liveplayercount b { color: #e7ddca; font-size: 11px; }
#setup .liveplayercount small { color: #8d978f; font-size: 9px; }
#setup .liveplayerchoices { display: flex; gap: 6px; }
#setup .liveplayerchoices .pbtn { min-width: 76px; margin: 0; padding: 8px 10px; }
#setup .liveplayerchoices .pbtn.selected { border-color: #67bd82; background: rgba(103, 189, 130, .14); }

.online-lobby,
.online-remote-game {
  min-height: calc(100 * var(--dvhu));
  padding: clamp(22px, 4 * var(--vwu), 58px);
  color: #e8deca;
  background:
    linear-gradient(rgba(4, 8, 8, .88), rgba(4, 8, 8, .94)),
    url('../assets/backgrounds/commander-war-room.jpg') center/cover fixed;
}
.online-lobby-head,
.online-game-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 22px;
  max-width: 1500px;
  margin: 0 auto 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(var(--ds-accent-rgb), .22);
}
.online-lobby-head > div:first-of-type { max-width: 760px; }
.online-lobby-head span:first-child,
.online-game-head > div > span { color: var(--ds-accent); font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.online-lobby-head h1 { margin: 8px 0 5px; color: #f5eddb; font: 42px/1.06 var(--ds-font-display); }
.online-lobby-head p { margin: 0; color: #a6a092; font-size: 13px; line-height: 1.6; }
.online-back,
.online-copy,
.online-start,
.online-choice,
.online-decision-choices select {
  min-height: 42px;
  padding: 10px 14px;
  color: #ded3be;
  font: 700 10px/1.2 var(--ds-font-body);
  letter-spacing: .04em;
  border: 1px solid rgba(var(--ds-accent-rgb), .26);
  border-radius: 6px;
  background: rgba(10, 15, 15, .9);
  cursor: pointer;
}
.online-back:hover,
.online-copy:hover,
.online-choice:hover { border-color: var(--ds-accent); }
.online-room-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #8fd0a3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  border: 1px solid rgba(103, 189, 130, .25);
  border-radius: 999px;
  background: rgba(21, 72, 42, .15);
}
.online-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  max-width: 1500px;
  margin: 0 auto 22px;
  padding: 16px 18px;
  border: 1px solid rgba(var(--ds-accent-rgb), .28);
  border-radius: 8px;
  background: rgba(14, 20, 19, .9);
}
.online-invite div { display: grid; gap: 5px; min-width: 0; }
.online-invite b { overflow: hidden; color: #f1dfbf; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.online-seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  max-width: 1500px;
  margin: 0 auto;
}
.onlineseat {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 160px;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(24, 31, 28, .96), rgba(7, 11, 12, .97));
}
.onlineseat.mine { border-color: rgba(var(--ds-accent-rgb), .6); box-shadow: 0 0 28px rgba(var(--ds-accent-rgb), .1); }
.onlineseat.bot { border-color: rgba(108, 139, 111, .28); }
.onlineseatnum { color: rgba(var(--ds-accent-rgb), .35); font: 34px/1 var(--ds-font-display); }
.onlineseatstatus { display: flex; align-items: center; gap: 6px; color: #8cc29b; font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.onlineseatstatus i { width: 5px; height: 5px; }
.onlineseat.waiting .onlineseatstatus { color: #8b877f; }
.onlineseat.waiting .onlineseatstatus i { background: #68665f; box-shadow: none; }
.onlineseat > img { width: 100%; min-height: 0; height: 160px; object-fit: cover; border-radius: 6px; filter: saturate(.8) contrast(1.05); }
.onlineseatempty { display: grid; min-height: 160px; place-items: center; color: rgba(var(--ds-accent-rgb), .35); font: 54px/1 var(--ds-font-display); border: 1px dashed rgba(var(--ds-accent-rgb), .2); border-radius: 6px; }
.onlineseatcopy { display: grid; gap: 3px; min-width: 0; }
.onlineseatcopy b { overflow: hidden; color: #f0e7d5; font: 20px/1.15 var(--ds-font-display); text-overflow: ellipsis; white-space: nowrap; }
.onlineseatcopy span { overflow: hidden; color: #aba496; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.onlineseatimported { margin-left: 6px; padding: 1px 6px; border: 1px solid rgba(224, 168, 79, .5); border-radius: 999px; color: #e8b45c; font-size: 10px; font-style: normal; letter-spacing: .04em; text-transform: uppercase; }
.online-deck-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: #e7dcc8;
  border: 1px solid rgba(var(--ds-accent-rgb), .25);
  border-radius: 5px;
  background: #0c1111;
}
.online-lobby-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1500px;
  margin: 18px auto 0;
  padding: 18px;
  border-top: 1px solid rgba(var(--ds-accent-rgb), .2);
  background: rgba(7, 11, 12, .8);
}
.online-lobby-actions > div:first-child { display: grid; gap: 3px; }
.online-lobby-actions b { color: #f0e6d2; }
.online-lobby-actions span { color: #8f897d; font-size: 10px; }
.online-start,
.online-choice.primary {
  color: var(--ds-accent-ink);
  border-color: #e4aa61;
  background: linear-gradient(135deg, #e8b46d, #b97735);
  box-shadow: 0 7px 24px rgba(var(--ds-accent-rgb), .18);
}
.online-start { min-width: 210px; min-height: 52px; }
.online-start:disabled,
.online-choice:disabled { opacity: .38; cursor: not-allowed; }
.online-guest-wait { display: flex !important; align-items: center; gap: 8px; color: #aaa295; font-size: 11px; }
.online-error { max-width: 1500px; margin: 0 auto 14px; padding: 12px 15px; color: #f0b3a5; border: 1px solid rgba(204, 83, 61, .45); background: rgba(94, 25, 18, .45); }
.online-unavailable-card,
.online-waiting-game {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 900px;
  min-height: 240px;
  margin: 80px auto;
  padding: 30px;
  text-align: left;
  border: 1px solid rgba(var(--ds-accent-rgb), .25);
  border-radius: 10px;
  background: rgba(8, 13, 13, .92);
}
.online-unavailable-card > i,
.online-waiting-game > i { width: 13px; height: 13px; }
.online-unavailable-card div { display: grid; gap: 5px; }
.online-unavailable-card b { color: #eee2cc; font-size: 17px; }
.online-unavailable-card span,
.online-waiting-game p { color: #999287; }

.online-remote-game { padding: 20px 24px 30px; }
.online-game-head { align-items: center; margin-bottom: 14px; padding-bottom: 14px; }
.online-game-head > div:first-child { display: grid; gap: 5px; }
.online-game-head b { color: #f0e7d4; font: 21px/1.1 var(--ds-font-display); }
.online-game-tools { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.online-last-resort-toggle { min-height: 40px; padding: 9px 12px; color: #e8b29f; border: 1px solid rgba(221,82,48,.5); border-radius: 6px; background: rgba(111,30,18,.38); font: 800 9px/1 var(--ds-font-body); letter-spacing: .08em; cursor: pointer; }
.online-last-resort-toggle.active { color: #ffe0d5; border-color: #ef704e; background: #762817; box-shadow: 0 0 20px rgba(222,72,38,.18); }
.online-player-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-bottom: 10px; }
.online-player { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .09); background: rgba(8, 13, 13, .9); }
.online-player.active { border-color: rgba(var(--ds-accent-rgb), .58); }
.online-player.lost { opacity: .4; }
.online-player small,
.online-player b,
.online-player span,
.online-player i { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-player b { color: #eee3ce; }
.online-player span,
.online-player i { color: #8f897e; font-size: 9px; font-style: normal; }
.online-player strong { grid-column: 2; grid-row: 1 / span 4; align-self: center; color: #f0c17e; font: 27px/1 var(--ds-font-display); }
.online-player strong em { display: block; margin-top: 3px; color: #8b7d68; font: 7px/1 var(--ds-font-body); letter-spacing: .12em; }
.online-remote-board { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 10px; min-height: 280px; }
.online-battlefield,
.online-stack,
.online-own-hand,
.online-decision { padding: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(7, 11, 12, .88); }
.online-section-title { display: flex; justify-content: space-between; margin-bottom: 9px; }
.online-card-row { display: flex; gap: 8px; min-height: 190px; padding: 4px; overflow-x: auto; }
.online-remote-card { position: relative; flex: 0 0 132px; display: grid; align-content: start; gap: 5px; color: #ded5c4; }
.online-remote-card img,
.online-card-back { width: 132px; height: 184px; object-fit: cover; border-radius: 6px; }
.online-card-back { display: grid; place-items: center; color: #b98749; font: 11px/1 var(--ds-font-display); letter-spacing: .12em; border: 1px solid #8c6335; background: radial-gradient(circle, #26342f, #090d0d 65%); }
.online-remote-card b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.online-remote-card > span { position: absolute; right: 4px; bottom: 25px; padding: 3px 5px; color: #fff; font-weight: 700; border-radius: 4px; background: rgba(0, 0, 0, .8); }
.online-remote-card.tapped img { transform: rotate(2deg); filter: brightness(.72); }
.online-stack-list { display: grid; gap: 7px; }
.online-stack-item { display: grid; gap: 2px; padding: 10px; border-left: 2px solid var(--ds-accent); background: rgba(var(--ds-accent-rgb), .06); }
.online-stack-item b { color: #eee2cd; font-size: 11px; }
.online-stack-item span,
.online-empty-stack { color: #837e75; font-size: 9px; }
.online-own-hand { margin-top: 10px; }
.online-own-hand .online-card-row { min-height: 210px; }
.online-last-resort { margin-top: 10px; padding: 14px; border: 1px solid rgba(235,99,65,.4); background: linear-gradient(145deg,rgba(71,23,16,.88),rgba(7,11,12,.94)); box-shadow: 0 14px 38px rgba(0,0,0,.28); }
.online-last-resort-head { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.online-last-resort-head > div { display: grid; gap: 4px; }
.online-last-resort-head b { color: #ffe0d4; font: 22px/1 var(--ds-font-display); }
.online-last-resort-head span,.online-last-resort-head em { color: #a9978f; font-size: 10px; font-style: normal; }
.online-last-resort-head em { max-width: 330px; padding: 8px 10px; color: #9dccc4; border-left: 2px solid #65988f; background: rgba(54,93,87,.12); }
.online-last-resort-controls { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.online-last-resort-player { min-height: 42px; padding: 8px; color: #eee1cf; border: 1px solid rgba(239,111,78,.38); background: #15100f; }
.online-last-resort-result { margin-top: 9px; padding: 8px 10px; font-size: 10px; border-left: 2px solid #6bad7d; background: rgba(73,126,86,.12); }
.online-last-resort-result.error { color: #efaa96; border-color: #d75236; background: rgba(132,42,25,.16); }
.online-decision { position: sticky; bottom: 0; z-index: 4; margin-top: 10px; box-shadow: 0 -14px 35px rgba(0, 0, 0, .38); }
.online-decision.waiting > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; }
.online-decision.waiting i { grid-row: 1 / span 3; }
.online-decision.waiting b { color: #e9deca; }
.online-decision.waiting span { color: #8d887e; font-size: 10px; }
.online-decision-head h2 { margin: 5px 0 10px; color: #f3e8d2; font: 22px/1.15 var(--ds-font-display); }
.online-decision-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.online-choice { display: grid; gap: 2px; min-width: 120px; text-align: left; }
.online-choice span { color: #8f897e; font-size: 9px; }
.online-choice.selected { border-color: #67bd82; background: rgba(103, 189, 130, .12); }
.online-decision-choices select { min-width: 180px; }
.online-number-choice { display: flex; gap: 8px; }
.online-number-choice input { width: 110px; padding: 8px; color: #f2e5cd; border: 1px solid rgba(var(--ds-accent-rgb), .3); background: #080d0d; }
.online-assignment { align-self: center; color: #b8ad9a; font-size: 10px; }

@media (max-width: 1100px) {
  .online-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-player-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-remote-board { grid-template-columns: minmax(0, 1fr); }
  .online-last-resort-controls { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 620px) {
  #setup .liveplayercount { grid-template-columns: 1fr; }
  #setup .liveplayerchoices .pbtn { flex: 1; min-width: 0; }
  .online-game-tools,.online-last-resort-head { align-items: stretch; flex-direction: column; }
  .online-last-resort-controls { grid-template-columns: 1fr; }
}

/* Battlefield zoning: combat bodies first, support to the right, mana with lands. */
#game .mybattlefieldmain {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(180px, .72fr);
  align-items: stretch;
  gap: 8px;
  overflow: hidden;
}

#game .mybattlefieldmain > .emptyrow { grid-column: 1 / -1; }

#game .boardlane,
#game .resourcezone,
#game .oppresourcelane {
  position: relative;
  min-width: 0;
  padding: 17px 6px 4px;
  overflow: hidden;
  border: 1px solid rgba(var(--ds-accent-soft-rgb), .09);
  border-radius: 7px;
  background: rgba(5, 10, 10, .34);
}

#game .boardlane.supportlane {
  border-color: rgba(143, 126, 184, .18);
  background: linear-gradient(180deg, rgba(92, 72, 126, .08), rgba(5, 10, 10, .28));
}

#game .boardlanelabel {
  position: absolute;
  top: 5px;
  left: 7px;
  z-index: 2;
  overflow: hidden;
  color: rgba(205, 193, 168, .48);
  font: 800 7px/1 var(--ds-font-display);
  letter-spacing: .16em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#game .boardlanecards {
  display: flex;
  min-width: 0;
  min-height: 100%;
  align-items: flex-end;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

#game .resourcezone {
  flex: 1 1 auto;
  display: flex;
  min-height: 62px;
  align-items: flex-end;
  gap: 7px;
  padding: 16px 5px 3px;
  border-color: rgba(117, 151, 107, .15);
  background: linear-gradient(180deg, rgba(74, 99, 66, .06), rgba(5, 10, 10, .3));
}

#game .resourcezone .landstrip {
  flex: 1 1 auto;
  align-self: center;
}

#game .manaartifactstrip,
#game .oppresourcecards {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

#game .manaartifactstrip {
  flex: 0 1 auto;
  max-width: 44%;
  padding-left: 7px;
  border-left: 1px solid rgba(126, 162, 116, .16);
}

#game .manaartifactstrip .mini.sm,
#game .oppresourcelane .mini.sm {
  width: 40px !important;
  height: 54px !important;
}

#game .manaartifactstrip .permanentpile.sm,
#game .oppresourcelane .permanentpile.sm { width: 40px !important; }

#game .manaartifactstrip .mini.sm .mname,
#game .oppresourcelane .mini.sm .mname { font-size: 6px; max-height: 14px; }

#game .landrow { overflow: hidden; }

#game .oppstrip.battlefieldstrip {
  display: flex !important;
  flex-wrap: nowrap !important;
  min-width: 0;
  align-items: stretch;
  gap: 5px;
  padding: 6px 7px 8px !important;
  overflow: hidden;
}

#game .oppstrip.battlefieldstrip::before { content: none; }

#game .oppboardmain {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(76px, .72fr);
  min-width: 0;
  gap: 5px;
}

#game .oppboardmain .boardlane {
  min-height: 0;
  padding: 14px 4px 3px;
  border-radius: 5px;
}

#game .oppboardmain .boardlane:only-child { grid-column: 1 / -1; }
#game .oppboardmain .boardlanelabel { top: 4px; left: 5px; font-size: 6px; }
#game .oppboardmain .boardlanecards { gap: 4px; }

#game .oppresourcelane {
  flex: 0 1 29%;
  display: flex;
  min-width: 54px;
  max-width: 128px;
  align-items: flex-end;
  padding: 14px 4px 3px;
  border-color: rgba(117, 151, 107, .14);
  border-radius: 5px;
  background: rgba(56, 79, 51, .08);
}

#game .oppresourcelane .boardlanelabel { top: 4px; left: 5px; font-size: 5.5px; }
#game .oppresourcecards { width: 100%; }
#game .oppresourcelane .oppLands { align-self: center; }

/* Bot potezi emituju više uzastopnih state updatea. Ambient animacije na
   ponovo nacrtanim čvorovima bi svaki put krenule od prvog framea i izgledale
   kao mini refresh; aktivno mjesto ostaje jasno označeno bez pulsiranja. */
#game.ai-turn .opprow.active,
#game.ai-turn .oppswrap.active-ai-turn .opprow.activeai {
  animation: none;
  filter: brightness(1.045);
}

#game.ai-turn .stackempty span {
  animation: none;
  opacity: .5;
  transform: rotate(22deg) scale(.98);
}

@media (min-width: 768px) and (max-width: 1279px) {
  #game .mybattlefieldmain { grid-template-columns: minmax(0, 1.6fr) minmax(150px, .72fr); gap: 6px; }
  #game .oppboardmain { grid-template-columns: minmax(0, 1.5fr) minmax(62px, .7fr); gap: 4px; }
  #game .oppresourcelane { flex-basis: 27%; max-width: 105px; }
}

@media (max-width: 767px) {
  #game .mybattlefieldmain {
    grid-template-columns: minmax(0, 1.65fr) minmax(112px, .78fr);
    gap: 5px;
    overflow: visible;
  }
  #game .boardlane { padding: 14px 4px 3px; border-radius: 5px; }
  #game .boardlanelabel { top: 4px; left: 5px; font-size: 5.8px; letter-spacing: .11em; }
  #game .boardlanecards { gap: 4px; }
  #game .resourcezone { min-height: 59px; padding-top: 14px; }
  #game .resourcezone .landstrip { overflow-x: auto; }
  #game .landrow { flex-direction: column; align-items: stretch; gap: 5px; overflow: visible; }
  #game .resourcezone { width: 100%; flex: 0 0 auto; }
  #game .playerrail { width: 100%; margin-left: 0; padding-left: 0; background: none; }
  #game .playerrail:not(.has-library-top) .meinfo { width: 100%; margin-left: 0; justify-content: space-between; }
  #game .manaartifactstrip { max-width: 42%; padding-left: 5px; }
  #game .manaartifactstrip .mini.sm { width: 36px !important; height: 49px !important; }
  #game .manaartifactstrip .permanentpile.sm { width: 36px !important; }
  #game .oppstrip.battlefieldstrip { gap: 4px; padding: 3px 4px 4px !important; overflow-x: auto; }
  #game .oppboardmain { min-width: 165px; grid-template-columns: minmax(80px, 1.45fr) minmax(68px, .8fr); gap: 4px; }
  #game .oppboardmain .boardlane { padding: 11px 3px 2px; }
  #game .oppboardmain .boardlanelabel,
  #game .oppresourcelane .boardlanelabel { top: 3px; left: 4px; font-size: 5px; letter-spacing: .08em; }
  #game .oppresourcelane { flex: 0 0 58px; min-width: 58px; padding: 11px 3px 2px; }
  #game .oppresourcelane .mini.sm { width: 34px !important; height: 46px !important; }
  #game .oppresourcelane .permanentpile.sm { width: 34px !important; }
  #game .oppresourcelane .oppLands { min-width: 38px; padding: 3px 5px; font-size: 8px; }
  #game[data-mobile-view="mine"] .oppboardmain .boardlane,
  #game[data-mobile-view="mine"] .oppresourcelane { padding-top: 9px; }
  #game[data-mobile-view="mine"] .oppboardmain .boardlanelabel,
  #game[data-mobile-view="mine"] .oppresourcelane .boardlanelabel { top: 2px; font-size: 4.5px; }
  #game[data-mobile-view="mine"] .oppboardmain .mini.sm {
    width: 29px !important;
    height: 38px !important;
  }
  #game[data-mobile-view="mine"] .oppboardmain .permanentpile.sm { width: 29px !important; }
  #game[data-mobile-view="mine"] .oppresourcelane .mini.sm {
    width: 28px !important;
    height: 38px !important;
  }
  #game[data-mobile-view="mine"] .oppresourcelane .permanentpile.sm { width: 28px !important; }
  #game[data-mobile-view="mine"] .oppboardmain .mini.sm .mname,
  #game[data-mobile-view="mine"] .oppresourcelane .mini.sm .mname { font-size: 4.5px; max-height: 10px; }
}

@media (min-width: 1280px) and (max-height: 700px) {
  #game .boardlane { padding-top: 14px; }
  #game .resourcezone { min-height: 56px; padding-top: 14px; }
  #game .manaartifactstrip .mini.sm { width: 36px !important; height: 49px !important; }
  #game .manaartifactstrip .permanentpile.sm { width: 36px !important; }
  #game .oppstrip.battlefieldstrip { padding-block: 4px 5px !important; }
  #game .oppboardmain .boardlane,
  #game .oppresourcelane { padding-top: 12px; }
}

/* Eliminated seats leave the table entirely. The remaining battlefields
   reclaim the freed width while their original seat numbers stay stable. */
@media (min-width: 768px) {
  #game .oppswrap[data-opponent-count="2"],
  #game .oppswrap.active-ai-turn[data-opponent-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #game .oppswrap.active-ai-turn[data-opponent-count="2"]:has(.opprow:first-child.activeai) {
    grid-template-columns: 1.28fr 1fr !important;
  }

  #game .oppswrap.active-ai-turn[data-opponent-count="2"]:has(.opprow:last-child.activeai) {
    grid-template-columns: 1fr 1.28fr !important;
  }

  #game .oppswrap[data-opponent-count="1"],
  #game .oppswrap.active-ai-turn[data-opponent-count="1"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Live decisions stay in reach before the board on short and touch screens. */
.online-decision-stage { position: sticky; top: 0; z-index: 8; margin-bottom: 12px; }
.online-decision-stage .online-decision { position: static; margin-top: 0; max-height: 42dvh; overflow-y: auto; background: var(--ds-panel); }
.online-seat-kind { width: 100%; min-height: 44px; margin-top: 10px; padding: 8px; color: var(--ds-text); background: var(--ds-panel); border: 1px solid var(--ds-accent); }
.online-seat-count { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 620px) {
  #setup:has(.online-remote-game), #setup:has(.online-lobby) { padding: 0 !important; }
  .online-remote-game, .online-lobby { padding: 12px; }
  .online-game-head { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .online-game-head b { font-size: 17px; }
  .online-game-head .online-room-state { display: none; }
  .online-player-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-remote-board, .online-own-hand, .online-battlefield, .online-stack { min-width: 0; }
  .online-choice { min-height: 44px; min-width: 0; }
  .online-decision-choices { gap: 8px; }
  .online-decision-choices select { min-width: 0; max-width: 100%; }
  .online-lobby-head { grid-template-columns: 1fr; gap: 12px; }
  .online-invite { flex-wrap: wrap; }
  .online-seats { grid-template-columns: minmax(0, 1fr); }
}
/* Native macOS select styling ignores the room controls' minimum height. */
.online-deck-select, .online-seat-kind {
  -webkit-appearance: none;
  appearance: none;
  height: 44px;
  padding-right: 30px;
  font: 600 12px var(--ds-font-body);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23bca172' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
