* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #eef2f7;
  background: #081016;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

[hidden] {
  display: none !important;
}

.model-loading {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
  pointer-events: none;
}

.model-loading.is-complete {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.model-loading span {
  display: block;
  color: #ffffff;
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
}

.top-links {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.github-link {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgb(226 239 255 / 24%);
  border-radius: 50%;
  color: #eef2f7;
  background: rgb(8 16 22 / 78%);
  box-shadow: 0 10px 28px rgb(0 0 0 / 22%);
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.github-link:hover {
  background: rgb(49 90 99 / 82%);
  transform: translateY(-1px);
}

.lang-switcher {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgb(226 239 255 / 20%);
  border-radius: 8px;
  background: rgb(8 16 22 / 78%);
  box-shadow: 0 10px 28px rgb(0 0 0 / 20%);
  backdrop-filter: blur(12px);
}

.lang-btn {
  min-width: 34px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9fb0bf;
  font-size: 12px;
  font-weight: 700;
}

.lang-btn:hover,
.lang-btn.is-active {
  color: #eef2f7;
  background: #315a63;
}

.controls-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4;
}

.panel {
  position: fixed;
  padding: 18px;
  border: 1px solid rgb(226 239 255 / 26%);
  border-radius: 8px;
  background: rgb(8 16 22 / 86%);
  box-shadow: 0 18px 42px rgb(0 0 0 / 24%);
  backdrop-filter: blur(14px);
}

.controls-panel {
  top: 72px;
  right: 18px;
  z-index: 3;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100vh - 96px);
  overflow: auto;
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 180ms ease;
}

#app[data-controls-panel="hidden"] .controls-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 28px));
}

#app[data-ui-panels="hidden"] .panel {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

h2,
h3,
p {
  margin: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.18;
  font-weight: 720;
}

h3 {
  margin: 18px 0 8px;
  color: #eef2f7;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: 0;
}

p {
  margin-top: 3px;
  color: #9fb0bf;
  font-size: 13px;
}

button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 34px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 6px;
  color: #eef2f7;
  background: #315a63;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: #3e707b;
}

button:disabled {
  color: #78909d;
  background: rgb(49 90 99 / 38%);
  cursor: not-allowed;
}

button:disabled:hover {
  background: rgb(49 90 99 / 38%);
}

.playback-controls {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
  margin-bottom: 12px;
}

.toggle-button[aria-pressed="true"] {
  background: #7c4e56;
}

.toggle-button[aria-pressed="true"]:hover {
  background: #935f68;
}

label {
  display: grid;
  grid-template-columns: 96px 1fr 42px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: #dce6ef;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

output {
  color: #9fb0bf;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: #61d394;
}

.camera-panel {
  top: auto;
  bottom: 18px;
  left: 18px;
  width: auto;
  max-height: calc(100vh - 36px);
  overflow: auto;
  transform: none;
}

.camera-panel .panel-header {
  margin-bottom: 0;
}

.copy-status {
  min-height: 18px;
  margin-top: 10px;
  color: #61d394;
  font-size: 12px;
}

.copy-status:empty {
  display: none;
}

@media (max-width: 620px) {
  .controls-toggle {
    top: 12px;
    right: 12px;
  }

  .top-links {
    top: 12px;
    left: 12px;
  }

  .github-link {
    width: 34px;
    height: 34px;
  }

  .controls-panel {
    top: 58px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 76px);
    padding: 16px;
  }

  h2 {
    font-size: 17px;
  }

  h3 {
    font-size: 16px;
  }

  label {
    grid-template-columns: 90px 1fr 38px;
    gap: 8px;
    min-height: 32px;
    font-size: 12px;
  }

  .camera-panel {
    top: auto;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: min(48vh, 380px);
  }
}
