/* The public Research Arena pages — the directory (/arenas), an arena
   (/arenas/<slug>), a submission (/arenas/<slug>/submission/<id>) and the
   submission form (/arenas/<slug>/submit). Templates arenas.html, arena.html,
   arena_submission.html and arena_submit.html; behaviour in
   static/js/arena-public.js (docs/arenas.md).

   Builds on public.css (chrome, cards, badges, tabs, forms); the chart and
   leaderboard are styled by arena-chart.css, comments by comments.css.
   Tokens only (var(--…)): the page follows the arena owner's theme. Numbers
   in columns use tabular figures so they line up; a standalone headline
   number keeps the font's proportional ones. */

/* The scripts show and hide parts of these pages with the `hidden`
   attribute; a `display` set on a component (a drop zone, a fact list) would
   otherwise beat the browser's own [hidden] rule. */
.pub-body [hidden] { display: none !important; }

.ap-icon {
    width: 16px; height: 16px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}
.ap-icon-sm { width: 14px; height: 14px; }
.ap-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-unit { color: var(--text-3); font-size: 0.86em; margin-left: 0.2em; }
.ap-dir { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.ap-symbol .katex { font-size: 1.05em; }
/* A two-sided parameter's interval: the slot (_arena_macros.html) that
   arena-public.js fills with ArenaChart.renderBounds, whose own parts
   arena-chart.css styles. Here only its size and place. */
.ap-bounds { display: inline-flex; max-width: 100%; min-width: 0; }
/* ≥ / ≤ before a bound: lighter than the number, but it says which bound. */
.ap-claim-rel { color: var(--text-3); font-weight: 500; }

/* ── Status badges ──
   One rule set for every status a template prints (data-status), so the
   colours can't drift between the list, the submission page and the form —
   and the same colour per status as everywhere else (ArenaChart.STATUS_TONE:
   pending neutral, accepted accent, verified success, disputed warning,
   rejected danger, withdrawn muted). Each carries its label; the dot is
   decoration, never the only signal. */
.ap-status::before, .ap-arena-status::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; opacity: 0.85;
}
.ap-status[data-status="pending"] { background: var(--surface-4); color: var(--text-3); }
.ap-status[data-status="accepted"] { background: var(--accent-bg); color: var(--accent-deep); }
.ap-status[data-status="verified"] { background: var(--success-bg); color: var(--success-deep); }
.ap-status[data-status="disputed"] { background: var(--warning-bg); color: var(--warning-deep); }
.ap-status[data-status="rejected"] { background: var(--danger-bg); color: var(--danger-strong); }
.ap-status[data-status="withdrawn"] { background: var(--surface-3); color: var(--text-3); }
.ap-arena-status[data-status="open"] { background: var(--success-bg); color: var(--success-deep); }
.ap-arena-status[data-status="closed"] { background: var(--surface-4); color: var(--text-3); }
.ap-arena-status[data-status="draft"] { background: var(--warning-bg); color: var(--warning-deep); }
.ap-record-badge { background: var(--tag-amber-bg); color: var(--tag-amber-fg); }
.ap-record-badge .ap-icon, .ap-cross-badge .ap-icon { width: 12px; height: 12px; }
/* A claimed bound past the other side's best one (ArenaChart's warn tone). */
.ap-cross-badge { background: var(--warning-bg); color: var(--warning-deep); }
/* Which bounds of a two-sided primary parameter a report moves. */
.ap-side-badge { background: var(--tag-slate-bg); color: var(--tag-slate-fg); }

/* ── Directory (/arenas) ──
   Its header band, with Create an arena beside the text, is public.css's
   .pub-hero-index, shared with /blogs and /commons. */
.ap-steps {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem;
    margin: 0 0 2.4rem; padding: 0; list-style: none;
}
.ap-step {
    display: flex; gap: 0.85rem; align-items: flex-start;
    padding: 1rem 1.1rem; border-radius: var(--radius-xl);
    background: var(--surface-1); border: 1px solid var(--border-2);
}
.ap-step-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-bg); color: var(--accent);
}
.ap-step-title { margin: 0 0 0.15rem; font-size: 0.92rem; font-weight: 650; color: var(--text-strong); }
.ap-step-text { margin: 0; font-size: 0.84rem; color: var(--text-3); line-height: 1.5; }

