/* Account deck builder (duel/public/deckbuilder.js) */
body.dk-open { overflow: hidden; }
.dk-backdrop { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 12, 0.78); backdrop-filter: blur(5px); }
.dk-dialog { position: relative; width: min(1120px, 100%); max-height: min(94dvh, 960px); display: flex; flex-direction: column; border: 1px solid var(--line, #2a2f3b); border-radius: 18px; background: var(--surface, #161a22); color: var(--text, #f1f2f5); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); overflow: hidden; }
.dk-x { position: absolute; right: 12px; top: 10px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; color: var(--muted, #aab); background: var(--surface-2, #20242e); }
.dk-x:hover { color: var(--text, #fff); }
.dk-body { flex: 1; min-height: 0; overflow: auto; padding: 22px 24px 0; display: flex; flex-direction: column; }
.dk-body > h2 { margin: 0 44px 6px 0; font-size: 22px; }
.dk-body > h2 small { color: var(--muted, #aab); font-size: 14px; font-weight: 600; margin-left: 6px; }
.dk-help { color: var(--muted, #aab); font-size: 14px; line-height: 1.5; margin: 4px 0 14px; max-width: 80ch; }
.dk-empty { color: var(--muted, #aab); margin: 18px 0; }
.dk-bad { color: #ff9b8a; font-size: 13px; }
.dk-msg { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2, #20242e); color: var(--accent, #ffd24a); font-size: 14px; }
.dk-bar .dk-msg { flex: 1 1 100%; margin: 0; }
.dk-body > h2 + .dk-msg { margin: 4px 0 10px; }
.dk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 16px 0 22px; }
.dk-actions small { color: var(--muted, #aab); }
.dk-list { display: grid; gap: 8px; align-items: start; }
.dk-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "hero main fan actions" "all all all all"; align-items: center; gap: 4px 18px; padding: 14px 16px 12px 18px; border: 1px solid color-mix(in srgb, var(--fc, #888) 38%, var(--line, #2a2f3b)); border-radius: 14px; overflow: hidden; background: linear-gradient(100deg, color-mix(in srgb, var(--fc2, #333) 62%, #0e1118) 0%, var(--surface-2, #1c202a) 58%); }
.dk-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--fc3, var(--fc, #888)), var(--fc, #888)); }
.dk-row.bad { border-color: #8a4036; }
.dk-hero { grid-area: hero; position: relative; width: 76px; height: 76px; flex: none; }
.dk-hero > img, .dk-hero-icon { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #10141c; box-shadow: 0 0 0 3px var(--fc, #888), 0 0 18px color-mix(in srgb, var(--fc, #888) 55%, transparent); }
.dk-hero-icon { display: grid; place-items: center; font-size: 34px; }
.dk-hero2 { position: absolute; right: -8px; bottom: -4px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; background: color-mix(in srgb, var(--fc2, #333) 80%, #000); box-shadow: 0 0 0 2px var(--fc, #888), 0 3px 8px #0009; }
.dk-row-main { grid-area: main; min-width: 0; display: grid; gap: 5px; }
.dk-row-main strong { font: 600 20px/1.15 var(--font-display, inherit); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-row-main small { color: var(--muted, #aab); }
.dk-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dk-tags i { font-style: normal; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; color: #d9dde8; background: #0b0e15a0; border: 1px solid #ffffff1c; }
.dk-tags i.special { color: #ffe199; border-color: #ffd36a88; background: #3a2c0a99; }
.dk-mc { display: flex; align-items: flex-end; gap: 4px; height: 46px; margin-top: 2px; }
.dk-mc s { text-decoration: none; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; width: 22px; height: 100%; }
.dk-mc i { font-style: normal; font-size: 10px; line-height: 12px; color: #c6cbd8; min-height: 12px; }
.dk-mc em { align-self: end; width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(var(--fc3, #ffd24a), var(--fc, #ffd24a)); }
.dk-mc b { font-size: 9.5px; line-height: 12px; color: var(--muted, #aab); }
.dk-fan { grid-area: fan; display: flex; align-items: flex-end; justify-content: center; height: 124px; padding: 0 12px 16px 0; }
.dk-fan-card { display: block; flex: none; margin-left: -34px; z-index: var(--z); transform-origin: 50% 120%; transform: rotate(calc(var(--o) * 7deg)) translateY(calc(var(--o) * var(--o) * 3px)); transition: transform 0.2s; }
.dk-fan-card:first-child { margin-left: 0; }
.dk-fan-card .dl-card { box-shadow: 0 6px 12px #0009, 0 0 0 1px #0009; }
.dk-row:hover .dk-fan-card { transform: rotate(calc(var(--o) * 9deg)) translateY(calc(var(--o) * var(--o) * 3px - 4px)); }
.dk-row-actions { grid-area: actions; display: grid; gap: 8px; }
.dk-row-actions .btn { min-width: 92px; }
.dk-all { grid-area: all; margin-top: 4px; font-size: 13px; color: var(--muted, #aab); }
.dk-all summary { cursor: pointer; width: max-content; padding: 4px 0; }
.dk-peek { display: flex; flex-wrap: wrap; gap: 16px 12px; padding: 12px 4px 8px; }
.dk-peek-card { position: relative; display: block; }
.dk-peek-card.special .dl-card { box-shadow: 0 0 0 2px #ffd36a, 0 6px 12px #0009; }
.dk-peek-n { position: absolute; right: -6px; top: -8px; z-index: 3; min-width: 26px; padding: 0 6px; border-radius: 13px; background: #3dff95; color: #052a14; font: 800 13px/26px var(--font, sans-serif); text-align: center; box-shadow: 0 3px 8px #0008; }
.dk-del.armed { background: #7a2b22; color: #fff; }
.dk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; margin: 8px 0 6px; }
.dk-fields label { display: grid; gap: 4px; font-size: 13px; color: var(--muted, #aab); }
.dk-fields input, .dk-fields select { height: 40px; }
.dk-cards { padding: 4px 2px 10px; }
.dk-group h3 { margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line, #2a2f3b); font-size: 15px; color: var(--accent, #ffd24a); }
.dk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 16px 10px; justify-items: center; padding: 10px 0 6px; }
.dk-tile { position: relative; display: grid; gap: 6px; justify-items: center; padding: 4px; border-radius: 12px; transition: transform 0.15s, opacity 0.2s; }
.dk-tile[hidden], .dk-group[hidden] { display: none; }
.dk-pick { position: relative; cursor: pointer; border-radius: 12px; }
.dk-pick .dl-card { pointer-events: none; transition: filter 0.2s; }
.dk-tile:hover { transform: translateY(-3px); z-index: 3; }
.dk-tile.on .dk-pick { box-shadow: 0 0 0 3px #3dff95, 0 0 20px rgba(61, 255, 149, 0.4); }
.dk-tile.blocked .dk-pick { cursor: not-allowed; }
.dk-tile.blocked .dl-card { filter: grayscale(0.75) brightness(0.6); }
.dk-tile.special .dk-pick { box-shadow: 0 0 0 2px #ffd36a; }
.dk-tile.special .dl-card-name strong { white-space: normal; font-size: 0.78em; }
.dk-tile.special.on .dk-pick { box-shadow: 0 0 0 3px #3dff95, 0 0 0 6px #ffd36a; }
.dk-count { position: absolute; right: -6px; top: -8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; display: none; place-items: center; background: #3dff95; color: #052a14; font: 800 14px/28px var(--font, sans-serif); text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.dk-tile.on .dk-count { display: block; }
.dk-step { display: flex; align-items: center; gap: 6px; }
.dk-step button { width: 30px; height: 28px; border-radius: 8px; font-size: 18px; font-weight: 700; line-height: 1; background: var(--surface-2, #20242e); color: var(--text, #fff); }
.dk-step button:hover:not(:disabled) { background: var(--accent, #ffd24a); color: var(--accent-ink, #1a1300); }
.dk-step button:disabled { opacity: 0.35; cursor: not-allowed; }
.dk-step output { min-width: 34px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted, #aab); }
.dk-bar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 0 -24px; padding: 12px 24px 14px; border-top: 1px solid var(--line, #2a2f3b); background: var(--surface, #161a22); }
.dk-meter { display: grid; gap: 4px; min-width: 120px; }
.dk-meter b { font-size: 20px; font-variant-numeric: tabular-nums; }
.dk-meter i { display: block; height: 6px; border-radius: 3px; background: var(--surface-2, #20242e); overflow: hidden; }
.dk-meter u { display: block; height: 100%; width: 0; background: #3dff95; transition: width 0.2s; }
.dk-break { flex: 1 1 220px; color: var(--muted, #aab); font-size: 13px; }
.dk-curve { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.dk-curve s { text-decoration: none; display: grid; grid-template-rows: 1fr auto; justify-items: center; width: 17px; height: 100%; }
.dk-curve em { align-self: end; width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent, #ffd24a); }
.dk-curve b { font-size: 9px; color: var(--muted, #aab); }
.dk-editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 264px; align-items: start; gap: 24px; padding-bottom: 16px; }
.dk-editor-layout .dk-cards { min-width: 0; }
.dk-editor-layout .dk-bar { top: 18px; bottom: auto; margin: 16px 0 0; padding: 18px; display: grid; gap: 12px; border: 1px solid var(--line,#2a2f3b); border-radius: 8px; max-height: calc(100dvh - 36px); overflow: auto; }
.dk-summary-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted,#aab); }
.dk-editor-layout .dk-meter b { font-size: 32px; line-height: 1.1; }
.dk-editor-layout .dk-meter { gap: 10px; }
.dk-editor-layout .dk-break { line-height: 1.6; }
.dk-editor-layout .dk-curve { height: 48px; justify-content: space-between; }
.dk-status { font-size: 11px; line-height: 1.5; margin: 0; }
.dk-selected-list { max-height: 24dvh; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dk-selected-row { display: grid; grid-template-columns: 23px minmax(0,1fr) auto 25px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid #ffffff20; font-size: 10px; }
.dk-selected-row > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-selected-cost { display: grid; place-items: center; width: 22px; height: 25px; background: #285a8a; color: #fff; clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%); font-weight: 800; }
.dk-selected-row button { width: 25px; height: 25px; background: #ffffff15; color: inherit; border: 1px solid #ffffff30; border-radius: 3px; font-size: 16px; }
.dk-selected-row button:hover { background: #ffffff30; }
.dk-selected-empty { font-size: 11px; line-height: 1.5; opacity: .7; margin: 0; }
@media (max-width: 850px) {
  .dk-editor-layout { display: block; }
  .dk-editor-layout .dk-bar { top: auto; bottom: 8px; max-height: none; overflow: visible; grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; }
  .dk-editor-layout .dk-summary-title,.dk-editor-layout .dk-curve,.dk-selected-list { display: none; }
  .dk-editor-layout .dk-meter { grid-column: 1; grid-row: 1; gap: 5px; }
  .dk-editor-layout .dk-meter b { font-size: 24px; }
  .dk-editor-layout [data-dk-save] { grid-column: 2; grid-row: 1; }
  .dk-editor-layout .dk-break { grid-column: 1/-1; font-size: 10px; }
  .dk-editor-layout .dk-status { grid-column: 1; }
  .dk-editor-layout [data-dk-back] { grid-column: 2; padding: 6px 10px; min-height: 30px; font-size: 10px; }
  .dk-editor-layout .dk-msg { grid-column: 1/-1; }
}
@media (max-width: 640px) {
  .dk-backdrop { padding: 0; }
  .dk-dialog { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .dk-body { padding: 16px 14px 0; }
  .dk-bar { margin: 0 -14px; padding: 10px 14px 12px; }
  .dk-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .dk-row { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "hero main" "fan fan" "actions actions" "all all"; padding: 14px 14px 10px 16px; gap: 10px 14px; }
  .dk-hero { width: 62px; height: 62px; }
  .dk-fan { justify-content: flex-start; padding: 0 0 18px 20px; }
  .dk-row-actions { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .dk-peek { gap: 14px 8px; justify-content: center; }
}
