:root { --bg: #0b0b0c; --ink: #e8e8e3; --dim: #7a7a74; --line: #222220; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 13px/1.4 ui-sans-serif, -apple-system, "Helvetica Neue", Arial, sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
header { display: flex; align-items: center; gap: 18px; padding: 10px 16px; flex-wrap: wrap; }
.brand { font-weight: 600; letter-spacing: 0.02em; }
.tag { font-weight: 400; color: var(--dim); font-size: 11px; margin-left: 4px; }
nav { display: flex; gap: 4px; }
#views { padding-right: 14px; border-right: 1px solid var(--line); }
button { background: transparent; color: var(--dim); border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 9px; font: inherit; cursor: pointer; }
button:hover { color: var(--ink); border-color: #3a3a37; }
button.on { color: var(--ink); border-color: #5a5a55; }
.ctl { display: flex; align-items: center; gap: 14px; margin-left: auto; color: var(--dim); }
.ctl label { display: flex; align-items: center; gap: 6px; }
.ctl input[type=range] { width: 90px; accent-color: #8a8a84; }
.ctl .v { font: 11px ui-monospace, Menlo, monospace; min-width: 70px; color: var(--dim); }
main { flex: 1; position: relative; min-height: 0; }
canvas { position: absolute; inset: 0; margin: auto; display: block; }
footer { padding: 8px 16px 12px; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-align: center; }
footer b { color: var(--ink); font-weight: 500; }
.tip { position: absolute; display: none; pointer-events: none; max-width: 300px; background: rgba(20,20,19,0.94);
  border: 1px solid #2c2c29; border-radius: 4px; padding: 7px 9px; font-size: 12px; z-index: 2; }
.tip .k { font: 600 12px ui-monospace, Menlo, monospace; }
.tip .m { color: var(--dim); }
.tip code { font: 11px ui-monospace, Menlo, monospace; background: #232321; padding: 0 3px; border-radius: 2px;
  margin-right: 2px; white-space: pre; }
#body { flex: 1; display: flex; min-height: 0; }
#panel { width: 300px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 4px 14px 12px 16px;
  border-right: 1px solid var(--line); min-height: 0; }
.plabel { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
#kinds { flex-wrap: wrap; }
.ptitle { margin-top: 6px; font-weight: 500; }
.psrc { color: var(--dim); font-size: 11px; }
#text { flex: 1; overflow: auto; margin-top: 4px; font: 12px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap;
  word-break: break-word; color: #a9a9a3; cursor: pointer; }
#text span:hover { color: var(--ink); }
#text span.s { color: #55554f; }
#text span.now { color: #0b0b0c; background: #e8e8e3; border-radius: 2px; }
@media (max-width: 760px) { #body { flex-direction: column; } #panel { width: auto; max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); } }
#legend { margin: 0; padding-left: 16px; color: #a9a9a3; font-size: 12px; line-height: 1.45; flex: none; max-height: 40%; overflow: auto; }
#legend li { margin-bottom: 4px; }
#legend b { color: var(--ink); font-weight: 500; }
#detail { width: 260px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 4px 16px 12px 14px;
  border-left: 1px solid var(--line); min-height: 0; overflow: auto; }
#detail code, #dword code { font: 11px ui-monospace, Menlo, monospace; background: #232321; padding: 0 3px; border-radius: 2px; margin-right: 2px; white-space: pre; }
#dpicks { list-style: none; margin: 0; padding: 0; font-size: 12px; }
#dpicks li { padding: 5px 0; border-bottom: 1px solid var(--line); line-height: 1.6; }
#dpicks .k { font: 600 12px ui-monospace, Menlo, monospace; }
.m { color: var(--dim); }
@media (max-width: 760px) { #detail { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 30vh; } }
/* stacked layout: fixed heights, so a panel's changing content never moves the picture */
@media (max-width: 760px) {
  body { overflow: auto; }
  #body { flex: none; }
  #panel { height: 34vh; max-height: none; flex: none; }
  main#stage { flex: none; height: min(100vw, 72vh); }
  #detail { height: 30vh; max-height: none; flex: none; }
}
#timeline { display: flex; align-items: center; gap: 8px; padding: 6px 16px 0; }
#scrub { flex: 1; accent-color: #8a8a84; }
#tpos { font: 11px ui-monospace, Menlo, monospace; color: var(--dim); min-width: 170px; text-align: right; }
#timeline button { padding: 2px 9px; }
