:root {
  --bg: #08131d;
  --panel: rgba(12, 24, 36, 0.92);
  --text: #e8f4ff;
  --muted: #8aa4b8;
  --accent: #5ec6e8;
  --accent-2: #b58fd8;
  --danger: #ff6b6b;
  --border: rgba(150, 190, 220, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10, 20, 30, 0.95), rgba(8, 16, 24, 0.7));
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

.brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.pill[data-state="connected"] {
  background: rgba(70, 200, 140, 0.18);
  color: #9ef0c8;
}

.pill[data-state="connecting"] {
  background: rgba(255, 196, 90, 0.18);
  color: #ffd98e;
}

.pill[data-state="error"] {
  background: rgba(255, 90, 90, 0.18);
  color: #ffb0b0;
}

.ghost-btn,
button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

button:hover,
.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
}

.stage {
  position: relative;
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
}

.canvas-wrap {
  flex: 1;
  min-height: 60vh;
  position: relative;
  overflow: hidden;
}

#artCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.debug-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.debug-canvas[hidden] {
  display: none;
}

.pill[data-state="lidar"] {
  background: rgba(70, 200, 140, 0.18);
  color: #9ef0c8;
}

.pill[data-state="simulation"] {
  background: rgba(181, 143, 216, 0.22);
  color: #dcc7f5;
}

.pill[data-state="pointer"] {
  background: rgba(94, 198, 232, 0.16);
  color: #b9e8f7;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.7rem;
  margin-bottom: 0.6rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.select-row select {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

.select-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin: 0.55rem 0;
  font-size: 0.92rem;
}

.range-row input[type="range"] {
  flex: 1;
  max-width: 55%;
}

output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-bar .is-error {
  color: var(--danger);
}

.support-notice {
  margin: 0 1.2rem 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(255, 196, 90, 0.12);
  color: #ffd98e;
  font-size: 0.85rem;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100vh;
  padding: 1.2rem;
  background: var(--panel);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(14px);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  z-index: 20;
}

.settings-panel.open {
  transform: translateX(0);
}

.panel-header h2 {
  margin: 0;
}

.panel-header p {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-section {
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-section h3 {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.button-row button {
  flex: 1;
}

.full-width {
  width: 100%;
}

.switch-row,
.range-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin: 0.55rem 0;
  font-size: 0.92rem;
}

.shortcuts ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shortcuts li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 720px) {
  .status-bar {
    flex-direction: column;
  }

  .brand p {
    display: none;
  }
}
