:root {
  --bg: #080808;
  --text: #d0d0cc;
  --dim: #3a3a38;
  --mid: #666660;
  --line: #222220;
  --accent: #c8a44e;
  --red: #993333;
  --blue: #5580bb;
  --orange: #bb7730;
  --purple: #7744aa;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f3f0;
  --text: #1a1a18;
  --dim: #b0b0a8;
  --mid: #888880;
  --line: #d8d8d4;
  --accent: #9a7a30;
  --red: #993333;
  --blue: #3366aa;
  --orange: #aa6620;
  --purple: #6633aa;
  color-scheme: light;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

body {
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.3s, color 0.3s;
}

#app {
  max-width: 400px;
  margin: 0 auto;
  padding: 32px 24px;
  padding-bottom: env(safe-area-inset-bottom, 32px);
}

/* --- HEADER --- */

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 48px;
}

header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 8px;
  text-transform: uppercase;
}

header h1 .x {
  color: var(--accent);
  font-weight: 300;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  font-family: inherit;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:active { color: var(--text); }

.connection-status {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
}
.connection-status.online { color: var(--accent); }

/* --- CONFIG --- */

.osc-config {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 48px;
}

.osc-config label {
  color: var(--dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 8px;
  font-weight: 600;
}

.osc-config input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--mid);
  padding: 4px 0;
  font-family: inherit;
  font-size: 12px;
  min-width: 0;
  flex: 1;
  outline: none;
  transition: border-color 0.2s;
}
.osc-config input:focus { border-bottom-color: var(--accent); }
.osc-config input[type="number"] { max-width: 48px; }

/* --- TRANSPORT --- */

.transport {
  display: flex;
  align-items: center;
  margin-bottom: 56px;
}

.transport-btn {
  flex: 1;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 3px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  text-transform: uppercase;
  line-height: 40px;
}
.tap-tempo { text-align: left; }
.resync { text-align: right; }
.tap-tempo:active, .tap-tempo.flash { color: var(--accent); }
.resync:active, .resync.flash { color: var(--text); }

.bpm-display {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-align: center;
  min-width: 80px;
  flex-shrink: 0;
}

/* --- ZONES --- */

.zone { margin-bottom: 56px; }

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.zone-header h2 {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--dim);
}

.kill-btn {
  font-family: inherit;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 3px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  text-transform: uppercase;
}
.kill-btn:active, .kill-btn.active { color: var(--text); }

/* --- LAYERS --- */

.layer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.layer-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--dim);
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.clips {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.clip {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.04s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clip:active, .clip.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- FADERS --- */

input[type="range"].fader {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  width: 0;
  height: 1px;
  background: var(--line);
  border: none;
  outline: none;
  cursor: pointer;
}
input[type="range"].fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1px;
  height: 20px;
  background: var(--accent);
}
input[type="range"].fader::-moz-range-thumb {
  width: 1px;
  height: 20px;
  background: var(--accent);
  border: none;
}

/* --- MOODS --- */

.moods {
  display: flex;
  gap: 6px;
  margin-top: 24px;
}

.mood-btn {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 0;
  line-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  text-transform: uppercase;
  text-align: center;
  transition: all 0.06s;
}
.mood-btn.vibe:active, .mood-btn.vibe.active {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(85, 128, 187, 0.12);
}
.mood-btn.climax:active, .mood-btn.climax.active {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(187, 119, 48, 0.12);
}
.mood-btn.blackout:active, .mood-btn.blackout.active {
  color: var(--purple);
  border-color: var(--purple);
  background: rgba(119, 68, 170, 0.12);
}
