html, body { margin: 0; height: 100%; background: #090909; color: #d8d8d8; font: 12px/1.35 "Segoe UI", "PingFang SC", sans-serif; }
a { color: #ff4d00; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; background: #101010; border: 1px solid #333; border-radius: 0; padding: 4px 6px; }
button { cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; }
button:hover, a:hover { border-color: #ff4d00; color: #ff4d00; }
h1, h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #8a8a8a; margin: 12px 0 6px; }
.brand { color: #ff4d00; font-weight: 700; letter-spacing: 0.18em; text-transform: lowercase; font-size: 18px; }
.home .brand { font-size: 42px; margin: 0 0 8px; }
.home { display: grid; place-items: center; }
.home main { width: min(480px, 92vw); }
body.output { overflow: hidden; background: #000; }
#stage { position: relative; background: #000; min-height: 0; flex: 1; touch-action: none; outline: 1px solid #ff4d00; cursor: none; overflow: visible; }
body.output #stage { position: fixed; inset: 0; outline: 0; }
#stage canvas { position: absolute; display: block; }
#fs, #hostwarn { display: none; }
body.output.show-ui #fs, body.output.show-ui #hostwarn { display: block; }
#fs { position: fixed; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #ff4d00; color: #111; border: 0; padding: 14px 22px; }
#hostwarn { position: fixed; z-index: 3; left: 16px; right: 16px; bottom: 16px; margin: 0; color: #ff4d00; }
#gate { display: none; }
body.output.need-auth #gate, body:not(.output) #gate:not([hidden]) { display: flex; }
body.output #gate { position: fixed; z-index: 4; inset: 0; margin: auto; width: min(420px, 92vw); height: auto; min-height: 160px; padding: 24px; gap: 10px; flex-direction: column; align-items: center; justify-content: center; background: #000; }
body:not(.output) #gate:not([hidden]) { position: fixed; z-index: 30; left: 50%; top: 18vh; transform: translateX(-50%); width: min(380px, 92vw); margin: 0; flex-direction: column; gap: 8px; padding: 18px; background: #121212; border: 1px solid #2a2a2a; }
#gate.panel button { background: #ff4d00; color: #111; border: 0; padding: 8px; }
#pairshow { margin: 0; font: 700 36px/1.2 "Consolas", "SF Mono", monospace; letter-spacing: 0.2em; color: #ff4d00; user-select: text; -webkit-user-select: text; cursor: text; }
#pairhint { margin: 0; color: #8a8a8a; text-align: center; }
#pairbadge { display: none; position: fixed; z-index: 5; left: 12px; bottom: 12px; margin: 0; padding: 6px 10px; background: rgba(0,0,0,0.7); color: #ff4d00; font: 700 14px/1 "Consolas", "SF Mono", monospace; letter-spacing: 0.12em; user-select: text; -webkit-user-select: text; cursor: text; }
body.output.show-ui:not(.need-auth) #pairbadge { display: block; }
body.output.need-auth, body.output.need-auth * { cursor: auto !important; }
body.output.need-auth #pairshow { cursor: text !important; }
#app[hidden] { display: none !important; }
#app { height: 100%; display: flex; flex-direction: column; }
.top { display: flex; gap: 10px; align-items: center; min-height: 36px; padding: 0 10px; background: #101010; border-bottom: 1px solid #2a2a2a; flex: none; min-width: 0; }
.top button, .top a, .brand { flex: none; }
.top button, .top a { border: 1px solid #333; padding: 4px 8px; }
#conn, #rev, #sealed, #presence { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; }
#conn, #rev, #sealed, #presence, #shape { color: #8a8a8a; }
.hostmode, #ack, .note, #readout, #progress { margin: 0; padding: 2px 10px; color: #6e6e6e; font-size: 11px; }
.hostmode { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ack:empty, #progress:empty { display: none; }
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px; }
.col { min-width: 0; min-height: 0; overflow: auto; padding: 8px 10px 16px; background: #101010; }
.stagecol { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0c0c0c; border-left: 1px solid #2a2a2a; border-right: 1px solid #2a2a2a; }
.viewbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; background: #121212; border-bottom: 1px solid #2a2a2a; }
.viewon { color: #ff4d00; letter-spacing: 0.14em; font-size: 11px; }
.row, .transport { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.head { justify-content: space-between; }
#surfacelist, #presetlist { list-style: none; padding: 0; margin: 0 0 8px; }
#surfacelist li, #presetlist li { padding: 6px 4px; border-bottom: 1px solid #222; cursor: pointer; border-left: 3px solid transparent; }
#surfacelist li { display: flex; align-items: center; gap: 6px; }
#surfacelist li .swatch { width: 8px; height: 8px; flex: none; }
#surfacelist li.on { background: #1a1a1a; color: #fff; border-left-color: var(--layer, #ff4d00); }
#readout { font-variant-numeric: tabular-nums; }
.inspector label { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0; color: #8a8a8a; }
.inspector label input[type="range"] { width: 58%; accent-color: #ff4d00; }
label.check { flex-direction: row; align-items: center; gap: 4px; margin: 0; }
#name, textarea, #importdir, #manifesturl { width: 100%; box-sizing: border-box; }
#corners label { display: grid; grid-template-columns: 14px 1fr 1fr; gap: 4px; align-items: center; margin: 0 0 4px; color: #ff4d00; }
.grid4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 4px; }
.transport button { min-width: 64px; }
#bin { display: flex; gap: 8px; overflow-x: auto; height: 96px; flex: none; padding: 8px; background: #101010; border-top: 1px solid #2a2a2a; align-items: stretch; }
.thumb { position: relative; width: 96px; height: 80px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 4px 2px; overflow: visible; background: #181818; border: 1px solid #333; }
.thumb img, .thumb video { width: 100%; height: 52px; object-fit: cover; background: #000; }
.thumb.on { border-color: #ff4d00; color: #ff4d00; }
.thumb span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; text-transform: none; letter-spacing: 0; }
.thumb .kill {
  display: none; position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: #e23b3b; color: #fff; border: 0; padding: 0; line-height: 20px; font-size: 14px; font-weight: 700;
  text-transform: none; letter-spacing: 0; z-index: 2;
}
.thumb.on .kill, .thumb:hover .kill { display: block; }
.thumb-add {
  width: 96px; height: 80px; flex: none; display: grid; place-items: center; background: #f4f4f4; color: #111;
  border: 1px solid #ddd; font-size: 36px; font-weight: 300; line-height: 1; text-transform: none; letter-spacing: 0;
}
.thumb-add:hover { background: #fff; color: #ff4d00; border-color: #ff4d00; }
.deploy { flex: none; background: #0d0d0d; border-top: 1px solid #2a2a2a; max-height: 42vh; overflow: auto; }
.deploy summary { cursor: pointer; padding: 8px 12px; letter-spacing: 0.08em; color: #ff4d00; font-weight: 700; }
.deploy-grid { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; padding: 0 10px 12px; }
.deploy-card { background: #141414; border: 1px solid #2a2a2a; padding: 8px 10px 10px; min-width: 0; }
.deploy-card.venue { border-top: 3px solid #ff4d00; }
.deploy-card.save { border-top: 3px solid #3ecf8e; }
.deploy-card.load { border-top: 3px solid #4da3ff; }
a.btn-green { background: #1f6b45; color: #eafff3; }
.deploy-card h3 { margin: 0 0 6px; color: #ececec; font-size: 12px; letter-spacing: 0.08em; }
.deploy .row, .deploy .note, #selfout, #progress { margin: 6px 0; }
.deploy .note { color: #8f8f8f; line-height: 1.4; }
.deploy .inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; color: #bdbdbd; text-transform: none; letter-spacing: 0; }
.deploy button, .deploy .btn-link {
  border: 0; padding: 6px 10px; text-transform: none; letter-spacing: 0; font-weight: 600;
}
.btn-green { background: #1f6b45; color: #eafff3; }
.btn-blue { background: #1d4f86; color: #eaf4ff; }
.btn-amber { background: #7a5a12; color: #fff4d6; }
.btn-violet { background: #5a3d86; color: #f3eaff; }
.btn-dim { background: #2a2a2a; color: #bdbdbd; }
.btn-link { display: inline-flex; align-items: center; background: #333; color: #ffb48a; text-decoration: none; }
.btn-green:hover, .btn-blue:hover, .btn-amber:hover, .btn-violet:hover, .btn-dim:hover, .btn-link:hover { filter: brightness(1.12); color: inherit; border-color: transparent; }
#selfout, #progress { white-space: pre-wrap; background: #090909; padding: 8px; min-height: 2em; color: #d2d2d2; }
@media (max-width: 1100px) {
  .deploy-grid { grid-template-columns: 1fr; }
}
body.output:not(.show-ui):not(.need-auth), body.output:not(.show-ui):not(.need-auth) * { cursor: none !important; }
@media (max-width: 900px) {
  body:not(.output) { overflow: auto; }
  #app { height: auto; min-height: 100%; }
  .desk { grid-template-columns: 1fr; }
  #stage { height: 46vh; flex: none; }
}
