:root {
    --bg: #151922;
    --panel: #1c212c;
    --line: #2f3747;
    --text: #e6e9f0;
    --dim: #9aa5b8;
    --accent: #ffd166;
    --a: #5aa2ff;
    --b: #ff7a6b;
    --move: #3fb8a8;
    --melee: #ec6a54;
    --ranged: #a3d65c;
    --spell: #b48cf2;
    --stance: #e6b84a;
    --feint: #ee82bd;
    --wait: #8591a8;
    --state: #f09a4a;
    --device: #cfd6e4;
    --aid: #6fd08c;
}

* { box-sizing: border-box; }

/* A downward drag at the top of the page must not reload it (pull-to-refresh on phones and tablets): a local match would be lost. */
html, body { overscroll-behavior-y: none; }
/* A double tap does not zoom anywhere on the page (pinch still does): buttons are pressed again and again. */
html { touch-action: manipulation; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header.top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    position: relative;
}
header.top h1 { font-size: 18px; margin: 0; }
header.top .sub { color: var(--dim); }
body.in-game header.top h1 { font-size: 15px; color: var(--dim); }
header.top .menu { padding: 4px 10px; }
/* What must stay in view during a match: one compact strip in the header. */
.status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-left: auto; font-size: 12px; position: relative; }
.status .warn { color: var(--accent); }
.status button { padding: 3px 10px; }
.conn { color: var(--dim); font-size: 12px; }
.conn.ok::before { content: "\25CF  "; color: #4fbf7a; }
.conn.bad { color: var(--accent); }
.conn.bad::before { content: "\25CF  "; }

/* Two layouts of one page: the main screen, where something is started, and the game screen, which is only the game. */
body.at-home main { display: none; }
body.in-game .home { display: none; }
.home { padding: 16px; max-width: 1180px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.card .hint { margin-top: 0; }
.resume {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 16px;
    background: #232a38; border: 1px solid #6b5a2a; border-radius: 10px; padding: 10px 14px;
}
.resume .hint { margin: 0; flex: 1; min-width: 160px; }
.resume .warn { color: var(--accent); font-size: 12px; }
details.more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
details.more summary { cursor: pointer; color: var(--dim); font-size: 13px; }
details.more[open] summary { margin-bottom: 8px; color: var(--text); }
.preview { max-width: 360px; margin: 0 auto 10px; }
.signed { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.signed .hint { margin: 0; flex: 1; }

main {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    align-items: flex-start;
}

.boardcol { flex: 3 1 400px; min-width: 300px; max-width: 720px; }
.panel {
    flex: 2 1 320px;
    min-width: 300px;
    max-width: 460px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
}

.note {
    background: #232a38;
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.canvaswrap { width: 100%; }
/* Chrome on Android paints a blue fill over a canvas that a double tap selects, and a flash on every tap. */
canvas {
    display: block; cursor: pointer;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}

h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.hint { color: var(--dim); font-size: 12px; margin: 6px 0; }
.big { font-size: 16px; }

button, select, input {
    font: inherit;
    color: var(--text);
    background: #2a3140;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
}
button { cursor: pointer; }
button:hover:not([disabled]) { border-color: #5a6680; }
button[disabled] { opacity: 0.4; cursor: default; }
button.primary { background: #2f6fdb; border-color: #2f6fdb; font-weight: 600; }
button.wide { width: 100%; margin-top: 12px; padding: 9px; }
/* The time left, on the button that ends the wait. */
.btn-timer { margin-left: 8px; font-variant-numeric: tabular-nums; font-weight: 600; opacity: 0.85; }
.btn-timer.low { color: #ffd166; opacity: 1; }
button.ghost { background: transparent; }
button.mini { padding: 1px 7px; min-width: 26px; }

.form { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; }
.form label { color: var(--dim); }
.form label.team0 { color: var(--a); font-weight: 600; }
.form label.team1 { color: var(--b); font-weight: 600; }
.form .row { display: flex; gap: 6px; flex-wrap: wrap; }
.form select, .form input { width: 100%; }
.form .row select { width: auto; flex: 1; }


.head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.head h2 { margin: 0; flex: 1; }
.chip { font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.score { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.score .hero { display: flex; align-items: center; padding: 3px 6px; border-radius: 6px; border: 1px solid transparent; }
.score .hero.click { cursor: pointer; }
.score .hero.sel { border-color: #5a6680; background: #232a38; }
.score .hero.down { opacity: 0.55; }
.score .downchip { display: none; margin-right: 8px; }
.score .hero.down .downchip { display: inline; }
.score .hname { flex: 1; }
.score .hp { color: var(--dim); }
.score .hp b { color: var(--text); }

.who { margin-bottom: 8px; }
.who .stats { color: var(--dim); font-size: 12px; }


.hintline { color: var(--dim); font-size: 12px; line-height: 17px; margin-top: 8px; height: 51px; overflow: hidden; }
.hintline .kname { color: var(--k); }
.hintline .why { color: var(--accent); }
.hintline.warn { color: var(--accent); height: auto; }

.plan { display: flex; flex-direction: column; gap: 4px; }
.plan .empty, .log .empty { color: var(--dim); font-size: 12px; }
.prow { display: flex; gap: 8px; align-items: flex-start; background: #232a38; border-radius: 6px; padding: 5px 8px; }
.ptime { color: var(--dim); font-size: 12px; min-width: 46px; padding-top: 1px; }
.pbody { flex: 1; }
.pname { border-left: 3px solid var(--k); padding-left: 6px; }
.pname .ico { color: var(--k); margin-right: 5px; }
.pname .guess { display: inline-block; margin-left: 6px; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 50%; background: var(--accent); color: #10131a; font-size: 11px; font-weight: 700; cursor: help; }
.pnote { color: var(--dim); font-size: 12px; padding-left: 9px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.pn { display: inline-flex; gap: 4px; }
.ptools { display: flex; gap: 3px; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/* What to do next, side by side: the buttons share the row and grow to fill it, each at least as wide as its words.
   Where they do not fit on one line they wrap; a label is never cut. */
.actions.nextrow > button { flex: 1 0 auto; min-height: 36px; white-space: nowrap; }

.banner { text-align: center; padding: 10px 12px; border-radius: 8px; background: #232a38; border: 1px solid var(--line); margin-bottom: 10px; }
.banner-title { font-size: 18px; font-weight: 700; }
.banner-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.banner.team0 { color: var(--a); }
.banner.team1 { color: var(--b); }

/* The replay's controls are one row of one height: the play button is as tall as the buttons with words. */
.controls { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.controls > button, .controls > select { min-height: 34px; }
.controls > button.iconbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; }
.controls .tick { color: var(--dim); font-size: 12px; margin-left: auto; align-self: center; }

.log { display: flex; flex-direction: column; gap: 1px; max-height: 300px; overflow-y: auto; font-size: 13px; }
.log .line.future { opacity: 0.3; }
.log .lt { color: var(--dim); min-width: 22px; text-align: right; }

/* Timeline bars */
.timeline { margin-top: 10px; position: relative; }
.tl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
/* Who the row is for: the kit's icon alone, in the team's colour; the hero being planned has a ring. */
.tl-name { flex: none; width: 22px; height: 22px; border-radius: 50%; box-sizing: border-box; }
.tl-lane .tl-name, .axis .tl-name, .timeline .tl-lane .tl-name, .timeline .axis .tl-name { height: 0; }
.tl-name.cur { box-shadow: inset 0 0 0 1.5px #fff; }
.tl-name.cur .kitico { width: 13px; height: 13px; }
/* The name of a timeline row's hero: a tooltip of one line. */
.abtip:has(> .tip-name) { width: auto; padding: 3px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap; }
.tl-bar { position: relative; flex: 1; height: 22px; background: #10131a; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.seg {
    position: absolute; top: 1px; bottom: 1px;
    font-size: 10px; line-height: 18px; padding-left: 3px;
    white-space: nowrap; overflow: hidden;
    border-left: 1px solid #10131a; border-radius: 2px; color: #10131a; font-weight: 600;
}
.seg { background: var(--k); }
.seg .ico { width: 14px; height: 14px; vertical-align: -3px; margin-right: 2px; }
/* The landing mark: a line that begins on the tick the blow lands on (rules spec 6a). */
.impact { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.tl-axis { position: relative; flex: 1; height: 14px; color: var(--dim); font-size: 10px; }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }
.demonote { color: var(--dim); font-size: 12px; font-weight: 400; margin-top: 2px; }
.chip.timer { color: var(--text); border-color: #5a6680; font-weight: 600; }
.chip.timer.low { color: var(--accent); border-color: var(--accent); }
.chip.lockchip { margin-left: 8px; color: var(--accent); border-color: var(--accent); }
input[type="text"] { width: 100%; }

/* Action kinds: one colour each, used by the bar, the plan list and the timeline. */
.k-move { --k: var(--move); }
.k-melee { --k: var(--melee); }
.k-ranged { --k: var(--ranged); }
.k-spell { --k: var(--spell); }
.k-stance { --k: var(--stance); }
.k-feint { --k: var(--feint); }
.k-wait { --k: var(--wait); }
.k-device { --k: var(--device); }
.k-aid { --k: var(--aid); }

/* Icons */
.ico { width: 1.25em; height: 1.25em; vertical-align: -0.25em; flex: none; }
.kitico { margin-right: 6px; color: var(--dim); }
.tc0 { color: var(--a); }
.tc1 { color: var(--b); }

/* The board in its stone frame */
.canvaswrap canvas { border-radius: 12px; }

/* Action bar */
.actionbar { margin-top: 8px; }
.ab-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; min-height: 30px; }
button.ab-target {
    display: inline-flex; align-items: center; gap: 6px;
    background: #231f14; border-color: #6b5a2a; border-radius: 16px; padding: 3px 12px 3px 8px;
}
button.ab-target .ico { color: var(--accent); width: 18px; height: 18px; }
.ab-tlabel { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.ab-tdist { color: var(--dim); font-size: 12px; }
.ab-dest { color: var(--dim); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.ab-dest .ico { color: var(--accent); }
.ab-sight { margin-left: auto; cursor: help; }
.ab-sight .ico { color: #cfe3ff; }
.targetline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.targetline .ico { color: var(--accent); }

.ab-row { display: flex; align-items: stretch; gap: 8px; }
/* A grid, so that every tile is as wide as every other whatever row it is in: a wrapping flex row stretches a short last row. */
.ab-slots {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px 5px; flex: 1; padding: 6px;
    background: linear-gradient(#262a33, #14171d);
    border: 1px solid #3d4350; border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -2px 6px rgba(0, 0, 0, 0.5);
}
button.slot, button.ab-undo {
    position: relative; flex: 1 1 38px; min-width: 36px; max-width: 48px; height: 58px; padding: 4px 0 25px;
    display: flex; align-items: center; justify-content: center;
    color: var(--k); border: 1.5px solid var(--k); border-radius: 7px;
    background: radial-gradient(circle at 50% 35%, #333a49, #1a1e27 75%);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(0, 0, 0, 0.6);
}
button.slot .ico, button.ab-undo .ico { width: 27px; height: 27px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
.ab-slots button.slot { max-width: none; min-width: 0; }
button.slot:hover, button.ab-undo:hover:not([disabled]) { border-color: var(--k); filter: brightness(1.25); }
button.slot:active { transform: translateY(1px); }
button.slot .key { position: absolute; top: 0; left: 3px; font-size: 9px; color: var(--dim); }
button.slot .cost, button.ab-undo .cost {
    position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
    font-size: 9px; line-height: 12px; text-align: center; color: var(--text);
    background: rgba(8, 10, 14, 0.72); border-radius: 0 0 5px 5px;
}
button.slot .count {
    position: absolute; top: -6px; right: -6px; min-width: 17px; padding: 0 4px;
    font-size: 10px; line-height: 15px; font-weight: 700; text-align: center;
    color: #10131a; background: var(--k); border: 1px solid #10131a; border-radius: 9px;
}
/* A tile that cannot be picked now is dimmed, all but its limit marks, which say why. */
/* A tile that cannot be picked now is dimmed, border and all; no dashes. */
button.slot.off { border-color: color-mix(in srgb, var(--k) 35%, #171a21); cursor: not-allowed; background: #171a21; }
button.slot.off > .ico, button.slot.off > .key, button.slot.off > .cost, button.slot.off > .fx { opacity: 0.45; }
/* No time left for it: the cost stays, undimmed and in the warning colour, since it is the number that does not fit. */
button.slot.off > .cost.notime { opacity: 1; color: #ff8577; font-weight: 700; }
button.slot.pending { box-shadow: 0 0 0 2px var(--accent); }
button.ab-undo { --k: #9aa5b8; flex: none; width: 46px; align-self: center; margin-right: 2px; height: 48px; padding: 0 0 11px; }

.tl-name { display: flex; align-items: center; justify-content: center; }
.tl-name.click { cursor: pointer; }
.tl-name.click:hover { color: var(--accent); }
.tl-name .kitico, .score .kitico { width: 16px; height: 16px; }
.tl-name .kitico { margin: 0; }
.who { display: flex; align-items: center; flex-wrap: wrap; }
.who .kitico { width: 20px; height: 20px; }

@media (max-width: 480px) {
    button.slot, button.ab-undo { height: 54px; }
    button.ab-undo { height: 44px; }
    .ab-row { gap: 5px; }
    button.slot .ico, button.ab-undo .ico { width: 23px; height: 23px; }
    main { padding: 10px; }
}

/* A state on a hero (Slowed, Pinned, Staggered): the same orange tag everywhere. */
.statetag {
    display: inline-flex; align-items: center; gap: 2px; flex: none;
    height: 17px; padding: 0 4px 0 2px; vertical-align: middle;
    font-size: 11px; line-height: 15px; font-weight: 700;
    color: #10131a; background: var(--state); border: 1px solid #10131a; border-radius: 4px; cursor: help;
}
.statetag .ico { width: 12px; height: 12px; vertical-align: 0; margin: 0; color: #10131a; }
/* A badge with its icon and nothing else: the icon sits in the middle, with the same room on both sides. */
.statetag.bare { padding: 0 3px; justify-content: center; }
/* A unit after a number (ticks, hexes or steps, damage): an icon the size of the digits beside it, in their colour. */
.wico { display: inline-flex; vertical-align: -2px; margin-left: 1px; }
.wico .ico { width: 13px; height: 13px; margin: 0; filter: none; color: inherit; }
.sk-stat .wico .ico, .statetag .wico .ico { width: 11px; height: 11px; }
.statetag .wico { vertical-align: -1px; margin-left: 0; }
/* The rule that puts a number's name on a line of its own must not take the unit off the number. */
.hd-num b .wico { display: inline-flex; font-size: inherit; overflow: visible; }
.hd-num b .wico .ico { width: 14px; height: 14px; }
/* At the foot of a tile there is room for small print only. */
button.slot .cost .wico { vertical-align: -1px; margin-left: 0; }
button.slot .cost .wico .ico { width: 9px; height: 9px; filter: none; }
/* The landing tick, before the cost: a dimmer number, also on a tile there is no time for. The two stay on one line. */
button.slot .cost { white-space: nowrap; }
button.slot .cost .lands, button.slot.off > .cost.notime .lands { color: var(--dim); font-weight: 400; margin-right: 3px; }
/* What Focus added to a spell, in the replay log: the number, then the damage icon. */
.lbonus { display: inline-flex; align-items: center; gap: 1px; font-weight: 700; color: #ff8577; }
.lbonus .wico { margin: 0; }
/* Focus is a gain and not a hindrance, and an enemy's must be read at a glance: the colour of spells, not the orange of the rest. */
.statetag.focus { background: #b48cf2; }
/* A tag that explains itself: on a hero, where it says what the effect is doing to it now. */
.statetag[data-tip] { cursor: help; }
@media (pointer: coarse) {
    .statetag[data-tip] { position: relative; }
    .statetag[data-tip]::after { content: ""; position: absolute; inset: -7px -5px; }
}
.score .states { display: inline-flex; gap: 3px; margin-right: 8px; }
.statehint { display: flex; align-items: flex-start; gap: 6px; }
.log .line .statetag { margin: 0; }
.hintline .statetag { margin: 0 4px 0 6px; }
button.slot .fx { position: absolute; top: 2px; right: 2px; display: flex; gap: 1px; }
button.slot .fx .statetag { height: 13px; padding: 0 1px; border-radius: 3px; }
button.slot .fx .statetag .ico { width: 10px; height: 10px; filter: none; }

/* The action bar's tooltip: one floating box, the same layout for every action. It never takes part in the page layout. */
.abtip {
    position: fixed; left: 0; top: 0; z-index: 50; visibility: hidden; pointer-events: none;
    width: 252px; padding: 9px 11px; font-size: 12px; line-height: 1.35;
    color: var(--text); background: #11141b; border: 1px solid #4a5366; border-radius: 9px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.abtip.on { visibility: visible; }
.tip-head { display: flex; align-items: center; gap: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.tip-head > .ico { width: 26px; height: 26px; color: var(--k); }
.tip-names { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tip-names b { font-size: 14px; }
.tip-kind { color: var(--k); font-size: 11px; }
.tip-key { color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: 11px; }
.tip-stats { display: grid; grid-template-columns: 72px 1fr; gap: 1px 8px; margin: 7px 0; }
.tip-label { color: var(--dim); }
.tip-value { font-variant-numeric: tabular-nums; }
.tip-value.none { color: #566078; }
.tip-fx { display: flex; align-items: flex-start; gap: 6px; margin-top: 3px; }
.tip-desc { color: var(--dim); margin-top: 6px; }
.tip-why { color: var(--accent); margin-top: 6px; }

/* The ghost of a considered pick on the planned hero's timeline row, and the lane for its label. */
.tl-lane { margin-bottom: 1px; }
.tl-lanebox { position: relative; flex: 1; height: 14px; }
.ghostlabel { position: absolute; top: 0; white-space: nowrap; font-size: 10px; line-height: 14px; color: var(--text); }
.ghostlabel.bad { color: var(--accent); }
/* Tick numbers written over the timeline: where an action lands (dim, at its mark) and where it ends. */
.ticknote { position: absolute; top: 0; white-space: nowrap; font-size: 10px; line-height: 14px; font-style: normal; font-variant-numeric: tabular-nums; color: var(--text); pointer-events: none; }
.ticknote.lands { color: var(--dim); }
.tl-axis.pointing > span { visibility: hidden; }
.seg.ghost {
    background: var(--k); opacity: 0.45; border: 1px dashed #fff; border-radius: 2px; padding: 0; pointer-events: none;
}
.seg.ghost.bad {
    opacity: 0.8; border-color: var(--accent);
    background: repeating-linear-gradient(45deg, rgba(255, 209, 102, 0.55) 0 4px, rgba(16, 19, 26, 0.6) 4px 8px);
}
.impact.ghost { opacity: 0.8; pointer-events: none; }

/* The replay log: tick, how it went (mark and colour), who did what to whom as icons, numbers on the right. */
.log .line {
    display: flex; align-items: flex-start; gap: 6px; padding: 2px 4px; min-height: 22px;
    border-left: 3px solid var(--rc); --rc: #566078;
    /* The log scrolls; its rows keep their own height. Without this a long log squeezes them, and a row that wraps
       onto a second line spills over the row below. */
    flex: none;
}
/* The tick, the mark and the numbers stay on the first line of a row that wraps. */
.log .line > .lt, .log .line > .lmark, .log .line > .lside { line-height: 18px; }
.log .line > .lbody { min-height: 18px; }
.log .line.r-ok { --rc: #4fbf7a; }
.log .line.r-part { --rc: #d9a93a; }
.log .line.r-fail { --rc: #7b8496; }
.log .line.r-fail .lbody { color: var(--dim); }
.lmark { color: var(--rc); width: 12px; text-align: center; font-weight: 700; flex: none; }
.pn.r-ok { --rc: #4fbf7a; }
.pn.r-part { --rc: #d9a93a; }
.pn.r-fail { --rc: #7b8496; }
.pn.r-info { --rc: #566078; }
.lbody { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 5px; min-width: 0; }
.lhero, .lab { display: inline-flex; align-items: center; cursor: help; }
.lhero .ico, .lab .ico { width: 17px; height: 17px; vertical-align: 0; }
.lab { color: var(--k); }
/* Holding a finger on something with a tooltip opens the tooltip: not a text selection, not the browser's menu. */
[data-tip] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* A finger gets a bigger target than the icon, with nothing more to see. */
@media (pointer: coarse) {
    .lab[data-tip] { position: relative; }
    .lab[data-tip]::after { content: ""; position: absolute; inset: -4px; }
}
.ltwin { font-size: 10px; font-weight: 700; margin-left: 1px; }
.lw.strong { font-weight: 700; color: var(--text); }
.lnote { color: var(--dim); font-size: 12px; }
.lside { display: flex; align-items: baseline; gap: 6px; flex: none; font-variant-numeric: tabular-nums; }
.ldmg { color: #ff8577; min-width: 40px; text-align: right; white-space: nowrap; }
.lhp { color: var(--dim); font-size: 12px; min-width: 50px; text-align: right; }

button.ab-destbtn { background: transparent; border: 1px solid transparent; padding: 2px 6px; cursor: pointer; }
button.ab-destbtn:hover { border-color: #5a6680; }

/* The forecast: what to expect of the plan against likely turns of the others. */
.expect { font-size: 12px; color: var(--text); margin: 0 0 6px; min-height: 17px; }
.meter { display: inline-block; width: 34px; height: 6px; border-radius: 3px; background: #10131a; border: 1px solid var(--line); overflow: hidden; align-self: center; flex: none; }
.meter span { display: block; height: 100%; background: var(--rc); }
.hint.help { cursor: help; text-decoration: underline dotted #566078; text-underline-offset: 3px; }

/* Replay timeline: a delay (stagger, flight in fear) inside an action, and what it pushed out of the turn. */
.hold {
    position: absolute; top: 1px; bottom: 1px; z-index: 2; overflow: hidden; border-radius: 2px; pointer-events: auto;
    display: flex; align-items: center; justify-content: center; color: #10131a;
    background: repeating-linear-gradient(135deg, rgba(240, 154, 74, 0.95) 0 4px, rgba(240, 154, 74, 0.6) 4px 8px);
    border-left: 1px solid #10131a; border-right: 1px solid #10131a;
}
.hold .ico { width: 12px; height: 12px; }
.hold.fresh { box-shadow: 0 0 0 2px #fff, 0 0 10px 3px rgba(240, 154, 74, 0.9); z-index: 3; }
.seg.lost {
    display: flex; align-items: center; gap: 1px; padding-left: 2px; color: var(--dim);
    background: repeating-linear-gradient(45deg, #2a3140 0 4px, #1a1e27 4px 8px);
    border: 1px dashed #7b8496; opacity: 0.85;
}
.seg.lost .ico { width: 12px; height: 12px; margin: 0; flex: none; }
button.iconbtn { padding: 4px 9px; line-height: 0; }
button.iconbtn .ico { width: 16px; height: 16px; vertical-align: 0; }

/* A planned action that would fail from where the plan puts the hero: kept, with a warning. */
.pname .risk { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; background: #ff8577; color: #10131a; font-size: 11px; font-weight: 700; line-height: 15px; cursor: help; white-space: nowrap; }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--dim); cursor: pointer; }
label.check input { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; }

/* The Demos screen: a card per section, all in view; in it a grid of tiles, one per demo, as many across as fit. */
.demopage { display: flex; flex-direction: column; gap: 12px; }
.demohead h2 { margin: 0 0 2px; }
.demosec h3 { margin: 0; font-size: 15px; }
.demogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-top: 10px; }
button.demotile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; white-space: normal; padding: 10px 12px; min-height: 56px; }
.dt-head { display: flex; align-items: center; gap: 8px; }
.dt-head b { flex: 1; min-width: 0; }
.dt-icons { display: inline-flex; gap: 3px; flex: none; }
.dt-icon { display: inline-flex; }
.dt-icon .ico { width: 16px; height: 16px; margin: 0; filter: none; color: inherit; }
button.nextdemo { white-space: nowrap; }
/* A finger needs more than the header's small buttons give. */
@media (pointer: coarse) {
    button.nextdemo { min-height: 34px; padding: 4px 12px; }
}
.demochip { display: inline-block; vertical-align: middle; max-width: min(46vw, 420px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-group { color: var(--dim); }
.demochip b { color: var(--text); }
@media (max-width: 480px) { .dc-group { display: none; } }

/* A start that is held by a match in waiting: the bar that says so blinks a few times, every time. */
.resume.asking { border-color: var(--accent); }
.resume.held { animation: heldblink 0.45s ease-in-out 4; }
@keyframes heldblink {
    0%, 100% { background: #232a38; box-shadow: none; }
    50% { background: #5c4a17; box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.6); }
}
@media (prefers-reduced-motion: reduce) {
    .resume.held { animation: none; background: #4a3d18; box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.6); }
}

/* The replay timeline is the scrub surface: press or drag on the rows to move the playhead. */
.timeline.scrub { padding-top: 18px; user-select: none; -webkit-user-select: none; }
/* A finger that lands between two rows must scrub too, not scroll: the whole row is the surface. */
.timeline.scrub .tl-row { touch-action: none; }
.timeline.scrub .tl-bar, .timeline.scrub .tl-axis { cursor: ew-resize; }
.playhead { position: absolute; top: 2px; width: 0; z-index: 6; pointer-events: none; outline: none; }
.playhead::after { content: ""; position: absolute; left: -1px; top: 12px; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 0 1px rgba(16, 19, 26, 0.6); }
.playhead .grip {
    position: absolute; left: -8px; top: 0; width: 16px; height: 15px; pointer-events: auto; touch-action: none; cursor: grab;
    background: var(--accent); border: 1px solid #10131a; border-radius: 3px 3px 8px 8px;
}
/* The handle is small; what can be touched around it is about 40 px. */
.playhead .grip::before { content: ""; position: absolute; left: -13px; top: -14px; width: 40px; height: 40px; }
.playhead:focus-visible .grip { box-shadow: 0 0 0 2px #fff; }

/*
 * The main screen: the hero first, then the ways to play. Narrow: one after the other, with the hero in full after the
 * ways to play, so the buttons that start a game stay near the top. Wide: two columns, the hero in full under the pick.
 */
.homegrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; align-items: start; }
.homecol { display: contents; }
.homegrid .s1 { order: 1; }
.homegrid .card.hero { order: 2; }
.homegrid .s2 { order: 3; margin-top: 6px; }
.homegrid .playcard { order: 4; }
.homegrid .onlinecard { order: 5; }
.homegrid .democard { order: 7; }
.homegrid .pastcard { order: 8; }
@media (min-width: 640px) and (max-width: 899px) {
    .homegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .homegrid .s1, .homegrid .s2, .homegrid .card.hero, .homegrid .democard, .homegrid .pastcard { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
    .homegrid { grid-template-columns: minmax(0, 1fr) 340px; }
    .homecol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
    .homegrid .s2 { margin-top: 0; }
}
@media (min-width: 1200px) { .home { max-width: 1400px; } }
/*
 * Wide enough for three columns: the ways to play stand in two, so the hero is not stretched and the page needs no
 * scrolling. The cards fill the two columns in order and are never split.
 */
@media (min-width: 1360px) {
    .homegrid { grid-template-columns: minmax(0, 1fr) 692px; }
    .homecol:last-child { display: block; columns: 2; column-gap: 12px; }
    .homecol:last-child > .s2 { column-span: all; margin-bottom: 12px; }
    .homecol:last-child > .card { break-inside: avoid; margin-bottom: 12px; }
}
h2.steplabel { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.sk-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sk-marks { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.sk-marks .statetag { margin: 0; }
.stepno {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); color: #10131a; font-size: 12px; font-weight: 700;
}
.youline { display: flex; align-items: center; gap: 6px; margin: 2px 0 10px; }
.youline .hint { margin: 0; }
.youline b { color: var(--a); }

/* Picking a hero: a tile per hero with its token; the details of one hero beside the tiles, or under them where it is narrow. */
.picklabel { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 6px; font-size: 13px; }
.picklabel b { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.picklabel.team0 b { color: var(--a); }
.picklabel.team1 b { color: var(--b); }
.picklabel span { color: var(--text); font-weight: 600; }
.pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 6px; margin-bottom: 10px; }
.card.hero .pick { grid-template-columns: repeat(auto-fit, minmax(54px, 104px)); }
button.herotile {
    --t: var(--a);
    display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
    padding: 8px 2px 6px; border-radius: 9px; background: #171b24; border: 2px solid var(--line); color: var(--dim);
    position: relative;
}
button.herotile.team1 { --t: var(--b); }
button.herotile .tok { opacity: 0.6; filter: saturate(0.6); transition: opacity 0.12s; }
button.herotile:hover .tok, button.herotile:focus-visible .tok { opacity: 1; filter: none; }
button.herotile .ht-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
button.herotile.on { border-color: var(--t); background: #232b3b; color: var(--text); box-shadow: inset 0 0 0 1px var(--t), 0 0 10px -2px var(--t); }
button.herotile.on .tok { opacity: 1; filter: none; }
button.herotile.on .ht-name { font-weight: 700; }
/* The chosen tile also says so without colour: a tick in its corner. */
button.herotile.on::after {
    content: "✓"; position: absolute; top: 2px; right: 4px; font-size: 11px; font-weight: 700; color: var(--t);
}
button.herotile:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.pick.small button.herotile { padding: 5px 2px 4px; gap: 2px; }
.pick.small button.herotile .ht-name { font-size: 11px; }

.herodetail { min-width: 0; background: #171b24; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.hd-head { display: flex; align-items: center; gap: 10px; }
.hd-names { display: flex; flex-direction: column; min-width: 0; }
.hd-names b { font-size: 17px; line-height: 1.2; }
.hd-tag { font-size: 11px; }
.hd-tag.team0 { color: var(--a); }
.hd-tag.team1 { color: var(--b); }
.hd-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 9px 0 0; }
.hd-num { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; text-align: center; min-width: 0; }
.hd-num { display: flex; align-items: center; justify-content: center; gap: 6px; }
.hd-num > .ico { flex: none; width: 15px; height: 15px; color: var(--dim); }
.hd-num b { font-size: 16px; line-height: 1.5; }
.hs-hp > .ico, .hp > .ico { flex: none; width: 13px; height: 13px; color: var(--dim); vertical-align: -2px; margin-right: 3px; }
.lhp .ico { width: 11px; height: 11px; vertical-align: -1px; margin-left: 2px; }
.hd-num span { display: block; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-desc { margin: 9px 0 0; font-size: 13px; color: var(--text); }
/* The families of skills stand side by side where the panel has room for them; what every hero can do is one line under them. */
/* Flex, not a grid: the line of basics spans the panel, and in a grid that kept empty columns open beside the families. */
.skills { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-start; }
.sk-group { padding-top: 8px; min-width: 0; flex: 1 1 190px; }
.sk-group.basic { flex-basis: 100%; }
.sk-group:not(.basic) { max-width: 330px; }
.sk-title { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.sk-rows { display: flex; flex-direction: column; gap: 3px; }
.sk-rows.line { flex-direction: row; flex-wrap: wrap; gap: 4px; }
button.skill {
    display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; cursor: help;
    background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--k); border-radius: 6px; padding: 4px 8px 4px 6px; color: var(--text);
}
button.skill > .ico { flex: none; width: 22px; height: 22px; color: var(--k); }
button.skill:hover, button.skill:focus-visible { border-color: var(--k); background: #232b3b; }
button.skill:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.sk-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sk-text b { font-size: 13px; line-height: 1.25; }
.sk-stats { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 11px; line-height: 1.35; color: var(--text); }
/* A value stays whole with its name and its signs: a long one ("Damage 14 · 10 at 1") takes a line of its own. */
.sk-stat { white-space: nowrap; }
.sk-stat i { font-style: normal; color: var(--dim); }
button.skill.mini { padding: 4px 6px; min-height: 32px; font-size: 12px; gap: 5px; border-left-width: 1px; border-bottom: 2px solid var(--k); }
button.skill.mini > .ico { width: 20px; height: 20px; }
@media (max-width: 480px) {
    .home { padding: 10px; }
    .card { padding: 12px; }
    button.skill.mini { min-height: 36px; min-width: 36px; justify-content: center; }
}

/* The steps of a walking action: faint divisions inside its one block, at the tick each step ends on. They never take the pointer. */
.seg > .ico, .seg > span { position: relative; z-index: 1; }
.seg .step { position: absolute; top: 0; bottom: 0; pointer-events: none; border-right: 1px solid rgba(16, 19, 26, 0.42); box-shadow: 1px 0 0 rgba(255, 255, 255, 0.16); }
.seg .step.end { border-right: 0; box-shadow: none; }
/* The rest of an action a blow interrupted: its time still passes and gives nothing. Dark and hatched from the blow on. */
.seg .spoilt {
    position: absolute; top: 0; bottom: 0; right: 0; pointer-events: none;
    background: repeating-linear-gradient(135deg, rgba(16, 19, 26, 0.85) 0 3px, rgba(16, 19, 26, 0.55) 3px 6px);
    border-left: 1px solid #10131a;
}
/* A step that took its time and got nowhere: pinned, or blocked. */
.seg .step.lost { background: repeating-linear-gradient(135deg, rgba(16, 19, 26, 0.26) 0 2px, transparent 2px 5px); }

/* A rationed ability's marks: "1×" is so many per turn, the loop arrow and a number so many turns off afterwards. One notation everywhere. */
.ration {
    display: inline-flex; align-items: center; gap: 1px; flex: none; height: 14px; padding: 0 4px; border-radius: 7px;
    font-size: 9px; line-height: 12px; font-weight: 600; white-space: nowrap;
    color: var(--text); background: #10131a; border: 1px solid #5a6680;
}
.ration .ico { width: 9px; height: 9px; margin-left: 2px; filter: none; color: inherit; }
/* Charges for the whole match: a dot each, filled while it is there, hollow once spent. */
.ration .pip { flex: none; width: 7px; height: 7px; margin: 0 1px; border-radius: 50%; box-sizing: border-box; border: 1.5px solid currentColor; background: currentColor; }
.ration .pip.spent { background: transparent; }
.ration.gone, button.slot .ration.gone { color: var(--dim); }
/* The state on the action bar: a filled tag with a word, used this turn or resting. */
.ration.live { background: var(--accent); color: #10131a; border-color: #10131a; font-weight: 700; }
.ration.resting { background: #e8eaf0; }
/* A limit above one with some uses in the plan: how many are left, in the accent colour but not filled, as it can still be picked. */
.ration.left { color: var(--accent); border-color: var(--accent); font-weight: 700; }
/* On a tile the marks have a line of their own, between the icon and the time: nothing covers anything, nothing hangs outside. */
button.slot .ration {
    position: absolute; left: 0; right: 0; bottom: 12px; height: 13px; padding: 0; justify-content: center;
    border: 0; border-radius: 0; background: rgba(8, 10, 14, 0.5); line-height: 13px;
}
button.slot .ration.live { background: var(--accent); }
button.slot .ration.resting { background: #e8eaf0; }
button.slot .ration .ico { width: 9px; height: 9px; margin-left: 1px; }
button.slot .ration.live { letter-spacing: -0.2px; }
/* The limit is its badge alone, in the middle of its row. */
.tip-limit { display: flex; align-items: center; gap: 6px; }

/* All heroes' details share one place, as tall as the tallest: switching hero moves nothing around it. */
.herostack { display: grid; min-width: 0; }
.herostack > * { grid-area: 1 / 1; visibility: hidden; }
.herostack > .shown { visibility: visible; }

/* Hidden information: an action the team could not see, and where one came into view. */
.seg.unknown {
    background: repeating-linear-gradient(135deg, #3a4254 0 6px, #2c3342 6px 12px); color: var(--text);
    border: 1px dashed #7c879c; text-align: center; padding-left: 0; font-size: 12px;
}
.seenmark { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dotted #10131a; z-index: 2; pointer-events: none; }
.lhero.unseen, .unseenq {
    display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; border-radius: 50%;
    border: 1px dashed #7c879c; color: var(--text); font-size: 11px; font-weight: 700;
}

/* The hero in full, kept short: token and name beside the numbers, the description on a line, skills in tight rows. */
.card.hero .herodetail { padding: 8px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; align-items: center; align-content: start; }
.card.hero .hd-nums { margin: 0; }
.card.hero .hd-num { padding: 2px 6px; }
.card.hero .hd-desc, .card.hero .skills { grid-column: 1 / -1; margin: 0; }
.card.hero .sk-group { padding-top: 4px; }
.card.hero button.skill { padding: 2px 8px 2px 6px; }
.card.hero .sk-stats { line-height: 1.25; }
.picklabel .hint { margin: 0; font-weight: 400; }
@media (max-width: 480px) {
    .card.hero .herodetail { grid-template-columns: minmax(0, 1fr); }
    .card.hero .hd-head .tok { width: 40px !important; height: 40px !important; }
    .picklabel .hint { display: none; }
}

/* The lobby and a room, in the Online card. */
.lobbysec { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.lobbysec h3, .roomhead b { margin: 0 0 4px; font-size: 14px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; }
.btnrow button { flex: 1 1 auto; padding: 8px 10px; }
.roomrow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-top: 6px; background: #171b24; border: 1px solid var(--line); border-radius: 8px; }
.roominfo { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.roominfo .hint { margin: 0; }
.wholist { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.who b { color: var(--text); font-weight: 600; }
.chip.who.me { border-color: var(--a); }
.roomhead { display: flex; flex-direction: column; margin-top: 4px; }
.roomhead .hint { margin: 0; }
.roomteam { margin-top: 8px; padding: 6px 8px; background: #171b24; border: 1px solid var(--line); border-radius: 8px; border-left: 3px solid var(--a); }
.roomteam.team1 { border-left-color: var(--b); }
.roomteam .picklabel { margin: 0 0 2px; }
.seatrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 0; border-top: 1px solid var(--line); min-height: 40px; }
.seatrow:first-of-type { border-top: 0; }
.seatrow.mine .seatwho b { color: var(--accent); }
.seatwho { display: flex; align-items: center; gap: 6px; flex: 1 1 120px; min-width: 0; }
.seatwho .hint { margin: 0; }
.seatopen { color: var(--dim); font-style: italic; }
.seatrow select { width: auto; max-width: 110px; padding: 3px 6px; }
.seatrow button.mini { padding: 4px 8px; }
.refusal { height: auto; border-left: 3px solid var(--accent); padding-left: 8px; margin-bottom: 6px; }

/* The hero in full under the tiles: as many columns of skills as fit, and on a phone the names alone in two columns (the numbers are a tap away, in the tooltip). */
/* Columns of one width: a group that falls to the next row keeps a column's width and does not stretch across the card. */
.card.hero .skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 0 14px; }
.card.hero .sk-group.basic { grid-column: 1 / -1; }
@media (max-width: 480px) {
    .card.hero .skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
    .card.hero .sk-group.basic { grid-column: 1 / -1; }
    .card.hero .sk-stats { display: none; }
    .card.hero button.skill { min-height: 30px; }
    .card.hero .sk-head { flex-wrap: wrap; gap: 2px 4px; }
}
@media (max-width: 900px) {
    /* Seats are worked with a finger on a tablet or a phone. */
    .seatrow button.mini, .seatrow select, .roomrow button { min-height: 36px; }
}

/* The whole-match replay: the strip of turns over the timeline, and what says that this is the full picture. */
.chip.full { color: #10131a; background: var(--accent); border-color: var(--accent); font-weight: 700; }
/* A turn is never narrower than its numbers: with more turns than fit, the row scrolls sideways. */
.filmstrip {
    display: flex; gap: 3px; margin: 0 0 22px 30px; overflow-x: auto; scrollbar-width: none;
    touch-action: pan-x; user-select: none; -webkit-user-select: none;
}
.filmstrip::-webkit-scrollbar { display: none; }
.filmcell {
    position: relative; flex: 1 0 36px; min-width: 36px; max-width: 64px; height: 42px; padding: 1px 0; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
    background: #171b24; border: 1px solid var(--line); border-radius: 5px; color: var(--dim); font-size: 11px; cursor: pointer;
}
.filmcell b { font-size: 12px; color: var(--text); position: relative; z-index: 1; }
.filmcell .fc-gist { font-size: 9px; font-weight: 600; white-space: nowrap; position: relative; z-index: 1; }
.filmcell .fc-gist.team0 { color: var(--a); }
.filmcell .fc-gist.team1 { color: var(--b); }
/* The turns are a row of their own over the scrubber: the playhead's handle sits under it, and what can be touched around the handle does not reach up into the turns. */
.boardcol .timeline.scrub.film, .timeline.scrub.film { padding-top: 6px; }
.timeline.film .playhead .grip::before { top: -3px; height: 30px; }
.filmcell.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.filmcell .fc-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 209, 102, 0.22); }
.pastrow .roominfo b { font-size: 13px; }
.filebtn { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--dim); cursor: pointer; flex-wrap: wrap; }
.filebtn input { font-size: 12px; max-width: 100%; }
@media (max-width: 480px) { .filmstrip { margin-left: 0; } .filmcell { height: 46px; } }

/* The one button that ends planning, in the action bar; and under it the action in hand, where it covers no hex. */
button.confirm { margin-top: 8px; padding: 10px; font-size: 14px; }
/* Asked before confirming a plan with much of the turn empty: the button is the question, and the line under it runs out with it. */
button.confirm.armed { position: relative; overflow: hidden; background: var(--accent); border-color: var(--accent); color: #10131a; }
button.confirm.armed .ico { filter: none; }
button.confirm.armed .btn-timer { color: inherit; }
button.confirm.armed::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(16, 19, 26, 0.55);
    transform-origin: left; animation: cf-run 3s linear forwards;
}
@keyframes cf-run { to { transform: scaleX(0); } }
/* The empty stretch of the turn the question is about. */
.tl-unused {
    position: absolute; top: 0; bottom: 0; right: 0; pointer-events: none;
    background: repeating-linear-gradient(135deg, rgba(255, 209, 102, 0.4) 0 4px, transparent 4px 9px);
}
.ab-detail { margin-top: 8px; height: 36px; overflow: hidden; font-size: 12px; line-height: 18px; }
.ab-detail .hint { margin: 0; }
.ad-top { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.ad-top > .ico { flex: none; width: 16px; height: 16px; color: var(--k); }
.ad-top b { color: var(--k); }
.ad-stats { color: var(--text); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ad-desc { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hintline { margin-top: 4px; }

/* The banner over the board: the turn and the phase, for a moment. It never takes a tap. */
.canvaswrap { position: relative; }
.phase {
    position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
    padding: 8px 18px; border-radius: 10px; white-space: nowrap; font-size: 20px; font-weight: 700; letter-spacing: 0.02em;
    color: #fff; background: rgba(14, 17, 24, 0.82); border: 1px solid rgba(255, 209, 102, 0.7);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); opacity: 0; visibility: hidden;
}
.phase.show { visibility: visible; animation: phasefade 1.3s ease-out both; }
.phase.show.long { animation-duration: 2.6s; font-size: 26px; }
@keyframes phasefade { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .phase.show, .phase.show.long { animation: none; opacity: 1; } }
body.at-home .phase { display: none; }

.timingform { margin-top: 8px; }
.chip.burnchip { color: #ffb35c; border-color: #a86a2a; }

/* Thinking time in a plan: the waits it left between the actions, quiet; and the one still growing at the end, with a burning edge. */
.seg.thinking {
    background: repeating-linear-gradient(135deg, #4a3320 0 5px, #3a2818 5px 10px); color: #c98a4a; padding-left: 1px; text-align: center;
    border-left: 1px solid #10131a;
}
.seg.thinking .ico { width: 11px; height: 11px; margin: 0; vertical-align: -2px; }
.burnblock {
    position: absolute; top: 1px; bottom: 1px; width: 0; z-index: 2; pointer-events: auto; border-radius: 2px;
    background: linear-gradient(90deg, #4a3320, #8a531d 70%, #d98a2b);
}
.burnblock .ember {
    position: absolute; right: -2px; top: -1px; bottom: -1px; width: 5px; border-radius: 3px;
    background: #ffd08a; box-shadow: 0 0 8px 3px rgba(255, 150, 50, 0.85); animation: ember 0.9s ease-in-out infinite alternate;
}
@keyframes ember { from { opacity: 0.65; box-shadow: 0 0 5px 2px rgba(255, 140, 40, 0.7); } to { opacity: 1; box-shadow: 0 0 10px 4px rgba(255, 170, 70, 0.95); } }
@media (prefers-reduced-motion: reduce) { .burnblock .ember { animation: none; } }
.chip.thinkchip { display: inline-flex; align-items: center; gap: 3px; color: #ffb35c; border-color: #a86a2a; font-weight: 600; }
.chip.thinkchip .ico { width: 12px; height: 12px; }
.chip.thinkchip.free { color: var(--dim); border-color: var(--line); font-weight: 400; }

/* A plan cut short where the team is not told what was dropped: the cut-off block, with a question mark. */
.seg.lost.dropped { justify-content: flex-start; padding-left: 4px; font-size: 11px; color: var(--text); }

/*
 * A phone: the timeline sits right under the board, and the header, the board, the timeline, the target row, the
 * action bar and Confirm fit one screen. Text that is not needed on every turn is hidden until "?" is pressed.
 */
@media (max-width: 767px) {
    body.in-game main { display: block; }
    body.in-game .boardcol { max-width: none; }
    body.in-game .panel { max-width: none; margin-top: 10px; }
    body.in-game header.top { padding: 6px 10px; gap: 6px; flex-wrap: nowrap; }
    body.in-game header.top h1 { display: none; }
    body.in-game .status { flex-wrap: nowrap; gap: 5px; min-width: 0; overflow: hidden; }
    body.in-game .viewchip { display: none; }
    body.in-game .conn { font-size: 0; }
    body.in-game .conn::before { font-size: 12px; }
    body.in-game main { padding: 6px 10px 10px; gap: 10px; }
    .boardcol { display: flex; flex-direction: column; min-width: 0; }
    .boardcol .canvaswrap { order: 1; }
    .boardcol .timeline { order: 2; margin-top: 4px; }
    .boardcol .actionbar { order: 3; margin-top: 6px; }
    .timeline .tl-row { margin-bottom: 2px; gap: 5px; }
    .timeline .tl-name { width: 18px; height: 18px; }
    .timeline .tl-name.cur .kitico { width: 11px; height: 11px; }
    .timeline .tl-bar { height: 18px; }
    .timeline .seg { line-height: 14px; }
    .timeline .tl-lane { height: 12px; margin-bottom: 0; }
    .timeline .tl-axis { height: 11px; font-size: 9px; }
    .timeline.scrub { padding-top: 16px; }
    .filmstrip { margin-bottom: 18px; margin-left: 23px; }
    .ab-top { gap: 5px; margin-bottom: 5px; }
    .ab-sight span { display: none; }
    .ab-slots { padding: 5px; gap: 6px 4px; }
    button.confirm { margin-top: 6px; padding: 9px; }
    .ab-detail { margin-top: 5px; }
    .panel .hint.help { display: none; }
}

/*
 * Under the board, the timeline and the list of heroes are one closed box: the timeline is its top, the heroes its
 * bottom. The action bar follows.
 */
.boardcol { display: flex; flex-direction: column; min-width: 0; }
.boardcol .canvaswrap { order: 1; }
/* The board has a largest hex size, so a wide column can be wider than it: it stands in the middle. */
.boardcol .canvaswrap canvas { display: block; margin: 0 auto; border-radius: 12px; }
.boardcol .timeline { order: 2; margin-top: 6px; padding: 5px 8px 2px; background: #10131a; border: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.boardcol .timeline.scrub { padding-top: 18px; }
.boardcol .herostrip { order: 3; }
.boardcol .actionbar { order: 4; margin-top: 8px; }
body.at-home .herostrip { display: none !important; }
.herostrip {
    display: flex; flex-direction: column; gap: 1px; padding: 3px 4px;
    background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; font-size: 12px;
}
/* A hero a row. The name has a column of its own, so the health bars stand under one another. */
.hs-row { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 10px; min-height: 24px; padding: 1px 4px; border-radius: 6px; }
.hs-row .hs-who { flex: none; width: 112px; }
.hs-row.sel { background: #232a38; }
.hs-row.click { cursor: pointer; }
.hs-row.down { opacity: 0.55; }
.hs-row .downchip { display: none; }
.hs-row.down .downchip { display: inline; }
.hs-row .chip.lockchip { margin-left: 0; }
.hs-hp b { min-width: 22px; }
.hs-who { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.hs-who .ico { width: 16px; height: 16px; }
.hs-who.click { cursor: pointer; border-radius: 4px; }
.hs-who.click:hover b { text-decoration: underline; text-underline-offset: 3px; }
.hs-who.click:focus-visible, .tl-name.click:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* A hero's sheet during a match: a popup over the page that stays until it is closed. Under the ability tooltip. */
.sheetveil {
    position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 14px;
    background: rgba(8, 10, 14, 0.66);
}
.sheetveil.on { display: flex; }
.herosheet {
    position: relative; width: min(580px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 16px 16px; background: #171b24; border: 1px solid #4a5366; border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}
.herosheet .hd-head { padding-right: 44px; }
button.sheetclose { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 15px; color: var(--dim); }
button.sheetclose:hover, button.sheetclose:focus-visible { color: var(--text); border-color: #5a6680; }
button.sheetbtn {
    flex: none; margin-left: 8px; width: 22px; height: 22px; min-width: 0; padding: 0; border-radius: 50%;
    font: italic 700 13px/1 Georgia, "Times New Roman", serif; color: var(--dim);
}
button.sheetbtn:hover, button.sheetbtn:focus-visible { color: var(--text); border-color: #5a6680; }
@media (pointer: coarse) {
    button.sheetbtn { width: 30px; height: 30px; }
}
.hs-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.hs-hp { display: inline-flex; align-items: center; gap: 5px; }
.hs-bar { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: #0b0d12; border: 1px solid var(--line); overflow: hidden; }
.hs-bar i { display: block; height: 100%; background: #3c9a61; }
.hs-bar i.mid { background: #b3861d; }
.hs-bar i.low { background: #c24a4a; }
.hs-stat, .hs-rest { display: inline-flex; align-items: center; gap: 2px; color: var(--dim); }
.hs-stat .ico, .hs-rest .ico { width: 13px; height: 13px; }
.hs-rest { color: var(--k); }
.hs-rest .ico + .ico { width: 9px; height: 9px; color: var(--dim); }
.hs-states { display: inline-flex; gap: 3px; }
.hs-states .statetag { margin: 0; }
/* The details of a picked action are in its tooltip (hold the tile): no strip of its own. */
.ab-detail { display: none; }
/* What the game says about the last thing tried: over the board for a moment, never a row of its own on a phone. */
.boardmsg {
    position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6; pointer-events: none; max-width: 92%;
    padding: 6px 12px; border-radius: 8px; font-size: 13px; text-align: center; color: #10131a; background: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); opacity: 0; visibility: hidden;
}
.boardmsg.show { visibility: visible; opacity: 1; }
@media (max-width: 767px) {
    .boardcol .timeline { padding: 4px 6px 1px; }
    .timeline.scrub { padding-top: 16px; }
    .hs-bar { width: 54px; }
}

/*
 * A wide screen that is not tall (a tablet on its side, a laptop): the board with everything under it does not fit
 * one screen, and there is room beside it. The board stands alone on the left and stays in view; the timeline, the
 * hero in hand and the action bar go to the top of the right column, over the panel. The same condition is in
 * Main.kt (SIDE_LAYOUT), which lays the page out again when it starts or stops being true.
 */
@media (min-width: 900px) and (max-height: 880px) {
    body.in-game main {
        display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); grid-template-rows: auto auto auto 1fr;
        gap: 0 16px; align-items: start; max-width: 1240px; padding: 10px 16px 16px;
    }
    body.in-game .boardcol { display: contents; }
    body.in-game .boardcol .canvaswrap { grid-column: 1; grid-row: 1 / -1; position: sticky; top: 8px; }
    body.in-game .boardcol .canvaswrap canvas { border-radius: 12px; }
    body.in-game .boardcol .timeline { grid-column: 2; grid-row: 1; border-top: 1px solid var(--line); border-radius: 10px 10px 0 0; }
    body.in-game .boardcol .herostrip { grid-column: 2; grid-row: 2; }
    body.in-game .boardcol .actionbar { grid-column: 2; grid-row: 3; min-width: 0; }
    body.in-game .panel { grid-column: 2; grid-row: 4; max-width: none; min-width: 0; margin-top: 10px; }
}

/* Checkboxes drawn for the dark page: the browser's own empty box is a white square here. Empty: a dark box with the
   line colour; ticked: the accent with a dark tick. The size suits a finger as well as a mouse. */
input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; flex: none;
    width: 18px; height: 18px; margin: 0 6px 0 0; padding: 0; vertical-align: -4px;
    background: #10131a center / 14px 14px no-repeat; border: 1px solid #5a6680; border-radius: 4px; cursor: pointer;
}
input[type="checkbox"]:hover { border-color: var(--dim); }
input[type="checkbox"]:checked {
    background-color: var(--accent); border-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310131a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5L10 17.5L19 7'/%3E%3C/svg%3E");
}
input[type="checkbox"]:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: 0.4; cursor: default; }
@media (pointer: coarse) {
    input[type="checkbox"] { width: 22px; height: 22px; background-size: 17px 17px; vertical-align: -6px; }
}

/* Health given back, in the log's damage column: the green of aid. */
.ldmg.lheal { color: var(--aid); }
/* How hard the bot plays: a small choice at the end of the line that names the bot. */
.picklabel select.botlevel { margin-left: auto; width: auto; padding: 2px 6px; font-size: 12px; }
