/* CloneTheVoice — visuals.css: canvases, audio visualizers, focus mode, boot screen, clone studio.
   Palette: Deep Teal (#17252A / #2B7A78) & Aqua (#3AAFA9). Zero gradients. */

/* ── Generator Visualizers Rack ─────────────────────────────────────────── */

.wave-wrap {
  position: relative;
  height: 140px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-input);
  overflow: hidden;
}
.wave-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
  opacity: 0.7;
}
.wave-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.spec-wrap {
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-input);
  overflow: hidden;
}
.spec-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Focus Mode (Audiobook / Long-form Studio) ───────────────────────────── */

.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(18, 19, 17, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: focus-fade 0.16s var(--ease);
}
@keyframes focus-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.focus-inner {
  width: min(880px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.focus-text {
  max-height: 35vh;
  overflow-y: auto;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.7;
  color: var(--text-1);
  text-align: center;
  padding: 0 16px;
}
.focus-wave-wrap {
  height: 200px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-l);
  background: var(--surface);
  overflow: hidden;
}
.focus-wave-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.focus-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ── Boot Overlay (Engine Initialization) ───────────────────────────────── */

.boot-overlay {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  pointer-events: none; /* the app stays usable while models download */
}
.boot-card {
  pointer-events: auto;
  width: min(330px, 88vw);
  padding: 18px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.boot-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.boot-brand::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
}
.boot-sub {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 6px;
}
.boot-overlay .progress { margin-top: 4px; }

/* ── Clone Studio Modal ─────────────────────────────────────────────────── */

.modal-clone .modal-panel {
  width: min(540px, 100%);
}
.clone {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clone-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-input);
}
.clone-tab {
  flex: 1;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.clone-tab:hover {
  color: var(--text-1);
}
.clone-tab-active {
  background: var(--surface-olive);
  color: var(--accent);
  font-weight: 600;
}

.rec-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}
.rec-ring {
  position: relative;
  width: 200px;
  height: 200px;
}
.rec-visual {
  width: 100%;
  height: 100%;
  display: block;
}
.rec-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px;
  height: 68px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 0.1s var(--ease), background 0.1s var(--ease);
}
.rec-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  transition: border-radius 0.14s var(--ease), width 0.14s var(--ease), height 0.14s var(--ease);
}
.rec-btn:hover {
  transform: scale(1.04);
  background: var(--surface-3);
}
.rec-btn.recording::after {
  width: 20px;
  height: 20px;
  border-radius: 4px; /* square = stop */
}

.rec-timer {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.rec-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--surface-input);
  cursor: pointer;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
  color: var(--text-2);
  font-size: 13px;
}
.dropzone:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--text-1);
}
.dropzone-icon {
  font-size: 26px;
  color: var(--accent);
}
.dropzone-hint {
  font-size: 11.5px;
  color: var(--text-3);
}

.clone-review {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.review-wave {
  width: 100%;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-input);
  display: block;
}
.review-stats {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.review-flags {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}
.review-flag-warn {
  color: var(--warn);
}
.review-flag-ok {
  color: var(--success);
}
.review-actions {
  display: flex;
  justify-content: flex-end;
}

.clone-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
}
.clone-progress-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.clone-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-olive);
  overflow: hidden;
}
.clone-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.16s var(--ease);
}


/* ── Donation overlay (card + mascot) ───────────────────────────────────── */

.donate-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px 48px;
}
.donate-overlay.open { opacity: 1; }

.donate-wrap {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: auto;
  animation: dcard-in 0.6s var(--ease) both;
}
@keyframes dcard-in {
  from { opacity: 0; transform: translateY(26px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 1150px) {
  .donate-wrap { justify-content: center; }
  .dmascot { display: none; }
}

.dclose {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), transform 0.2s var(--ease);
}
.dclose:hover { color: var(--text-1); transform: rotate(90deg); }

/* card */
.donate-overlay .dcard {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 44px 40px 36px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 4px 40px rgba(23, 37, 42, 0.06);
}

.dheader { text-align: center; margin-bottom: 30px; }
.dbrand {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 14px;
}
.dheader h1 {
  margin: 0 0 10px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-1);
}
.dheader p {
  margin: 0 auto;
  max-width: 350px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-3);
}

