:root {
  --bg-pastel-pink: #fff2f5;
  --bg-gradient: linear-gradient(180deg, #fff5f7 0%, #ffebf0 45%, #fff0f5 100%);
  --bg-card: #ffffff;
  --text-main: #382725;
  --text-dim: #967570;
  --accent-rose: #ff6584;
  --accent-soft-pink: #ff8ea5;
  --accent-border: #ffd3dd;
  --highlight-bg: rgba(255, 160, 180, 0.16);
  --shadow-soft: 0 16px 45px rgba(230, 120, 145, 0.12);
  --shadow-card: 0 20px 50px rgba(225, 115, 140, 0.15);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-pastel-pink);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 120px;
}

/* Pantalla de bienvenida (Intro Overlay en Rosa Pastel) */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 240, 244, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.7s ease, visibility 0.7s ease;
  padding: 24px;
}

.intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-card {
  background: var(--bg-card);
  max-width: 440px;
  width: 100%;
  padding: 44px 32px;
  border-radius: 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--accent-border);
  animation: fadeInPop 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPop {
  0% { transform: scale(0.93); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Contador de Oso Monedas flotante arriba */
.coin-counter-bar {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 980;
  pointer-events: auto;
}

.coin-pill {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid #ffd3dd;
  padding: 8px 16px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(255, 100, 130, 0.18);
  transition: transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28), background 0.2s ease;
}

.coin-pill.pop {
  transform: scale(1.22);
  border-color: #ff5277;
  background: #fff0f3;
  box-shadow: 0 10px 28px rgba(255, 82, 119, 0.35);
}

.coin-icon {
  font-size: 19px;
  filter: drop-shadow(0 2px 4px rgba(230, 150, 0, 0.3));
}

.coin-label {
  font-size: 13px;
  font-weight: 700;
  color: #8c6864;
  letter-spacing: 0.5px;
}

.coin-count {
  font-size: 17px;
  font-weight: 800;
  color: #ff5277;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
}

/* Ancla de My Melody en la bienvenida */
.intro-melody-anchor {
  width: 130px;
  height: 145px;
  margin: 0 auto 16px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 36px;
  font-weight: 600;
  color: #ff5277;
  margin-bottom: 10px;
}

.intro-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 28px;
  line-height: 1.6;
}

.btn-start {
  background: linear-gradient(135deg, #ff7593, #ff5277);
  color: #ffffff;
  border: none;
  font-size: 16px;
  font-weight: 600;
  padding: 16px 30px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(255, 82, 119, 0.38);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 82, 119, 0.48);
}

.btn-start:active {
  transform: translateY(0);
}

.intro-note {
  font-size: 12.5px;
  color: #b08d88;
  margin-top: 22px;
}

/* Contenedor principal de la carta */
.letter-container {
  max-width: 680px;
  margin: 48px auto;
  padding: 56px 48px;
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--accent-border);
  position: relative;
}

@media (max-width: 640px) {
  .letter-container {
    margin: 16px 12px 140px 12px;
    padding: 36px 22px;
  }
}

/* Cabecera de la carta */
.letter-header {
  text-align: center;
  margin-bottom: 40px;
}

.stamp-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.stamp {
  border: 2px dashed #ff8ea5;
  color: #ff5277;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 8px;
  background: #fff5f7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: rotate(3deg);
}

.letter-date {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 19px;
  color: #ff6584;
  margin-bottom: 16px;
}

.divider-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
  margin: 0 auto;
}

/* Bloques sincronizados y párrafos */
.sync-block {
  padding: 22px 24px;
  margin: 14px -24px;
  border-radius: 18px;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.55;
  border-left: 4px solid transparent;
  cursor: pointer;
}

.sync-block.active {
  opacity: 1;
  background: var(--highlight-bg);
  border-left-color: var(--accent-rose);
  box-shadow: 0 6px 24px rgba(255, 130, 160, 0.16);
  transform: translateX(4px);
}

.sync-block:hover {
  opacity: 0.9;
}

.letter-p {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 21.5px;
  font-weight: 400;
  color: #382725;
  line-height: 1.95;
  letter-spacing: 0.2px;
}

@media (max-width: 640px) {
  .letter-p {
    font-size: 18.5px;
    line-height: 1.85;
  }
}

/* Tarjetas de fotos / Recuerdos */
.memory-card {
  margin: 28px auto 10px auto;
  max-width: 480px;
  background: #ffffff;
  padding: 14px 14px 20px 14px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(240, 120, 145, 0.12);
  border: 1.5px solid #ffe3ea;
  text-align: center;
}

