/* Roster tables: /players, /onlineplayers (roster.js renders the cells) and /guilds (Guilds.php).
   Each row reads like a line of the in-game guild roster: a faction crest with the rank, the name,
   a class emblem (Global.HeroEmblems.php), a shield-shaped level and the prestige sigil. Colours
   come from the helios tokens, so the light theme follows. Phones get one card per character. */

.hr-roster {
    --hr-gold: var(--hx-gold);
    --hr-silver: color-mix(in srgb, var(--hx-text) 70%, var(--hx-teal));
    --hr-bronze: color-mix(in srgb, var(--hx-amber) 70%, var(--hx-boss));
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
    margin-top: 0 !important;
}
.hr-roster thead th {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: .72rem;
    letter-spacing: .14em;
    color: var(--hx-text-faint);
    padding-top: 4px;
    padding-bottom: 6px;
}

/* one roster line: a faction stripe on the left and a soft wash of its colour, painted on the row
   (cells stay transparent so the wash runs across the whole line) */
.hr-roster tbody tr { --hr-accent: var(--hx-edge-soft); --hr-wash: var(--hr-accent); }
.hr-roster tbody tr.is-athens { --hr-accent: var(--hx-mp); }
.hr-roster tbody tr.is-sparta { --hr-accent: var(--hx-hp); }
.hr-roster.is-ranked tbody tr.is-top1 { --hr-medal: var(--hr-gold); --hr-wash: var(--hr-gold); }
.hr-roster.is-ranked tbody tr.is-top2 { --hr-medal: var(--hr-silver); --hr-wash: var(--hr-silver); }
.hr-roster.is-ranked tbody tr.is-top3 { --hr-medal: var(--hr-bronze); --hr-wash: var(--hr-bronze); }
.hr-roster.table > tbody > tr {
    background: linear-gradient(90deg, color-mix(in srgb, var(--hr-wash) 16%, transparent), transparent 38%), var(--hx-card);
    transition: background-color .2s ease;
}
.hr-roster.table > tbody > tr:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--hr-wash) 26%, transparent), transparent 50%), var(--hx-card-hover); }
.hr-roster.table > tbody > tr > td {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 10px 12px;
}
.hr-roster.table > tbody > tr > td:first-child { box-shadow: inset 3px 0 0 var(--hr-accent) !important; }
.hr-roster.is-ranked.table > tbody > tr:is(.is-top1, .is-top2, .is-top3) > td:first-child { box-shadow: inset 3px 0 0 var(--hr-medal) !important; }
/* ---- faction crest with the rank plate */
.hr-crest { position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; vertical-align: middle; }
.hr-crest img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--hr-accent, var(--hx-edge-soft)), 0 0 14px color-mix(in srgb, var(--hr-accent, var(--hx-teal)) 45%, transparent);
}
.hr-crest--athens { --hr-accent: var(--hx-mp); }
.hr-crest--sparta { --hr-accent: var(--hx-hp); }
.hr-rank {
    position: absolute;
    left: 50%;
    bottom: -7px;
    transform: translateX(-50%);
    min-width: 24px;
    padding: 0 5px;
    font-size: .66rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    color: var(--hx-ice);
    background: linear-gradient(180deg, var(--hx-head-top), var(--hx-head-bottom));
    box-shadow: inset 0 0 0 1px var(--hx-edge-soft);
    clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 50%, calc(100% - 5px) 100%, 5px 100%, 0 50%);
    font-variant-numeric: tabular-nums;
}
.hr-rank[hidden] { display: none; }
tr:is(.is-top1, .is-top2, .is-top3) .hr-rank {
    color: var(--hx-void);
    background: linear-gradient(180deg, color-mix(in srgb, var(--hr-medal) 60%, var(--hx-ice)), var(--hr-medal));
    box-shadow: none;
}
tr.is-top1 .hr-crest::before {
    content: '\f521';      /* crown */
    font-family: 'Font Awesome 7 Free';
    font-weight: 900;
    position: absolute;
    top: -13px;
    font-size: .8rem;
    color: var(--hr-gold);
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--hr-gold) 70%, transparent));
}

/* ---- name, guild, gender */
.hr-name { display: block; color: var(--hx-ice); font-weight: 700; font-size: 1.02rem; overflow-wrap: anywhere; }
tr.is-top1 .hr-name { color: var(--hr-gold); }
.hr-sub { display: none; align-items: center; gap: 5px; font-size: .74rem; color: var(--hx-text-dim); margin-top: 2px; }
.hr-sub .hr-emblem { width: 14px; height: 14px; }
.hr-guild { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--hx-text); }
.hr-guild i { color: var(--hx-accent); font-size: .75rem; }
.hr-guild.is-none { color: var(--hx-text-faint); font-style: italic; font-weight: 500; }
.hr-gender { font-size: 1.1rem; }
.hr-gender.is-male { color: var(--hx-mp); }
.hr-gender.is-female { color: color-mix(in srgb, var(--hx-hp) 55%, var(--hx-elite)); }

