/* Drop deck page (deck.html): tokens and base controls come from style.css. */
/* Shared by deck.html, mechlab.html and library.html (never loaded by the map tool): charter fonts and tokens,
   top bar, tool navigation, language menu (docs/design/CHARTE.md). */
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/chakra-petch-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 700; font-display: swap; src: url("vendor/fonts/chakra-petch-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("vendor/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); }
:root {
  --danger: #ff6b70;   /* the site's value (charte §11 n° 2) */
  --danger-soft: rgba(255, 107, 112, .1);
  --ok-soft: rgba(70, 209, 122, .1);
  --backdrop: rgba(0, 0, 0, .55);
  --hero: #b98a2e;
  --cls-light: #5cc8ff; --cls-medium: #46d17a; --cls-heavy: #f0a53a; --cls-assault: #ff6b70;
  --f-display: "Chakra Petch", system-ui, "Segoe UI", "Noto Sans Thai", sans-serif;
  --f-body: "Barlow", system-ui, "Segoe UI", "Noto Sans Thai", sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
body.deckpage { font-family: var(--f-body); font-size: 13.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* buttons: Chakra Petch capitals; the main action (amber) has cut corners, its focus ring removes the cut */
.deckpage #topbar button, .deckpage #topbar .btn, .dk-tbtn, .dk-head button, .dk-dlg-actions button, .dk-empty button, .dk-loading button {
  font-family: var(--f-display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.deckpage button.primary, .deckpage .btn.primary { --cut: 6px; border-radius: 0; clip-path: var(--ch); }
.deckpage .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.deckpage .btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.deckpage button.primary:focus-visible, .deckpage .btn.primary:focus-visible { clip-path: none; }
.deckpage #saveState, .deckpage #count { font-family: var(--f-data); font-size: 11px; letter-spacing: .04em; }
/* tool navigation, same order on every page: Map · Lab · Decks · My mechs */
.dk-tools { display: flex; align-self: stretch; margin-left: 4px; border-left: 1px solid var(--line); }
.dk-tools a { display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none;
  font: 600 12px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.dk-tools a:hover { color: var(--text-strong); background: var(--surface-3); }
.dk-tools a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
/* language menu: globe + code, list of full names (js/lang-menu.js, same as the site header) */
.dk-lang { display: flex; align-items: center; margin-left: 4px; }
.lang-menu { position: relative; }
.lang-menu__toggle { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border-radius: 2px; color: var(--muted);
  font: 400 12px/1 var(--f-data); cursor: pointer; list-style: none; user-select: none; }
.lang-menu__toggle::-webkit-details-marker { display: none; }
.lang-menu__toggle::after { content: "▾"; font-size: 10px; }
.lang-menu__toggle:hover, .lang-menu[open] > .lang-menu__toggle { background: var(--surface-3); color: var(--text-strong); }
.lang-menu__list { position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); display: flex; flex-direction: column; gap: 2px; min-width: max-content;
  margin: 0; padding: 4px; list-style: none; background: var(--surface-1); border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.deckpage #topbar .dk-menu button { font: 400 13px/1.4 var(--f-body); letter-spacing: 0; text-transform: none; }
.deckpage #topbar .lang-menu__btn { font: 400 13px/1.4 var(--f-body); letter-spacing: 0; text-transform: none; }
.lang-menu__btn { display: flex; width: 100%; align-items: center; padding: 4px 10px; border-color: transparent; background: none; color: var(--muted); text-align: left; }
.lang-menu__btn:hover { background: var(--surface-3); color: var(--text-strong); }
.lang-menu__btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
html, body { overflow: auto; height: auto; min-height: 100%; }
.deckpage { padding-top: var(--tb-h); }
.deckpage #topbar { align-items: center; gap: 8px; padding-right: 10px; background: var(--surface-1); border-bottom: 1px solid var(--line); }
.deckpage .tb-brand { align-self: stretch; }
.dk-title { margin: 0 4px; font: 700 15px/1 var(--f-display); color: var(--text-strong); letter-spacing: .08em; text-transform: uppercase; }
.dk-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.dk-field select { max-width: 240px; }
#saveState { color: var(--muted); font-size: 12px; }
#saveState[data-state="error"] { color: var(--danger); }
#saveState[data-state="saving"], #saveState[data-state="pending"] { color: var(--accent); }
.btn { text-decoration: none; display: inline-flex; align-items: center; }
/* top bar buttons and menu items carrying an icon (<i data-ui-icon> filled by fillIcons) */
.dk-tbtn { display: inline-flex; align-items: center; gap: 6px; }
.dk-tbtn.sq { padding: 3px 5px; }
.dk-tbtn i[data-ui-icon], .dk-menu i[data-ui-icon], .ml-ico { display: inline-grid; place-items: center; line-height: 0; flex: none; }
.dk-tbtn svg, .dk-menu svg { width: 16px; height: 16px; }
.dk-menu button i[data-ui-icon] { color: var(--muted); }
.dk-menu button:hover i[data-ui-icon] { color: var(--text); }
.dk-menu button.danger i[data-ui-icon] { color: var(--danger); }
.dk-menuwrap { position: relative; }
.dk-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: var(--surface-1); border: 1px solid var(--line); box-shadow: var(--shadow-pop); padding: 4px; }
.dk-menu button:disabled { opacity: .4; }

.dk-notice { margin: 8px 12px 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.dk-main { padding: 10px 12px 60px; }
/* loading state (js/page-loading.js): logo + indeterminate bar in the content area; failure in red with Retry */
.dk-loading { display: grid; justify-items: center; gap: 10px; margin: 12vh auto 0; padding: 0 12px; max-width: 420px; text-align: center; color: var(--muted); }
.dk-loading[hidden] { display: none; }
.dk-loading__logo { width: 40px; height: 40px; opacity: .85; }
.dk-loading p { margin: 0; }
.dk-loading__bar { position: relative; width: 200px; height: 3px; background: var(--surface-3); overflow: hidden; }
.dk-loading__bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: dk-loading 1.1s ease-in-out infinite; }
@keyframes dk-loading { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.dk-loading.is-failed .dk-loading__text, .dk-loading.is-failed .dk-loading__bar { display: none; }
.dk-loading__error { padding: 6px 10px; border-left: 3px solid var(--danger); background: var(--danger-soft); color: var(--text-strong); text-align: left; }
body.is-loading main { display: none !important; }
/* set in the HTML: top bar actions (icons, lists filled by the page script) hidden until the page is ready */
body.is-loading #topbar > :not(.tb-brand, .dk-title, .tb-spacer, .dk-tools, .dk-lang) { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .dk-loading__bar::after { animation: none; width: 100%; opacity: .5; } }
.dk-empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* deck head: neutral panel, amber reserved for the active state (a 2px line on the left) */
.dk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 10px;
  background: var(--surface-1); border: 1px solid var(--line); box-shadow: inset 2px 0 0 var(--accent); }
.dk-head button { display: inline-flex; align-items: center; gap: 6px; }
.dk-head button svg { width: 16px; height: 16px; }
.dk-name { font: 700 15px/1.3 var(--f-display); letter-spacing: .06em; text-transform: uppercase; min-width: 200px; color: var(--text-strong); }
.dk-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.dk-chip { display: inline-block; padding: 1px 7px; border: 1px solid var(--line-strong); background: var(--surface-2); font: 11px/1.6 var(--f-data); white-space: nowrap; }
.dk-chip.bad { border-color: var(--danger); color: var(--danger); }
.dk-chip.cls-light { border-left: 3px solid var(--cls-light); }
.dk-chip.cls-medium { border-left: 3px solid var(--cls-medium); }
.dk-chip.cls-heavy { border-left: 3px solid var(--cls-heavy); }
.dk-chip.cls-assault { border-left: 3px solid var(--cls-assault); }

/* one drop: header, table, issues, notes */
.dk-drop { margin: 0 0 18px; border: 1px solid var(--line); background: var(--surface-1); }
.dk-drophead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px 6px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dk-label { font: 700 13px/1.3 var(--f-display); letter-spacing: .06em; text-transform: uppercase; width: 150px; color: var(--text-strong); }
.dk-map { max-width: 220px; }
.dk-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.dk-ibtn { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; color: var(--muted); text-decoration: none;
  background: transparent; border: 1px solid transparent; }
.dk-ibtn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); }
.dk-ibtn svg { width: 16px; height: 16px; }
.dk-ibtn.danger:hover { color: var(--danger); }
.dk-ibtn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.dk-yes { display: inline-grid; place-items: center; color: var(--ok); }
.dk-yes svg { width: 14px; height: 14px; }

.dk-tablewrap { overflow-x: auto; }
.dk-table { width: 100%; border-collapse: collapse; }
.dk-table th, .dk-table td { padding: 2px 4px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.dk-table thead th { background: var(--surface-1); color: var(--muted); font: 500 10.5px/1.8 var(--f-data); letter-spacing: .08em; text-transform: uppercase; position: sticky; top: 0; }
.dk-table input, .dk-table select { width: 100%; border-color: transparent; background: transparent; }
.dk-table input:hover, .dk-table select:hover, .dk-table input:focus { border-color: var(--line-strong); background: var(--bg); }
.dk-table input:disabled, .dk-table select:disabled { opacity: 1; cursor: default; }
.dk-table .c-cls { width: 34px; font-weight: 700; text-align: center; }
.dk-table td.c-cls[data-cls="light"] { color: var(--cls-light); }
.dk-table td.c-cls[data-cls="medium"] { color: var(--cls-medium); }
.dk-table td.c-cls[data-cls="heavy"] { color: var(--cls-heavy); }
.dk-table td.c-cls[data-cls="assault"] { color: var(--cls-assault); }
.dk-table .c-mech { min-width: 260px; }
.dk-table .c-ton { width: 56px; text-align: right; font-family: var(--f-data); }
.dk-tons { text-align: right; }
.dk-table .c-opt { font-size: 12px; }
.dk-table thead th.c-opt, .dk-table thead th.c-ton { font-size: 10.5px; }
.dk-code { min-width: 140px; font-family: var(--f-data); font-size: 11.5px; }
.dk-table .c-lance { width: 56px; }
.dk-table .c-pilot { min-width: 150px; }
.dk-table .c-comment { min-width: 160px; }
.dk-table .c-act { width: 60px; text-align: right; }
.dk-table tr.bad td { background: var(--danger-soft); }
.dk-table tr.bad td.c-cls { box-shadow: inset 3px 0 0 var(--danger); }
.dk-table tr.warn td.c-cls { box-shadow: inset 3px 0 0 var(--accent); }
.dk-table input.bad { color: var(--danger); }
.dk-newrow input::placeholder { color: var(--text-faint); font-style: italic; }
.dk-table tfoot td, .dk-table tfoot th { border-bottom: 0; padding-top: 4px; }
.dk-total-label { text-align: right !important; color: var(--muted); font-weight: 400; }
.dk-total { text-align: right; font: 700 13px/1.4 var(--f-data); color: var(--text-strong); }
.dk-delta { color: var(--branch); }
.dk-delta.bad { color: var(--danger); font-weight: 600; }

.dk-issues { list-style: none; margin: 0; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.dk-issues li::before { display: inline-block; width: 16px; }
.dk-issues li.error { color: var(--danger); }
.dk-issues li.error::before { content: "✕"; }
.dk-issues li.warn { color: var(--accent); }
.dk-issues li.warn::before { content: "!"; }
.dk-issues li.ok { color: var(--ok); }
.dk-issues li.ok::before { content: "✓"; }
.dk-issues li.note { color: var(--muted); white-space: pre-line; }
.dk-set { margin: 0 0 10px; border: 1px solid var(--line); background: var(--surface-1); }
.dk-set.bad { border-color: var(--danger); }
.dk-notes { display: block; width: calc(100% - 16px); margin: 0 8px 8px; resize: vertical; min-height: 26px; }

/* picker */
.dk-pick li { flex-direction: row; align-items: baseline; gap: 8px; }
.dk-pick li b { flex: 1; font-weight: 500; }
.dk-pick .cls { width: 14px; font-weight: 700; }
.dk-pick .cls[data-cls="light"] { color: var(--cls-light); }
.dk-pick .cls[data-cls="medium"] { color: var(--cls-medium); }
.dk-pick .cls[data-cls="heavy"] { color: var(--cls-heavy); }
.dk-pick .cls[data-cls="assault"] { color: var(--cls-assault); }

/* dialogs */
.dk-dlg { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 14px 16px; color: var(--text); background: var(--surface-1);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); }
.dk-dlg::backdrop { background: var(--backdrop); }
.dk-dlg.dk-small { width: min(420px, calc(100vw - 24px)); }
.dk-dlg h2 { margin: 0 0 8px; font: 700 16px/1.3 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.dk-dlg fieldset { border: 1px solid var(--line); margin: 0 0 10px; padding: 6px 10px 10px; }
.dk-dlg legend { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 0 4px; }
.dk-dlg textarea, .dk-dlg .dk-small input { width: 100%; }
.dk-dlg .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; max-height: 50vh; overflow: auto; }
.dk-dlg-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.dk-dlg .dk-small input, .dk-small input[type="text"] { width: 100%; }
.dk-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.dk-rules { display: flex; flex-direction: column; gap: 6px; }
.dk-rule { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dk-rule-label { width: 210px; color: var(--text); }
.dk-num { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.dk-num input { width: 74px; }
.dk-lines { display: flex; flex-direction: column; gap: 2px; }
.dk-lines span { color: var(--text); }
.dk-rules fieldset { margin: 0; }

.dk-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; max-width: min(640px, calc(100vw - 24px));
  padding: 8px 14px; background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); }
body.readonly .dk-newrow { display: none; }

@media (max-width: 700px) {
  .deckpage #topbar { flex-wrap: wrap; height: auto; position: static; padding: 6px; }
  .deckpage { padding-top: 0; }
  .dk-rule-label { width: 100%; }
}

/* plans of a set */
.dk-plans { display: inline-flex; align-items: center; gap: 2px; }
.dk-plan { padding: 2px 8px; font-size: 12px; background: var(--surface-2); border-color: var(--line); }
.dk-plan.on { background: var(--accent-bg); border-color: var(--accent); color: var(--text-strong); }
.dk-plan.ok { box-shadow: inset 0 -2px 0 var(--ok); }
.dk-plan.bad { box-shadow: inset 0 -2px 0 var(--danger); }
.dk-dlg select { max-width: 100%; }

/* build code button and its panel */
.dk-codebtn { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; font-size: 11.5px; color: var(--muted); background: transparent; border-style: dashed; }
.dk-codebtn.has { color: var(--blu); border-style: solid; }
.dk-codebtn svg { width: 14px; height: 14px; }
.dk-pop { position: fixed; z-index: 70; background: var(--surface-1); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); padding: 8px; }
.dk-codepop { width: 360px; }
.dk-codepop h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-strong); }
.dk-codepop textarea { width: 100%; font-family: var(--f-data); font-size: 11.5px; resize: vertical; }
.dk-colmenu { max-height: 60vh; overflow: auto; min-width: 200px; }
.dk-colmenu p { margin: 4px 8px; }