.ap-arena-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.1rem; }
.ap-arena-card { display: flex; flex-direction: column; gap: 0.2rem; padding: 1.25rem 1.35rem 1.1rem; }
.ap-arena-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.45rem; }
.ap-arena-card .pub-card-desc { margin: 0; }
.ap-arena-card-record {
    margin-top: 0.9rem; padding: 0.75rem 0.9rem;
    border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--border-2);
}
.ap-arena-card-record-label {
    display: flex; justify-content: space-between; gap: 0.6rem;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.ap-arena-card-record-label .ap-dir { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ap-arena-card-record-value {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem;
    margin-top: 0.25rem; font-size: 1.3rem; font-weight: 650; color: var(--text-strong); line-height: 1.3;
}
.ap-arena-card-record-value .ap-num { font-variant-numeric: normal; }
.ap-arena-card-record-approx { font-size: 0.8rem; font-weight: 400; color: var(--text-3); }
.ap-arena-card-record-name { font-size: 0.8rem; color: var(--text-3); margin-top: 0.1rem; }
.ap-arena-card-record-none { font-size: 0.88rem; color: var(--text-3); margin-top: 0.2rem; }
/* An interval is about three numbers wide: a step smaller than one record. */
.ap-arena-card-record-value.ap-arena-card-bounds { font-size: 1.12rem; }
.ap-arena-card .pub-card-foot { margin-top: auto; padding-top: 0.9rem; }
.ap-foot-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.ap-host-cta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.4rem;
    margin-top: 2.6rem; padding: 1.4rem 1.6rem; border-radius: var(--radius-xl);
    background: var(--accent-bg); border: 1px solid var(--accent-faint);
}
.ap-host-cta-mark { display: inline-flex; flex-shrink: 0; color: var(--accent-deep); --logo-accent: var(--accent); }
.ap-host-cta-text { flex: 1 1 22rem; min-width: 0; }
.ap-host-cta h2 { margin: 0 0 0.2rem; font-family: var(--font-display); font-size: 1.1rem; color: var(--text-strong); }
.ap-host-cta p { margin: 0; color: var(--text-2); font-size: 0.92rem; max-width: 60ch; }

/* ── Arena hero: the problem on the left, where it stands on the right, both
   kept short so the tabs start high on the first screen. ── */
.ap-hero { padding: 1.6rem 1.25rem 1.6rem; }
.ap-hero-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
    gap: 1.4rem 2.4rem; align-items: center;
}
.ap-hero-inner.no-record { grid-template-columns: minmax(0, 1fr); }
.ap-hero .pub-hero-title { font-size: clamp(1.6rem, 3.2vw, 2.15rem); margin-bottom: 0.35rem; }
.ap-hero .pub-hero-lede { font-size: 1rem; line-height: 1.5; }
.ap-hero .pub-kicker { margin-bottom: 0.45rem; }
.ap-hero .pub-kicker a { color: var(--sb-accent); text-decoration: none; }
.ap-hero .pub-kicker a:hover { text-decoration: underline; }
.ap-hero-meta { margin-top: 0.7rem; }
.ap-hero-meta .ap-arena-status { font-size: 0.74rem; }
.ap-hero-meta strong { color: var(--sb-text-strong); font-weight: 600; }
.ap-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.8rem; margin-top: 1rem; }
.ap-hero-note { font-size: 0.84rem; color: var(--sb-text-faint); }
.ap-btn-icon .ap-icon { width: 15px; height: 15px; }

/* The standing card: a head line (what is shown, of which parameter), the
   figure, who set it, and the meter. */
.ap-standing {
    padding: 0.85rem 1.15rem 0.9rem; border-radius: var(--radius-2xl);
    background: var(--surface-1); color: var(--text-1); box-shadow: 0 10px 30px var(--shadow-3);
}
.ap-standing-head {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; margin: 0;
}
.ap-standing-kicker {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tag-amber-fg);
}
.ap-standing-none { margin: 0.45rem 0 0.1rem; font-size: 0.95rem; color: var(--text-3); }
.ap-standing-param { font-size: 0.8rem; color: var(--text-3); }
.ap-standing-param .ap-dir { color: var(--text-3); margin-left: 0.35rem; }
/* The one headline number on the page: large, in the UI face, proportional
   figures. An exact form (LaTeX) is shown instead when the record has one. */
.ap-record-figure {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem;
    margin: 0.25rem 0 0; color: var(--text-strong);
    font-family: var(--font-ui); font-size: 2.2rem; font-weight: 650; line-height: 1.12; letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}
.ap-record-figure .katex { font-size: 0.78em; letter-spacing: 0; }
.ap-record-figure .ap-record-eq { font-weight: 400; color: var(--text-5); font-size: 0.7em; }
.ap-record-figure .ap-unit { font-size: 0.42em; font-weight: 500; letter-spacing: 0; }
.ap-record-approx { margin: 0; font-size: 0.82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* Two-sided: the interval in place of the one number. */
.ap-record-figure.ap-bounds-figure { font-size: 1.65rem; letter-spacing: -0.01em; }
.ap-record-figure.ap-bounds-figure .katex { font-size: 0.95em; }
.ap-record-holders { display: flex; flex-direction: column; gap: 0.1rem; margin-top: 0.3rem; }
.ap-record-holder { margin: 0; font-size: 0.85rem; color: var(--text-2); }
.ap-holder-side { color: var(--text-3); }
.ap-cross-note {
    display: flex; gap: 0.45rem; align-items: flex-start;
    margin: 0.2rem 0 0; padding: 0.45rem 0.6rem; border-radius: var(--radius-md);
    background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-deep);
    font-size: 0.8rem; line-height: 1.4;
}
.ap-cross-note .ap-icon { margin-top: 0.15rem; }
/* The strip sits in the navy hero, whose links are white. */
.pub-hero .ap-standing a { color: var(--link); font-weight: 600; text-decoration: none; }
.pub-hero .ap-standing a:hover { color: var(--accent-hover); text-decoration: underline; }
.ap-gain { color: var(--success-deep); font-weight: 600; }
.ap-loss { color: var(--danger-strong); font-weight: 600; }
.ap-even { color: var(--text-3); }
/* How far: the record from the baseline to the target, or how much of the
   gap between the known bounds has closed. The track is a lighter step of
   the fill's own ramp, so the bar reads whole. */
