:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #11110f;
  color: #f5f0e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(38, 157, 140, 0.15), transparent 36%),
    linear-gradient(315deg, rgba(238, 121, 79, 0.13), transparent 42%),
    #11110f;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid rgba(245, 240, 230, 0.16);
  border-radius: 8px;
  padding: 0 14px;
  color: #f5f0e6;
  background: rgba(245, 240, 230, 0.08);
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

button:hover {
  background: rgba(245, 240, 230, 0.13);
  border-color: rgba(245, 240, 230, 0.28);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #42d6c4;
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  width: 100vw;
  height: 100vh;
}

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(245, 240, 230, 0.08), transparent 42%),
    #070806;
}

#camera,
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera {
  object-fit: cover;
  opacity: 0.34;
  filter: saturate(0.8) contrast(1.12);
}

#camera.mirrored {
  transform: scaleX(-1);
}

#scene {
  z-index: 2;
  touch-action: none;
}

.status-strip {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: calc(100% - 36px);
  border: 1px solid rgba(245, 240, 230, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(245, 240, 230, 0.9);
  background: rgba(14, 14, 12, 0.72);
  backdrop-filter: blur(12px);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: #f2b84b;
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.14);
}

.status-dot.live {
  background: #42d6c4;
  box-shadow: 0 0 0 4px rgba(66, 214, 196, 0.14);
}

.status-dot.error {
  background: #ff746c;
  box-shadow: 0 0 0 4px rgba(255, 116, 108, 0.14);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  border-left: 1px solid rgba(245, 240, 230, 0.1);
  padding: 22px;
  background: rgba(19, 19, 16, 0.9);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 720;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: rgba(245, 240, 230, 0.58);
  font-size: 13px;
  line-height: 1.4;
}

.fps {
  flex: 0 0 auto;
  min-width: 60px;
  border-radius: 8px;
  padding: 6px 8px;
  color: rgba(245, 240, 230, 0.74);
  background: rgba(245, 240, 230, 0.07);
  font-size: 12px;
  text-align: center;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.primary-button {
  border-color: rgba(66, 214, 196, 0.34);
  background: rgba(66, 214, 196, 0.16);
}

.switch-row,
.range-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: rgba(245, 240, 230, 0.8);
  font-size: 13px;
}

.switch-row input {
  justify-self: end;
  width: 44px;
  height: 24px;
  accent-color: #42d6c4;
  cursor: pointer;
}

.range-row input {
  width: 100%;
  accent-color: #f2b84b;
  cursor: pointer;
}

.mapping-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.map-chip {
  min-height: 34px;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 8px 10px;
  color: rgba(245, 240, 230, 0.84);
  background: rgba(245, 240, 230, 0.055);
  font-size: 12px;
  line-height: 1.35;
}

.thumb {
  border-left-color: #f2b84b;
}

.index {
  border-left-color: #42d6c4;
}

.middle {
  border-left-color: #78a7ff;
}

.ring {
  border-left-color: #ff746c;
}

.pinky {
  border-left-color: #ca85ff;
}

@media (max-width: 840px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(480px, 68vh) auto;
    min-height: 100vh;
    height: auto;
  }

  .controls {
    border-top: 1px solid rgba(245, 240, 230, 0.1);
    border-left: 0;
  }

  .mapping-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }
}

@media (max-width: 520px) {
  .app-shell {
    grid-template-rows: minmax(420px, 62vh) auto;
  }

  .controls {
    padding: 16px;
  }

  .brand-row,
  .button-row,
  .switch-row,
  .range-row,
  .mapping-grid {
    grid-template-columns: 1fr;
  }

  .switch-row input {
    justify-self: start;
  }
}