/* ---- class: emblem + name, in the class colour */
.hr-emblem { width: 18px; height: 18px; flex-shrink: 0; color: var(--hr-cls, var(--hx-accent)); }
.hr-emblem--warrior, .hr-class--warrior { --hr-cls: var(--hx-boss); }
.hr-emblem--champion, .hr-class--champion { --hr-cls: var(--hx-gold); }
.hr-emblem--priest, .hr-class--priest { --hr-cls: var(--hx-good); }
.hr-emblem--mage, .hr-class--mage { --hr-cls: var(--hx-elite); }
.hr-class {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 6px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--hx-text);
    background: color-mix(in srgb, var(--hr-cls, var(--hx-accent)) 12%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hr-cls, var(--hx-accent)) 45%, transparent);
    clip-path: var(--hx-shape-sm);
    white-space: nowrap;
}

/* ---- level: a small gold-rimmed shield */
.hr-level {
    --hr-shield: polygon(50% 0, 100% 13%, 100% 58%, 50% 100%, 0 58%, 0 13%);
    position: relative;
    display: inline-grid;
    place-items: center;
    align-content: center;
    width: 40px;
    height: 46px;
    padding-bottom: 5px;
    line-height: 1;
    font-weight: 700;
    font-size: .92rem;
    color: var(--hx-gold);
    font-variant-numeric: tabular-nums;
    isolation: isolate;
    background: linear-gradient(180deg, var(--hx-gold), var(--hx-gold-deep));
    clip-path: var(--hr-shield);
}
.hr-level::before {
    content: '';
    position: absolute;
    inset: 2px;
    z-index: -1;
    background: linear-gradient(180deg, var(--hx-head-top), var(--hx-head-bottom));
    clip-path: var(--hr-shield);
}
.hr-level small { display: block; font-size: .5rem; letter-spacing: .12em; text-transform: uppercase; color: var(--hx-text-dim); margin-bottom: 1px; }

/* ---- prestige: a gem-cut sigil in the god's colour */
.hr-sigil { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .86rem; color: var(--hr-tier, var(--hx-text)); white-space: nowrap; }
.hr-sigil i {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    font-size: .7rem;
    color: var(--hr-tier);
    background: color-mix(in srgb, var(--hr-tier) 16%, var(--hx-inset));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hr-tier) 60%, transparent), 0 0 10px color-mix(in srgb, var(--hr-tier) 35%, transparent);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.hr-sigil.is-none { color: var(--hx-text-faint); font-weight: 500; font-size: .8rem; }
.hr-sigil--hermes { --hr-tier: var(--hx-elite); }
.hr-sigil--hades { --hr-tier: color-mix(in srgb, var(--hx-hp) 80%, var(--hx-elite)); }
.hr-sigil--poseidon { --hr-tier: var(--hx-amber); }
.hr-sigil--zeus { --hr-tier: var(--hx-teal); }
.hr-sigil--cronus { --hr-tier: var(--hx-good); }

/* ---- filter strip and table controls sit on one console */
.gl-panel .filter-section + .hx-table-wrap,
.gl-panel .hx-table-wrap { margin-top: 4px; }

/* ---- phones and small tablets: one roster card per character */
@media (max-width: 767.98px) {
    .hr-roster thead { display: none; }
    .hr-roster,
    .hr-roster tbody { display: block; width: 100% !important; }
    .hr-roster { border-spacing: 0 !important; }
    .hr-roster tbody tr {
        display: grid;
        grid-template-columns: 50px minmax(0, 1fr) auto;
        grid-template-areas: "crest name level" "crest guild tier";
        align-items: center;
        gap: 6px 12px;
        padding: 12px 12px 12px 14px;
        margin-bottom: 8px;
        box-shadow: inset 3px 0 0 var(--hr-accent);
        clip-path: var(--hx-shape-sm);
    }
    .hr-roster.is-ranked tbody tr:is(.is-top1, .is-top2, .is-top3) { box-shadow: inset 3px 0 0 var(--hr-medal); }
    .hr-roster.table > tbody > tr > td,
    .hr-roster.table > tbody > tr:hover > td,
    .hr-roster.is-ranked.table > tbody > tr > td {
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        clip-path: none !important;
        text-align: left !important;
        min-width: 0;
    }
    .hr-c-crest { grid-area: crest; }
    .hr-c-name { grid-area: name; }
    .hr-c-guild { grid-area: guild; }
    .hr-c-level { grid-area: level; justify-self: end; }
    .hr-c-tier { grid-area: tier; justify-self: end; }
    .hr-c-gender, .hr-c-class { display: none !important; }
    .hr-sub { display: flex; }
    .hr-roster tbody tr:has(> td.dataTables_empty) { display: block; padding: 18px 12px; }
    .hr-roster td.dataTables_empty { text-align: center !important; }
    .hr-level { width: 34px; height: 40px; font-size: .84rem; }
}
