html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #020306;
  color: #d7f9ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100dvh; }

html:fullscreen body,
html:-webkit-full-screen body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  image-rendering: auto;
}

.hud {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  color: #d7f9ff;
  background: rgba(2, 3, 6, .62);
  border: 1px solid rgba(119, 241, 255, .28);
  box-shadow: 0 0 24px rgba(26, 209, 255, .15);
  z-index: 5;
}
.hud.debug-enabled { grid-template-columns: auto auto auto minmax(0, 1fr) 110px; }

.volume { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.volume input { min-width: 0; }
.debug-panel {
  display: flex;
  align-items: center;
  gap: 5px;
}
.debug-panel[hidden] { display: none; }
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 7px;
  color: #d7f9ff;
  border: 1px solid rgba(119, 241, 255, .38);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.filter-toggle input { margin: 0; accent-color: #7ff4ff; }
.track-load {
  min-width: 88px;
  height: 34px;
  padding: 0 8px;
  font-size: 10px;
}
#track-name {
  max-width: 150px;
  overflow: hidden;
  color: #8fefff;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#debug-time {
  min-width: 116px;
  padding-left: 3px;
  color: #fff28a;
  font-size: 11px;
  white-space: nowrap;
}
#status { grid-column: 1 / -1; font-size: 12px; color: #fff28a; overflow-wrap: anywhere; }
#status:empty { display: none; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff28a; outline-offset: 2px; }

button {
  min-width: 42px;
  height: 34px;
  color: #021016;
  background: #7ff4ff;
  border: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #fff28a;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  font-size: 12px;
}

.meta strong,
.meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #7ff4ff;
}

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
  color: #d7f9ff;
  background: #020306;
  text-shadow: 0 0 14px #00d8ff;
  transition: opacity .35s ease;
  z-index: 4;
}

.boot strong {
  font-size: 64px;
  line-height: 1.1;
}

.boot span {
  font-size: 16px;
  color: #fff28a;
}

.boot small {
  color: #84a8b6;
}

.boot.hidden {
  opacity: 0;
}

@media (max-width: 620px) {
  .hud {
    grid-template-columns: auto auto 1fr;
  }
  .hud.debug-enabled { grid-template-columns: auto auto 1fr; }
  .debug-panel { grid-column: 1 / -1; }
  #track-name { max-width: 110px; }
  .volume { grid-column: 1 / -1; justify-self: end; width: 130px; }
  .boot strong { font-size: 32px; }

  .meta {
    flex-direction: column;
    gap: 2px;
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  html.mobile-landscape-fallback body {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
    touch-action: none;
  }

  html.mobile-landscape-fallback .hud {
    padding-right: max(10px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot { transition: none; }
}
