/* =========================================
   Amigo Secreto Marvel — estilos
   Paleta: rojo, negro, azul, dorado
   ========================================= */

:root {
  --red: #e62429;
  --red-deep: #8a0f14;
  --black: #0a0a0c;
  --ink: #12141a;
  --blue: #1a3d8f;
  --blue-bright: #2f6fed;
  --gold: #d4af37;
  --gold-soft: #f0d78c;
  --cream: #f4f1ea;
  --muted: #b8b3a8;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font-display: "Bangers", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--black);
  line-height: 1.5;
  overflow-x: hidden;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

/* --- Fondo Marvel --- */

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(230, 36, 41, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(26, 61, 143, 0.5), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(212, 175, 55, 0.18), transparent 55%),
    linear-gradient(160deg, #050507 0%, #12141a 45%, #1a0a0c 100%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(
      -18deg,
      transparent 0,
      transparent 38px,
      rgba(230, 36, 41, 0.06) 38px,
      rgba(230, 36, 41, 0.06) 40px
    );
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(40px); }
}

/* --- Layout --- */

.page {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeUp 0.7s ease both;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 5rem);
  letter-spacing: 0.04em;
  line-height: 1.05;
  color: var(--cream);
  text-shadow:
    0 0 0.05em var(--red),
    0 8px 0 rgba(138, 15, 20, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.55);
  animation: brandPulse 4s ease-in-out infinite;
}

.tagline {
  margin: 1rem auto 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

@keyframes brandPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

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

/* --- Formulario --- */

.panel {
  background:
    linear-gradient(145deg, rgba(26, 20, 24, 0.92), rgba(10, 10, 12, 0.95)),
    linear-gradient(90deg, rgba(230, 36, 41, 0.15), transparent 40%);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 4vw, 2.2rem);
  box-shadow: var(--shadow);
  animation: fadeUp 0.75s ease 0.1s both;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--blue-bright));
}

.panel-title {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: 0.06em;
  color: var(--gold-soft);
  text-align: center;
}

.field {
  margin-bottom: 1.15rem;
}

.field label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--cream);
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
}

.site-nav a {
  color: var(--gold-soft);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.55);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.45);
  color: var(--cream);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(184, 179, 168, 0.55);
}

.field textarea {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.field input.is-invalid,
.field textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18);
}

/* Selector de personaje: lista táctil (el datalist nativo no se ve en móvil) */
.character-picker {
  display: grid;
  gap: 0.55rem;
}

#character-name {
  font-size: 16px;
}

