:root {
    --bg: #0e1014;
    --panel: #161920;
    --panel-2: #1c2029;
    --line: #262b36;
    --text: #e6e8ee;
    --muted: #8a92a5;
    --accent: #e0a43a;
    --accent-2: #f2c066;
    --discord: #5865f2;
    --danger: #e5604d;
    --radius: 8px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
code { font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    padding: 8px 14px; border-radius: var(--radius); font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #3a4152; }
.btn-ghost { background: transparent; }
.btn-discord { background: var(--discord); border-color: var(--discord); color: #fff; padding: 11px 18px; }
.btn-discord:hover { background: #4752c4; }
.btn-discord svg { width: 20px; height: 20px; }

/* ── Login / sem acesso ─────────────────────────────── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
    width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line);
    border-radius: 14px; padding: 32px 28px; text-align: center;
}
.gate-logo { width: 64px; height: 64px; object-fit: contain; }
.gate-card h1 { font-size: 20px; margin: 12px 0 6px; }
.gate-card p { margin: 0 0 22px; }
.gate-error { color: var(--danger); }

/* ── Barra de cima ─────────────────────────────────── */
.top {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 24px;
    padding: 10px 20px; background: rgba(14, 16, 20, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.tabs { display: flex; gap: 4px; }
.tabs button {
    background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
}
.tabs button:hover { color: var(--text); background: var(--panel); }
.tabs button[aria-selected="true"] { color: var(--accent-2); background: var(--panel-2); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.me-text small { font-size: 11.5px; }
.me form { margin: 0; }

/* ── Filtros ───────────────────────────────────────── */
.wrap { padding: 16px 20px 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 380px; display: flex; gap: 6px; }
.search input { flex: 1; }
input, select {
    background: var(--panel); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 8px 10px; font: inherit; min-height: 37px;
}
input:focus, select:focus { outline: 2px solid rgba(224, 164, 58, .45); outline-offset: 0; border-color: var(--accent); }
.dates { display: flex; align-items: center; gap: 6px; }
.live { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; user-select: none; }
.live input { min-height: 0; accent-color: var(--accent); }

.help {
    margin-top: 10px; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px 16px;
}
.help p { margin: 4px 0 10px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 18px; }

.status { display: flex; gap: 14px; align-items: baseline; margin: 14px 2px 8px; min-height: 20px; }
.notes { color: var(--accent-2); }

/* ── Tabela ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
table.loading tbody { opacity: .45; transition: opacity .15s; }
th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .02); }
td.empty { text-align: center; color: var(--muted); padding: 48px 12px; }

.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.when .date { display: block; color: var(--muted); font-size: 12px; }
.when small { color: var(--muted); }
.idc { white-space: nowrap; font-variant-numeric: tabular-nums; }
.what { white-space: nowrap; }
.who { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ident { display: flex; align-items: center; gap: 4px; font-size: 12px; max-width: 220px; }

.chip {
    background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
    text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.chip:hover { color: var(--accent-2); text-decoration: underline; }
.chip.sid { font-weight: 600; }
.chip.cid { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.chip.link { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.copy { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 13px; opacity: .6; }
.copy:hover { opacity: 1; color: var(--text); }

.ic { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.ic-discord { background: var(--discord); }
.ic-steam { background: #66c0f4; }

.pill {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: rgba(224, 164, 58, .12); color: var(--accent-2); white-space: nowrap; cursor: pointer;
}
.pill:hover { background: rgba(224, 164, 58, .22); }

.dcell { min-width: 260px; max-width: 520px; }
.det-head { display: flex; gap: 6px; cursor: pointer; min-width: 0; }
.det-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chev { color: var(--muted); transition: transform .12s; flex: none; }
.det-body { display: none; margin-top: 6px; }
.det.open .det-short { display: none; }
.det.open .chev { transform: rotate(90deg); }
.det.open .det-body { display: block; }
.det-body > div { margin-bottom: 6px; }
.dtext { white-space: pre-wrap; word-break: break-word; }
.move { color: var(--accent-2); }
.kv { font-size: 12.5px; word-break: break-word; }
.kv span { color: var(--muted); }
.kv ul { margin: 2px 0 4px; padding-left: 18px; }

/* ── Paginas ───────────────────────────────────────── */
.pager { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager button {
    min-width: 36px; height: 34px; padding: 0 10px; border-radius: var(--radius);
    background: var(--panel); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: #3a4152; }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #17130a; font-weight: 700; }
.pager button:disabled { opacity: .35; cursor: default; }
.pager .gap { color: var(--muted); align-self: center; padding: 0 4px; }

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--panel-2); border: 1px solid var(--line); padding: 8px 16px; border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

/* ── Jogadores ─────────────────────────────────────── */
.prof { text-decoration: none; margin-right: 5px; font-size: 12px; opacity: .65; }
.prof:hover { opacity: 1; }

.presults { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.pempty { color: var(--muted); padding: 40px 12px; text-align: center; grid-column: 1 / -1; }
.pcard {
    display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; color: var(--text); font: inherit;
}
.pcard:hover { border-color: var(--accent); }
.pcard-name { font-weight: 700; font-size: 15px; }
.pcard-chars, .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.pcard-meta span { display: inline-flex; align-items: center; gap: 5px; }

.tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
    background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; white-space: nowrap;
}
.tag small { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.tag-ok { color: #6fd39a; border-color: rgba(111, 211, 154, .35); }
.tag-no { color: var(--danger); border-color: rgba(229, 96, 77, .35); }

.badge { display: inline-block; vertical-align: middle; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.badge-red { background: rgba(229, 96, 77, .18); color: #ff8a78; }
.badge-amber { background: rgba(224, 164, 58, .16); color: var(--accent-2); }

.pbar { margin-bottom: 10px; }
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 12px; min-width: 0;
}
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.card h3:not(:first-child) { margin-top: 16px; }

.phead { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; }
.pavatar { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--panel-2); }
.pavatar-empty { display: grid; place-items: center; font-size: 30px; color: var(--muted); }
.phead h2 { margin: 0 0 10px; font-size: 20px; }
.pstats { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.pstats div { display: flex; flex-direction: column; }
.pstats span { font-size: 11.5px; color: var(--muted); }
.plinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.plinks .btn { padding: 6px 12px; font-size: 13px; }
.pids { display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-width: 0; max-width: 420px; }
.idrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.idrow > span { width: 62px; flex: none; }
.idrow code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pflag { border-color: rgba(224, 164, 58, .45); }

.pchars { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pchars button {
    background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius);
    padding: 7px 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.pchars button small { font-weight: 400; font-family: ui-monospace, Consolas, monospace; }
.pchars button[aria-selected="true"] { color: var(--accent-2); border-color: var(--accent); background: var(--panel-2); }

.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 12px; }
.pgrid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 0 12px; }
.kvlist > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kvlist > div:last-child { border-bottom: 0; }
.kvlist span { color: var(--muted); }
.kvlist b { text-align: right; font-weight: 600; word-break: break-word; }
.kvlist.money b { color: #6fd39a; font-variant-numeric: tabular-nums; }

.sbar { display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 8px; margin: 6px 0; font-size: 12.5px; }
.sbar span { color: var(--muted); }
.sbar b { text-align: right; font-variant-numeric: tabular-nums; }
.sbar progress { width: 100%; height: 7px; appearance: none; border: 0; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.sbar progress::-webkit-progress-bar { background: var(--panel-2); border-radius: 99px; }
.sbar progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.sbar progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { position: static; padding: 7px 10px; font-size: 11px; }
table.mini td { padding: 7px 10px; }
table.mini tr:last-child td { border-bottom: 0; }
.card .table-wrap { background: transparent; }
.row-red td { background: rgba(229, 96, 77, .07); }
.nowrap { white-space: nowrap; }

.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.inv-item {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px;
}
.inv-item code { background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-item { flex-wrap: wrap; }
.inv-item small { flex-basis: 100%; font-size: 11px; overflow-wrap: anywhere; }
.card h4 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 10px 0 6px; }
.dsearch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.dsearch input[type="search"] { flex: 1 1 280px; min-width: 0; }
#dstatus { margin: 0 0 6px; }
[data-dmore] { margin-top: 8px; }
details.death { border-top: 1px solid var(--line); padding: 8px 0; }
details.death:first-of-type { border-top: 0; }
details.death summary { cursor: pointer; margin-bottom: 6px; }
details.death .inv { margin-top: 6px; }

@media (max-width: 900px) {
    .phead { grid-template-columns: auto 1fr; }
    .pids { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 760px) {
    .top { flex-wrap: wrap; gap: 10px; }
    .me-text { display: none; }
}
