/* ================================================================
   Per a tu: mazo de cartas (PerATu / PerATuMobil)
================================================================ */

body.is-deck { background: var(--bg-2); }
:root[data-theme="dark"] body.is-deck { background: var(--bg); }

.deck-page {
  max-width: 1240px; margin: 0 auto; padding: 40px 24px 56px;
  display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; justify-content: center;
}

/* Columna izquierda */
.deck-intro { flex: 1 1 260px; min-width: 0; max-width: 340px; display: flex; flex-direction: column; gap: 20px; padding-top: 12px; }
.deck-intro h1 { margin: 0; font-size: 40px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; }
.deck-lead { margin: 0; font-size: 16px; line-height: 1.55; color: var(--mid); }
.deck-lead strong { color: var(--text); }
.deck-progress {
  display: flex; flex-direction: column; gap: 10px; padding: 18px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; font-weight: 600;
}
.deck-progress small { font-size: 13px; font-weight: 400; color: var(--mid); }
.deck-dots { display: flex; gap: 6px; }
.deck-dots span { flex: 1; height: 6px; border-radius: 999px; background: var(--border-light); }
.deck-dots span.is-done { background: var(--primary); }
.deck-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--mid); }
.deck-keys li { display: flex; align-items: center; gap: 10px; }
.deck-keys kbd {
  font: inherit; font-weight: 600; min-width: 34px; text-align: center; padding: 4px 8px;
  border-radius: 8px; border: 1px solid var(--border-light); background: var(--bg-card); color: var(--text);
}

/* Centro: la carta */
.deck-main { flex: 0 1 440px; min-width: 0; width: 440px; display: flex; flex-direction: column; gap: 20px; }
.deck-stack { position: relative; height: 600px; }

.deck-card {
  position: absolute; inset: 0; border-radius: 28px; overflow: hidden; background: #0F172A;
  box-shadow: 0 20px 48px rgba(15,23,42,.18); touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; transition: transform .24s ease;
}
.deck-card.is-dragging { cursor: grabbing; transition: none; }
.deck-card.is-flying { transition: transform .3s ease-in; pointer-events: none; }
.deck-card.is-back { transform: translateY(16px) scale(.94); opacity: .85; box-shadow: none; pointer-events: none; }
.deck-card-cover { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.deck-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.deck-card-cover.is-generated svg { opacity: .9; margin-bottom: 30%; }
.deck-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(2,6,23,.25) 0%, rgba(2,6,23,0) 22%, rgba(2,6,23,0) 45%, rgba(2,6,23,.85) 100%);
}
.deck-card-text {
  position: absolute; left: 28px; right: 28px; bottom: 28px; z-index: 1;
  display: flex; flex-direction: column; gap: 10px; color: #fff;
}
.deck-card-cat { align-self: flex-start; font-size: 13px; font-weight: 600; background: rgba(15,118,110,.92); padding: 6px 14px; border-radius: 999px; }
.deck-card-text h2 { margin: 0; font-size: 32px; line-height: 1.08; font-weight: 700; letter-spacing: -.01em; }
.deck-card-text h2 a { color: inherit; }
.deck-card-text h2 a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 4px; }
.deck-card-when { font-size: 16px; font-weight: 600; }
.deck-card-place { font-size: 15px; opacity: .88; }

.deck-stamp {
  position: absolute; z-index: 2; top: 28px; font-size: 22px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; padding: 6px 14px; border-radius: 12px; opacity: 0; pointer-events: none; white-space: nowrap;
}
.deck-stamp.is-like { left: 24px; background: var(--primary); transform: rotate(-8deg); }
.deck-stamp.is-pass { right: 24px; background: var(--pass); transform: rotate(8deg); }
.deck-stamp.is-going { top: 36%; left: 50%; background: var(--going); transform: translateX(-50%); }

