:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #15171c;
  --panel-raised: #1b1e25;
  --text: #f5f7fb;
  --muted: #9da4b2;
  --subtle: #697180;
  --accent: #d8ff55;
  --danger: #ff8d8d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  min-height: 100svh;
  overflow-x: hidden;
}

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

.app-shell {
  width: min(100%, 540px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) calc(18px + var(--safe-right)) calc(22px + var(--safe-bottom)) calc(18px + var(--safe-left));
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.privacy-badge {
  flex: none;
  margin-top: 2px;
  padding: 7px 9px;
  border: 1px solid rgba(216, 255, 85, 0.24);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: #050608;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  isolation: isolate;
}

#cameraVideo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050608;
}

#cameraVideo[data-facing="user"] {
  transform: scaleX(-1);
}

.stage-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(180deg, rgba(5, 6, 8, 0.02), rgba(5, 6, 8, 0.72));
  color: #fff;
  text-align: center;
  transition: opacity 180ms ease;
}

.stage-overlay[hidden] {
  display: none;
}

.stage-overlay span {
  max-width: 270px;
  font-size: 14px;
  line-height: 1.55;
  text-wrap: balance;
}

.shot-toast {
  position: absolute;
  z-index: 4;
  top: 16px;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  border: 1px solid rgba(216, 255, 85, 0.22);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(11, 12, 15, 0.76);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.shot-toast[hidden],
.shot-strip[hidden] {
  display: none;
}

.shot-strip {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 12px;
  display: flex;
  width: min(44%, 142px);
  max-height: 82px;
  gap: 7px;
  padding: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 15px;
  scrollbar-width: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.shot-strip::-webkit-scrollbar {
  display: none;
}

.shot-strip.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.shot-card {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 72px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 11px;
  background: #050608;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.shot-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-card[data-state="confirmed"] {
  border-color: rgba(216, 255, 85, 0.76);
}

.shot-card-close {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(11, 12, 15, 0.75);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.status-message {
  min-height: 21px;
  margin: 13px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.status-message[data-tone="error"] {
  color: var(--danger);
}

.status-message[data-tone="success"] {
  color: var(--accent);
}

.queue-actions {
  min-height: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.queue-clear-button {
  padding: 3px 8px;
  border: 0;
  border-radius: 999px;
  color: var(--subtle);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.queue-clear-button:active {
  color: var(--text);
  background: var(--panel-raised);
}

.queue-clear-button[hidden] {
  display: none;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding: 24px 0 14px;
}

.control-button {
  min-width: 76px;
  min-height: 48px;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--text);
  background: var(--panel-raised);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.control-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.save-button {
  justify-self: end;
}

.control-button:disabled {
  opacity: 0.36;
  cursor: default;
}

.control-button:not(:disabled):active,
.shutter-button:active {
  transform: scale(0.94);
}

.shutter-button {
  position: relative;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f7f8fb;
  box-shadow: 0 0 0 5px rgba(247, 248, 251, 0.15), 0 8px 28px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.shutter-ring {
  position: absolute;
  inset: 7px;
  border: 2px solid #d4d8e0;
  border-radius: 50%;
}

.fine-print {
  margin: 0 auto;
  max-width: 380px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

@media (min-width: 600px) {
  .app-shell {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .camera-stage {
    aspect-ratio: 4 / 5;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    width: min(100%, 900px);
    min-height: 100svh;
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(260px, 0.7fr);
    grid-template-rows: auto 1fr auto;
    column-gap: 24px;
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .app-header {
    grid-column: 1 / -1;
    padding-bottom: 10px;
  }

  .camera-stage {
    grid-row: 2 / 4;
    aspect-ratio: 4 / 3;
    max-height: calc(100svh - 72px);
  }

  .status-message {
    align-self: end;
    margin-top: 0;
  }

  .controls {
    align-self: center;
    margin-top: 0;
  }

  .fine-print {
    grid-column: 2;
  }
}
