* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Space Grotesk", "IBM Plex Sans", "Arial", sans-serif;
  background: #0f1116;
  color: #f5f5f5;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

#perceptron-ui {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  grid-template-columns: auto;
  gap: 12px;
  align-items: end;
  z-index: 9;
}

.perceptron-preview {
  position: relative;
  padding: 10px;
  background: rgba(10, 12, 16, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.perceptron-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(159, 215, 255, 0.85);
  margin-bottom: 8px;
}

#fp-camera {
  display: block;
  width: 320px;
  height: 180px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 12, 16, 0.5);
}

.perceptron-panel {
  width: 320px;
  padding: 14px;
  background: rgba(12, 16, 22, 0.82);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.perceptron-title {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fd7ff;
  margin-bottom: 10px;
}

.perceptron-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.perceptron-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(245, 245, 245, 0.6);
}

.perceptron-value {
  font-size: 12px;
  color: #f5f5f5;
}

.perceptron-value.is-off {
  color: rgba(255, 147, 147, 0.9);
}

.perceptron-value.is-on {
  color: rgba(159, 255, 189, 0.9);
}

.perceptron-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 20, 28, 0.9);
  color: #f5f5f5;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

.perceptron-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}

.perceptron-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(32, 48, 70, 0.8);
  color: #f5f5f5;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
  cursor: pointer;
}

.perceptron-btn.is-muted {
  background: rgba(24, 28, 36, 0.8);
  color: rgba(245, 245, 245, 0.7);
}

.perceptron-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.perceptron-metric {
  background: rgba(15, 19, 26, 0.7);
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.perceptron-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(245, 245, 245, 0.55);
  display: block;
}

.perceptron-metric-value {
  font-size: 12px;
  color: #f5f5f5;
}

.asset-loader {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: min(320px, 90vw);
  padding: 14px 16px;
  background: rgba(10, 12, 16, 0.85);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  z-index: 9;
  transition: opacity 0.25s ease;
}

.asset-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.asset-loader-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9fd7ff;
  margin-bottom: 4px;
}

.asset-loader-subtitle {
  font-size: 12px;
  color: rgba(245, 245, 245, 0.65);
  margin-bottom: 12px;
}

.asset-loader-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-loader-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: rgba(245, 245, 245, 0.85);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 20, 28, 0.7);
}

.asset-loader-item.is-loading {
  border-color: rgba(159, 215, 255, 0.35);
}

.asset-loader-item.is-done {
  border-color: rgba(159, 255, 189, 0.35);
  color: rgba(159, 255, 189, 0.9);
}

.asset-loader-item.is-error {
  border-color: rgba(255, 147, 147, 0.4);
  color: rgba(255, 147, 147, 0.9);
}

.asset-loader-item-detail {
  font-size: 11px;
  color: rgba(245, 245, 245, 0.6);
  text-align: right;
}


#hud {
  position: fixed;
  top: 18px;
  left: 18px;
  padding: 12px 16px;
  background: rgba(10, 12, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

#hud > summary {
  list-style: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(245, 245, 245, 0.85);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(12, 16, 22, 0.6);
}

#hud > summary::-webkit-details-marker {
  display: none;
}

#hud[open] > summary {
  margin-bottom: 10px;
}

#hud .title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

#hud .hint {
  font-size: 12px;
  opacity: 0.7;
}

#hud .mode {
  margin-top: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9fd7ff;
}

#hud .debug {
  margin-top: 8px;
  font-size: 11px;
  color: #e6e9f5;
  opacity: 0.9;
}

#hud .debug-line {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 10px;
  opacity: 0.75;
}

#thought-log {
  position: fixed;
  top: 24px;
  right: 20px;
  width: min(380px, 92vw);
  padding: 20px 22px;
  background: rgba(9, 12, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  z-index: 10;
}

#thought-log .log-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #8fb8ff;
  margin-bottom: 14px;
}

#thought-log .log-entry {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(245, 245, 245, 0.9);
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

#thought-log .log-entry:last-child {
  border-bottom: none;
}

#thought-log .log-entry.quote {
  font-style: italic;
  color: rgba(159, 215, 255, 0.95);
}

#speech-bubble {
  position: fixed;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(250, 250, 255, 0.92);
  color: #12141a;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(12, 16, 22, 0.15);
  transform: translate(-50%, -65%);
  pointer-events: none;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#speech-bubble::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(250, 250, 255, 0.92);
}

#speech-bubble.is-visible {
  opacity: 1;
}

#override-input {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 90vw);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(10, 12, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

#override-input label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(159, 215, 255, 0.9);
}

#override-input input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 20, 28, 0.9);
  color: #f5f5f5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

#override-input input::placeholder {
  color: rgba(245, 245, 245, 0.45);
}

@media (max-width: 720px) {
  #perceptron-ui {
    right: 12px;
    bottom: 12px;
  }

  .perceptron-panel,
  #fp-camera {
    width: min(300px, 92vw);
  }

  #thought-log {
    top: auto;
    bottom: 18px;
    right: 18px;
    left: 18px;
    width: auto;
  }
}
