/* Player workspace: sidebar, rail, drawers and the mobile sheet. Uses the Fight Club tokens
   (arena.css) plus the few extra ones the status colours need. No inline styles anywhere. */
.arena-player {
  --side: 320px; --rail: 60px;
  --rule-strong: #433f4a; --faint: #8f899a; --sunk: #0d0c10; --accent: var(--blue);
  --ok: #4fd18b; --ok-wash: #0f2e20; --signal-wash: #06303a; --on-signal: #00161b;
  --warn: #ffb547; --warn-wash: #3a2a0e; --bad: #ff6b81; --dot: rgb(209 132 255 / 10%);
}
:root[data-theme=light] .arena-player {
  --rule-strong: #c7bfcf; --faint: #6f6779; --sunk: #ebe7ef;
  --ok: #137a45; --ok-wash: #e2f5ea; --signal-wash: #dff4f8; --on-signal: #fff;
  --warn: #8a5a00; --warn-wash: #fbf0dc; --bad: #b4233c; --dot: rgb(120 2 158 / 10%);
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#workspace .label { font: 600 .7rem/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.icon-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: var(--base-raised); color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 700 .68rem/1 var(--mono); letter-spacing: .1em; padding: 5px 8px; border-radius: 4px; background: var(--signal-wash); color: var(--signal); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.pill:is([data-state=frozen], [data-state=closed]) { background: var(--base-raised); color: var(--muted); }
.pill:is([data-state=frozen], [data-state=closed])::before { box-shadow: none; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--signal); color: var(--on-signal); font: 700 .66rem/1 var(--mono); }
.tag { display: inline-block; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: var(--base-raised); color: var(--ink); font: 600 .66rem/1 var(--mono); letter-spacing: .06em; white-space: nowrap; }
.tag[data-tone=ok] { color: var(--ok); background: var(--ok-wash); border-color: transparent; }
.tag[data-tone=sig] { color: var(--signal); background: var(--signal-wash); border-color: transparent; }
.tip { position: relative; }
.tip::after {
  content: attr(data-tip); position: absolute; inset-inline-end: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: 5px 8px; border-radius: 5px; background: var(--ink); color: var(--paper); font: 600 .74rem var(--sans);
  white-space: nowrap; opacity: 0; pointer-events: none; z-index: 5;
}
.tip:is(:hover, :focus-visible)::after { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .tip::after { transition: opacity .12s; } }

