:root {
  --bg: #faf6f1;
  --card: #ffffff;
  --primary: #c8527a;
  --primary-dark: #a83f63;
  --accent: #d4a830;
  --accent-pale: rgba(212, 168, 48, 0.13);
  --text: #28201e;
  --muted: #9a8680;
  --border: #ecddd4;
  --error: #b83040;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 40px;
}

.card {
  background: var(--card);
  border-radius: 28px;
  padding: 44px 36px 48px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 2px 4px rgba(40, 32, 30, 0.05),
    0 8px 32px rgba(40, 32, 30, 0.09),
    0 40px 80px rgba(40, 32, 30, 0.06);
}

/* ── Portrait ── */
.portrait-frame {
  position: relative;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 30px;
  border: 2.5px solid var(--accent);
  box-shadow:
    0 0 0 7px var(--accent-pale),
    0 8px 28px rgba(40, 32, 30, 0.15);
  background: linear-gradient(135deg, #fef6ec, #f5e8d8);
  flex-shrink: 0;
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.portrait-initials {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.9rem;
  color: var(--accent);
}

.portrait-initials em {
  font-size: 1.5rem;
  color: var(--muted);
  font-style: italic;
}

.no-photo .portrait-img { display: none; }
.no-photo .portrait-initials { display: flex; }

/* ── Noms ── */
.names-block { margin-bottom: 20px; }

.ornament-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ornament-row span {
  display: block;
  width: 32px;
  height: 0.5px;
  background: var(--accent);
  opacity: 0.8;
}

.ornament-row small {
  font-size: 0.38rem;
  color: var(--accent);
  line-height: 1;
}

h1 {
  font-family: var(--serif);
  font-size: 2.05rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.amp {
  font-style: italic;
  color: var(--primary);
  font-weight: 300;
}

.date-line {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Divider ── */
.divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 24px;
}

/* ── Tagline ── */
.tagline {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 300;
  font-style: italic;
  color: var(--muted);
  line-height: 1.85;
  margin-bottom: 28px;
}

/* ── Input ── */
.form-group { margin-bottom: 28px; }

input[type="text"] {
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 40px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  background: #fdf9f6;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  letter-spacing: 0.02em;
}

input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 82, 122, 0.10);
  font-style: normal;
}

input[type="text"]::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ── Bouton enregistrer ── */
.btn-record {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  margin: 0 auto;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 24px rgba(200, 82, 122, 0.38);
}

.btn-record:hover {
  transform: scale(1.04);
  box-shadow: 0 10px 32px rgba(200, 82, 122, 0.48);
}

.btn-record:active { transform: scale(0.97); }

.mic-icon { font-size: 2rem; line-height: 1; }

/* ── Recording ── */
.recording-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
}

.recording-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--error);
  opacity: 0.3;
  animation: ring-pulse 1.5s ease-out infinite;
}

@keyframes ring-pulse {
  0%  { transform: scale(0.85); opacity: 0.5; }
  100%{ transform: scale(1.15); opacity: 0; }
}

.recording-btn-inner {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(184, 48, 64, 0.05);
  border: 2px solid var(--error);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--error);
  animation: dot-blink 1.1s ease-in-out infinite;
}

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.recording-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timer {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.timer-limit {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.timer-limit.warning { color: var(--error); font-weight: 500; }

.btn-stop {
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
  border-radius: 40px;
  padding: 11px 36px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-stop:hover { background: rgba(184, 48, 64, 0.05); }

/* ── Preview ── */
.preview-label {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 14px;
}

audio {
  width: 100%;
  margin-bottom: 20px;
  border-radius: 8px;
}

.preview-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 12px 22px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 40px;
  padding: 12px 28px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(200, 82, 122, 0.32);
  letter-spacing: 0.02em;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Uploading ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.uploading-text {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Success ── */
.success-icon {
  display: block;
  font-family: var(--serif);
  font-size: 2.8rem;
  color: var(--primary);
  margin-bottom: 18px;
  line-height: 1;
}

h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  margin-bottom: 12px;
}

.success-text {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
  font-family: var(--serif);
  line-height: 1.8;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Sélecteur de langue ── */
.lang-selector {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 6px 12px;
  box-shadow: 0 2px 10px rgba(40, 32, 30, 0.09);
}

.lang-btn {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.18s;
}

.lang-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.lang-btn:hover:not(.active) { color: var(--text); }

.lang-sep {
  color: var(--border);
  font-size: 0.65rem;
  user-select: none;
}

/* ── Onglets ── */
.tabs-nav {
  display: flex;
  background: var(--bg);
  border-radius: 40px;
  padding: 4px;
  gap: 3px;
  margin-bottom: 28px;
}

.tab-btn {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: 36px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
  line-height: 1.3;
}

.tab-btn.tab-active {
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(40, 32, 30, 0.11);
}

.tab-btn:hover:not(.tab-active) { color: var(--text); }

/* ── Responsive mobile ── */
@media (max-width: 480px) {
  .lang-selector {
    top: 12px;
    right: 12px;
    padding: 5px 10px;
  }

  .page {
    padding: 28px 12px 28px;
    align-items: flex-start;
  }

  .card {
    padding: 36px 22px 40px;
    border-radius: 20px;
  }

  .tabs-nav {
    margin-bottom: 22px;
  }

  .tab-btn {
    font-size: 0.68rem;
    padding: 8px 6px;
  }

  .portrait-frame {
    width: 136px;
    height: 136px;
    margin-bottom: 24px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .tagline {
    font-size: 0.92rem;
    margin-bottom: 22px;
  }

  .form-group {
    margin-bottom: 22px;
  }

  .btn-record {
    width: 112px;
    height: 112px;
  }

  .recording-ring,
  .recording-btn-inner {
    width: 112px;
    height: 112px;
  }

  .preview-actions {
    flex-direction: column;
    gap: 10px;
  }

  .btn-secondary,
  .btn-primary {
    width: 100%;
    padding: 14px;
  }
}

@media (max-width: 360px) {
  .card {
    padding: 30px 18px 36px;
  }

  .portrait-frame {
    width: 120px;
    height: 120px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .portrait-initials {
    font-size: 1.6rem;
  }
}
