/* Deck browser (js/lobby/deckbrowser.js) and its detail panel (js/lobby/deckdetail.js).
   Accents come from the selected deck's theme (--dk-*, set by an ancestor, js/lobby/themes.js),
   falling back to the base tokens. Layout follows the browser's own width: the JS sets
   .is-wide / .is-narrow from a ResizeObserver, and the tile grid sizes itself with auto-fill.
   The narrow detail sheet renders into <body> (.dkb-portal) so no ancestor can trap it.
   An ancestor may set --dkb-sticky-top to the height of anything fixed above the browser. */

.dkb, .dkb-portal {
  --dkb-a: var(--dk-accent, var(--accent));
  --dkb-a2: var(--dk-accent2, var(--plan));
  --dkb-on: var(--dk-on-accent, var(--bg));
  --dkb-tint: var(--dk-tint, rgba(122, 162, 247, .06));
  --dkb-bd: var(--dk-border, var(--border2));
  --dkb-glow: var(--dk-glow, rgba(122, 162, 247, .25));
}
.dkb { position: relative; min-width: 0; width: 100%; }
/* undo game.css's page-wide button/details defaults (min-height 40px, padding, details margin);
   :where keeps this at element specificity so every rule below still wins */
:where(.dkb, .dkb-portal) button { font: inherit; color: inherit; min-height: 0; padding: 0; text-align: inherit; }
:where(.dkb, .dkb-portal) details { margin-top: 0; }
.dkd-x { padding: 0; }
.dkd-err button, .dkb-note button, .dkb-empty button { padding: 2px 8px; }
.dkb-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- filter bar ---------- */
.dkb-bar {
  position: sticky; top: var(--dkb-sticky-top, 0px); z-index: 6;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 10px 8px; margin: 0 0 12px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
}
.dkb-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.dkb-q {
  flex: 1 1 220px; min-width: 0; height: 36px; padding: 0 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border2); border-radius: 9px;
  font: inherit; font-size: 14px;
}
.dkb-q::placeholder { color: var(--faint); }
.dkb-sortl { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; flex: 0 0 auto; }
.dkb-sort, .dkb-set {
  height: 36px; padding: 0 8px; max-width: 100%;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2); border-radius: 9px; font: inherit; font-size: 13px;
}
.dkb-setl { flex: 0 1 240px; min-width: 0; display: flex; }
.dkb-set { width: 100%; }

.dkb-seg, .dkb-mode {
  display: inline-flex; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--border2);
  border-radius: 9px; padding: 2px; gap: 2px; min-width: 0;
}
.dkb-seg button, .dkb-mode button {
  border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  padding: 5px 10px; font-size: 13px; color: var(--dim); min-height: 30px;
}
.dkb-mode button { padding: 4px 8px; font-size: 12px; min-height: 28px; }
.dkb-seg button:hover, .dkb-mode button:hover { color: var(--text); background: var(--panel2); }
.dkb-seg button.on, .dkb-mode button.on { background: var(--dkb-a); color: var(--dkb-on); font-weight: 600; }
.dkb-cnt { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; margin-left: 2px; }

