:root {
  --bg-glass: rgba(18, 21, 26, 0.84);
  --border-stone: rgba(218, 198, 164, 0.32);
  --stone-gold: #e5c896;
  --stone-light: #f5efe4;
  --text-muted: #b6afa2;
  --accent-emerald: #34d399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #14181f;
  color: var(--stone-light);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

#viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 248, 230, 0.75);
  font-size: 20px;
  font-weight: 300;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  z-index: 10;
}

#hud-top {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-stone);
  border-radius: 10px;
  z-index: 20;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--stone-gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  background: rgba(229, 200, 150, 0.18);
  border: 1px solid var(--stone-gold);
  color: var(--stone-gold);
  padding: 2px 6px;
  border-radius: 4px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.telemetry-block {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.telemetry-block .lbl {
  color: var(--text-muted);
}

.btn-accent {
  background: linear-gradient(135deg, #d4af72, #b38847);
  color: #15120d;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-accent:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

#hud-places {
  position: fixed;
  top: 76px;
  left: 12px;
  width: 270px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-stone);
  border-radius: 10px;
  z-index: 20;
}

#hud-inspector {
  position: fixed;
  top: 76px;
  right: 12px;
  width: 290px;
  padding: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-stone);
  border-radius: 10px;
  z-index: 20;
}

.panel-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-gold);
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(218, 198, 164, 0.2);
  padding-bottom: 4px;
}

.places-list, .viewpoints-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.place-btn, .vp-btn {
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  color: var(--stone-light);
  border: 1px solid rgba(218, 198, 164, 0.18);
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.place-btn:hover, .vp-btn:hover {
  background: rgba(229, 200, 150, 0.16);
  border-color: var(--stone-gold);
}

.lvl-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(52, 211, 153, 0.18);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.inspector-body {
  font-size: 12px;
  line-height: 1.45;
  color: #e6dfd3;
  min-height: 108px;
}

.insp-row {
  margin-bottom: 4px;
}

.insp-key {
  color: var(--text-muted);
  font-size: 11px;
}

.insp-val {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--stone-gold);
}

.controls-help {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(218, 198, 164, 0.2);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  color: #fff;
}

/* QA Dialog */
dialog#qa-dialog {
  width: min(1120px, 94vw);
  max-height: 88vh;
  margin: auto;
  background: #171a21;
  color: var(--stone-light);
  border: 1px solid var(--stone-gold);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

dialog#qa-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(218, 198, 164, 0.22);
  background: #1e222b;
}

.dialog-header h2 {
  font-size: 17px;
  color: var(--stone-gold);
}

.dialog-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--stone-light);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.dialog-body {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(88vh - 76px);
}

.qa-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(218, 198, 164, 0.2);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

.qa-card h3 {
  color: var(--stone-gold);
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.qa-contact-img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 8px;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
}

.ledger-table th, .ledger-table td {
  border: 1px solid rgba(218, 198, 164, 0.2);
  padding: 6px 8px;
  text-align: left;
}

.ledger-table th {
  background: rgba(229, 200, 150, 0.1);
  color: var(--stone-gold);
}

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 23, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.loader-card {
  text-align: center;
  padding: 24px 32px;
  background: #1d222b;
  border: 1px solid var(--border-stone);
  border-radius: 12px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(229, 200, 150, 0.25);
  border-top-color: var(--stone-gold);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.qa-capture-mode #hud-top,
body.qa-capture-mode #hud-places,
body.qa-capture-mode #hud-inspector,
body.qa-capture-mode #crosshair,
body.qa-capture-mode #loading-overlay {
  display: none !important;
}
