@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── tokens ────────────────────────────────────────────────────── */
:root {
  --pleasure:  #FF2D8E;
  --curiosity: #8A2BE2;
  --energy:    #FFAE00;
  --tech:      #141018;
  --paper:     #F3F2F0;
  --panel:     #FFFFFF;
  --dim:       rgba(20,16,24,0.60);
  --faint:     rgba(20,16,24,0.36);
  --hairline:  rgba(20,16,24,0.10);
  --gfont:     'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono:      'IBM Plex Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #d8d5cf;
  font-family: var(--gfont);
  color: var(--tech);
}

button { cursor: pointer; }
input  { font: inherit; }

/* ── app shell ─────────────────────────────────────────────────── */
body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

.app-shell {
  position: relative;
  width: 390px;
  height: 844px;
  overflow: hidden;
  border-radius: 44px;
  box-shadow: 0 28px 90px rgba(17,17,17,0.20), 0 4px 12px rgba(17,17,17,0.10);
}

@media (max-width: 440px) {
  .app-shell {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-height: 860px) and (min-width: 441px) {
  .app-shell {
    height: min(844px, calc(100dvh - 24px));
  }
}

/* ── WebGL shader canvas ───────────────────────────────────────── */
#shaderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ── screen system ─────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  background: transparent;
  z-index: 1;
}

.screen--active {
  opacity: 1;
  pointer-events: auto;
}

/* ── AuraField component ───────────────────────────────────────── */
.aura-field {
  position: relative;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}

/* ── AuraField keyframes ───────────────────────────────────────── */
@keyframes auraA {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(6%,-5%)  scale(1.08); }
}
@keyframes auraB {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(-7%,4%)  scale(1.10); }
}
@keyframes auraC {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(4%,6%)   scale(0.94); }
}
@keyframes flowA {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(5%,-4%)  scale(1.12); }
}
@keyframes flowB {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(-6%,3%)  scale(1.06); }
}
@keyframes flowC {
  0%   { transform: translate(-50%,-50%) translate(0,0)     scale(1);    }
  100% { transform: translate(-50%,-50%) translate(8%,5%)   scale(0.96); }
}
@keyframes wPulse {
  0%,100% { opacity: 1;    transform: scale(1);   }
  50%     { opacity: 0.35; transform: scale(0.8); }
}

/* ── Persistent circle ─────────────────────────────────────────── */
#persistentCircle {
  position: absolute;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  background: var(--paper);
  box-shadow: 0 4px 30px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);
  transition:
    width   0.55s cubic-bezier(0.4, 0, 0.2, 1),
    height  0.55s cubic-bezier(0.4, 0, 0.2, 1),
    left    0.65s cubic-bezier(0.4, 0, 0.2, 1),
    top     0.65s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.35s ease,
    background 0.4s ease,
    box-shadow 0.4s ease;
}

#persistentCircleAura {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes circleBreath {
  0%, 100% { box-shadow: 0 4px 30px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05); }
  50%       { box-shadow: 0 10px 52px rgba(255,45,142,0.22), 0 0 0 1px rgba(0,0,0,0.04); }
}
#persistentCircle.circle--breathing {
  animation: circleBreath 3.5s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.20; }
}
#persistentCircle.circle--analyzing {
  animation: dotBlink 1.1s ease-in-out infinite;
}

/* ── Text entrance animations ──────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-in {
  opacity: 0;
}
.anim-in.animated {
  animation: fadeInUp 0.45s ease forwards;
}

/* ── shared typography ─────────────────────────────────────────── */
.label-mono {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(20,16,24,0.50);
  margin: 0;
}

/* ── shared buttons ────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 16px;
  padding: 16px 18px;
  font-family: var(--gfont);
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0,0,0,0.06);
  color: var(--tech);
  cursor: pointer;
  transition: opacity 0.15s;
  touch-action: manipulation;
}
.btn:active { opacity: 0.7; }
.btn--primary  { background: var(--tech); color: #fff; }
.btn--white    { background: #fff; color: var(--tech); }
.btn--grow     { flex: 1; }
.btn--icon     { width: 56px; padding: 0; flex-shrink: 0; }
.btn:disabled  { opacity: 0.38; cursor: default; }

/* ═══════════════════════════════════════════════════════════════
   SCREEN 1 — SPLASH
════════════════════════════════════════════════════════════════ */
.splash-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 64px 30px 36px;
  height: 100%;
  min-height: 100%;
}

