:root {
  --bg: rgba(16, 19, 23, 0.82);
  --bg2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e7e9ec;
  --mute: #8f979f;
  --accent: #ff8a1f;
  --ok: #67e08a;
  --warn: #ffcc4d;
  --bad: #ff5b4d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0f11; color: var(--text); font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: #0d0f11; z-index: 50; color: var(--mute); transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.spin { width: 34px; height: 34px; border: 3px solid #2a2f35; border-top-color: var(--accent); border-radius: 50%; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

#panel { position: fixed; top: 12px; left: 12px; bottom: 12px; width: 292px; overflow-y: auto; background: var(--bg); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px 12px; z-index: 10; scrollbar-width: thin; }
#panel header { padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: 0.12em; font-size: 15px; }
.brand span { color: var(--accent); }
.sub { color: var(--mute); font-size: 11px; margin-top: 2px; }
.back { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 12px; text-decoration: none; }
.back:hover { text-decoration: underline; }
section { padding: 10px 0; border-bottom: 1px solid var(--line); }
section:last-child { border-bottom: 0; }
h3 { margin: 0 0 8px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); font-weight: 700; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { margin-top: 8px; }
.lbl { display: flex; justify-content: space-between; color: var(--mute); font-size: 11.5px; margin-bottom: 4px; }
.lbl b { color: var(--text); font-weight: 600; }
button { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover { background: rgba(255, 255, 255, 0.1); }
button.primary { background: #1f7a3c; border-color: #2a9a4d; font-weight: 700; letter-spacing: 0.08em; min-width: 92px; }
button.primary.stop { background: #8a2620; border-color: #b0362e; }
button.tog.on, .seg button.on, .gears button.on { background: rgba(255, 138, 31, 0.18); border-color: var(--accent); color: #ffd2a8; }
.gears button.engaged { background: rgba(103, 224, 138, 0.18); border-color: var(--ok); color: #c8ffd8; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gears { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.gears button { padding: 8px 0; font-weight: 700; font-size: 14px; }
select { width: 100%; background: #1a1e23; color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.chk { display: flex; gap: 6px; align-items: center; color: var(--mute); cursor: pointer; }
.spec { margin-top: 8px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 11.5px; color: var(--mute); }
.spec b { color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.note { color: var(--mute); font-size: 11.5px; margin-top: 6px; }
.warn { margin-top: 8px; padding: 7px 9px; border-radius: 7px; background: rgba(255, 204, 77, 0.1); border: 1px solid rgba(255, 204, 77, 0.35); color: var(--warn); font-size: 11.5px; }
.warn.bad { background: rgba(255, 91, 77, 0.12); border-color: rgba(255, 91, 77, 0.45); color: #ffb0a8; }
.hidden { display: none !important; }

#hud { position: fixed; top: 12px; right: 12px; display: grid; grid-template-columns: repeat(3, 108px); gap: 6px; z-index: 10; }
.tile { background: var(--bg); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; display: flex; flex-direction: column; }
.tile span { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile b.small { font-size: 13px; }
.tile i { font-style: normal; color: var(--mute); font-size: 11px; }
.tile.big b { color: var(--accent); }
.tile.wide { grid-column: span 3; flex-direction: row; align-items: baseline; gap: 10px; }
.tile.wide span { flex: 1; }

#inspect { position: fixed; right: 12px; bottom: 12px; width: 330px; background: var(--bg); backdrop-filter: blur(10px); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; z-index: 11; }
#inspect .tag { color: var(--accent); font-size: 10px; letter-spacing: 0.16em; font-weight: 700; }
#inspect h2 { margin: 4px 0 6px; font-size: 17px; }
#inspect p { margin: 0 0 8px; color: #c4c9cf; }
#inspData { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; color: var(--mute); }
#inspData b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
#inspClose { position: absolute; top: 8px; right: 8px; padding: 2px 8px; font-size: 16px; }

#crosshair { position: fixed; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid rgba(255, 255, 255, 0.8); border-radius: 50%; z-index: 12; pointer-events: none; mix-blend-mode: difference; }
#help { position: fixed; left: 320px; bottom: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--mute); font-size: 11.5px; z-index: 9; }
#help b { color: var(--text); }

@media (max-width: 900px) {
  #panel { width: calc(100vw - 32px); left: 16px; right: 16px; top: auto; height: 46vh; bottom: 16px; }
  #hud { grid-template-columns: repeat(3, 1fr); left: 16px; right: 16px; }
  #help { display: none; }
  #inspect { width: auto; left: 16px; right: 16px; bottom: calc(46vh + 24px); }
}
