:root {
  color-scheme: dark;
  --bg: #050008;
  --text: #fff7ff;
  --muted: rgba(255, 247, 255, 0.68);
  --panel: rgba(12, 8, 20, 0.48);
  --panel-strong: rgba(10, 8, 16, 0.78);
  --line: rgba(255, 255, 255, 0.18);
  --hot: #ff2aa3;
  --cyan: #00f0ff;
  --lime: #c7ff32;
  --amber: #ffb000;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
label {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  position: fixed;
  inset: 0;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 42, 163, 0.28), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(0, 240, 255, 0.22), transparent 24%),
    #050008;
}

.camera-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #050008;
}

.gate {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5, 0, 8, 0.34), rgba(5, 0, 8, 0.84)),
    radial-gradient(circle at 50% 42%, rgba(255, 42, 163, 0.22), transparent 34%),
    radial-gradient(circle at 55% 55%, rgba(0, 240, 255, 0.18), transparent 36%);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.gate.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.brand-mark {
  width: 74px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    conic-gradient(from 45deg, var(--hot), var(--cyan), var(--lime), var(--amber), var(--hot));
  box-shadow: 0 0 34px rgba(255, 42, 163, 0.42), 0 0 58px rgba(0, 240, 255, 0.24);
}

.gate h1 {
  margin: 0;
  font-size: clamp(42px, 13vw, 76px);
  line-height: 0.9;
  letter-spacing: 0;
}

.gate p {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}

.gate-actions {
  width: min(100%, 320px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-action,
.secondary-action,
.dock-button,
.icon-button {
  appearance: none;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-weight: 760;
  cursor: pointer;
  backdrop-filter: blur(18px);
}

.primary-action {
  border: 0;
  color: #06030a;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  box-shadow: 0 12px 34px rgba(0, 240, 255, 0.24);
}

.secondary-action {
  display: grid;
  place-items: center;
}

.secondary-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.status-text {
  min-height: 20px;
  font-size: 13px;
}

.top-bar {
  position: absolute;
  z-index: 4;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.app-shell:not(.ready) .top-bar,
.app-shell:not(.ready) .meter-strip,
.app-shell:not(.ready) .bottom-dock {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.track-chip {
  min-width: 0;
  max-width: calc(100% - 86px);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.track-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 68px;
  min-height: 42px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: auto;
}

.meter-strip {
  position: absolute;
  z-index: 4;
  left: 12px;
  right: 12px;
  bottom: calc(94px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.meter {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.meter span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.meter i {
  display: block;
  width: 0%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--hot), var(--lime));
  box-shadow: 0 0 18px rgba(255, 42, 163, 0.44);
  transition: width 90ms linear;
}

.bottom-dock {
  position: absolute;
  z-index: 5;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: var(--panel-strong);
  backdrop-filter: blur(22px);
}

.dock-button {
  min-width: 0;
  border-radius: 18px;
  font-size: clamp(12px, 3.4vw, 15px);
}

.dock-button.record {
  background: rgba(255, 42, 98, 0.22);
  border-color: rgba(255, 42, 98, 0.62);
}

.dock-button.record.recording {
  color: #08020a;
  background: linear-gradient(135deg, #ff375f, #ffb000);
  animation: pulse 1s infinite;
}

.dock-button:disabled {
  opacity: 0.42;
}

.toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: calc(170px + env(safe-area-inset-bottom));
  max-width: min(320px, calc(100vw - 36px));
  transform: translateX(-50%) translateY(14px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(6, 4, 12, 0.84);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(18px);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 55, 95, 0);
  }

  50% {
    box-shadow: 0 0 24px rgba(255, 55, 95, 0.5);
  }
}

@media (orientation: landscape) {
  .gate h1 {
    font-size: 48px;
  }

  .meter-strip {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: 92px;
    width: 280px;
  }
}