.ap-meter { margin-top: 0.55rem; }
.ap-meter-track { height: 6px; border-radius: var(--radius-pill); background: var(--accent-bg); overflow: hidden; }
.ap-meter-fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent); }
/* A sliver of progress still shows as a dot. */
.ap-meter.is-started .ap-meter-fill { min-width: 6px; }
.ap-meter.is-reached .ap-meter-track { background: var(--success-bg); }
.ap-meter.is-reached .ap-meter-fill { background: var(--success); }
.ap-meter-caption { margin: 0.3rem 0 0; font-size: 0.76rem; color: var(--text-3); }

/* ── Arena page body ── */
.ap-arena-wrap { padding-top: 0; }
.ap-arena-wrap > .pub-notice:first-child { margin-top: 1.6rem; }
.ap-tabs { margin-top: 0; position: relative; }
/* Tabs cut off (a phone): fade them out at that edge, so the strip reads as
   one that scrolls. arena-public.js sets .has-more while it can still scroll
   right, .has-before while it can scroll back. A mask uses only the
   gradient's alpha, so its colours are no colours on the page. */
.ap-tabs.has-more {
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to right, black calc(100% - 3rem), transparent);
}
.ap-tabs.has-before {
    -webkit-mask-image: linear-gradient(to left, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to left, black calc(100% - 3rem), transparent);
}
.ap-tabs.has-before.has-more {
    -webkit-mask-image: linear-gradient(to right, transparent, black 3rem, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to right, transparent, black 3rem, black calc(100% - 3rem), transparent);
}
.ap-panel:focus-visible { outline: none; }
.ap-panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.6rem; align-items: start; }
.ap-stack { display: flex; flex-direction: column; gap: 1.4rem; min-width: 0; }
.ap-card-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem;
    margin: 0 0 1rem;
}
.ap-card-title { margin: 0; font-family: var(--font-display); font-size: 1.05rem; font-weight: 650; color: var(--text-strong); }
.ap-card-sub { margin: 0.15rem 0 0; font-size: 0.84rem; color: var(--text-3); }
.ap-reading { padding: 1.6rem 1.8rem; }
.ap-reading-empty { color: var(--text-3); font-style: italic; margin: 0; }

/* Parameters table. Below 640px each row becomes a small card; the labels
   come from data-label so the cells still say what they are. */
.ap-table-wrap { overflow-x: auto; margin: 0 -0.2rem; }
.ap-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ap-table th {
    text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3); padding: 0 0.7rem 0.55rem; border-bottom: 1px solid var(--border-2); white-space: nowrap;
}
.ap-table td { padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--border-1); vertical-align: top; color: var(--text-2); }
.ap-table tr:last-child td { border-bottom: none; }
.ap-table .ap-num-col { text-align: right; }
.ap-params-table th:first-child { width: 42%; }
.ap-param-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; font-weight: 600; color: var(--text-strong); }
.ap-param-desc { margin-top: 0.25rem; font-size: 0.84rem; color: var(--text-3); font-family: var(--font-ui); line-height: 1.5; }
.ap-param-desc.shared-content { font-size: 0.84rem; line-height: 1.5; font-family: var(--font-ui); }
.ap-param-desc.shared-content p { margin: 0 0 0.3em; }
.ap-cell-label { display: block; font-size: 0.76rem; color: var(--text-3); white-space: normal; }
.ap-record-cell a { font-weight: 600; text-decoration: none; }
.ap-record-cell a:hover { text-decoration: underline; }
/* A two-sided parameter's cell: a line per bound ("≥ 0", "≤ 0.2"), each
   with its source or holder under it. */
.ap-bound-line { display: block; white-space: nowrap; }
.ap-bound-line ~ .ap-bound-line { margin-top: 0.4rem; }

