/* ============================================================
   palm.css — StillGate Palm Reading
   ============================================================ */

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

html, body {
  height: 100%;
  background: #06070e;
  color: #d4d8e8;
  font-family: 'Noto Serif SC', serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Background Canvas ───────────────────────────────────── */
#palm-bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── App Container ───────────────────────────────────────── */
.pa-app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Chrome (back + dots + home) ────────────────────────── */
.pa-chrome {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
  height: 52px;
  position: relative;
  z-index: 10;
}

.pa-back, .pa-home-link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  color: rgba(200,210,230,0.65);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.pa-back:hover, .pa-home-link:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(200,210,230,0.90);
}

.pa-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}
.pa-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(160,175,215,0.22);
  transition: background 0.3s, transform 0.3s;
}
.pa-dot.active {
  background: rgba(185,152,180,0.80);
  transform: scale(1.25);
}

/* ── Acts (full-height panels) ───────────────────────────── */
.pa-act {
  position: absolute;
  inset: 52px 0 0;           /* below chrome */
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(22px);
  transition: opacity 0.32s ease, transform 0.32s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pa-act.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.pa-act.exit {
  opacity: 0;
  transform: translateX(-22px);
}
.pa-act--fullscreen {
  overflow: hidden;
}

/* ── Inner content wrapper ───────────────────────────────── */
.pa-inner {
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Typography ──────────────────────────────────────────── */
.pa-eyebrow {
  font-size: 10px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(185,152,180,0.60);
  margin-bottom: 12px;
}

.pa-headline {
  font-family: 'Cormorant Garamond', serif;
  font-style: normal;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.22;
  color: rgba(255,245,195,0.97);
  margin-bottom: 36px;
  letter-spacing: 0.2px;
}

/* ── Act 1: Hand Selection ───────────────────────────────── */
.pa-hand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
  max-height: 320px;
}

.pa-hand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  background: rgba(20, 18, 40, 0.60);
  border: 1px solid rgba(180,160,60,0.18);
  border-radius: 16px;
  cursor: pointer;
  color: rgba(200,210,230,0.70);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
}
.pa-hand-card:active { transform: scale(0.97); }
.pa-hand-card:hover {
  background: rgba(30, 26, 55, 0.80);
  border-color: rgba(185,152,180,0.45);
  color: rgba(245,235,175,0.95);
}

.pa-hand-svg {
  width: 60px;
  height: 78px;
  color: rgba(185,152,180,0.60);
  transition: color 0.18s;
}
.pa-hand-card:hover .pa-hand-svg { color: rgba(200,165,195,0.85); }

.pa-hand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 700;
  color: rgba(245,235,175,0.92);
}

.pa-hand-sub {
  font-size: 11px;
  letter-spacing: 0.3px;
  color: rgba(180,170,140,0.60);
  text-align: center;
  line-height: 1.4;
}

/* ── Act 2: Focus Selection ──────────────────────────────── */
.pa-focus-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pa-focus-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  background: rgba(18, 16, 36, 0.60);
  border: 1px solid rgba(160,175,215,0.08);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s;
}
.pa-focus-row:hover {
  background: rgba(28, 24, 50, 0.85);
  border-color: rgba(185,152,180,0.30);
}
.pa-focus-row:active { transform: scale(0.99); }

.pa-focus-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(185,152,180,0.08);
  border-radius: 10px;
  color: rgba(185,152,180,0.75);
  flex-shrink: 0;
}

.pa-focus-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pa-focus-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(225,220,195,0.92);
  letter-spacing: 0.2px;
}

.pa-focus-desc {
  font-size: 11px;
  color: rgba(170,165,145,0.60);
  line-height: 1.4;
}

.pa-focus-arrow {
  color: rgba(160,175,215,0.30);
  flex-shrink: 0;
}

/* ── Act 3: Capture ──────────────────────────────────────── */
.pa-inner--capture {
  align-items: center;
  text-align: center;
}
.pa-inner--capture .pa-headline { text-align: center; }

.pa-capture-frame {
  position: relative;
  width: min(240px, 65vw);
  height: min(288px, 78vw);
  margin-bottom: 18px;
  flex-shrink: 0;
}

.pa-guide-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(185,152,180,0.40);
  animation: guide-pulse 2.8s ease-in-out infinite;
}
@keyframes guide-pulse {
  0%, 100% { color: rgba(185,152,180,0.35); }
  50%       { color: rgba(185,152,180,0.65); }
}

.pa-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(185,152,180,0.40);
}

.pa-capture-hint {
  font-size: 11px;
  letter-spacing: 0.3px;
  color: rgba(170,160,130,0.55);
  margin-bottom: 24px;
  line-height: 1.5;
}

.pa-capture-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.pa-capture-error {
  font-size: 13px;
  color: rgba(220,120,100,0.85);
  text-align: center;
  min-height: 20px;
  margin-bottom: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.pa-btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  background: rgba(185,152,180,0.96);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a0a1c;
  letter-spacing: 0.5px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}
.pa-btn-primary:active { transform: scale(0.97); opacity: 0.88; }
.pa-btn-primary input[type="file"] { display: none; }

