/* =========================================================
   ELFO TRAVIESO MÁGICO — Hoja de estilos principal
   Paleta: rojo navideño, verde pino, dorado y blanco nieve.
   ========================================================= */

:root {
  --red: #c41e3a;
  --red-dark: #8c0f27;
  --red-light: #e94560;
  --pine: #0f5132;
  --pine-dark: #0a3621;
  --pine-light: #1c7a4a;
  --gold: #d4af37;
  --gold-light: #ffe27a;
  --gold-dark: #a8842a;
  --snow: #fffdf8;
  --snow-dim: #f1ece1;
  --ink: #201a12;
  --shadow: rgba(10, 20, 10, 0.45);

  --font-ui: "Poppins", system-ui, -apple-system, sans-serif;
  --font-title: "Mountains of Christmas", cursive, serif;
  --font-magic: "Caveat", cursive;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% -10%, #1d6b43 0%, var(--pine-dark) 45%, #06190f 100%);
  color: var(--snow);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

img { max-width: 100%; display: block; }

/* ---------------------------------------------------------
   UTILIDADES GENERALES
--------------------------------------------------------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.sparkle-text {
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--gold-light));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
  color: #3a2a06;
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.45);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px rgba(212, 175, 55, 0.6);
  filter: brightness(1.05);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  color: var(--snow);
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.1); }

.btn-red {
  background: linear-gradient(135deg, var(--red-light), var(--red) 60%, var(--red-dark));
  color: var(--snow);
  box-shadow: 0 8px 20px rgba(196, 30, 58, 0.4);
}
.btn-red:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--snow-dim);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--gold-light);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-gold { background: rgba(212, 175, 55, 0.2); color: var(--gold-light); border: 1px solid rgba(212, 175, 55, 0.4); }
.badge-green { background: rgba(28, 122, 74, 0.25); color: #7be3aa; border: 1px solid rgba(123, 227, 170, 0.35); }
.badge-red { background: rgba(196, 30, 58, 0.25); color: #ff9aae; border: 1px solid rgba(255, 154, 174, 0.4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------------------------------------------------------
   TOASTS
--------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 92vw;
}

.toast {
  background: rgba(10, 30, 18, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--snow);
  padding: 13px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px var(--shadow);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease;
  max-width: 340px;
}
.toast.success { border-color: rgba(123, 227, 170, 0.5); }
.toast.error { border-color: rgba(233, 69, 96, 0.6); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------
   NAVBAR
--------------------------------------------------------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(90deg, rgba(140, 15, 39, 0.55), rgba(10, 54, 33, 0.7));
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
  gap: 12px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 700;
}
.navbar-brand .emoji { font-size: 1.8rem; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--snow-dim);
}

/* ---------------------------------------------------------
   AUTENTICACIÓN (Login / Registro)
--------------------------------------------------------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: 0 20px 60px var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "❅";
  position: absolute;
  top: -20px;
  right: -10px;
  font-size: 7rem;
  color: rgba(212, 175, 55, 0.08);
  transform: rotate(15deg);
}

.auth-title {
  font-family: var(--font-title);
  font-size: 2.1rem;
  text-align: center;
  margin: 0 0 4px;
}
.auth-subtitle {
  text-align: center;
  color: var(--snow-dim);
  font-size: 0.88rem;
  margin: 0 0 22px;
}

.tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.tab {
  flex: 1;
  padding: 9px 0;
  text-align: center;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--snow-dim);
  background: transparent;
  transition: all 0.2s ease;
}
.tab.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #3a2a06;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: var(--snow-dim);
}
.field input,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--snow);
  font-size: 0.95rem;
  font-family: inherit;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(255, 255, 255, 0.4); }

.form-error {
  background: rgba(196, 30, 58, 0.18);
  border: 1px solid rgba(233, 69, 96, 0.5);
  color: #ffc1cc;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.auth-footer-link {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--snow-dim);
}
.auth-footer-link button {
  background: none;
  color: var(--gold-light);
  font-weight: 600;
  text-decoration: underline;
}

.child-link {
  margin-top: 22px;
  text-align: center;
  padding-top: 18px;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
}
.child-link a {
  display: inline-block;
  margin-top: 8px;
}

/* ---------------------------------------------------------
   DASHBOARD DEL PADRE
--------------------------------------------------------- */
.dashboard-hero {
  padding: 30px 24px 10px;
  text-align: center;
}
.dashboard-hero h1 {
  font-family: var(--font-title);
  font-size: 2.4rem;
  margin: 0 0 6px;
}
.dashboard-hero p {
  color: var(--snow-dim);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 18px 24px 8px;
}

/* --- Banner premium --- */
.premium-banner {
  margin: 20px auto;
  max-width: 900px;
  background: linear-gradient(120deg, #3a0a16, var(--red-dark), #3a0a16);
  background-size: 220% 100%;
  animation: shimmer-bg 6s ease infinite;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 12px 30px var(--shadow);
}
@keyframes shimmer-bg {
  0%, 100% { background-position: 0 0; }
  50% { background-position: 100% 0; }
}
.premium-banner h3 {
  margin: 0 0 4px;
  font-family: var(--font-title);
  font-size: 1.5rem;
}
.premium-banner p { margin: 0; color: var(--snow-dim); font-size: 0.88rem; max-width: 420px; }

/* --- Enlace mágico para el niño --- */
.share-box {
  max-width: 900px;
  margin: 10px auto 26px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.share-box .icon { font-size: 1.8rem; }
.share-box .share-input {
  flex: 1;
  min-width: 200px;
  display: flex;
  gap: 8px;
}
.share-box input[readonly] {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--snow-dim);
  font-size: 0.8rem;
}

/* --- Calendario 25 días --- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 10px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.day-card {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 170px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.day-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px var(--shadow); }

.day-card.locked {
  align-items: center;
  justify-content: center;
  text-align: center;
  filter: grayscale(0.4);
  opacity: 0.75;
}
.day-card.locked .lock-emoji { font-size: 2rem; margin-bottom: 6px; }

.day-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.5), 0 0 26px rgba(212, 175, 55, 0.45);
  animation: glow 2.2s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.5), 0 0 18px rgba(212, 175, 55, 0.35); }
  50% { box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.8), 0 0 34px rgba(212, 175, 55, 0.65); }
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.day-number {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  margin: 0;
}

.day-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-light);
  font-weight: 700;
  margin: 2px 0 2px;
}

.day-instructions {
  font-size: 0.8rem;
  color: var(--snow-dim);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  line-height: 1.35;
}

.day-note-textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  font-family: var(--font-magic);
  font-size: 1.05rem;
  line-height: 1.3;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: rgba(255, 253, 248, 0.08);
  color: var(--snow);
}
.day-note-textarea:focus {
  border-color: var(--gold);
  background: rgba(255, 253, 248, 0.14);
}

.day-note-hint {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.3;
}

.day-card-footer {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------
   MODALES
--------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 6, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 18px;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, #103a24, #07190f);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.25s ease;
}
@keyframes pop-in {
  from { transform: scale(0.92) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal h2 {
  font-family: var(--font-title);
  font-size: 1.7rem;
  margin: 0 0 4px;
}
.modal p.modal-sub { color: var(--snow-dim); font-size: 0.85rem; margin: 0 0 18px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  color: var(--snow-dim);
  font-size: 1.3rem;
}

/* ---------------------------------------------------------
   VISTA ESCÁNER / CÁMARA MÁGICA
--------------------------------------------------------- */
.scan-shell {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  z-index: 50;
}

.scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
  background: #000;
}

.scan-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0.65), transparent);
  z-index: 5;
}
.scan-topbar .elf-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.scan-frame-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}