/* add / remove columns from the headers */
.dk-table thead th .dk-colx { display: inline-grid; place-items: center; vertical-align: middle; margin-left: 4px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); opacity: 0; font-size: 13px; line-height: 1; }
.dk-table thead th:hover .dk-colx, .dk-table thead th .dk-colx:focus-visible { opacity: 1; }
.dk-table thead th .dk-colx:hover { color: var(--danger); }
.dk-table thead .c-act .dk-ibtn { color: var(--text); }
.dk-table select.bad { color: var(--danger); border-color: var(--danger); }

/* columns moved by dragging their header */
.dk-table thead th[draggable="true"] { cursor: grab; user-select: none; }
.dk-table thead th.dragging { opacity: .45; }
.dk-table thead th.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.dk-table thead th.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.dk-foot { text-align: left; }
.dk-foot .dk-total-label { color: var(--muted); margin: 0 6px 0 calc(34px + 4px); }
.dk-foot .dk-total { color: var(--text-strong); margin-right: 14px; }

/* build name over its field: scrolls back and forth when it does not fit (js: markLongNames) */
.dk-mechwrap { position: relative; }
.dk-mechtext { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 7px; overflow: hidden; white-space: nowrap; pointer-events: none; }
.dk-mechtext > span { flex: none; }
.dk-table input.dk-masked:not(:focus) { color: transparent; }
.dk-mechwrap input:focus + .dk-mechtext { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .dk-mechtext.long > span { animation: marquee 6s ease-in-out infinite alternate; }
}

