:root {
  --blue: #15AFE5;
  --navy: #201F2F;
  --coal: #141414;
  --smoke: #D5D5D5;
  --white: #FFFFFF;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad:  #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; touch-action: manipulation; }
body {
  background: var(--navy);
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--white);
  display: flex; flex-direction: column;
  -webkit-user-select: none; user-select: none;
}

/* HEADER */
.header { background: rgba(0,0,0,0.3); border-bottom: 2px solid var(--blue);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.header-logo { display: inline-flex; align-items: center; text-decoration: none; line-height: 1; }
.header-logo-img { height: 32px; width: auto; display: block; }
.header-logo-text { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700;
  color: var(--blue); letter-spacing: -0.5px; }
.header-title { font-size: 13px; color: var(--smoke); opacity: 0.7; text-align: right; line-height: 1.4; }

/* STEP DOTS */
.step-dots { display: flex; gap: 8px; justify-content: center; padding: 12px 0 0; flex-shrink: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.dot.active { background: var(--blue); }
.dot.done { background: rgba(21,175,229,0.4); }

/* SCREENS */
.screen { flex: 1; overflow-y: auto; display: none; flex-direction: column; }
.screen.active { display: flex; }

.body-pad { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 24px; gap: 22px; }
.eyebrow { font-family: Arial, sans-serif; font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--blue); text-align: center; }
.headline { font-family: 'Playfair Display', Georgia, serif; font-size: 30px; font-weight: 400;
  text-align: center; line-height: 1.2; }
.headline em { font-style: italic; color: var(--blue); }
.sub { font-size: 14px; color: var(--smoke); opacity: 0.7; text-align: center; max-width: 340px; line-height: 1.45; }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 420px; }
.form-label { font-family: Arial, sans-serif; font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--blue); }
.form-label .opt { color: var(--smoke); opacity: 0.5; font-weight: 400; margin-left: 6px; }
.form-input, .form-select {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 14px 16px; color: var(--white);
  font-family: inherit; font-size: 17px; outline: none; transition: border-color .2s; width: 100%;
}
.form-input:focus, .form-select:focus { border-color: var(--blue); }
.form-input::placeholder { color: rgba(255,255,255,0.25); }
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: var(--navy); color: var(--white); }
.qualify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 420px; }
.qualify-btn { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px; padding: 18px 12px; text-align: center; cursor: pointer; transition: all .12s;
  font-family: inherit; color: inherit; min-height: 64px; touch-action: manipulation; }
.qualify-btn:active { background: rgba(21,175,229,0.25); transform: scale(0.97); }
.qualify-btn.selected { background: rgba(21,175,229,0.18); border-color: var(--blue); }
.qualify-btn-label, .qualify-btn-sub { pointer-events: none; }
.qualify-btn-label { font-size: 14px; color: var(--white); font-weight: 600; display: block; margin-bottom: 3px; }
.qualify-btn-sub { font-size: 11px; color: var(--smoke); opacity: 0.6; }

/* BUTTONS */
.btn-primary { width: 100%; max-width: 420px; padding: 16px;
  background: var(--blue); color: var(--navy); border: none; border-radius: 10px;
  font-family: Arial, sans-serif; font-size: 13px; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 700; cursor: pointer; transition: all .15s; }
.btn-primary:hover:not(:disabled) { background: #1fc4ff; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost { padding: 14px 32px; background: rgba(255,255,255,0.06);
  color: var(--white); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
  font-family: Arial, sans-serif; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; transition: all .15s; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.privacy-note { font-size: 11px; color: var(--smoke); opacity: 0.5; text-align: center; max-width: 360px; line-height: 1.5; }

/* SPIN */
.wheel-container { position: relative; width: 320px; height: 320px; flex-shrink: 0; }
.wheel-pointer { position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 28px solid var(--blue); z-index: 10; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
#wheelCanvas { border-radius: 50%; cursor: pointer; }
.result-banner { background: rgba(21,175,229,0.08); border: 1px solid rgba(21,175,229,0.25);
  border-radius: 10px; padding: 16px 24px; text-align: center; width: 100%; max-width: 340px;
  min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.result-label { font-family: Arial, sans-serif; font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--smoke); opacity: 0.6; }
.result-prompt { font-family: 'Playfair Display', Georgia, serif; font-size: 24px; color: var(--blue); }
.result-sub { font-size: 12px; color: var(--smoke); opacity: 0.55; }

/* READY */
.ready-icon { font-size: 64px; line-height: 1; }
.ready-prompt-box { background: var(--blue); border-radius: 12px; padding: 22px 28px; max-width: 360px; }
.ready-prompt-box-label { font-family: Arial, sans-serif; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--navy); opacity: 0.7; margin-bottom: 6px; }
.ready-prompt-text { font-family: 'Playfair Display', Georgia, serif; font-size: 24px;
  color: var(--navy); font-weight: 700; }

/* CAMERA */
.camera-frame { position: relative; width: 100%; max-width: 420px; aspect-ratio: 3 / 4;
  border-radius: 16px; overflow: hidden; background: #000; border: 2px solid rgba(21,175,229,0.4); }
.camera-frame video, .camera-frame canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.camera-frame video[hidden], .camera-frame canvas[hidden] { display: none; }
.camera-guide { position: absolute; inset: 12px; border: 2px dashed rgba(255,255,255,0.35);
  border-radius: 10px; pointer-events: none; }
.camera-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', Georgia, serif; font-size: 120px; color: var(--white);
  text-shadow: 0 4px 24px rgba(0,0,0,0.6); pointer-events: none; opacity: 0; transition: opacity .15s; }
.camera-countdown.show { opacity: 1; }
.camera-actions { display: flex; gap: 12px; }

/* GENERATING */
.gen-image { width: 192px; height: 256px; border-radius: 14px; object-fit: cover;
  border: 2px solid rgba(21,175,229,0.4); }
.gen-spinner { width: 32px; height: 32px; border: 3px solid rgba(21,175,229,0.2);
  border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-status { font-size: 13px; color: var(--smoke); opacity: 0.7; }

/* RESULT */
.result-image { width: 240px; height: 320px; border-radius: 14px; object-fit: cover;
  border: 2px solid rgba(21,175,229,0.5); box-shadow: 0 8px 40px rgba(0,0,0,0.4); }
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* TEXT CARD FALLBACK */
.text-card-preview { width: 100%; max-width: 360px; background: var(--blue);
  border-radius: 14px; padding: 24px; color: var(--navy); }
.text-card-prompt { font-family: Arial, sans-serif; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.7; margin-bottom: 8px; }
.text-card-name { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700;
  margin-bottom: 12px; }
.text-card-body { font-family: 'Playfair Display', Georgia, serif; font-style: italic;
  font-size: 16px; line-height: 1.45; }

/* STATUS */
.status-bar { background: rgba(21,175,229,0.08); border-top: 1px solid rgba(21,175,229,0.15);
  padding: 8px 24px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  animation: pulse 2s infinite; display: inline-block; margin-right: 6px; }
.status-dot.warn { background: var(--warn); }
.status-dot.bad { background: var(--bad); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-text { font-family: Arial, sans-serif; font-size: 11px; color: var(--smoke); opacity: 0.7; }
.contacts-count { font-family: Arial, sans-serif; font-size: 11px; color: var(--blue); }

/* TOAST */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--navy); border: 1px solid var(--blue); border-radius: 8px;
  padding: 12px 22px; font-size: 14px; color: var(--white); opacity: 0;
  transition: opacity .3s; pointer-events: none; z-index: 200; white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; }
