/* Ghostline Anti-Cheat. Copyright (c) 2026 Bohdan Shymov. All rights reserved. See LICENSE. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #eef0f3; --text: #16181d; --muted: #646b78;
  --border: #dcdfe5; --accent: #3a5bd9; --accent-text: #ffffff;
  --clean: #2f9e6b; --suspect: #c9a227; --review: #d9822b; --ban: #d23f3f; --shadow: #7a5bd9;
  --radius: 10px; --shadow-1: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #20242d; --text: #e7e9ee; --muted: #9aa2b1;
    --border: #2b303b; --accent: #6f8cff; --accent-text: #0f1115;
    --clean: #3fbf86; --suspect: #e0bb3e; --review: #ef9a4a; --ban: #f06262; --shadow: #a08bff;
    --shadow-1: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #20242d; --text: #e7e9ee; --muted: #9aa2b1;
  --border: #2b303b; --accent: #6f8cff; --accent-text: #0f1115;
  --clean: #3fbf86; --suspect: #e0bb3e; --review: #ef9a4a; --ban: #f06262; --shadow: #a08bff;
  --shadow-1: none; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 22px; margin: 0 0 8px; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .error { color: var(--ban); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; } .logo { color: var(--accent); }
.topbar-right { display: flex; gap: 8px; align-items: center; min-width: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); margin-bottom: 16px; min-width: 0; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }

input, select, button { font: inherit; color: inherit; }
input, select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { background: var(--accent); color: var(--accent-text); border: 1px solid transparent; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
button.danger { background: var(--ban); color: #fff; } button.warn { background: var(--shadow); color: #fff; }
form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#loginForm input, #createForm input { flex: 1 1 220px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
label { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; font-size: 14px; color: var(--text); }
.key { display: block; padding: 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; margin: 8px 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 10px; align-items: center; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar .n { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3ch; text-align: right; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.filters input { flex: 1 1 180px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; } tbody tr:hover { background: var(--surface-2); }
table.compact tbody tr { cursor: default; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; }
.b-Clean { background: var(--clean); } .b-Suspect { background: var(--suspect); color: #1b1b1b; } .b-Review { background: var(--review); }
.b-Ban, .b-Banned { background: var(--ban); } .b-ShadowBanned, .b-Shadow { background: var(--shadow); } .b-None { background: var(--surface-2); color: var(--muted); }
.b-Cheating { background: var(--ban); } .b-Unsure { background: var(--surface-2); color: var(--muted); }
.b-High { background: var(--clean); } .b-Normal { background: var(--accent); } .b-Low { background: var(--review); }

.panel-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.panel-head h2 { margin: 0; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.reasons { margin: 0; padding-left: 18px; } .reasons li { margin: 2px 0; }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.timeline .type { font-weight: 600; color: var(--text); }
.timeline .details { word-break: break-word; margin-top: 2px; }
.pill { font-size: 11px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

.thresholds, .weights { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; width: 100%; }
.thresholds input, .weights input { width: 100%; }
.weights label.changed input, .thresholds label.changed input { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.idlist { margin: 0; padding-left: 18px; max-height: 240px; overflow: auto; } .idlist li { word-break: break-all; }
.idlist li.risky { color: var(--ban); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); z-index: 10; }
[hidden] { display: none !important; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; width: min(760px, 100%); max-height: 100%; overflow: auto; }
#replayCanvas { width: 100%; height: auto; aspect-ratio: 720 / 520; background: var(--surface-2); border-radius: 8px; display: block; }
.replay-controls input[type=range] { flex: 1 1 200px; }
.legend { font-size: 12px; margin-top: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot.focus { background: var(--ban); } .dot.other { background: var(--muted); } .dot.ghost { background: var(--shadow); } .dot.shot { background: var(--suspect); }
.clip-btn { margin-left: auto; padding: 2px 10px; font-size: 12px; }

@media (max-width: 600px) {
  main { padding: 12px 16px; }
  .brand .muted { display: none; }
  #gameSelect { max-width: 120px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar button { padding: 6px 10px; white-space: nowrap; font-size: 13px; }
  .bar { grid-template-columns: 90px 1fr auto; }
}

.stack { display: grid; gap: 10px; }
.keylogin { margin-top: 16px; }
.keylogin summary { cursor: pointer; color: var(--muted); }
.secret { margin: 12px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.secret code { font-size: 1.1rem; letter-spacing: .08em; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }

.card.alert { border-color: var(--ban, #e5484d); }

#demoBtn { width: 100%; margin-top: 10px; }
.readonly [data-mod], .readonly [data-vote], .readonly #waveForm, .readonly #catalogForm, .readonly #exportDossier,
.readonly #newGameBtn, .readonly #rulesForm .row, .readonly #reviewerForm, .readonly .clip-btn ~ button { display: none !important; }

.setup { padding-left: 0; list-style: none; display: grid; gap: 8px; margin: 0; }
.setup li { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.setup li.done { opacity: .6; }

.plain { font-size: .92rem; margin: 2px 0 2px; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 24px; margin: 12px 0; text-align: left; justify-items: start; }
.setting { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; font-size: .95rem; text-align: left; margin: 0; }
.setting input { margin: 0; flex: none; }
.setting input[type=number] { width: 88px; }

.toolrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0; }
.toolrow input[type=url], .toolrow input:not([type]) { min-width: 240px; flex: 1; }
#langSelect { margin-left: 8px; }
