:root {
  --bg: #1d2024;
  --panel: #24282d;
  --line: #353b42;
  --text: #e6e8eb;
  --dim: #9aa3ad;
  --accent: #5aa9ff;
  --tag: #e8731f;
  --tag-edge: #ff9a52;
  --work: #f5c518;
  --pick: #ffd166;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif; }
body { display: flex; overflow: hidden; }
#side { width: 300px; min-width: 220px; display: flex; flex-direction: column; background: var(--panel);
  border-right: 1px solid var(--line); }
#side header { padding: 12px 12px 8px; border-bottom: 1px solid var(--line); }
#side h1 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
#count { margin: 0 0 8px; color: var(--dim); font-size: 12px; }
#filter { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; }
#list { flex: 1; overflow-y: auto; padding: 4px 0 12px; }
#list h2 { margin: 10px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim); }
#list a { display: flex; justify-content: space-between; gap: 8px; padding: 4px 12px; color: var(--text);
  text-decoration: none; white-space: nowrap; }
#list a span:first-child { overflow: hidden; text-overflow: ellipsis; }
#list a span:last-child { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 12px; }
#list a:hover { background: #2c3137; }
#list a.on { background: #2f3b4a; color: #fff; }
#stage { position: relative; flex: 1; min-width: 0; }
/* The top: title and tools on one row (the tools go under the title when the window is narrow; a button never breaks
   its words), then the progress bar and the note under them. */
#top { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 8px 12px 14px; background: linear-gradient(#000a, #0000); pointer-events: none; }
#bar { align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
#title { flex: 1 1 220px; min-width: 0; font-weight: 600; text-shadow: 0 1px 2px #000; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.tools { flex: none; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; pointer-events: auto; }
.tools button { padding: 4px 9px; border-radius: 6px; border: 1px solid #ffffff30; background: #00000060; color: var(--text);
  font: inherit; white-space: nowrap; cursor: pointer; }
.tools button.on { border-color: var(--accent); color: #fff; background: #1d4f8a; }
#progress { width: 240px; max-width: 100%; height: 4px; border-radius: 2px; background: #ffffff20; display: none; }
#progress div { height: 100%; width: 0; border-radius: 2px; background: var(--accent); }
/* The work after the download (reading the stage, materials, merging, sending to the GPU): the same bar, yellow; a
   step with no measure of its own runs as moving stripes. */
#work { width: 240px; max-width: 100%; height: 4px; border-radius: 2px; background: #ffffff20; display: none; overflow: hidden; }
#work div { height: 100%; width: 0; border-radius: 2px; background: var(--work); transition: width .2s ease; }
#work.busy div { width: 100% !important; background: repeating-linear-gradient(90deg, var(--work) 0 12px, #f5c51840 12px 24px);
  background-size: 24px 100%; animation: work-run .6s linear infinite; }
@keyframes work-run { to { background-position: 24px 0; } }
#note { max-width: min(640px, 100%); padding: 6px 10px; border-radius: 6px; background: #000000b0; display: none;
  white-space: pre-wrap; }
/* The bottom: the counts and the frame readout on the left, the picked prim on the right, the help under them; each
   keeps its own room (none lies over another at any width). */
#foot { position: absolute; left: 12px; right: 12px; bottom: 8px; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; }
/* Each side's own readout under it (user: "하단메세지로양쪽에각각제역할에맞게두라"): the official side's counts and what it
   drew at the left, the StellaX side's at the right, what both share (the frame rate, the stage) and the picked prim in
   the middle. A side the line hides hides its readout too. */
#panels { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 6px 12px; }
.readout { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; max-width: 100%; }
.readout.right { align-items: flex-end; margin-left: auto; }
.readout.hidden { display: none; }
#middle { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
/* A side's card: its name and what it drew, then a bar for each count (user: "하단 메시지도 시각적으로 우아하게, 글자가
   아닌 막대기 등 시각표현으로 대체할 수 있는 것들은 그렇게 최대한 대체"): green loaded, red failed, striped still coming,
   grey not drawn by that side, orange the engine's own. */