.picker-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.character-options {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  gap: 0.4rem;
  max-height: min(50vh, 20rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(0, 0, 0, 0.28);
  scrollbar-width: thin;
}

.character-options li {
  margin: 0;
  padding: 0;
}

.character-option {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(18, 20, 26, 0.95);
  color: var(--cream);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.character-option:hover,
.character-option:focus-visible {
  border-color: var(--gold);
  outline: none;
}

.character-option.is-selected,
.character-option[aria-selected="true"] {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-soft);
}

.character-empty {
  grid-column: 1 / -1;
  padding: 0.9rem 0.6rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (min-width: 640px) {
  .character-options {
    grid-template-columns: 1fr 1fr;
    max-height: 16.5rem;
  }
}

.field-error,
.form-error,
.form-success {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
}

.field-error,
.form-error {
  color: var(--danger);
}

.form-success {
  color: #8ee0a8;
  text-align: center;
  margin-bottom: 0.8rem;
}

.privacy-note {
  margin: 0.4rem 0 1.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.btn-primary,
.btn-secondary {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 55%, #5a0a0d 100%);
  box-shadow: 0 12px 28px rgba(230, 36, 41, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-secondary {
  display: block;
  margin: 0.5rem auto 0;
  color: var(--gold-soft);
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.45);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.1);
  transform: translateY(-1px);
}

/* --- Resultados --- */

.results {
  margin-top: 2.2rem;
  display: grid;
  gap: 1.4rem;
  animation: fadeUp 0.6s ease both;
}

.results-badge {
  justify-self: center;
  margin: 0;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  animation: fadeUp 0.5s ease both;
}

.character-card {
  background: linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  animation: cardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.identity-card {
  border-top: 3px solid var(--red);
  animation-delay: 0.05s;
}

.gift-card {
  border-top: 3px solid var(--blue-bright);
  animation-delay: 0.2s;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-header {
  padding: 1.1rem 1.2rem 0.2rem;
}

.card-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.05em;
  color: var(--gold-soft);
  text-align: center;
}

.card-media {
  position: relative;
  margin: 1rem auto 0;
  width: min(280px, 78%);
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(212, 175, 55, 0.35);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: #1a1a1f;
  transition: transform 0.5s ease;
}

.character-card:hover .card-media img {
  transform: scale(1.04);
}

.type-pill {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.type-pill.is-hero {
  background: linear-gradient(135deg, var(--blue), #0d214f);
}

.type-pill.is-villain {
  background: linear-gradient(135deg, var(--red), #5a0a0d);
}

.card-body {
  padding: 1.1rem 1.4rem 1.5rem;
  text-align: center;
}

.card-body h3 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  color: #fff;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.footer {
  text-align: center;
  padding: 0 1rem 2rem;
  color: rgba(184, 179, 168, 0.55);
  font-size: 0.78rem;
}

/* --- Responsive --- */

.views-info {
  margin: -0.4rem 0 0;
  text-align: center;
  color: var(--gold-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.results-actions {
  display: grid;
  gap: 0.75rem;
  justify-items: stretch;
}

.btn-print {
  width: 100%;
  background: linear-gradient(135deg, var(--blue) 0%, #0d214f 100%);
  box-shadow: 0 12px 28px rgba(47, 111, 237, 0.28);
}

@media (min-width: 780px) {
  .results {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .results-badge,
  .views-info,
  .results-actions {
    grid-column: 1 / -1;
  }

  .results-actions {
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
  }

  .btn-print,
  .results-actions .btn-secondary,
  .results-actions .nav-btn {
    width: 100%;
    margin: 0;
  }
}

@media print {
  .bg-layer,
  .bg-glow,
  .hero .eyebrow,
  .hero .tagline,
  .form-panel,
  .footer,
  .site-nav,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }

  .page {
    max-width: 100%;
    padding: 0;
  }

  .brand {
    color: #111 !important;
    text-align: center;
    margin-bottom: 1rem;
  }

  .results {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0;
  }

  .results-badge,
  .views-info {
    grid-column: 1 / -1;
    color: #111 !important;
    background: none !important;
  }

  .character-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
  }

  .card-header h2,
  .card-body h3 {
    color: #111 !important;
  }

  .card-body p {
    color: #333 !important;
  }

  .card-media {
    box-shadow: none;
  }
}

a.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.survey-panel fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.character-badge {
  margin: 0 auto 1rem;
  width: fit-content;
  max-width: 100%;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
}

.progress-wrap {
  position: sticky;
  top: 0.6rem;
  z-index: 8;
  margin: 0 0 1.1rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(10px);
}

.progress-label {
  margin: 0 0 0.45rem;
  text-align: center;
  color: var(--gold-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--blue-bright));
  transition: width 0.25s ease;
}

.gifts-block {
  margin: 1.4rem 0 1rem;
  padding: 1.1rem 1rem 0.2rem;
  border-radius: 14px;
  border: 1px solid rgba(47, 111, 237, 0.35);
  background: rgba(26, 61, 143, 0.12);
}

.gifts-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.05em;
  color: var(--gold-soft);
  text-align: center;
}

/* Preferencias Endulzada */
.endulzada-section {
  margin-top: 1.8rem;
  padding-top: 0.4rem;
}

.endulzada-header {
  text-align: center;
  margin-bottom: 1.1rem;
}

.endulzada-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.endulzada-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  letter-spacing: 0.04em;
  color: var(--cream);
}

.pref-grid {
  display: grid;
  gap: 1rem;
}

.pref-card {
  border-radius: 16px;
  padding: 1rem 0.9rem 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  animation: fadeUp 0.55s ease both;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pref-card.is-at-limit {
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45), 0 14px 36px rgba(0, 0, 0, 0.28);
}

.pref-card--candy {
  border-top: 3px solid var(--red);
  background:
    linear-gradient(135deg, rgba(230, 36, 41, 0.14), transparent 45%),
    linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
}

.pref-card--fruit {
  border-top: 3px solid #3d9a4a;
  background:
    linear-gradient(135deg, rgba(61, 154, 74, 0.16), transparent 45%),
    linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
}

.pref-card--salty {
  border-top: 3px solid #a8b0bc;
  background:
    linear-gradient(135deg, rgba(168, 176, 188, 0.14), transparent 45%),
    linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
}

.pref-card--drink {
  border-top: 3px solid var(--blue-bright);
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.16), transparent 45%),
    linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
}

.pref-card--special {
  border-top: 3px solid var(--gold);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.14), transparent 45%),
    linear-gradient(160deg, rgba(18, 20, 26, 0.95), rgba(8, 8, 12, 0.98));
}

.pref-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.pref-icon {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  font-size: 1rem;
  color: var(--gold-soft);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.28);
  flex-shrink: 0;
}

.pref-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--gold-soft);
}

.pref-counter {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.pref-counter.is-max {
  color: var(--gold);
}

.pref-limit-msg {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.82rem;
  color: #1a1408;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  animation: fadeUp 0.35s ease both;
}

.pref-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pref-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.pref-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pref-chip:has(input:checked),
.pref-chip.is-checked {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-soft);
}

.pref-chip.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.pref-chip:hover:not(.is-disabled) {
  border-color: rgba(212, 175, 55, 0.55);
}

.notes-field {
  margin-top: 1.2rem;
}

.char-counter {
  margin: 0.4rem 0 0;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
}

.char-counter.is-near-limit {
  color: var(--gold);
}

@media (min-width: 780px) {
  .pref-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pref-card--wide {
    grid-column: 1 / -1;
  }
}

.notice-panel {
  text-align: center;
}

.notice-icon {
  margin: 0 0 0.4rem;
  font-size: 2.4rem;
  color: var(--gold);
}

.notice-text {
  margin: 0 auto 1.2rem;
  max-width: 32rem;
  color: var(--muted);
}

.thanks-panel {
  border-color: rgba(212, 175, 55, 0.45);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 5, 8, 0.72);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(440px, 100%);
  background:
    linear-gradient(145deg, rgba(26, 20, 24, 0.98), rgba(10, 10, 12, 0.98));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius);
  padding: 1.5rem 1.3rem 1.3rem;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: grid;
  gap: 0.7rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
