/* ======================= Friend Duel (src/board-duel.js) ======================= */
/* 2026-10-07: the duel's screens over the board. A panel for the start, the draft, placement, the codes and the result;
   while its fight plays on the board, a bar along the top and a tag on each half. Shown only in the board's "duel" mode
   (quick-board.js show sets data-mode), so anything that takes the frame back to the Road also takes the panel away. */
.bd:not([data-mode="duel"]) > .bd-d { display: none !important; }
.bd-d { position: absolute; inset: 0; z-index: 13; pointer-events: none; }
.bd-d-panel { position: absolute; inset: 0; padding: 14px 14px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  overflow-y: auto; overscroll-behavior: contain; background: rgba(26, 20, 40, 0.88); pointer-events: auto; scrollbar-width: thin; }
.bd-d-head { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bd-d-titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bd-d-title { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: 2px; line-height: 1; }
.bd-d-sub { font-size: 16px; font-weight: 800; color: #ffe08a; -webkit-text-stroke: 4px var(--ol); paint-order: stroke fill; }
.bd-d-road { flex: none; height: 38px; padding: 0 14px 0 10px; border: 3px solid var(--ol); border-radius: 19px; background: linear-gradient(180deg, #eceaf6, #c9c5dc);
  color: #3b3350 !important; font-size: 17px; font-weight: 800; }
.bd-d-body { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; border: 4px solid var(--ol); border-radius: 22px;
  background: linear-gradient(180deg, #fff6d6, #f1dfae); color: #3b3350; }
.bd-d-body p { margin: 0; }
.bd-d .big-btn:disabled { filter: grayscale(0.6) brightness(0.9); opacity: 0.7; cursor: default; }
.bd-d-btn { min-width: 0; width: auto; height: 54px; padding: 0 18px; font-size: 22px; }
.bd-d-text { height: 40px; padding: 0 10px; border: 0; background: none; color: #5a4f72 !important; font-size: 17px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.bd-d-nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.bd-d-nav > :last-child { margin-left: auto; }

/* ---- text ---- */
.bd-d-lead { display: flex; align-items: flex-start; gap: 8px; font-size: 17px; font-weight: 800; line-height: 1.3; }
.bd-d-lead p { flex: 1; }
.bd-d-info { flex: none; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border: 2px solid var(--ol); border-radius: 50%;
  background: #eceaf6; color: #3b3350 !important; font-size: 15px; font-weight: 800; line-height: 1; }
.bd-d-more { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: rgba(59, 51, 80, 0.08);
  font-size: 14px; font-weight: 700; line-height: 1.3; color: #5a4f72; }
.bd-d-line { font-size: 15px; font-weight: 700; line-height: 1.3; }
.bd-d-note { font-size: 14px; font-weight: 700; line-height: 1.3; color: #5a4f72; }
.bd-d-status { min-height: 1.3em; font-size: 14px; font-weight: 800; line-height: 1.3; color: #3b7a1f; }
.bd-d-err { font-size: 15px; font-weight: 800; line-height: 1.3; color: #a5303b; }

/* ---- start ---- */
.bd-d-cont { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; border: 3px solid var(--ol); border-radius: 16px; background: #ffe9a8; }
.bd-d-cont .k { padding: 1px 7px; border-radius: 8px; background: #6b6083; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; }
.bd-d-cont .st { flex: 1; min-width: 160px; font-size: 15px; font-weight: 800; line-height: 1.25; }
.bd-d-choices { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.bd-d-confirm { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 3px solid var(--ol); border-radius: 16px; background: #ffd3d7; }
.bd-d-confirm p { font-size: 16px; font-weight: 800; line-height: 1.3; }

/* ---- draft ---- */
.bd-d-dots { display: flex; justify-content: center; gap: 6px; }
.bd-d-dot { width: 12px; height: 12px; border: 2px solid var(--ol); border-radius: 50%; background: #d8d0ef; }
.bd-d-dot.done { background: #6cc93f; }
.bd-d-dot.cur { background: #ffd15c; box-shadow: 0 0 0 3px rgba(255, 209, 92, 0.55); }
.bd-d-ask { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 1px; line-height: 1; }
.bd-d-offers { display: flex; justify-content: center; align-items: flex-start; gap: 12px; }
.bd-d-offer { position: relative; width: 118px; padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* the card scaled in a box of its scaled size: its entrance animation owns its own transform */
.bd-d-cardbox { position: relative; display: block; width: 118px; height: 184px; }
.bd-d-cardwrap { position: absolute; left: 0; top: 0; width: 168px; height: 262px; transform: scale(0.7); transform-origin: top left; }
.bd-d-cardwrap .card { position: absolute; left: 0; top: 0; }
/* a redraw of the same round (a pick) does not deal the cards again */
.bd-d-offers.still .card { animation: none; }
.bd-d-offer.in .bd-d-cardwrap .card { box-shadow: 0 0 0 7px #6cc93f, 0 7px 0 rgba(47, 36, 55, 0.26); }
.bd-d-verb { font-size: 18px; font-weight: 800; letter-spacing: 0.5px; line-height: 1; color: #ffe36b; -webkit-text-stroke: 5px var(--ol); paint-order: stroke fill; }
.bd-d-tag { padding: 0 6px; border: 2px solid var(--ol); border-radius: 8px; background: #e8e2ff; color: #3b3350; font-size: 11px; font-weight: 800; letter-spacing: 0.6px; line-height: 15px; }
.bd-d-tag.t-front { background: #8fc0ff; }
.bd-d-tag.t-back { background: #b4ef7d; }
.bd-d-tag.t-swarm { background: #ffd15c; }
.bd-d-tag.t-splash { background: #ff9a9a; }
.bd-d-tag.t-tank { background: #c9b6ff; }
.bd-d-tag.t-flank { background: #ffb26b; }
.bd-d-tag.t-support { background: #9ff0e0; }
.bd-d-tick { position: absolute; right: -4px; top: -6px; width: 30px; height: 30px; display: grid; place-items: center; border: 3px solid var(--ol); border-radius: 50%;
  background: #6cc93f; color: #fff; font-size: 17px; font-weight: 800; }
.bd-d-yours { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding-top: 8px; border-top: 2px dashed rgba(59, 51, 80, 0.3); }
.bd-d-yours > .k { margin-right: 4px; font-size: 13px; font-weight: 800; color: #4a5bd0; }

/* ---- placement: your half as the board shows it ---- */
.bd-d-grid { display: flex; flex-direction: column; align-items: center; padding: 8px 6px 10px; border: 3px solid var(--ol); border-radius: 18px; background: #3a3156; }
.bd-d-grid.blue { background: linear-gradient(180deg, #3a3156, #343a7a); }
.bd-d-grid.red { background: linear-gradient(180deg, #6a2f45, #3a3156); }
.bd-d-enemy { padding: 2px 0 6px; font-size: 13px; font-weight: 800; letter-spacing: 0.6px; }
.bd-d-grid.blue .bd-d-enemy { color: #ffb3b9; }
.bd-d-grid.red .bd-d-enemy { padding: 6px 0 2px; color: #c3caff; }
.bd-d-row { display: flex; justify-content: center; gap: 4px; }
.bd-d-row + .bd-d-row { margin-top: -20px; }
.bd-d-hex { position: relative; width: 84px; height: 96px; padding: 0; border: 0; background: none; }
.bd-d-hexbg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: rgba(255, 255, 255, 0.14); }
.bd-d-hex.can .bd-d-hexbg { background: rgba(255, 227, 107, 0.32); }
.bd-d-grid.blue .bd-d-hex.taken .bd-d-hexbg { background: #6474f2; }
.bd-d-grid.red .bd-d-hex.taken .bd-d-hexbg { background: #e8606b; }
.bd-d-hex.sel .bd-d-hexbg { background: #ffe36b !important; }
.bd-d-hexbg canvas { display: block; }
.bd-d-n { margin-top: -4px; font-size: 16px; font-weight: 800; color: #fff; -webkit-text-stroke: 4px var(--ol); paint-order: stroke fill; }

/* ---- codes ---- */
.bd-d-codebox, .bd-d-paste { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; }
.bd-d-label { grid-column: 1 / -1; font-size: 13px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: #5a4f72; }
.bd-d-code, .bd-d-field { width: 100%; min-width: 0; resize: none; padding: 8px 10px; border: 3px solid var(--ol); border-radius: 12px; background: #fff; color: #2f2437;
  font: 700 16px/1.35 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.5px; pointer-events: auto; user-select: text; -webkit-user-select: text; }
.bd-d-code { background: #f4f0ff; }
.bd-d-code:focus, .bd-d-field:focus { outline: none; }
.kbd .bd-d-code:focus-visible, .kbd .bd-d-field:focus-visible { outline: 4px solid #ffe36b; outline-offset: 2px; }
.bd-d-codebox .bd-d-status, .bd-d-paste .bd-d-err { grid-column: 1 / -1; }
.bd-d-paste .bd-d-err:empty { display: none; }
.bd-d-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 700; line-height: 1.3; }

/* ---- result ---- */
.bd-d-verdict { text-align: center; font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: 1px; color: #ffe36b; -webkit-text-stroke: 8px var(--ol); paint-order: stroke fill; }
.bd-d-verdict.lose { color: #ffb3b9; }
.bd-d-verdict.draw { color: #fff; }
.bd-d-facts { display: flex; flex-direction: column; gap: 4px; text-align: center; font-size: 15px; font-weight: 700; line-height: 1.3; }
.bd-d-agree { padding: 8px 12px; border: 3px solid var(--ol); border-radius: 14px; text-align: center; font-size: 15px; font-weight: 800; line-height: 1.3; }
.bd-d-agree.ok { background: #c9f2a6; }
.bd-d-agree.wait { background: #ffe9a8; }
.bd-d-agree.bad { background: #ffd3d7; color: #6b1e26; }
.bd-d-hash { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 800; }
.bd-d-hash .v { padding: 2px 8px; border-radius: 8px; background: rgba(59, 51, 80, 0.1); font: 800 16px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px;
  user-select: text; -webkit-user-select: text; }

/* ---- the fight: the bar along the top, and whose half is whose ---- */
.bd-d-watch { position: absolute; left: 0; right: 0; top: 0; height: 56px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(180deg, rgba(24, 19, 36, 0.96), rgba(24, 19, 36, 0.8)); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18); pointer-events: auto; }
.bd-d-wtitle { font-size: 20px; font-weight: 800; letter-spacing: 1.5px; }
.bd-d-skip { height: 38px; padding: 0 16px; border: 3px solid var(--ol); border-radius: 19px; background: linear-gradient(180deg, #ffb36b, #e0782f);
  font-size: 16px; font-weight: 800; letter-spacing: 0.5px; -webkit-text-stroke: 4px var(--ol); paint-order: stroke fill; }
.bd-d-side { position: absolute; left: calc(var(--bx) + 16px); padding: 1px 10px; border: 3px solid var(--ol); border-radius: 12px; color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: 1px; line-height: 20px; -webkit-text-stroke: 3px var(--ol); paint-order: stroke fill; pointer-events: none; }
.bd-d-side.top { top: calc(var(--by) + 16px); background: #e8606b; }
.bd-d-side.bottom { top: calc(var(--by) + var(--bh) - 44px); background: #6474f2; }
.bd-d-side.you { box-shadow: 0 0 0 3px #ffe36b; }

/* the wide frame: the cards a little smaller, as the tray's are */
.bd.wide .bd-d-offer { width: 104px; }
.bd.wide .bd-d-cardbox { width: 104px; height: 163px; }
.bd.wide .bd-d-cardwrap { transform: scale(0.62); }