/* At-a-glance aside */
.ap-aside-title { margin-bottom: 0.85rem; }
.ap-facts { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ap-fact { display: flex; gap: 0.7rem; padding: 0.6rem 0; border-top: 1px solid var(--border-1); font-size: 0.86rem; }
.ap-fact:first-child { border-top: none; padding-top: 0; }
.ap-fact > .ap-icon { color: var(--text-5); margin-top: 0.2rem; }
.ap-fact > div { display: flex; flex-direction: column; min-width: 0; }
.ap-fact-title { font-weight: 600; color: var(--text-2); }
.ap-fact-text { margin-top: 0.05rem; color: var(--text-3); font-size: 0.82rem; line-height: 1.45; overflow-wrap: anywhere; }
.ap-aside-cta { margin-top: 1rem; width: 100%; }
.ap-latest { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ap-latest li { padding: 0.55rem 0; border-top: 1px solid var(--border-1); }
.ap-latest li:first-child { border-top: none; padding-top: 0; }
.ap-latest a { font-size: 0.88rem; font-weight: 600; color: var(--text-strong); text-decoration: none; display: block; }
.pub-body .ap-latest a:hover { color: var(--accent-hover); }
.ap-latest .pub-meta { font-size: 0.78rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.45rem; margin-top: 0.2rem; }
.ap-latest .pub-badge { font-size: 0.66rem; padding: 0.05rem 0.45rem; }
.ap-more-link { display: inline-block; margin-top: 0.7rem; font-size: 0.84rem; font-weight: 600; }

/* Leaderboard / progress toolbars */
.ap-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.ap-control { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; color: var(--text-3); }
.ap-control .pub-select { width: auto; min-width: 12rem; max-width: 100%; padding: 0.35rem 0.6rem; font-size: 0.86rem; }
.ap-control .pub-select.ap-side-select { min-width: 0; }
.ap-board-note { margin: 0.9rem 0 0; font-size: 0.8rem; color: var(--text-3); }
.ap-board { min-height: 4rem; }

/* A switch built on a native checkbox, so it keeps the keyboard and
   form semantics; the track and knob are drawn on the label. */
.ap-switch { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.84rem; color: var(--text-2); user-select: none; }
.ap-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.ap-switch-track {
    position: relative; width: 30px; height: 18px; flex-shrink: 0;
    border-radius: var(--radius-pill); background: var(--surface-7); transition: background 0.15s;
}
.ap-switch-track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
    border-radius: 50%; background: var(--surface-1); box-shadow: 0 1px 2px var(--shadow-2);
    transition: transform 0.15s;
}
.ap-switch input:checked + .ap-switch-track { background: var(--accent); }
.ap-switch input:checked + .ap-switch-track::after { transform: translateX(12px); }
.ap-switch input:focus-visible + .ap-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Submissions list */
.ap-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 1rem; }
.ap-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ap-chip-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.28rem 0.7rem; border-radius: var(--radius-pill);
    border: 1px solid var(--border-4); background: var(--surface-1); color: var(--text-3);
    font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.ap-chip-btn:hover { border-color: var(--border-6); color: var(--text-strong); }
.ap-chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); }
.ap-chip-btn .pub-count { font-weight: 500; opacity: 0.8; }
.ap-chip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-sub-list { display: flex; flex-direction: column; gap: 0.8rem; }
.ap-sub-card { padding: 1.05rem 1.3rem 0.95rem; }
.ap-sub-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.4rem 1rem; }
.ap-sub-head .pub-card-title { margin: 0; font-size: 1.04rem; flex: 1 1 18rem; min-width: 0; }
.ap-sub-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ap-sub-byline { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--text-3); }
/* A plain-text excerpt whose $…$ the script typesets (.mb-tex-safe clips
   each formula); the paint containment is a second wall around the lot. */
.ap-sub-excerpt { margin: 0.55rem 0 0; font-size: 0.88rem; color: var(--text-3); line-height: 1.55; overflow: hidden; contain: paint; }
.ap-claims { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }
.ap-claim {
    display: inline-flex; align-items: baseline; gap: 0.3rem;
    padding: 0.2rem 0.6rem; border-radius: var(--radius-md);
    background: var(--surface-3); color: var(--text-2); font-size: 0.84rem;
}
.ap-claim .ap-claim-eq { color: var(--text-5); }
.ap-claim .ap-claim-rel { color: var(--text-3); }
.ap-claim .ap-num, .ap-claim .ap-claim-display { font-weight: 600; color: var(--text-strong); }
.ap-claim.is-record { background: var(--tag-amber-bg); }
.ap-sub-card .pub-card-foot { margin-top: 0.7rem; }