/* ---- Sidebar ---- */
#workspace .side { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-inline-end: 1px solid var(--rule); }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 22px 18px; }
.side-brand .company-wordmark { width: auto; height: 17px; }
.side-brand .brand-divider { height: 18px; border-inline-start: 1px solid var(--rule-strong); }
.side-brand .product-lockup { height: 19px; width: auto; }
.side-event { padding: 6px 22px 18px; }
.side-event h2 { font: 620 1.9rem/1.02 Space, var(--sans); letter-spacing: -.055em; overflow-wrap: anywhere; text-wrap: balance; }
.side-event .sub { margin-top: 6px; color: var(--muted); font-size: .86rem; }
.side-event .live { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.edition-pick { display: grid; gap: 6px; margin: 0 22px 4px; }
.edition-pick select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sunk); color: var(--ink); font-size: .92rem; width: 100%; }
.stats { display: grid; grid-template-columns: 1fr 1fr; margin: 18px 22px 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.stat { padding: 12px 14px; min-width: 0; }
.stat + .stat { border-inline-start: 1px solid var(--rule); }
.stat b { display: block; margin-top: 6px; font: 620 1.55rem/1.1 Space, var(--sans); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat b[data-unranked] { color: var(--muted); }
.stat b small { font: 500 .9rem var(--sans); letter-spacing: 0; color: var(--muted); }
.stat .pend { margin-top: 2px; color: var(--signal); font: 500 .72rem var(--mono); }
.progress { padding: 18px 22px; border-bottom: 1px solid var(--rule); }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-height: 1.6em; }
.progress-head .pct { font: 600 1.35rem Space, var(--sans); letter-spacing: -.04em; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 5px; margin-top: 10px; }
.cell { aspect-ratio: 1; border-radius: 3px; background: var(--base-raised); border: 1px solid var(--rule); }
.cell[data-status=solved] { background: var(--solid); border-color: var(--solid); }
.cell[data-status=pending] { background: repeating-linear-gradient(135deg, var(--signal-wash) 0 4px, transparent 4px 8px); border-color: var(--signal); }
.cell.current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.bout-group, .practice-group { padding: 16px 12px 4px; }
.practice-group { padding-block-end: 16px; }
.group-label { display: flex; justify-content: space-between; margin: 0; padding: 0 10px 8px; }
.empty-list { padding: 18px 22px; color: var(--muted); font-size: .88rem; }
a.bout {
  position: relative; display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 10px; align-items: start;
  padding: 11px 10px; border-radius: 7px; color: var(--ink); text-decoration: none;
}
a.bout:hover { background: var(--base-raised); }
a.bout[aria-current=page] { background: var(--wash); }
a.bout[aria-current=page]::before { content: ''; position: absolute; inset-inline-start: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
a.bout[aria-disabled=true] { opacity: .6; }
a.bout .st { display: grid; place-items: center; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--rule-strong); border-radius: 50%; }
a.bout[data-status=solved] .st { background: var(--solid); border-color: var(--solid); color: #fff; }
a.bout[data-status=pending] .st { border-color: var(--signal); color: var(--signal); }
a.bout .st svg { width: 11px; height: 11px; stroke-width: 3; }
a.bout.practice .st { border-style: dashed; color: var(--muted); }
a.bout.practice .st svg { width: 10px; height: 10px; stroke-width: 2.4; }
.bout-main { display: block; min-width: 0; }
.bout-title { display: block; font-weight: 560; font-size: .93rem; line-height: 1.3; overflow-wrap: anywhere; }
.bout-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 5px; color: var(--muted); font-size: .78rem; }
.bout-turns { margin-top: 3px; color: var(--faint); font: 500 .7rem var(--mono); white-space: nowrap; }
a.bout[aria-current=page] .tag { background: var(--surface); }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.side-foot .who { flex: 1; min-width: 0; max-width: none; }
.side-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .84rem var(--mono); }
.side-foot .who small { color: var(--muted); font-size: .74rem; }
.side-foot .tip::after { inset-inline-end: auto; inset-inline-start: 50%; top: auto; bottom: calc(100% + 8px); transform: translateX(-50%); }

/* ---- Main column ---- */
#workspace .thread {
  grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; margin: 0; max-width: none;
  background-color: var(--paper); background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 22px 22px;
}
#workspace .topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 0; padding: 16px var(--gut); background: none; border: 0; }
.opp { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 14px 7px 7px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); }
.opp img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.opp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.opp-text b { font-weight: 600; }
.opp-text em { font-style: normal; color: var(--muted); }
#opponent-role:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.top-actions:has(.state[data-status=solved]) #arena-award-receipt { display: none; }
@media (max-width: 900px) {
  #claims-button .txt { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
#workspace .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .84rem; white-space: nowrap; }
#workspace .btn:hover:not(:disabled) { border-color: var(--rule-strong); }
.state { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--muted); font: 700 .68rem/1 var(--mono); letter-spacing: .08em; white-space: nowrap; }
.state[data-status=solved] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-wash); }
.state[data-status=pending] { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 40%, transparent); background: var(--signal-wash); }
#arena-award-receipt { min-height: 40px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); border-radius: 7px; background: var(--ok-wash); color: var(--ok); font: 650 .8rem var(--sans); }
.banner, .strip { flex: none; align-self: center; width: min(51.25rem, calc(100% - 2 * var(--gut))); display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); font-size: .88rem; }
.banner svg { margin-top: 1px; color: var(--muted); }
.strip { align-items: center; margin-bottom: 12px; border-color: var(--rule); }
.strip > svg { color: var(--muted); }
.strip .txt { min-width: 0; flex: 1; }
.strip .txt b { display: block; font: 600 .95rem Space, var(--sans); letter-spacing: -.02em; overflow-wrap: anywhere; }
.strip .txt span { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The brief card an empty bout opens on */
#workspace #objective-card { position: relative; width: min(100%, 700px); max-width: 700px; margin: auto; padding: 0; overflow: hidden; text-align: start; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
#workspace #objective-card::before { content: ''; position: absolute; inset: 0 0 auto; width: auto; height: 3px; margin: 0; border: 0; border-radius: 0; background: linear-gradient(90deg, var(--solid), var(--accent) 60%, transparent); }
#workspace #objective-card > :not(.facts) { margin-inline: clamp(20px, 4vw, 40px); max-width: none; }
#workspace #objective-card .obj-label { margin-block-start: 30px; font: 600 .7rem/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
#workspace #objective-card h2 { margin-block-start: 12px; font: 620 clamp(1.8rem, 3.2vw, 2.5rem)/1.05 Space, var(--sans); letter-spacing: -.055em; }
#objective-card .obj { margin-block-start: 20px; }
#objective-card .obj-term { font: 600 .7rem/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
#workspace #objective-card .obj p { max-width: 58ch; margin: 6px 0 0; color: var(--ink); font-size: 1.05rem; line-height: 1.55; }
#objective-card #rubric-toggle { margin-block-start: 22px; }
#workspace #objective-card .rubric { max-width: none; margin-block: 16px 0; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sunk); color: var(--ink); font-size: .9rem; white-space: pre-line; }
#workspace #objective-card .goal { max-width: none; margin-block: 14px 18px; color: var(--muted); font-size: .85rem; }
#objective-card .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); margin: 26px 0 0; border-top: 1px solid var(--rule); }
#objective-card .facts div { padding: 13px clamp(14px, 2vw, 20px); min-width: 0; }
#objective-card .facts div + div { border-inline-start: 1px solid var(--rule); }
#objective-card dt { font: 600 .64rem var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
#objective-card dd { margin: 4px 0 0; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }

/* Claim and verdict cards inside the transcript */
.event-card { align-self: stretch; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--signal) 45%, transparent); border-radius: 8px; background: var(--signal-wash); }
.event-card > svg { margin-top: 2px; color: var(--signal); }
.event-card b { display: block; font-weight: 650; }
.event-card p { margin-top: 3px; color: var(--ink); font-size: .88rem; opacity: .85; }
.event-card[data-claim-card=rejected] { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--warn-wash); }
.event-card[data-claim-card=rejected] > svg { color: var(--bad); }
.event-card:is(.ok, [data-claim-card=settled]) { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-wash); }
.event-card:is(.ok, [data-claim-card=settled]) > svg { color: var(--ok); }
.event-card .btn { margin-top: 10px; min-height: 34px; padding: 6px 12px; }
.event-card .btn:disabled { opacity: .6; }

