/* SeekStories mobile receive page.
   Mobile-first; designed for portrait phones primarily. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #0a0a0a;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ── Brand chrome ─────────────────────────────────────────────── */
.ss-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
}
.ss-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff0075;
  flex-shrink: 0;
}
.ss-brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── State containers ─────────────────────────────────────────── */
.ss-state {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ss-hidden { display: none !important; }

/* ── LOADING STATE ────────────────────────────────────────────── */
#ss-loading {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
#ss-loading .ss-brand {
  margin-bottom: 48px;
}
.ss-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ff0075;
  border-radius: 50%;
  animation: ss-spin 0.9s linear infinite;
  margin-bottom: 24px;
}
@keyframes ss-spin {
  to { transform: rotate(360deg); }
}
.ss-status {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.65);
}

/* ── GALLERY STATE ────────────────────────────────────────────── */
.ss-header {
  flex-shrink: 0;
}
.ss-tagline {
  padding: 0 20px 16px 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

.ss-slides {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 20px;
}
.ss-slide-thumb {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(255, 0, 117, 0.2);
  aspect-ratio: 1 / 1;
  touch-action: manipulation;
}
.ss-slide-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ss-slide-thumb-index {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.ss-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ss-footer-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

.ss-footer-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  counter-reset: step;
}
.ss-footer-steps li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  counter-increment: step;
}
.ss-footer-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  background: #ff0075;
  color: #ffffff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-footer-steps strong {
  color: #ffffff;
  font-weight: 600;
}

.ss-footer-note {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border-left: 3px solid #ff0075;
}
.ss-footer-note strong {
  color: #ffffff;
  font-weight: 600;
}

.ss-footer-alt {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ss-disclaimer {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  line-height: 1.4;
}

/* ── BUTTONS ──────────────────────────────────────────────────── */
.ss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}
.ss-btn:active {
  opacity: 0.75;
}
.ss-btn-primary {
  background: #ff0075;
  color: #ffffff;
}
.ss-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* ── FULL-SCREEN PREVIEW ──────────────────────────────────────── */
.ss-preview {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.ss-preview-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}
.ss-preview-instruction {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin-bottom: 20px;
  max-width: 320px;
  line-height: 1.5;
  padding: 0 16px;
}
.ss-preview-instruction strong {
  color: #ff0075;
  font-weight: 700;
}
.ss-preview-img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  object-fit: contain;
  border-radius: 8px;
}

/* ── ERROR STATE ──────────────────────────────────────────────── */
#ss-error {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.ss-error-title {
  margin-top: 24px;
  font-size: 22px;
  font-weight: 700;
}
.ss-error-body {
  margin-top: 12px;
  max-width: 320px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

/* ── Primary "Save to Photos" (Web Share tier 1) ──────────────── */
.ss-save-photos-btn {
  margin: 4px 0 8px;
}
.ss-share-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 0 0 8px;
  line-height: 1.4;
}

/* Per-slide save button inside the full-screen preview */
.ss-preview-save {
  margin-top: 16px;
  max-width: 320px;
}

/* ── VIDEO VIEW ───────────────────────────────────────────────── */
.ss-video-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}
.ss-video-player,
.ss-video-poster {
  width: 100%;
  max-width: 360px;
  max-height: 70vh;
  border-radius: 16px;
  object-fit: contain;
  display: block;
}
.ss-video-save-btn {
  margin: 4px 0 8px;
}

/* Tier-1 confirmation thumbnail — a single, larger, centered slide
   shown when "Save all" works, replacing the full grid. */
.ss-slide-thumb-confirm {
  max-width: 220px;
  margin: 0 auto;
}

/* ── Tier-1 gallery layout ─────────────────────────────────────────
   When "Save all" works in one tap, the page is sparse: header,
   one confirmation thumbnail, the button. Center it vertically so it
   doesn't leave a big void with the button stranded at the bottom. */
.ss-gallery-tier1 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 24px;
}
.ss-gallery-tier1 .ss-slides {
  /* single thumbnail, centered, roomy */
  display: flex;
  justify-content: center;
  margin: 24px 0;
}
.ss-gallery-tier1 .ss-slide-thumb-confirm {
  max-width: 260px;
  width: 70%;
}
.ss-gallery-tier1 .ss-slide-thumb-confirm img {
  width: 100%;
  border-radius: 14px;
  display: block;
}