/* ── Submission page ── */
.ap-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; margin: 0 0 1.2rem; padding: 0; list-style: none; font-size: 0.84rem; color: var(--text-3); }
.ap-crumbs li { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.ap-crumbs li + li::before { content: '/'; color: var(--text-7); }
.ap-crumbs a { color: var(--text-3); text-decoration: none; }
.pub-body .ap-crumbs a:hover { color: var(--accent-hover); text-decoration: underline; }
.ap-crumbs [aria-current] { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24rem; }
.ap-sub-header { margin-bottom: 1.6rem; }
.ap-sub-header .ap-sub-badges { margin-bottom: 0.6rem; }
.ap-sub-title {
    font-family: var(--font-display); font-size: clamp(1.5rem, 3.2vw, 2.05rem); font-weight: 700;
    letter-spacing: -0.015em; line-height: 1.2; color: var(--text-strong); margin: 0;
}
.ap-sub-authors { margin: 0.5rem 0 0; font-size: 1.02rem; color: var(--text-2); }
.ap-sub-meta { margin: 0.3rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0; }

/* The reviewer's note, coloured by the decision it explains. */
.ap-callout {
    display: flex; gap: 0.75rem; align-items: flex-start;
    margin: 1.2rem 0 0; padding: 0.85rem 1.05rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-3); border-left-width: 4px; background: var(--surface-1); font-size: 0.92rem;
}
.ap-callout .ap-icon { margin-top: 0.2rem; }
.ap-callout > div { flex: 1; min-width: 0; }
.ap-callout-title { margin: 0; font-weight: 650; color: var(--text-strong); font-size: 0.9rem; }
.ap-callout-body { margin-top: 0.2rem; color: var(--text-2); font-family: var(--font-ui); font-size: 0.9rem; line-height: 1.55; }
.ap-callout-body.shared-content { font-family: var(--font-ui); font-size: 0.9rem; line-height: 1.55; }
.ap-callout-body.shared-content p:last-child { margin-bottom: 0; }
.ap-callout[data-status="accepted"] { border-color: var(--accent-faint); border-left-color: var(--accent); background: var(--accent-bg); }
.ap-callout[data-status="accepted"] .ap-icon { color: var(--accent); }
.ap-callout[data-status="verified"] { border-color: var(--success-border); border-left-color: var(--success); background: var(--success-bg); }
.ap-callout[data-status="verified"] .ap-icon { color: var(--success); }
.ap-callout[data-status="disputed"] { border-color: var(--warning-border); border-left-color: var(--warning); background: var(--warning-bg); }
.ap-callout[data-status="disputed"] .ap-icon { color: var(--warning-deep); }
.ap-callout[data-status="rejected"] { border-color: var(--danger-border); border-left-color: var(--danger); background: var(--danger-bg); }
.ap-callout[data-status="rejected"] .ap-icon { color: var(--danger-strong); }
.ap-callout[data-status="pending"], .ap-callout[data-status="withdrawn"] { border-left-color: var(--border-6); }
.ap-callout[data-status="pending"] .ap-icon, .ap-callout[data-status="withdrawn"] .ap-icon { color: var(--text-4); }
/* A claimed bound crosses the other side's best one: the disputed colours,
   whatever the report's status. */
.ap-callout.ap-cross-callout { border-color: var(--warning-border); border-left-color: var(--warning); background: var(--warning-bg); }
.ap-cross-callout .ap-icon { color: var(--warning-deep); }
.ap-cross-item { margin: 0; }
.ap-cross-item + .ap-cross-item { margin-top: 0.35rem; }
.ap-cross-item .ap-symbol .katex { font-size: 1em; }

.ap-values-table td:first-child { width: 38%; }
.ap-claimed { display: flex; flex-direction: column; gap: 0.1rem; align-items: flex-start; }
.ap-claimed-main { font-size: 1.12rem; font-weight: 650; color: var(--text-strong); }
.ap-claimed-main .ap-num { font-variant-numeric: normal; }
.ap-claimed-approx { font-size: 0.8rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ap-compare { font-size: 0.84rem; color: var(--text-3); }
.ap-compare-line + .ap-compare-line { margin-top: 0.2rem; }
.ap-compare-ref { color: var(--text-3); }
.ap-cross-line { display: flex; align-items: center; gap: 0.3rem; color: var(--warning-deep); font-weight: 600; }

/* PDF writeup: a framed viewer with its own toolbar. Phones get a link
   instead — mobile browsers show a PDF iframe as its first page, or not at all. */
.ap-pdf { padding: 0; overflow: hidden; }
.ap-pdf-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-2); background: var(--surface-2);
}
.ap-pdf-name { display: flex; align-items: center; gap: 0.55rem; min-width: 0; font-weight: 600; color: var(--text-strong); font-size: 0.9rem; }
.ap-pdf-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-pdf-name .pub-meta { font-weight: 400; flex-shrink: 0; }
.ap-pdf-actions { display: flex; gap: 0.45rem; }
.ap-pdf-frame { display: block; width: 100%; height: 80vh; min-height: 420px; border: none; background: var(--surface-3); }
.ap-pdf-mobile { display: none; padding: 1.4rem 1.2rem; text-align: center; color: var(--text-3); font-size: 0.9rem; }
.ap-file-glyph {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: var(--radius-md);
    background: var(--tag-red-bg); color: var(--tag-red-fg);
}
.ap-file-glyph[data-kind="image"] { background: var(--tag-violet-bg); color: var(--tag-violet-fg); }
.ap-file-glyph[data-kind="code"] { background: var(--tag-teal-bg); color: var(--tag-teal-fg); }
.ap-file-glyph[data-kind="data"] { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.ap-file-glyph[data-kind="archive"] { background: var(--tag-amber-bg); color: var(--tag-amber-fg); }
.ap-file-glyph[data-kind="text"], .ap-file-glyph[data-kind="file"] { background: var(--tag-slate-bg); color: var(--tag-slate-fg); }

.ap-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ap-file { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--border-1); }
.ap-file:first-child { border-top: none; padding-top: 0; }
.ap-file:last-child { padding-bottom: 0; }
.ap-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-file-name { font-weight: 600; font-size: 0.9rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.pub-body a.ap-file-name:hover { color: var(--accent-hover); text-decoration: underline; }
.ap-file-meta { font-size: 0.78rem; color: var(--text-3); }
.ap-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: var(--radius-md);
    border: 1px solid transparent; background: none; color: var(--text-4); cursor: pointer; text-decoration: none;
}
.pub-body .ap-icon-btn:hover { background: var(--surface-3); color: var(--text-strong); }
.ap-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Details aside */
.ap-details .ap-fact-text a { font-weight: 600; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-2); }
.ap-actions .pub-btn { flex: 1 1 auto; }

