html, body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  overflow: hidden;
  height: 100%;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 10;
  transition: opacity 600ms ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#start {
  padding: 14px 28px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease;
}

#start:hover {
  border-color: #fff;
}

#webcam {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 120px;
  height: 90px;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transform: scaleX(-1);
}

#top-hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: calc(100vw - 180px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease;
}

#bottom-hud {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease;
}

#bottom-right-hud {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease;
}

body.experience-live #bottom-hud {
  opacity: 1;
  visibility: visible;
}

body.experience-live #bottom-right-hud {
  opacity: 1;
  visibility: visible;
}

body.experience-live #top-hud {
  opacity: 1;
  visibility: visible;
}

.hud-chip,
#about-link,
#back-link {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  background: rgba(18, 20, 26, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px 18px 11px;
  line-height: 1;
  white-space: nowrap;
}

#add-assets-button {
  appearance: none;
  border-radius: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

#add-assets-button:hover,
#add-assets-button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

#add-assets-button:disabled {
  cursor: default;
  opacity: 0.45;
}

#about-link,
#manual-link {
  position: fixed;
  top: 16px;
  z-index: 20;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, color 200ms ease, border-color 200ms ease;
}

#about-link {
  right: 16px;
}

#manual-link {
  right: 106px;
  appearance: none;
  border-radius: 0;
  cursor: pointer;
}

body.experience-live #about-link,
body.experience-live #manual-link {
  opacity: 1;
  visibility: visible;
}

#about-link:hover,
#manual-link:hover,
#manual-link:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

body.experience-live.assets-prompt #add-assets-button {
  color: #39ff14;
  border-color: rgba(57, 255, 20, 0.74);
  box-shadow: 0 0 16px rgba(57, 255, 20, 0.28);
  animation: add-assets-pulse 950ms ease-in-out infinite alternate;
}

body.experience-live.assets-prompt #assets-status {
  color: rgba(57, 255, 20, 0.72);
}

.manual-target-outline,
#about-link.manual-target-outline,
#asset-show-button.manual-target-outline,
#asset-show-button.manual-target-outline:disabled {
  color: #39ff14;
  border-color: rgba(57, 255, 20, 0.95);
  opacity: 1;
}

@keyframes add-assets-pulse {
  from {
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.18);
  }
  to {
    box-shadow: 0 0 26px rgba(57, 255, 20, 0.46);
  }
}

#asset-modal {
  position: fixed;
  right: 16px;
  bottom: 68px;
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

#asset-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

#asset-dialog {
  position: relative;
  width: min(280px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 16px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(18, 20, 26, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#asset-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

#asset-modal-close:hover,
#asset-modal-close:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

#asset-dialog-title {
  margin: 0 32px 14px 0;
  color: rgba(255, 255, 255, 0.86);
}

#asset-file-input {
  display: none;
}

#asset-select-button,
#asset-show-button {
  width: 100%;
  padding: 11px 12px 10px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

#asset-select-button:hover,
#asset-select-button:focus-visible,
#asset-show-button:hover,
#asset-show-button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

#asset-select-button:disabled,
#asset-show-button:disabled {
  cursor: default;
  opacity: 0.45;
}

#asset-review-region {
  box-sizing: border-box;
  min-height: 54px;
  margin-top: 12px;
}

#asset-upload-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.58);
}

#asset-upload-status.processing {
  color: rgba(255, 255, 255, 0.72);
}

#asset-upload-status.processing::after {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: asset-processing-spin 700ms linear infinite;
}

#asset-upload-status.processed {
  color: rgba(255, 255, 255, 0.86);
}

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

#asset-file-list {
  display: grid;
  gap: 6px;
  min-height: 18px;
  max-height: 112px;
  margin-top: 10px;
  overflow: auto;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.48);
  scrollbar-color: rgba(255, 255, 255, 0.3) #000;
  scrollbar-width: thin;
}

#asset-file-list::-webkit-scrollbar {
  width: 8px;
  background: #000;
}

#asset-file-list::-webkit-scrollbar-track {
  background: #000;
}

#asset-file-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0;
}

#asset-show-button {
  margin-top: 14px;
}

.asset-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#loader {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 15;
  color: #fff;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  padding: 40px;
}
#loader.show { display: flex; }
#loader-title {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 24px;
  color: rgba(255,255,255,0.5);
}
#loader-log {
  color: rgba(255,255,255,0.8);
  width: min(66ch, calc(100vw - 80px));
  line-height: 1.8;
}

.loader-log-line {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1ch;
}

.loader-log-time {
  white-space: nowrap;
}

.loader-log-message {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

#fatal {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.9);
  z-index: 25;
  color: #ff6666;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  padding: 40px;
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.7;
}
#fatal.show { display: flex; }
#fatal h2 {
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin: 0 0 20px 0;
}

