/* ==========================================================================
   Battle Pencils — Battle Lab.

   An extension of the existing design system, not a new theme. Brand tokens
   (--red, --gold, --graphite, --cream, --display) come from redesign.css and
   are reused rather than redefined. Every selector is .bplab* prefixed so
   nothing here can reach the homepage, articles or existing pages.
   ========================================================================== */

.bplab {
	--ink: #1b1814;
	--soft: #6f6759;
	--hair: #e6e0d5;
	--sand: #faf7f1;
	--brass: #b08d3f;
	--win: #1f7a4d;
	--lose: #b32d2e;
	--panel: #fff;
	--shadow: 0 1px 2px rgba(27, 24, 20, .05), 0 8px 24px -16px rgba(27, 24, 20, .28);
}
.bplab *,
.bplab *::before,
.bplab *::after { box-sizing: border-box; }
.bplab p { margin: 0; }
.bplab { padding-top: clamp(108px, 12vw, 150px); }   /* clears the fixed header */
.bplab-in { width: min(1140px, calc(100vw - 40px)); margin-left: auto; margin-right: auto; }
.bplab-narrow { width: min(48rem, 100%); }

/* ---------- breadcrumb ---------- */
.bplab-crumb { padding-top: 26px; font-size: .8rem; color: var(--soft); }
.bplab-crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.bplab-crumb li::after { content: "/"; margin-left: 6px; color: var(--hair); }
.bplab-crumb li:last-child::after { content: ""; }
.bplab-crumb a { color: var(--soft); }
.bplab-crumb a:hover { color: var(--red); }

/* ---------- headings ---------- */
.bplab-eyebrow {
	font-size: .72rem; letter-spacing: .26em; text-transform: uppercase;
	color: var(--red); font-weight: 700; margin: 0 0 14px;
}
.bplab h1.bplab-h1 {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: clamp(2rem, 5.2vw, 3.6rem); line-height: .98; letter-spacing: .5px;
	color: var(--ink); margin: 0; text-wrap: balance;
}
.bplab h2.bplab-h2 {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: clamp(1.4rem, 3vw, 2.1rem); line-height: 1.06; letter-spacing: .4px;
	color: var(--ink); margin: 0; text-wrap: balance;
}
.bplab h3.bplab-h3 {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .96rem; letter-spacing: .07em; color: var(--ink); margin: 0;
}
.bplab .bplab-lede {
	margin-top: 18px; max-width: 40rem;
	font-size: clamp(1.04rem, 1.9vw, 1.2rem); line-height: 1.65; color: var(--soft);
}
.bplab-sec { margin-top: clamp(46px, 6vw, 80px); }
.bplab .bplab-prose { margin-top: 16px; max-width: 40rem; font-size: 1.02rem; line-height: 1.72; color: var(--soft); }
.bplab .bplab-prose + .bplab-prose { margin-top: 14px; }

/* ---------- console panel: the shared surface every tool sits on ---------- */
.bplab-console {
	margin-top: 28px; background: var(--panel); border: 1px solid var(--hair);
	border-radius: 14px; padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow);
}
.bplab-console + .bplab-console { margin-top: 20px; }

/* ---------- form controls (44px minimum targets) ---------- */
.bplab-controls { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.bplab-field { min-width: 0; }
.bplab-label {
	display: block; margin-bottom: 7px; font-family: var(--display); font-weight: 900;
	text-transform: uppercase; font-size: .7rem; letter-spacing: .13em; color: var(--soft);
}
.bplab-select, .bplab-input {
	width: 100%; min-height: 46px; padding: 11px 13px; font: inherit; font-size: 1rem;
	color: var(--ink); background: #fff; border: 1px solid var(--hair);
	border-radius: 9px; appearance: none;
}
.bplab-select {
	background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%),
		linear-gradient(135deg, var(--soft) 50%, transparent 50%);
	background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 38px;
}
.bplab-select:focus-visible, .bplab-input:focus-visible,
.bplab-btn:focus-visible, .bplab-chip:focus-visible, .bplab a:focus-visible {
	outline: 3px solid var(--red); outline-offset: 2px;
}
.bplab-hint { margin-top: 7px; font-size: .84rem; line-height: 1.5; color: var(--soft); }

