:root {
  --bg: #16181b; --panel: #1e2126; --panel2: #24282e; --ink: #e8e6df;
  --muted: #a8aeb4; --faint: #7b828a; --line: #33383e; --accent: #d2564c;
  --accent-soft: #3a2523; --mono: Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.6 "Segoe UI", system-ui, sans-serif; }
a { color: inherit; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }
header.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; flex-direction: column; line-height: 1.05; font-weight: 700; letter-spacing: .12em; text-decoration: none; color: var(--accent); }
.brand .barch { color: var(--muted); font-weight: 400; margin-left: 6px; }
.brand .btag { color: var(--faint); font-weight: 400; font-size: 9.5px; letter-spacing: .26em; margin-top: 3px; }
header.top nav { display: flex; gap: 18px; flex: 1; }
header.top nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
header.top nav a:hover { color: var(--ink); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who a { color: var(--muted); text-decoration: none; }
.who .uname { color: var(--ink); }
.role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; border-radius: 3px; padding: 1px 6px; }
.role-reader { background: #2a2f36; color: var(--muted); }
.role-editor { background: #143a2c; color: #5dcaa5; }
.role-admin { background: var(--accent-soft); color: var(--accent); }
footer { text-align: center; color: var(--faint); font-size: 12.5px; padding: 30px; border-top: 1px solid var(--line); }
h1 { font-size: 26px; margin: 18px 0 8px; } h2 { font-size: 18px; margin: 26px 0 10px; color: var(--muted); }
.small { color: var(--faint); font-size: 12.5px; } .mono { font-family: var(--mono); }
.notice { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); border-radius: 6px; padding: 8px 14px; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
#q, .field { width: 100%; padding: 12px 16px; font-size: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; outline: none; }
#q:focus, .field:focus { border-color: var(--accent); }
.field-sm { padding: 5px 8px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; width: 110px; }
.filters { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kf { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); border-radius: 16px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; }
.kf.sel { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }

.hit { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 10px 0; }
.hit .meta { color: var(--faint); font-size: 12.5px; margin-bottom: 6px; display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.snippet { line-height: 1.7; }
.snippet .ctx { color: var(--muted); }
.snippet .ctxhit { color: var(--ink); }
.snippet mark, .hit mark { background: var(--accent-soft); color: var(--accent); padding: 0 2px; border-radius: 2px; }
.chip { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px; margin: 3px 4px 3px 0; font-size: 13px; text-decoration: none; }
.chip:hover { border-color: var(--accent); }
.chip .k { color: var(--faint); font-size: 11px; margin-left: 6px; }
.tslink { color: var(--accent); text-decoration: none; font-family: var(--mono); font-size: 12.5px; }

.seg { padding: 5px 10px; border-radius: 6px; display: flex; gap: 14px; scroll-margin-top: 130px; }
.seg.active { background: var(--accent-soft); }
.seg.flash { animation: flash 2.5s ease; }
@keyframes flash { 0%,60% { background: var(--accent-soft); } 100% { background: transparent; } }
.seg .t { color: var(--faint); font-family: var(--mono); font-size: 12px; min-width: 52px; cursor: pointer; }
.seg .t:hover { color: var(--accent); }
.seg.banter { opacity: .5; }
.player-wrap { position: sticky; top: 55px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; z-index: 4; display: flex; align-items: center; gap: 16px; }
.player-wrap audio { flex: 1; }
.autojump { font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.rumble-link { color: #85c742; text-decoration: none; font-weight: 500; }
.rumble-link:hover { text-decoration: underline; }
.rumble-btn { border-color: #4a6b2a; color: #85c742; white-space: nowrap; text-decoration: none; }
.rumble-btn:hover { border-color: #85c742; }
.rumble-edit { margin: 8px 0 0; display: flex; gap: 8px; align-items: center; }
.rel { border-left: 3px solid var(--line); padding: 6px 14px; margin: 10px 0; }
.rel .pred { color: var(--accent); font-family: var(--mono); font-size: 13px; }
.rel .status { font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; color: var(--muted); margin-left: 6px; }
.rel .ev { color: var(--muted); font-size: 13.5px; font-style: italic; margin-top: 3px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* autocomplete (shared by home + graph) */
.acwrap { position: relative; }
.acmenu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; z-index: 40; overflow: hidden; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.acitem { padding: 9px 14px; cursor: pointer; font-size: 14px; }
.acitem:hover, .acitem.active { background: var(--accent-soft); }
.acitem .k { color: var(--faint); font-size: 11px; margin-left: 6px; }

/* graph */
.gctrls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.gctrls .acwrap { flex: 1; min-width: 280px; }
.gctrls input#gsearch { width: 100%; padding: 9px 14px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }
.gctrls label { color: var(--muted); font-size: 13px; }
.gctrls select { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
.glegend { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 10px; }
.glegend .lg { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.glegend .lg i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.glegend .lg i.dash { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed #555b63; }
#cywrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; position: relative; }
#cy { height: 74vh; }
.gstatus { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: var(--faint); font-size: 14px; pointer-events: none; }
#cywrap:fullscreen { padding: 0; } #cywrap:fullscreen #cy { height: 100vh; }
#edgeinfo { position: fixed; right: 20px; bottom: 20px; max-width: 400px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: none; z-index: 30; }
#edgeinfo .status { font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; color: var(--muted); }
#edgeinfo .ev { color: var(--muted); font-style: italic; font-size: 13px; margin: 6px 0; }

/* timeline */
.tctrls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 10px 0 14px; }
.tctrls label { color: var(--muted); font-size: 13px; }
.tctrls input, .tctrls select { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }

/* buttons & forms */
.btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 11px 18px; font-size: 15px; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn2 { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.btn2:hover { border-color: var(--accent); } .btn2.danger:hover { border-color: var(--accent); color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 480px; margin-bottom: 20px; }
.inline { display: inline; }
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th { text-align: left; color: var(--faint); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.utable td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.utable select { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 4px; }
textarea.field { font-family: inherit; resize: vertical; }
.tablewrap { overflow-x: auto; }

/* info tooltips */
.info { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-style: italic; font-weight: 700; cursor: help; position: relative; vertical-align: middle; margin-left: 6px; }
.info:hover { border-color: var(--accent); color: var(--accent); }
.info::after { content: attr(data-tip); position: absolute; left: 22px; top: -4px; width: 300px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-style: normal; font-weight: 400; line-height: 1.5; color: var(--ink); z-index: 50; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.info:hover::after { display: block; }
@media (max-width: 700px) { .info::after { left: auto; right: 0; width: 220px; } }

/* captcha */
.captcha { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.captcha label { display: block; margin-bottom: 6px; color: var(--muted); }

/* karaoke word highlight */
.wd { transition: color .1s; }
.wd.wnow { color: var(--accent); font-weight: 600; }

/* manual claim badge */
.badge-manual { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; background: #143a2c; color: #5dcaa5; border-radius: 3px; padding: 1px 6px; margin-left: 6px; }

/* audit log */
.audit td { font-size: 13px; }
.evtag { font-size: 11px; border-radius: 3px; padding: 1px 7px; white-space: nowrap; }
.evtag-ok { background: #143a2c; color: #5dcaa5; }
.evtag-bad { background: var(--accent-soft); color: var(--accent); }
