html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0c0f;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

#hudTop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: linear-gradient(rgba(10, 13, 17, 0.85), rgba(10, 13, 17, 0.55));
  border-bottom: 1px solid rgba(70, 80, 92, 0.5);
  z-index: 5;
  color: #cfd6dd;
  font-size: 11px;
  letter-spacing: 0.04em;
}

#routeInfo {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#toolbar {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.tbtn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #262c33;
  border: 1px solid #454c56;
  color: #cfd6dd;
  border-radius: 6px;
  padding: 3px 9px;
  font: 600 11px system-ui;
  cursor: pointer;
}

.tbtn:hover {
  background: #323a43;
}

.tbtn:active {
  background: #1d2228;
}

.tbtn.primary {
  background: #2f6b46;
  border-color: #3f8f5c;
}

.tbtn svg {
  width: 12px;
  height: 12px;
  display: block;
}

#panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 158px;
  display: flex;
  gap: 8px;
  padding: 7px 10px 8px;
  background: linear-gradient(#242830, #171a1f);
  border-top: 1px solid #3d444d;
  z-index: 6;
  overflow: hidden;
  justify-content: center;
}

.cluster {
  background: rgba(16, 19, 24, 0.72);
  border: 1px solid #333a44;
  border-radius: 8px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ctitle {
  font: 700 9px system-ui;
  color: #8a939c;
  letter-spacing: 0.12em;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font:
    600 12px ui-monospace,
    Menlo,
    Consolas,
    monospace;
  color: #cfd6dd;
}

.kv span {
  font: 500 9px system-ui;
  color: #8a939c;
  letter-spacing: 0.06em;
  align-self: center;
}

.kv b {
  font-weight: 600;
  min-width: 52px;
  text-align: right;
}

.grid2 {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 8px;
  align-content: start;
}

.lamps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lamp {
  font: 700 9px system-ui;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #252a31;
  color: #6e7883;
  border: 1px solid #3a414b;
}

#panel svg {
  display: block;
}

#cStick {
  flex: 1 1 260px;
  flex-direction: row;
  gap: 10px;
  align-items: stretch;
}

.padWrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.padCap {
  font: 500 9px system-ui;
  color: #8a939c;
  line-height: 1.35;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 11, 0.55);
  z-index: 20;
}

.card {
  background: #1b1f26;
  border: 1px solid #3c4450;
  border-radius: 12px;
  padding: 18px 22px;
  color: #cfd6dd;
  max-width: min(580px, 92vw);
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

#resTitle {
  font: 800 22px system-ui;
  margin: 0 0 4px;
}

#resSub {
  color: #8a939c;
  font-size: 13px;
  margin-bottom: 8px;
}

#resGrade {
  font: 800 30px system-ui;
  color: #63d97f;
  margin: 4px 0 10px;
}

#resList {
  font:
    12px ui-monospace,
    Menlo,
    monospace;
  white-space: pre;
  line-height: 1.55;
  color: #c3ccd5;
  margin: 0 0 14px;
  text-align: left;
}

#pausedTag {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 24, 30, 0.88);
  border: 1px solid #3c4450;
  color: #ffb648;
  font: 700 13px system-ui;
  padding: 6px 14px;
  border-radius: 8px;
  z-index: 15;
}

#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 170px;
  background: rgba(16, 20, 26, 0.88);
  border: 1px solid #3c4450;
  color: #cfd6dd;
  font: 500 11.5px system-ui;
  padding: 7px 14px;
  border-radius: 8px;
  z-index: 15;
  transition: opacity 0.6s;
  opacity: 1;
  pointer-events: none;
  white-space: nowrap;
  max-width: 94vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font:
    12px ui-monospace,
    Menlo,
    Consolas,
    monospace;
  color: #c3ccd5;
  align-content: start;
}

kbd {
  background: #262c33;
  border: 1px solid #454c56;
  border-radius: 4px;
  padding: 0 5px;
  font:
    600 10.5px ui-monospace,
    Menlo,
    monospace;
}

@media (max-width: 940px) {
  #cAdi,
  #cCdi {
    display: none;
  }
}

@media (max-width: 660px) {
  #panel {
    height: 128px;
  }

  #cEng .bars {
    display: none;
  }

  .cluster {
    padding: 4px 6px;
  }

  #toast {
    bottom: 138px;
  }
}

@media (max-height: 600px) {
  #panel {
    height: 118px;
  }

  #toast {
    bottom: 128px;
  }
}