.pa-btn-secondary {
  display: flex;
  align-items: center;
  padding: 13px 20px;
  background: transparent;
  border: 1px solid rgba(185,152,180,0.32);
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  color: rgba(185,152,180,0.75);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, color 0.15s;
}
.pa-btn-secondary:hover {
  border-color: rgba(185,152,180,0.60);
  color: rgba(185,152,180,0.95);
}
.pa-btn-secondary input[type="file"] { display: none; }

.pa-btn-confirm {
  padding: 15px 36px;
  background: rgba(185,152,180,0.96);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a0a1c;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.pa-btn-confirm:active { transform: scale(0.97); }

/* Shimmer on confirm button */
@keyframes confirm-shimmer {
  0% { left: -80%; opacity: 0; }
  8% { opacity: 1; }
  55%, 100% { left: 130%; opacity: 0; }
}
.pa-btn-confirm::after {
  content: '';
  position: absolute;
  top: -50%; left: -80%;
  width: 40%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.40), transparent);
  animation: confirm-shimmer 2.8s ease-in-out 1s infinite;
}

/* ── Act 4: Analysis ─────────────────────────────────────── */
.pa-analysis-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.pa-line-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Dark veil over photo so text is readable */
.pa-analysis-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(4, 3, 12, 0.88) 0%,
    rgba(6, 5, 18, 0.55) 45%,
    rgba(6, 5, 18, 0.25) 100%
  );
}

.pa-analysis-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 24px 40px;
  text-align: center;
}

.pa-analysis-label {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 20px;
  color: rgba(245,235,175,0.90);
  margin-bottom: 16px;
  letter-spacing: 0.3px;
}

.pa-analysis-pulse {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pa-analysis-pulse span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(185,152,180,0.55);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.pa-analysis-pulse span:nth-child(2) { animation-delay: 0.2s; }
.pa-analysis-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1.1); opacity: 1; }
}

/* ── Act 5: Reveal cards ─────────────────────────────────── */
.pa-reveal-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.pa-reveal-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 24px 36px;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.pa-reveal-card.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.pa-reveal-card.exit {
  opacity: 0;
  transform: translateX(-30px);
}

/* Colored line accent at top */
.pa-reveal-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0 2px 2px;
}

.pa-reveal-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.pa-reveal-content {
  position: relative;
  z-index: 1;
}

.pa-reveal-line-label {
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0.65;
}

.pa-reveal-line-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 700;
  color: rgba(255,245,195,0.97);
  margin-bottom: 18px;
  line-height: 1.15;
}

.pa-reveal-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 19px;
  line-height: 1.62;
  color: rgba(235,225,175,0.88);
  margin-bottom: 36px;
  letter-spacing: 0.15px;
}

.pa-reveal-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  background: rgba(185,152,180,0.96);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a0a1c;
  letter-spacing: 0.4px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}
.pa-reveal-next:active { transform: scale(0.97); opacity: 0.88; }

/* ── Act 6: Synthesis ────────────────────────────────────── */
.pa-inner--synthesis {
  justify-content: center;
  text-align: center;
  gap: 0;
}

.pa-synth-eyebrow {
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(185,152,180,0.60);
  margin-bottom: 28px;
}

.pa-synth-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.65;
  color: rgba(245,235,175,0.92);
  margin-bottom: 24px;
  max-width: 320px;
  align-self: center;
}

.pa-synth-focus {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(185,175,145,0.70);
  margin-bottom: 40px;
  max-width: 280px;
  align-self: center;
}

.pa-synth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.pa-btn-share {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  background: rgba(185,152,180,0.96);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 600;
  color: #1a0a1c;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.pa-btn-share:active { opacity: 0.85; }

.pa-btn-oracle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  color: rgba(185,152,180,0.80);
  text-decoration: none;
  letter-spacing: 0.3px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(185,152,180,0.25);
  transition: color 0.15s, border-color 0.15s;
}
.pa-btn-oracle:hover {
  color: rgba(220,195,80,0.95);
  border-color: rgba(220,195,80,0.55);
}

.pa-btn-again {
  font-size: 12px;
  color: rgba(160,165,185,0.45);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: 0.3px;
}
.pa-btn-again:hover { color: rgba(160,165,185,0.70); }

/* ── Desktop overrides ───────────────────────────────────── */
@media (min-width: 900px) {
  .pa-app {
    align-items: center;
    background: transparent;
  }

  .pa-chrome {
    width: 480px;
    padding: 16px 0 0;
  }

  .pa-act {
    width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(calc(-50% + 11px));
    border-left: 1px solid rgba(160,175,215,0.06);
    border-right: 1px solid rgba(160,175,215,0.06);
  }
  .pa-act.active {
    transform: translateX(-50%);
  }
  .pa-act.exit {
    transform: translateX(calc(-50% - 11px));
  }
  .pa-act--fullscreen {
    border: none;
    border-radius: 16px;
    overflow: hidden;
  }

  .pa-headline { font-size: 32px; }

  .pa-capture-frame {
    width: 220px;
    height: 264px;
  }
}