:root {
  --peach-bg: #ffeee7;
  --peach-bg-2: #ffe3ec;
  --pink: #f4577f;
  --pink-deep: #e23e6b;
  --pink-soft: #ff9bb6;
  --purple: #7b54d6;
  --purple-2: #9a6cf0;
  --orange: #ff8a3d;
  --ink: #4a2c3a;
  --ink-soft: #9a8089;
  --card: #fffaf7;
  --white: #ffffff;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(226, 62, 107, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: linear-gradient(160deg, var(--peach-bg) 0%, var(--peach-bg-2) 100%);
  color: var(--ink);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.phone {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  padding: 18px 18px 96px;
  position: relative;
}

/* ---- Cabecera ---- */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.logo {
  font-family: 'Pacifico', cursive;
  font-size: 26px;
  line-height: 1.05;
  color: var(--pink);
  font-weight: 400;
}
.streak {
  background: var(--white);
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.auth-btn {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; border: none; border-radius: 20px;
  padding: 9px 18px; font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(226,62,107,.3);
}

/* ---- Hero ---- */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  color: var(--white);
  text-align: center;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(226, 62, 107, 0.32);
  margin-bottom: 18px;
}
.hero-glow {
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 70%);
}
.hero-glow::after {
  content: '';
  position: absolute;
  top: 60px; right: 58px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #ffd54a;
  box-shadow: 0 0 0 6px rgba(255,255,255,.25);
}
.hero-label { font-size: 12px; letter-spacing: 2px; font-weight: 700; opacity: .9; }
.hero-word {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 46px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 8px 0 14px;
  text-shadow: 0 3px 0 rgba(0,0,0,.08);
}
.hero-timer {
  display: inline-block;
  background: rgba(255,255,255,.22);
  border-radius: 16px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
}

/* ---- Botones ---- */
.btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 12px;
  transition: transform .08s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%); color: #fff; box-shadow: 0 8px 20px rgba(226,62,107,.32); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--card); color: var(--purple); box-shadow: var(--shadow); }
.ic { font-size: 16px; }

/* ---- Sección de canciones ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 12px; }
.section-head h3 { font-size: 19px; font-weight: 800; }
.pill { background: #efe6ff; color: var(--purple); border-radius: 12px; padding: 3px 11px; font-weight: 800; font-size: 13px; }

.song-list { display: flex; flex-direction: column; gap: 12px; }
.song-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  box-shadow: var(--shadow);
}
.play-btn {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--purple-2), var(--purple));
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(123,84,214,.34);
}
.play-btn.playing { background: linear-gradient(135deg, var(--orange), #ff6a3d); }
.song-info { flex: 1; min-width: 0; }
.song-author { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 5px; }
.song-meta { color: var(--ink-soft); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.like-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.like-btn { background: none; border: none; cursor: pointer; font-size: 20px; line-height: 1; filter: grayscale(1) opacity(.55); transition: transform .12s ease; }
.like-btn.liked { filter: none; }
.like-btn:active { transform: scale(1.3); }
.like-count { font-weight: 800; font-size: 13px; color: var(--pink); }
.song-actions { display: flex; gap: 4px; margin-top: 4px; }
.mini-btn { background: none; border: none; color: var(--ink-soft); font-size: 12px; cursor: pointer; text-decoration: underline; }
.mini-btn-danger { color: var(--pink-deep); font-weight: 700; }

.empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; font-weight: 600; }
.empty .big { font-size: 38px; display: block; margin-bottom: 8px; }

/* ---- Vistas secundarias ---- */
.view-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.view-sub { color: var(--ink-soft); font-weight: 700; margin-bottom: 16px; }
.rank-badge { font-size: 20px; width: 30px; text-align: center; }

.word-history { display: flex; flex-direction: column; gap: 10px; }
.word-row {
  background: var(--card); border-radius: 16px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow);
}
.word-row .w { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; text-transform: capitalize; color: var(--pink-deep); }
.word-row .d { color: var(--ink-soft); font-size: 12px; font-weight: 700; }