.scan-frame {
  width: min(78vw, 360px);
  height: min(78vw, 360px);
  border: 3px dashed var(--gold-light);
  border-radius: 28px;
  position: relative;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.35), inset 0 0 40px rgba(212, 175, 55, 0.15);
  animation: frame-pulse 2.4s ease-in-out infinite;
}
@keyframes frame-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.3), inset 0 0 30px rgba(212, 175, 55, 0.12); }
  50% { box-shadow: 0 0 55px rgba(212, 175, 55, 0.55), inset 0 0 55px rgba(212, 175, 55, 0.22); }
}
.scan-frame::before,
.scan-frame::after,
.scan-frame .corner-tl,
.scan-frame .corner-br {
  content: "❅";
  position: absolute;
  font-size: 1.6rem;
  color: var(--gold-light);
  filter: drop-shadow(0 0 6px rgba(212,175,55,0.7));
}
.scan-frame::before { top: -14px; left: -14px; }
.scan-frame::after { bottom: -14px; right: -14px; }

.scan-hint {
  position: absolute;
  bottom: -46px;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  max-width: 340px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--snow);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.scan-fab {
  position: absolute;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scan-fab-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.18), 0 10px 30px rgba(0,0,0,0.5);
  animation: fab-pulse 1.8s ease-in-out infinite;
  pointer-events: auto;
}
@keyframes fab-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.scan-fab-btn:disabled { animation: none; opacity: 0.6; }
.scan-fab-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--snow);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.scan-error-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 30px;
  text-align: center;
  background: linear-gradient(160deg, var(--pine-dark), #06190f);
  /* z-index inferior al de la topbar (5) y al botón de escaneo flotante (6):
     así, aunque la cámara falle, el niño puede seguir pulsando "Escanear"
     (el escaneo es una experiencia mágica/teatral que no depende del
     análisis real del vídeo, solo de la petición GET al backend). */
  z-index: 4;
}
.scan-error-box .big-emoji { font-size: 3.2rem; }
.scan-error-box h2 { font-family: var(--font-title); font-size: 1.6rem; margin: 0; }
.scan-error-box p { color: var(--snow-dim); max-width: 340px; font-size: 0.9rem; }

