:root {
  --bg: #06080e; --panel: rgba(12, 16, 28, 0.86); --panel2: rgba(18, 24, 40, 0.92); --line: #26314d; --ink: #e9edf8; --dim: #8f9ab6;
  --faint: #5d6886; --gold: #ffc448; --cyan: #00e5ff; --green: #39ff88; --pink: #ff4fa3; --violet: #b388ff; --blue: #468cff; --red: #ff5a5a;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden;
  font: 14px/1.5 Inter, "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
button, input, select { font: inherit; color: inherit; }

/* top bar */
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: linear-gradient(#06080ef0, #06080e00); }
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 16px; letter-spacing: .3px; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.brand b { color: var(--gold); font-weight: 700; }
#nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
#nav::-webkit-scrollbar { display: none; }
#nav button { background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; color: var(--dim);
  cursor: pointer; white-space: nowrap; transition: .2s; }
#nav button:hover { color: var(--ink); background: #ffffff0d; }
#nav button.on { color: var(--bg); background: var(--gold); font-weight: 600; }
.search { position: relative; width: 260px; flex: none; }
.search input { width: 100%; background: #0c1222cc; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; outline: none; }
.search input:focus { border-color: var(--cyan); }
#qres { position: absolute; top: 38px; right: 0; width: 340px; max-width: calc(100vw - 32px); max-height: 50vh; overflow: auto; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; display: none; }
#qres div { padding: 7px 12px; cursor: pointer; border-bottom: 1px solid #ffffff08; }
#qres div:hover, #qres div.sel { background: #ffffff10; }
#qres small { color: var(--dim); margin-left: 6px; }

/* side panel */
#panel { position: fixed; top: 64px; left: 16px; bottom: 16px; width: 430px; z-index: 4; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; overflow: hidden; }
#fold { display: none; }
#content { overflow-y: auto; padding: 20px 22px 26px; scrollbar-width: thin; scrollbar-color: #33405f transparent; }
#content h1 { font-size: 26px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -.3px; }
#content h2 { font-size: 15px; margin: 22px 0 8px; color: var(--ink); }
#content p { color: #c4cbe0; margin: 8px 0; }
#content .lead { color: var(--dim); font-size: 15px; margin-top: 0; }
.kick { color: var(--gold); font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 600; margin-bottom: 6px; }
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.big div { background: #ffffff06; border: 1px solid #ffffff0d; border-radius: 12px; padding: 10px 12px; }
.big b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.big span { color: var(--dim); font-size: 12px; }
.card { background: #ffffff06; border: 1px solid #ffffff10; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.card h3 { margin: 0 0 4px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.card h3 em { font-style: normal; font-variant-numeric: tabular-nums; }
.card p { margin: 4px 0 0; font-size: 13px; color: var(--dim); }
.row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.sw { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; background: currentColor; }
.bars .b { display: grid; grid-template-columns: 1fr 120px 64px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; cursor: pointer; }
.bars .b:hover .n { color: var(--ink); }
.bars .b.on { color: var(--gold); }
.bars .n { color: #c4cbe0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .t { height: 7px; background: #ffffff0d; border-radius: 4px; overflow: hidden; }
.bars .t i { display: block; height: 100%; border-radius: 4px; background: var(--gold); }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.tog { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tog button, .chip { background: #ffffff08; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 12.5px; color: var(--dim); }
.tog button.on, .chip.on { color: var(--ink); border-color: currentColor; background: #ffffff10; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 6px; border-bottom: 1px solid #ffffff10; }
th { color: var(--dim); font-weight: 500; }
td.k, th.k { text-align: right; }
tr.me td { color: var(--gold); font-weight: 600; }
.note { font-size: 12px; color: var(--faint); }
.warn { border-left: 3px solid var(--gold); padding: 6px 10px; background: #ffc4480a; border-radius: 0 8px 8px 0; color: #d9cfae; font-size: 13px; }
.formula { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; background: #000a; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--cyan); overflow-x: auto; white-space: nowrap; }
input[type=range] { width: 100%; accent-color: var(--gold); }
ul.lim { padding-left: 18px; color: #c4cbe0; margin: 6px 0; }
ul.lim li { margin: 4px 0; }
.out { font-size: 14px; line-height: 1.6; color: var(--ink); background: #000a; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; }
.out .cur { display: inline-block; width: 7px; height: 15px; background: var(--gold); vertical-align: -2px; animation: bl 1s steps(2) infinite; }
@keyframes bl { 50% { opacity: 0; } }

/* step view of the writer */
.step { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #ffffff05; }
.step .hd { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.cand { display: grid; grid-template-columns: 1fr 90px 46px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.cand .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c4cbe0; }
.cand .nm small { color: var(--faint); }
.cand .t { height: 7px; background: #ffffff0d; border-radius: 4px; overflow: hidden; }
.cand .t i { display: block; height: 100%; background: #5d6886; border-radius: 4px; }
.cand.ch .nm { color: var(--green); font-weight: 600; }
.cand.ch .t i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.cand.end .nm { color: var(--pink); }
.cand .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.ctl { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.ctl button { background: var(--gold); color: var(--bg); border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
.ctl button.sec { background: #ffffff10; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }

/* floating */
#info { position: fixed; right: 16px; top: 64px; width: 340px; max-height: calc(100vh - 140px); overflow: auto; z-index: 4; background: var(--panel2);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: none; backdrop-filter: blur(10px); }
#info .x { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 20px; color: var(--dim); cursor: pointer; }
#info h3 { margin: 0 24px 4px 0; font-size: 16px; }
#info .meta { color: var(--dim); font-size: 12px; margin-bottom: 8px; }
#info .e { font-size: 12.5px; padding: 2px 0; color: #c4cbe0; cursor: pointer; }
#info .e:hover { color: var(--ink); }
#info .e i { color: var(--cyan); font-style: normal; }
#info .e.h i { color: var(--gold); }
#info a { color: var(--cyan); }
#tip { position: fixed; pointer-events: none; z-index: 6; background: #0b1020ee; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px;
  font-size: 12.5px; display: none; max-width: 340px; }
#tip small { display: block; color: var(--dim); }
#hud { position: fixed; right: 16px; bottom: 14px; z-index: 4; display: flex; gap: 12px; align-items: center; color: var(--dim); font-size: 12px; }
#hud select { background: #0c1222cc; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
#hud label { display: flex; gap: 5px; align-items: center; cursor: pointer; }
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.tag { position: absolute; transform: translate(-50%, -50%); font-size: 11.5px; color: #dfe6ff; text-shadow: 0 0 6px #000, 0 0 2px #000; white-space: nowrap;
  letter-spacing: .2px; transition: opacity .3s; }
.tag.focus { color: var(--gold); font-weight: 700; font-size: 13px; }
.tag.yr { color: var(--gold); font-weight: 600; }
.tag.ax { color: var(--cyan); font-size: 12px; }
.tag.node { color: var(--green); font-size: 12px; font-weight: 600; }
#load { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: grid; place-items: center; transition: opacity .8s; }
.lbox { width: min(360px, 80vw); text-align: center; }
.lt { font-size: 28px; margin-bottom: 18px; } .lt b { color: var(--gold); }
.lbar { height: 3px; background: #ffffff12; border-radius: 3px; overflow: hidden; }
.lbar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
#lmsg { color: var(--dim); font-size: 12px; margin-top: 10px; }

@media (max-width: 860px) {
  #top { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .search { width: 100%; order: 3; }
  #nav { order: 2; flex-basis: 100%; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46vh; border-radius: 16px 16px 0 0; transition: height .3s; }
  #panel.folded { height: 44px; }
  #fold { display: block; position: absolute; right: 10px; top: 6px; z-index: 2; background: #ffffff10; border: 1px solid var(--line); border-radius: 999px;
    width: 32px; height: 32px; cursor: pointer; }
  #panel.folded #fold { transform: rotate(180deg); }
  #content { padding: 14px 16px 20px; }
  #content h1 { font-size: 21px; padding-right: 36px; }
  #info { top: auto; bottom: calc(46vh + 10px); right: 16px; left: 16px; width: auto; max-height: 30vh; }
  #hud { bottom: calc(46vh + 8px); right: 16px; }
  #hud #hudtxt { display: none; }
  .bars .b { grid-template-columns: 1fr 80px 56px; }
}