/* Owner review panel */
.ap-review { border-top: 3px solid var(--accent); }
.ap-review .pub-textarea { min-height: 5.5rem; font-family: var(--font-ui); font-size: 0.88rem; }
.ap-review-current { margin: 0 0 0.8rem; font-size: 0.84rem; color: var(--text-3); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.ap-review > .pub-label { margin: 0 0 0.35rem; }
/* The decisions: radio cards, each in its status's colour (the badges'). */
.ap-decisions { display: flex; flex-direction: column; gap: 0.35rem; }
.ap-decision {
    display: flex; align-items: flex-start; gap: 0.55rem;
    padding: 0.5rem 0.65rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-3); background: var(--surface-1); cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.ap-decision:hover { border-color: var(--border-6); }
.ap-decision input { margin: 0.2rem 0 0; flex-shrink: 0; accent-color: var(--accent); }
.ap-decision:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.ap-decision:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.ap-decision-icon { display: inline-flex; margin-top: 0.1rem; color: var(--text-3); }
.ap-decision[data-status="accepted"] .ap-decision-icon { color: var(--accent); }
.ap-decision[data-status="verified"] .ap-decision-icon { color: var(--success); }
.ap-decision[data-status="disputed"] .ap-decision-icon { color: var(--warning-deep); }
.ap-decision[data-status="rejected"] .ap-decision-icon { color: var(--danger-strong); }
.ap-decision-text { display: flex; flex-direction: column; min-width: 0; }
.ap-decision-label { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; color: var(--text-strong); }
.ap-decision-current {
    padding: 0 0.4rem; border-radius: var(--radius-pill); background: var(--surface-4);
    font-size: 0.66rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-3);
}
.ap-decision-hint { font-size: 0.78rem; line-height: 1.4; color: var(--text-3); }
.ap-review-note-field { margin-top: 0.9rem; }
.ap-review-save { width: 100%; margin-top: 0.75rem; }
.ap-review .pub-error, .ap-action-error { margin: 0.5rem 0 0; min-height: 0; }
.ap-review .pub-error:empty, .ap-action-error:empty { display: none; }
.ap-review .pub-hint { display: block; margin: 0.8rem 0 0; }
.ap-delete-link {
    display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 1rem; padding: 0;
    border: none; background: none; cursor: pointer; font: inherit; font-size: 0.82rem; color: var(--danger-strong);
}
.ap-delete-link:hover { text-decoration: underline; }

.ap-comments-section { margin-top: 1.6rem; }
/* In line with the main column (the aside's width and gap to its right). */
@media (min-width: 901px) {
    .ap-comments-section { margin-right: calc(300px + 1.6rem); }
}

/* Confirmation dialog (<dialog>) */
.ap-dialog {
    width: min(440px, calc(100vw - 2rem)); padding: 1.4rem 1.5rem 1.2rem;
    border: 1px solid var(--border-3); border-radius: var(--radius-xl);
    background: var(--surface-1); color: var(--text-1); box-shadow: 0 24px 60px var(--shadow-4);
}
.ap-dialog::backdrop { background: var(--scrim); }
.ap-dialog h2 { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.08rem; color: var(--text-strong); }
.ap-dialog p { margin: 0; font-size: 0.92rem; color: var(--text-3); }
.ap-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.3rem; }