/* frequency toggle */
.dfreq-wrap {
  position: relative;
  display: flex;
  padding: 4px;
  margin-bottom: 26px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.dfreq-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 10px;
  background: var(--accent);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dfreq-slider.right { transform: translateX(100%); }
.dfreq-btn {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 11px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.25s ease;
}
.dfreq-btn.active { color: var(--on-accent); }

/* amount grid */
.damts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.damt-btn {
  position: relative;
  padding: 16px 6px;
  overflow: hidden;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface-input);
  cursor: pointer;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.damt-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.damt-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: 0 4px 16px rgba(23, 37, 42, 0.06);
}
.damt-btn.selected {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(23, 37, 42, 0.1);
}
.damt-btn.selected::before { opacity: 1; }
.damt-value {
  position: relative;
  z-index: 1;
  display: block;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  color: var(--text-1);
  transition: color 0.22s ease;
}
.damt-note {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: color 0.22s ease;
}
.damt-btn.selected .damt-value,
.damt-btn.selected .damt-note { color: #fff; }
.damt-btn.selected .damt-note { color: rgba(255, 255, 255, 0.65); }
.dpop {
  position: absolute;
  top: -1px;
  right: -1px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 0 12px 0 8px;
  background: var(--accent-hover);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* custom amount */
.dcustom { margin-bottom: 22px; }
.dfield {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface-input);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.dfield:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.dsign {
  padding: 13px 2px 13px 17px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-3);
  user-select: none;
}
.dfield input {
  flex: 1;
  min-width: 0;
  padding: 13px 16px 13px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}
.dfield input::placeholder { color: var(--border-2); font-weight: 500; }

/* impact band */
.dimpact {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-bottom: 24px;
  text-align: center;
}
.dimpact-inner {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 11px;
  background: var(--surface-3);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.4;
}

/* CTA */
.dcta {
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 17px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.22s ease, transform 0.18s ease, box-shadow 0.22s ease;
}
.dcta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px rgba(23, 37, 42, 0.4);
}
.dcta:active { transform: translateY(0) scale(0.985); box-shadow: none; }
.dripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0);
  animation: dripple 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes dripple { to { transform: scale(4); opacity: 0; } }

.dfooter { margin-top: 18px; text-align: center; }
.dfooter p { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--text-3); }
.dback {
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
}
.dback:hover { border-color: var(--text-2); }

/* success overlay */
.dsuccess {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border-radius: 24px;
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.dsuccess.show { opacity: 1; pointer-events: auto; }
.dcheck {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 22px;
  border: 2px solid var(--border-2);
  border-radius: 50%;
  background: var(--surface-3);
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s;
}
.dsuccess.show .dcheck { transform: scale(1); }
.dcheck svg { width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dcheck path { stroke-dasharray: 30; stroke-dashoffset: 30; transition: stroke-dashoffset 0.4s ease 0.5s; }
.dsuccess.show .dcheck path { stroke-dashoffset: 0; }
.dsuccess h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease 0.55s;
}
.dsuccess p {
  margin: 0;
  max-width: 300px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-3);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease 0.65s;
}
.dsuccess.show h2, .dsuccess.show p { opacity: 1; transform: translateY(0); }
.dback-btn {
  margin-top: 26px;
  padding: 11px 26px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease 0.75s;
}
.dsuccess.show .dback-btn { opacity: 1; transform: none; }
.dback-btn:hover { border-color: var(--accent); color: var(--text-1); background: var(--accent-dim); }

.confetti-piece {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  will-change: transform;
}

/* mascot standing beside the card */
.dmascot {
  width: 250px;
  flex: none;
  margin-bottom: -10px;
  pointer-events: none;
  filter: drop-shadow(0 18px 26px rgba(23, 37, 42, 0.18));
  animation: dm-bob 3.4s ease-in-out infinite;
}
@keyframes dm-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.dm-body { transform-origin: 120px 205px; }
.dm-eyes { animation: dm-blink 4.6s infinite; transform-origin: 120px 96px; }
@keyframes dm-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
}
.dm-arm { animation: dm-nudge 2.6s ease-in-out infinite; transform-box: view-box; transform-origin: 80px 134px; }
@keyframes dm-nudge {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(7deg); }
}
.dm-bubble {
  position: absolute;
  top: -6px;
  right: -12px;
  z-index: 2;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 14px 14px 3px 14px;
  background: var(--surface);
  box-shadow: 0 6px 20px -8px rgba(23, 37, 42, 0.25);
  color: var(--text-1);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  animation: dm-pop 0.5s var(--ease) both 0.6s;
}
@keyframes dm-pop {
  from { opacity: 0; transform: scale(0.5) translateY(8px); }
  to { opacity: 1; transform: none; }
}
