/* The controls take the project's theme: --ui is its accent colour and --ui-text a paler shade
   of it, both set by the page script. These are the values until it has. */
:root {
  --ui: #ff69b4;
  --ui-text: #ffb6c1;
}

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

/* The scene's canvas fills #viewport; the pointer orbits its camera from here. */
#viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

#viewport.dragging {
  cursor: grabbing;
}

#vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, #000 100%);
  opacity: 0;
  pointer-events: none;
}

#hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1vh;
  margin: 0;
  text-align: center;
  color: color-mix(in srgb, var(--ui-text) 55%, transparent);
  font: 11px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  pointer-events: none;
}

#hint[hidden] {
  display: none;
}

#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 4vh;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 12px;
}

#controls button {
  padding: 0.6em 1.4em;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: rgb(13 6 16 / 70%);
  color: var(--ui-text);
  font: 14px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

#controls button:disabled {
  opacity: 0.6;
  cursor: default;
}

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

#controls[hidden] {
  display: none;
}

/* The job bar (live page only): what the server is rendering or publishing, and a way to stop it */
#job {
  position: fixed;
  top: 2vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0.5rem 0.45rem 1rem;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: rgb(13 6 16 / 88%);
  color: var(--ui-text);
  font: 13px/1 system-ui, sans-serif;
  white-space: nowrap;
  z-index: 5;
}

#job[hidden] {
  display: none;
}

#job-cancel {
  padding: 0.45em 1em;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  cursor: pointer;
}

#job-cancel:hover {
  background: color-mix(in srgb, var(--ui) 25%, transparent);
}

#progress {
  width: min(220px, 30vw);
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ui-text) 20%, transparent);
  overflow: hidden;
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--ui);
  transition: width 1s linear;
}

#viewport.on-link {
  cursor: pointer;
}

#stage {
  display: block;
}

/* Buy me a coffee: wflet.ch's cup, drawn in the button's own colour */
#coffee svg {
  width: auto;
  height: 1.3em;
}

/* Share and Gear: a pill with a menu that opens above it */
.menu-anchor {
  position: relative;
}

.menu-anchor[hidden] {
  display: none;
}

#controls button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 11rem;
  padding: 0.4rem;
  border: 1px solid var(--ui);
  border-radius: 1rem;
  background: rgb(13 6 16 / 92%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
}

.menu.is-open {
  display: flex;
}

#controls .menu button {
  justify-content: flex-start;
  border-color: transparent;
  border-radius: 0.7rem;
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
}

#controls .menu button:hover,
#controls .menu button:focus-visible {
  background: color-mix(in srgb, var(--ui) 18%, transparent);
}

.menu p,
.menu span {
  margin: 0;
  padding: 0.35rem 0.8rem;
  color: var(--ui-text);
  font: 14px/1.3 system-ui, sans-serif;
  white-space: nowrap;
}

.menu p {
  color: color-mix(in srgb, var(--ui-text) 60%, transparent);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(4vh + 4rem);
  transform: translateX(-50%);
  padding: 0.6em 1.1em;
  border-radius: 999px;
  background: rgb(13 6 16 / 92%);
  color: var(--ui-text);
  font: 14px/1 system-ui, sans-serif;
  opacity: 0;
  pointer-events: none;
}

#toast.is-visible {
  animation: toast 2.6s ease forwards;
}

@keyframes toast {
  0%,
  100% {
    opacity: 0;
  }
  10%,
  80% {
    opacity: 1;
  }
}

/* Share menu: Visualiser or Music, as a two-part switch above the places to send it */
.menu-choice {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ui) 35%, transparent);
}

#controls .menu-choice button {
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

#controls .menu-choice button[aria-checked="true"] {
  border-color: var(--ui);
  background: color-mix(in srgb, var(--ui) 22%, transparent);
}

/* the scrubber: a short track beside play / pause */
#scrub {
  width: 150px;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ui-text) 30%, transparent);
  appearance: none;
  cursor: pointer;
}

#scrub:disabled {
  opacity: 0.4;
  cursor: default;
}

#scrub::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--ui);
  appearance: none;
}

#scrub::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--ui);
}

#scrub::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--ui);
}

/* over the player's volume slider */
#viewport.on-slider {
  cursor: ns-resize;
}

/* the scene editor's toolbar, across the top while editing (live page only) */
#edit-tools {
  position: fixed;
  top: 2vh;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: color-mix(in srgb, var(--ui-text) 70%, transparent);
  font: 12px/1 system-ui, sans-serif;
}

#edit-tools[hidden] {
  display: none;
}

#edit-tools button {
  padding: 0.5em 1.1em;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: rgb(13 6 16 / 70%);
  color: var(--ui-text);
  font: 13px/1 system-ui, sans-serif;
  cursor: pointer;
}

#edit-tools button[aria-pressed="true"],
#edit[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ui) 30%, transparent);
}

#edit-tools button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Info: a round button in the bottom right corner, its menu opening up and to the left */
#info {
  position: fixed;
  right: max(1.2rem, 2vw);
  bottom: 4vh;
}

#info > button {
  display: inline-flex;
  padding: 0.6em;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: rgb(13 6 16 / 70%);
  color: var(--ui-text);
  cursor: pointer;
}

#info .menu {
  left: auto;
  right: 0;
  transform: none;
}

