/* Photo Booth is isolated from the desktop window manager on purpose: camera
   permission and stream cleanup should never depend on another app's state. */
.photo-booth-layer {
  position: fixed;
  z-index: 260;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 42px;
  background: rgba(4, 7, 12, 0.58);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  backdrop-filter: blur(16px);
}

.photo-booth-layer[hidden] { display: none; }

.photo-booth-window {
  width: min(920px, calc(100vw - 84px));
  height: min(720px, calc(100dvh - 84px));
  min-height: 560px;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: #121317;
  color: #f7f7f8;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.68);
}

.pb-titlebar {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr 92px;
  align-items: center;
  padding: 0 15px;
  background: #292a2e;
  border-bottom: 1px solid #0a0a0b;
  user-select: none;
}

.pb-titlebar strong {
  justify-self: center;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.pb-privacy {
  justify-self: end;
  color: #9da2aa;
  font-size: 10px;
  white-space: nowrap;
}

.pb-close {
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.pb-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #050506;
}

.pb-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scaleX(-1);
  transition: filter 180ms ease;
}

.pb-stage[data-effect="noir"] .pb-video { filter: grayscale(1) contrast(1.24); }
.pb-stage[data-effect="vivid"] .pb-video { filter: saturate(1.7) contrast(1.08); }
.pb-stage[data-effect="warm"] .pb-video { filter: sepia(0.42) saturate(1.25) contrast(1.04); }

.pb-camera-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 34px;
  background: #0a0b0e;
  text-align: center;
}

.pb-camera-state[hidden] { display: none; }

.pb-camera-glyph {
  width: 84px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 2px solid #ff405f;
  border-radius: 18px;
  color: #ff405f;
  font-size: 34px;
  line-height: 1;
}

.pb-camera-state h2 {
  margin: 8px 0 0;
  font-size: 22px;
}

.pb-camera-state p {
  max-width: 410px;
  margin: 0;
  color: #a8abb2;
  font-size: 13px;
  line-height: 1.45;
}

.pb-retry {
  margin-top: 6px;
  padding: 8px 18px;
  border: 0;
  border-radius: 7px;
  background: #ff405f;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pb-countdown {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 124px;
  height: 124px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.54);
  color: #fff;
  font-size: 72px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px #000;
  backdrop-filter: blur(5px);
}

.pb-countdown[hidden],
.pb-flash[hidden] { display: none; }

.pb-flash {
  position: absolute;
  z-index: 5;
  inset: 0;
  background: #fff;
  pointer-events: none;
  animation: pb-flash 340ms ease-out forwards;
}

@keyframes pb-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.pb-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 126px;
  padding: 14px 20px 16px;
  border-top: 1px solid #050506;
  background: #232428;
}

.pb-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pb-effect {
  min-width: 52px;
  padding: 6px 9px;
  border: 1px solid #4a4c52;
  border-radius: 6px;
  background: #303137;
  color: #c9cbd0;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.pb-effect[aria-pressed="true"] {
  border-color: #ff405f;
  background: #ff405f;
  color: #fff;
}

.pb-shutter {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 5px solid #f5f5f6;
  border-radius: 50%;
  background: #ff405f;
  box-shadow: inset 0 0 0 3px #be1837, 0 4px 16px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  transition: transform 100ms ease;
}

.pb-shutter:hover { transform: scale(1.05); }
.pb-shutter:active { transform: scale(0.95); }
.pb-shutter:disabled { cursor: default; filter: grayscale(1); opacity: 0.45; transform: none; }

.pb-side {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.pb-status {
  min-height: 14px;
  color: #a8abb2;
  font-size: 11px;
  text-align: right;
}

.pb-filmstrip {
  min-height: 48px;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  overflow: hidden;
}

.pb-shot {
  position: relative;
  width: 64px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #6c6f77;
  border-radius: 5px;
  background: #101114;
  cursor: pointer;
}

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

.pb-shot:hover::after {
  content: "download";
  position: absolute;
  inset: auto 0 0;
  padding: 2px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 8px;
  text-align: center;
}

/* A solid, recognizable Photo Booth tile; the artwork itself is 42px, matching
   the other full-bleed app marks inside their standard 52px dock slots. */
.pb-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  background: #ef3155;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 5px rgba(0, 0, 0, 0.38);
}

.pb-icon::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #1d1f25;
}

.pb-icon::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
}

.photo-booth-launcher {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.photo-booth-launcher > .pb-icon { line-height: 1; }

.pb-phone-tile {
  background: #ef3155 !important;
  color: #fff;
}

.pb-phone-tile .pb-icon {
  width: 60px;
  height: 60px;
  border-radius: 0;
  box-shadow: none;
}

.pb-phone-tile .pb-icon::before { width: 27px; height: 27px; border-width: 5px; }
.pb-phone-tile .pb-icon::after { top: 10px; right: 11px; width: 7px; height: 7px; }

@media (max-width: 900px) {
  .photo-booth-layer {
    padding: 0;
    place-items: stretch;
    background: #050506;
    backdrop-filter: none;
  }

  .photo-booth-window {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr) auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .pb-titlebar { padding-top: env(safe-area-inset-top); }
  .pb-titlebar strong { font-size: 15px; }
  .pb-privacy { display: none; }

  .pb-controls {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "effects shutter"
      "side side";
    min-height: 158px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .pb-effects { grid-area: effects; }
  .pb-shutter { grid-area: shutter; width: 66px; height: 66px; }
  .pb-side { grid-area: side; width: 100%; grid-template-columns: 1fr auto; align-items: center; }
  .pb-filmstrip { min-height: 42px; }
  .pb-shot { width: 56px; height: 40px; }
  .pb-status { justify-self: start; text-align: left; }
}

@media (max-width: 460px) {
  .pb-effects { gap: 4px; }
  .pb-effect { min-width: 0; padding-inline: 7px; font-size: 10px; }
  .pb-controls { gap: 10px; padding-inline: 12px; }
  .pb-countdown { width: 104px; height: 104px; font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .pb-video,
  .pb-shutter { transition: none; }
  .pb-flash { animation-duration: 80ms; }
}