.splash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.splash-spacer {
  flex: 1;
}

.splash-headline {
  margin: 0;
  font-family: var(--gfont);
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -2px;
  line-height: 0.95;
  color: var(--tech);
}

.splash-desc {
  margin: 18px 0 0;
  font-family: var(--gfont);
  font-size: 17px;
  line-height: 1.5;
  color: var(--dim);
  max-width: 310px;
}

.splash-tagline {
  margin: 20px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1px;
  line-height: 1.7;
  color: var(--faint);
  text-transform: uppercase;
}

#screen-splash .btn--white {
  margin-top: 26px;
  padding: 17px;
  font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   SCREEN 2 — RECORD
════════════════════════════════════════════════════════════════ */
.record-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 60px 22px 0;
  height: 86px;
  flex-shrink: 0;
}

.icon-btn {
  border: none;
  background: none;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(20,16,24,0.55);
  opacity: 0.85;
}
.icon-btn:active { opacity: 0.45; }
.icon-btn-spacer { width: 36px; }

.rec-indicator {
  display: none;
  align-items: center;
  gap: 8px;
}
.rec-indicator.visible {
  display: flex;
}
.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pleasure);
  animation: wPulse 1.1s ease-in-out infinite;
}
#recTimer {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--tech);
}

.record-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Transparent touch target — persistent circle overlays this */
.aura-button {
  border: none;
  background: none;
  padding: 0;
  border-radius: 50%;
  width: 292px;
  height: 292px;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s ease-out;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.aura-button.btn--pressed {
  transform: scale(0.96) !important;
}

.record-footer {
  padding: 0 40px 52px;
  text-align: center;
  flex-shrink: 0;
}

.record-cta-headline {
  margin: 0;
  font-family: var(--gfont);
  font-size: 19px;
  font-weight: 600;
  color: var(--tech);
}

.record-cta-sub {
  margin: 8px 0 0;
  font-family: var(--gfont);
  font-size: 13.5px;
  color: var(--dim);
  line-height: 1.4;
}

.play-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--tech);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.play-btn:active { opacity: 0.7; }


/* ── Live sensuality score ─────────────────────────────────────── */
.live-si-score {
  opacity: 0;
  transition: opacity 0.6s ease;
  text-align: center;
  margin-top: 20px;
}

.live-si-score.recording { opacity: 1; }

.si-score-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(20,16,24,0.55);
  text-transform: uppercase;
  margin: 0;
}

.si-score-value {
  font-family: var(--gfont);
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  color: var(--tech);
  margin-top: 2px;
  letter-spacing: -2px;
}

.si-score-pct {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
}

.si-score-bar-track {
  width: 160px;
  height: 3px;
  background: rgba(20,16,24,0.10);
  border-radius: 2px;
  margin: 10px auto 0;
  overflow: hidden;
}

.si-score-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--energy), var(--pleasure));
  transition: width 0.3s ease-out;
  width: 0%;
}

/* ═══════════════════════════════════════════════════════════════
   SCREEN 3 — ANALYZING
════════════════════════════════════════════════════════════════ */
.analyzing-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  text-align: center;
  padding: 0 32px 100px;
}

.analyzing-label {
  color: rgba(20,16,24,0.45);
  letter-spacing: 3px;
  text-shadow: 0 0 16px rgba(243,242,240,0.8);
}

.analyzing-headline {
  margin: 12px 0 0;
  font-family: var(--gfont);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.2;
  color: var(--tech);
  text-shadow: 0 0 24px rgba(243,242,240,0.9), 0 0 8px rgba(243,242,240,0.7);
}

/* ── Fingerprint canvas (inside #screen-analyzing, behind text) ── */
#fingerprintCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   SCREEN 4 — DONE
════════════════════════════════════════════════════════════════ */
#doneCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

.done-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 64px 30px max(40px, env(safe-area-inset-bottom));
}

.done-top { display: flex; flex-direction: column; gap: 8px; }

.done-code-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--tech);
  text-shadow: 0 0 24px rgba(243,242,240,0.9);
}

.done-code-label .dot-sep { color: var(--pleasure); }

.done-bottom {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.done-message {
  margin: 0;
  font-size: 17px;
  color: var(--dim);
  text-align: center;
  text-shadow: 0 0 16px rgba(243,242,240,0.8);
}

/* ── reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
