/* Monochrome, clear glass over the user's own photos. No accent colour: the pictures are the colour. */
:root {
  --bg: #000;
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.66);
  --faint: rgba(255, 255, 255, 0.4);
  --hairline: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-edge: rgba(255, 255, 255, 0.2);
  --glass-shine: rgba(255, 255, 255, 0.28);
  --on-primary: #0a0a0a;
  --danger: #ff8a7a;
  --radius: 22px;
  --tile-radius: 10px;
  --gutter: 16px;
  color-scheme: dark;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: calc(env(safe-area-inset-top) + 80px) var(--gutter) calc(env(safe-area-inset-bottom) + 40px);
}

main { max-width: 560px; margin: 0 auto; }
[hidden] { display: none !important; }

/* The first picked photo, blurred, fills the page behind everything. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #000 center / cover no-repeat;
  transform: scale(1.4);
  filter: blur(60px) saturate(1.2);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.backdrop.on { opacity: 1; }
.backdrop::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-shine), 0 8px 32px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
}

/* Top bar */
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 24px;
  background: linear-gradient(#000 0%, rgba(0, 0, 0, 0.6) 55%, transparent);
  pointer-events: none;
}
.brand {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.4px;
}

/* Start */
h1 {
  font-size: clamp(44px, 13vw, 64px);
  line-height: 1;
  letter-spacing: -2px;
  margin: 18vh 0 14px;
}
.lead { color: var(--muted); font-size: 17px; margin: 0 0 28px; max-width: 30em; }

.steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 0;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 14px;
}
.steps li { display: flex; align-items: center; gap: 8px; }
.steps span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.2px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.button:active { transform: scale(0.98); }
.button.primary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--on-primary);
  box-shadow: inset 0 1px 0 #fff, 0 8px 30px rgba(0, 0, 0, 0.3);
}
.button[aria-disabled='true'] { opacity: 0.4; pointer-events: none; }

.tip {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 14px;
}
.tip strong { display: block; color: var(--text); margin-bottom: 2px; }
.tip b { color: var(--text); font-weight: 600; }

/* Batch */
.heading { margin: 4px 2px 16px; }
h2 { font-size: 28px; letter-spacing: -0.8px; line-height: 1.1; margin: 0 0 4px; }
.heading p { margin: 0; color: var(--muted); font-size: 15px; }

.grid {
  list-style: none;
  padding: 0;
  margin: 0 0 240px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.tile {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--tile-radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.tile > img, .tile > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s ease, opacity 0.4s ease;
}
.tile.dim > img, .tile.dim > video { filter: brightness(0.55); }

.badges {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  pointer-events: none;
}
.badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.remove, .play {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--text);
  cursor: pointer;
}
.remove { top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; padding: 0; }
.play { inset: 0; background: transparent; width: 100%; }

/* Upload/processing state over a tile */
.state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.ring { width: 38px; height: 38px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: rgba(255, 255, 255, 0.22); }
.ring .fill { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.state.failed { color: var(--danger); }

.add-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  border-radius: var(--tile-radius);
  border: 1px dashed rgba(255, 255, 255, 0.28);
  color: var(--muted);
  cursor: pointer;
}

/* Dock */
.dock {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  padding: 40px var(--gutter) calc(env(safe-area-inset-bottom) + 16px);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55) 45%);
  pointer-events: none;
}
.dock-panel {
  pointer-events: auto;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 30px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.28);
}
.dock-state { display: none; }
.dock[data-state='review'] [data-state='review'],
.dock[data-state='working'] [data-state='working'],
.dock[data-state='ready'] [data-state='ready'] { display: block; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 14px;
}
.row strong { display: block; font-size: 15px; }
.row small { color: var(--muted); font-size: 13px; }

.switch {
  appearance: none;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch:checked { background: rgba(255, 255, 255, 0.92); }
.switch:checked::after { transform: translateX(20px); background: var(--on-primary); }

[data-state='working'] { padding: 10px 10px 8px; }
.progress-text { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 10px; }
.progress-text span { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; transition: width 0.4s ease; }
[data-state='working'] small { display: block; color: var(--muted); font-size: 13px; margin-top: 10px; }

.ready-note { margin: 12px 8px 4px; color: var(--muted); font-size: 13.5px; text-align: center; }
.ready-note b { color: var(--text); letter-spacing: 1px; }

/* Full-screen preview */
.player {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
}
.player::backdrop { background: #000; }
.player video { width: 100%; height: 100%; object-fit: contain; }
.close {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  right: var(--gutter);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  cursor: pointer;
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