.campaign-id-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

/* --- Overlay de revelado mágico --- */
.reveal-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(16, 58, 36, 0.92), rgba(3, 10, 6, 0.97));
  overflow: hidden;
}

.reveal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 2;
}
.reveal-wand {
  font-size: 3.4rem;
  animation: wand-spin 1.4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(212,175,55,0.8));
}
@keyframes wand-spin {
  0%, 100% { transform: rotate(-18deg) scale(1); }
  50% { transform: rotate(18deg) scale(1.15); }
}
.reveal-loading p {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--gold-light);
  text-align: center;
  animation: pulse-text 1.6s ease-in-out infinite;
}
@keyframes pulse-text { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.sparkle-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sparkle-particles span {
  position: absolute;
  font-size: 1.2rem;
  color: var(--gold-light);
  opacity: 0;
  animation: sparkle-pop 1.1s ease-in infinite;
}
@keyframes sparkle-pop {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.4) translateY(-30px) rotate(90deg); }
}

/* --- Pergamino / carta festiva --- */
.scroll-wrap {
  position: relative;
  z-index: 2;
  width: min(90vw, 420px);
  max-height: 85vh;
  overflow-y: auto;
  transform-origin: top center;
  animation: unroll 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes unroll {
  from { transform: scaleY(0.05); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

.scroll-card {
  background: linear-gradient(165deg, #fdf6e3, #f3e4bb 60%, #e9d49f);
  color: #3a2a06;
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.55), inset 0 0 0 6px rgba(212,175,55,0.35);
  position: relative;
  border: 2px solid var(--gold-dark);
}
.scroll-card::before {
  content: "❆ ✦ ❆";
  display: block;
  text-align: center;
  color: var(--gold-dark);
  letter-spacing: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.scroll-card h2 {
  font-family: var(--font-title);
  text-align: center;
  font-size: 1.5rem;
  margin: 0 0 4px;
  color: var(--red-dark);
}
.scroll-card .scroll-sub {
  text-align: center;
  font-size: 0.78rem;
  color: var(--gold-dark);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.scroll-text {
  font-family: var(--font-magic);
  font-size: 1.7rem;
  line-height: 1.5;
  min-height: 90px;
  text-align: left;
  white-space: pre-wrap;
}
.scroll-text .cursor {
  display: inline-block;
  width: 2px;
  background: var(--red-dark);
  margin-left: 1px;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.scroll-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.scroll-actions .btn-tts {
  background: linear-gradient(135deg, var(--pine-light), var(--pine));
  color: var(--snow);
}
.scroll-actions .btn-tts.speaking {
  animation: speaking-pulse 1s ease-in-out infinite;
}
@keyframes speaking-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */
@media (max-width: 640px) {
  .dashboard-hero h1 { font-size: 1.9rem; }
  .navbar { padding: 12px 16px; }
  .calendar-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 10px 14px 50px; }
  .premium-banner { flex-direction: column; text-align: center; }
  .share-box { flex-direction: column; align-items: stretch; }
  .scroll-text { font-size: 1.4rem; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .calendar-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* =========================================================
   ELFTRANSLATOR — pantalla del niño, cámara y área de padres
   ========================================================= */

/* --- Selector de idioma y botón de icono --- */
.lang-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}
.lang-toggle button {
  background: transparent;
  color: var(--snow-dim);
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 700;
}
.lang-toggle button.active {
  background: var(--gold);
  color: #3a2a06;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--snow);
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { transform: scale(0.92); }

.link-btn {
  display: block;
  margin: 16px auto 0;
  background: none;
  color: var(--gold-light);
  font-size: 0.85rem;
  text-decoration: underline;
}

/* --- Inicio (niño) --- */
.home {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}
.home-elf { font-size: 4.5rem; animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.home-title {
  font-family: var(--font-title);
  font-size: clamp(2.6rem, 11vw, 4rem);
  margin: 0;
}
.home-subtitle {
  margin: 0 0 40px;
  color: var(--snow-dim);
  font-size: 0.95rem;
}

.scan-big-btn {
  width: min(78vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  color: #3a2a06;
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 0 0 10px rgba(212, 175, 55, 0.15), 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: fab-pulse 2.4s ease-in-out infinite;
}
.scan-big-btn:active { transform: scale(0.95); }
.scan-big-icon { font-size: 4rem; }

/* --- Cámara --- */
.camera-overlay,
.photo-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
}
.camera-video,
.photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
}
.camera-frame {
  position: absolute;
  inset: 18% 10% 26%;
  border: 3px dashed rgba(255, 226, 122, 0.85);
  border-radius: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  animation: frame-pulse 2s ease-in-out infinite;
}
.camera-frame span {
  margin-top: -14px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--gold-light);
}
.camera-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}
.shutter-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--snow);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.35);
}
.shutter-btn:active { transform: scale(0.9); }

/* --- Efecto mágico sobre la foto --- */
.magic-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 30, 15, 0.35);
  overflow: hidden;
  transition: opacity 0.6s ease, background 0.6s ease;
}
.magic-layer.done { background: rgba(0, 0, 0, 0.35); }
.magic-layer.done .magic-text,
.magic-layer.done .magic-sweep { opacity: 0; }
.magic-sweep {
  position: absolute;
  inset: -50% 0;
  background: linear-gradient(180deg, transparent 40%, rgba(255, 226, 122, 0.55) 50%, transparent 60%);
  animation: sweep 1.1s ease-in-out infinite;
  transition: opacity 0.4s ease;
}
@keyframes sweep {
  from { transform: translateY(-40%); }
  to { transform: translateY(40%); }
}
.magic-text {
  position: relative;
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--gold-light);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  animation: pulse-text 1.2s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