/* ---------------------------------------------------------------- charts of the analysis tools (js/analysis/charts.js)
   categorical slots validated on --surface-1 (dark): blue, orange, aqua, yellow, in this order */
:root { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-total: #d9dee5; }
.viz { position: relative; }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; font: 10px/1 var(--f-body); }
.viz-grid line, .viz-grid polygon { stroke: var(--line); stroke-width: 1; fill: none; }
.viz-grid polygon.mid { stroke: var(--line-strong); }
.viz-tick { fill: var(--text-faint); font-variant-numeric: tabular-nums; }
.viz-axis { fill: var(--muted); font-size: 10px; }
.viz-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-line.strong { stroke-width: 2.5; }
.viz-line.dash { stroke-dasharray: 5 4; }
.viz-area { fill: var(--c); fill-opacity: .1; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; }
.viz-dot { fill: var(--c); stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
.viz-cross, .viz-marker { stroke: var(--line-strong); stroke-width: 1; }
.viz-band { fill: var(--accent-soft); }
.viz-over { fill: var(--danger-soft); }
.viz-hit { fill: transparent; cursor: crosshair; }
/* draggable marker (lineChart drag): wide invisible grip over the line */
.viz-handle { stroke: transparent; stroke-width: 12; cursor: ew-resize; touch-action: none; }
.viz-handle:focus-visible { stroke: var(--accent-soft); outline: none; }
.viz-marker.drag { stroke: var(--accent); stroke-width: 1.5; }
.viz-svg.dragging { cursor: ew-resize; }
.viz-pt { fill: var(--c); stroke: var(--surface-1); stroke-width: 1.5; }
.viz-pt.front { stroke-width: 2; }
.viz-pt.pick { cursor: pointer; }
.viz-pt.pick:hover { stroke: var(--text-strong); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0; color: var(--muted); font-size: 12px; }
.viz-key { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.viz-mark { flex: none; display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--c); }
.viz-mark.dash { border-top-style: dashed; }
.viz-mark.dot { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--c); }
.viz-mark.none { background: none; }
.viz-mark.swatch { width: 10px; height: 10px; border: 0; background: var(--c); }
.viz-tip { position: absolute; z-index: 5; min-width: 120px; max-width: 260px; padding: 6px 8px; pointer-events: none; background: var(--overlay);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); font-size: 12px; }
.viz-tip b { display: block; margin-bottom: 3px; color: var(--text-strong); font-weight: 600; }
.viz-tiprow { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 6px; color: var(--muted); }
.viz-tiprow .v { color: var(--text-strong); font: 12px/1.4 var(--f-data); font-variant-numeric: tabular-nums; }
.viz-shape { flex: none; }

