:root {
  --bg: #2c3136;
  --panel: rgba(16, 18, 21, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3f1ea;
  --muted: #b7b3a8;
  --accent: #c4a56a;
  --btn: rgba(255, 255, 255, 0.06);
  --btn-hover: rgba(255, 255, 255, 0.12);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

#viewer:fullscreen,
#viewer:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

#unity-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#unity-canvas:focus { outline: none; }

#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  width: min(320px, calc(100% - 40px));
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  z-index: 3;
}

#hud[hidden] { display: none; }

#hud-toggle,
#hud-backdrop {
  display: none;
}

#hud-toggle .caret {
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-left: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}

#hud-toggle[aria-expanded="true"] .caret {
  transform: translateY(2px) rotate(-135deg);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

button {
  appearance: none;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--btn);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

button:hover { background: var(--btn-hover); }

.opacity {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

#loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 4;
}

#loader[hidden] { display: none; }

.loader-copy {
  width: min(280px, calc(100vw - 48px));
  text-align: left;
}

.loader-copy p:last-of-type {
  margin: 6px 0 14px;
  font-size: 20px;
}

.track {
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

#loader-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
}

#fullscreen {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  z-index: 3;
}

@media (max-width: 720px) {
  #hud-toggle {
    display: inline-flex;
    align-items: center;
    position: absolute;
    top: 14px;
    left: 14px;
    width: auto;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    z-index: 6;
  }

  #hud-toggle[hidden] { display: none; }

  #hud-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 4;
  }

  #hud-backdrop[hidden] { display: none; }

  #hud {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(58vh, 520px);
    overflow: auto;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
    transition: transform 0.22s ease;
    z-index: 5;
    pointer-events: none;
  }

  #hud.is-open {
    transform: translateY(0);
    pointer-events: auto;
  }

  #hud .hint { display: none; }

  #hud h1 {
    margin-bottom: 12px;
    font-size: 18px;
  }

  #fullscreen { z-index: 6; }
}
