/* Result — app/result.tsx (original styling). */

.screen-result {
  padding-bottom: var(--safe-bottom);
}

.screen-result .result-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-lg);
  margin-bottom: var(--s-sm);
}

.screen-result .result-image {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 var(--s-lg);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-muted);
  box-shadow: var(--sh-card);
  isolation: isolate;
}

.screen-result .result-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen-result .result-footer {
  flex-shrink: 0;
  padding: var(--s-lg) var(--s-lg) var(--s-md);
}

.screen-result .result-title {
  margin: 0 0 var(--s-md);
  text-align: center;
  color: var(--text);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.screen-result .result-title:has(+ .result-ai-label) {
  margin-bottom: 2px;
}

.screen-result .result-ai-label {
  margin: 0 0 var(--s-md);
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.screen-result .mini-actions {
  display: flex;
  justify-content: center;
  gap: var(--s-xxl);
}

.screen-result .mini-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  transition: opacity 0.15s ease;
}

/* The app dims mini actions while pressed instead of scaling them. */
.screen-result .mini-action.pressable.is-pressed {
  transform: none;
  opacity: 0.7;
}

.screen-result .mini-circle {
  width: 52px;
  height: 52px;
  margin-bottom: var(--s-xs);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--sh-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text);
}

.screen-result .mini-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.screen-result .result-more {
  margin-top: var(--s-lg);
}

/* ---------- Before / after: one sweep from the original, then hold to compare ---------- */

.screen-result .result-image.has-compare {
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.screen-result .result-image.has-compare:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft), var(--sh-card);
}
.screen-result .result-image.has-compare img {
  pointer-events: none;
}

/* The shared scanner loops; here it is driven by result.js (one sweep, then rest). */
.screen-result .result-compare .after {
  animation: none;
  clip-path: inset(0 0 100% 0);
  transition: opacity 0.14s ease;
}
.screen-result .result-compare .line {
  animation: none;
  opacity: 0;
  /* result.js moves this line with translateY(px), so keep it a thin 3px strip here (base.css
     makes the looping scanners' line a full-height transform layer). */
  height: 3px;
  margin-top: -1.5px;
  transform: none;
}
.screen-result .result-compare .line::after {
  bottom: 0;
}
.screen-result .cmp-rest .result-compare .after {
  clip-path: none;
}
.screen-result .cmp-peek .result-compare .after {
  opacity: 0;
}

.screen-result .compare-tag {
  position: absolute;
  top: var(--s-sm);
  left: var(--s-sm);
  z-index: 2;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: #fff;
  background: rgba(26, 28, 34, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.screen-result .compare-tag.tag-after {
  background: rgba(123, 92, 250, 0.82);
}
.screen-result .cmp-pre .tag-before,
.screen-result .cmp-peek .tag-before,
.screen-result .cmp-rest:not(.cmp-peek) .tag-after {
  opacity: 1;
}

.screen-result .compare-hint {
  position: absolute;
  left: 50%;
  bottom: var(--s-sm);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(26, 28, 34, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transform: translate(-50%, 6px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
  pointer-events: none;
}
.screen-result .compare-hint ion-icon {
  font-size: 14px;
}
.screen-result .cmp-rest:not(.used-hold) .compare-hint {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.25s;
}

/* ---------- Try another prank on this photo ---------- */

.screen-result .result-again {
  margin-top: var(--s-md);
}
.screen-result .result-again-label {
  margin: 0 0 var(--s-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
}
.screen-result .again-row {
  display: flex;
  gap: var(--s-xs);
  margin: 0 calc(-1 * var(--s-lg));
  padding: 2px var(--s-lg) 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-padding: 0 var(--s-lg);
}
.screen-result .again-row::-webkit-scrollbar {
  display: none;
}
.screen-result .again-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--s-xs);
  height: 44px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
}
.screen-result .again-chip img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-muted);
}

/* Entrance: the image zooms in with a soft spring, the footer rises after it. */
.screen-result.is-loading .result-image,
.screen-result.is-loading .result-footer {
  visibility: hidden;
}

.screen-result.is-ready .result-image {
  animation: resultZoomIn 0.6s cubic-bezier(0.22, 1.12, 0.36, 1) both;
}

.screen-result.is-ready .result-footer {
  animation: resultRise 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.04) 0.15s both;
}

@keyframes resultZoomIn {
  from {
    transform: scale(0);
  }
  to {
    transform: none;
  }
}

@keyframes resultRise {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.screen-result .result-missing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-md);
  padding: 0 var(--s-xxl) 80px;
  text-align: center;
  color: var(--text-2);
}
.screen-result .result-missing ion-icon {
  font-size: 40px;
  color: var(--text-3);
}
.screen-result .result-missing p {
  margin: 0;
}
.screen-result .result-missing .btn {
  max-width: 220px;
  margin-top: var(--s-xs);
}

/* Confetti burst (first view after a generation). */
.screen-result .confetti {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}
.screen-result .confetti i {
  position: absolute;
  display: block;
  will-change: transform, opacity;
  box-shadow: 0 0 0 0.5px rgba(26, 28, 34, 0.06);
}

/* Short screens (iPhone SE & co.): keep the image as big as possible. */
@media (max-height: 700px) {
  .screen-result .result-footer {
    padding-top: var(--s-md);
    padding-bottom: var(--s-sm);
  }
  .screen-result .result-title {
    margin-bottom: var(--s-sm);
  }
  .screen-result .result-title:has(+ .result-ai-label) {
    margin-bottom: 0;
  }
  .screen-result .result-ai-label {
    margin-bottom: var(--s-sm);
  }
  .screen-result .result-more {
    margin-top: var(--s-sm);
    height: 50px;
  }
  .screen-result .result-again {
    margin-top: var(--s-sm);
  }
  .screen-result .mini-circle {
    width: 46px;
    height: 46px;
    margin-bottom: 4px;
  }
}
