:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #aab1c5;
  --panel: rgba(17, 20, 32, 0.82);
  --panel-strong: #171a29;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ff4f8b;
  --accent-2: #34d5ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 79, 139, 0.24), transparent 28rem),
    linear-gradient(135deg, #10131e 0%, #242535 48%, #10131e 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23rem;
  gap: 1rem;
  min-height: 100dvh;
  padding: 1rem;
}

.booth,
.controls {
  min-width: 0;
}

.booth {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
}

.camera-frame {
  position: relative;
  overflow: hidden;
  min-height: 32rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #05070d;
  box-shadow: var(--shadow);
}

.camera-frame::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background: var(--scene-background, linear-gradient(135deg, #202433, #090b11));
  opacity: 0.52;
}

.camera-frame::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  content: "";
  background: var(--style-overlay, transparent);
  mix-blend-mode: screen;
}

video,
.frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  z-index: 2;
  object-fit: cover;
  transform: scaleX(-1);
  filter: var(--camera-filter, none);
}

.frame-overlay {
  z-index: 3;
  pointer-events: none;
  border: var(--frame-border, 0);
  box-shadow: var(--frame-shadow, none);
}

.camera-empty {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 0.9rem;
  padding: 2rem;
  text-align: center;
  background: rgba(5, 7, 13, 0.72);
}

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

.camera-icon {
  width: 4.75rem;
  height: 4.75rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-size: 3rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  font-size: 1rem;
}

.primary-action,
.secondary-action,
.text-button {
  min-height: 2.5rem;
  border-radius: 999px;
  background: var(--ink);
  color: #111421;
  font-weight: 800;
}

.primary-action {
  min-width: 10rem;
  padding: 0 1.25rem;
  justify-self: center;
}

.secondary-action {
  min-width: 0;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.capture-bar,
.controls {
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.capture-bar {
  display: grid;
  grid-template-columns: 3.25rem 5.25rem 3.25rem;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
}

.icon-button,
.shutter {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
}

.icon-button {
  width: 3.25rem;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line);
  font-size: 1.6rem;
}

.shutter {
  width: 5.25rem;
  border: 0.45rem solid var(--ink);
  background:
    radial-gradient(circle, var(--accent) 0 48%, transparent 50%),
    rgba(255, 255, 255, 0.08);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  overflow: auto;
}

.control-group {
  display: grid;
  gap: 0.75rem;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.group-header span,
.text-button {
  color: var(--muted);
  font-size: 0.86rem;
}

.text-button {
  min-height: 2rem;
  padding: 0 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.segmented,
.style-grid,
.background-grid,
.chip-grid,
.gallery {
  display: grid;
  gap: 0.55rem;
}

.segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.25rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
}

.segmented button,
.style-option,
.background-option {
  min-height: 2.65rem;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.segmented button.is-active,
.style-option.is-active,
.background-option.is-active {
  background: var(--ink);
  color: #111421;
}

.style-grid,
.background-grid,
.gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-panel {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.055);
}

.edit-preview {
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    #0b0e18;
}

.editor-section {
  display: grid;
  gap: 0.5rem;
}

.editor-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chip-grid button {
  min-height: 2.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.chip-grid button.is-active {
  background: var(--ink);
  color: #111421;
}

.editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 0.6rem;
}

.editor-actions .primary-action,
.editor-actions .secondary-action {
  width: 100%;
  justify-self: stretch;
}

.style-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0 0.7rem;
  background: rgba(255, 255, 255, 0.07);
}

.swatch {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.swatch.clean {
  background: linear-gradient(135deg, #f8fafc, #9ca3af);
}

.swatch.miami {
  background: linear-gradient(135deg, #ff4f8b, #34d5ff);
}

.swatch.noir {
  background: linear-gradient(135deg, #0f172a, #d1d5db);
}

.swatch.film {
  background: linear-gradient(135deg, #f59e0b, #7c2d12);
}

.background-option {
  background: var(--bg-preview);
  color: var(--ink);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}

.background-option[data-background="studio"] {
  --bg-preview: linear-gradient(135deg, #222738, #5b6277);
}

.background-option[data-background="sunset"] {
  --bg-preview: linear-gradient(135deg, #ff7a59, #4f46e5);
}

.background-option[data-background="neon"] {
  --bg-preview: linear-gradient(135deg, #101827, #00d4ff 52%, #ff36a3);
}

.background-option[data-background="paper"] {
  --bg-preview: linear-gradient(135deg, #f6f1e7, #8f9aa8);
}

.gallery {
  min-height: 6rem;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel-strong);
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  place-items: center;
  font-size: clamp(5rem, 22vw, 12rem);
  font-weight: 900;
  text-shadow: 0 12px 44px rgba(0, 0, 0, 0.5);
}

.countdown.is-visible {
  display: grid;
}

body[data-background="studio"] {
  --scene-background: linear-gradient(135deg, #1f2433, #62697d);
}

body[data-background="sunset"] {
  --scene-background: linear-gradient(135deg, #ff7a59 0%, #7c3aed 50%, #101827 100%);
}

body[data-background="neon"] {
  --scene-background:
    linear-gradient(90deg, rgba(255, 54, 163, 0.64) 0 14%, transparent 14% 86%, rgba(52, 213, 255, 0.64) 86%),
    linear-gradient(135deg, #0d1321, #1b1033);
}

body[data-background="paper"] {
  --scene-background:
    repeating-linear-gradient(0deg, rgba(17, 20, 33, 0.06) 0 1px, transparent 1px 14px),
    linear-gradient(135deg, #f6f1e7, #849c92);
}

body[data-style="clean"] {
  --camera-filter: saturate(1.04) contrast(1.02);
  --style-overlay: transparent;
  --frame-border: 0.55rem solid rgba(255, 255, 255, 0.88);
}

body[data-style="miami"] {
  --camera-filter: saturate(1.35) contrast(1.08);
  --style-overlay: linear-gradient(135deg, rgba(255, 79, 139, 0.24), rgba(52, 213, 255, 0.2));
  --frame-border: 0.55rem solid rgba(255, 255, 255, 0.88);
}

body[data-style="noir"] {
  --camera-filter: grayscale(1) contrast(1.28);
  --style-overlay: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.34));
  --frame-border: 0.55rem solid rgba(255, 255, 255, 0.75);
}

body[data-style="film"] {
  --camera-filter: sepia(0.32) saturate(1.15) contrast(1.12);
  --style-overlay:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, rgba(245, 158, 11, 0.1), rgba(124, 45, 18, 0.14));
  --frame-border: 0.55rem solid rgba(255, 248, 232, 0.86);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .camera-frame {
    min-height: 24rem;
    aspect-ratio: 4 / 5;
  }

  .controls {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 0.75rem;
    padding: 0.65rem;
  }

  .camera-frame,
  .capture-bar,
  .controls {
    border-radius: 1rem;
  }

  .camera-frame {
    min-height: 18rem;
  }

  .controls {
    padding: 0.85rem;
  }

  .capture-bar {
    grid-template-columns: 2.8rem 4.7rem 2.8rem;
  }

  .icon-button {
    width: 2.8rem;
  }

  .shutter {
    width: 4.7rem;
  }
}
