:root {
  --frame-width: min(82vw, 390px);
  --blue: #1657ad;
  --panel: rgba(255, 255, 255, 0.15);
  --line: rgba(255, 255, 255, 0.30);
  --muted: rgba(255, 255, 255, 0.80);
}

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

html {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #111;
}

body {
  position: relative;
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: #111;
  color: #fff;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

.bgvid {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.tint {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.42) 0%,
    rgba(0, 0, 0, 0.16) 26%,
    rgba(0, 0, 0, 0.16) 68%,
    rgba(0, 0, 0, 0.50) 100%
  );
}

.wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 18px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  text-align: center;
}

.logo {
  display: block;
  width: min(60%, 180px);
  height: auto;
  filter: drop-shadow(0 8px 22px rgba(0, 20, 60, 0.45));
}

.intro-copy {
  width: 100%;
  margin: 46px 0 0;
  color: #fff;
  text-align: center;
  font-size: 19px;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

#view {
  display: block;
  max-width: 100%;
  max-height: 53vh;
  border-radius: 16px;
  touch-action: pan-y;
  background: #0b0f15;
  box-shadow: 0 20px 48px rgba(0, 20, 60, 0.5);
}

.empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24%;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  gap: 10px;
}

button.act {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 13px;
  padding: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition:
    transform 0.08s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

button.act:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #fff;
  color: #124a9e;
  box-shadow: 0 10px 26px rgba(0, 10, 40, 0.34);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.34);
}

button.act:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.16);
}

.bolt {
  flex: 0 0 auto;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--panel);
  border-radius: 13px;
  box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: blur(6px);
}

.zoom label {
  min-width: 36px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

input[type="range"] {
  flex: 1;
  height: 22px;
  accent-color: #fff;
}

.hint {
  min-height: 1px;
  margin-top: -1px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.hidden {
  display: none !important;
}



/* =========================================================
   MOBILE FULL-BLEED SAFARI LAYOUT
   ========================================================= */

@media (max-width: 600px) {
  :root {
    --frame-width: min(82vw, 390px);
  }

  html,
  body {
    width: 100%;
    min-height: 100%;
    background: #111;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .bgvid,
  .tint {
    min-height: 100%;
  }

  .wrap {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
      calc(env(safe-area-inset-top) + 42px)
      0
      calc(env(safe-area-inset-bottom) + 14px);
    gap: 10px;
  }

  header {
    margin: 0;
    padding: 0;
  }

  .logo {
    width: min(60%, 180px);
  }

  .stage {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 34px;
    align-items: center;
  }

  #view {
    width: var(--frame-width);
    height: auto;
    max-width: none;
    max-height: none;
    touch-action: pan-y;
  }

  #view.is-editing {
    touch-action: pan-y;
  }

  .intro-copy {
    width: 100%;
    margin-top: 44px;
    font-size: 19px;
    line-height: 1.3;
  }

  .controls {
    width: var(--frame-width);
    flex: 0 0 auto;
    gap: 8px;
  }

  button.act {
    padding: 14px;
  }
}

.photo-hit-area {
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}




input.native-photo-input.is-hidden {
  display: none !important;
}


/* Upload interaction */
input[type="file"] {
  display: none;
}

.empty {
  pointer-events: auto;
  touch-action: pan-y;
  cursor: pointer;
}


/* Entire photo window is tappable before upload */
.stage {
  position: relative;
}

.photo-upload-zone {
  position: absolute;
  left: 13.8889%;
  top: 30.1042%;
  width: 72.2222%;
  height: 38.9583%;
  z-index: 8;
  display: block;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.photo-upload-zone.is-hidden {
  display: none;
}

.empty {
  pointer-events: none;
}


/* Editing guidance */
.edit-coach {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 90px);
  z-index: 30;
  transform: translateX(-50%);
  width: max-content;
  max-width: 82vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.edit-coach.is-fading {
  opacity: 0;
}


/* Actual photo editing window */
.photo-edit-zone {
  position: absolute;
  left: 13.8889%;
  top: 30.1042%;
  width: 72.2222%;
  height: 38.9583%;
  z-index: 9;
  display: block;
  background: transparent;
  touch-action: none;
  cursor: grab;
}

.photo-edit-zone:active {
  cursor: grabbing;
}

.photo-edit-zone.is-hidden {
  display: none;
}


/* =========================================================
   PORTRAIT EXPERIENCE GUARD
   ========================================================= */

.orientation-lock {
  display: none;
}

@media (max-width: 900px) and (orientation: landscape) {
  body {
    overflow: hidden;
  }

  .orientation-lock {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(0, 0, 0, 0.72);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .orientation-lock__content {
    max-width: 420px;
    text-align: center;
    color: #fff;
  }

  .orientation-lock__icon {
    margin-bottom: 18px;
    font-size: 56px;
    line-height: 1;
  }

  .orientation-lock h2 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
  }

  .orientation-lock p {
    margin: 0;
    font-size: 17px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
  }
}
