/* ============================================================
   Giả lập xếp hạng (GLXH) — ranked manager-mode robot panel
   Scoped to #glxhTab; only reads the app's theme variables.
   ============================================================ */

#glxhTab {
    --g-surface: rgba(22, 27, 34, 0.72);
    --g-surface-2: rgba(255, 255, 255, 0.035);
    --g-line: rgba(255, 255, 255, 0.07);
    --g-line-2: rgba(255, 255, 255, 0.12);
    --g-text: var(--text-primary, #f0f6fc);
    --g-muted: var(--text-secondary, #8b949e);
    --g-dim: #6e7681;
    --g-accent: var(--accent, #58a6ff);
    --g-win: #3fb950;
    --g-draw: #d29922;
    --g-loss: #f85149;
    --g-mine: #3fb950;
    --g-opp: #f78166;
    --g-radius: 16px;
    color: var(--g-text);
}

#glxhTab *,
#glxhTab *::before,
#glxhTab *::after { box-sizing: border-box; }

/* The app styles every <input> as a big login field; undo that inside the panel. */
#glxhTab input,
#glxhTab select {
    font-family: inherit;
    margin: 0;
}

#glxhTab .glxh-input,
#glxhTab .glxh-rule select,
#glxhTab .glxh-rule input[type="number"] {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background-color: rgba(1, 4, 9, 0.45);
    border: 1px solid var(--g-line-2);
    border-radius: 10px;
    color: var(--g-text);
    font-size: 0.86rem;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

#glxhTab select.glxh-input,
#glxhTab .glxh-rule select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b949e' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    text-overflow: ellipsis;
}

#glxhTab select option { background: #161b22; color: var(--g-text); }

#glxhTab .glxh-input:hover,
#glxhTab .glxh-rule select:hover,
#glxhTab .glxh-rule input[type="number"]:hover { border-color: rgba(255, 255, 255, 0.2); }

#glxhTab .glxh-input:focus,
#glxhTab .glxh-rule select:focus,
#glxhTab .glxh-rule input[type="number"]:focus {
    outline: none;
    border-color: var(--g-accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18);
    background-color: rgba(1, 4, 9, 0.6);
}

#glxhTab .glxh-input[readonly] { color: var(--g-muted); cursor: default; }
#glxhTab button { font-family: inherit; }

/* ---------- header ---------- */
.glxh-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.glxh-title { display: flex; align-items: center; gap: 14px; min-width: 0; }

.glxh-title-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    color: #ffd76a;
    background: radial-gradient(circle at 30% 20%, rgba(255, 215, 106, 0.35), rgba(210, 153, 34, 0.12) 60%);
    border: 1px solid rgba(255, 215, 106, 0.28);
    box-shadow: 0 8px 24px rgba(210, 153, 34, 0.18);
}

.glxh-title h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; margin: 0; white-space: nowrap; }
.glxh-title p { color: var(--g-muted); font-size: 0.8rem; margin: 3px 0 0; }

.glxh-head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.glxh-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--g-muted);
    background: var(--g-surface-2);
    border: 1px solid var(--g-line-2);
    white-space: nowrap;
}

.glxh-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--g-dim); }
.glxh-pill.is-on { color: #7ee2a8; border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.1); }
.glxh-pill.is-on i { background: var(--g-win); animation: glxhPulse 1.6s infinite; }
.glxh-pill.is-warn { color: #f0b72f; border-color: rgba(210, 153, 34, 0.4); background: rgba(210, 153, 34, 0.1); }
.glxh-pill.is-warn i { background: var(--g-draw); }

.glxh-icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--g-line-2);
    background: var(--g-surface-2);
    color: var(--g-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.glxh-icon-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.glxh-icon-btn:active { transform: scale(0.96); }
.glxh-icon-btn.is-spinning i { animation: glxhSpin 0.8s linear infinite; }

.glxh-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--g-line-2);
    background: var(--g-surface-2);
    color: var(--g-text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.glxh-ghost-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }

/* ---------- layout ---------- */
.glxh-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.glxh-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.glxh-right { min-width: 0; }

.glxh-card {
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    border-radius: var(--g-radius);
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.glxh-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.glxh-card-title i { color: var(--g-accent); margin-right: 6px; }

.glxh-block { margin-top: 16px; }

.glxh-block-head,
.glxh-block-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--g-muted);
}

.glxh-block-head { margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.glxh-block-head > span:last-child { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--g-text); }
.glxh-block-foot { margin-top: 8px; }

/* ---------- rank card ---------- */
.glxh-rank {
    --tier: #8b949e;
    --tier-2: #484f58;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 0% 0%, color-mix(in srgb, var(--tier) 20%, transparent), transparent 60%),
        var(--g-surface);
}