.menu a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.2em;
  padding: 0.35rem 0.8rem;
  border-radius: 0.7rem;
  color: var(--ui-text);
  font: 14px/1.3 system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.menu a:hover,
.menu a:focus-visible {
  background: color-mix(in srgb, var(--ui) 18%, transparent);
}

.menu a small {
  color: color-mix(in srgb, var(--ui-text) 60%, transparent);
  font-size: 12px;
  text-decoration: underline;
}

.menu .menu-note {
  color: color-mix(in srgb, var(--ui-text) 60%, transparent);
  font-size: 12px;
}

/* Settings (live page only): a panel down the right side */
#settings[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ui) 30%, transparent);
}

#settings-panel {
  position: fixed;
  top: 2vh;
  right: max(1.2rem, 2vw);
  bottom: calc(4vh + 3.4rem);
  width: min(24rem, 92vw);
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-color: color-mix(in srgb, var(--ui) 60%, transparent) transparent;
  scrollbar-width: thin;
  padding: 0.4rem 1rem 0;
  border: 1px solid var(--ui);
  border-radius: 1rem;
  background: rgb(13 6 16 / 88%);
  color: var(--ui-text);
  font: 13px/1.35 system-ui, sans-serif;
}

#settings-panel[hidden] {
  display: none;
}

#settings-panel h2 {
  margin: 1rem 0 0.4rem;
  color: color-mix(in srgb, var(--ui-text) 60%, transparent);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#settings-panel label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.2rem 0.8rem;
  padding: 0.35rem 0;
}

#settings-panel label small {
  grid-column: 1 / -1;
  color: color-mix(in srgb, var(--ui-text) 55%, transparent);
  font-size: 11.5px;
}

#settings-panel input[type="text"],
#settings-panel input[type="number"],
#settings-panel select {
  width: 9.5rem;
  box-sizing: border-box;
  padding: 0.3em 0.6em;
  border: 1px solid color-mix(in srgb, var(--ui) 60%, transparent);
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 35%);
  color: var(--ui-text);
  font: inherit;
}

#settings-panel input[type="checkbox"] {
  accent-color: var(--ui);
}

#settings-panel input[type="color"] {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ui) 60%, transparent);
  border-radius: 0.4rem;
  background: none;
  cursor: pointer;
}

#settings-panel .swatches label div {
  display: flex;
  gap: 0.25rem;
}

#settings-panel footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.8rem -1rem 0;
  padding: 0.7rem 1rem;
  background: rgb(13 6 16 / 96%);
}

#settings-panel footer span {
  margin-right: auto;
  color: color-mix(in srgb, var(--ui-text) 70%, transparent);
  font-size: 12px;
}

#settings-panel footer button {
  padding: 0.5em 1.1em;
  border: 1px solid var(--ui);
  border-radius: 999px;
  background: rgb(13 6 16 / 70%);
  color: var(--ui-text);
  font: 13px/1 system-ui, sans-serif;
  cursor: pointer;
}

/* Modals (live page only), with daisyUI 3's modal structure and class names */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: hidden;
}

.modal:not([open]) {
  display: none;
}

.modal::backdrop {
  background: rgb(0 0 0 / 55%);
}

.modal-box {
  grid-area: 1 / 1;
  z-index: 1;
  width: min(32rem, 91.6667%);
  max-height: calc(100vh - 5em);
  box-sizing: border-box;
  overflow-y: auto;
  padding: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--ui) 55%, transparent);
  border-radius: 1rem;
  background: rgb(22 12 30);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 60%);
  color: var(--ui-text);
  font: 15px/1.45 system-ui, sans-serif;
  animation: modal-pop 0.2s ease-out;
}

@keyframes modal-pop {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
}

.modal-box h3 {
  margin: 0 0 0.8rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-box p {
  margin: 0.5rem 0;
}

.modal-box ul {
  margin: 0.4rem 0;
  padding-left: 1.3rem;
}

.modal-box li {
  margin: 0.2rem 0;
}

.modal-box .modal-note {
  color: color-mix(in srgb, var(--ui-text) 65%, transparent);
  font-size: 13px;
}

.modal-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.modal-action {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.modal-backdrop {
  grid-area: 1 / 1;
  align-self: stretch;
  justify-self: stretch;
  z-index: 0;
}

.modal-backdrop button {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: default;
}

.modal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  box-sizing: border-box;
  padding: 0 1.1rem;
  border: 1px solid color-mix(in srgb, var(--ui) 60%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--ui) 12%, transparent);
  color: var(--ui-text);
  font: 600 14px/1 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.modal .btn:hover {
  background: color-mix(in srgb, var(--ui) 28%, transparent);
}

.modal .btn-primary {
  border-color: var(--ui);
  background: var(--ui);
  color: #fff;
}

.modal .btn-primary:hover {
  background: color-mix(in srgb, var(--ui) 82%, #fff);
}

.modal .btn-error {
  border-color: #e5484d;
  background: #e5484d;
  color: #fff;
}

.modal .btn-whatsapp {
  border-color: #1fa855;
  background: #1fa855;
  color: #fff;
}

.modal .btn-whatsapp:hover {
  background: #25c065;
}

.modal .btn-error:hover {
  background: #f0666a;
}

/* the editor's toolbar sits under the job bar while a job is running */
#job:not([hidden]) ~ #edit-tools {
  top: calc(2vh + 3.4rem);
}
