/* Arena Companion panel. Dark, calm, readable at a glance from a second monitor. */

:root {
  --bg: #101214;
  --panel: #171a1e;
  --raise: #1e2227;
  --line: #2b3036;
  --text: #e8eaec;
  --muted: #b0b7be;
  --quiet: #959ea6;
  --focus: #8cc8ff;
  --you: #6fc08c;
  --opp: #e0b25a;
  --cheap: #e7c27a;
  --grave: #b9a6e8;
  --table: #8fd0b6;
  --warn: #f0a36c;

  --m-w: #efe6bd; --m-u: #2a6fb0; --m-b: #4a4152; --m-r: #b23a2e; --m-g: #2f7d4f;
  --m-n: #5f6a66; --m-c: #b9b4ae;
  --ink-light: #ffffff; --ink-dark: #24211a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
h2 { margin: 0; font-weight: 600; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.quiet { color: var(--quiet); font-size: 13px; }

/* ---- top bar ------------------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 12px 20px; align-items: flex-start; justify-content: space-between;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
}
.bar.whose-you { border-left-color: var(--you); }
.bar.whose-opponent { border-left-color: var(--opp); }
.bar-main { min-width: 0; flex: 1 1 auto; }
.turn-line { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline; }
.turn { font-size: 20px; font-weight: 600; }
.opp-line { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; margin-top: 4px; font-size: 15px; }
.hand.zero { color: var(--warn); font-weight: 600; }
.mana { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.mana .total { font-weight: 600; margin-left: 4px; }
.mana .names { color: var(--quiet); font-size: 13px; margin-left: 6px; }
.cost-notes { margin: 6px 0 0; padding: 0; list-style: none; color: var(--quiet); font-size: 13px; }
.cost-notes li { margin: 1px 0; }

.toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px;
  cursor: pointer;
}
.toggle-track { width: 34px; height: 20px; border-radius: 999px; background: #3a4047; position: relative; }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #c9ced3; }
.toggle[aria-pressed="true"] .toggle-track { background: #2f6f4b; }
.toggle[aria-pressed="true"] .toggle-knob { left: 16px; background: #ffffff; }
.toggle:disabled { opacity: .6; cursor: wait; }

.notices { padding: 0 20px; }
.notice { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: #2a2219; color: #f3d2b3; border: 1px solid #5a4330; }

/* ---- the windows (P25, dock.js) ---------------------------------------------------------
   The page fills the browser window: the bar, the windows, a one-line footer. Windows sit in
   columns (side by side) and frames (stacked in a column); each frame scrolls by itself. */
.panel-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.panel-page .bar { position: static; flex: 0 0 auto; }
.panel-page .notices { flex: 0 0 auto; }
/* (P44) what the app has noticed (`health`): quieter than a problem, with a way to put it away */
.notice.health { display: flex; align-items: flex-start; gap: 12px; background: #17212b; color: #cfe1f2; border-color: #2f4a63; }
.notice.health > span { flex: 1 1 auto; min-width: 0; }
.notice.health .small { flex: 0 0 auto; padding: 1px 10px; font-size: 12.5px; }
.bar-tools { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 10px; }
.layout-button { padding: 6px 12px; border-radius: 999px; }
.layout-button[aria-expanded="true"] { border-color: var(--focus); background: #2f4a63; }

.dock { flex: 1 1 auto; min-height: 0; display: flex; padding: 10px 12px 6px; overflow: hidden; }
.dock-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.pane-head { flex: 0 0 auto; display: flex; align-items: stretch; gap: 4px; padding: 0 4px 0 2px;
  background: #13161a; border-bottom: 1px solid var(--line); }
.pane-tabs { flex: 1 1 auto; min-width: 0; display: flex; overflow: hidden; }
.tab {
  position: relative; flex: 0 1 auto; min-width: 0; padding: 8px 14px 6px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  font-size: 14.5px; font-weight: 600; color: var(--quiet); cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; user-select: none; -webkit-user-select: none;
}
.tab:hover { color: var(--ink-light); }
.tab[aria-selected="true"] { color: var(--ink-light); border-bottom-color: var(--focus); }
.tab.alone { border-bottom-color: transparent; cursor: grab; }
.dock.locked .tab.alone, .dock.fixed .tab.alone { cursor: default; }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tab-mark { display: none; }
.tab.changed .tab-mark { display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%;
  background: var(--opp); vertical-align: middle; }
.pane-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 1px; }
.pane-tool { width: 26px; height: 26px; padding: 0; background: none; border: 0; border-radius: 6px;
  color: var(--quiet); font-size: 15px; line-height: 1; cursor: pointer; }
.pane-tool:hover { background: var(--raise); color: var(--text); }
.dock.locked .pane-tool { display: none; }
.pane-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 14px 14px; container-type: inline-size; }
.pane-body.fills { overflow: hidden; display: flex; flex-direction: column; padding: 8px 12px 10px; }
.pane-body.fills > .panel:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.panel:focus { outline: none; }
.panel.has-message > .panel-content { display: none; }

/* the bars between windows */
.split { flex: 0 0 10px; position: relative; touch-action: none; }
.split-v { cursor: col-resize; }
.split-h { cursor: row-resize; }
.split::after { content: ""; position: absolute; border-radius: 3px; background: var(--focus); opacity: 0; }
.split-v::after { top: 10px; bottom: 10px; left: 3px; width: 4px; }
.split-h::after { left: 10px; right: 10px; top: 3px; height: 4px; }
.split:hover::after, .split.active::after { opacity: .55; }
.split:focus-visible { outline: none; }
.split:focus-visible::after { opacity: .9; }
.dock.locked .split { pointer-events: none; cursor: default; }
.dock.locked .split::after { display: none; }
body.sizing-v, body.sizing-v * { cursor: col-resize !important; user-select: none !important; }
body.sizing-h, body.sizing-h * { cursor: row-resize !important; user-select: none !important; }

/* moving a window */
.drop-hint { position: fixed; z-index: 40; pointer-events: none; border: 2px solid var(--focus); border-radius: 10px;
  background: rgba(140, 200, 255, .16); transition: left .07s, top .07s, width .07s, height .07s; }
.drag-ghost { position: fixed; z-index: 41; pointer-events: none; padding: 4px 10px; border-radius: 6px;
  background: var(--raise); border: 1px solid var(--focus); font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
body.dragging-window, body.dragging-window * { cursor: grabbing !important; user-select: none !important; }
@media (prefers-reduced-motion: reduce) { .drop-hint { transition: none; } }

/* the Layout menu */
.menu { position: fixed; z-index: 30; top: calc(var(--bar-h, 60px) + 6px); right: 12px;
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - var(--bar-h, 60px) - 20px); overflow-y: auto;
  background: #20252b; border: 1px solid #3a424b; border-radius: 10px; padding: 10px 14px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55); }
.menu-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.menu p { margin: 4px 0 10px; }
.menu-h { margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--quiet); }
.menu-window { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding: 5px 0; border-bottom: 1px solid var(--line); }
.menu-window select { flex: 1 1 200px; min-width: 0; max-width: 270px; font: inherit; font-size: 13px; color: var(--text);
  background: var(--raise); border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; }
.menu-presets { display: grid; gap: 6px; }
.preset { display: grid; gap: 1px; text-align: left; padding: 7px 10px; background: var(--raise);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.preset:hover { border-color: var(--focus); }
.preset-name { font-weight: 600; }

/* a tick box with its words (the colour filter, the deck list's details, the Layout menu) */
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--focus); cursor: pointer; }
.check input:disabled { cursor: default; }
.filter-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 8px; font-size: 14px; }
.shown-colors { display: inline-flex; align-items: center; gap: 1px; color: var(--quiet); font-size: 13px; }
.shown-colors .pip { width: 18px; height: 18px; font-size: 11px; }
/* ---- the timing tell (P26) ---------------------------------------------------------------------
   One line in the bar and a strip at the top of the Opponent window. Both keep their place for
   the whole game, so nothing below them moves when a tell comes or goes. */
.tell-bar { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; min-height: 1.5em; font-size: 14px; min-width: 0; }
.tell-bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
/* (P43) this opponent's own pace beside the line: a count; it keeps its room when the line is long */
.tell-pace { flex: 0 0 auto; color: var(--quiet); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--line); padding-left: 8px; }
.tell { margin: 0 0 10px; padding: 8px 12px; min-height: 5.4em; background: var(--raise); border: 1px solid var(--line);
  border-radius: 8px; }
