:root {
  --ink: #000;
  --paper: #e9e3d5;
  --dim: rgba(233, 227, 213, 0.42);
  --faint: rgba(233, 227, 213, 0.22);
  --type: "Special Elite", "Courier New", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  height: 100dvh;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--type);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  transition: opacity 0.2s linear;
}

#scene {
  cursor: grab;
}

#scene.is-pointer {
  cursor: pointer;
}

#scene.is-dragging {
  cursor: grabbing;
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  transition: opacity 0.8s ease;
  z-index: 2;
}

.loader.is-done {
  opacity: 0;
  pointer-events: none;
}

.loader-mark {
  width: clamp(56px, 7vw, 84px);
  fill: none;
  stroke: var(--paper);
  stroke-width: 16;
  opacity: 0.85;
  animation: flicker 1.6s steps(2, jump-none) infinite;
}

@keyframes flicker {
  50% { opacity: 0.35; }
}

.hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding:
    0
    calc(clamp(16px, 3vw, 36px) + env(safe-area-inset-right))
    calc(clamp(14px, 2.6vw, 28px) + env(safe-area-inset-bottom))
    calc(clamp(16px, 3vw, 36px) + env(safe-area-inset-left));
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--dim);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 1;
}

.hud.is-on {
  opacity: 1;
}

.hud-hint {
  color: var(--faint);
}

.hud-where {
  display: flex;
  gap: 1.4em;
  text-transform: lowercase;
}

.hud-hint,
.hud::after {
  flex: 1;
}

.hud::after {
  content: "";
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .hud-hint {
    display: none;
  }
}

.is-accordion .hud {
  display: none;
}

@media (pointer: coarse) {
  .hud {
    color: rgba(233, 227, 213, 0.6);
    padding-top: 28px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 30%, rgba(0, 0, 0, 0));
  }

  .hud-hint {
    color: var(--dim);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-mark {
    animation: none;
  }
}

.deck {
  position: fixed;
  bottom: calc(clamp(14px, 2.6vw, 28px) - 14px + env(safe-area-inset-bottom));
  right: calc(clamp(16px, 3vw, 36px) - 6px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-transform: lowercase;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
  z-index: 1;
}

.hud.is-on ~ .deck {
  opacity: 1;
  pointer-events: auto;
}

.deck-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.deck-title {
  max-width: 30ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
}

.deck-no {
  margin-right: 0.7em;
  color: var(--faint);
}

.deck.is-playing .deck-title {
  color: var(--paper);
}

.deck-ctrl {
  display: flex;
  align-items: center;
  gap: 2px;
}

.deck-btn {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--dim);
  transition: color 0.2s ease;
}

.deck-btn:hover,
.deck-btn:focus-visible {
  color: var(--paper);
  outline: none;
}

.deck-btn svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.deck-btn.play svg {
  width: 12px;
  height: 12px;
}

.deck-btn.vol svg {
  width: 13px;
  height: 12px;
}

.deck-btn .w {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.deck-btn .i-pause,
.deck-btn .i-mute,
.deck.is-playing .deck-btn .i-play,
.deck.is-muted .deck-btn .i-vol {
  display: none;
}

.deck.is-playing .deck-btn .i-pause,
.deck.is-muted .deck-btn .i-mute {
  display: block;
}

.deck-level {
  position: relative;
  width: 48px;
  height: 26px;
  margin-left: 2px;
  cursor: pointer;
  touch-action: none;
  color: var(--dim);
}

.deck-level::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--faint);
}

.deck-level i {
  position: absolute;
  left: 0;
  top: 50%;
  height: 1px;
  background: var(--dim);
  transition: background 0.2s ease;
}

.deck-level i::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 5px;
  height: 5px;
  background: currentColor;
}

.deck-level:hover,
.deck-level:focus-visible,
.deck-level.is-drag {
  color: var(--paper);
  outline: none;
}

.deck-level:hover i,
.deck-level:focus-visible i,
.deck-level.is-drag i {
  background: var(--paper);
}

.deck.is-muted .deck-level i {
  width: 0 !important;
}

.deck-bar {
  position: relative;
  width: calc(100% - 6px);
  height: 1px;
  margin-right: 6px;
  background: var(--faint);
}

.deck-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--paper);
  opacity: 0.7;
}

.is-accordion .deck {
  bottom: calc(clamp(14px, 2.6vw, 28px) + env(safe-area-inset-bottom));
  padding: 6px 6px 8px 12px;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--faint);
}

.is-accordion .deck-title {
  max-width: 18ch;
}

.is-accordion .deck-level {
  display: none;
}
