@font-face {
  font-family: 'Departure Mono';
  src: url('../haecceity/assets/DepartureMono-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  color: #e4eeeb;
  font-family: 'Departure Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
}

#gl-canvas,
#hud-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#gl-canvas {
  z-index: 0;
  image-rendering: pixelated;
  pointer-events: none;
}

#hud-canvas {
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

#hud-canvas.is-orbiting {
  cursor: grabbing;
}

/* Minimal top-right Haecceity reroll trigger */
.haecceity-btn {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 14;
  font-family: 'Departure Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: #e4eeeb;
  background: transparent;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.94);
  transition: background-color 0.12s ease, transform 0.08s ease, color 0.12s ease;
}

.haecceity-btn:hover {
  background: rgba(0, 0, 0, 0.42);
  color: #3ad8e8;
}

.haecceity-btn:active {
  transform: scale(0.97);
  color: #ece535;
}

.haecceity-btn:focus {
  outline: none;
}

/* Transparent Mobile Touch Controls (strictly hidden on desktop) */
.mobile-controls {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: block;
  }
}

.touch-pad {
  position: fixed;
  left: 20px;
  bottom: 24px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 1px solid rgba(228, 238, 235, 0.28);
  background: rgba(6, 10, 14, 0.16);
  pointer-events: auto;
  touch-action: none;
}

.touch-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  margin-left: -21px;
  margin-top: -21px;
  border-radius: 50%;
  border: 1px solid rgba(58, 216, 232, 0.55);
  background: rgba(58, 216, 232, 0.16);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

.touch-actions {
  position: fixed;
  right: 18px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(2, 58px);
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(228, 238, 235, 0.28);
  background: rgba(6, 10, 14, 0.18);
  color: rgba(228, 238, 235, 0.68);
  font-family: 'Departure Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn:active,
.touch-btn.is-active {
  background: rgba(58, 216, 232, 0.26);
  border-color: rgba(58, 216, 232, 0.78);
  color: #ffffff;
}

.touch-btn-fire {
  border-color: rgba(58, 216, 232, 0.45);
}

.touch-btn:focus {
  outline: none;
}

/* Hidden Tab-Toggleable Studio DAW Console (strictly 0 pixels until Tab is pressed) */
.daw-console {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  pointer-events: none;
}

.daw-console.is-open {
  display: flex;
}

.daw-panel {
  width: min(980px, 96vw);
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(5, 8, 12, 0.86);
  border: 1px solid rgba(58, 216, 232, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.72);
}

.daw-bar,
.daw-spatial-btns,
.daw-scene-pads {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.daw-mid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
}

.daw-bot {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 12px;
}

@media (max-width: 780px) {
  .daw-mid,
  .daw-bot {
    grid-template-columns: 1fr;
  }
}

.daw-section {
  border: 1px solid rgba(228, 238, 235, 0.14);
  background: rgba(10, 15, 20, 0.52);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.daw-sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.daw-sec-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(228, 238, 235, 0.65);
}

.daw-btn {
  font-family: 'Departure Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #e4eeeb;
  background: rgba(18, 26, 34, 0.85);
  border: 1px solid rgba(228, 238, 235, 0.24);
  padding: 5px 8px;
  cursor: pointer;
}

.daw-btn:hover {
  border-color: rgba(58, 216, 232, 0.75);
  color: #3ad8e8;
}

.daw-btn.is-on {
  background: rgba(58, 216, 232, 0.22);
  border-color: #3ad8e8;
  color: #ffffff;
}

.daw-btn.is-warn {
  background: rgba(236, 229, 53, 0.22);
  border-color: #ece535;
  color: #ece535;
}

.daw-btn.is-rec {
  background: rgba(255, 58, 58, 0.28);
  border-color: #ff4a4a;
  color: #ffffff;
}

.daw-btn.is-queued {
  border-color: #ece535;
  color: #ece535;
}

.daw-mini {
  padding: 2px 6px;
  font-size: 10px;
}

.daw-stem-row {
  display: grid;
  grid-template-columns: 46px 1fr 24px 24px;
  gap: 6px;
  align-items: center;
}

.daw-stem-lbl,
.daw-lane-lbl {
  font-size: 10px;
  color: rgba(228, 238, 235, 0.78);
}

.daw-slider {
  width: 100%;
  accent-color: #3ad8e8;
  cursor: pointer;
}

.daw-step-row {
  display: grid;
  grid-template-columns: 32px repeat(16, 1fr);
  gap: 3px;
  align-items: center;
}

.daw-cell {
  height: 18px;
  padding: 0;
  border: 1px solid rgba(228, 238, 235, 0.16);
  background: rgba(14, 20, 26, 0.72);
  cursor: pointer;
}

.daw-cell.is-beat {
  border-color: rgba(228, 238, 235, 0.30);
}

.daw-cell.is-active {
  background: rgba(58, 216, 232, 0.45);
  border-color: rgba(58, 216, 232, 0.85);
}

.daw-cell.is-accent {
  background: rgba(236, 229, 53, 0.65);
  border-color: #ece535;
}

.daw-cell.is-now {
  box-shadow: inset 0 0 0 2px #ffffff;
}

.daw-scene-btn {
  min-width: 44px;
  text-align: center;
}

.daw-scene-btn.is-filled {
  border-color: rgba(58, 216, 232, 0.55);
}

/* Studio v2 Tabs, Performance FX, VM // HEX Live-Coder & A/B Morph Console */
.daw-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daw-tabs-bar {
  border-bottom: 1px solid rgba(58, 216, 232, 0.22);
  padding-bottom: 8px;
}

.daw-status-lbl {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(228, 238, 235, 0.58);
  padding: 0 6px;
}

.daw-status-lbl.is-flash {
  color: #ece535;
}

.daw-filter-slider {
  width: 130px;
}

.daw-hex-input {
  flex: 1;
  min-width: 160px;
  font-family: 'Departure Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: #e4eeeb;
  background: rgba(8, 12, 16, 0.9);
  border: 1px solid rgba(228, 238, 235, 0.24);
  padding: 4px 7px;
}

.daw-vm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 10px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 780px) {
  .daw-vm-grid {
    grid-template-columns: 1fr;
  }
}

.daw-vm-row {
  display: grid;
  grid-template-columns: 24px 58px 42px 42px 42px 1fr;
  gap: 4px;
  align-items: center;
  padding: 2px 5px;
  border: 1px solid rgba(228, 238, 235, 0.10);
  background: rgba(12, 18, 24, 0.62);
}

.daw-vm-row.is-nop-inst {
  opacity: 0.48;
}

.daw-vm-row.is-ray-inst {
  border-left: 3px solid #52fad6;
}

.daw-vm-row.is-hover-inst {
  border-color: #3ad8e8;
  background: rgba(58, 216, 232, 0.14);
}

.daw-vm-row.is-write-inst {
  border-color: #ece535;
}

.daw-vm-addr {
  font-size: 9px;
  color: rgba(228, 238, 235, 0.55);
}

.daw-vm-op {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daw-vm-byte {
  width: 100%;
  font-family: 'Departure Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: #e4eeeb;
  background: rgba(6, 10, 14, 0.85);
  border: 1px solid rgba(228, 238, 235, 0.18);
  padding: 2px 3px;
  text-align: center;
}

.daw-vm-dis {
  font-size: 9px;
  color: rgba(150, 247, 190, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daw-morph-row {
  display: grid;
  grid-template-columns: 112px 1fr 112px;
  gap: 10px;
  align-items: center;
}

.daw-morph-slider {
  height: 18px;
}
