/* style.css */

/* ── Splash screen ──────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1.5s ease;
}

#splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-lines {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  transition: opacity 0.7s ease;
}

.splash-lines.fade-out {
  opacity: 0;
}

#splash-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #fff;
  opacity: 0;
  transition: opacity 0.8s ease;
  white-space: nowrap;
}

#splash-coat {
  transition: color 0.5s ease;
}

#splash-logo.visible {
  opacity: 1;
}


.splash-line {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  opacity: 0;
  transform: translateY(10px);
  animation: splash-line-in 1.2s ease forwards;
  animation-delay: calc(0.9s + var(--i) * 1.5s);
}

@keyframes splash-line-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Full-screen reset */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: black;
  overflow: hidden;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Canvas fills the screen behind the toolbar */
#output {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 1;
}

/* ── Vibe input bar ─────────────────────────────────────────── */
#vibe-bar {
  position: absolute;
  bottom: calc(4rem + env(safe-area-inset-bottom, 0px)); /* sits above toolbar */
  left: 1rem;
  right: 1rem;
  z-index: 2;

  display: flex;
  align-items: center;
  gap: 0.5rem;

  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 0.4rem 0.4rem 0.4rem 1rem;
}

#vibe-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 1rem;
  caret-color: #fff;
  min-width: 0;
}

#vibe-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#vibe-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#vibe-send svg {
  width: 18px;
  height: 18px;
}

#vibe-send:active {
  background: #ccc;
}

#vibe-send.disconnected {
  opacity: 0.35;
}

/* ── Bottom toolbar ─────────────────────────────────────────── */
#toolbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0.75rem 1.25rem;
  /* push above iOS home indicator / Android nav bar */
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));

  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

/* Colour-picker buttons grouped together */
#controls {
  display: flex;
  gap: 0.75rem;
}

#controls button {
  width: 48px;
  height: 48px;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.15s, border-color 0.15s, opacity 0.15s;
  /* larger tap target on mobile */
  -webkit-tap-highlight-color: transparent;
}

#controls button:active {
  transform: scale(0.92);
}

#controls button.active {
  border-color: #fff;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.35);
}

#controls button[data-color="green"]  { background-color: #3cff00; }
#controls button[data-color="blue"]   { background-color: #0011ff; }

#btn-test {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

#btn-test.active {
  background: rgba(255, 200, 0, 0.7);
  color: #000;
}

#btn-snapshot {
  position: absolute;
  left: 1.25rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#btn-snapshot:active {
  background: rgba(255,255,255,0.3);
}

#btn-snapshot svg {
  width: 22px;
  height: 22px;
}

#btn-settings {
  position: absolute;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#btn-settings:active {
  background: rgba(255,255,255,0.3);
}

#btn-settings svg {
  width: 22px;
  height: 22px;
}

/* ── Settings panel ─────────────────────────────────────────── */
#settings-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9;
}

#settings-backdrop.open {
  display: block;
}

#settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(18, 18, 18, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  padding: 12px 0 0;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  color: #fff;
  font-family: inherit;
}

#settings-panel.open {
  transform: translateY(0);
}

.settings-drag-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 0 auto 14px;
  flex-shrink: 0;
}

.settings-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 12px;
  padding: 0 20px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.settings-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
}

.settings-section-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.setting-row + .setting-row {
  margin-top: 10px;
}

.setting-row--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-header label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.slider-value {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
  color: rgba(255, 255, 255, 0.85);
  min-width: 2.8ch;
  text-align: right;
}

#settings-panel input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
  display: block;
}

#settings-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

#settings-panel input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Keep overlay videos invisible but decoded */
#video-red,
#video-green,
#video-blue,
#video-yellow {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  visibility: hidden;
  pointer-events: none;
}