.panel { width: 280px; max-width: 100%; padding: 8px 11px 9px; border-radius: 10px; background: #0d0f12cc;
  border: 1px solid #ffffff1c; box-shadow: 0 6px 18px #00000070; backdrop-filter: blur(6px); font-size: 12px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: auto; cursor: pointer; }
.panel:empty { display: none; }
.panel.bad { border-color: #ff6b6b99; }
.panel .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.panel .head b { font-weight: 600; letter-spacing: .01em; }
.panel .head span { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { margin-left: 6px; padding: 1px 7px; border-radius: 8px; background: #8a6a00; color: #fff; font-size: 11px;
  font-weight: 500; }
.meter { display: grid; grid-template-columns: 58px 1fr 64px; align-items: center; gap: 8px; }
.meter .name { color: var(--dim); white-space: nowrap; }
.meter .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.meter .num em { font-style: normal; color: #ff8f8f; }
.track { position: relative; display: flex; height: 6px; border-radius: 3px; background: #ffffff16; overflow: hidden; }
.track i { display: block; height: 100%; transition: width .25s ease; }
i.ok { background: #4cd38a; }
i.bad { background: #ff6b6b; }
i.wait { background: repeating-linear-gradient(45deg, #ffffff55 0 4px, #ffffff1e 4px 8px); }
i.off { background: #ffffff38; }
i.accent { background: var(--accent); }
#stage-panel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#stage-panel .fps { display: flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 14px; background: #0d0f12cc;
  border: 1px solid #ffffff1c; font-variant-numeric: tabular-nums; }
#stage-panel .fps .track { width: 96px; }
#stage-panel .fps b { min-width: 52px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.chips span { padding: 2px 8px; border-radius: 10px; background: #0d0f12cc; border: 1px solid #ffffff1c; color: var(--dim);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.chips span b { color: var(--text); font-weight: 500; }
#pick { max-width: min(520px, 100%); padding: 6px 8px; border-radius: 6px; background: #000000b0;
  font: 12px/1.45 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all; display: none; pointer-events: auto; }
#help { color: var(--dim); font-size: 12px; text-shadow: 0 1px 2px #000; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#pick b { color: var(--pick); font-weight: 600; }
@media (max-width: 720px) {
  body { flex-direction: column; }
  #side { width: auto; height: 38%; border-right: 0; border-bottom: 1px solid var(--line); }
  #help { display: none; }
}
.switch { display: inline-flex; margin-right: 8px; }
.switch button { border-radius: 0; }
.switch button:first-child { border-radius: 6px 0 0 6px; }
.switch button:last-child { border-radius: 0 6px 6px 0; }
/* The line between the two sides: a thin bright rule over the view, a round knob in the middle to drag, each side's
   name at the top beside it, on orange (the names alone are orange). At an edge the knob stays inside the view (to drag it back) and the hidden side's name goes. */
#split { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; z-index: 1; pointer-events: none; }
#split::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #ffffffe0;
  box-shadow: 0 0 0 1px #00000040, 0 0 14px #00000080; }
#split-hit { position: absolute; top: 0; bottom: 0; left: -7px; width: 14px; cursor: ew-resize; pointer-events: auto; }
#split-knob { position: absolute; top: 50%; left: 0; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  background: #1d2024e6; border: 2px solid #fff; box-shadow: 0 2px 12px #000000b0; cursor: ew-resize; pointer-events: auto;
  touch-action: none; transition: transform .12s ease; }
#split-knob::before, #split-knob::after { content: ''; position: absolute; top: 50%; width: 0; height: 0; margin-top: -6px;
  border: 6px solid transparent; }
#split-knob::before { left: 4px; border-right-color: #fff; }
#split-knob::after { right: 4px; border-left-color: #fff; }
#split-knob:hover { transform: scale(1.08); }
#split .tag { position: absolute; top: 58px; padding: 3px 10px; border-radius: 12px; background: var(--tag);
  border: 1px solid var(--tag-edge); box-shadow: 0 2px 8px #00000080; color: #fff; font-weight: 600; font-size: 12px; line-height: 18px; white-space: nowrap; pointer-events: none; }
#split .tag.left { right: 10px; }
#split .tag.right { left: 10px; }
#split.at-left #split-knob { margin-left: 2px; }
#split.at-right #split-knob { margin-left: -40px; }
#split.at-left .tag.left, #split.at-right .tag.right { display: none; }
#split.at-left .tag.right { left: 12px; }
#split.at-right .tag.left { right: 12px; }
/* The bars stay above the line (their buttons take the clicks where the line passes under them). */
#top, #foot { z-index: 2; }
/* A narrow window: smaller cards, the stage chips left out, so that the readouts stay one row at the bottom. */
@media (max-width: 1250px) {
  .panel { width: 200px; padding: 6px 9px 7px; gap: 4px; }
  .meter { grid-template-columns: 34px 1fr 50px; gap: 6px; }
  .panel .head { flex-wrap: wrap; gap: 0 8px; }
  .chips { display: none; }
  #stage-panel .fps .track { width: 44px; }
}
/* A side's own work bar (yellow, as the page's work bar) and its step. */
i.work { background: var(--work); }
i.work.busy { background: repeating-linear-gradient(90deg, var(--work) 0 10px, #f5c51840 10px 20px); background-size: 20px 100%;
  animation: work-run .6s linear infinite; }
.panel .step { color: var(--dim); font-size: 11px; margin-top: -2px; }
.readout.right .panel .step { text-align: right; }
/* A side's own counts in its card. */
.chips.side { justify-content: flex-start; margin-top: 2px; }
.readout.right .chips.side { justify-content: flex-end; }
.chips.side span { background: #ffffff0c; border-color: #ffffff14; padding: 1px 7px; font-size: 11px; }
@media (max-width: 1250px) { .chips.side { display: flex; } }
/* ?mode=cinematic: nothing answers the mouse; the help line goes. */
body.cinematic, body.cinematic * { pointer-events: none !important; cursor: none !important; }
body.cinematic #help { display: none; }
/* The asset list on the left answers the mouse in the cinematic too (user: "좌측은 마우스에 반응해야 한다"): a stage picked
   there opens and the cinematic goes on with it; the stage itself takes no mouse or keys. */
body.cinematic #side, body.cinematic #side * { pointer-events: auto !important; cursor: auto !important; }
body.cinematic #list a { cursor: pointer !important; }
/* Its own button takes the mouse too, to end it. */
body.cinematic #cine { pointer-events: auto !important; cursor: pointer !important; }
/* The two engines read the stage at different sizes. */
.chips span.warn { color: #ffd2a8; border-color: #ff9a5280; background: #3a2412cc; }