/* ---------------------------------------------------------------- build comparison (js/analysis/compare.js), drop analysis (drop.js) */
.an-field { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.an-num { width: 64px; }
.an-hint { margin: 4px 0 2px; font-size: 11.5px; }
.dk-anh { margin: 14px 0 4px; font: 600 11px/1.3 var(--f-display); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.cmp-dlg .dk-issues { padding: 0 0 8px; }
.cmp-dlg { width: min(1180px, calc(100vw - 24px)); }
.cmp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.cmp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; background: var(--surface-2); border: 1px solid var(--line); }
.cmp-chip .dk-ibtn { padding: 0 6px; line-height: 1.4; }
.cmp-pick { width: 220px; }
.cmp-status { font-size: 12px; }
.cmp-main { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cmp-radar .viz-legend { justify-content: center; }
.cmp-wait { padding: 60px 0; text-align: center; }
.cmp-tablewrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cmp-table th, .cmp-table td { padding: 3px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp-table thead th { color: var(--text-strong); font-weight: 600; white-space: nowrap; }
.cmp-table tbody th { color: var(--muted); font-weight: 400; }
.cmp-table td .v { font: 12.5px/1.4 var(--f-data); font-variant-numeric: tabular-nums; color: var(--text-strong); }
.cmp-table td .gap, .cmp-table td .p { margin-left: 6px; font: 11px/1.4 var(--f-data); color: var(--text-faint); white-space: nowrap; }
.cmp-table td .gap.good { color: var(--ok); }
.cmp-table td .gap.bad { color: var(--danger); }
.cmp-table td.ref { color: var(--text-faint); font: 11px/1.4 var(--f-data); white-space: nowrap; }
.cmp-table tr.txt td { font-size: 12px; color: var(--text); }
.cmp-table tr.gh th { padding-top: 10px; border-bottom-color: var(--line-strong); font: 600 10.5px/1.3 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.cmp-table tr.gh em { margin-right: 6px; font: 600 10px/1 var(--f-data); font-style: normal; color: var(--accent); }
.cmp-table td .note { margin-left: 4px; font: 11px/1.4 var(--f-data); color: var(--text-faint); white-space: nowrap; }
.cmp-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.cmp-charts figure { margin: 0; }
.cmp-charts figcaption { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font: 600 11px/1.3 var(--f-display); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 900px) { .cmp-main, .cmp-charts { grid-template-columns: 1fr; } }
/* mech sheet button next to the mech name (js/mechlab/sheet.js) */
.dk-mechwrap .dk-sheetbtn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); padding: 1px 3px; }
.dk-mechwrap:has(.dk-sheetbtn) input, .dk-mechwrap:has(.dk-sheetbtn) .dk-mechtext { padding-right: 28px; }

/* ---------------------------------------------------------------- top bar below 900 px (docs/specs/17-mobile.md)
   One line: logo + title + burger. Navigation, language and the page's controls move into the drawer #dkDrawer
   (js/topbar-drawer.js). From 900 px the drawer is transparent to the layout and the bar is unchanged. */
.dk-drawer { display: contents; }
.dk-burger, .dk-scrim { display: none; }
@media (max-width: 899px) {
  .dk-top { gap: 6px; padding-right: 6px; overflow: visible; }
  .dk-top .tb-brand { padding: 0 10px; }
  .dk-top .dk-title { flex: none; margin: 0 2px; font-size: 14px; }
  .dk-top .ml-variant { min-width: 0; flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dk-top > #saveState { display: none; }
  .dk-burger { display: inline-grid; place-items: center; width: 36px; height: 32px; margin-left: auto; padding: 0; flex: none; }
  .dk-scrim { position: fixed; inset: 0; z-index: 49; display: block; background: var(--backdrop); }
  .dk-scrim[hidden] { display: none; }
  .dk-drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); display: flex; flex-direction: column;
    align-items: stretch; gap: 10px; padding: calc(var(--tb-h) + 8px) 12px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto;
    background: var(--surface-1); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); transform: translateX(100%);
    visibility: hidden; transition: transform .18s ease, visibility 0s .18s; }
  .dk-drawer:not([inert]) { transform: none; visibility: visible; transition: transform .18s ease; }
  /* the burger stays above the drawer so it can close it */
  .dk-top > .dk-burger { position: relative; z-index: 51; }
  .dk-drawer > * { margin: 0; }
  .dk-drawer .dk-tools { order: -2; flex-direction: column; align-self: stretch; margin: 0; border-left: 0; border-top: 1px solid var(--line); }
  .dk-drawer .dk-tools a { padding: 0 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
  .dk-drawer .dk-lang { order: -1; align-self: flex-start; margin: 0; }
  .dk-drawer .lang-menu__list { position: static; box-shadow: none; margin-top: 4px; }
  .dk-drawer .dk-field { flex-direction: column; align-items: stretch; gap: 4px; }
  .dk-drawer .dk-field[hidden] { display: none; }
  .dk-drawer .dk-field select { max-width: none; width: 100%; }
  .dk-drawer .dk-tbtn, .dk-drawer .btn { justify-content: flex-start; min-height: 40px; }
  .dk-drawer .dk-menu { position: static; box-shadow: none; margin-top: 4px; }
  .dk-drawer > .tb-spacer { display: none; }
  .dk-drawer > #count { order: 99; }
  html.dk-drawer-open { overflow: hidden; }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) { .dk-drawer, .dk-drawer:not([inert]) { transition: none; } }
@media (max-width: 899px) and (pointer: coarse) {
  .dk-burger { width: var(--touch); height: var(--touch); }
  .dk-top .tb-brand { min-width: var(--touch); }
  .dk-drawer .dk-tbtn, .dk-drawer .btn { min-height: var(--touch); }
}

/* ---------------------------------------------------------------- decks below 900 px (docs/specs/17-mobile.md)
   Each mech of a drop is a card (grid of labelled values) instead of a table row; the header row is hidden. */
.dk-mobonly { display: none; }
.dk-picksheet { list-style: none; margin: 0; padding: 0; }
.dk-picksheet li { display: block; }
.dk-picksheet li button { display: flex; align-items: baseline; gap: var(--sp-2); width: 100%; min-height: var(--touch); padding: var(--sp-2) var(--sp-3); text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--line); }
.dk-picksheet li b { flex: 1; font-weight: 500; }
.dk-picksheet .cls { width: 14px; font-weight: 700; }
.dk-picksheet .cls[data-cls="light"] { color: var(--cls-light); }
.dk-picksheet .cls[data-cls="medium"] { color: var(--cls-medium); }
.dk-picksheet .cls[data-cls="heavy"] { color: var(--cls-heavy); }
.dk-picksheet .cls[data-cls="assault"] { color: var(--cls-assault); }
.dk-picksheet .dk-pickfree { color: var(--accent); }
.dk-picksheet .hint { padding: var(--sp-3); color: var(--muted); }
.dk-picksearch { width: 100%; margin-bottom: var(--sp-2); }
@media (max-width: 899px) {
  .dk-main { padding: var(--sp-2) var(--sp-2) 60px; }
  .dk-mobonly { display: inline-grid; }
  .dk-head, .dk-drophead { gap: var(--sp-2); }
  .dk-name { min-width: 0; flex: 1 1 160px; }
  .dk-label { width: auto; flex: 1 1 120px; min-width: 0; }
  .dk-map { max-width: 100%; flex: 1 1 140px; }
  .dk-tablewrap { overflow-x: visible; }
  .dk-table, .dk-table tbody, .dk-table tfoot, .dk-table tfoot tr, .dk-table tfoot td { display: block; width: 100%; }
  .dk-table thead { display: none; }
  .dk-table tbody { padding: var(--sp-2); display: grid; gap: var(--sp-2); }
  .dk-table tr[data-slot] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-1) var(--sp-2); padding: var(--sp-2);
    background: var(--surface-2); border: 1px solid var(--line); }
  .dk-table tr[data-slot].bad { border-color: var(--danger); }
  .dk-table tr[data-slot].warn { border-color: var(--accent); }
  .dk-table tr[data-slot] td { display: block; min-width: 0; width: auto; padding: 0; border: 0; white-space: normal; text-align: left; background: transparent; }
  .dk-table tr.bad td { background: transparent; }
  .dk-table tr[data-slot] td.c-cls { grid-column: 1; grid-row: 1; box-shadow: none; align-self: center; text-align: left; font-size: 15px; }
  .dk-table tr[data-slot] td.c-act { grid-column: 2; grid-row: 1; display: flex; justify-content: flex-end; gap: var(--sp-1); }
  .dk-table tr[data-slot] td.c-mech { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .dk-table tr[data-slot] td.c-comment, .dk-table tr[data-slot] td.c-pilot { grid-column: 1 / -1; }
  .dk-table tr[data-slot] td:not(.c-cls, .c-mech, .c-act)::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--muted);
    font: 500 10.5px/1.4 var(--f-data); letter-spacing: .06em; text-transform: uppercase; }
  .dk-table tr[data-slot] td:empty { display: none; }
  .dk-table tr[data-slot] td.c-ton { text-align: left; }
  .dk-table tr[data-slot] input, .dk-table tr[data-slot] select { border-color: var(--line); background: var(--bg); min-height: 32px; }
  .dk-table .c-mech input.dk-mech { font-weight: 600; color: var(--text-strong); }
  .dk-table input.dk-masked:not(:focus) { color: var(--text-strong); }
  .dk-mechtext { display: none; }
  .dk-table tr.dk-newrow { grid-template-columns: 1fr; }
  .dk-table tr.dk-newrow td:not(.c-mech) { display: none; }
  .dk-table tr.dk-newrow td.c-mech { grid-row: 1; }
  .dk-table tr.dk-newrow input { border-style: dashed; }
  .dk-table tfoot td.dk-foot { padding: var(--sp-2) var(--sp-3); }
  .dk-foot .dk-total-label { margin-left: 0; }
  .dk-dlg { max-width: calc(100vw - 16px); }
  .dk-dlg .list { grid-template-columns: 1fr; }
  .dk-dlg .list label { display: flex; align-items: center; gap: var(--sp-2); }
  .dk-dlg .list label span { flex: 1; min-width: 0; }
  .dk-codepop { width: min(360px, calc(100vw - 16px)); }
  .dk-plans { flex-wrap: wrap; }
}
@media (max-width: 899px) and (pointer: coarse) {
  .dk-ibtn { min-width: var(--touch); height: var(--touch); }
  .dk-table tr[data-slot] input, .dk-table tr[data-slot] select, .dk-table tr[data-slot] .dk-codebtn { min-height: var(--touch); }
  .dk-head button, .dk-drophead button, .dk-plan { min-height: var(--touch); }
  .dk-label, .dk-map, .dk-drophead select, .dk-drophead input { min-height: var(--touch); }
  .dk-dlg-actions button, .dk-dlg .list label { min-height: var(--touch); }
  .dk-picksearch { min-height: var(--touch); }
}

/* touch devices >= 900 px (tablets): 44 px targets in the shared top bar */
@media (pointer: coarse) {
  html:has(body.deckpage) { --tb-h: 46px; }
  .deckpage .tb-brand { min-width: var(--touch); }
  .lang-menu__toggle, .lang-menu__btn { min-height: var(--touch); }
}