/* ── Submission form ── */
.ap-form-head { margin-bottom: 1.6rem; }
.ap-form-head .ap-sub-title { font-size: clamp(1.5rem, 3vw, 1.9rem); }
.ap-form-head p { margin: 0.45rem 0 0; color: var(--text-3); font-size: 0.95rem; max-width: 64ch; }
.ap-form-head .pub-connect-hint { font-size: 0.84rem; margin-top: 0.5rem; }
.ap-form-section { padding: 1.4rem 1.5rem 1.5rem; }
.ap-form-section-head { display: flex; gap: 0.8rem; align-items: flex-start; margin: 0 0 1.1rem; }
.ap-form-step {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent-bg); color: var(--accent-deep); font-size: 0.8rem; font-weight: 700;
}
.ap-form-section-title { margin: 0.05rem 0 0; font-family: var(--font-display); font-size: 1.02rem; font-weight: 650; color: var(--text-strong); }
.ap-form-section-sub { margin: 0.15rem 0 0; font-size: 0.84rem; color: var(--text-3); }
.ap-req { color: var(--danger-strong); font-weight: 600; margin-left: 0.15rem; }
.ap-optional { font-weight: 400; color: var(--text-3); font-size: 0.8rem; margin-left: 0.3rem; }
.pub-field.has-error .pub-input, .pub-field.has-error .pub-textarea, .pub-field.has-error .pub-select { border-color: var(--danger); }
.pub-field.has-error .pub-dropzone { border-color: var(--danger); }
.ap-field-error { color: var(--danger-strong); font-size: 0.8rem; margin: 0; }
.ap-field-error:empty { display: none; }

.ap-param-rows { display: flex; flex-direction: column; gap: 0.9rem; }
.ap-param-row {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.7rem 1rem;
    padding: 0.95rem 1rem 1rem; border: 1px solid var(--border-2); border-radius: var(--radius-lg); background: var(--surface-2);
}
.ap-param-row-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; }
.ap-param-row-head .ap-param-name { font-size: 0.94rem; }
.ap-param-row-hint { font-size: 0.8rem; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; }
.ap-param-row .pub-field { gap: 0.25rem; }
.ap-param-row .pub-label { font-size: 0.78rem; }
.ap-tex-preview { min-height: 1.5rem; font-size: 0.95rem; color: var(--text-2); overflow-x: auto; }
.ap-tex-preview:empty::before { content: attr(data-placeholder); color: var(--text-6); font-size: 0.8rem; }
.ap-beats { font-size: 0.8rem; font-weight: 600; color: var(--success-deep); display: inline-flex; align-items: center; gap: 0.25rem; }
.ap-beats:empty { display: none; }
.ap-beats.is-even { color: var(--text-3); }
/* A two-sided parameter: a box per bound, each with the row's two fields.
   Floated, the legend is laid out inside the box like its heading. */
.ap-side-row {
    grid-column: 1 / -1; min-width: 0; margin: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem 1rem;
    padding: 0.75rem 0.85rem 0.85rem; border: 1px solid var(--border-2); border-radius: var(--radius-md);
    background: var(--surface-1);
}
.ap-side-legend {
    float: left; grid-column: 1 / -1; display: flex; align-items: baseline; gap: 0.3rem; padding: 0;
    font-size: 0.84rem; font-weight: 650; color: var(--text-strong);
}
/* Crossing the other side's best bound: a warning, not an error. */
.ap-cross {
    display: flex; gap: 0.4rem; align-items: flex-start;
    padding: 0.45rem 0.6rem; border-radius: var(--radius-md);
    background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-deep);
    font-size: 0.8rem; line-height: 1.45;
}
.ap-cross:empty { display: none; }
.ap-cross .ap-icon { margin-top: 0.12rem; }

.ap-editor { border: 1px solid var(--border-4); border-radius: var(--radius-md); background: var(--surface-1); overflow: hidden; }
.ap-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ap-editor-tabs { display: flex; align-items: center; gap: 0.15rem; padding: 0.3rem 0.4rem 0; background: var(--surface-2); border-bottom: 1px solid var(--border-2); }
.ap-editor-tab {
    padding: 0.4rem 0.8rem; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
    border-radius: var(--radius-md) var(--radius-md) 0 0; background: none; cursor: pointer;
    font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--text-3);
}
.ap-editor-tab:hover { color: var(--text-strong); }
.ap-editor-tab[aria-selected="true"] { background: var(--surface-1); border-color: var(--border-2); color: var(--text-strong); }
.ap-editor-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ap-editor .pub-textarea { border: none; border-radius: 0; min-height: 16rem; display: block; }
.ap-editor .pub-textarea:focus { outline: none; }
/* Its height is the textarea's, set as it opens (arena-public.js). */
.ap-editor-preview { min-height: 16rem; overflow-y: auto; padding: 0.9rem 1.1rem; font-size: 0.98rem; }
.ap-editor-preview-empty { color: var(--text-3); font-style: italic; font-family: var(--font-ui); font-size: 0.88rem; }