/* --- Nota revelada sobre la foto --- */
#note-slot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  pointer-events: none;
}
#note-slot > * { pointer-events: auto; }
.note-card {
  width: min(100%, 440px);
  max-height: 65vh;
  overflow-y: auto;
  background: linear-gradient(165deg, rgba(253, 246, 227, 0.94), rgba(233, 212, 159, 0.94));
  color: #3a2a06;
  border: 2px solid var(--gold-dark);
  border-radius: 18px;
  padding: 24px 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 226, 122, 0.5);
  animation: unroll 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.note-text {
  margin: 0;
  font-family: var(--font-magic);
  font-size: 1.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.note-text .cursor {
  display: inline-block;
  width: 2px;
  background: var(--red-dark);
  animation: blink 0.8s step-end infinite;
}
.note-card.unavailable { text-align: center; }
.note-card.unavailable .note-text { font-family: var(--font-title); color: var(--red-dark); }
.note-sub { margin: 8px 0 0; font-size: 0.9rem; }
.note-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.note-actions .btn-tts {
  background: linear-gradient(135deg, var(--pine-light), var(--pine));
  color: var(--snow);
}
.note-actions .btn-tts.speaking { animation: speaking-pulse 1s ease-in-out infinite; }
.note-actions .btn-ghost { background: rgba(0, 0, 0, 0.5); }

/* --- Área de padres --- */
.auth-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}

