/* Device battles: the contender arena's ring (coral red and blue corners,
   corner ticks, monospace numbers) inside the RindBench pages. */
.battle {
  --red: #ff9081; --blue: #85ccff; --red-soft: rgb(255 144 129 / .14); --blue-soft: rgb(133 204 255 / .14);
  --amber: #f3c879; --tick: #819197; --steel: #171f23; --steel-2: #202a2e; --steel-line: #39464b;
  --ticks:
    linear-gradient(var(--tick), var(--tick)) top left / 10px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top left / 1px 10px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top right / 10px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top right / 1px 10px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom left / 10px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom left / 1px 10px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom right / 10px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom right / 1px 10px no-repeat;
}
.battle [hidden] { display: none !important; }
.battle .codebig { font: 800 clamp(2.2rem, 8vw, 3.6rem)/1 var(--mono); letter-spacing: .18em; color: var(--amber); }
.battle .ring {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-4); align-items: stretch;
  background: var(--ticks), var(--steel); border: 1px solid var(--steel-line); padding: var(--sp-5); margin: var(--sp-5) 0;
}
.battle .corner { background: var(--steel-2); border: 2px solid var(--steel-line); border-radius: 4px; padding: var(--sp-4); display: grid; gap: var(--sp-3); align-content: start; min-width: 0; }
.battle .corner.red { border-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--steel-2) 60%); }
.battle .corner.blue { border-color: var(--blue); background: linear-gradient(180deg, var(--blue-soft), var(--steel-2) 60%); }
.battle .corner.empty { border-style: dashed; opacity: .8; }
.battle .corner.winner { box-shadow: 0 0 0 3px var(--amber), 0 6px 0 var(--shadow); }
.battle .side { font: 800 .74rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.battle .red .side { color: var(--red); }
.battle .blue .side { color: var(--blue); }
.battle .device { font-size: clamp(1.15rem, 3vw, 1.5rem); font-weight: 800; overflow-wrap: anywhere; margin: 0; }
.battle .meta { color: var(--muted); font: 600 .85rem/1.3 var(--mono); }
.battle .chip { justify-self: start; font: 800 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 6px 8px; border-radius: 3px; background: var(--ink); border: 1px solid var(--steel-line); color: var(--muted); }
.battle .chip.now { color: var(--amber); border-color: var(--amber); }
.battle .chip.done { color: var(--peel); border-color: var(--peel-mid); }
.battle .chip.bad { color: #ffb4b4; border-color: #ffb4b4; }
.battle .segs { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); gap: 4px; }
.battle .segs i { height: 12px; background: var(--ink); border: 1px solid var(--steel-line); }
.battle .red .segs i.done { background: var(--red); border-color: var(--red); }
.battle .blue .segs i.done { background: var(--blue); border-color: var(--blue); }
.battle .segs i.now { background: var(--amber); border-color: var(--amber); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .battle .segs i.now { animation: none; } }
.battle .ops { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.battle .ops li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: .86rem; }
.battle .ops .t { font: 700 .86rem/1.2 var(--mono); text-align: right; }
.battle .ops .lead { color: var(--amber); }
.battle .ops .bar { grid-column: 1 / -1; height: 4px; background: var(--ink); }
.battle .ops .bar b { display: block; height: 100%; }
.battle .red .ops .bar b { background: var(--red); }
.battle .blue .ops .bar b { background: var(--blue); }
.battle .center { display: grid; align-content: center; justify-items: center; gap: var(--sp-3); min-width: 8.5rem; text-align: center; }
.battle .vs { font: 800 1rem/1 var(--mono); letter-spacing: .3em; color: var(--tick); text-transform: uppercase; }
.battle .clock { font: 800 clamp(2rem, 7vw, 3.2rem)/1 var(--mono); color: var(--amber); min-height: 1em; }
.battle .status { font: 700 .8rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); max-width: 12rem; }
.battle .tug { width: 100%; max-width: 12rem; height: 10px; display: flex; border: 1px solid var(--steel-line); }
.battle .tug .r { background: var(--red); }
.battle .tug .b { background: var(--blue); }
.battle .tug-label { font: 700 .72rem/1 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.battle .banner { text-align: center; padding: var(--sp-5); border: 2px solid var(--amber); background: rgb(243 200 121 / .08); border-radius: 4px; margin: var(--sp-5) 0; }
.battle .banner h2 { margin: 0 0 var(--sp-2); font-size: clamp(1.6rem, 5vw, 2.4rem); }
.battle .banner .red { color: var(--red); }
.battle .banner .blue { color: var(--blue); }
.battle table.score { width: 100%; border-collapse: collapse; font-size: .92rem; }
.battle table.score th, .battle table.score td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
.battle table.score th:first-child, .battle table.score td:first-child { text-align: left; white-space: normal; }
.battle table.score td { font-family: var(--mono); }
.battle table.score td:first-child { font-family: inherit; font-weight: 650; }
.battle table.score .win-red { color: var(--red); font-weight: 800; }
.battle table.score .win-blue { color: var(--blue); font-weight: 800; }
.battle .tablewrap { overflow-x: auto; }
.battle .joinbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-5); align-items: center; }
.battle .joinbox .qr-tile svg, .battle .joinbox .qr-tile img { width: 168px; height: 168px; display: block; }
.battle .joinurl { font: 700 .95rem/1.4 var(--mono); overflow-wrap: anywhere; }
.battle .you { font: 800 .8rem/1 var(--mono); letter-spacing: .12em; color: var(--amber); }
@media (max-width: 760px) {
  .battle .ring { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--sp-3); gap: var(--sp-3); }
  .battle .center { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .battle .joinbox { grid-template-columns: 1fr; justify-items: start; }
}
@media (max-width: 420px) {
  .battle .ring { grid-template-columns: minmax(0, 1fr); }
}

/* User guide at /bench/battle/guide/ */
.battle .guide-links ~ section[id], .battle .steps li[id] { scroll-margin-top: 5rem; }
@media (max-width: 34rem) {
  .battle .guide-links ~ section[id], .battle .steps li[id] { scroll-margin-top: 11rem; }
}
.battle .guide-qrs { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--sp-5); margin: var(--sp-5) 0; }
.battle .guide-qr { display: grid; gap: var(--sp-3); align-content: start; }
.battle .guide-qr .qr-tile svg { width: 148px; height: 148px; }
.battle .guide-qr .link { font: 600 .9rem var(--mono); word-break: break-all; }
.battle .guide-shot { display: block; width: 100%; max-width: 52rem; height: auto; margin: var(--sp-4) 0; border-radius: var(--radius); border: 1px solid var(--steel-line); box-shadow: 0 4px 0 var(--shadow); }
.battle .steps { display: grid; gap: var(--sp-5); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.battle .steps li { display: grid; gap: var(--sp-2); }
.battle .steps li h3 { display: flex; gap: var(--sp-3); align-items: baseline; margin: 0; }
.battle .steps li h3::before { counter-increment: step; content: counter(step); font: 800 .8rem/1 var(--mono); letter-spacing: .08em; color: var(--amber); border: 1px solid var(--amber); border-radius: 3px; padding: 4px 8px; }
.battle .tips, .battle .fix { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.battle .tips li, .battle .fix li { padding-left: 1.2em; position: relative; }
.battle .tips li::before, .battle .fix li::before { content: "–"; position: absolute; left: 0; color: var(--peel); }

.battle .guide-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: 1.25rem; }
