:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #e8b85a;
  --high: #ef5f5f;
  --medium: #e8a23a;
  --low: #5a9be8;
  --good: #4fbf7a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.top {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: .02em; }
.brand::before { content: '💀 '; }
.report-form { display: flex; gap: 8px; flex: 1; min-width: 260px; max-width: 640px; }
input, select, button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
input { flex: 1; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { cursor: pointer; background: var(--accent); color: #1a1408; border-color: var(--accent); font-weight: 700; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); font-weight: 500; }
button:disabled { opacity: .5; cursor: progress; }

.crumbs { padding: 10px 24px 0; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); }
.crumbs span.sep { margin: 0 6px; }
main { flex: 1; padding: 16px 24px 40px; max-width: 1400px; width: 100%; margin: 0 auto; }
.foot { padding: 10px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card .v { font-size: 22px; font-weight: 700; }
.card .k { color: var(--muted); font-size: 12px; }
.card .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.enc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.enc { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); }
.enc:hover { border-color: var(--accent); text-decoration: none; }
.enc .name { font-weight: 700; font-size: 15px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.kill { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.tag.high { color: var(--high); border-color: color-mix(in srgb, var(--high) 50%, transparent); }
.tag.medium { color: var(--medium); border-color: color-mix(in srgb, var(--medium) 50%, transparent); }
.tag.low { color: var(--low); border-color: color-mix(in srgb, var(--low) 50%, transparent); }

.recs { display: grid; gap: 8px; }
.rec { border-left: 3px solid var(--low); background: var(--panel-2); padding: 10px 12px; border-radius: 0 8px 8px 0; }
.rec.high { border-color: var(--high); }
.rec.medium { border-color: var(--medium); }
.rec .t { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.rec .d { color: #c3c8d4; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.scroll { overflow-x: auto; }

.ab { display: inline-flex; align-items: center; gap: 6px; }
.ab img { width: 18px; height: 18px; border-radius: 3px; }
.bar { position: relative; height: 6px; background: var(--panel-2); border-radius: 3px; min-width: 60px; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.bar.red > i { background: var(--high); }
.bar.blue > i { background: var(--low); }

.timeline svg, .progress svg { width: 100%; height: auto; display: block; }
.timeline text, .progress text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

.recap { font-size: 12px; margin: 4px 0 2px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recap ol { margin: 0; padding-left: 18px; }
details > summary { cursor: pointer; }
.error { background: color-mix(in srgb, var(--high) 15%, var(--panel)); border: 1px solid var(--high); padding: 12px 14px; border-radius: var(--radius); }
.loading { color: var(--muted); padding: 30px 0; }
.loading::before { content: ''; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; margin-right: 8px; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.steps { padding-left: 20px; }
.steps li { margin: 4px 0; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 640px) {
  .top, main, .crumbs, .foot { padding-left: 16px; padding-right: 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .recap { grid-template-columns: 1fr; }
}

.tag.info { color: var(--low); border-color: color-mix(in srgb, var(--low) 50%, transparent); }
tr.explain td { font-size: 12px; color: #c3c8d4; background: var(--panel-2); border-left: 3px solid var(--low); padding: 8px 10px; }
.causes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cause { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 4px; border: 1px solid var(--line); border-radius: 99px; }
.cause.avoid { border-color: var(--high); color: #ffb3b3; }

a.spell { color: inherit; text-decoration: underline dotted color-mix(in srgb, currentColor 50%, transparent); text-underline-offset: 3px; }
a.spell:hover { color: var(--accent); }
.ab a.spell { display: inline-flex; align-items: center; gap: 6px; }

.job { padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.job:last-of-type { border-bottom: 0; }
.job-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.job .desc { margin: 4px 0 8px; max-width: 900px; }
table.compact th, table.compact td { padding: 4px 8px; }
tr.muted td { color: var(--muted); }

.pulls { display: flex; flex-wrap: wrap; gap: 8px; }
.pull { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; font-size: 13px; }
.pull.off { opacity: .45; text-decoration: line-through; }
.pull input { margin: 0; accent-color: var(--accent); }

.fav-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.fav { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.fav-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.fav .fav-body { min-height: 40px; }
.fav .fav-body.loading { padding: 10px 0; }
.fav table td, .fav table th { padding: 4px 6px; }
button.small { padding: 2px 8px; font-size: 12px; }
.nav-fav { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .fav-grid { grid-template-columns: 1fr; } }

.soak { margin-top: 10px; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; }
.soak h3 { margin-bottom: 4px; }
.soak details { margin-top: 8px; }

tr.missed td { background: color-mix(in srgb, var(--high) 12%, transparent); }

tr.expandable { cursor: pointer; }
tr.expandable:hover td { background: var(--panel-2); }
.hint { margin-left: 6px; font-size: 11px; color: var(--low); white-space: nowrap; }
tr.expandable.open .hint { color: var(--muted); }
tr.explain[hidden] { display: none; }

ul.todo { list-style: none; margin: 0; padding: 0; }
ul.todo li { padding: 6px 0; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
ul.todo li:first-child { border-top: 0; }

/* TL;DR flags are sentences: wrap them rather than scroll */
#tldr .scroll { overflow-x: visible; }
#tldr table { table-layout: auto; width: 100%; }
#tldr td.small { white-space: normal; }
#tldr .tag { display: inline-block; white-space: normal; max-width: 100%; border-radius: 12px; line-height: 1.4; margin: 1px 0; }

/* Screenshot mode (the server captures this view for Discord) */
body.shot .top, body.shot .crumbs, body.shot .foot, body.shot #app > :not(#compare) { display: none; }
body.shot #compare header .row { display: none; }
body.shot main#app { max-width: 1100px; margin: 0; padding: 12px; }
body.shot .scroll { overflow: visible; }
body.shot #compare > p.muted { display: none; }

a.guide { margin-left: 8px; font-size: 11px; white-space: nowrap; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(560px, 90vw); padding: 10px 14px; background: var(--panel-2, #20242d); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
#toast.show { opacity: 1; }

ul.fixfirst { margin: 0; padding-left: 18px; }
ul.fixfirst li { padding: 3px 0; }
ul.fixfirst li .muted { font-size: 11px; }

.who { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who .avatar { width: 22px; height: 22px; border-radius: 50%; }
body.signed-out .report-form, body.signed-out .nav-fav, body.signed-out #crumbs { display: none; }
a.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; background: #5865f2; color: #fff; font-weight: 600; text-decoration: none; }
a.btn:hover { filter: brightness(1.1); }