.panel {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 48px;
}
.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.panel-title {
  font-family: var(--font-title);
  font-size: 2rem;
  margin: 22px 0 4px;
}
.panel-device {
  margin: 0 0 18px;
  font-size: 0.82rem;
  color: #7be3aa;
}
.panel-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 18px;
}
.panel-card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.panel-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--snow-dim);
}
.panel-warning {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.12);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.note-input {
  width: 100%;
  resize: vertical;
  font-family: var(--font-magic);
  font-size: 1.3rem;
  line-height: 1.35;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 253, 248, 0.08);
  color: var(--snow);
}
.note-input:focus { border-color: var(--gold); outline: none; }

.pass-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.pass-head h2 { margin: 0; }

.generate-form h3 { margin: 6px 0 12px; font-size: 1rem; }

.day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}
.day-item {
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.day-item.active { border-color: var(--gold); box-shadow: 0 0 16px rgba(212, 175, 55, 0.3); }
.day-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}
.day-item summary::-webkit-details-marker { display: none; }
.day-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.day-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-item[open] .day-name { white-space: normal; }
.day-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-body .note-input { font-size: 1.1rem; margin-bottom: 4px; }
.day-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------
   AJUSTES DEL PANEL: actitud, cambio automático, cuenta
   --------------------------------------------------------- */
.field select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--snow);
  font-size: 0.95rem;
  font-family: inherit;
}
.field select option { color: var(--ink); }

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}
.switch-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--gold); flex-shrink: 0; }
.switch-row strong { display: block; font-size: 0.92rem; }
.switch-row small { color: var(--snow-dim); font-size: 0.8rem; }

.verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.panel-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--snow-dim);
  margin: 10px 0 30px;
}
.panel-footer a { color: var(--gold-light); }

.danger-card { border-color: rgba(233, 69, 96, 0.35); }
.danger-card summary { cursor: pointer; font-weight: 600; }

.legal-accept { font-size: 0.78rem; color: var(--snow-dim); text-align: center; margin: 10px 0 0; }
.legal-accept a { color: var(--gold-light); }

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  line-height: 1.6;
}
.legal-page h1 { font-family: var(--font-title); font-size: 2rem; }
.legal-page h2 { font-size: 1.05rem; margin-top: 26px; color: var(--gold-light); }
.legal-page p, .legal-page li { font-size: 0.92rem; color: var(--snow-dim); }
.legal-draft {
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------
   NOTA EN ÉLFICO PARA IMPRIMIR
   --------------------------------------------------------- */
.print-sheet { display: none; }

@media print {
  @page { margin: 18mm; }
  html, body { background: #fff !important; color: #000; }
  body > *:not(#print-sheet) { display: none !important; }
  .print-sheet { display: block; }

  .elvish-card {
    border: 3px double #000;
    border-radius: 18px;
    padding: 28px 24px;
    text-align: center;
    break-inside: avoid;
  }
  .elvish-ornament { font-size: 20pt; letter-spacing: 8px; }
  .elvish-text {
    font-family: "Noto Sans Runic", serif;
    font-size: 26pt;
    line-height: 1.6;
    white-space: pre-line;
    margin: 18px 0;
  }
  .elvish-signature {
    font-family: "Noto Sans Runic", serif;
    font-size: 18pt;
    text-align: right;
    margin: 0 0 12px;
  }
}