.tell-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tell-line .tools-label { margin: 0; }
.tell-text { flex: 1 1 260px; min-width: 0; font-size: 15px; }
.tell-text.quiet { font-size: 13.5px; }
.tell-strength { margin: 4px 0 0; }
.tell-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; font-size: 13.5px; }
.tell-kind { flex: 0 0 auto; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px;
  font-weight: 700; line-height: 1.6; white-space: nowrap; }
.tell-kind.hold { color: #ffd9a8; border-color: #8a6230; background: #2c2216; }
.tell-kind.pass { color: #bfe6d2; border-color: #35594d; background: #15231e; }
/* (P49) passing automatically, and the notice about an ability on their table they can use: loud on purpose */
.tell-kind.auto { color: #1b1300; border-color: #f2c14e; background: #f2c14e; font-weight: 700; }
.tell-table-chip { flex: 0 0 auto; padding: 0 8px; border-radius: 4px; background: #f2c14e; color: #1b1300; font-weight: 700;
  font-size: 12.5px; white-space: nowrap; }
.tell-table-note { margin: 0 0 8px; padding: 6px 10px; border-left: 4px solid #f2c14e; background: rgba(242, 193, 78, .14);
  color: #ffe9b0; font-weight: 600; line-height: 1.35; min-height: 2.7em; }
.tell-table-note.off { border-left-color: var(--line); background: none; color: var(--quiet); font-weight: 400; }
.timing-table-note { margin: 0 0 12px; font-size: 15px; }
@media (max-width: 560px) {      /* a narrow screen: the notice takes a line of its own; the rest of the bar is as it was */
  .tell-bar.has-table { flex-wrap: wrap; }
  .tell-bar.has-table .tell-table-chip { flex: 0 0 100%; max-width: 100%; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; }
  .tell-bar.has-table .tell-bar-text { flex: 1 1 0; }
}
.tell-kind.now { animation: tell-now 1.4s ease-in-out infinite; }
@keyframes tell-now { 50% { background: #5a3f17; border-color: var(--opp); } }
@media (prefers-reduced-motion: reduce) { .tell-kind.now { animation: none; border-color: var(--opp); } }
/* the marks on the rows a tell names */
.tell-mark { border-radius: 4px; padding: 0 5px; font-size: 11.5px; line-height: 1.5; letter-spacing: 0; text-transform: none;
  font-weight: 600; white-space: nowrap; }
.tell-mark.held { color: #ffd9a8; border: 1px solid #8a6230; }
.tell-mark.passed { color: #bfe6d2; border: 1px solid #35594d; }
.row.ruled-out .name { color: var(--quiet); }
/* (P43) dimmed, not left out: a card a choice above rules out keeps its place, greyed and uncounted;
   one crossed out by hand is struck through as well */
.row.dimmed > * { opacity: .42; }
.row.dimmed:hover > *, .row.dimmed.active > *, .row.dimmed:focus-visible > * { opacity: .8; }
.row.struck .name { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.dim-mark { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11.5px; line-height: 1.5; white-space: nowrap; }
.x-max { color: var(--cheap); white-space: nowrap; }
/* the line keeps the height of its button, so the lists below do not move when the button comes */
.strike-line { margin-top: -4px; font-size: 13px; min-height: 26px; }
.strike-line .small { padding: 1px 8px; font-size: 12.5px; }
.tip-strike { margin-top: 10px; }
.card-tip:not(.pinned) .tip-strike, .card-tip.pinned .tip-strike-hint { display: none; }
.cost-notes li.free-cast { color: var(--warn); }

/* ---- the Timing window (P29) -------------------------------------------------------------------
   Everything the timing has said this game, with the measured numbers. Amber is a stop, green a
   pass at once, the same two colours as the marks on the Opponent window's rows. */
.tell-more { margin-left: auto; padding: 1px 9px; font-size: 12.5px; }
.timing-tools { margin-bottom: 12px; }
.timing-show { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.seg-group { display: inline-flex; }
.seg-group .seg { border-radius: 0; margin-left: 0; }
.seg-group .seg + .seg { border-left: 0; }
.seg-group .seg:first-child { border-radius: 6px 0 0 6px; }
.seg-group .seg:last-child { border-radius: 0 6px 6px 0; }
.timing-none { margin: 0; max-width: 68ch; font-size: 14px; line-height: 1.5; }
#panel-timing .group-h .n { text-transform: none; }
.timing-latest { padding: 10px 14px 12px; background: var(--raise); border: 1px solid var(--line); border-radius: 8px; }
.timing-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.timing-where { font-weight: 600; font-size: 15px; }
.timing-statement { margin: 8px 0; font-size: 16px; line-height: 1.45; max-width: 72ch; }
.timing-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 8px 0 0; font-size: 14px; }
.timing-facts dt { color: var(--quiet); }
.timing-facts dd { margin: 0; min-width: 0; }
.timing-mana { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; vertical-align: middle; }
.timing-cardlist { line-height: 1.9; }
.timing-evidence { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.timing-evidence > p.quiet { margin: 6px 0 0; font-size: 13px; max-width: 78ch; }
.stat-h { margin: 14px 0 6px; font-size: 13.5px; color: var(--muted); max-width: 78ch; }
.timing-evidence > .stat-h:first-child { margin-top: 0; }
.stat { display: grid; grid-template-columns: minmax(96px, 170px) minmax(60px, 1fr) 78px;
  grid-template-areas: "label meter value" "note note note"; align-items: center; gap: 1px 10px; margin: 0 0 6px; font-size: 14px; }
.stat-label { grid-area: label; }
.meter { grid-area: meter; height: 10px; border-radius: 5px; background: #262b31; overflow: hidden; }
.meter-fill { display: block; height: 100%; min-width: 2px; background: var(--muted); border-radius: 5px; }
.meter.hold .meter-fill { background: var(--opp); }
.meter.pass .meter-fill { background: #5fb89a; }
.stat-value { grid-area: value; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.stat-note { grid-area: note; font-size: 12.5px; }

.table-scroll { overflow-x: auto; margin: 0 0 10px; }
.timing-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.timing-table th, .timing-table td { text-align: left; vertical-align: top; padding: 6px 12px 6px 0; border-top: 1px solid var(--line); }
.timing-table thead th { border-top: 0; color: var(--quiet); font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap; }
.timing-table tbody th { font-weight: 600; }
.timing-table tr.is-old th, .timing-table tr.is-old td { color: var(--quiet); }
.timing-table td.held { color: #ffd9a8; font-weight: 600; }
.timing-table td.passed { color: #bfe6d2; font-weight: 600; }
.timing-name { min-width: 150px; }
.timing-name .cardref { font-weight: 600; }
.castable-now { display: inline-block; margin-left: 6px; font-size: 11.5px; color: var(--focus); border: 1px solid #3b5870;
  border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.timing-cost { white-space: nowrap; }
.timing-status { white-space: nowrap; }
.timing-count { font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timing-tally.passed .timing-count { color: #bfe6d2; }
.timing-tally.held .timing-count { color: #ffd9a8; }
.timing-last { font-size: 12.5px; }
.tell-mark.shown-since { color: #cfc3f5; border: 1px solid #5a4d8a; }
.share-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.timing-summary { margin: 0 0 8px; font-size: 15px; max-width: 78ch; }
.timing-caution { margin: 0 0 10px; padding: 8px 12px; border: 1px solid #7a5a2a; background: #2a2114; border-radius: 6px;
  color: #ffe2b8; font-size: 14px; max-width: 78ch; }
.timing-moment-tools { margin-top: 14px; }
.timing-window-pick select { margin-left: 6px; }
.timing-moments { list-style: none; margin: 0; padding: 0; }
.moment { padding: 6px 0 6px 12px; border-left: 3px solid var(--line); margin: 0 0 10px; }
.moment.hold { border-left-color: #8a6230; }
.moment.pass { border-left-color: #35594d; }
.moment.auto { border-left-color: #f2c14e; }
.moment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.moment-n { color: var(--quiet); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.moment-where { font-weight: 600; font-size: 14px; }
.moment-facts { font-size: 13px; }
.moment-statement { margin: 4px 0 2px; font-size: 14.5px; line-height: 1.45; max-width: 78ch; }
.moment-strength { margin: 0 0 2px; font-size: 13px; max-width: 78ch; }
.moment-cards { margin: 2px 0 0; font-size: 13.5px; }
details.moment-cards summary { cursor: pointer; color: var(--muted); margin-bottom: 2px; }

.timing-numbers > #timing-numbers-body > p { max-width: 78ch; font-size: 14px; margin: 0 0 8px; }
.timing-rate { margin: 0 0 8px; font-size: 14.5px; max-width: 78ch; }
.numbers-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.numbers-head .group-h { width: auto; margin-right: auto; }
.numbers-block { border-top: 1px solid var(--line); }
.numbers-block > summary { padding: 8px 0; cursor: pointer; max-width: 92ch; }
.numbers-block > summary::marker { color: var(--quiet); }
.numbers-title { font-weight: 600; font-size: 14.5px; margin-right: 10px; }
.numbers-reading { font-size: 13.5px; }
.numbers-block[open] > summary .numbers-title { color: var(--focus); }
.numbers-body { padding: 2px 0 12px; }
.numbers-body > p { max-width: 78ch; font-size: 14px; margin: 0 0 8px; }
.numbers-limits-box { border-top: 1px solid var(--line); }
.meter.kind .meter-fill { background: #9fb4c8; }
.stat.stat-absent { opacity: .55; }
.numbers-h { margin: 20px 0 4px; font-size: 15px; }
.numbers-sub { font-weight: 600; color: var(--muted); }
.numbers-limits { margin: 4px 0 0; padding-left: 20px; font-size: 14px; max-width: 78ch; }
.numbers-limits li { margin: 0 0 4px; }
/* a narrow window: each card of the table becomes a small block */
@container (max-width: 560px) {
  .timing-cards .timing-table thead { display: none; }
  .timing-cards .timing-table, .timing-cards .timing-table tbody { display: block; }
  .timing-cards .timing-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0;
    border-top: 1px solid var(--line); }
  .timing-cards .timing-table td { display: block; border: 0; padding: 0; }
  .timing-cards .timing-name { min-width: 0; }
  .timing-cards .timing-group, .timing-cards .timing-tally { grid-column: 1 / -1; }
  .timing-cards .timing-tally::before { content: attr(data-label) ": "; color: var(--quiet); }
}
@container (max-width: 430px) {
  .timing-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .timing-facts dd { margin-bottom: 6px; }
  .stat { grid-template-columns: minmax(0, 1fr) 78px; grid-template-areas: "label value" "meter meter" "note note"; }
}

/* the five colour buttons: click one to cross it out; a dot under a colour they have shown */
.color-chips { display: inline-flex; align-items: center; gap: 3px; }
.color-chip { position: relative; padding: 2px; margin-bottom: 5px; line-height: 0; background: none;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.color-chip .pip { margin: 0; width: 24px; height: 24px; font-size: 13px; }
.color-chip:hover { border-color: var(--quiet); }
.color-chip.crossed .pip { opacity: .55; filter: grayscale(.3); }
.color-chip.crossed::after { content: ""; position: absolute; left: -1px; right: -1px; top: 50%; height: 3px; margin-top: -1.5px;
  background: #f6e3cf; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .65); transform: rotate(-45deg);
  pointer-events: none; }
.color-chip.has-shown::before { content: ""; position: absolute; left: 50%; bottom: -6px; width: 5px; height: 5px;
  margin-left: -2.5px; border-radius: 50%; background: var(--opp); }

/* a narrow browser window: the frames stack, the page scrolls, nothing is dragged */
@media (max-width: 760px) {
  .panel-page { display: block; height: auto; overflow: visible; }
  .dock { display: block; padding: 10px 12px 4px; overflow: visible; }
  .dock-col { display: block; }
  .pane { display: block; margin-bottom: 12px; }
  .pane-body { overflow: visible; }
  .pane-body.fills { display: block; }
  .pane-body.fills > .panel:not([hidden]) { display: flex; max-height: 70vh; }
  .split { display: none; }
  .tab.alone { cursor: default; }
}
body.stale .dock, body.stale .bar-main { opacity: .45; filter: grayscale(1); }
/* a window opened in a browser window of its own: only that window and the bar */
.panel-page.popout .foot, .panel-page.popout .layout-button { display: none; }

.block { margin-bottom: 22px; }
.state { font-size: 20px; padding: 18px 0 8px; }
.state p { margin: 0 0 10px; }
.state .reason { color: var(--muted); font-size: 16px; }
.no-hand { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--panel); }
/* "No cards in hand" dims the lists of cards from hand, not the graveyard group */
.lists.dim > .block:not(.graveyard):not(.on-table) { opacity: .5; }

.instant-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.big-count { font-size: 46px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.instant-word { font-size: 17px; color: var(--muted); font-weight: 500; }
.empty { font-size: 17px; color: var(--muted); margin: 6px 0 12px; }
.instant-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.jump { border-color: var(--opp); }

.group-h, .group-fold {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  margin: 14px 0 2px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--quiet);
}
.group-h .n, .group-fold .n { font-weight: 600; letter-spacing: 0; }
.group-fold { background: none; border: 0; padding: 6px 0; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.group-fold::before { content: "▸"; display: inline-block; width: 1em; color: var(--quiet); }
.group-fold[aria-expanded="true"]::before { content: "▾"; }

/* ---- card rows ----------------------------------------------------------------------- */
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 12px;
  width: 100%; margin: 0; padding: 7px 6px; text-align: left; cursor: default;
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
}
.row:hover, .row.active { background: var(--raise); }
.row .name { font-size: 18px; font-weight: 600; min-width: 0; }
.row .meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12.5px; color: var(--quiet); }
.row .cost { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; }
.row .reason { grid-column: 1 / -1; color: var(--cheap); font-size: 14.5px; margin-top: 2px; }
@container (min-width: 560px) {
  /* one line per card in a wide window: name, then type and rarity, then the cost */
  .row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .row .meta { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .row .cost { grid-column: 3; grid-row: 1; min-width: 72px; text-align: right; }
}
.rar.rare { color: #d8c27d; }
.rar.mythic { color: #e59a6a; }

.cheaper { border-left: 3px solid var(--cheap); padding: 2px 0 2px 12px; background: linear-gradient(90deg, #1b1913, transparent 60%); }
.cheaper .group-h { margin-top: 4px; color: var(--cheap); }
.graveyard { border-left: 3px solid var(--grave); padding: 2px 0 2px 12px; background: linear-gradient(90deg, #17151d, transparent 60%); }
.graveyard .group-h { margin-top: 4px; color: var(--grave); }
.graveyard .row .reason { color: var(--grave); }
/* On the table (P12): certain, needs no card in hand; quieter than the lists from hand */
.on-table { border-left: 3px solid var(--table); padding: 2px 0 2px 12px; background: linear-gradient(90deg, #131a18, transparent 60%); }
.on-table .group-h { margin-top: 4px; color: var(--table); }
.on-table .group-h .group-fold { margin: 0; padding: 0; border: 0; width: auto; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; }
.on-table .row .name { font-size: 16px; }
.on-table .row .reason { color: var(--table); font-size: 14px; }
.on-table .row .note { grid-column: 1 / -1; color: var(--quiet); font-size: 12.5px; }
.on-table .copies { color: var(--quiet); font-weight: 500; }
/* (P43) "once each turn", used: the line stays in its place, greyed, out of the count until the next turn */
.on-table .row.used > :not(.meta) { opacity: .42; }
.on-table .row.used .meta > :not(.used-mark) { opacity: .42; }
.used-mark { color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11.5px;
  line-height: 1.5; white-space: nowrap; }
.pip.tap { background: var(--m-n); font-size: 11px; }

.fold {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-align: left; cursor: pointer;
  font-size: 16px;
}
.fold-mark::before { content: "▸"; }
.fold[aria-expanded="true"] .fold-mark::before { content: "▾"; }
.sorcery .groups { padding: 0 4px; }

/* ---- mana pips ----------------------------------------------------------------------- */
.pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; margin-left: 2px; vertical-align: middle;
  font-size: 12.5px; font-weight: 700; color: var(--ink-light); background: var(--m-n);
}
.pip.w { background: var(--m-w); color: var(--ink-dark); box-shadow: inset 0 0 0 1px #8c8461; }
.pip.u { background: var(--m-u); } .pip.b { background: var(--m-b); box-shadow: inset 0 0 0 1px #9a8fa6; } .pip.r { background: var(--m-r); }
.pip.g { background: var(--m-g); } .pip.n { background: var(--m-n); }
.pip.c { background: var(--m-c); color: var(--ink-dark); }
.pip.any { background: conic-gradient(var(--m-w) 0 20%, var(--m-u) 0 40%, var(--m-b) 0 60%, var(--m-r) 0 80%, var(--m-g) 0); }
.pip.hy { background: linear-gradient(135deg, var(--pa) 0 50%, var(--pb) 50% 100%); text-shadow: 0 0 2px #000; }
.pip.a-w { --pa: var(--m-w); } .pip.a-u { --pa: var(--m-u); } .pip.a-b { --pa: var(--m-b); }
.pip.a-r { --pa: var(--m-r); } .pip.a-g { --pa: var(--m-g); } .pip.a-n { --pa: var(--m-n); } .pip.a-c { --pa: var(--m-c); }
.pip.b-w { --pb: var(--m-w); } .pip.b-u { --pb: var(--m-u); } .pip.b-b { --pb: var(--m-b); }
.pip.b-r { --pb: var(--m-r); } .pip.b-g { --pb: var(--m-g); } .pip.b-n { --pb: var(--m-n); } .pip.b-c { --pb: var(--m-c); }
.pip.floating { outline: 2px dashed var(--quiet); outline-offset: 1px; }
.pip.big { width: 24px; height: 24px; font-size: 13px; }

/* ---- library blocks ------------------------------------------------------------------ */
.lib-line { margin: 8px 0; padding: 8px 12px; background: var(--panel); border-radius: 8px; border: 1px solid var(--line);
  font-size: 16px; line-height: 1.9; }
.lib-pos { color: var(--quiet); font-size: 14px; white-space: nowrap; }
.cardref { display: inline; padding: 1px 7px; margin: 0 1px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--raise); font-weight: 600; cursor: default; line-height: 1.5; }
.cardref:hover, .cardref.active { border-color: var(--focus); }
.logref { display: inline; padding: 0; margin: 0; border: 0; background: none; font-weight: inherit;
  text-decoration: underline dotted var(--quiet); text-underline-offset: 3px; line-height: inherit; }
.logref:hover, .logref.active { text-decoration-color: var(--focus); }
/* ---- the You window (P15) -------------------------------------------------------------- */
.you-intro { margin: 2px 0 8px; color: var(--muted); font-size: 15px; }
.you-mana { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; font-size: 15px; }
.you-mana .total { font-weight: 700; }
.you-mana .names { color: var(--quiet); font-size: 13px; }
.decks-empty { margin: 6px 0 14px; max-width: 60ch; }

/* ---- shown this game (P15) ------------------------------------------------------------ */
.shown-mark { color: var(--quiet); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
  font-size: 11.5px; line-height: 1.5; }
.tip-seen { color: var(--quiet); font-size: 13px; margin-top: 6px; }
.shown { margin-top: 10px; }
.quiet-fold { background: none; border-color: transparent; color: var(--quiet); font-size: 14px; padding: 6px 4px; }
.shown-cards { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 4px 0; }
.shown-cards .cardref { font-size: 14px; font-weight: 500; }

/* ---- game log ------------------------------------------------------------------------ */
.panel-log { min-width: 0; }
.log-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.log-game { min-width: 0; }
.log-head .small { margin-left: auto; }
.small { background: var(--raise); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.log { overflow-y: auto; overflow-anchor: none; min-height: 120px; flex: 1 1 auto; padding-right: 4px; }
.log-turn { position: sticky; top: 0; z-index: 1; background: var(--panel); margin: 0; padding: 8px 0 3px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--quiet); }
.log-turn.you { color: var(--you); } .log-turn.opponent { color: var(--opp); }
.entry { padding: 3px 0 3px 10px; border-left: 3px solid transparent; font-size: 14.5px; }
.entry .step { color: var(--quiet); font-size: 12px; margin-right: 6px; }
.entry.k-attack, .entry.k-block { border-left-color: #c47a3a; }
.entry.k-damage { border-left-color: #c0473b; }
.entry.k-life { border-left-color: #d9a441; font-weight: 600; }
.entry.k-dies { border-left-color: #7d6a8a; }
.entry.k-cast, .entry.k-ability, .entry.k-trigger { border-left-color: #3f6f9e; }
.entry.k-game_start, .entry.k-game_end { color: var(--muted); font-style: italic; }
.entry.k-tap, .entry.k-choice { color: var(--muted); }
.entry.k-attach, .entry.k-effect { border-left-color: #4f6a7f; }
.entry.k-control { border-left-color: #9a6fb0; }
.entry.k-gap { color: var(--quiet); font-style: italic; border-left: 3px dotted var(--quiet); }
.entry.k-other { border-left: 3px dashed var(--warn); background: rgba(240, 163, 108, .08); }
.log.shorter .entry.quiet { display: none; }
.log-view { display: inline-flex; margin-left: auto; }
.log-view + .small { margin-left: 6px; }
.log-head .seg { border-radius: 0; margin-left: 0; }
.seg:first-child { border-radius: 6px 0 0 6px; }
.seg:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.seg[aria-pressed="true"] { background: #2f4a63; border-color: var(--focus); }
.log-empty { color: var(--quiet); padding: 10px 0; }
.latest { align-self: center; margin-top: 6px; background: var(--raise); border: 1px solid var(--focus); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.games { margin: 0 0 8px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.games button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 4px; cursor: pointer; }
.games button:hover { background: var(--raise); }
.saved-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 6px; color: var(--muted); }

/* ---- the hover card ------------------------------------------------------------------ */
.card-tip {
  position: fixed; z-index: 20; display: flex; gap: 14px; align-items: flex-start;
  max-width: calc(100vw - 24px);
  background: #20252b; border: 1px solid #3a424b; border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55); pointer-events: none;
}
.tip-body { width: min(340px, calc(100vw - 52px)); min-width: 0; }
.tip-pic img { display: block; width: 223px; height: auto; border-radius: 10px; }
.card-tip.pinned { pointer-events: auto; }
.tip-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tip-name { font-size: 18px; font-weight: 700; }
.tip-type { color: var(--muted); margin: 4px 0 8px; font-size: 14px; }
.tip-text { white-space: pre-line; font-size: 14.5px; }
.tip-foot { color: var(--quiet); font-size: 12.5px; margin-top: 8px; display: flex; justify-content: space-between; gap: 10px; }
.tip-reason { color: var(--cheap); margin-top: 8px; font-size: 14px; }
@media (max-width: 640px) {
  .card-tip { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto;
    flex-direction: column-reverse; align-items: center; max-height: calc(100vh - 24px); overflow-y: auto; }
  .tip-body { width: 100%; }
  .tip-pic img { width: auto; max-width: 100%; max-height: 38vh; }
}

/* ---- footer: the card pictures switch, Your games, the version ---------------------------- */
.foot { padding: 4px 20px 24px; }
.foot-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 8px; }
.foot .quiet { max-width: 70ch; }
.panel-page .foot { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 22px; padding: 2px 14px 8px; }
.panel-page .foot .quiet { font-size: 12.5px; }
.foot-item { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.panel-page .foot .small { padding: 1px 8px; font-size: 12.5px; }
.panel-page .foot .version-line { margin: 0 0 0 auto; }
.attribution { margin: 4px 0 0; }
/* ---- play rates (P17) ---------------------------------------------------------------- */
.order-line { margin: 0 0 4px; }
.order-credit { margin: -2px 0 6px; font-size: 12px; }
.row .meta .rate { white-space: nowrap; }
.base-rate { margin: 2px 0 6px; font-size: 14px; color: var(--muted); cursor: help; }
.row .meta .rate { color: var(--quiet); }
#pictures-toggle[aria-pressed="false"] { color: var(--muted); }

/* ---- hand marks and the library (P21) ------------------------------------------------------ */
.known-mark { color: var(--opp); border: 1px solid var(--opp); border-radius: 4px; padding: 0 5px;
  font-size: 11.5px; line-height: 1.5; }
.hand-mark { color: var(--you); border: 1px solid var(--you); border-radius: 4px; padding: 0 5px;
  font-size: 11.5px; line-height: 1.5; }
.tip-known { color: var(--opp); font-size: 13px; margin-top: 6px; }
.known-hand { margin: 0 0 10px; padding: 7px 12px; border-left: 3px solid var(--opp); background: var(--panel);
  line-height: 1.9; }
.known-hand .cardref { font-size: 14px; }
.in-hand-line { margin: 0 0 4px; color: var(--you); font-size: 14px; }
.deck-totals { margin: 6px 0 2px; font-size: 16px; font-weight: 600; }
.deck-next { margin: 4px 0; padding: 6px 10px; border-left: 3px solid var(--focus); background: var(--panel); }
.deck-land { margin: 2px 0 6px; color: var(--muted); }
.deck-unaccounted { margin: 4px 0 6px; padding: 6px 10px; border-left: 3px solid var(--warn); background: var(--panel); }
.deck-list .group-h { margin-top: 10px; }
/* (P25) what each line of the list shows is the owner's choice: the tick boxes above the list */
.deck-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 2px; padding: 6px 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.tools-label { color: var(--quiet); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.deck-tools .check input { width: 14px; height: 14px; }
.tools-select { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tools-select select { font: inherit; font-size: 13px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 4px; }
.deck-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 1px 10px; align-items: center;
  padding: 4px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.deck-n { text-align: right; color: var(--muted); }
.deck-main { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 10px; }
.deck-name .cardref { font-weight: 500; }
/* the type and the category always take the line under the name, so every line reads the same */
.deck-meta { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 8px; color: var(--quiet); font-size: 12.5px; }
.cat { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.cat.removal { color: #f0a36c; border-color: #6b4a33; }
.cat.pump { color: #8fd0b6; border-color: #35594d; }
.cat.counter { color: #8cc8ff; border-color: #34556f; }
.cat.flash { color: #e7c27a; border-color: #6a5a36; }
.deck-right { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px 12px; white-space: nowrap; }
.deck-right .cost .pip { width: 19px; height: 19px; font-size: 11.5px; }
.deck-chance { color: var(--muted); font-size: 14px; white-space: nowrap; min-width: 8.6em; text-align: right; }
.deck-text { grid-column: 2 / -1; margin: 0 0 2px; color: var(--muted); font-size: 13px; white-space: pre-line; }
.deck-row.at-bottom .deck-chance { color: var(--quiet); font-style: italic; }
/* (P43) at least one copy within the next 3 and 5 draws */
.deck-within { color: var(--quiet); font-size: 13px; white-space: nowrap; min-width: 10em; text-align: right; }
.deck-row.at-bottom .cardref { opacity: .7; }
@container (max-width: 430px) {
  /* a narrow window: the cost and the chance go under the name */
  .deck-row { grid-template-columns: 2.2em minmax(0, 1fr); }
  .deck-right { grid-column: 2; justify-content: flex-start; }
  .deck-chance { min-width: 0; margin-left: auto; }
}
.deck-assumed { margin: 8px 0 0; max-width: 70ch; }
.deck-unknown { margin: 6px 0 14px; }

/* ---- a new version of the panel (P24) -------------------------------------------------------- */
.new-version { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 20px;
  background: #22303d; border-bottom: 1px solid var(--focus); font-size: 15px; }
.version-line { margin: 6px 0 0; }

/* ---- the Combat tab (P23) ------------------------------------------------------------------ */
.help-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 2px 0 6px; }
#help-toggle[aria-pressed="true"] { background: #2f4a63; border-color: var(--focus); }
.value-rule { display: inline-flex; gap: 6px; align-items: center; }
.value-rule select { font: inherit; font-size: 13px; color: var(--text); background: var(--raise);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.help-words { margin: 0 0 10px; max-width: 70ch; }
.combat-none { margin: 6px 0 14px; max-width: 70ch; }
.combat-h { font-size: 18px; margin: 4px 0 6px; }
.combat-facts { margin: 0 0 6px; padding-left: 20px; font-size: 15.5px; }
.combat-facts li { margin: 2px 0; }
.combat-who { margin: 0 0 10px; }
.combat-working { color: var(--muted); }
.combat-options { margin: 0 0 8px; padding-left: 26px; }
.combat-option { margin: 0 0 10px; padding: 6px 0 6px 4px; border-bottom: 1px solid var(--line); }
.combat-option::marker { font-weight: 700; color: var(--muted); }
.combat-option.baseline { list-style: none; margin-left: -26px; padding-left: 0; border-bottom: 0; color: var(--muted); }
.opt-blocks { margin: 0; font-weight: 600; }
.opt-result { margin: 2px 0 0; }
.bad { margin: 4px 0 0; }
.bad-h { margin: 4px 0 2px; font-size: 13.5px; color: var(--warn); }
.bad-list { margin: 0 0 4px; padding-left: 18px; font-size: 14px; color: var(--muted); }
.bad-list li { margin: 2px 0; }
.combat-outcome { margin: 4px 0 10px; }
.combat-notes p { margin: 6px 0 0; max-width: 80ch; }
@media (max-width: 520px) { .foot { padding: 4px 12px 20px; } }

@media (max-width: 520px) {
  .bar { padding: 8px 12px; position: static; }      /* on a narrow window the header scrolls away */
  .turn { font-size: 18px; }
  .notices { padding: 0 12px; }
  .big-count { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---- your games (P19): /games ------------------------------------------------------------ */
a { color: var(--focus); }
.games-link { color: var(--muted); }
.games-bar { align-items: center; }
.games-bar .back { text-decoration: none; color: var(--text); white-space: nowrap; }
.games-main { max-width: 980px; padding: 14px 20px 32px; }
.games-h { font-size: 19px; margin: 0 0 6px; }
.games-main section { scroll-margin-top: 84px; }
.games-page .state { font-size: 17px; color: var(--muted); }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 4px 28px; }
.stat-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stat-table th, .stat-table td { text-align: left; padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line);
  vertical-align: baseline; font-size: 14.5px; }
.stat-table th { font-weight: 500; color: var(--muted); white-space: nowrap; }
/* a long sentence in a row ("too few of your games yet ...") wraps; it must not squeeze the row's name */
.stat-table td { white-space: normal; }
.stat-table td.quiet { white-space: normal; }
.stat-table .colors .pip { width: 20px; height: 20px; font-size: 11.5px; }
.stat-table .more { margin-top: 6px; }
.top-cards { margin: 4px 0 0; padding-left: 22px; }
.top-cards li { padding: 2px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 8px; }
/* (P36) games from friends, on the owner's own copy of the games page */
.friend-rows { display: grid; gap: 6px; margin: 6px 0 12px; }
.friend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); }
.friend-who { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; min-width: 0; font-size: 15px; }
.friend-who .hash { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.friend-what { grid-column: 1; min-width: 0; font-size: 13.5px; }
.friend-acts { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  justify-content: flex-end; max-width: 460px; }
.friend-acts .ask { flex: 1 1 220px; font-size: 13.5px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.on { color: var(--text); border-color: color-mix(in srgb, #6fbf8a 60%, var(--line)); }
.small.danger { border-color: color-mix(in srgb, #e0705f 70%, var(--line)); color: #f0a394; }
.friends-result { margin: 4px 0 8px; font-size: 14px; }
.friends-result.bad { color: #f0a394; }
#friends-after { margin: -4px 0 8px; max-width: 80ch; }
.invite-form label { color: var(--text); font-size: 14px; }
.invite-form input { font: inherit; font-size: 14px; color: var(--text); background: var(--raise);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; min-width: 0; flex: 0 1 280px; }
.invite-code { margin: 6px 0 10px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, #e0b25a 55%, var(--line)); }
.invite-code p { margin: 2px 0; }
.invite-code .code { font-family: ui-monospace, Consolas, monospace; font-size: 17px; letter-spacing: 0.04em;
  user-select: all; margin: 0 8px 0 4px; overflow-wrap: anywhere; }
.refused { margin-top: 8px; font-size: 13.5px; }
.refused ul { margin: 4px 0; padding-left: 20px; }
@media (max-width: 640px) {
  .friend-row { grid-template-columns: minmax(0, 1fr); }
  .friend-acts { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 4px; max-width: none; }
}
.filters select { font: inherit; font-size: 14px; color: var(--text); background: var(--raise);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; max-width: 100%; }
.filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; }
.game-rows { border-top: 1px solid var(--line); }
.game-row { display: block; padding: 8px 6px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.game-row:hover { background: var(--raise); }
.game-top, .game-sides { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.game-sides { margin-top: 3px; }
.game-sides .colors { margin-right: 6px; }
.game-sides .pip { width: 19px; height: 19px; font-size: 11px; }
.game-date { font-weight: 600; }
.game-result { font-weight: 700; }
.game-result.win { color: var(--you); } .game-result.loss { color: var(--opp); }
.game-result.unfinished { color: var(--quiet); font-weight: 500; }
.game-event { margin-left: auto; }
.review-head { margin: 4px 0 10px; }
.review-head p { margin: 4px 0; }
.review-title { font-size: 17px; font-weight: 600; }
.timeline { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--line); }
.tl-item { display: grid; grid-template-columns: minmax(150px, 13em) minmax(0, 1fr); gap: 1px 14px;
  padding: 6px 4px 6px 10px; border-bottom: 1px solid var(--line); border-left: 3px solid #3f6f9e; }
.tl-item.unlisted { border-left-color: var(--warn); }
.tl-when { color: var(--quiet); font-size: 13px; grid-row: span 2; }
.tl-where { color: var(--muted); font-size: 14px; }
.tl-item.unlisted .tl-where { color: var(--warn); }
.review-log { max-height: none; overflow: visible; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 12px 10px; }
.review .log-head { margin-top: 8px; }
.review-log .log-turn { position: static; }
.review .log-head .group-h { width: auto; margin: 0; }
@media (max-width: 520px) {
  .games-main { padding: 10px 12px 24px; }
  .tl-item { grid-template-columns: minmax(0, 1fr); }
  .tl-when { grid-row: auto; }
  .game-event { margin-left: 0; }
}

/* ---- game tracking (P41): the overview and a deck's page on /games ---------------------------
   Won is the page's green; lost is a quiet step of the same green, so the two parts of a bar
   differ in lightness and not in hue alone. Figures stay in the text colours. */
.games-page { --trk-won: var(--you); --trk-lost: #3d6657; }
.trk-loading { opacity: .55; }
.trk-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr)); gap: 10px; margin: 8px 0 10px; }
.trk-tile { min-width: 0; padding: 10px 12px 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.trk-tile-label { color: var(--muted); font-size: 13px; }
.trk-tile-value { margin: 1px 0 2px; font-size: 26px; font-weight: 600; line-height: 1.25; }
.trk-tile-sub { color: var(--muted); font-size: 13px; }
.trk-blank { color: var(--quiet); font-weight: 400; }
.trk-share { white-space: nowrap; }
.trk-tile-value .trk-blank { font-size: 21px; }
.trk-balances, #track-trophy-rule, #track-note { margin: 4px 0; }
/* a number that leads to its games: it reads as the number it is, marked like a card's name */
.trk-fig { padding: 0; background: none; border: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline dotted var(--quiet); text-underline-offset: 3px; }
.trk-fig:hover { text-decoration-color: var(--focus); }
.trk-tile-value .trk-fig { text-underline-offset: 5px; }
.trk-pick { margin: 4px 0 8px; color: var(--text); }
.trk-pick .colors .pip { width: 19px; height: 19px; font-size: 11px; }
/* the first block: the latest run, a link to its deck, and under it its latest game */
.trk-latest { margin: 2px 0 14px; padding: 2px 14px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.trk-latest .group-h { margin-top: 10px; }
.trk-latest-run { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 0; color: var(--text); text-decoration: none; }
.trk-latest-run .pip { margin-left: 0; margin-right: 2px; }
.trk-latest-event { font-size: 16px; font-weight: 600; }
.trk-latest-score { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trk-latest-gems { color: var(--muted); }
.trk-latest-open { margin-left: auto; color: var(--focus); text-decoration: underline; }
.trk-latest-game { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 30px; padding-top: 6px;
  border-top: 1px solid var(--line); font-size: 14.5px; }
.trk-latest-game .pip { width: 19px; height: 19px; font-size: 11px; margin-left: 0; margin-right: 2px; }
.trk-latest-game .trk-links { margin-left: auto; }
.trk-latest-game .trk-links a:last-child { margin-right: 0; }
/* two periods side by side; what each kind of event returned; the attacks behind a count */
#track-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 4px 28px; align-items: start; }
.trk-compare-pair > p { margin: -6px 0 10px; }
.trk-table.trk-compare thead th { vertical-align: top; text-transform: none; letter-spacing: 0; white-space: normal; }
.trk-period { display: block; color: var(--text); font-size: 14px; }
.trk-period-dates { display: block; font-size: 12px; font-weight: 400; }
.trk-compare tbody th { color: var(--muted); }
.trk-table.trk-return th, .trk-table.trk-return td { padding-right: 12px; }
.trk-wins { display: inline-flex; gap: 3px; vertical-align: middle; }
.trk-win { display: inline-flex; flex-direction: column; align-items: center; min-width: 24px; padding: 1px 3px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--raise); line-height: 1.25; }
.trk-win-runs { font-weight: 600; }
.trk-win-wins { color: var(--quiet); font-size: 11px; }
.trk-win-none .trk-win-runs { color: var(--quiet); font-weight: 400; }
.trk-moments { margin: 10px 0 0; }
.trk-moments-table td:nth-child(4) { white-space: normal; min-width: 14em; }
.trk-none { margin: 10px 0; color: var(--muted); font-size: 16px; }

.trk-scroll { margin: 2px 0 12px; }
.trk-scroll:focus-visible { outline-offset: 4px; }
.trk-table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.trk-table th, .trk-table td { padding: 6px 16px 6px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: middle;
  white-space: nowrap; }
.trk-table thead th { border-top: 0; vertical-align: bottom; color: var(--quiet); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; }
.trk-table tbody th { font-weight: 400; }
.trk-table .colors .pip { width: 20px; height: 20px; font-size: 11.5px; margin-left: 0; margin-right: 2px; }
.trk-sort { padding: 2px 0; background: none; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: inherit; cursor: pointer; }
.trk-sort::after { content: "↕"; display: inline-block; width: 1.1em; margin-left: 3px; text-align: center; opacity: .5; }
.trk-sort:hover, th[aria-sort] > .trk-sort { color: var(--text); }
th[aria-sort="ascending"] > .trk-sort::after { content: "▲"; opacity: 1; color: var(--focus); }
th[aria-sort="descending"] > .trk-sort::after { content: "▼"; opacity: 1; color: var(--focus); }
.trk-table td.trk-bar-cell { width: 32%; min-width: 120px; }
.trk-bar { display: flex; gap: 2px; width: 100%; height: 8px; }
.trk-bar > span { flex: 0 1 0; min-width: 4px; height: 100%; border-radius: 4px; }
.trk-bar-won { background: var(--trk-won); }
.trk-bar-lost { background: var(--trk-lost); }
.trk-keys { display: inline-flex; gap: 12px; letter-spacing: 0; text-transform: none; font-weight: 500; }
.trk-key { display: inline-flex; align-items: center; gap: 5px; }
.trk-key::before { content: ""; width: 12px; height: 8px; border-radius: 4px; background: var(--trk-won); }
.trk-key-lost::before { background: var(--trk-lost); }

.trk-fold { margin: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trk-fold > summary { padding: 8px 0; cursor: pointer; }
.trk-fold > summary::marker { color: var(--quiet); }
.trk-fold-title { margin-right: 8px; color: var(--quiet); font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.trk-fold[open] > summary .trk-fold-title { color: var(--focus); }

.trk-rank-flat { margin: 4px 0 10px; color: var(--muted); max-width: 80ch; }
.trk-rank { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; max-width: 760px; margin: 6px 0 10px; }
.trk-rank-y { position: relative; width: 8.5em; color: var(--quiet); font-size: 12px; line-height: 1.2; }
.trk-rank-y > span { position: absolute; right: 0; max-width: 100%; text-align: right; transform: translateY(-50%); }
.trk-rank-plot { position: relative; height: 112px; margin-right: 8px; touch-action: pan-y; }
.trk-rank-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trk-rank-grid { fill: none; stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trk-rank-line { fill: none; stroke: var(--focus); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke; }
.trk-rank-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--focus);
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.trk-rank-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); pointer-events: none; }
.trk-rank-x { grid-column: 2; display: flex; justify-content: space-between; margin-right: 8px; color: var(--quiet); font-size: 12px; }
.trk-rank-read { grid-column: 1 / -1; min-height: 1.4em; margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.trk-rank-changes { grid-column: 1 / -1; margin: 4px 0 0; }

.trk-decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; margin: 6px 0 4px; }
.trk-card { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 12px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; }
.trk-card:hover { background: var(--raise); border-color: var(--focus); }
.trk-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.trk-card-top .pip { margin-left: 0; margin-right: 2px; }
.trk-card-event { font-size: 15px; font-weight: 600; }
.trk-card-nums { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.trk-card-nums .trk-share { font-size: 21px; font-weight: 600; }
.trk-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 0; }
.trk-chip { padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--raise); color: var(--muted);
  font-size: 12px; line-height: 1.55; }
.trk-pic { display: block; width: 32px; height: auto; aspect-ratio: 5 / 7; border-radius: 3px; object-fit: cover; }
.trk-card-last { margin-top: auto; }
.tag.trk-trophy { color: #ffd9a8; border-color: #8a6230; background: #2c2216; font-weight: 600; white-space: nowrap; }
.trk-trophy::before { content: "★ "; }

.trk-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 4px 0; font-size: 17px; font-weight: 600; }
.trk-title .pip { margin-left: 0; margin-right: 2px; }
.trk-deck .trk-fold > summary { color: var(--muted); font-size: 14px; }
.trk-import { max-height: 280px; margin: 0 0 10px; padding: 8px 12px; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; font: 13px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.trk-n { display: inline-block; min-width: 1.2em; margin-right: 3px; color: var(--muted); font-variant-numeric: tabular-nums; }
#deck-h:focus { outline: none; }
.trk-cardline .card-name, .trk-cardline .logref { font-size: 14.5px; }
.trk-version { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 14px; align-items: center; padding: 8px 0 8px 10px;
  border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.trk-version.chosen { border-left-color: var(--focus); }
.trk-version-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.trk-version-head .pip { width: 19px; height: 19px; font-size: 11px; margin-left: 0; margin-right: 2px; }
.trk-version-nums, .trk-version-changes { grid-column: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.trk-version-changes { display: flex; flex-wrap: wrap; gap: 4px 18px; line-height: 1.9; }
.trk-version > button { grid-column: 2; grid-row: 1 / span 3; white-space: nowrap; }
.trk-version > button[aria-pressed="true"] { background: #2f4a63; border-color: var(--focus); }
.trk-change-word { margin-right: 6px; color: var(--quiet); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.trk-change .trk-cardline { margin-right: 10px; white-space: nowrap; }
.trk-pools { display: grid; gap: 4px 0; margin: 0 0 6px; }
.trk-pool-title { margin: 10px 0 2px; font-size: 15px; font-weight: 600; }
.trk-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 2px 26px; align-items: start; }
.trk-pool-h { display: flex; align-items: center; gap: 6px; margin: 8px 0 3px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.trk-pool-h .pip { width: 19px; height: 19px; font-size: 11px; margin-left: 0; }
.trk-pool-row { display: grid; grid-template-columns: 19px minmax(0, 1fr); gap: 0 10px; padding: 3px 0; border-top: 1px solid var(--line); }
.trk-mv.pip { width: 19px; height: 19px; margin: 3px 0 0; font-size: 11px; }
.trk-pool-cards .trk-cardline { display: block; padding: 1px 0; line-height: 1.7; }
.trk-session th { padding-top: 12px; border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.trk-history tbody + tbody .trk-session th { border-top: 1px solid var(--line); }
.trk-opponent .colors { margin-right: 8px; }
.trk-opponent .pip { width: 19px; height: 19px; font-size: 11px; margin-left: 0; margin-right: 2px; }
.trk-links a { margin-right: 14px; }
@media (max-width: 640px) {
  /* a narrow screen: each game of the play history is a small block, its links in reach */
  .trk-history, .trk-history tbody { display: block; }
  .trk-history thead { display: none; }
  .trk-history tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 7px 0; border-top: 1px solid var(--line); }
  .trk-history th, .trk-history td { display: block; padding: 0; border: 0; white-space: normal; }
  .trk-history tbody tr:not(.trk-session) th { flex: 1 0 100%; font-weight: 600; }
  .trk-history tr.trk-session { padding: 12px 0 4px; }
  .trk-history tbody:first-of-type tr.trk-session { border-top: 0; }
  .trk-history td[data-label]::after { content: " " attr(data-label); color: var(--quiet); font-size: 12.5px; }
  .trk-history .trk-links { flex: 1 0 100%; }
  .trk-version { grid-template-columns: minmax(0, 1fr); }
  .trk-version > button { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 2px; }
  .trk-rank-y { width: 6.2em; }
}
@media (forced-colors: active) {
  .trk-bar-won { background: Highlight; }
  .trk-bar-lost { background: GrayText; }
  .trk-rank-line { stroke: Highlight; }
}
/* (P47) while the earlier games of Arena's log are still being read in the background */
.earlier-note { margin: 0 0 10px; padding: 6px 10px; border-left: 3px solid var(--focus); background: var(--panel); }
/* (P45) "Mark this moment", in the top bar during a game */
.mark-button { white-space: nowrap; }
.mark-button:disabled { opacity: 1; color: var(--you); border-color: var(--you); cursor: default; }
/* ---- (P46) the mana check, and (P45 set 2) the set recap, on "Your games" ----------------------------- */
.mana-text { width: 100%; margin: 4px 0 8px; padding: 8px 10px; font: 13px/1.4 Consolas, "Cascadia Mono", monospace; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
.mana-title { margin: 8px 0 4px; font-weight: 600; }
.mana-list { margin: 4px 0 10px; padding-left: 20px; }
.mana-list li { margin: 0 0 3px; }
.mana-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 4px; }
.mana-scroll { overflow-x: auto; margin: 0 0 12px; }
.mana-table { width: auto; min-width: 100%; }
.mana-table caption { caption-side: top; text-align: left; padding: 6px 0 2px; font-weight: 700; font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; }
.mana-table th, .mana-table td { padding-right: 12px; white-space: nowrap; }
.mana-table tbody th { white-space: normal; min-width: 150px; }
.mana-spell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mana-spell .cost .pip { width: 18px; height: 18px; font-size: 11px; }
.mana-hands { margin: 4px 0 6px; padding-left: 22px; }
.mana-hands li { margin: 0 0 4px; }
.mana-land { color: var(--you); }
.recap-line { margin: 4px 0; }
.recap-label { display: inline-block; min-width: 7.5em; color: var(--quiet); font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; }
.recap-cast { margin: 4px 0 10px; padding-left: 24px; }
