/* player-explore.css — controls + windowed table for player-explore.php.
 *
 * Deliberately plain: matches altorg.css's flat greys (#f0f0f0 rows, #c0c0c0
 * borders, #e0e0e0 hover) rather than introducing a second visual language.
 * No framework, no icon font, no webfont. */

.explore {
    margin: 1em;
    font-size: small;
}

.explore-empty, .explore-noscript {
    margin: 1em;
}

/* no-player / unknown-player search box */
.xp-search {
    margin-top: 0.5em;
    display: flex;
    gap: 0.3em;
}

.xp-search input {
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #c0c0c0;
    padding: 0.15em 0.4em;
}

.xp-search input[type=submit] {
    background-color: #ffffff;
    cursor: pointer;
}

.xp-search input[type=submit]:hover { background-color: #e0e0e0; }

/* Placeholder printed by player-explore.php and overwritten by the JS on init.
 * If a user ever reports seeing this, the script did not run. */
.xp-loading {
    margin: 1em;
    color: #777;
}

/* window.onerror writes here — see player-explore.js. Loud on purpose. */
.xp-error {
    margin: 1em;
    border: 3px solid red;
    background-color: #ffffcc;
    color: #000;
    padding: 0.5em;
    font-weight: bold;
}

.xp-error small {
    font-weight: normal;
    white-space: pre-wrap;
    font-family: monospace;
}

/* ── top bar ────────────────────────────────────────────────────────────── */

.xp-topbar {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 0.4em;
}

.xp-title {
    font-size: medium;
}

/* an <a> that reads as a button; margin-left:auto pins it upper-right */
.xp-classic {
    margin-left: auto;
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    padding: 0.2em 0.7em;
    text-decoration: none;
    color: #000;
    white-space: nowrap;
}

.xp-classic:hover { background-color: #e0e0e0; }

/* ── controls ───────────────────────────────────────────────────────────── */

.xp-controls {
    border: 1px solid #c0c0c0;
    background-color: #f7f7f7;
    padding: 0.5em;
    margin-bottom: 0.5em;
}

.xp-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 0.4em;
}

.xp-row:last-child { margin-bottom: 0; }

.xp-group {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.xp-group > label {
    color: #444;
}

.xp-controls select,
.xp-controls input {
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    padding: 0.1em 0.2em;
}

.xp-controls input[type=number] { width: 6em; }
.xp-controls input[type=text]   { width: 14em; }
.xp-controls input[type=date]   { width: 9.5em; }

/* Multi-select facets are checkbox pills, not <select multiple> — ctrl-click to
 * multi-select is the single least discoverable control in HTML, and these sets
 * are small enough (13 roles, 5 races, 3 aligns) to show inline. */
.xp-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15em;
}

.xp-pill {
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    padding: 0.1em 0.4em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.xp-pill:hover { background-color: #e0e0e0; }

.xp-pill.on {
    background-color: #444444;
    border-color: #444444;
    color: #ffffff;
}

.xp-pill input { display: none; }

.xp-reset {
    margin-left: auto;
}

.xp-reset button {
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    padding: 0.15em 0.6em;
    cursor: pointer;
}

.xp-reset button:hover { background-color: #e0e0e0; }

/* ── summary ────────────────────────────────────────────────────────────── */

.xp-summary {
    padding: 0.3em 0;
    color: #444;
}

.xp-summary b { color: #000; }

.xp-summary .xp-filtered { color: #a00000; }

/* ── table ──────────────────────────────────────────────────────────────── */

/* Fixed row height is load-bearing: the virtual scroller computes the visible
 * slice as scrollTop/ROW_H, so rows must not vary. Long death strings are
 * ellipsised (full text in title=) rather than allowed to wrap. */
/* ⚠️ Mobile / narrow-window side-scroll (2026-07-23). The table is ~90-110em
 * wide (18 columns); at font-size:small that's ~1250-1450px, far past a phone.
 * Rather than the browser-default nested scroller (which desynced the separate
 * header table and was near-unscrollable on touch), we give the header AND the
 * body-viewport a `min-width` = the summed column widths (explore.js sets
 * `--xp-table-w` from the shown columns — it varies per board), and turn the
 * viewport's own horizontal scroll OFF. Below that width the min-width overflows
 * .explore and the PAGE scrolls side-to-side as one unit — header and body
 * locked together, every column reachable by a native swipe. At/above that width
 * min-width doesn't bind and this is a no-op (desktop unchanged). Only the table
 * block gets the min-width, so the filter controls still wrap to the screen. */
.xp-viewport {
    height: 70vh;
    min-height: 20em;
    min-width: var(--xp-table-w, 90em);
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    position: relative;
}

.xp-sizer { position: relative; width: 100%; }

.xp-table {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

/* ⚠️ 24px EXACTLY, and it must equal ROW_H in player-explore.js — the scroller
 * computes the visible slice as scrollTop/ROW_H, so any drift misaligns rows
 * against the scrollbar. Do NOT change this to an em value: .explore sets
 * font-size:small, so 1.5em is ~19.5px, not 24px. (The JS measures the real
 * height on first render and warns to console if the two disagree.) */
.explore .xp-table td {
    height: 24px;
    max-height: 24px;
    padding: 0 0.4em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border: 0;
    line-height: 24px;
}

/* ⚠️ Striping is by the .odd/.even CLASS, never :nth-child — only a window of
 * rows exists in the DOM at a time, so nth-child would re-stripe on every
 * scroll. altorg.css's `.body:not(.dudley) tr:nth-child(odd) td` would do
 * exactly that and outranks a bare `.xp-table tr.odd td`, so these rules are
 * scoped to .explore to match its specificity (0,0,3,2) and win on load order
 * (player-explore.css is an xtracss, loaded after altorg.css). Both parities
 * are declared so neither can fall through to the nth-child rule. */
.explore .xp-table tr.odd td  { background-color: #f0f0f0; }
.explore .xp-table tr.even td { background-color: #ffffff; }
.explore .xp-table tr:hover td { background-color: #e0e0e0; }

/* Conduct badges — same one-letter-on-color idiom as player-all.php's
 * decode_conduct_short(), whose $conduct_colors are shipped in the payload.
 * Those colors are all pale, so the text stays black. */
.explore .xp-cbadge {
    font-family: monospace;
    color: #000;
    padding: 0 0.15em;
    margin-right: 1px;
}

.explore .xp-table td.num { text-align: right; }
.explore .xp-table td.ctr { text-align: center; }

.explore .xp-table tr.xp-asc td { background-color: #fff3b0; }
.explore .xp-table tr.xp-asc:hover td { background-color: #ffe870; }

/* Header is a separate table so it stays put while the body scrolls; its
 * colgroup is cloned from the body's so the columns cannot drift. */
.xp-head {
    margin: 0;
    padding: 0;
    border: 0;
    border-collapse: collapse;
    width: 100%;
    /* MUST match .xp-viewport's min-width so header and body stay column-aligned
     * when the page side-scrolls — see the .xp-viewport note above. */
    min-width: var(--xp-table-w, 90em);
    table-layout: fixed;
    background-color: #e8e8e8;
}

.xp-head th {
    height: 1.6em;
    padding: 0 0.4em;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid #c0c0c0;
    cursor: pointer;
    user-select: none;
    font-weight: bold;
}

.xp-head th:hover { background-color: #d8d8d8; }
.xp-head th.num { text-align: right; }
.xp-head th.ctr { text-align: center; }

.xp-head th .xp-arrow {
    color: #a00000;
    font-weight: normal;
}

/* ── paging ─────────────────────────────────────────────────────────────── */

.xp-paging {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.4em 0;
}

.xp-paging button {
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #c0c0c0;
    background-color: #ffffff;
    padding: 0.15em 0.6em;
    cursor: pointer;
}

.xp-paging button:hover:not(:disabled) { background-color: #e0e0e0; }
.xp-paging button:disabled { color: #c0c0c0; cursor: default; }

.xp-paging input { width: 5em; }

.xp-hint { color: #777; }
