:root {
  color-scheme: dark;
  --bg: #000000;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --pink: #fe2c55;
  --cyan: #25f4ee;
  --glass: rgba(18, 18, 22, 0.56);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hidden {
  display: none !important;
}

.ig-shell {
  width: 100%;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: #000;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.camera-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 4px 4px 0;
  border-radius: 22px;
  overflow: hidden;
  background: #0d0e12;
}

.stage-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.camera-fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #0d0e12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.svg-lg {
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.72);
}

.fallback-actions {
  display: flex;
  gap: 10px;
}

.fb-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.fb-btn.primary {
  background: #fff;
  color: #000;
  border-color: transparent;
}

.top-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ig-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.75));
  transition: transform 0.14s ease, opacity 0.15s ease;
}

.ig-icon-btn:active {
  transform: scale(0.88);
}

.ig-icon-btn svg {
  width: 25px;
  height: 25px;
}

.intensity-panel {
  position: absolute;
  top: 62px;
  right: 14px;
  left: 14px;
  z-index: 16;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
}

.intensity-panel input {
  flex: 1;
  accent-color: #fff;
}

.filter-pill {
  position: absolute;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.filter-pill.visible {
  opacity: 1;
}

.filter-pill .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

/* Capture overlay with Instagram-style centered shutter + filter circles */
.capture-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shutter-row {
  position: relative;
  width: 100%;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-carousel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 calc(50% - 28px);
  scrollbar-width: none;
}

.filter-carousel::-webkit-scrollbar {
  display: none;
}

.filter-orb {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.36);
  background: rgba(20, 22, 28, 0.72);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: center;
  transition: transform 0.18s ease, opacity 0.18s ease;
  opacity: 0.85;
}

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

.filter-orb.active {
  transform: scale(1.18);
  opacity: 1;
  border-color: transparent;
}

.shutter-ring {
  position: relative;
  z-index: 4;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
}

.shutter-core {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  transition: transform 0.14s ease, background 0.15s ease, border-radius 0.15s ease;
  pointer-events: none;
}

.shutter-ring.recording .shutter-core {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--pink);
}

.shutter-ring.video-mode .progress-ring circle {
  stroke: #ff385c;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 82px;
  height: 82px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.progress-ring circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3.5;
  stroke-dasharray: 239;
  stroke-dashoffset: 0;
  transition: stroke 0.15s ease;
}

.shutter-ring.recording .progress-ring circle {
  stroke: var(--pink);
  stroke-dashoffset: var(--rec-offset, 239);
}

.preview-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.action-pill {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--glass);
  backdrop-filter: blur(14px);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  cursor: pointer;
}

.action-pill.primary {
  background: #fff;
  color: #000;
  border-color: transparent;
  font-weight: 700;
}

.action-pill svg {
  width: 17px;
  height: 17px;
}

.processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Instagram-style Bottom Bar */
.bottom-bar {
  height: 62px;
  padding: 0 18px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-thumb-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #181a20;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.gallery-thumb-btn svg {
  width: 18px;
  height: 18px;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.9px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.mode-btn.active {
  color: #fff;
}

.mode-btn.platform {
  color: var(--cyan);
  font-size: 11px;
}

.mode-sep {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
}

.toast {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 22, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