.photo-frame {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #fff8f9;
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-frame img {
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

.photo-placeholder {
  display: none;
  padding: 30px 20px;
  font-size: 14px;
  color: #b08d88;
  border: 2px dashed #ffccd5;
  border-radius: 10px;
  width: 100%;
  margin: 10px;
}

.photo-frame.placeholder-active .photo-placeholder {
  display: block;
}

.photo-caption {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
  color: #ff6584;
  margin-top: 12px;
}

/* Firma final */
.letter-signature {
  margin-top: 54px;
  text-align: right;
  padding-right: 20px;
}

.sig-note {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 19px;
  color: var(--text-dim);
}

.sig-name {
  font-family: 'Sacramento', cursive;
  font-size: 48px;
  color: #ff5277;
  line-height: 1.1;
  margin-top: 4px;
}

/* Barra de audio inferior en Rosa Pastel */
.audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 245, 247, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1.5px solid var(--accent-border);
  padding: 14px 20px;
  z-index: 900;
  box-shadow: 0 -8px 30px rgba(240, 110, 140, 0.08);
}

.audio-controls {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-ctrl {
  background: linear-gradient(135deg, #ff7593, #ff5277);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(255, 82, 119, 0.38);
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-ctrl:hover {
  transform: scale(1.05);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.time-display {
  font-size: 12px;
  font-weight: 600;
  color: #b0808a;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: #ffe3ea;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff8ea5, #ff5277);
  border-radius: 10px;
  transition: width 0.1s linear;
}

.btn-scroll-toggle {
  background: #fff0f3;
  border: 1px solid var(--accent-border);
  color: #b07080;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-scroll-toggle.active {
  background: #ffe0e7;
  border-color: #ff9fb2;
  color: #ff5277;
}

@media (max-width: 520px) {
  .btn-scroll-toggle {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* Modal de contraseña (Password Gate) */
.password-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 235, 240, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 24px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.password-gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.password-card {
  background: #ffffff;
  max-width: 420px;
  width: 100%;
  padding: 40px 28px;
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(230, 80, 110, 0.22);
  border: 2px solid var(--accent-border);
  animation: fadeInPop 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.lock-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.password-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 32px;
  color: var(--accent-rose);
  margin-bottom: 8px;
}

.password-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 22px;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.password-input {
  width: 100%;
  padding: 14px 20px;
  border-radius: 50px;
  border: 2px solid #ffd6df;
  font-size: 16px;
  text-align: center;
  font-family: inherit;
  color: #382725;
  background: #fff8f9;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.password-input:focus {
  border-color: var(--accent-rose);
  box-shadow: 0 0 0 4px rgba(255, 82, 119, 0.15);
  background: #ffffff;
}

.btn-verify {
  background: linear-gradient(135deg, #ff7593, #ff5277);
  color: #ffffff;
  border: none;
  font-size: 15px;
  font-weight: 700;
  padding: 15px 24px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 82, 119, 0.38);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-verify:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(255, 82, 119, 0.48);
}

.password-error {
  font-size: 13px;
  color: #e03b5b;
  font-weight: 600;
  margin-top: 14px;
}

.password-error.hidden {
  display: none;
}

/* Sección de desahogo: Patear al Oso */
.bear-kick-section {
  margin-top: 50px;
  padding-top: 36px;
  border-top: 2px dashed #ffd6df;
}

.bear-kick-card {
  background: #fff8f9;
  border: 2px solid #ffd3dd;
  border-radius: 22px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(230, 110, 130, 0.1);
}

.bear-avatar-wrap {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bear-avatar {
  font-size: 54px;
  display: inline-block;
  transition: transform 0.15s ease;
  user-select: none;
}

.bear-avatar.kicked {
  animation: bearKickedAnim 0.45s ease-out;
}

@keyframes bearKickedAnim {
  0% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.3, 0.7) rotate(25deg) translateX(15px); }
  50% { transform: scale(0.8, 1.2) rotate(-20deg) translateY(-20px); }
  75% { transform: scale(1.1) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.bear-kick-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  color: #ff5277;
  margin-bottom: 8px;
}

.bear-kick-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto 20px auto;
}

.kick-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 2px solid #ffd3dd;
  padding: 8px 18px;
  border-radius: 50px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(255, 100, 130, 0.12);
}

.kick-label {
  font-size: 13px;
  font-weight: 600;
  color: #8c6864;
}

.kick-number {
  font-size: 22px;
  font-weight: 800;
  color: #ff5277;
  font-variant-numeric: tabular-nums;
  transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.kick-number.pop {
  transform: scale(1.35);
}

.kick-unit {
  font-size: 13px;
  font-weight: 600;
  color: #8c6864;
}

.btn-kick-bear {
  background: linear-gradient(135deg, #ff6b8b, #e03b5b);
  color: #ffffff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(224, 59, 91, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-kick-bear:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(224, 59, 91, 0.48);
}

.btn-kick-bear:active {
  transform: translateY(2px) scale(0.96);
}

.kick-permanent-note {
  font-size: 12px;
  color: #a88580;
  margin-top: 14px;
}

/* Sección: Pregunta de Tregua */
.truce-section {
  margin-top: 40px;
  padding-top: 36px;
  border-top: 2px dashed #ffd6df;
}

.truce-card {
  background: #ffffff;
  border: 2px solid var(--accent-rose);
  border-radius: 24px;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 12px 35px rgba(255, 82, 119, 0.16);
  position: relative;
}

.truce-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  color: #ff5277;
  margin-bottom: 10px;
}

.truce-desc {
  font-size: 16px;
  color: #4a3633;
  line-height: 1.6;
  margin-bottom: 28px;
}

.truce-buttons-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  min-height: 70px;
}

.btn-truce-yes {
  background: linear-gradient(135deg, #ff7593, #ff5277);
  color: #ffffff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 32px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 82, 119, 0.4);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: yesHeartPulse 2s infinite ease-in-out;
}

@keyframes yesHeartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.no-button-holder {
  position: relative;
  display: inline-block;
  transition: transform 0.25s ease;
}

.btn-truce-no {
  background: #f7ede8;
  color: #8c726d;
  border: 1.5px solid #e5d1cb;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 26px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.truce-success {
  margin-top: 24px;
  padding: 24px;
  background: #fff2f5;
  border-radius: 20px;
  border: 2px solid #ffd3dd;
  animation: fadeInPop 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.truce-success.hidden {
  display: none;
}

.truce-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.truce-success-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 700;
  color: #ff5277;
  margin-bottom: 8px;
}

.truce-success-desc {
  font-size: 15px;
  color: #4a3633;
  line-height: 1.6;
}

