:root {
  color-scheme: dark;
  font-family: Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #f7f9fc;
  background: #060b14;
  font-synthesis: none;
  --surface: #0d1625;
  --surface-soft: #121d2e;
  --line: rgb(255 255 255 / 10%);
  --muted: #8f9caf;
  --accent: #59f0c8;
  --accent-strong: #28d7ae;
  --danger: #ff6b7a;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #060b14;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 100% 0%, rgb(42 214 172 / 12%), transparent 31rem),
    radial-gradient(circle at 0% 45%, rgb(48 94 190 / 12%), transparent 28rem),
    #060b14;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    16px
    max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(89 240 200 / 34%);
  border-radius: 13px;
  background: linear-gradient(145deg, rgb(89 240 200 / 16%), rgb(89 240 200 / 3%));
  box-shadow: inset 0 1px rgb(255 255 255 / 9%), 0 10px 28px rgb(0 0 0 / 20%);
}

.brand-mark span {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50% 44% 52% 46%;
  box-shadow: 0 0 16px rgb(89 240 200 / 65%);
  transform: rotate(-14deg);
}

.brand-copy,
.brand-copy p,
.brand-copy h1,
h2,
p {
  margin: 0;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand-copy h1 {
  margin-top: 3px;
  font-size: 17px;
  line-height: 1.2;
}

.privacy-chip {
  padding: 7px 9px;
  border: 1px solid rgb(89 240 200 / 20%);
  border-radius: 999px;
  color: #bdf9e9;
  background: rgb(89 240 200 / 7%);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

main {
  display: grid;
  gap: 14px;
}

.camera-card,
.control-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, rgb(18 29 46 / 96%), rgb(10 18 31 / 96%));
  box-shadow: 0 24px 70px rgb(0 0 0 / 25%), inset 0 1px rgb(255 255 255 / 4%);
}

.camera-card {
  padding: 14px;
}

.camera-heading-row,
.section-heading,
.slider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin-top: 3px;
  font-size: 15px;
}

.performance-label {
  position: relative;
  padding-left: 13px;
  color: var(--muted);
  font-size: 10px;
}

.performance-label::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #718096;
  content: "";
  transform: translateY(-50%);
}

.performance-label.active::before {
  background: var(--accent);
  box-shadow: 0 0 9px rgb(89 240 200 / 85%);
}

.camera-stage {
  position: relative;
  display: grid;
  min-height: 300px;
  margin-top: 12px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 15px;
  background:
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px),
    #050a12;
  background-size: 24px 24px;
}

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

#output-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  touch-action: manipulation;
}

.camera-empty {
  position: absolute;
  z-index: 2;
  display: grid;
  width: min(240px, 78%);
  place-items: center;
  color: #cdd5e1;
  text-align: center;
  pointer-events: none;
}

.camera-empty.hidden {
  display: none;
}

.camera-empty strong {
  margin-top: 12px;
  font-size: 14px;
}

.camera-empty span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.camera-icon {
  position: relative;
  width: 46px;
  height: 34px;
  border: 2px solid rgb(89 240 200 / 55%);
  border-radius: 9px;
}

.camera-icon::before {
  position: absolute;
  top: 8px;
  left: 14px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  content: "";
}

.camera-icon::after {
  position: absolute;
  top: -8px;
  left: 8px;
  width: 16px;
  height: 7px;
  border-radius: 5px 5px 0 0;
  background: rgb(89 240 200 / 55%);
  content: "";
}

.focus-frame {
  position: absolute;
  z-index: 3;
  inset: 17px;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: rgb(89 240 200 / 52%);
  border-style: solid;
}

.corner-top-left {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
  border-radius: 7px 0 0;
}

.corner-top-right {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
  border-radius: 0 7px 0 0;
}

.corner-bottom-left {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 7px;
}

.corner-bottom-right {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 7px;
}

.tap-hint {
  position: absolute;
  z-index: 4;
  bottom: 12px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 999px;
  color: #d7dee9;
  background: rgb(5 10 18 / 70%);
  backdrop-filter: blur(8px);
  font-size: 10px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.camera-stage.active .tap-hint {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.status-message {
  min-height: 18px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.status-message.error {
  color: var(--danger);
}

.control-card {
  padding: 16px;
}

.background-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.background-swatch {
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 70%);
  border-radius: 6px;
  background: #111827;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 40%);
}

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

.button {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.button-primary {
  color: #04231c;
  background: linear-gradient(135deg, #70f5d2, #38dcb4);
  box-shadow: 0 9px 24px rgb(56 220 180 / 18%);
}

.button-secondary {
  color: #d6deea;
  border-color: rgb(255 255 255 / 10%);
  background: rgb(255 255 255 / 5%);
}

.button-wide {
  grid-column: 1 / -1;
}

.button:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button:disabled {
  color: #637084;
  background: rgb(255 255 255 / 3%);
  box-shadow: none;
  cursor: not-allowed;
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
}

.play-icon::before {
  position: absolute;
  top: 2px;
  left: 4px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
  content: "";
}

.pause-icon::before,
.pause-icon::after {
  position: absolute;
  top: 2px;
  width: 4px;
  height: 11px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.pause-icon::before {
  left: 2px;
}

.pause-icon::after {
  right: 2px;
}

.switch-icon {
  font-size: 17px;
  line-height: 14px;
}

.slider-block {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.slider-heading label {
  font-size: 12px;
  font-weight: 700;
}

.slider-heading output {
  min-width: 35px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--accent);
  background: rgb(89 240 200 / 8%);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 8px 0 0;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: #6f7d91;
  font-size: 9px;
}

.control-help {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.tip-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid rgb(89 240 200 / 11%);
  border-radius: 11px;
  color: #9fabbc;
  background: rgb(89 240 200 / 4%);
  font-size: 10px;
  line-height: 1.55;
}

.tip-box strong {
  color: #c8f9ec;
}

.tip-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgb(89 240 200 / 65%);
}

footer {
  padding: 17px 10px 0;
  color: #697588;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

@media (min-width: 620px) {
  .app-shell {
    padding-right: 22px;
    padding-left: 22px;
  }

  main {
    grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.65fr);
    align-items: start;
  }

  .camera-stage {
    min-height: 430px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .button-wide {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
