/* Voxel v4 — Space Engineers Viewer */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #050712; color: #e2e8f0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }

.app { display: flex; height: 100vh; }

aside {
  width: 320px;
  background: linear-gradient(180deg, #0b1226 0%, #0a1020 100%);
  border-right: 1px solid #1e293b;
  padding: 16px 14px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
aside::-webkit-scrollbar { width: 6px; }
aside::-webkit-scrollbar-track { background: transparent; }
aside::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }

.brand h1 { font-size: 18px; color: #e2e8f0; font-weight: 700; letter-spacing: -0.01em; }
.brand h1 span { color: #9ffbff; font-weight: 400; font-size: 13px; }
.brand .sub { font-size: 11px; color: #64748b; margin-top: 2px; }

.search {
  width: 100%;
  padding: 9px 12px;
  background: #131e3a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  margin: 14px 0 6px;
  transition: border-color 0.15s;
}
.search:focus { outline: none; border-color: #9ffbff66; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 6px 0;
}
.stat {
  background: #131e3a;
  border: 1px solid #1e293b;
  padding: 8px;
  border-radius: 6px;
  text-align: center;
}
.stat .v { color: #9ffbff; font-weight: 700; font-size: 15px; }
.stat .l { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

.section { margin-top: 8px; }
.section.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lbl {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 6px;
}

.row { display: flex; gap: 5px; flex-wrap: wrap; }
.btn {
  padding: 7px 10px;
  background: #1a2540;
  color: #cbd5e1;
  border: 1px solid #243259;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.12s ease;
  flex: 1;
  min-width: 0;
  text-align: center;
}
.btn:hover { background: #243259; border-color: #2e3b6e; }
.btn.active {
  background: #9ffbff;
  color: #0b1226;
  border-color: #9ffbff;
  font-weight: 600;
  box-shadow: 0 0 16px #9ffbff33;
}
.btn.pink {
  background: #9ffbff15;
  border-color: #9ffbff44;
  color: #9ffbff;
}
.btn.pink:hover { background: #9ffbff25; border-color: #9ffbff77; }
.btn.full { width: 100%; flex: none; margin-top: 6px; }
.btn.small { padding: 5px 8px; font-size: 13px; min-width: 30px; }

.gridlist { flex: 1; overflow-y: auto; min-height: 0; }
.gridlist::-webkit-scrollbar { width: 5px; }
.gridlist::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }
.gi {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  background: #131e3a;
  color: #cbd5e1;
  border: 1px solid #1e293b;
  border-left: 3px solid transparent;
  border-radius: 5px;
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.12s;
}
.gi:hover { background: #1a2540; border-color: #243259; }
.gi.active { border-left-color: #9ffbff; background: #9ffbff10; }
.gi .top { font-weight: 600; color: #e2e8f0; margin-bottom: 3px; }
.gi .sub { font-size: 10px; color: #64748b; }

main { flex: 1; position: relative; overflow: hidden; }
#canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute;
  left: 16px;
  top: 16px;
  background: #0b1226d0;
  border: 1px solid #1e293b;
  padding: 11px 16px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  max-width: 360px;
  pointer-events: none;
}
.overlay strong { color: #9ffbff; font-size: 13px; display: block; margin-bottom: 4px; }
.overlay .muted { color: #94a3b8; line-height: 1.5; }

.rotpanel {
  position: absolute;
  right: 16px;
  top: 16px;
  background: #0b1226d0;
  border: 1px solid #1e293b;
  padding: 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  min-width: 140px;
}
.rotpanel .lbl { color: #9ffbff; margin-bottom: 8px; }
.rotrow {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 4px 0;
}
.rotrow .axis {
  display: inline-block;
  width: 20px;
  color: #64748b;
  font-weight: 700;
  font-family: monospace;
}
.rotrow .btn { flex: 1; }
.rotinfo {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #1e293b;
  color: #64748b;
  font-family: monospace;
  font-size: 10px;
  text-align: center;
}

.hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: #0b1226cc;
  border: 1px solid #1e293b;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: #64748b;
  backdrop-filter: blur(8px);
}

.legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  background: #0b1226cc;
  border: 1px solid #1e293b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  max-width: 480px;
  backdrop-filter: blur(8px);
}
.legend .item { display: flex; gap: 5px; align-items: center; color: #cbd5e1; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; }

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  background: #050712e0;
  color: #9ffbff;
  font-size: 14px;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.loading.hidden { display: none; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #1e293b;
  border-top-color: #9ffbff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  aside { width: 280px; }
  .rotpanel { top: 10px; right: 10px; padding: 8px; }
  .overlay { left: 10px; top: 10px; max-width: 250px; padding: 8px 12px; }
  .legend { display: none; }
}
