/* ==========================================================================
   Fijate Tools - Calendario de Adviento personalizado
   Tema oscuro base (:root / [data-theme="dark"]) y tema claro ([data-theme="light"])
   ========================================================================== */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #090d16;
  --bg-card: #111827;
  --bg-surface: #131b2e;
  --bg-card-subtle: #182235;
  --bg-input: #0f172a;
  --border-color: #273549;
  --border-focus: #ef4444;

  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-color: #f59e0b;
  --primary-light: rgba(245, 158, 11, 0.14);
  --primary-border: rgba(245, 158, 11, 0.35);

  --festive-red: #dc2626;
  --festive-red-hover: #b91c1c;
  --festive-green: #10b981;
  --festive-gold: #fbbf24;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --success-text: #6ee7b7;

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --warning-text: #fcd34d;

  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #dc2626;

  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-color: #d97706;
  --primary-light: #fef3c7;
  --primary-border: #fcd34d;

  --festive-red: #dc2626;
  --festive-red-hover: #b91c1c;
  --festive-green: #059669;
  --festive-gold: #d97706;

  --success: #059669;
  --success-bg: #ecfdf5;
  --success-text: #065f46;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;

  --shadow-card: 0 4px 18px -2px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.panel-title,
.recipient-title {
  font-family: var(--font-heading);
}

.mono,
code {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.btn-stage-control:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Layout principal canónico */
.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Barra superior de modo */
.advent-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.9rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.advent-mode-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-subtle);
}

.mode-tab-btn.is-active {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-size: 0.78rem;
  font-weight: 600;
}

.advent-view {
  display: none;
}

.advent-view.is-active {
  display: block;
}

