/* Vista móvil pulida — complementa interfaz.css + interfaz-pdf.css */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-tap-highlight-color: transparent;
}

/* —— Landing —— */
@media (max-width: 900px) {
  body:has(.trivia-landing) {
    overflow-x: hidden;
    background: #e5007d;
  }

  .trivia-landing {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    min-height: 100svh;
  }

  .trivia-landing__hero {
    order: -1;
    flex: none;
    height: clamp(220px, 38dvh, 320px);
    min-height: 220px;
  }

  .trivia-landing__hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 45%;
    background: linear-gradient(180deg, transparent, rgba(229, 0, 125, 0.85));
    pointer-events: none;
    z-index: 2;
  }

  .trivia-landing__hero-photo {
    object-position: center 30%;
  }

  .trivia-landing__marcas-lockup {
    height: clamp(64px, 10vh, 88px);
    max-width: min(58vw, 240px);
    top: max(0.65rem, env(safe-area-inset-top));
    right: max(0.75rem, env(safe-area-inset-right));
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  }

  .trivia-landing__brand {
    flex: 1;
    min-height: 0;
    padding: 1.5rem 1.25rem max(2rem, env(safe-area-inset-bottom));
    justify-content: center;
    gap: 1.25rem;
  }

  .trivia-landing__title-block {
    font-size: clamp(3.25rem, 14vw, 4.75rem);
    padding: 0 0.5rem;
  }

  .trivia-landing__scene {
    margin: 0.25rem 0 0.5rem;
  }

  .trivia-landing__plane {
    width: min(72vw, 280px);
    top: 42px;
  }

  .trivia-landing__cta {
    width: min(100%, 320px);
    height: 56px;
    font-size: 1.45rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  }

  .trivia-landing__slogan {
    white-space: normal;
    font-size: 1.2rem;
    opacity: 0.95;
  }
}

/* —— Páginas interior (form, preguntas, fin, ranking) —— */
@media (max-width: 768px) {
  .pdf-page__inner {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  /* Cabecera compacta en dos filas */
  .pdf-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 0.5rem;
    row-gap: 0.35rem;
    min-height: auto;
    margin-bottom: 0.65rem;
  }

  .pdf-header__logo-trivia {
    width: min(46vw, 168px);
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .pdf-header__marcas-lockup {
    width: min(44vw, 156px);
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .pdf-header__ruta {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0.15rem;
  }

  .pdf-header__ruta-combo {
    width: 100%;
    max-height: 52px;
    object-fit: contain;
  }

  .pdf-glass {
    border-radius: 20px;
    padding: 1.15rem 1.1rem 1.35rem;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  }

  .pdf-glass--registro {
    width: 100%;
    max-width: none;
    margin-top: 0.25rem;
  }

  .pdf-glass__title {
    font-size: clamp(1.65rem, 7vw, 2.15rem);
  }

  .pdf-field input,
  .pdf-input {
    font-size: 16px;
    min-height: 48px;
    padding: 0.75rem 1.15rem;
  }

  .pdf-btn-continuar {
    width: 100%;
    max-width: none;
    min-height: 52px;
    font-size: 1.12rem;
  }

  .pdf-end-score {
    font-size: 1.25rem;
  }
}

/* —— Preguntas —— */
@media (max-width: 768px) {
  #questions-app.pdf-page {
    height: auto;
    min-height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #questions-app .pdf-page__inner {
    height: auto;
    min-height: 100dvh;
    min-height: 100svh;
  }

  #questions-app .pdf-questions-stage {
    justify-content: flex-start;
    padding: 0.25rem 0 1rem;
    gap: 0;
  }

  #questions-app .pdf-questions-stage .pdf-dots-wrap {
    margin-bottom: clamp(22px, 4vh, 36px);
    width: 100%;
  }

  .pdf-dots-score {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.95;
  }

  /* Diez puntos en una sola línea */
  .pdf-dots {
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: clamp(0.28rem, 1.4vw, 0.5rem);
    width: 100%;
    max-width: 100%;
    margin: 0.25rem auto 0;
    padding: 0 0.15rem;
  }

  .pdf-dots span {
    width: clamp(0.95rem, 3.6vw, 1.35rem);
    height: clamp(0.95rem, 3.6vw, 1.35rem);
    flex: 0 0 auto;
  }

  .pdf-dots span.is-ok::before,
  .pdf-dots span[data-result="ok"]::before,
  .pdf-dots span.is-fail::before,
  .pdf-dots span[data-result="fail"]::before {
    font-size: 0.75rem;
  }

  .pdf-dots span.is-current,
  .pdf-dots span[data-result="current"] {
    box-shadow: 0 0 0 3px #e21c24;
  }

  .pdf-glass--pregunta {
    width: 100%;
    padding: 2rem 1rem 1.25rem;
    margin: 0;
  }

  .pdf-glass--pregunta .pdf-q-badge {
    width: 2.65rem;
    height: 2.65rem;
    font-size: 0.95rem;
    border-width: 2px;
  }

  .pdf-glass--pregunta .pdf-q-timer {
    top: 0.65rem;
    right: 0.65rem;
    min-width: 3.75rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.95rem;
  }

  .pdf-q-text {
    font-size: 1.02rem;
    line-height: 1.42;
    padding: 1rem 0.9rem;
    margin-bottom: 1rem;
    border-radius: 16px;
  }

  .pdf-answers {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .pdf-answer {
    width: 100%;
    min-height: 52px;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
  }

  .pdf-answer:active:not(:disabled) {
    transform: scale(0.98);
  }

  .pdf-answer--full {
    width: 100%;
    justify-self: stretch;
  }

  .pdf-answer__letter {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }
}

/* —— Feedback / overlay —— */
@media (max-width: 768px) {
  .pdf-overlay {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
      max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .pdf-feedback .pdf-glass {
    width: 100%;
    max-width: none;
    border-radius: 22px 22px 18px 18px;
    margin-bottom: 0;
    padding: 1.25rem 1rem 1.5rem;
  }

  .pdf-feedback h2 {
    font-size: 1.35rem;
  }

  .pdf-feedback p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .pdf-track {
    padding: 0.75rem 0.1rem 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .pdf-track::-webkit-scrollbar {
    display: none;
  }

  .pdf-track__node {
    width: 1.1rem;
    height: 1.1rem;
  }

  .pdf-track__plane {
    width: clamp(4.5rem, 22vw, 5.75rem);
  }

  .pdf-track__trophy {
    font-size: 1.35rem;
  }
}

/* —— Ranking: tarjetas —— */
@media (max-width: 768px) {
  .pdf-glass--wide {
    padding: 1.15rem 1rem;
  }

  .pdf-table-wrap {
    overflow: visible;
  }

  .pdf-table {
    display: block;
    font-size: 0.88rem;
  }

  .pdf-table thead {
    display: none;
  }

  .pdf-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .pdf-table tr {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  }

  .pdf-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.28rem 0;
    border-bottom: none;
  }

  .pdf-table td::before {
    content: attr(data-label);
    font-weight: 700;
    opacity: 0.88;
    flex-shrink: 0;
  }

  .pdf-table td:first-child {
    font-size: 1.05rem;
    font-weight: 800;
    padding-bottom: 0.45rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 380px) {
  .pdf-dots {
    gap: 0.22rem;
  }

  .pdf-dots span {
    width: clamp(0.88rem, 3.2vw, 1.05rem);
    height: clamp(0.88rem, 3.2vw, 1.05rem);
  }

  .pdf-header__logo-trivia {
    width: 42vw;
  }

  .pdf-header__marcas-lockup {
    width: 40vw;
  }
}