/* ---------- buttons ---------- */
.bplab-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 9px;
	min-height: 46px; padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .82rem; letter-spacing: .08em; cursor: pointer;
	transition: transform .16s ease, background-color .2s, color .2s, border-color .2s;
}
.bplab-btn-primary { background: var(--red); color: #fff; }
.bplab-btn-primary:hover { background: #a3161c; color: #fff; }
.bplab-btn-ghost { background: #fff; color: var(--ink); border-color: var(--hair); }
.bplab-btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.bplab-btn:active { transform: translateY(1px); }
.bplab-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.bplab-btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.bplab-chip {
	display: inline-flex; align-items: center; gap: 7px; min-height: 40px;
	padding: 8px 15px; border-radius: 999px; border: 1px solid var(--hair);
	background: #fff; color: var(--soft); cursor: pointer;
	font-size: .84rem; font-weight: 600; transition: border-color .2s, color .2s, background-color .2s;
}
.bplab-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--sand); }
.bplab-chip:hover { border-color: var(--ink); }

/* ---------- arena ---------- */
.bplab-arena {
	display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(14px, 3vw, 34px);
	align-items: center; margin-top: 22px;
}
.bplab-vs {
	font-family: var(--display); font-weight: 900; font-size: clamp(1.1rem, 3vw, 1.8rem);
	color: var(--red); letter-spacing: .08em; text-align: center;
}
.bplab-fighter {
	text-align: center; padding: clamp(14px, 2.4vw, 24px) 12px;
	border: 1px solid var(--hair); border-radius: 12px; background: var(--sand);
	min-width: 0;
}
.bplab-fighter img {
	width: 100%; max-width: 168px; aspect-ratio: 1 / 1; object-fit: contain;
	display: block; margin: 0 auto 12px;
}
.bplab-fighter-ph {
	width: 100%; max-width: 168px; aspect-ratio: 1 / 1; margin: 0 auto 12px;
	display: grid; place-items: center; border-radius: 10px;
	background: #fff; border: 1px dashed var(--hair);
	font-family: var(--display); font-size: 2.4rem; color: var(--hair);
}
.bplab-fighter-name {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: clamp(.94rem, 2vw, 1.2rem); letter-spacing: .04em; color: var(--ink);
	line-height: 1.12; overflow-wrap: anywhere;
}
.bplab-fighter-meta { margin-top: 6px; font-size: .8rem; color: var(--soft); }
.bplab-score {
	display: block; margin-top: 12px; font-family: var(--display); font-weight: 900;
	font-size: clamp(2.2rem, 8vw, 3.6rem); line-height: 1; color: var(--ink);
	font-variant-numeric: tabular-nums;
}
.bplab-score[data-state="win"] { color: var(--win); }
.bplab-score[data-state="lose"] { color: var(--lose); }
.bplab-score:not([data-state]), .bplab-score[data-state=""] { font-family: inherit; font-weight: 700; color: var(--hair); }
.bplab-score-sym { display: block; margin-top: 4px; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
@media (max-width: 700px) {
	.bplab-arena { grid-template-columns: 1fr; }
	.bplab-vs { padding: 2px 0; }
}

/* rolling animation, suppressed under reduced motion */
.bplab-score.is-rolling { animation: bplab-roll .5s steps(6) infinite; }
@keyframes bplab-roll { 0% { opacity: 1; } 50% { opacity: .35; } 100% { opacity: 1; } }
.bplab-reveal { animation: bplab-pop .32s ease-out; }
@keyframes bplab-pop { from { transform: scale(.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- outcome ---------- */
.bplab-outcome {
	margin-top: 20px; padding: 15px 18px; border-radius: 11px;
	background: var(--sand); border: 1px solid var(--hair);
	display: flex; align-items: center; gap: 12px;
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .96rem; letter-spacing: .04em; color: var(--ink);
}
.bplab-outcome .bplab-oi {
	display: grid; place-items: center; width: 30px; height: 30px; flex: none;
	border-radius: 50%; background: var(--ink); color: #fff; font-size: .8rem;
}
.bplab-outcome[data-o="win"] .bplab-oi { background: var(--win); }
.bplab-outcome[data-o="lose"] .bplab-oi { background: var(--lose); }
.bplab-outcome[data-o="tie"] .bplab-oi { background: var(--brass); }

/* ---------- tables ---------- */
.bplab-tablewrap { margin-top: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bplab-table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 30rem; }
.bplab-table caption {
	caption-side: top; text-align: left; padding-bottom: 12px;
	font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--soft);
}
.bplab-table th, .bplab-table td {
	padding: 12px 14px 12px 0; text-align: left; vertical-align: top;
	border-bottom: 1px solid var(--hair);
}
.bplab-table thead th {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .7rem; letter-spacing: .1em; color: var(--ink); border-bottom-color: var(--ink);
	white-space: nowrap;
}
.bplab-table tbody th { font-weight: 600; color: var(--ink); }
.bplab-table td { color: var(--soft); }
.bplab-table .bplab-n { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.bplab-table tbody tr:hover { background: var(--sand); }
.bplab-sortable th button {
	all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
	min-height: 44px; font: inherit; color: inherit;
}
.bplab-sortable th button::after { content: "↕"; opacity: .35; font-size: .8em; }
.bplab-sortable th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
.bplab-sortable th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
@media (max-width: 600px) {
	.bplab-table { font-size: .88rem; min-width: 26rem; }
	.bplab-table th, .bplab-table td { padding: 10px 10px 10px 0; }
}

/* ---------- statistic grid ---------- */
.bplab-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin-top: 18px; }
.bplab-stat { padding: 14px; border: 1px solid var(--hair); border-radius: 10px; background: #fff; min-width: 0; }
.bplab-stat dt {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .64rem; letter-spacing: .12em; color: var(--soft);
}
.bplab-stat dd {
	margin: 6px 0 0; font-family: var(--display); font-weight: 900; font-size: 1.5rem;
	color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1;
}
.bplab-stat small { display: block; margin-top: 6px; font-family: inherit; font-weight: 400; font-size: .76rem; color: var(--soft); letter-spacing: 0; text-transform: none; }

/* ---------- meters ---------- */
.bplab-meter { margin-top: 12px; }
.bplab-meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .8rem; color: var(--soft); }
.bplab-meter-track { margin-top: 6px; height: 9px; border-radius: 999px; background: var(--hair); overflow: hidden; }
.bplab-meter-fill { height: 100%; border-radius: 999px; background: var(--red); transition: width .5s ease; }
.bplab-meter-fill[data-v="win"] { background: var(--win); }

/* ---------- chart ---------- */
.bplab-chart { margin: 18px 0 0; }
.bplab-chart svg { width: 100%; height: clamp(130px, 22vw, 190px); overflow: visible; }
.bplab-bar { fill: var(--red); }
.bplab-bar-l { font-size: 3.1px; fill: var(--soft); text-anchor: middle; font-family: inherit; }
.bplab-chart figcaption { margin-top: 10px; font-size: .82rem; color: var(--soft); }

/* ---------- notices and empty states ---------- */
.bplab .bplab-unofficial {
	margin-top: 16px; padding: 12px 15px; border-radius: 9px;
	background: #fdf6e3; border: 1px solid #e8d9a8; color: #6b5320;
	font-size: .88rem; line-height: 1.55;
}
.bplab-empty {
	margin-top: 18px; padding: clamp(22px, 4vw, 34px); border-radius: 11px;
	background: var(--sand); border: 1px dashed var(--hair); color: var(--soft);
	font-size: .96rem; line-height: 1.65;
}
.bplab .bplab-empty-t {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .9rem; letter-spacing: .05em; color: var(--ink); margin-bottom: 8px;
}

/* ---------- tool cards ---------- */
.bplab-tools { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 24px; }
.bplab-tool {
	display: flex; flex-direction: column; gap: 9px; padding: 22px;
	border: 1px solid var(--hair); border-radius: 13px; background: #fff;
	text-decoration: none; min-width: 0;
	transition: transform .2s ease, border-color .2s, box-shadow .2s;
}
.bplab-tool:hover { transform: translateY(-3px); border-color: var(--ink); box-shadow: var(--shadow); }
.bplab-tool-ico { font-size: 1.5rem; line-height: 1; }
.bplab-tool-t {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: 1.02rem; letter-spacing: .03em; color: var(--ink); line-height: 1.15;
}
.bplab-tool p { font-size: .92rem; line-height: 1.6; color: var(--soft); }
.bplab-tool-go {
	margin-top: auto; padding-top: 8px; font-family: var(--display); font-weight: 900;
	text-transform: uppercase; font-size: .74rem; letter-spacing: .1em; color: var(--red);
}
.bplab-tool:hover .bplab-tool-go::after { margin-left: 6px; }
.bplab-tool-go::after { content: "→"; margin-left: 4px; transition: margin-left .2s ease; display: inline-block; }
.bplab-tool--feature { background: var(--sand); }

/* ---------- roster grid ---------- */
.bplab-roster { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); margin-top: 22px; }
.bplab-card {
	padding: 16px; border: 1px solid var(--hair); border-radius: 12px; background: #fff;
	text-decoration: none; display: block; min-width: 0;
	transition: transform .2s ease, border-color .2s;
}
.bplab-card:hover { transform: translateY(-3px); border-color: var(--ink); }
.bplab-card img, .bplab-card .bplab-card-ph {
	width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; margin-bottom: 10px;
	border-radius: 8px; background: var(--sand);
}
.bplab-card .bplab-card-ph { display: grid; place-items: center; font-family: var(--display); font-size: 2rem; color: var(--hair); }
.bplab-card-n { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: .88rem; color: var(--ink); line-height: 1.15; overflow-wrap: anywhere; }
.bplab-card-m { margin-top: 5px; font-size: .76rem; color: var(--soft); }
.bplab-tag {
	display: inline-block; margin-top: 8px; padding: 3px 9px; border-radius: 999px;
	font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
}
.bplab-tag--official { background: #eef7f1; color: var(--win); }
.bplab-tag--fan { background: #fdf6e3; color: #6b5320; }
.bplab-tag--nodata { background: #fbeceb; color: var(--lose); }

/* ---------- toast ---------- */
.bplab-toast {
	position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
	background: var(--graphite, #221f18); color: #fff; padding: 12px 20px; border-radius: 999px;
	font-size: .88rem; opacity: 0; pointer-events: none; z-index: 999;
	transition: opacity .25s ease, transform .25s ease;
}
.bplab-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- related links ---------- */
.bplab-related { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 18px; }
.bplab-related a {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .78rem; letter-spacing: .09em; color: var(--ink);
	border-bottom: 1px solid var(--hair); padding-bottom: 4px;
}
.bplab-related a:hover { color: var(--red); border-bottom-color: var(--red); }

.bplab-visually-hidden {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.bplab-tool, .bplab-card, .bplab-btn, .bplab-meter-fill,
	.bplab-score, .bplab-reveal, .bplab-toast {
		transition: none !important; animation: none !important;
	}
	.bplab-tool:hover, .bplab-card:hover { transform: none; }
}

/* ---------- print ---------- */
@media print {
	.site-header, .site-footer, .nav-overlay, .bplab-crumb,
	.bplab-btnrow, .bplab-controls, .bplab-related, .bplab-toast,
	.bplab-noprint { display: none !important; }
	.bplab { --shadow: none; }
	.bplab-console { border: 1px solid #000; border-radius: 0; box-shadow: none; break-inside: avoid; }
	.bplab-table { min-width: 0; font-size: 11pt; }
	.bplab-table thead { display: table-header-group; }
	.bplab-table tr { break-inside: avoid; }
	body { background: #fff !important; }
	.bplab a { text-decoration: none; color: #000; }
	.bplab-in { width: 100%; }
	@page { margin: 14mm; }
}

/* the crossed-swords character is outside the display face, so it is rendered
   in the body font to avoid a fallback box */
.bplab-vs-s { font-family: proxima-nova, system-ui, sans-serif; font-weight: 400; }

/* Native checkboxes render around 13px, below the 44px minimum target. The
   label is made the hit area and the box itself is enlarged. */
.bplab-pick {
	display: flex; align-items: center; gap: 10px; cursor: pointer;
	min-height: 44px; padding: 2px 0;
}
.bplab-pick input[type="checkbox"] {
	width: 22px; height: 22px; flex: none; margin: 0; cursor: pointer;
	accent-color: var(--red);
}

/* ---------- hub: one grid, light hierarchy ---------- */
.bplab-filters { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.bplab-chip-n {
	display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px;
	border-radius: 999px; background: var(--hair); color: var(--ink);
	font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.bplab-chip[aria-pressed="true"] .bplab-chip-n { background: var(--ink); color: #fff; }
.bplab-tool-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bplab-tool-flag {
	font-family: var(--display); font-weight: 900; text-transform: uppercase;
	font-size: .58rem; letter-spacing: .12em; color: var(--red);
	background: #fbeceb; border-radius: 999px; padding: 4px 9px;
}
.bplab-tool-cat {
	margin-top: 2px; font-size: .68rem; letter-spacing: .14em;
	text-transform: uppercase; color: var(--soft);
}
.bplab-tool[hidden] { display: none; }
#bp-filter-empty[hidden] { display: none; }
