* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #0b0d10;
  color: #e8ecef;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  height: 100%;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  padding: 2rem;
  text-align: center;
  z-index: 10;
}

#overlay h1 {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.04em;
}

#status {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.85rem;
  color: #9aa4ad;
  margin: 0;
}

.hint {
  font-size: 0.8rem;
  color: #6a737c;
  max-width: 28ch;
  margin: 0;
}

#xr-button-slot button {
  background: #1f6feb;
  color: white;
  border: 0;
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

#xr-button-slot button:disabled {
  background: #2c3138;
  color: #6a737c;
  cursor: not-allowed;
}

#location-picker,
#location-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

#location-picker label {
  font-size: 0.85rem;
  color: #9aa4ad;
}

#location-select,
#location-form input {
  background: #14181d;
  color: #e8ecef;
  border: 1px solid #2c3138;
  border-radius: 0.3rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

#location-form input {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  width: 10ch;
}

#location-form input#location-name {
  width: 14ch;
  font-family: inherit;
}

#location-picker button,
#location-form button {
  background: #2c3138;
  color: #e8ecef;
  border: 0;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 0.3rem;
  cursor: pointer;
}

#location-picker button#location-add-btn {
  font-weight: 600;
  width: 2.2rem;
  padding: 0.45rem 0;
}

#location-form button#location-save {
  background: #1f6feb;
  color: white;
}

#location-json-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  width: min(36rem, 90vw);
}

#location-json-editor .hint {
  margin: 0;
  font-size: 0.75rem;
  color: #6a737c;
  max-width: none;
}

#location-json-editor code {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  background: #14181d;
  padding: 0 0.3rem;
  border-radius: 0.2rem;
}

#location-json-text {
  background: #14181d;
  color: #e8ecef;
  border: 1px solid #2c3138;
  border-radius: 0.3rem;
  padding: 0.5rem;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

#location-json-editor .row {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

#location-json-editor button {
  background: #2c3138;
  color: #e8ecef;
  border: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 0.3rem;
  cursor: pointer;
}

#location-json-editor button#location-json-save {
  background: #1f6feb;
  color: white;
}

canvas { display: block; }

body.in-xr #overlay { display: none; }

#xr-overlay {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 20;
  pointer-events: auto;
}

#xr-overlay button {
  background: rgba(31, 111, 235, 0.9);
  color: white;
  border: 0;
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

#xr-overlay #xr-status {
  background: rgba(0, 0, 0, 0.6);
  color: #e8ecef;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 1rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.4rem;
  margin: 0;
  min-width: 0;
  max-width: 26rem;
  white-space: normal;
  line-height: 1.4;
}

#xr-overlay #xr-debug {
  background: rgba(255, 193, 7, 0.85);
  color: #1a1a1a;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.95rem;
  padding: 0.4rem 0.7rem;
  border-radius: 0.4rem;
  margin: 0;
  min-width: 0;
  max-width: 26rem;
  font-weight: 600;
}

#xr-overlay #xr-debug:empty {
  display: none;
}

#settings-panel {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(11, 13, 16, 0.95);
  border: 1px solid #2c3138;
  border-radius: 0.6rem;
  padding: 1rem 1.2rem;
  width: min(28rem, 95vw);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: auto;
}

#settings-panel[hidden] {
  display: none;
}

#settings-panel .settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#settings-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.02em;
}

#settings-panel h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #9aa4ad;
  margin: 0 0 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#settings-panel section {
  border-top: 1px solid #1c2128;
  padding-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#settings-panel section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

#settings-panel #close-settings-btn {
  background: transparent;
  color: #cdd5db;
  border: 0;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

#settings-panel .row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

#settings-panel section > .row button {
  background: rgba(31, 111, 235, 0.85);
  color: white;
  border: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr 4ch;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.slider-row > span {
  color: #cdd5db;
}

.slider-row input[type="range"] {
  width: 100%;
}

.slider-value {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.8rem;
  color: #9aa4ad;
  text-align: right;
}