/* Paneles del creador */
.advent-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.panel-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Barra de plantillas rápidas */
.templates-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.templates-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.templates-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-template {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-template:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-template.is-applied {
  border-color: var(--festive-green);
  background: var(--success-bg);
  color: var(--success-text);
}

.btn-template-ghost {
  color: var(--text-muted);
}

/* Formulario creador */
.creator-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field label,
.config-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-field input[type="text"],
.advent-panel textarea,
.advent-modal-card input[type="text"],
.advent-modal-card textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.93rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-field input[type="text"]:focus,
.advent-panel textarea:focus,
.advent-modal-card input[type="text"]:focus,
.advent-modal-card textarea:focus,
.year-select-wrap select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Select canónico */
.year-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.year-select-wrap label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.year-select-wrap select {
  width: 110px;
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0.45rem 40px 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

[data-theme="light"] .year-select-wrap select {
  background-color: #ffffff;
  color: #0f172a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.year-select-wrap select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

[data-theme="light"] .year-select-wrap select option {
  background-color: #ffffff;
  color: #0f172a;
}

.config-subsection {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.config-label {
  display: block;
  margin-bottom: 0.65rem;
}

.unlock-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.unlock-header-row .config-label {
  margin-bottom: 0;
}

/* Selector visual de temas */
.theme-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.theme-card-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 58px;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-card-option:hover {
  border-color: var(--primary);
}

.theme-card-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.theme-swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.theme-swatch-rojo {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 60%, #f59e0b 100%);
}

.theme-swatch-bosque {
  background: linear-gradient(135deg, #06202a 0%, #0f766e 60%, #38bdf8 100%);
}

.theme-swatch-dorado {
  background: linear-gradient(135deg, #1c1917 0%, #b45309 60%, #fbbf24 100%);
}

.theme-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.theme-card-info strong {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.25;
}

.theme-card-info small {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Tarjetas de modo de desbloqueo */
.unlock-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.unlock-card-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.18s ease;
}

.unlock-card-option input[type="radio"] {
  margin-top: 0.25rem;
  accent-color: #dc2626;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.unlock-card-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.unlock-card-icon {
  font-size: 1.35rem;
  line-height: 1.1;
  flex-shrink: 0;
}

.unlock-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.unlock-card-body strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.unlock-card-body small {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Contador y rejilla editora de 24 días */
.days-counter-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.creator-days-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.creator-day-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-height: 132px;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.creator-day-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.creator-day-card.is-empty {
  border-style: dashed;
  opacity: 0.82;
}

.creator-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
}

.creator-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  border-radius: 7px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.creator-day-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.creator-day-type {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: none;
}

.creator-day-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.creator-day-edit-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-subtle);
}

/* Botones principales y secundarios */
.btn-primary-festive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}

.btn-primary-festive:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  transform: translateY(-1px);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

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

.btn-full {
  width: 100%;
}

/* Bloque compartir enlace + QR */
.share-result-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1.5rem;
  align-items: start;
}

.share-link-column {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.share-url-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.url-size-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.url-qr-compat {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
}

.url-qr-compat.is-warn {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.share-url-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.share-url-input-group input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.8rem;
}

.share-cta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-whatsapp-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-sm);
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-whatsapp-share:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.whatsapp-preview-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.wa-preview-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.wa-preview-text {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-secondary);
  white-space: pre-line;
  word-break: break-all;
  line-height: 1.45;
  max-height: 195px;
  overflow-y: auto;
}

/* Tarjetón QR preview */
.share-qr-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.qr-gift-card {
  border-radius: 16px;
  padding: 1.35rem 1.1rem;
  text-align: center;
  color: #ffffff;
  border: 2px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  position: relative;
  overflow: hidden;
}

.qr-gift-card.theme-rojo {
  background: linear-gradient(155deg, #5c0a0a 0%, #991b1b 55%, #7f1d1d 100%);
}

.qr-gift-card.theme-bosque {
  background: linear-gradient(155deg, #06202a 0%, #0f4c5c 55%, #0b3b36 100%);
  border-color: rgba(56, 189, 248, 0.45);
}

.qr-gift-card.theme-dorado {
  background: linear-gradient(155deg, #1c1609 0%, #5c4110 55%, #2c2008 100%);
  border-color: rgba(251, 191, 36, 0.65);
}

.qr-card-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fef3c7;
  margin-bottom: 0.55rem;
}

.qr-card-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.qr-card-names {
  margin: 0 0 0.9rem 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
}

.qr-canvas-frame {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 0.7rem;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  max-width: 100%;
}

.qr-code-container canvas,
.qr-code-container img {
  display: block;
  width: 180px !important;
  height: 180px !important;
  max-width: 100%;
}

.qr-overflow-msg {
  max-width: 220px;
  font-size: 0.78rem;
  color: #991b1b;
  padding: 0.5rem;
  line-height: 1.4;
}

.qr-card-foot {
  margin: 0.85rem 0 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fde68a;
}

/* ==========================================================================
   VISTA DESTINATARIO: TABLERO INTERACTIVO CON 24 PUERTAS
   ========================================================================== */

.recipient-stage {
  position: relative;
  border-radius: 18px;
  padding: 1.75rem 1.4rem;
  color: #f8fafc;
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.recipient-stage.theme-rojo {
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.16), transparent 45%),
    linear-gradient(160deg, #3b0707 0%, #7f1d1d 52%, #450a0a 100%);
  --door-bg: rgba(127, 29, 29, 0.72);
  --door-border: rgba(251, 191, 36, 0.45);
  --door-accent: #fbbf24;
  --door-open-bg: rgba(255, 248, 235, 0.12);
}

.recipient-stage.theme-bosque {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 45%),
    linear-gradient(160deg, #04151f 0%, #0f3d3e 55%, #07202b 100%);
  border-color: rgba(56, 189, 248, 0.38);
  --door-bg: rgba(15, 59, 62, 0.72);
  --door-border: rgba(125, 211, 252, 0.42);
  --door-accent: #38bdf8;
  --door-open-bg: rgba(224, 242, 254, 0.12);
}

.recipient-stage.theme-dorado {
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.2), transparent 48%),
    linear-gradient(160deg, #171206 0%, #3d2c0b 55%, #1f1707 100%);
  border-color: rgba(251, 191, 36, 0.55);
  --door-bg: rgba(56, 40, 10, 0.76);
  --door-border: rgba(251, 191, 36, 0.52);
  --door-accent: #fcd34d;
  --door-open-bg: rgba(254, 243, 199, 0.12);
}

.snow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.recipient-stage-inner {
  position: relative;
  z-index: 2;
}

.recipient-hero {
  margin-bottom: 1.35rem;
}

.recipient-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.recipient-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recipient-pill,
.recipient-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.recipient-pill {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.recipient-mode-pill {
  background: rgba(0, 0, 0, 0.28);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.recipient-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-stage-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.26);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-stage-control.is-on {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.42);
}

.btn-stage-control:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.recipient-title {
  margin: 0 0 0.3rem 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.recipient-from-line {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.86);
}

.recipient-progress-wrap {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
}

.recipient-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.45rem;
}

.recipient-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.recipient-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #34d399);
  transition: width 0.35s ease;
}

.preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  margin-bottom: 1.15rem;
  font-size: 0.85rem;
  color: #fef3c7;
}

.btn-banner-back {
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  border: 1px solid rgba(254, 243, 199, 0.45);
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* Rejilla de 24 puertas */
.recipient-doors-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  perspective: 900px;
}

.advent-door {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 138px;
  padding: 0.8rem 0.65rem;
  border-radius: 14px;
  border: 1.5px dashed var(--door-border);
  background: var(--door-bg);
  color: #ffffff;
  text-align: center;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  backdrop-filter: blur(4px);
}