/* ---- Rail and drawers ---- */
#workspace .rail { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; background: var(--surface); border-inline-start: 1px solid var(--rule); }
.rail .icon-btn { width: 42px; height: 42px; }
.rail .icon-btn[data-active] { background: var(--wash); color: var(--ink); }
.rail .badge, .mhead .badge { position: absolute; top: 3px; inset-inline-end: 2px; transform: scale(.85); }
dialog.drawer, body[data-surface=workspace] #round-dialog {
  position: fixed; inset: 0 var(--rail) 0 auto; margin: 0; width: min(420px, 100vw); max-width: none; height: 100dvh; max-height: none;
  padding: 0; overflow: hidden; border: 0; border-inline-start: 1px solid var(--rule); border-radius: 0; background: var(--surface); color: var(--ink);
}
dialog.drawer[open], body[data-surface=workspace] #round-dialog[open] { display: flex; flex-direction: column; }
dialog.drawer::backdrop, body[data-surface=workspace] #round-dialog::backdrop { background: rgb(5 3 8 / 55%); }
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open], body[data-surface=workspace] #round-dialog[open] { animation: drawer-in .2s ease; }
  @keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--rule); }
dialog.drawer h2 { font: 620 1.3rem Space, var(--sans); letter-spacing: -.04em; }
.d-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 24px; }
.d-body p { margin-top: 0; }
.d-intro { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.d-intro:empty { display: none; }
.d-para { margin-block-end: 14px; font-size: .92rem; line-height: 1.55; }
.d-note { margin-block: 16px; padding: 12px 14px; border-radius: 8px; background: var(--sunk); color: var(--muted); font-size: .84rem; }
.d-note[hidden] { display: none; }
#claims-list { margin-top: 8px; }
.claim { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.claim .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.claim .claim-title { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.claim .claim-title:hover { text-decoration: underline; }
.claim p { margin-top: 4px; color: var(--muted); font-size: .84rem; }
.claim time { display: block; margin-top: 2px; color: var(--faint); font: 500 .72rem var(--mono); }
.claim[data-status=confirmed] .tag { color: var(--ok); background: var(--ok-wash); border-color: transparent; }
.claim[data-status=pending] .tag { color: var(--signal); background: var(--signal-wash); border-color: transparent; }
#standings-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
#standings-table th { padding: 8px 6px; border-bottom: 1px solid var(--rule); color: var(--muted); font: 600 .64rem var(--mono); letter-spacing: .09em; text-transform: uppercase; text-align: start; }
#standings-table td { padding: 10px 6px; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
#standings-table td:first-child { width: 40px; color: var(--muted); font: 600 .8rem var(--mono); }
#standings-table :is(th, td):last-child { text-align: end; }
#standings-table tr[data-you] td { background: var(--wash); }
#standings-table tr[data-you] td:nth-child(2) { color: var(--accent); font-weight: 700; }
#standings-table .gap td { padding: 4px; color: var(--faint); text-align: center; }
#standings-full { text-decoration: none; }
.rules { margin: 0; padding: 0; list-style: none; counter-reset: rule; }
.rules li { position: relative; padding: 11px 0 11px 26px; border-bottom: 1px solid var(--rule); font-size: .9rem; counter-increment: rule; }
.rules li::before { content: counter(rule); position: absolute; inset-inline-start: 0; top: 11px; color: var(--accent); font: 600 .74rem var(--mono); }
body[data-surface=workspace] #round-dialog .sheet-cover { display: none; }
body[data-surface=workspace] #round-dialog .sheet-copy { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
body[data-surface=workspace] #round-dialog .sheet-copy h2 { font-size: 1.6rem; letter-spacing: -.05em; }
.rail-spec > div:has(dd:empty) { display: none; }

/* ---- Mobile (up to 760px): top header, sidebar sheet, full-width drawers, no rail ---- */
.mhead { display: none; }
.sheet-close, .side-links { display: none; }
.hold-link { min-height: 44px; padding: 0; border: 0; background: none; color: var(--signal); font: inherit; font-size: .88rem; text-decoration: underline; cursor: pointer; }
.side-link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 22px; border: 0; background: none; color: var(--muted); font: 600 .86rem var(--sans); text-align: start; }
.side-link:hover { color: var(--ink); background: var(--base-raised); }
#scrim { position: fixed; inset: 0; z-index: 20; background: rgb(5 3 8 / 55%); }
@media (max-width: 860px) { .arena-player { --side: 290px; } }
@media (max-width: 760px) {
  #workspace { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) !important; }
  .mhead { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 6px; padding: 8px 12px 8px 8px; background: var(--surface); border-bottom: 1px solid var(--rule); }
  .mhead .ttl { flex: 1; min-width: 0; }
  .mhead .ttl b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 620 1.02rem Space, var(--sans); letter-spacing: -.03em; }
  .mhead .ttl small { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 500 .7rem var(--mono); }
  .mhead .pill { padding: 3px 6px; font-size: .6rem; }
  .mhead .icon-btn { width: 44px; height: 44px; }
  #workspace .thread { grid-column: 1; grid-row: 2; }
  #workspace .rail { display: none; }
  #workspace .side {
    position: fixed; inset: 0 auto 0 0; z-index: 22; width: min(340px, 88vw); grid-column: auto; grid-row: auto;
    transform: translateX(-100%); visibility: hidden;
  }
  #workspace .side[data-open] { transform: none; visibility: visible; box-shadow: 0 0 40px rgb(0 0 0 / 50%); }
  .side-foot .icon-btn { width: 44px; height: 44px; }
  .sheet-close { display: grid; position: absolute; top: 8px; inset-inline-end: 8px; z-index: 1; width: 44px; height: 44px; }
  .side-links { display: block; padding: 6px 0; border-top: 1px solid var(--rule); }
  @media (prefers-reduced-motion: no-preference) {
    #workspace .side { transition: transform .2s, visibility 0s .2s; }
    #workspace .side[data-open] { transition: transform .2s; }
  }
  dialog.drawer, body[data-surface=workspace] #round-dialog { inset: 0 0 0 auto; width: 100vw; }
  #workspace .topbar { padding: 12px var(--gut); }
  #workspace #claims-button { display: none; }
  .opp-text em { display: none; }
  #workspace #objective-card h2 { font-size: 1.7rem; }
  #objective-card .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #objective-card .facts div:nth-child(odd) { border-inline-start: 0; }
  #objective-card .facts div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  #workspace .box-bar .tool span { display: none; }
}
.box-bar .tool { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 .78rem var(--sans); }
.box-bar .tool:hover:not(:disabled) { background: var(--base-raised); color: var(--ink); }
@media (max-width: 760px) { .box-bar .tool { min-width: 44px; min-height: 44px; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