/* =============================================================
   MANUAL OVERLAY
   ============================================================= */
#manual-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

#manual-overlay.open {
  opacity: 1;
  visibility: visible;
}

.manual-highlight-box {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  box-sizing: border-box;
  border: 1px solid rgba(57, 255, 20, 0.95);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.64),
    0 0 24px rgba(57, 255, 20, 0.55);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transition: left 220ms ease, top 220ms ease, width 220ms ease, height 220ms ease, opacity 180ms ease;
}

.manual-highlight-box.is-shadow-only {
  border-color: transparent;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.64);
}

.manual-highlight-box.is-ring-only {
  box-shadow: none;
}

.manual-highlight-box.is-hidden {
  opacity: 0;
}

#manual-panel {
  position: fixed;
  left: 16px;
  top: 16px;
  width: min(340px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 16px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(8, 10, 12, 0.9);
  border: 1px solid rgba(57, 255, 20, 0.3);
  border-radius: 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: 'SF Mono', Menlo, monospace;
  pointer-events: auto;
  transition: left 220ms ease, top 220ms ease;
}

#manual-kicker,
#manual-step-count {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(57, 255, 20, 0.76);
}

#manual-title {
  margin: 10px 0 12px;
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

#manual-copy {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.7;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

#manual-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

#manual-controls {
  display: flex;
  gap: 8px;
}

#manual-controls button {
  min-width: 64px;
  padding: 9px 10px 8px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

#manual-controls button:hover,
#manual-controls button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

#manual-skip {
  color: rgba(57, 255, 20, 0.78);
  border-color: rgba(57, 255, 20, 0.34);
}

#manual-controls button:disabled {
  cursor: default;
  opacity: 0.38;
}

#manual-controls button[hidden] {
  display: none;
}

/* =============================================================
   ABOUT PAGE (about.html only)
   ============================================================= */
body.about-page {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

#back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  text-decoration: none;
  transition: color 200ms ease;
}

#back-link:hover {
  color: #fff;
}

#about-page-content {
  --about-copy-size: 11px;
  --about-copy-leading: 1.75;
  max-width: 560px;
  margin: 0 auto;
  padding: 136px 40px 80px;
  color: rgba(255, 255, 255, 0.85);
}

#about-page-content h1 {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--about-copy-size);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  font-weight: normal;
  margin: 0 0 52px 0;
}

#about-page-content p {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--about-copy-size);
  letter-spacing: 0.18em;
  word-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  line-height: var(--about-copy-leading);
  margin: 0 0 32px 0;
}

#about-page-content .about-meta {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: var(--about-copy-size);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-between;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 1024px) {
  #about-page-content {
    --about-copy-size: 15px;
    padding: 120px 32px 60px;
  }

  #start {
    transform: translateY(-2vh);
  }
}

@media (max-width: 640px) {
  #top-hud,
  #bottom-hud,
  #bottom-right-hud {
    gap: 8px;
  }

  .hud-chip,
  #about-link,
  #back-link {
    font-size: 9px;
    letter-spacing: 0.16em;
    padding: 9px 12px 8px;
    background: rgba(18, 20, 26, 0.82);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #start {
    font-size: 11px;
    padding: 12px 22px;
    letter-spacing: 0.2em;
    transform: translateY(6vh);
  }

  #loader {
    padding: 24px 20px;
    font-size: 10px;
  }

  #loader-title {
    font-size: 11px;
    margin-bottom: 16px;
  }

  #top-hud {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: calc(100vw - 116px);
  }

  #bottom-hud {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  #bottom-right-hud {
    flex-direction: column;
    align-items: flex-end;
  }

  #asset-modal {
    right: 8px;
    bottom: 86px;
  }

  #asset-dialog {
    width: min(264px, calc(100vw - 16px));
    padding: 14px;
    font-size: 9px;
    letter-spacing: 0.12em;
    background: rgba(18, 20, 26, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #manual-link {
    top: 50px;
    right: 16px;
  }

  #manual-panel {
    width: min(304px, calc(100vw - 24px));
    padding: 14px;
    background: rgba(8, 10, 12, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #manual-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  #manual-controls {
    width: 100%;
  }

  #manual-controls button {
    flex: 1;
    min-width: 0;
  }

  #about-page-content {
    --about-copy-size: 10px;
    --about-copy-leading: 1.65;
    padding: 96px 20px 60px;
    max-width: 100%;
  }

  #about-page-content h1 {
    margin: 0 0 36px 0;
  }

  #about-page-content p {
    font-family: 'SF Mono', Menlo, monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 18px;
  }

  #about-page-content .about-meta {
    margin-top: 40px;
  }
}