.dkb-colours { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dkb-ctog {
  width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border2); display: inline-grid; place-items: center;
}
.dkb-ctog i { width: 16px; height: 16px; border-radius: 50%; display: block; opacity: .6; transition: opacity .12s, transform .12s; }
.dkb-ctog.W i { background: #f5f0dc; } .dkb-ctog.U i { background: #9ec7e8; }
.dkb-ctog.B i { background: #a89bb0; } .dkb-ctog.R i { background: #e8a294; }
.dkb-ctog.G i { background: #a5c99a; }
.dkb-ctog.C i { background: transparent; box-shadow: inset 0 0 0 2px #c4c8cf; }
.dkb-ctog:hover i { opacity: .8; }
.dkb-ctog.on { border-color: var(--dkb-a); box-shadow: 0 0 0 2px var(--dkb-glow); }
.dkb-ctog.on i { opacity: 1; transform: scale(1.15); }
.dkb-mode { margin-left: 4px; }

.dkb-status { gap: 10px; font-size: 12.5px; color: var(--dim); }
.dkb-count { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.dkb-clear {
  background: none; border: 1px solid var(--border2); border-radius: 7px; padding: 2px 9px;
  cursor: pointer; font-size: 12px; min-height: 26px;
}
.dkb-clear:disabled { opacity: .4; cursor: default; }
.dkb-hint { margin-left: auto; color: var(--faint); font-size: 12px; }

.dkb-note, .dkb-empty {
  margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; font-size: 13px; color: var(--dim);
  background: var(--dkb-tint); border: 1px dashed var(--dkb-bd);
}
.dkb-note button, .dkb-empty button, .dkb-note b { color: var(--dkb-a); }
.dkb-note button, .dkb-empty button { background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0 4px; }
.dkb-empty { margin-top: 12px; }

/* ---------- body: grid (+ detail beside it when wide) ---------- */
.dkb-body { display: block; }
.dkb.is-wide.has-detail .dkb-body {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 36%, 440px); gap: 16px; align-items: start;
}
.dkb-main { min-width: 0; }
.dkb-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px;
}
.dkb.is-narrow .dkb-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
/* Random sits first as a compact banner across the grid, so it costs a short row, not a tile row */
.dkb-randrow, .dkb.is-narrow .dkb-randrow { grid-template-columns: minmax(0, 1fr); margin-bottom: 4px; }
.dkb-tile.dkb-random { flex-direction: row; align-items: stretch; }
.dkb-tile.dkb-random .dkb-art { width: 112px; flex: 0 0 112px; aspect-ratio: auto; min-height: 76px; }
.dkb-random .dkb-die { width: 48px; height: 48px; border-radius: 11px; }
.dkb-random .dkb-die i { width: 9px; height: 9px; }
.dkb-random .dkb-die i:nth-child(1) { left: 7px; top: 7px; } .dkb-random .dkb-die i:nth-child(2) { right: 7px; top: 7px; }
.dkb-random .dkb-die i:nth-child(3) { left: 19px; top: 19px; } .dkb-random .dkb-die i:nth-child(4) { left: 7px; bottom: 7px; }
.dkb-random .dkb-die i:nth-child(5) { right: 7px; bottom: 7px; }
.dkb-random .dkb-tbody { flex: 1 1 auto; justify-content: center; }
.dkb-random .dkb-badge { top: auto; bottom: 6px; }
.dkb-cell { min-width: 0; display: flex; }
.dkb-group { margin-top: 18px; }
.dkb-gh {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; padding-bottom: 4px;
  font-size: 13px; font-weight: 650; letter-spacing: .02em; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.dkb-gy { color: var(--dkb-a); font-variant-numeric: tabular-nums; font-weight: 600; }
.dkb-gn { margin-left: auto; color: var(--faint); font-weight: 500; font-size: 12px; }

/* ---------- tiles ---------- */
.dkb-tile {
  position: relative; display: flex; flex-direction: column; width: 100%; padding: 0; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.dkb-tile:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.dkb-tile:focus-visible { outline: 2px solid var(--dkb-a); outline-offset: 2px; }
.dkb-tile.is-prev { border-color: var(--dkb-a); border-style: dashed; }
.dkb-tile.is-sel {
  border: 2px solid var(--dkb-a); border-style: solid;
  box-shadow: 0 0 0 3px var(--dkb-glow), 0 8px 22px rgba(0, 0, 0, .4);
}
.dkb-tile:disabled { opacity: .5; cursor: default; transform: none; }
.dkb-art {
  position: relative; display: block; width: 100%; aspect-ratio: 626 / 380; overflow: hidden;
  background-color: var(--panel2); background-size: cover;
}
.dkb-art img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  display: block;
}
.dkb-mono {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 44px; font-weight: 700; color: rgba(255, 255, 255, .22); letter-spacing: -.02em;
}
.dkb-badge, .dkb-yours {
  position: absolute; top: 6px; font-size: 11px; font-weight: 650; line-height: 1;
  padding: 4px 7px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 12px);
  overflow: hidden; text-overflow: ellipsis;
}
.dkb-badge { left: 6px; background: var(--dkb-a); color: var(--dkb-on); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.dkb-yours { right: 6px; background: rgba(16, 19, 26, .82); color: var(--good); border: 1px solid rgba(158, 206, 106, .5); }
.dkb-tbody { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 9px; min-width: 0; }
.dkb-title {
  font-weight: 650; font-size: 14px; line-height: 1.25; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dkb-cmd { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkb-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-width: 0; font-size: 11.5px; color: var(--faint); }
.dkb-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.dkb-pips { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.dkb-pip { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.dkb-pips.big .dkb-pip { width: 14px; height: 14px; }
.dkb-pip.W { background: #f5f0dc; } .dkb-pip.U { background: #9ec7e8; }
.dkb-pip.B { background: #a89bb0; } .dkb-pip.R { background: #e8a294; }
.dkb-pip.G { background: #a5c99a; }
.dkb-pip.C { background: transparent; box-shadow: inset 0 0 0 1.5px #c4c8cf; }

/* random tile */
.dkb-rart {
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--dkb-a) 30%, var(--panel2)), var(--panel2) 70%),
              var(--panel2);
  display: grid; place-items: center;
}
.dkb-die {
  width: 64px; height: 64px; border-radius: 14px; position: relative;
  background: var(--panel); border: 1px solid var(--border2); box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  transform: rotate(-8deg); transition: transform .2s;
}
.dkb-die i { position: absolute; width: 11px; height: 11px; border-radius: 50%; }
.dkb-die i:nth-child(1) { left: 10px; top: 10px; } .dkb-die i:nth-child(2) { right: 10px; top: 10px; }
.dkb-die i:nth-child(3) { left: 26px; top: 26px; } .dkb-die i:nth-child(4) { left: 10px; bottom: 10px; }
.dkb-die i:nth-child(5) { right: 10px; bottom: 10px; }
.dkb-random:hover .dkb-die { transform: rotate(8deg); }
.dkb-random .dkb-sub { color: var(--dkb-a); }

/* ---------- detail: beside the grid ---------- */
.dkb-side {
  position: sticky; top: calc(var(--dkb-sticky-top, 0px) + var(--dkb-bar-h, 0px) + 12px);
  /* --dock-h: the builder's fixed bottom dock, which would otherwise cover the panel's foot */
  max-height: calc(100vh - var(--dkb-sticky-top, 0px) - var(--dkb-bar-h, 0px) - var(--dock-h, 0px) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--dkb-bd); border-radius: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
}

/* ---------- detail: slide-up sheet (narrow) ---------- */
.dkb-sheetwrap { position: fixed; inset: 0; z-index: 90; }
.dkb-backdrop { position: absolute; inset: 0; background: rgba(5, 7, 12, .6); }
.dkb-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-top: 2px solid var(--dkb-a); border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .5);
  padding-bottom: env(safe-area-inset-bottom);
  animation: dkb-up .22s ease-out;
}
@media (min-width: 640px) { .dkb-sheet { left: 50%; right: auto; width: 600px; margin-left: -300px; } }
/* transform only: an animation paused at its first frame (a background tab) must still be opaque */
@keyframes dkb-up { from { transform: translateY(48px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .dkb-sheet, .dkb-backdrop { animation: none; }
  .dkb-tile, .dkb-tile:hover, .dkb-die { transition: none; transform: none; }
}

/* ---------- detail content ---------- */
.dkd { display: flex; flex-direction: column; gap: 12px; padding: 14px; position: relative; }
.dkd-head { display: flex; align-items: flex-start; gap: 10px; }
.dkd-titles { flex: 1; min-width: 0; }
.dkd-head h3 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 700; outline: none; }
.dkd-sub { color: var(--dim); font-size: 13px; margin-top: 2px; }
.dkd-x {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--panel2); color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer;
}
.dkd-x:hover { color: var(--text); }
.dkd-x:focus-visible, .dkd-choose:focus-visible, .dkd-cname:focus-visible, .dkd-sec summary:focus-visible,
.dkb-seg button:focus-visible, .dkb-mode button:focus-visible, .dkb-ctog:focus-visible, .dkb-clear:focus-visible,
.dkb-q:focus-visible, .dkb-sort:focus-visible, .dkb-set:focus-visible {
  outline: 2px solid var(--dkb-a); outline-offset: 2px;
}

.dkd-cmdrs { display: grid; grid-template-columns: 1fr; gap: 8px; justify-items: center; }
.dkd-cmdrs.n2 { grid-template-columns: 1fr 1fr; }
.dkd-cmdr { margin: 0; width: 100%; max-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.dkd-cmdr img {
  width: 100%; aspect-ratio: 488 / 680; border-radius: 4.75% / 3.5%; display: block;
  background: var(--panel2); box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}
.dkd-sheet .dkd-cmdr { max-width: 220px; }
.dkd-sheet .dkd-cmdrs.n2 .dkd-cmdr { max-width: 170px; }
.dkd-cmdr figcaption { font-size: 12px; color: var(--dim); text-align: center; }

.dkd-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.dkd-facts .dkd-off { color: var(--warn); }
.dkd-src {
  margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--dkb-bd); color: var(--dkb-a); background: var(--dkb-tint);
}
.dkd-strat {
  margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text);
  padding: 8px 10px; border-left: 3px solid var(--dkb-a); background: var(--dkb-tint); border-radius: 0 8px 8px 0;
}

.dkd-curve { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; height: 70px; align-items: end; }
.dkd-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.dkd-barf {
  width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--dkb-a), color-mix(in srgb, var(--dkb-a) 55%, var(--dkb-a2)));
}
.dkd-barn { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; line-height: 1.3; }
.dkd-barl { font-size: 10.5px; color: var(--faint); line-height: 1.4; }

.dkd-actions {
  position: sticky; bottom: 0; z-index: 2; margin: 0 -14px; padding: 10px 14px;
  background: linear-gradient(to top, var(--panel) 75%, transparent);
}
.dkd-choose {
  width: 100%; min-height: 44px; padding: 8px 14px; text-align: center;
  border-radius: 10px; cursor: pointer; font: inherit; font-weight: 700; font-size: 15px;
  background: var(--dkb-a); color: var(--dkb-on); border: 1px solid var(--dkb-a);
  box-shadow: 0 4px 14px var(--dkb-glow);
}
.dkd-choose:hover { filter: brightness(1.08); }
.dkd-choose.is-chosen { background: var(--dkb-tint); color: var(--dkb-a); box-shadow: none; cursor: default; }

.dkd-list { display: flex; flex-direction: column; gap: 6px; }
.dkd-listhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.dkd-sum { text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.dkd-sec { border: 1px solid var(--border); border-radius: 10px; background: var(--panel2); }
.dkd-sec summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none;
  font-weight: 650; font-size: 13px; border-radius: 10px; text-transform: none; letter-spacing: 0; color: var(--text);
}
.dkd-sec summary::-webkit-details-marker { display: none; }
.dkd-sec summary::before { content: "▸"; color: var(--faint); font-size: 11px; transition: transform .12s; }
.dkd-sec[open] summary::before { transform: rotate(90deg); }
.dkd-n { margin-left: auto; color: var(--dkb-a); font-variant-numeric: tabular-nums; }
.dkd-sec ul { list-style: none; margin: 0; padding: 0 6px 6px; }
.dkd-card { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 6px; min-width: 0; }
.dkd-card:hover { background: var(--panel3); }
.dkd-qty { flex: 0 0 18px; text-align: right; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.dkd-cname {
  flex: 1 1 auto; min-width: 0; min-height: 0; line-height: 1.35; text-align: left; background: none; border: 0; padding: 3px 0; cursor: default;
  font: inherit; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px;
}
.dkd-cost { flex: 0 0 auto; }
.dkd-cost .pip { width: 13px; height: 13px; line-height: 13px; font-size: 9px; }

.dkd-skel { display: flex; flex-direction: column; gap: 6px; }
.dkd-skel i { display: block; height: 30px; border-radius: 8px; background: linear-gradient(90deg, var(--panel2), var(--panel3), var(--panel2));
  background-size: 200% 100%; animation: dkb-shimmer 1.2s linear infinite; }
@keyframes dkb-shimmer { to { background-position: -200% 0; } }
.dkd-err { font-size: 13px; color: var(--bad); }
.dkd-err button { margin-left: 8px; background: none; border: 1px solid var(--border2); color: var(--text); border-radius: 6px; cursor: pointer; }

/* card preview: follows the row on hover/focus; centred and tap-to-close on touch */
.dkd-peek { position: fixed; z-index: 100; width: 244px; pointer-events: none; }
.dkd-peek img { width: 100%; aspect-ratio: 488 / 680; display: block; border-radius: 4.75% / 3.5%;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .6); background: var(--panel2); }
.dkd-peek.pinned {
  inset: 0; width: auto; pointer-events: auto; display: grid; place-items: center;
  background: rgba(5, 7, 12, .7); padding: 24px;
}
.dkd-peek.pinned img { width: min(300px, 80vw); }

/* the narrowest builders: stack the bar's controls */
.dkb.is-narrow .dkb-hint { display: none; }
.dkb.is-narrow .dkb-seg { width: 100%; }
.dkb.is-narrow .dkb-seg button { flex: 1 1 auto; padding: 5px 6px; }
.dkb.is-narrow .dkb-setl { flex: 1 1 100%; }
.dkb.is-narrow .dkb-mode { margin-left: 0; }
/* on a phone a sticky bar would eat a third of the screen: it scrolls away with the page */
.dkb.is-narrow .dkb-bar { position: static; padding: 8px; gap: 6px; }
.dkb.is-narrow .dkb-q { flex-basis: 140px; }
.dkb.is-narrow .dkb-sortl > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dkb.is-narrow .dkb-colours { gap: 3px; }
.dkb.is-narrow .dkb-ctog { width: 26px; height: 26px; }
.dkb.is-narrow .dkb-ctog i { width: 14px; height: 14px; }
.dkb.is-narrow .dkb-mode button { padding: 3px 5px; font-size: 11.5px; min-height: 26px; }

/* ---------- deck management: New deck in the bar; Edit / Copy / Delete in the detail ---------- */
.dkb-new {
  flex: 0 0 auto; min-height: 40px; padding: 7px 14px; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 13.5px; white-space: nowrap;
  background: var(--dkb-tint); color: var(--dkb-a); border: 1px solid var(--dkb-a);
}
.dkb-new:hover { background: var(--dkb-a); color: var(--dkb-on); }
.dkb-new:focus-visible, .dkd-manage button:focus-visible { outline: 2px solid var(--dkb-a); outline-offset: 2px; }
.dkd-manage { display: flex; gap: 6px; margin-top: 8px; }
.dkd-manage button {
  flex: 1 1 0; min-height: 36px; padding: 6px 10px; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; text-align: center;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2);
}
.dkd-manage button:hover { border-color: var(--dkb-a); color: var(--dkb-a); }
.dkd-manage button.danger:hover { border-color: var(--bad); color: var(--bad); }
.dkd-managenote { margin: 8px 0 0; color: var(--bad); font-size: 12.5px; }
.dkb-empty button + button { margin-left: 8px; }

/* ---- deck variants, descriptions and notes (server/deck_store.py) ---- */
.dkd-manage { flex-wrap: wrap; }
.dkd-manage button { min-width: 6.5em; }
.dkd-src + .dkd-src { margin-left: 0; }
.dkb-vis {
  position: absolute; bottom: 6px; right: 6px; font-size: 10.5px; font-weight: 650; line-height: 1;
  padding: 3px 6px; border-radius: 999px; background: rgba(16, 19, 26, .82); color: var(--dim);
  border: 1px solid var(--border2);
}
.dkb-nv { margin-left: auto; flex: none; color: var(--dkb-a); font-weight: 600; }
.dkd-desc { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.dkd-notes summary { cursor: pointer; font-size: 12.5px; color: var(--dim); }
.dkd-notetext {
  margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap;
  max-height: 16em; overflow: auto; padding: 8px 10px; background: var(--panel2); border-radius: 8px;
}
.dkd-vpick { display: flex; flex-direction: column; gap: 4px; }
.dkd-var {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px; text-align: left; cursor: pointer;
  padding: 7px 10px; border-radius: 9px; font: inherit; color: var(--text);
  background: var(--panel2); border: 1px solid var(--border2);
}
.dkd-var:hover { border-color: var(--dkb-a); }
.dkd-var.on { border-color: var(--dkb-a); background: var(--dkb-tint); }
.dkd-var:focus-visible { outline: 2px solid var(--dkb-a); outline-offset: 2px; }
.dkd-varl { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.dkd-varchosen { color: var(--good); }
.dkd-vars { grid-column: 1; font-size: 11.5px; color: var(--dim); }
.dkd-varb {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 10.5px; padding: 2px 6px;
  border-radius: 999px; border: 1px solid var(--border2); color: var(--dim);
}
.dkd-vinfo { padding: 8px 10px; border-left: 3px solid var(--dkb-a2, var(--dkb-a)); background: var(--dkb-tint); border-radius: 0 8px 8px 0; }
.dkd-vtitle { font-weight: 650; font-size: 13.5px; }
.dkd-vby { font-size: 12px; color: var(--dim); }
.dkd-vinfo .dkd-notetext { background: var(--panel); }

/* ---- synced decks: waiting on cards the game can't play yet (server/scryfall_sync.py) ---- */
.dkb-tile.is-waiting .dkb-art img { filter: grayscale(.85) brightness(.7); }
.dkb-wait {
  position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 650; line-height: 1;
  padding: 3px 6px; border-radius: 999px; background: rgba(16, 19, 26, .88); color: var(--warn);
  border: 1px solid rgba(224, 175, 104, .55); max-width: calc(100% - 70px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dkd-sync { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--dim); }
.dkd-sync a { color: var(--dkb-a); }
.dkd-wait {
  display: grid; gap: 4px; padding: 9px 11px; font-size: 13px; line-height: 1.45; color: var(--dim);
  border: 1px solid rgba(224, 175, 104, .5); background: rgba(224, 175, 104, .08); border-radius: 9px;
}
.dkd-wait > b { color: var(--warn); }
.dkd-choose:disabled { opacity: .55; cursor: not-allowed; }
.dkd-playnow {
  width: 100%; min-height: 38px; margin-top: 8px; padding: 7px 12px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 650;
  background: var(--dkb-tint); color: var(--dkb-a); border: 1px solid var(--dkb-a);
}
.dkd-playnow:hover { background: var(--dkb-a); color: var(--dkb-on); }
