:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f5f0df;
  background: #050707;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    linear-gradient(180deg, #081112 0%, #050707 52%, #020303 100%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  box-shadow:
    inset 0 0 140px rgba(0, 0, 0, 0.74),
    inset 0 0 36px rgba(213, 44, 20, 0.18);
}

button,
input,
select {
  font: inherit;
}

#crystalCanvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  outline: none;
  touch-action: none;
}

#crystalCanvas:active {
  cursor: grabbing;
}

.viewer-ui {
  position: fixed;
  inset: 18px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.viewer-title,
.viewer-tools {
  border: 1px solid rgba(245, 240, 223, 0.16);
  border-radius: 8px;
  background: rgba(6, 10, 10, 0.76);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.viewer-title {
  display: grid;
  gap: 4px;
  min-width: 176px;
  padding: 13px 14px;
}

.viewer-title a {
  color: #c9d3b6;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.viewer-title strong {
  color: #fff1c9;
  font-size: 20px;
  line-height: 1.05;
}

.viewer-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(780px, calc(100vw - 36px));
  padding: 10px;
}

.select-control,
.slider-control,
.toggle-control {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #c9d3b6;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.select-control {
  width: 152px;
}

.slider-control {
  width: 168px;
}

.toggle-control {
  grid-template-columns: 18px max-content;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.toggle-control span {
  white-space: nowrap;
}

select,
button {
  min-height: 36px;
  border: 1px solid rgba(245, 240, 223, 0.22);
  border-radius: 8px;
  color: #fff7dc;
  background: rgba(17, 19, 15, 0.78);
}

select {
  width: 100%;
  padding: 0 30px 0 10px;
}

button {
  padding: 0 13px;
  cursor: pointer;
  font-weight: 800;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(78, 205, 196, 0.82);
  outline-offset: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: #f05d4d;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #f05d4d;
}

@media (max-width: 820px) {
  .viewer-ui {
    inset: 12px;
    display: grid;
    align-content: start;
  }

  .viewer-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: calc(100vw - 24px);
  }

  .select-control,
  .slider-control {
    width: auto;
  }

  button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .viewer-tools {
    grid-template-columns: 1fr;
  }
}
