@import url('../type.css');

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

:root {
  --bg: #000;
  --panel: rgba(6, 6, 7, 0.92);
  --dock-surface: rgba(255, 255, 255, 0.025);
  --dock-surface-soft: rgba(255, 255, 255, 0.018);
  --dock-surface-hover: rgba(255, 255, 255, 0.045);
  --dock-surface-active: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.06);
  --fg: rgba(255, 255, 255, 0.88);
  --fg-dim: rgba(255, 255, 255, 0.52);
  --fg-muted: rgba(255, 255, 255, 0.30);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--type-size);
  font-weight: 400;
  line-height: var(--type-line);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: none;
}

body {
  cursor: default;
}

a,
button,
input {
  color: inherit;
  font: inherit;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
  cursor: crosshair;
}

.mode-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity 500ms ease;
}

.mode-stage.fading-in,
.mode-stage.fading-out {
  opacity: 0;
  pointer-events: none;
}

#top-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.logo {
  color: var(--fg-dim);
  text-decoration: none;
  font-weight: 520;
  letter-spacing: 0.14em;
  pointer-events: auto;
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--fg);
}

#top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#text-input,
#text-input-dock {
  width: 160px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--fg-dim);
  pointer-events: auto;
}

#text-input-dock {
  width: 150px;
}

#text-input:focus,
#text-input-dock:focus {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--fg);
}

#status,
.hint,
.ctrl-label,
.mini-readout,
.fps,
.mode-btn,
.pill-btn,
.prompt-title,
#start-btn {
  font-size: var(--type-size);
}

#status,
.hint,
.ctrl-label,
.mini-readout,
.fps {
  color: var(--fg-muted);
}

#status.live {
  color: var(--fg-dim);
}

#level-meter {
  position: relative;
  width: 36px;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

#level-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.80);
  transition: width 0.06s linear;
}

#start-prompt {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  width: min(280px, calc(100vw - 32px));
  margin: auto;
  pointer-events: none;
}

#start-prompt.hidden {
  display: none;
}

.prompt-title {
  color: var(--fg);
  font-weight: 520;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}

#start-prompt .hint {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}

#start-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.90);
  color: rgba(6, 6, 7, 0.94);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#start-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: none;
}

#dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(6, 6, 7, 0.72), rgba(6, 6, 7, 0.92));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#dock.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#mode-row {
  display: flex;
  gap: 4px;
  padding: 8px 14px 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

#mode-row::-webkit-scrollbar,
#control-bar::-webkit-scrollbar {
  display: none;
}

.mode-btn {
  flex-shrink: 0;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--dock-surface-soft);
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mode-btn:hover {
  background: var(--dock-surface-hover);
  border-color: rgba(255, 255, 255, 0.04);
  color: var(--fg-dim);
}

.mode-btn.active {
  background: var(--dock-surface-active);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

#control-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 48px;
  padding: 4px 14px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.control-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-height: 0;
  padding: 0;
  flex-shrink: 0;
}

.control-section.is-empty {
  display: none;
}

.ctrl-section-label {
  color: var(--fg-muted);
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0.7;
}

.section-rail,
#mode-param-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 10px;
  background: var(--dock-surface);
}

#mode-param-rail.is-empty {
  display: none;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  flex-shrink: 0;
}

.ctrl-spacer {
  flex: 1;
  min-width: 8px;
}

.pill-btn {
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--dock-surface-soft);
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pill-btn:hover {
  background: var(--dock-surface-hover);
  border-color: rgba(255, 255, 255, 0.04);
  color: var(--fg-dim);
}

.pill-btn.active,
.pill-btn.dj-active {
  background: var(--dock-surface-active);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.pill-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 14px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 6px;
  height: 6px;
  margin-top: -2.5px;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.82);
}

input[type="range"]::-moz-range-track {
  height: 1px;
  border: none;
  background: rgba(255, 255, 255, 0.10);
}

input[type="range"]::-moz-range-thumb {
  width: 6px;
  height: 6px;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.82);
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 0;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 0;
}

.fps {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  opacity: 0.6;
}

body.ui-hidden #dock,
body.ui-hidden #top-strip,
body.ui-idle-hidden #dock,
body.ui-idle-hidden #top-strip {
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 780px) {
  #top-strip,
  #mode-row,
  #control-bar {
    padding-left: 10px;
    padding-right: 10px;
  }

  #start-prompt {
    width: calc(100vw - 24px);
  }

  #text-input {
    width: 118px;
  }

  #text-input-dock {
    width: 122px;
  }

  .ctrl-group {
    gap: 5px;
  }

  .control-section {
    gap: 4px;
  }
}
