:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-elevated: #273549;
  --bg-input: #0b1120;
  --primary: #f43f5e;
  --primary-hover: #e11d48;
  --primary-glow: rgba(244, 63, 94, 0.35);
  --accent-gold: #fbbf24;
  --whatsapp: #22c55e;
  --whatsapp-dark: #16a34a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.09);
  --danger: #ef4444;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
}

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

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(at 10% 5%, rgba(244, 63, 94, 0.16) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(251, 191, 36, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 92px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.btn-install {
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

/* Main Content */
.app-content {
  flex: 1;
  padding: 16px;
}

.view {
  display: none;
  animation: fadeIn 0.24s ease-out;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.hero-card {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.22), rgba(30, 41, 59, 0.95));
  border-color: rgba(244, 63, 94, 0.35);
}

.hero-card.compact {
  padding: 16px 18px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.hero-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.hero-card p {
  font-size: 0.87rem;
  color: #cbd5e1;
}

/* Grid de los 8 participantes en Inicio */
.participants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.participant-card-btn {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
  text-align: left;
}

.participant-card-btn:hover,
.participant-card-btn:active {
  border-color: var(--primary);
  background: rgba(244, 63, 94, 0.14);
  transform: translateY(-1px);
}

.participant-card-btn.locked-me {
  border-color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.14);
}

.participant-card-btn.locked-other {
  opacity: 0.45;
}

.participant-name-label {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Forms */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.section-header .section-title {
  margin-bottom: 0;
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-card-elevated);
  color: var(--accent-gold);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
}

input[type="text"],
input[type="date"],
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

.add-participant-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.add-participant-bar input {
  flex: 1;
}

.participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #fb7185);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Buttons */
button {
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s, background 0.15s;
}

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

.btn-cta {
  width: 100%;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  border: none;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px var(--primary-glow);
  transition: transform 0.12s, box-shadow 0.15s;
}

.btn-cta:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-outline-danger {
  width: 100%;
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.87rem;
  cursor: pointer;
}

.btn-text {
  background: none;
  border: none;
  color: #fda4af;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

/* Share View */
.share-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.status-pill {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.share-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.group-share-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-lg {
  padding: 14px 16px !important;
  font-size: 0.92rem !important;
}

.instruction-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  font-size: 0.84rem;
}

.instruction-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.instruction-banner p {
  color: #cbd5e1;
  margin-top: 2px;
}

.share-links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.share-row {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-row.sent {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(22, 163, 74, 0.08);
}

.share-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-person {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.96rem;
}

.sent-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #86efac;
  background: rgba(34, 197, 94, 0.18);
  padding: 3px 8px;
  border-radius: 999px;
}

.share-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #052e16;
  border: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.83rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-whatsapp:active {
  background: var(--whatsapp-dark);
}

.btn-copy-link {
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

/* History View */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.history-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-participants-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.person-chip {
  font-size: 0.76rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  padding: 3px 9px;
  border-radius: 999px;
  color: #cbd5e1;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-actions .btn-primary {
  flex: 1;
  padding: 10px 14px;
}

/* Secret Reveal View */
.reveal-card {
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(244, 63, 94, 0.4);
  border-radius: 24px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  margin-top: 4px;
}

.reveal-sparkles {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.reveal-badge {
  display: inline-block;
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.reveal-greeting {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.reveal-greeting span {
  color: var(--accent-gold);
}

.reveal-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.reveal-meta-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.mystery-box {
  padding: 20px 14px;
  background: rgba(244, 63, 94, 0.08);
  border: 1.5px dashed rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-lg);
}

.gift-anim {
  font-size: 4rem;
  margin-bottom: 10px;
  display: inline-block;
  animation: bounceGift 1.8s infinite ease-in-out;
}

@keyframes bounceGift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-5deg); }
  75% { transform: translateY(-4px) rotate(5deg); }
}

.mystery-hint {
  font-size: 0.88rem;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.secret-result-box {
  padding: 22px 16px;
  background: rgba(251, 191, 36, 0.1);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  animation: popReveal 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popReveal {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.result-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fde68a;
  font-weight: 700;
  margin-bottom: 10px;
}

.result-name-card {
  background: rgba(15, 23, 42, 0.85);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.result-name {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.result-warning {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-bottom: 14px;
}

.reveal-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 22px 0 14px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}

.nav-item.active {
  color: #fff;
  background: rgba(244, 63, 94, 0.16);
}

.nav-icon {
  font-size: 1.2rem;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-pill {
  position: absolute;
  top: 4px;
  right: 22%;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

.hidden {
  display: none !important;
}