.glxh-rank[data-tier="nghiep-du"] { --tier: #c08457; --tier-2: #7c4a22; }
.glxh-rank[data-tier="ban-chuyen"] { --tier: #b8c4d6; --tier-2: #5b6779; }
.glxh-rank[data-tier="chuyen-nghiep"] { --tier: #f2c94c; --tier-2: #9a6b00; }
.glxh-rank[data-tier="the-gioi"] { --tier: #a98bff; --tier-2: #4b2fa8; }
.glxh-rank[data-tier="cao-thu"] { --tier: #3ddc84; --tier-2: #0f7a43; }
.glxh-rank[data-tier="tinh-anh"] { --tier: #3fd0d4; --tier-2: #0f6f78; }
.glxh-rank[data-tier="huyen-thoai"] { --tier: #4fd1c5; --tier-2: #1d6b70; }
.glxh-rank[data-tier="thach-dau"] { --tier: #d07bff; --tier-2: #6d2aa8; }
.glxh-rank[data-tier="sieu-sao"] { --tier: #e8d9a8; --tier-2: #6b6253; }

.glxh-rank-top { display: flex; align-items: center; gap: 14px; }

.glxh-emblem {
    position: relative;
    width: 62px;
    height: 70px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    clip-path: polygon(50% 0, 100% 18%, 100% 70%, 50% 100%, 0 70%, 0 18%);
    background: linear-gradient(160deg, var(--tier), var(--tier-2));
}

.glxh-emblem::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.35), transparent 45%, rgba(0, 0, 0, 0.25));
}

/* the game's rank icon replaces the drawn badge */
.glxh-emblem.has-img {
    width: 76px;
    height: 76px;
    clip-path: none;
    background: none;
    filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--tier) 35%, transparent));
}

.glxh-emblem.has-img::after { display: none; }
.glxh-emblem img { width: 100%; height: 100%; object-fit: contain; display: block; }

.glxh-emblem span {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.glxh-rank-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.glxh-rank-info small { font-size: 0.66rem; color: var(--g-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

.glxh-rank-info strong {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glxh-rank-info > span { font-size: 0.76rem; color: var(--g-muted); }

/* promotion cycle + ruled points bar (reference layout) */
.glxh-cyc { margin-top: 18px; }

.glxh-cyc-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.82rem;
    color: var(--g-muted);
}

.glxh-cyc-head > b { font-size: 0.95rem; font-weight: 800; color: #fff; letter-spacing: 0.01em; }
.glxh-cyc-head span b { color: #fff; font-weight: 800; }

.glxh-pts { margin-top: 18px; }
.glxh-pts-title { font-size: 0.84rem; font-weight: 600; color: var(--g-text); margin-bottom: 10px; }
.glxh-pts-title b { font-weight: 800; }
.glxh-pts-row { display: flex; align-items: flex-start; gap: 12px; }

.glxh-pts-score {
    flex-shrink: 0;
    min-width: 60px;
    height: 42px;
    padding: 0 12px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1px;
    padding-top: 7px;
    border-radius: 12px;
    color: #3fb950;
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid rgba(63, 185, 80, 0.55);
    box-shadow: 0 0 16px rgba(63, 185, 80, 0.15), inset 0 0 12px rgba(63, 185, 80, 0.08);
}

.glxh-pts-score b { font-size: 1.3rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.glxh-pts-score small { font-size: 0.72rem; font-weight: 800; }

.glxh-pts-track { flex: 1; min-width: 0; padding-top: 4px; }

.glxh-pts-bar {
    display: flex;
    gap: 2px;
    height: 34px;
    padding: 3px;
    border-radius: 6px;
    background: rgba(1, 4, 9, 0.45);
    border: 1px solid var(--g-line);
}

.glxh-pts-cell {
    flex: 1 1 0;
    min-width: 2px;
    border-radius: 2px;
    background: #2a3038;
}

.glxh-pts-cell.is-on { background: linear-gradient(180deg, #46c95a, #2ea043); }
.glxh-pts-cell.is-releg { background: #c96a73; }
.glxh-pts-cell.is-on.is-releg { background: #e08a92; }

.glxh-pts-axis { position: relative; height: 16px; margin-top: 4px; font-size: 0.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.glxh-pts-releg { position: absolute; top: 0; transform: translateX(-50%); color: #ff7b72; }
.glxh-pts-target { position: absolute; top: 0; right: 0; color: var(--g-win); }

.glxh-cyc-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.7rem;
    color: var(--g-dim);
}

.glxh-cyc-foot:empty { display: none; }

.glxh-cycle-list { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }

.glxh-cycle-item {
    position: relative;
    aspect-ratio: 1 / 1.15;
    max-height: 40px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
}

.glxh-cycle-item--win { background: rgba(46, 160, 67, 0.2); color: #56d364; box-shadow: inset 0 0 0 1px rgba(63, 185, 80, 0.45); }
.glxh-cycle-item--draw { background: rgba(56, 139, 253, 0.18); color: #79c0ff; box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.4); }
.glxh-cycle-item--loss { background: rgba(248, 81, 73, 0.16); color: #ff7b72; box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.4); }
.glxh-cycle-item--empty { background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }

.glxh-cycle-item.is-awarded::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffd76a;
}

.glxh-season {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--g-line-2);
    font-size: 0.74rem;
    color: var(--g-muted);
    line-height: 1.6;
}

.glxh-season:empty { display: none; }
.glxh-season b { color: var(--g-text); white-space: nowrap; }

/* mini live widget */
.glxh-mini-live {
    width: 100%;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--g-line-2);
    background: rgba(1, 4, 9, 0.35);
    color: var(--g-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.glxh-mini-live:hover { border-color: rgba(88, 166, 255, 0.45); background: rgba(88, 166, 255, 0.06); }
.glxh-mini-live > i { color: var(--g-muted); font-size: 0.7rem; }

.glxh-mini-live-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: #484f58; }
.glxh-mini-live.is-live .glxh-mini-live-dot { background: var(--g-loss); animation: glxhPulseRed 1.4s infinite; }
.glxh-mini-live.is-wait .glxh-mini-live-dot { background: var(--g-draw); animation: glxhBlink 1.4s infinite; }

.glxh-mini-live-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.glxh-mini-live-line { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; min-width: 0; }
.glxh-mini-live-line b { font-size: 0.95rem; font-variant-numeric: tabular-nums; white-space: pre; }
.glxh-mini-live-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--g-muted); }
.glxh-mini-live-name:last-child { text-align: right; }
.glxh-mini-live-body small { font-size: 0.7rem; color: var(--g-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glxh-mini-live-min { font-size: 0.72rem; font-weight: 800; color: var(--g-win); font-variant-numeric: tabular-nums; }

/* ---------- control card ---------- */
.glxh-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }

.glxh-kpi {
    padding: 10px;
    border-radius: 12px;
    background: var(--g-surface-2);
    border: 1px solid var(--g-line);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.glxh-kpi small { font-size: 0.62rem; color: var(--g-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glxh-kpi b { font-size: 0.95rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.glxh-window-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: 12px;
    font-size: 0.76rem;
    color: #e3b341;
    background: rgba(210, 153, 34, 0.1);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.glxh-window-note i { margin-top: 2px; }

.glxh-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.glxh-field > span:first-child { font-size: 0.74rem; font-weight: 600; color: var(--g-muted); }

.glxh-sub-title {
    margin: 18px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--g-line);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--g-muted);
}

.glxh-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--g-surface-2);
    border: 1px solid var(--g-line);
    font-size: 0.82rem;
    cursor: pointer;
}

.glxh-run-btn {
    width: 100%;
    height: 48px;
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, #2ea043, #238636);
    box-shadow: 0 10px 24px rgba(46, 160, 67, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.glxh-run-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.glxh-run-btn:active { transform: none; }

.glxh-run-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

/* running: the main button is the safe stop */
.glxh-run-btn.is-running {
    background: linear-gradient(180deg, #d97706, #b45309);
    box-shadow: 0 10px 24px rgba(217, 119, 6, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    color: #fff;
}

.glxh-run-btn.is-pending,
.glxh-run-btn.is-pending:disabled {
    opacity: 1;
    cursor: default;
    color: #fde68a;
    background: rgba(217, 119, 6, 0.12);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.glxh-safe-note {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    padding: 9px 10px 9px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.glxh-safe-note span { flex: 1; }

.glxh-safe-note button {
    height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--g-text);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.glxh-safe-note button:hover { background: rgba(255, 255, 255, 0.1); }

.glxh-stopnow-btn {
    width: 100%;
    height: 36px;
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid rgba(248, 81, 73, 0.4);
    background: rgba(248, 81, 73, 0.08);
    color: #ff9b95;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.glxh-stopnow-btn:hover { background: rgba(248, 81, 73, 0.16); color: #fff; }

.glxh-abandon-btn {
    width: 100%;
    margin-top: 8px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--g-dim);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.glxh-abandon-btn:hover { color: var(--g-loss); background: rgba(248, 81, 73, 0.08); }
.glxh-abandon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.glxh-abandon-btn[disabled]:hover { color: var(--g-dim); background: transparent; }

/* ---------- switch ---------- */
.glxh-switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
#glxhTab .glxh-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; pointer-events: none; }

.glxh-switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #30363d;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
}

.glxh-switch-track i {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c9d1d9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1), background 0.2s;
}

.glxh-switch input:checked + .glxh-switch-track { background: #238636; }
.glxh-switch input:checked + .glxh-switch-track i { transform: translateX(18px); background: #fff; }
.glxh-switch input:focus-visible + .glxh-switch-track { box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.35); }

.glxh-switch--lg .glxh-switch-track { width: 48px; height: 26px; }
.glxh-switch--lg .glxh-switch-track i { width: 20px; height: 20px; }
.glxh-switch--lg input:checked + .glxh-switch-track i { transform: translateX(22px); }

/* ---------- sub-tabs ---------- */
.glxh-tabs {
    display: flex;
    gap: 4px;
    padding: 5px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    overflow-x: auto;
    scrollbar-width: none;
}

.glxh-tabs::-webkit-scrollbar { display: none; }

.glxh-tab {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--g-muted);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.glxh-tab:hover { color: var(--g-text); background: rgba(255, 255, 255, 0.04); }

.glxh-tab.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.22), rgba(88, 166, 255, 0.12));
    box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.4);
}

.glxh-tab.active > i { color: var(--g-accent); }

.glxh-tab-badge {
    font-size: 0.66rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.06);
}

.glxh-tab-badge.is-on { color: #7ee2a8; background: rgba(63, 185, 80, 0.16); }

.glxh-tab-live { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--g-loss); animation: glxhPulseRed 1.4s infinite; }
.glxh-tab-live.show { display: inline-block; }

.glxh-pane { display: none; animation: glxhFade 0.25s ease; }
.glxh-pane.active { display: block; }

.glxh-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.glxh-pane-head h3 { font-size: 0.95rem; font-weight: 700; margin: 0; }
.glxh-pane-head--gap { margin-top: 22px; }

.glxh-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.06);
}

.glxh-chip.is-on { color: #7ee2a8; background: rgba(63, 185, 80, 0.14); }

/* ---------- live: match hero ---------- */
.glxh-match {
    position: relative;
    overflow: hidden;
    padding: 18px 20px 16px;
    border-radius: 18px;
    border: 1px solid var(--g-line);
    background:
        radial-gradient(60% 120% at 0% 0%, rgba(63, 185, 80, 0.12), transparent 60%),
        radial-gradient(60% 120% at 100% 0%, rgba(247, 129, 102, 0.12), transparent 60%),
        linear-gradient(180deg, rgba(22, 27, 34, 0.9), rgba(13, 17, 23, 0.9));
}

.glxh-match::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.014) 0 60px, transparent 60px 120px);
}

.glxh-match > * { position: relative; }

.glxh-match-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.glxh-match-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.06);
}

.glxh-match-tag.is-search { color: #e3b341; background: rgba(210, 153, 34, 0.14); }
.glxh-match-tag.is-enter { color: #79c0ff; background: rgba(88, 166, 255, 0.14); }
.glxh-match-tag.is-live { color: #fff; background: #da3633; }
.glxh-match-tag.is-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: glxhBlink 1s infinite; }
.glxh-match-tag.is-end { color: #7ee2a8; background: rgba(63, 185, 80, 0.14); }

.glxh-match-phase { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--g-muted); min-width: 0; }
.glxh-phase-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--g-text); }

.glxh-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(88, 166, 255, 0.25);
    border-top-color: var(--g-accent);
    animation: glxhSpin 0.9s linear infinite;
    flex-shrink: 0;
}

.glxh-spinner.is-idle { animation: none; border-color: rgba(255, 255, 255, 0.15); }

/* four-step progress */
.glxh-steps { display: grid; grid-template-columns: repeat(4, 1fr); margin: 16px 0 6px; }

.glxh-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--g-dim);
    text-align: center;
}

.glxh-step::before {
    content: '';
    position: absolute;
    top: 13px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
}

.glxh-step:first-child::before { display: none; }

.glxh-step i {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-style: normal;
    font-weight: 800;
    font-size: 0.74rem;
    background: #161b22;
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--g-dim);
    transition: all 0.25s;
}

.glxh-step b { font-weight: 600; }
.glxh-step.is-done { color: var(--g-muted); }
.glxh-step.is-done::before,
.glxh-step.is-current::before { background: var(--g-win); }
.glxh-step.is-done i { background: var(--g-win); border-color: var(--g-win); color: #fff; font-size: 0; }
.glxh-step.is-done i::after { content: '\2713'; font-size: 0.8rem; }
.glxh-step.is-current { color: #fff; }
.glxh-step.is-current b { font-weight: 800; }

.glxh-step.is-current i {
    border-color: var(--g-accent);
    color: #fff;
    background: rgba(88, 166, 255, 0.25);
    animation: glxhRing 1.6s infinite;
}

/* scoreboard */
.glxh-scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.glxh-side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.glxh-side strong { font-size: 0.95rem; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glxh-side small { font-size: 0.7rem; color: var(--g-muted); }

.glxh-crest {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(150deg, #3fb950, #196c2e);
    box-shadow: 0 8px 20px rgba(63, 185, 80, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.glxh-crest.has-img {
    background: none;
    box-shadow: none;
    border-radius: 0;
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.glxh-crest.is-unknown {
    color: #6e7681;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.glxh-crest img { width: 100%; height: 100%; object-fit: contain; display: block; }

.glxh-opp-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.glxh-opp-cell > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.glxh-opp-crest { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }

.glxh-crest--away {
    background: linear-gradient(150deg, #f78166, #a3301c);
    box-shadow: 0 8px 20px rgba(247, 129, 102, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.glxh-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.glxh-big-score {
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    white-space: pre;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.glxh-big-score.is-flash { animation: glxhFlash 1.2s ease; }

.glxh-minute {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--g-muted);
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.glxh-minute.is-live { color: #7ee2a8; background: rgba(63, 185, 80, 0.14); }

.glxh-scorers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.74rem;
    color: var(--g-muted);
}

.glxh-scorers:empty { display: none; }
.glxh-scorers > div:first-child { text-align: right; }
.glxh-scorers i { color: var(--g-text); margin: 0 4px; font-size: 0.66rem; }

/* 0-90' timeline */
.glxh-timeline { margin-top: 16px; }

.glxh-timeline-track { position: relative; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }

.glxh-timeline-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(63, 185, 80, 0.5), var(--g-win));
    transition: width 0.6s ease;
}

.glxh-timeline-half { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: rgba(255, 255, 255, 0.18); }
.glxh-timeline-marks { position: absolute; inset: 0; }

.glxh-mark {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    transform: translateY(-50%);
    border-radius: 50%;
    border: 2px solid #0d1117;
}

.glxh-mark--goal-mine { background: var(--g-mine); }
.glxh-mark--goal-opp { background: var(--g-opp); }
.glxh-mark--tactic { width: 9px; height: 9px; margin-left: -4px; border-radius: 2px; border-width: 1px; background: var(--g-accent); transform: translateY(-50%) rotate(45deg); }

.glxh-timeline-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.64rem; color: var(--g-dim); }

.glxh-using {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    color: var(--g-muted);
    background: rgba(1, 4, 9, 0.35);
    border: 1px solid var(--g-line);
}

.glxh-using > i { color: var(--g-accent); }
.glxh-using b { color: var(--g-text); font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(88, 166, 255, 0.12); }
.glxh-using b:empty { display: none; }
.glxh-using.is-idle b { color: var(--g-dim); background: transparent; padding: 0; font-weight: 500; }
.glxh-using .glxh-using-ment { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.06); }
.glxh-using em { font-style: normal; margin-left: auto; color: var(--g-dim); }

.glxh-offline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #ffa198;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.glxh-phase-log {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.glxh-phase-log div { display: flex; gap: 12px; font-size: 0.78rem; color: var(--g-muted); }
.glxh-phase-log div:last-child { color: var(--g-text); }
.glxh-phase-log time { font-variant-numeric: tabular-nums; color: var(--g-dim); flex-shrink: 0; }

/* segmented control */
.glxh-segment {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin: 18px 0 12px;
    border-radius: 12px;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
}

.glxh-segment button {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--g-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: background 0.15s, color 0.15s;
}

.glxh-segment button:hover { color: var(--g-text); }
.glxh-segment button.active { background: rgba(255, 255, 255, 0.09); color: #fff; }

.glxh-live-pane { border-radius: 14px; background: var(--g-surface); border: 1px solid var(--g-line); padding: 6px; }

.glxh-empty { padding: 34px 16px; text-align: center; font-size: 0.8rem; color: var(--g-dim); }
.glxh-empty i { display: block; font-size: 1.4rem; margin-bottom: 10px; opacity: 0.5; }

/* events feed */
.glxh-feed { max-height: 360px; overflow-y: auto; }

.glxh-ev {
    display: grid;
    grid-template-columns: 40px 30px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.glxh-ev + .glxh-ev { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.glxh-ev-min { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--g-muted); text-align: right; }

.glxh-ev-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 0.74rem;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.05);
}

.glxh-ev-ico--goal { color: #fff; background: rgba(63, 185, 80, 0.3); }
.glxh-ev-ico--tactic { color: #79c0ff; background: rgba(88, 166, 255, 0.16); }
.glxh-ev-ico--half,
.glxh-ev-ico--end { color: #e3b341; background: rgba(210, 153, 34, 0.16); }
.glxh-ev-ico--card { color: #ffd33d; background: rgba(255, 211, 61, 0.14); }
.glxh-ev--goal .glxh-ev-text { font-weight: 700; color: #fff; }
.glxh-ev-text { color: var(--g-text); overflow-wrap: anywhere; }

/* stats */
.glxh-stats { padding: 6px 10px; }
.glxh-stat { padding: 9px 0; }
.glxh-stat + .glxh-stat { border-top: 1px solid rgba(255, 255, 255, 0.04); }

.glxh-stat-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.8rem; margin-bottom: 6px; }
.glxh-stat-top b { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 32px; color: var(--g-muted); }
.glxh-stat-top b:last-child { text-align: right; }
.glxh-stat-top b.is-lead { color: #fff; }
.glxh-stat-top span { color: var(--g-muted); font-size: 0.74rem; }

.glxh-stat-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.glxh-stat-bars span { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; display: flex; }
.glxh-stat-bars span:first-child { justify-content: flex-end; }
.glxh-stat-bars i { display: block; height: 100%; border-radius: inherit; background: var(--g-mine); transition: width 0.5s ease; }
.glxh-stat-bars span:last-child i { background: var(--g-opp); }

/* player ratings */
.glxh-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; padding: 4px; }

.glxh-player {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--g-surface-2);
    font-size: 0.8rem;
}

.glxh-player > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glxh-player small { color: var(--g-muted); font-size: 0.72rem; white-space: nowrap; }

.glxh-rating {
    height: 24px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 0.76rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #0d1117;
    background: #8b949e;
}

.glxh-rating--a { background: #3fb950; }
.glxh-rating--b { background: #a3e635; }
.glxh-rating--c { background: #e3b341; }
.glxh-rating--d { background: #f0883e; }
.glxh-rating--e { background: #f85149; color: #fff; }

/* collapsible notes */
.glxh-tech {
    margin-top: 16px;
    border-radius: 14px;
    border: 1px solid var(--g-line);
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.78rem;
    color: var(--g-muted);
}

.glxh-tech > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}

.glxh-tech > summary::-webkit-details-marker { display: none; }

.glxh-tech > summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.66rem;
    margin-left: auto;
    transition: transform 0.2s;
}

.glxh-tech[open] > summary::after { transform: rotate(180deg); }
.glxh-tech > summary:hover { color: var(--g-text); }
.glxh-tech > :not(summary) { margin: 0 14px 12px; line-height: 1.6; }
.glxh-tech b { color: var(--g-text); }

.glxh-tech code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    color: #a5d6ff;
    background: rgba(1, 4, 9, 0.5);
    padding: 2px 6px;
    border-radius: 6px;
}

/* ---------- lineup ---------- */
.glxh-lineup-toolbar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.glxh-lineup-toolbar .glxh-field { margin-bottom: 0; }
.glxh-field--grow { flex: 1 1 220px; max-width: 320px; }

.glxh-squad-seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: rgba(1, 4, 9, 0.45); border: 1px solid var(--g-line-2); }

.glxh-squad-seg button {
    width: 42px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--g-muted);
    font-weight: 800;
    cursor: pointer;
}

.glxh-squad-seg button:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.06); }
.glxh-squad-seg button.active { color: #0d1117; background: #f0f6fc; }
.glxh-squad-seg button:disabled { cursor: not-allowed; opacity: 0.6; }
.glxh-squad-seg button.active:disabled { opacity: 1; }

.glxh-lineup-meta { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.glxh-lineup-meta > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.glxh-lineup-meta small { font-size: 0.66rem; font-weight: 700; color: var(--g-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.glxh-lineup-meta b { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.glxh-lineup { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* perspective pitch, like the in-game squad screen */
.glxh-pitch { position: relative; width: 100%; aspect-ratio: 10 / 8.4; }

.glxh-pitch-grass {
    position: absolute;
    inset: 0 0 3% 0;
    clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0 10%, transparent 10% 20%),
        linear-gradient(180deg, #3f8a2a, #4c9a33 55%, #57a83a);
}

.glxh-pitch::after {
    /* the pitch edge seen in perspective */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3%;
    background: #2d6a1f;
    border-radius: 0 0 6px 6px;
}

.glxh-pitch-grass i { position: absolute; display: block; border: 2px solid rgba(255, 255, 255, 0.55); }
.glxh-pitch-grass .glxh-pitch-mid { left: 0; right: 0; top: 42%; height: 0; border-width: 2px 0 0; }
.glxh-pitch-grass .glxh-pitch-circle { left: 50%; top: 42%; width: 17%; height: 15%; border-radius: 50%; transform: translate(-50%, -50%); }
.glxh-pitch-grass .glxh-pitch-box { left: 30%; right: 30%; }
.glxh-pitch-grass .glxh-pitch-box--top { top: -2px; height: 9%; left: 34%; right: 34%; border-top: 0; }
.glxh-pitch-grass .glxh-pitch-box--bot { bottom: -2px; height: 19%; left: 27%; right: 27%; border-bottom: 0; }
.glxh-pitch-grass .glxh-pitch-six--top { top: -2px; height: 4%; left: 42%; right: 42%; border-top: 0; }
.glxh-pitch-grass .glxh-pitch-six--bot { bottom: -2px; height: 8%; left: 38%; right: 38%; border-bottom: 0; }

.glxh-pitch-players { position: absolute; inset: 0; }
.glxh-pitch-empty { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.8); font-size: 0.85rem; }

.glxh-pp {
    position: absolute;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transform: translate(-50%, -78%) scale(var(--s, 1));
    transform-origin: 50% 80%;
}

.glxh-pp-face { position: relative; width: 52px; height: 52px; }

.glxh-pp-img,
.glxh-rr-face {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #e6edf3, #8b949e);
}

.glxh-pp-img { width: 52px; height: 52px; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.85); }
.glxh-pp-img img,
.glxh-rr-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }

.glxh-pp-img .face-fallback,
.glxh-rr-face .face-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #0d1117;
}

.glxh-pp-img .face-fallback { font-size: 0.9rem; }

.glxh-pp-ovr {
    position: absolute;
    right: -24px;
    top: 10px;
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    font-variant-numeric: tabular-nums;
}

.glxh-pp-cap {
    position: absolute;
    left: -4px;
    top: -2px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    font-weight: 900;
    color: #fff;
    background: #1f2328;
    box-shadow: 0 0 0 1.5px #ffd76a;
}

.glxh-pp-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 2px 6px 2px 3px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: rgba(1, 4, 9, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glxh-pp-pos {
    flex-shrink: 0;
    font-style: normal;
    font-size: 0.56rem;
    font-weight: 900;
    padding: 1px 3px;
    border-radius: 3px;
    color: #fff;
    background: #484f58;
}

/* position colours shared by the pitch and the roster (game colours) */
.glxh-pos-t--gk { --pc: #e3a008; }
.glxh-pos-t--df { --pc: #2f81f7; }
.glxh-pos-t--mf { --pc: #2ea043; }
.glxh-pos-t--fw { --pc: #f85149; }
.glxh-pp-pos[class*="glxh-pos-t--"] { background: var(--pc, #484f58); }

/* roster beside the pitch */
.glxh-roster { border-radius: 14px; background: var(--g-surface); border: 1px solid var(--g-line); overflow: hidden; }

.glxh-roster-head,
.glxh-rr {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 42px 30px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.glxh-roster-head {
    height: 34px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--g-dim);
    border-bottom: 1px solid var(--g-line);
}

.glxh-roster-head span:nth-child(3) { text-align: right; }
.glxh-rr { height: 42px; font-size: 0.82rem; }
.glxh-rr + .glxh-rr { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.glxh-rr:hover { background: rgba(255, 255, 255, 0.03); }

.glxh-rr-pos {
    font-size: 0.8rem;
    font-weight: 900;
    padding-left: 7px;
    border-left: 3px solid var(--pc, #484f58);
    line-height: 1.2;
}

.glxh-rr-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.glxh-rr-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glxh-rr-face { width: 28px; height: 28px; flex-shrink: 0; }
.glxh-rr-face .face-fallback { font-size: 0.6rem; }

.glxh-rr-cap {
    flex-shrink: 0;
    font-style: normal;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    color: #ffd76a;
    box-shadow: inset 0 0 0 1px rgba(255, 215, 106, 0.6);
}

.glxh-rr-ovr { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.glxh-grade {
    justify-self: end;
    width: 24px;
    height: 18px;
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-size: 0.68rem;
    font-weight: 900;
    color: #fff;
    background: #484f58;
}

.glxh-grade--bronze { background: linear-gradient(180deg, #c98a5a, #8a5232); }
.glxh-grade--silver { background: linear-gradient(180deg, #c9d1d9, #7d8590); color: #0d1117; }
.glxh-grade--gold { background: linear-gradient(180deg, #ffd76a, #d29922); color: #3b2a00; }

.glxh-roster-sub {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--g-line);
    border-bottom: 1px solid var(--g-line);
}

.glxh-lineup-note { margin: 12px 0 0; font-size: 0.72rem; color: var(--g-dim); }

.glxh-pos {
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 0.64rem;
    font-weight: 800;
    color: #fff;
    background: #30363d;
}

/* ---------- in-match tactic rules ---------- */
.glxh-master {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--g-line);
    background: var(--g-surface);
    transition: border-color 0.2s, background 0.2s;
}

.glxh-master.is-on {
    border-color: rgba(63, 185, 80, 0.35);
    background: linear-gradient(90deg, rgba(63, 185, 80, 0.1), transparent 70%), var(--g-surface);
}

.glxh-master-text { flex: 1; min-width: 0; }
.glxh-master-text strong { font-size: 0.92rem; }
.glxh-master-text p { margin: 3px 0 0; font-size: 0.76rem; color: var(--g-muted); }

.glxh-save-state { font-size: 0.74rem; color: var(--g-muted); white-space: nowrap; }
.glxh-save-state.is-ok { color: #7ee2a8; }
.glxh-save-state.is-err { color: var(--g-loss); white-space: normal; }

.glxh-rules-head,
.glxh-rule {
    display: grid;
    grid-template-columns: 60px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.glxh-rules-head {
    padding: 16px 14px 8px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--g-dim);
}

.glxh-col-ment { color: #ff7b72; }

.glxh-rules { display: flex; flex-direction: column; gap: 6px; transition: opacity 0.2s; }
.glxh-rules.is-off { opacity: 0.55; }

.glxh-rule {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.glxh-rule:hover { border-color: var(--g-line-2); }
.glxh-rule.is-disabled .glxh-rule-cond,
.glxh-rule.is-disabled .glxh-rule-tac,
.glxh-rule.is-disabled .glxh-ment { opacity: 0.45; }

.glxh-rule.is-active {
    border-color: rgba(63, 185, 80, 0.55);
    background: linear-gradient(90deg, rgba(63, 185, 80, 0.14), rgba(63, 185, 80, 0.03)), var(--g-surface);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.08);
}

.glxh-rule-n { display: flex; align-items: center; gap: 8px; }

#glxhTab .glxh-rule-n input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 5px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

#glxhTab .glxh-rule-n input[type="checkbox"]::after {
    content: '';
    width: 9px;
    height: 5px;
    border: 2px solid #fff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
}

#glxhTab .glxh-rule-n input[type="checkbox"]:checked { background: #238636; border-color: #2ea043; }
#glxhTab .glxh-rule-n input[type="checkbox"]:checked::after { opacity: 1; }
#glxhTab .glxh-rule-n input[type="checkbox"]:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

.glxh-rule-n b {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--g-muted);
    background: rgba(255, 255, 255, 0.06);
}

.glxh-rule.is-active .glxh-rule-n b { color: #fff; background: #238636; }

.glxh-rule-cond { min-width: 0; }
.glxh-rule-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.86rem; font-weight: 700; }

.glxh-level { font-size: 0.62rem; font-weight: 800; padding: 2px 6px; border-radius: 5px; letter-spacing: 0.04em; }
.glxh-level--1 { color: #79c0ff; background: rgba(88, 166, 255, 0.14); }
.glxh-level--2 { color: #d2a8ff; background: rgba(163, 113, 247, 0.16); }

.glxh-rule-hint { display: block; margin-top: 2px; font-size: 0.7rem; color: var(--g-dim); }

.glxh-rule-params { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; font-size: 0.74rem; color: var(--g-muted); }
#glxhTab .glxh-rule-params input[type="number"] { width: 58px; height: 30px; padding: 0 8px; text-align: center; }
#glxhTab .glxh-rule-params select { width: auto; min-width: 88px; height: 30px; }

.glxh-rule-tac { min-width: 0; }

.glxh-ment { position: relative; display: flex; align-items: center; min-width: 0; }

.glxh-ment-dot {
    position: absolute;
    left: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

#glxhTab .glxh-ment select { padding-left: 32px; }

/* defensive mentality scale: 1 = park the bus (cold) … 7 = all-out attack (hot) */
.glxh-m1 { --m: #388bfd; }
.glxh-m2 { --m: #39c5cf; }
.glxh-m3 { --m: #3fb950; }
.glxh-m4 { --m: #a3b1c2; }
.glxh-m5 { --m: #e3b341; }
.glxh-m6 { --m: #f0883e; }
.glxh-m7 { --m: #f85149; }
.glxh-ment-dot[class*="glxh-m"],
.glxh-mdot[class*="glxh-m"] { background: var(--m); box-shadow: 0 0 8px color-mix(in srgb, var(--m) 60%, transparent); }
.glxh-mdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #484f58; }

.glxh-rules-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }

/* substitutions (≤ 6 rows) — rows reuse the rule row look */
.glxh-subs-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--g-line); }
.glxh-subs-title { display: flex; align-items: center; gap: 10px; }
.glxh-subs-title strong { font-size: 0.95rem; }
.glxh-subs-title strong i { color: var(--g-accent); margin-right: 6px; }
.glxh-subs-count { font-size: 0.7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: var(--g-muted); background: rgba(255, 255, 255, 0.06); }
.glxh-subs-note { margin: 6px 0 0; font-size: 0.74rem; color: var(--g-muted); line-height: 1.55; }
.glxh-subs-head,
.glxh-rule.glxh-sub {
    display: grid;
    grid-template-columns: 60px 96px minmax(0, 1fr) minmax(0, 1fr) 132px;
    gap: 12px;
    align-items: center;
}
.glxh-subs-head { padding: 14px 14px 8px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--g-dim); }
.glxh-subs { display: flex; flex-direction: column; gap: 6px; }
.glxh-subs-empty { padding: 12px 14px; font-size: 0.8rem; }
#glxhTab .glxh-sub-min input[type="number"] { text-align: center; }
.glxh-rule.glxh-sub.is-disabled .glxh-sub-min,
.glxh-rule.glxh-sub.is-disabled .glxh-sub-out,
.glxh-rule.glxh-sub.is-disabled .glxh-sub-in { opacity: 0.45; }
.glxh-sub-out, .glxh-sub-in, .glxh-sub-min { min-width: 0; }
.glxh-sub-tail { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.glxh-sub-state { font-size: 0.68rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.glxh-sub-state:empty { display: none; }
.glxh-sub-state.is-sent { color: #79c0ff; background: rgba(88, 166, 255, 0.14); }
.glxh-sub-state.is-ok { color: #7ee2a8; background: rgba(63, 185, 80, 0.16); }
.glxh-sub-state.is-wait { color: #e3b341; background: rgba(227, 179, 65, 0.14); }
.glxh-sub-state.is-skip { color: #ff7b72; background: rgba(248, 81, 73, 0.14); }
#glxhTab .glxh-sub-del {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; cursor: pointer;
    color: var(--g-muted); background: transparent; border: 1px solid var(--g-line-2);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#glxhTab .glxh-sub-del:hover { color: #ff7b72; border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.08); }
.glxh-subs-add { margin-top: 10px; }
.glxh-subs-add:disabled { opacity: 0.45; cursor: not-allowed; }
.glxh-rules-foot p { margin: 0; font-size: 0.74rem; color: var(--g-muted); line-height: 1.55; }
.glxh-rules-foot p i { color: var(--g-accent); margin-right: 4px; }
.glxh-rules-foot b { color: var(--g-text); }

/* ---------- history ---------- */
.glxh-hist-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.glxh-hist-summary:empty { display: none; }

.glxh-hs { padding: 12px; border-radius: 12px; background: var(--g-surface); border: 1px solid var(--g-line); min-width: 0; }
.glxh-hs small { display: block; font-size: 0.64rem; font-weight: 700; color: var(--g-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.glxh-hs b { display: block; margin-top: 4px; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.glxh-hs b span { font-size: 0.78rem; color: var(--g-muted); font-weight: 600; }

.glxh-table-wrap { border-radius: 14px; border: 1px solid var(--g-line); background: var(--g-surface); overflow: auto; max-height: 540px; }
.glxh-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

.glxh-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--g-dim);
    background: #161b22;
    border-bottom: 1px solid var(--g-line);
}

.glxh-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); white-space: nowrap; }
.glxh-table td small { display: block; font-size: 0.68rem; color: var(--g-dim); }
.glxh-table tbody tr:last-child td { border-bottom: 0; }

.glxh-res-row { cursor: pointer; transition: background 0.15s; }
.glxh-res-row:hover { background: rgba(255, 255, 255, 0.03); }
.glxh-res-row.is-open { background: rgba(88, 166, 255, 0.06); }
.glxh-res-row td:last-child { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

.glxh-res { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 0.72rem; font-weight: 800; }
.glxh-res--T { color: var(--g-win); background: rgba(63, 185, 80, 0.14); }
.glxh-res--H { color: #e3b341; background: rgba(210, 153, 34, 0.14); }
.glxh-res--B { color: var(--g-loss); background: rgba(248, 81, 73, 0.12); }

.glxh-awarded { margin-left: 6px; font-size: 0.64rem; font-weight: 800; color: #ffd76a; }
.glxh-score-cell { font-weight: 800; font-variant-numeric: tabular-nums; }
.glxh-pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.glxh-pts--up { color: var(--g-win); }
.glxh-pts--down { color: var(--g-loss); }

.glxh-res-detail > td { padding: 0 !important; white-space: normal !important; background: rgba(1, 4, 9, 0.3); }

.glxh-detail { padding: 14px 16px 16px; display: grid; gap: 12px; }
.glxh-detail-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.8rem; color: var(--g-muted); }
.glxh-detail-head b { color: var(--g-text); }
.glxh-detail-sub { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--g-dim); }
.glxh-detail .glxh-stats { padding: 0; }
.glxh-detail .glxh-players { padding: 0; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.glxh-detail-changes { display: flex; flex-wrap: wrap; gap: 6px; }
.glxh-detail-change { font-size: 0.72rem; padding: 4px 8px; border-radius: 6px; color: #79c0ff; background: rgba(88, 166, 255, 0.1); }

.glxh-muted { font-size: 0.76rem; color: var(--g-dim); }

/* log */
.glxh-log {
    max-height: 340px;
    overflow-y: auto;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(1, 4, 9, 0.6);
    border: 1px solid var(--g-line);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    line-height: 1.6;
}

.glxh-log-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 1px 0; }
.glxh-log-time { color: #484f58; }
.glxh-log-text { color: #c9d1d9; overflow-wrap: anywhere; }
.glxh-log-line--ok .glxh-log-text { color: #7ee2a8; }
.glxh-log-line--warn .glxh-log-text { color: #e3b341; }
.glxh-log-line--err .glxh-log-text { color: #ff7b72; }

/* ---------- animations ---------- */
@keyframes glxhSpin { to { transform: rotate(360deg); } }
@keyframes glxhFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes glxhBlink { 50% { opacity: 0.25; } }
@keyframes glxhPulse { 0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); } }
@keyframes glxhPulseRed { 0% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(248, 81, 73, 0); } 100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0); } }
@keyframes glxhRing { 0% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(88, 166, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); } }
@keyframes glxhFlash { 0% { color: #ffd76a; transform: scale(1.12); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
    #glxhTab *, #glxhTab *::before, #glxhTab *::after { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .glxh-layout { grid-template-columns: minmax(0, 1fr); }
    .glxh-left { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .glxh-lineup { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .glxh-left { grid-template-columns: minmax(0, 1fr); }
    .glxh-head { flex-wrap: wrap; gap: 12px; }
    .glxh-title { flex: 1 1 auto; }
    .glxh-title h2 { font-size: 1.1rem; }
    .glxh-title p { display: none; }
    .glxh-title-icon { width: 40px; height: 40px; }
    .glxh-pill { padding: 0 10px; }
    .glxh-tab { flex: 0 0 auto; padding: 0 12px; }
    .glxh-big-score { font-size: 2.2rem; }
    .glxh-crest { width: 44px; height: 44px; border-radius: 13px; font-size: 1.05rem; }
    .glxh-crest.has-img { width: 52px; height: 52px; border-radius: 0; }
    .glxh-match { padding: 14px; }
    .glxh-step { font-size: 0.64rem; }
    .glxh-using em { margin-left: 0; width: 100%; }
    .glxh-lineup-meta { margin-left: 0; width: 100%; justify-content: space-between; }
    .glxh-lineup-meta > div { align-items: flex-start; }
    .glxh-field--grow { max-width: none; }
    .glxh-pitch { aspect-ratio: 10 / 10; }
    .glxh-pp { width: 64px; }
    .glxh-pp-face, .glxh-pp-img { width: 36px; height: 36px; }
    .glxh-pp-ovr { right: -18px; top: 6px; font-size: 0.78rem; }
    .glxh-pp-name { font-size: 0.58rem; }
    .glxh-pp-pos { display: none; }
    .glxh-hist-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .glxh-segment { display: flex; }
    .glxh-segment button { flex: 1; justify-content: center; padding: 0 8px; }

    /* rules become cards: label row, then one select per line (spec §6.3) */
    .glxh-rules-head { display: none; }

    .glxh-rule {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "n cond" "tac tac" "ment ment";
        gap: 10px 12px;
        padding: 14px;
    }

    .glxh-rule-n { grid-area: n; align-self: start; }
    .glxh-rule-cond { grid-area: cond; }
    .glxh-rule-tac { grid-area: tac; display: flex; align-items: center; gap: 8px; }
    .glxh-ment { grid-area: ment; gap: 8px; }

    .glxh-rule-tac::before,
    .glxh-ment::before {
        content: attr(data-label);
        flex-shrink: 0;
        width: 86px;
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--g-muted);
    }

    .glxh-ment::before { color: #ff7b72; }
    .glxh-ment-dot { left: 106px; }
    .glxh-rules-foot { flex-direction: column; align-items: stretch; }

    /* substitutions as cards */
    .glxh-subs-head { display: none; }
    .glxh-rule.glxh-sub {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "n min tail" "out out out" "in in in";
        gap: 10px 12px;
        padding: 14px;
    }
    .glxh-sub .glxh-rule-n { grid-area: n; }
    .glxh-sub-min { grid-area: min; display: flex; align-items: center; gap: 8px; }
    .glxh-sub-out { grid-area: out; display: flex; align-items: center; gap: 8px; }
    .glxh-sub-in { grid-area: in; display: flex; align-items: center; gap: 8px; }
    .glxh-sub-tail { grid-area: tail; }
    #glxhTab .glxh-sub-min input[type="number"] { width: 72px; }
    .glxh-sub-min::before,
    .glxh-sub-out::before,
    .glxh-sub-in::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--g-muted);
    }
    .glxh-sub-out::before, .glxh-sub-in::before { width: 86px; }
    .glxh-master { flex-wrap: wrap; }
    .glxh-save-state { width: 100%; }
    .glxh-table th, .glxh-table td { padding: 9px 10px; }
}