.profile-box { display: flex; flex-direction: column; gap: 14px; }
.profile-card { background: var(--card); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--shadow); }
.profile-avatar { font-size: 48px; }
.avatar-img-lg { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto; box-shadow: 0 4px 14px rgba(226,62,107,.28); }
.avatar-img-sm { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: -5px; }
.profile-section-title { font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emoji-pick { background: #fff; border: 2px solid #ffd9e2; border-radius: 12px; font-size: 22px; padding: 6px 0; cursor: pointer; line-height: 1; transition: transform .08s ease; }
.emoji-pick:active { transform: scale(.9); }
.emoji-pick.sel { border-color: var(--pink); background: #fff0f4; }
.profile-name { font-size: 22px; font-weight: 800; margin-top: 6px; }
.profile-stats { display: flex; justify-content: space-around; margin-top: 18px; }
.stat .num { font-size: 24px; font-weight: 800; color: var(--pink); }
.stat .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 700; }

/* ---- Navegación inferior ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 440px;
  background: rgba(255,250,247,.92);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px 12px;
  border-top: 1px solid rgba(226,62,107,.08);
}
.nav-item {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--ink-soft); width: 60px;
}
.nav-item span { font-size: 19px; }
.nav-item.active { color: var(--pink); }
.nav-fab {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--orange), #ff5e8a);
  color: #fff; font-size: 24px;
  box-shadow: 0 8px 20px rgba(255,94,138,.45);
  margin-top: -26px;
}

/* ---- Modales ---- */
.modal {
  position: fixed; inset: 0;
  background: rgba(74,44,58,.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: fade .2s ease;
}
/* El atributo hidden debe ocultar el modal pese al display:flex de arriba */
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--peach-bg);
  width: 100%; max-width: 440px;
  border-radius: 26px 26px 0 0;
  padding: 24px 22px 34px;
  position: relative;
  animation: slideup .25s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close { position: absolute; top: 16px; right: 18px; background: none; border: none; font-size: 18px; color: var(--ink-soft); cursor: pointer; }
.modal-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 18px; line-height: 1.2; }
.modal-word { font-family: 'Fredoka', sans-serif; color: var(--pink-deep); text-transform: uppercase; }

.tabs { display: flex; background: #fff0f4; border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.tab { flex: 1; border: none; background: none; padding: 10px; border-radius: 10px; font-weight: 800; color: var(--ink-soft); cursor: pointer; }
.tab.active { background: #fff; color: var(--pink); box-shadow: 0 2px 6px rgba(0,0,0,.06); }

.field {
  width: 100%; border: 2px solid #ffd9e2; background: #fff;
  border-radius: 14px; padding: 14px; font-size: 15px; font-family: inherit; font-weight: 600;
  margin-bottom: 12px; color: var(--ink);
}
.field:focus { outline: none; border-color: var(--pink-soft); }
.form-error { color: var(--pink-deep); font-size: 13px; font-weight: 700; min-height: 18px; margin-bottom: 6px; text-align: center; }

/* ---- Grabador ---- */
.recorder { text-align: center; margin-bottom: 12px; }
.rec-btn {
  width: 88px; height: 88px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  font-size: 36px; color: #fff; box-shadow: 0 10px 24px rgba(226,62,107,.4);
}
.rec-btn.recording { animation: pulse 1.1s infinite; background: linear-gradient(135deg, #ff5e5e, #e23e3e); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(226,62,107,.5);} 50% { box-shadow: 0 0 0 16px rgba(226,62,107,0);} }
.rec-status { margin-top: 10px; font-weight: 700; color: var(--ink-soft); }
.rec-preview { width: 100%; margin-top: 14px; }
.or { text-align: center; color: var(--ink-soft); font-weight: 700; margin: 8px 0; }
.file-btn { margin-bottom: 14px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-weight: 700; z-index: 80; box-shadow: 0 8px 20px rgba(0,0,0,.2); font-size: 14px;
  animation: fade .2s ease;
}