.ap-drop-prompt { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.ap-drop-prompt .ap-icon { width: 22px; height: 22px; color: var(--text-5); }
.ap-drop-title { font-weight: 600; color: var(--text-2); }
.ap-drop-title u { color: var(--accent); text-decoration: none; }
.ap-drop-hint { font-size: 0.78rem; color: var(--text-3); }
.pub-dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-file-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ap-file-list:empty { display: none; }
.ap-file-list .ap-file {
    padding: 0.5rem 0.6rem; border: 1px solid var(--border-3); border-radius: var(--radius-md); background: var(--surface-1);
}
.ap-file-list .ap-file:first-child { padding-top: 0.5rem; border-top: 1px solid var(--border-3); }
.ap-file-list .ap-file:last-child { padding-bottom: 0.5rem; }
.ap-file.is-removed .ap-file-name { text-decoration: line-through; color: var(--text-5); }
.ap-file.is-removed .ap-file-glyph { opacity: 0.5; }
.ap-file-tag { font-size: 0.7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.ap-undo-btn { border: none; background: none; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--accent); padding: 0.3rem 0.5rem; }

.ap-form-confirm { padding: 1.1rem 1.3rem; }
.ap-form-foot {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1rem;
    padding-top: 0.4rem;
}
.ap-form-foot .pub-btn-primary { min-width: 13rem; }
.ap-form-error {
    display: flex; gap: 0.6rem; align-items: flex-start;
    padding: 0.75rem 1rem; border-radius: var(--radius-lg);
    background: var(--danger-bg); color: var(--danger-strong); border: 1px solid var(--danger-border); font-size: 0.9rem;
}
.ap-form-error .ap-icon { margin-top: 0.15rem; }
.ap-spinner {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--text-inverse-dim); border-top-color: var(--text-inverse);
    animation: ap-spin 0.8s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }

.ap-gate { text-align: center; padding: 2.6rem 1.8rem; }
.ap-gate-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 50%; margin-bottom: 0.9rem;
    background: var(--accent-bg); color: var(--accent);
}
.ap-gate-icon .ap-icon { width: 24px; height: 24px; }
.ap-gate h2 { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.25rem; color: var(--text-strong); }
.ap-gate p { margin: 0 auto; max-width: 46ch; color: var(--text-3); }
.ap-gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.4rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .ap-hero-inner { grid-template-columns: minmax(0, 1fr); }
    .ap-standing { max-width: 460px; }
    .ap-panel-grid { grid-template-columns: minmax(0, 1fr); }
    .ap-steps { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; margin-bottom: 1.8rem; }
}
@media (max-width: 640px) {
    .ap-arena-grid { grid-template-columns: minmax(0, 1fr); }
    /* The standing card keeps the figure and who set it, so the tabs start
       on the first screen; the Overview tab's parameters table has the rest. */
    .ap-hero { padding: 1.3rem 1rem 1.2rem; }
    .ap-standing { padding: 0.8rem 1rem; }
    .ap-standing .ap-meter { display: none; }
    .ap-record-figure { font-size: 1.9rem; white-space: normal; overflow-wrap: anywhere; }
    .ap-record-figure.ap-bounds-figure { font-size: 1.45rem; }
    .ap-reading { padding: 1.15rem 1.1rem; }
    .ap-form-section { padding: 1.1rem 1rem 1.2rem; }
    .ap-param-row, .ap-side-row { grid-template-columns: minmax(0, 1fr); }
    .ap-pdf-frame { display: none; }
    .ap-pdf-mobile { display: block; }
    .ap-crumbs [aria-current] { max-width: 14rem; }
    /* Tables become stacked cards. */
    .ap-table-stack thead { display: none; }
    .ap-table-stack, .ap-table-stack tbody, .ap-table-stack tr, .ap-table-stack td { display: block; width: 100%; }
    .ap-table-stack tr { padding: 0.7rem 0; border-bottom: 1px solid var(--border-2); }
    .ap-table-stack tr:last-child { border-bottom: none; }
    .ap-table-stack td { border: none; padding: 0.2rem 0; }
    .ap-table-stack td.ap-num-col { text-align: left; }
    .ap-table-stack td[data-label]::before {
        content: attr(data-label); display: block;
        font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
    }
    .ap-values-table td:first-child { width: 100%; }
    .ap-form-foot .pub-btn-primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .ap-switch-track, .ap-switch-track::after, .ap-decision { transition: none; }
    .ap-spinner { animation-duration: 2.4s; }
}

/* The directory band's side column (arenas.html): Create an arena over the
   Claude Code line, narrow enough that the caption keeps its lines. */
.ap-dir-actions { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.ap-dir-actions .pub-connect-hint { max-width: 13.5rem; margin: 0; line-height: 1.45; }
@media (max-width: 640px) {
    .ap-dir-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
    .ap-dir-actions .pub-connect-hint { flex: 1 1 10rem; max-width: 16rem; }
}
