html,
body {
  margin: 0;
  height: 100%;
  background: #0b0c10;
  overflow: hidden;
}

#viewer-controls {
  position: fixed;
  left: 12px;
  top: 52px;
  z-index: 4;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.ctrl-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.92);
  padding: 6px 10px;
  border-radius: 999px;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

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

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 45%,
    rgba(0, 0, 0, 0.16) 70%,
    rgba(0, 0, 0, 0.36) 100%
  );
}

#info-panel {
  position: fixed;
  top: 50%;
  right: calc(80px + 10vw);
  transform: translateY(-50%);
  width: min(36vw, 440px);
  max-width: 92vw;
  padding: 22px 22px 20px;
  color: rgba(255, 255, 255, 0.94);
  background: radial-gradient(
      120% 120% at 20% 0%,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.02) 55%,
      rgba(0, 0, 0, 0.4) 100%
    ),
    rgba(5, 6, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease,
    visibility 0s linear 0.6s;
  will-change: opacity, transform;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

#info-panel.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0s;
}

.info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-switch {
  display: inline-flex;
  gap: 6px;
}

.lang-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  padding: 6px 8px;
  border-radius: 999px;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-btn.is-active {
  background: rgba(255, 255, 255, 0.16);
}

.info-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 8px;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}

.info-panel h1 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 600;
}

.info-desc {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
  opacity: 0.9;
}

.info-meta {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.02em;
  opacity: 0.78;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}

.info-download {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.info-download:hover {
  background: rgba(255, 255, 255, 0.12);
}

#hud {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: rgba(255, 255, 255, 0.92);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.25;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
  z-index: 3;
}

#hud .card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
  max-width: 780px;
}

#hint {
  opacity: 0.85;
  font-size: 13px;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1;
}

@media (min-width: 900px) {
  #viewer-controls .seg,
  #viewer-controls #btn-info {
    display: none;
  }
}

@media (min-width: 900px) and (max-width: 1099px) {
  #info-panel {
    right: calc(80px + 10vw + -85px);
  }
}

@media (min-width: 1100px) and (max-width: 1299px) {
  #info-panel {
    right: calc(80px + 10vw - 35px);
  }
}

@media (min-width: 1300px) and (max-width: 1399px) {
  #info-panel {
    right: calc(80px + 10vw + 12px);
  }
}

@media (max-width: 899px) {
  #viewer-controls {
    top: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    row-gap: 6px;
  }

  #info-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: min(72vh, calc(100vh - 90px));
    bottom: 16px;
    top: auto;
    transform: translateY(20px);
    padding: 16px;
    border-radius: 16px 16px 12px 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease,
      visibility 0s linear 0.28s;
  }

  #info-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s;
  }

  #info-panel.is-visible {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px);
  }

  body.narrow-info-open #hud {
    display: none;
  }

}

@media (max-width: 899px) and (pointer: coarse) {
  #hud {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    align-items: center;
    justify-content: center;
  }

  #hud .card {
    width: min(88vw, 460px);
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
    text-align: center;
  }

  #hint {
    display: none;
  }
}
