/* facepls brand styling.
   Base: near-black #0c0c0c, light text. Primary accent = the facepls yellow,
   used sparingly for the primary CTA + selection highlight. Green is reserved
   for the live AR markers. Fonts: DynaPuff (playful display) + Manrope (body),
   matching the main facepls app. */

:root {
  color-scheme: dark;

  --bg: #0c0c0c;
  --text: #f5f5f4; /* stone-100 */
  --muted: #a8a29e; /* stone-400 */

  /* facepls yellow */
  --yellow: #f0d327;
  --yellow-grad: linear-gradient(180deg, #f6df56 0%, #f0d327 58%, #e1bd16 100%);
  --yellow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(145, 112, 0, 0.18);

  /* AR marker green (matches the app's liveness-success green) */
  --accent: #36f315;

  --surface: rgba(0, 0, 0, 0.65);
  --field-bg: rgba(0, 0, 0, 0.35);
  --hairline: rgba(255, 255, 255, 0.2);

  --font-body: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-playful: "DynaPuff", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.font-playful {
  font-family: var(--font-playful);
}

/* ---- Stage: camera + overlay ---- */
#stage {
  position: fixed;
  inset: 0;
  background: #000;
  touch-action: manipulation;
}

#camera,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera {
  object-fit: cover;
}

#overlay {
  pointer-events: none; /* taps handled on #stage */
}

/* Front-camera mirroring: flip video + overlay together. */
#stage.mirrored #camera,
#stage.mirrored #overlay {
  transform: scaleX(-1);
}

/* ---- Floating brand logo (over the live view) ---- */
.stage-logo {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  height: 28px;
  width: auto;
  opacity: 0.92;
  z-index: 20;
  pointer-events: none;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.6));
}

/* ---- Controls ---- */
.control {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 30;
}
.control:active {
  transform: scale(0.94);
}

/* ---- Hint ---- */
.hint {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(12px);
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  z-index: 25;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transition: opacity 0.4s ease;
}
.hint.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---- Overlays (start / loading / error) ---- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #161616 0%, #0c0c0c 70%);
  z-index: 40;
  padding: 24px;
}
.overlay.hidden {
  display: none;
}
.overlay-card {
  text-align: center;
  max-width: 360px;
}
.overlay-logo {
  height: 34px;
  width: auto;
  margin-bottom: 22px;
  opacity: 0.95;
}
.overlay-card h1 {
  font-family: var(--font-playful);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 8px 0 8px;
}
.overlay-card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 22px;
}
.overlay-card small {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

/* facepls primary button: yellow gradient pill with inset emboss + offset
   double-text shadow (a brand signature). */
.btn-yellow {
  font-family: var(--font-playful);
  position: relative;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--yellow-grad);
  box-shadow: var(--yellow-inset);
  color: #1c1917; /* stone-900 */
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  padding: 15px 30px;
  cursor: pointer;
}
.btn-yellow:active {
  transform: scale(0.97);
}
.btn-yellow .label {
  position: relative;
  display: inline-grid;
  place-items: center;
}
.btn-yellow .label .ghost {
  position: absolute;
  width: 100%;
  color: #fff;
  transform: translate(0.8px, 0.8px);
}
.btn-yellow .label .top {
  position: relative;
  color: #1c1917;
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Panel ---- */
.panel {
  position: fixed;
  z-index: 50;
  background: rgba(12, 12, 12, 0.82);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.22, 1);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
}

/* Mobile: bottom sheet */
.panel {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 24px 24px 0 0;
  border-bottom: none;
  transform: translateY(110%);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.panel.open {
  transform: translateY(0);
}

/* Desktop / wide: right side panel */
@media (min-width: 720px) {
  .panel {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: 360px;
    border-radius: 0;
    border-right: none;
    transform: translateX(110%);
    box-shadow: -18px 0 50px rgba(0, 0, 0, 0.55);
  }
  .panel.open {
    transform: translateX(0);
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h2 {
  font-family: var(--font-playful);
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-close {
  border: none;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field input,
.field textarea {
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px; /* >=16px stops iOS zoom-on-focus */
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  font-family: var(--font-body);
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(240, 211, 39, 0.25);
}
.panel-foot {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
