/* Full-screen project viewer */
html, body { height: 100%; }
body.viewer-page { display: flex; flex-direction: column; overflow: hidden; }
.vbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 60px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.vbar .back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-size: 14px; white-space: nowrap; }
.vbar .back:hover { color: var(--text); }
.vbar .title { min-width: 0; flex: 1; }
.vbar .title h1 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar .title div { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar .right { display: flex; gap: 8px; align-items: center; }

.stage { position: relative; flex: 1; min-height: 0; background: linear-gradient(160deg, var(--viewer-a), var(--viewer-b)); }
.stage .canvas { position: absolute; inset: 0; }
.stage canvas { display: block; }

.side { position: absolute; top: 14px; bottom: 80px; width: 280px; display: flex; flex-direction: column; gap: 12px; overflow: auto; z-index: 2; pointer-events: none; }
.side > * { pointer-events: auto; }
.side[hidden] { display: none; }
.side.left { left: 14px; }
.side.right { right: 14px; width: 320px; }
.card { background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; backdrop-filter: blur(8px); box-shadow: var(--shadow); }
.card h4 { margin: 0 0 10px; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card p { font-size: 14px; color: var(--muted); }
.bullets { margin: 10px 0 0; padding-left: 16px; font-size: 13px; color: var(--muted); }
.bullets:empty { display: none; }
.bullets li + li { margin-top: 5px; }
.bullets li::marker { color: var(--accent); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.facts div { font-size: 14px; }
.facts small { display: block; font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.toggle .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.toggle .count { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; padding: 7px 0; border: 0; background: transparent; color: var(--muted); font: 500 12px var(--mono); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.range-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 5px 9px; font: 500 12px var(--mono); cursor: pointer; }
.icon-btn:disabled { opacity: .4; cursor: default; }

.toolbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; z-index: 3;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px); max-width: calc(100% - 24px); overflow-x: auto; }
.toolbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: 500 11px var(--font); cursor: pointer; }
.toolbar button:hover:not(:disabled) { background: var(--surface-2); }
.toolbar button:disabled { opacity: .35; cursor: default; }
.toolbar svg { width: 18px; height: 18px; }
.toolbar .sep { width: 1px; background: var(--line); margin: 4px 2px; flex: none; }

.props { font-size: 13px; }
.props .head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.props .cls { font: 500 11px var(--mono); color: var(--accent); }
.props .name { font-size: 16px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.props details { border-top: 1px solid var(--line); padding: 8px 0 2px; margin-top: 8px; }
.props summary { cursor: pointer; font-weight: 500; font-size: 13px; padding-bottom: 4px; }
.props table { width: 100%; border-collapse: collapse; }
.props td { padding: 3px 0; vertical-align: top; }
.props td:first-child { color: var(--muted); padding-right: 10px; width: 48%; word-break: break-word; }
.props td:last-child { font-family: var(--mono); font-size: 12px; word-break: break-word; }
.props .asm { margin-top: 10px; padding: 10px; border-radius: 9px; background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.hint { position: absolute; left: 14px; bottom: 16px; z-index: 2; font: 500 11px var(--mono); color: var(--muted); line-height: 1.7; }
.stage .loader { z-index: 4; }
.panel-toggle { display: none; }

@media (max-width: 860px) {
  .side { bottom: auto; max-height: calc(100% - 100px); width: calc(100% - 28px) !important; }
  .side.left, .side.right { left: 14px; right: 14px; }
  .side.collapsed { display: none; }
  .panel-toggle { display: inline-flex; }
  .hint { display: none; }
  .vbar .back span { display: none; }
}