.deck-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.deck-btn {
  font: inherit; font-size: 15px; font-weight: 600; min-height: 56px; border-radius: 18px; border: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.deck-btn.is-pass { background: var(--pass); }
.deck-btn.is-like { background: var(--primary); }
.deck-btn.is-going { background: var(--going); }
.deck-btn:disabled { opacity: .4; cursor: default; }
.deck-btn:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* Aviso tras las cartas de prueba y mazo vacío: en el sitio de la carta */
.deck-gate, .deck-empty {
  position: absolute; inset: 0; z-index: 3; border-radius: 28px;
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(15,23,42,.08);
}
.deck-gate[hidden], .deck-empty[hidden] { display: none; }
.deck-gate-sheet, .deck-empty { padding: 36px; display: flex; flex-direction: column; justify-content: center; gap: 14px; height: 100%; box-sizing: border-box; }
.deck-gate-logo { width: 56px; height: 56px; border-radius: 16px; }
.deck-gate h2, .deck-empty h2 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.deck-gate p, .deck-empty p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--mid); }
.deck-gate-thumbs { display: flex; gap: 8px; }
.deck-gate-thumbs:empty { display: none; }
.deck-gate-thumb { width: 52px; height: 52px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; color: #fff; flex: none; }
.deck-gate-thumb img { width: 100%; height: 100%; object-fit: cover; }
.deck-gate-thumb svg { width: 26px; height: 26px; }
.deck-cta {
  min-height: 52px; border-radius: 16px; background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.deck-cta:hover { background: var(--primary-dark); }
.deck-gate-later { align-self: flex-start; font-size: 14px; font-weight: 600; color: var(--accent-text); padding: 8px 0; }
.deck-empty .deck-cta { align-self: flex-start; padding: 0 24px; }
.deck-noscript { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* Derecha: lo elegido */
.deck-chosen { flex: 1 1 260px; min-width: 0; max-width: 340px; display: flex; flex-direction: column; gap: 14px; padding-top: 12px; }
.deck-chosen h2 { margin: 0; font-size: 18px; font-weight: 700; }
.deck-chosen-empty { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); border: 1px dashed var(--border-light); border-radius: 18px; padding: 18px; }
.deck-chosen-list { display: flex; flex-direction: column; gap: 10px; }
.deck-chosen-item {
  display: flex; gap: 12px; align-items: center; padding: 10px; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px;
}
.deck-chosen-item:hover { border-color: var(--border-light); }
.deck-chosen-cover { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; flex: none; display: grid; place-items: center; color: #fff; }
.deck-chosen-cover img { width: 100%; height: 100%; object-fit: cover; }
.deck-chosen-cover svg { width: 26px; height: 26px; }
.deck-chosen-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deck-chosen-text small { font-size: 12px; font-weight: 600; }
.deck-chosen-text small.is-like { color: var(--accent-text); }
.deck-chosen-text small.is-going { color: var(--going); }
:root[data-theme="dark"] .deck-chosen-text small.is-going { color: #93C5FD; }
.deck-chosen-text strong { font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-chosen-text span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ordenador estrecho: la lista baja debajo */
@media (max-width: 1100px) and (min-width: 769px) {
  .deck-chosen { max-width: 440px; flex-basis: 100%; }
}

/* Móvil: carta a pantalla completa, botones encima de la barra inferior */
@media (max-width: 768px) {
  body.is-deck .site-footer { display: none; }
  .deck-page { padding: 0; gap: 0; display: block; }
  .deck-intro { max-width: none; padding: 10px 12px 0; gap: 0; }
  .deck-intro h1, .deck-lead, .deck-keys { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .deck-progress { flex-direction: column-reverse; gap: 6px; padding: 0; background: none; border: 0; border-radius: 0; font-size: 12px; color: var(--mid); }
  .deck-progress small { display: none; }
  .deck-main { width: auto; gap: 0; }
  .deck-stack {
    height: calc(100dvh - var(--navbar-h) - var(--bottom-nav-h) - env(safe-area-inset-bottom) - 96px - 34px);
    min-height: 420px; margin: 8px 12px 0;
  }
  .deck-card { border-radius: 24px; }
  .deck-card.is-back { transform: translateY(10px) scale(.95); }
  .deck-card-text { left: 18px; right: 18px; bottom: 18px; gap: 8px; }
  .deck-card-text h2 { font-size: 28px; }
  .deck-card-when, .deck-card-place { font-size: 14px; }
  .deck-stamp { top: 20px; font-size: 18px; }
  .deck-buttons { gap: 8px; padding: 14px 12px; }
  .deck-btn { font-size: 13px; min-height: 52px; border-radius: 16px; gap: 6px; }
  .deck-chosen { display: none; }

  /* El aviso es una hoja que sube desde abajo */
  .deck-gate {
    position: fixed; inset: 0; z-index: 160; border: 0; border-radius: 0; box-shadow: none;
    background: rgba(2,6,23,.55); display: flex; flex-direction: column; justify-content: flex-end;
  }
  .deck-gate-sheet {
    height: auto; background: var(--bg-card); border-radius: 28px 28px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .deck-gate-logo { display: none; }
  .deck-gate h2 { font-size: 24px; }
  .deck-gate p { font-size: 15px; }
  .deck-empty { border-radius: 24px; padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .deck-card, .deck-card.is-flying { transition: none; }
}