.advent-door:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.advent-door.is-available {
  border-style: solid;
  border-color: var(--door-accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.advent-door.is-today {
  animation: door-pulse 2.2s infinite ease-in-out;
}

.advent-door.is-opened {
  border-style: solid;
  border-color: rgba(52, 211, 153, 0.65);
  background: var(--door-open-bg);
}

.advent-door.is-locked {
  opacity: 0.82;
  background: rgba(15, 23, 42, 0.48);
  border-color: rgba(255, 255, 255, 0.18);
}

.advent-door.is-opening {
  animation: door-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.advent-door.is-shaking {
  animation: door-shake 0.38s ease-in-out;
}

.door-num {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
}

.advent-door.is-opened .door-num {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.24);
  color: #a7f3d0;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.door-center-icon {
  font-size: 1.75rem;
  line-height: 1.1;
  margin: 0.2rem 0;
}

.door-status-text {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fde68a;
  word-break: break-word;
}

.advent-door.is-opened .door-status-text {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.advent-door.is-locked .door-status-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.72);
}

.recipient-footer-cta {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.recipient-footer-cta p {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}

@keyframes door-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
}

@keyframes door-pop {
  0% { transform: scale(1) rotateY(0deg); }
  45% { transform: scale(1.06) rotateY(-18deg); }
  100% { transform: scale(1) rotateY(0deg); }
}

@keyframes door-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

/* ==========================================================================
   MODALES ACCESIBLES Y TOAST
   ========================================================================== */

.advent-modal-backdrop[hidden] {
  display: none !important;
}

.advent-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 10, 18, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.advent-modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

.advent-modal-notice {
  max-width: 440px;
}

.advent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-day-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-day-title-wrap h3,
.advent-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-day-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 7px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
}

.reveal-type-pill {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.advent-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.advent-modal-close:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.advent-modal-body {
  padding: 1.2rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-field-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.editor-field-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
}

.editor-type-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.type-pill-btn {
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.83rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.type-pill-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.editor-emoji-row-header,
.editor-text-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.custom-emoji-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.custom-emoji-wrap input {
  width: 58px !important;
  min-height: 34px !important;
  padding: 0.25rem 0.4rem !important;
  text-align: center;
}

.editor-emoji-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.emoji-chip-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.emoji-chip-btn:hover {
  transform: scale(1.08);
  border-color: var(--primary);
}

.emoji-chip-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-inspire-me {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 32px;
  padding: 0.25rem 0.65rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.editor-char-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.advent-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.95rem 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.editor-modal-footer,
.reveal-modal-footer {
  justify-content: space-between;
}

.editor-nav-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Modal revelación destinatario */
.reveal-body {
  text-align: center;
  align-items: center;
  padding: 1.5rem 1.35rem;
  position: relative;
}

.reveal-emoji-stage {
  font-size: 3.4rem;
  line-height: 1.1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
}

.reveal-calendar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.reveal-surprise-box {
  width: 100%;
  padding: 1.15rem 1.2rem;
  border-radius: 12px;
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-main);
}

.reveal-surprise-box.is-voucher {
  border-style: dashed;
  border-color: var(--primary);
  background: var(--primary-light);
}

.reveal-surprise-box p {
  margin: 0;
  white-space: pre-line;
}

.reveal-signature {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.notice-message-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.reveal-confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(260px) rotate(320deg); opacity: 0; }
}

/* Toast flotante */
.app-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 10px;
  padding: 0.7rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
  z-index: 10050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.app-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   RESPONSIVE TABLET Y MÓVIL (375 PX)
   ========================================================================== */

@media (max-width: 960px) {
  .theme-cards-grid {
    grid-template-columns: 1fr;
  }

  .unlock-cards-grid,
  .share-result-grid {
    grid-template-columns: 1fr;
  }

  .creator-days-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recipient-doors-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tool-layout {
    margin: 1rem auto 2.5rem;
    padding: 0 0.75rem;
  }

  .advent-panel,
  .recipient-stage {
    padding: 1rem;
  }

  .creator-form-grid {
    grid-template-columns: 1fr;
  }

  .creator-days-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipient-doors-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .advent-door {
    min-height: 112px;
    padding: 0.65rem 0.4rem;
  }

  .door-num {
    font-size: 1.45rem;
  }

  .advent-mode-pills,
  .mode-tab-btn,
  .templates-buttons,
  .btn-template,
  .share-cta-row,
  .btn-whatsapp-share,
  .share-cta-row .btn-secondary-action,
  #btn-generate-link,
  #btn-create-own-calendar,
  .editor-type-pills {
    width: 100%;
  }

  .editor-type-pills {
    grid-template-columns: 1fr;
  }

  .share-url-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .share-url-input-group input {
    width: 100%;
    flex: none;
  }

  .editor-modal-footer,
  .reveal-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-nav-group {
    width: 100%;
    justify-content: space-between;
  }

  .editor-nav-group .btn-secondary-action {
    flex: 1 1 0%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .advent-door.is-today,
  .advent-door.is-opening,
  .advent-door.is-shaking,
  .confetti-piece {
    animation: none !important;
  }
}

