:root {
  --gold: #e8b23a;
  --ink: #0b0906;
  --glass: rgba(20, 16, 10, 0.42);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: #000;
}

html, body { margin: 0; height: 100%; overflow: hidden; }

body {
  color: #fff;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app { position: fixed; inset: 0; height: 100dvh; background: #000; }

#view {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

button {
  font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

/* Bottom bar */
#controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 28px calc(28px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
}
#controls .spacer { width: 52px; }
#flip { justify-self: end; }

.round {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: grid; place-items: center;
  transition: transform 140ms var(--ease-out);
}
.round:active { transform: scale(0.92); }
.round svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#shutter {
  position: relative; width: 84px; height: 84px; display: grid; place-items: center;
  touch-action: none; /* a long press must stay a press, not become a scroll or browser gesture */
}
#shutter svg { position: absolute; inset: 0; transform: rotate(-90deg); }
#shutter circle { fill: none; stroke-width: 5; }
#shutter .track { stroke: rgba(255, 255, 255, 0.92); }
#shutter .progress {
  stroke: var(--gold); stroke-linecap: round;
  stroke-dasharray: 289; stroke-dashoffset: 289;
}
#shutter .core {
  width: 66px; height: 66px; border-radius: 50%; background: #fff;
  transition: transform 160ms var(--ease-out), background 160ms, border-radius 160ms;
}
#shutter:active .core { transform: scale(0.9); }
#shutter.recording .core { transform: scale(0.5); border-radius: 10px; background: #ff3b30; }
#shutter.recording .progress { animation: ring 5s linear forwards; }
@keyframes ring { to { stroke-dashoffset: 0; } }

#shutter:disabled, #flip:disabled { opacity: 0.5; }

.hint {
  position: absolute; left: 0; right: 0;
  bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  text-align: center; font-size: 13px; letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: opacity 400ms var(--ease-out);
}
.hint.hide { opacity: 0; }

#flash {
  position: absolute; inset: 0; background: #fff; pointer-events: none;
  animation: flash 320ms var(--ease-out) forwards;
}
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

/* Overlays */
.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 0px);
}
.overlay[hidden] { display: none; }

#start { background: radial-gradient(120% 80% at 50% 30%, #2a1d08 0%, #000 70%); }
.card { text-align: center; max-width: 320px; }
.card h1 {
  margin: 0 0 8px; font: 600 30px/1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em; color: var(--gold);
}
.card p { margin: 0 0 24px; color: rgba(255, 255, 255, 0.75); }

.primary, .ghost {
  min-width: 140px; height: 50px; padding: 0 24px; border-radius: 25px;
  font-weight: 600;
  transition: transform 120ms var(--ease-out), background 120ms;
}
.primary { background: var(--gold); color: var(--ink); }
.ghost { background: rgba(255, 255, 255, 0.14); color: #fff; }
.primary:active, .ghost:active { transform: scale(0.96); }

/* The capture fills the screen behind the buttons; absolute sizing keeps a tall photo from
   pushing the buttons off-screen once it loads. */
#review { background: #000; display: block; padding: 0; }
#review[hidden] { display: none; }
#review .media { position: absolute; inset: 0; }
#review .media img, #review .media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block;
}
#review .actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 12px; justify-content: center;
  padding: 40px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

.toast {
  position: absolute; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px; border-radius: 20px; font-size: 13px; white-space: nowrap;
  pointer-events: none;
}
