:root {
  --bg: #0a0c12;
  --panel: #141822;
  --panel2: #1c2230;
  --ink: #e8ecf4;
  --dim: #8a93a6;
  --gold: #d9b45b;
  --line: #2a3142;
  --accent: #6ea8fe;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
#app { display: grid; grid-template-columns: 320px 1fr; height: 100vh; }
#sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 18px; }
#stage { position: relative; }
canvas { display: block; width: 100%; height: 100%; cursor: grab; }
canvas:active { cursor: grabbing; }

h1 { font-size: 18px; margin: 0 0 2px; letter-spacing: .3px; }
h1 .em { font-size: 20px; }
.tagline { color: var(--dim); font-size: 12px; margin: 0 0 16px; font-style: italic; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold);
  margin: 20px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.stat .v { font-size: 18px; font-weight: 600; color: var(--ink); }
.stat .k { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }

input[type=text] { width: 100%; background: var(--panel2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 7px; padding: 8px 10px; font-size: 13px; outline: none; }
input[type=text]:focus { border-color: var(--accent); }

.legend, .types { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 14px; padding: 3px 9px; font-size: 11px;
  cursor: pointer; user-select: none; color: var(--dim); }
.chip.on { color: var(--ink); border-color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.rank-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.rank-row:hover { color: var(--gold); }
.rank-row .bar { height: 6px; background: var(--accent); border-radius: 3px; flex: 0 0 auto; min-width: 2px; }
.rank-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

#dossier { position: absolute; top: 14px; right: 14px; width: 300px; max-height: calc(100vh - 28px);
  overflow-y: auto; background: rgba(20,24,34,.96); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; backdrop-filter: blur(8px); display: none; }
#dossier.show { display: block; }
#dossier h3 { margin: 0 0 4px; font-size: 15px; }
#dossier .type-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 7px; border-radius: 10px; background: var(--panel2); color: var(--gold); }
#dossier .metric { display: flex; justify-content: space-between; font-size: 12px;
  padding: 4px 0; border-bottom: 1px solid var(--line); }
#dossier .metric .dim { color: var(--dim); }
#dossier .close { float: right; cursor: pointer; color: var(--dim); font-size: 18px; line-height: 1; }
.nbr { font-size: 11px; color: var(--accent); cursor: pointer; padding: 2px 0; }
.nbr:hover { color: var(--gold); }

.btn { background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 7px; padding: 7px 12px; font-size: 12px; cursor: pointer; width: 100%; margin-top: 6px; }
.btn:hover { border-color: var(--accent); }
.path-hint { font-size: 11px; color: var(--dim); margin-top: 6px; min-height: 14px; }
#toast { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); padding: 8px 16px; border-radius: 20px;
  font-size: 12px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.show { opacity: 1; }
.hud { position: absolute; bottom: 14px; left: 14px; font-size: 11px; color: var(--dim);
  background: rgba(20,24,34,.7); padding: 5px 10px; border-radius: 8px; }
.footer { margin-top: 24px; font-size: 10px; color: var(--dim); line-height: 1.5; }
.footer a { color: var(--accent); text-decoration: none; }
