/* ================= Waku: intro / home screen -- SHARED SKELETON ========== *
 * Round 21, Fase 3: full redesign per "Waku — Plan de interfaz
 * multi-dispositivo" (Sep 29, 2026). Replaces the Round 18-20 single/
 * dual-tier layout with one shared 2-column skeleton (.wk-intro: art |
 * main) that every profile (phone/tablet/desktop -- see
 * styles/profiles/*.css, driven by html[data-ui], see ui/device.js's Fase
 * 2 addition) lays out differently through --wk-* size tokens rather than
 * duplicating structural CSS per tier. This file holds only what's the
 * SAME across every profile; everything that differs (splash size, card
 * size, content max-width, chip position, gutter) lives in
 * styles/profiles/*.css. styles/wk-tokens.css holds the color tokens used
 * throughout.
 *
 * Diagnóstico items this rewrite addresses (see the plan doc's table):
 *   #1 iPhone title/gesture-hint clipping -- .wk-intro now has its own
 *      overflow:auto safety net and sizes to content instead of forcing
 *      align-content:center on a box that could overflow both edges.
 *   #2 HUD/banner ghosting behind the portada -- #introOverlay's
 *      background is now fully OPAQUE (--wk-bg), not a translucent
 *      gradient, so nothing behind it (HUD, end-of-level banners) shows
 *      through anymore.
 *   #3 4th cast card cut mid-word with a hard edge -- .wk-cast-mask fades
 *      the trailing edge instead of a hard max-width cutoff, so a partial
 *      card reads as an intentional "swipe for more" cue.
 *   #4 three different alignment axes (title centered, text left, CTA
 *      centered) -- everything now shares ONE left edge inside
 *      .wk-intro-main (title, description, cast, actions all left-aligned
 *      as one column), fixing "un solo borde izquierdo".
 *   #5 iPad/Mac using ~50% of the screen with empty bands -- --wk-splash
 *      and --wk-content-max are now real per-profile tokens (see
 *      styles/profiles/tablet.css, desktop.css) tuned to fill the space
 *      instead of small fixed px caps.
 *   #6 phone splash/CTA oversized for a short viewport -- data-size
 *      (compact/regular/large, set by ui/device.js from viewport height)
 *      lets styles/profiles/*.css fall back to phone-sized tokens even on
 *      a tablet/desktop profile when the window is short.
 *   #7 two-line labels with inconsistent height -- .intro-char span now
 *      has a fixed min-height (2 lines' worth) regardless of label length.
 *   #8 visible grey scrollbar under the carousel -- hidden by default
 *      (profiles/desktop.css brings a thin one back, since desktop has
 *      room and mouse users benefit from seeing it).
 *   #9 señoría chip floating with no relation to the rest -- now shares
 *      the CTA's baseline row on tablet/desktop (profiles/tablet.css,
 *      desktop.css put both at the bottom of their own flex column so
 *      they land on the same line), and becomes a compact top-right pill
 *      on phone instead (profiles/phone.css) rather than sitting alone in
 *      the art column.
 */

#introOverlay{
  position:absolute; inset:0; z-index:6;
  display:flex; align-items:center; justify-content:center;
  /* #2: opaque, not translucent -- see the header comment above */
  background:var(--wk-bg, #140e08);
  color:var(--wk-text, #fff5ec); text-align:left;
  overflow:hidden;
}
#introOverlay[hidden]{ display:none; }

/* .wk-intro is the shared 2-column skeleton every profile lays out with
   its own tokens (grid-template-columns from --wk-splash, gutter from
   --wk-gutter, cap width from --wk-content-max -- all declared per
   profile in styles/profiles/*.css). It sizes to its own content
   (never taller than the viewport) and centers as ONE unit -- #1/#5. */
#introOverlay .wk-intro{
  display:grid;
  grid-template-columns: var(--wk-splash, 150px) 1fr;
  column-gap: var(--wk-gutter, 24px);
  align-items:stretch;
  width:100%;
  max-width: var(--wk-content-max, 100%);
  max-height:100%;
  padding: calc(var(--wk-gutter, 16px) + env(safe-area-inset-top,0px)) calc(var(--wk-gutter, 16px) + env(safe-area-inset-right,0px)) calc(var(--wk-gutter, 16px) + env(safe-area-inset-bottom,0px)) calc(var(--wk-gutter, 16px) + env(safe-area-inset-left,0px));
  box-sizing:border-box;
  /* safety net only -- profiles size their own tokens to fit without it,
     but a viewport smaller than expected (an unusually short phone, a
     resized desktop window) still scrolls instead of clipping -- #1 */
  overflow-y:auto;
}

#introOverlay .wk-intro-art{
  display:flex; flex-direction:column; align-items:center;
  gap:12px; min-width:0;
}

#introOverlay .wk-intro-main{
  display:flex; flex-direction:column;
  gap:10px; min-width:0; min-height:0;
  text-align:left;
}

#introOverlay .wk-intro-title{
  font-family:'Fredoka','Nunito',sans-serif;
  font-size: var(--wk-fs-title, 24px);
  margin:0; flex-shrink:0;
  display:flex; align-items:center; gap:8px;
}
#introOverlay .title-icon{ width:1.15em; height:1.15em; border-radius:50%; object-fit:cover; }

#introOverlay #introDesc{
  margin:0; max-width:none;
  font-size: var(--wk-fs-body, 14px);
  color: var(--wk-text-muted, rgba(255,245,236,0.72));
  line-height:1.4;
}
#introOverlay #introDesc{ transition:opacity 0.12s ease; }
#introOverlay #introDesc.swapping{ opacity:0; }
#introOverlay #introDesc .intro-power-icon{ font-size:1.05em; margin-right:4px; }
#introOverlay #introDesc .intro-power-level{ font-size:0.8em; color:var(--wk-gold, #ffd24a); opacity:0.9; }
#introOverlay #introDesc strong{ color:var(--wk-gold-soft, #ffcd6e); }

/* ---- carousel mask: fades the trailing edge instead of a hard cut -- #3.
   Removed (via .at-end, toggled by ui/intro.js when the scroller has
   nothing left to reveal) so the last real card doesn't fade uselessly. */
#introOverlay .wk-cast-mask{
  position:relative;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  /* when the desktop arrows wrap this in .wk-cast-row (a flex row), a flex
     item's default min-width:auto lets it grow to the scrolling cast's full
     (unclamped) content width instead of the row's available space -- that
     pushed the "next" arrow off past the edge of the screen. width:100% +
     min-width:0 makes it shrink to fit like any other block context. */
  width:100%;
  min-width:0;
}
#introOverlay .wk-cast-mask.at-end{
  -webkit-mask-image:none; mask-image:none;
}
/* the fade only makes sense once there's overflow to hint at -- a profile
   wide enough to show every card at once (desktop, a big tablet) gets no
   mask, via the .no-overflow class ui/intro.js adds after measuring */
#introOverlay .wk-cast-mask.no-overflow{
  -webkit-mask-image:none; mask-image:none;
}

#introOverlay .intro-cast{
  display:flex; flex-wrap:nowrap; justify-content:flex-start;
  gap: var(--wk-gutter-sm, 16px);
  width:100%; overflow-x:auto; overflow-y:hidden;
  padding:4px 2px 10px;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
  /* #8: hidden by default -- profiles/desktop.css brings a thin one back */
  scrollbar-width:none; -ms-overflow-style:none;
}
#introOverlay .intro-cast::-webkit-scrollbar{ display:none; height:0; }

#introOverlay .intro-char{
  display:flex; flex-direction:column; align-items:center; gap:5px;
  width: var(--wk-card-w, 112px);
  flex:0 0 auto; scroll-snap-align:start;
  cursor:pointer; border-radius:14px; padding:6px 4px; background:transparent;
  border:1px solid transparent; transition:background 0.15s, border-color 0.15s;
}
#introOverlay .intro-char:hover, #introOverlay .intro-char:focus-visible{ background:rgba(255,255,255,0.08); }
#introOverlay .intro-char.selected{ background:var(--wk-surface-raised, rgba(255,205,110,0.16)); border-color:var(--wk-gold-line, rgba(255,205,110,0.55)); }
#introOverlay .intro-char:focus-visible{ outline:2px solid var(--wk-gold, #ffd24a); outline-offset:2px; }
#introOverlay .intro-char img{
  width: var(--wk-card-img, 72px); height: var(--wk-card-img, 72px); object-fit:contain;
  animation: introBounce 1.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  filter:drop-shadow(0 6px 6px rgba(0,0,0,0.35));
}
/* #7: fixed 2-line height regardless of label length, so every card's
   button/CTA row below lands on the same baseline */
#introOverlay .intro-char span{
  font-size: var(--wk-fs-caption, 11px); opacity:0.85; line-height:1.25; text-align:center;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  min-height: calc(var(--wk-fs-caption, 11px) * 1.25 * 2);
}
#introOverlay .intro-char.locked-hero img{ filter:grayscale(1) brightness(0.55); animation:none; }
#introOverlay .intro-char.locked-hero span{ opacity:0.6; }
@keyframes introBounce{
  0%,100%{ transform:translateY(0) scale(1); }
  50%{ transform:translateY(-8px) scale(1.04); }
}

/* ---- CTA row (Jugar + gesture/keyboard hint) -- lives inside
   .wk-intro-main so it shares the same left edge as the title/description/
   cast above it (#4); per-profile position (right-aligned on phone,
   baseline-aligned with the chip on tablet/desktop) is set in
   styles/profiles/*.css. */
#introOverlay .wk-intro-actions{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin-top:auto; padding-top:6px;
}
#introOverlay .intro-gesture-hint,
#introOverlay .intro-keyboard-hint{
  font-size: var(--wk-fs-caption, 11px); opacity:0.65;
}
/* only one of the two hints is ever shown at once -- ui/intro.js sets
   [hidden] on whichever this profile doesn't use (see
   WakuProfiles.*.showGestureHint / .keyboard) */
#introOverlay .intro-gesture-hint[hidden],
#introOverlay .intro-keyboard-hint[hidden]{ display:none; }

/* the primary CTA -- "botones grandes" (Angry Birds reference): bigger,
   bolder, with its own soft drop shadow so it reads as THE thing to tap,
   not just another .btn in a row */
#introOverlay .intro-play-btn{
  font-size: var(--wk-fs-cta, 19px);
  min-height: var(--wk-cta-h, 48px);
  padding:0 32px 0 24px;
  display:inline-flex; align-items:center; gap:8px;
  background:var(--wk-clay, #b5502e); color:var(--wk-text, #fff5ec);
  box-shadow:0 10px 22px rgba(0,0,0,0.4), 0 1.5px 0 rgba(255,255,255,0.2) inset;
}
#introOverlay .intro-play-btn:hover{ background:var(--wk-clay-pressed, #8a3a20); }
#introOverlay .intro-play-btn:active{ box-shadow:0 4px 10px rgba(0,0,0,0.35); }
#introOverlay .intro-play-btn:focus-visible{ outline:2px solid var(--wk-gold, #ffd24a); outline-offset:3px; }

/* ---- carousel arrows (desktop only -- styles/profiles/desktop.css turns
   display:flex on for these; every other profile leaves them display:none
   via the base rule here since ui/intro.js always creates them but only
   desktop's WakuProfiles.carouselArrows wires up their click handlers) ---- */
#introOverlay .wk-cast-arrow{
  display:none;
  align-items:center; justify-content:center;
  width:36px; height:36px; border-radius:50%; flex-shrink:0;
  border:1.5px solid var(--wk-line, rgba(255,255,255,0.35));
  background:rgba(0,0,0,0.3); color:var(--wk-text, #fff);
  font-size:16px; cursor:pointer;
}
#introOverlay .wk-cast-arrow:hover{ background:rgba(0,0,0,0.5); }
#introOverlay .wk-cast-arrow:focus-visible{ outline:2px solid var(--wk-gold, #ffd24a); outline-offset:2px; }
#introOverlay .wk-cast-row{ display:flex; align-items:center; gap:8px; width:100%; }

/* startup señoría callout -- see "al iniciar debe salir el señorify".
   Tapping it opens the same detail popup (progress bar + full rank
   legend, styles/seniority-legend.css) as before. Per-profile position
   (absolute top-right pill on phone, inline on the CTA's baseline row on
   tablet/desktop) lives in styles/profiles/*.css -- #9. */
#introOverlay .intro-seniority-chip{
  display:flex; align-items:center; gap:6px;
  background:linear-gradient(135deg, rgba(255,210,74,0.18), rgba(255,157,60,0.1));
  border:1.5px solid var(--wk-gold-line, rgba(255,210,74,0.55));
  border-radius:999px;
  padding:6px 12px;
  color:var(--wk-text, #fff); text-align:center;
  font:inherit;
  cursor:pointer;
}
#introOverlay .intro-seniority-chip:focus-visible{ outline:2px solid var(--wk-gold, #ffd24a); outline-offset:2px; }
#introOverlay .intro-seniority-chip-icon{ font-size:15px; line-height:1; flex-shrink:0; }
#introOverlay .intro-seniority-chip-label{
  font-size:11px; font-weight:800; color:var(--wk-gold, #ffd24a); line-height:1.2;
  white-space:nowrap;
}
#introOverlay .intro-seniority-chip-rating{ font-size:9px; opacity:0.7; white-space:nowrap; }

#introOverlay .intro-splash{
  width: var(--wk-splash, 150px); height: var(--wk-splash, 150px);
  max-width:100%; max-height:100%;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  position:relative;
}
#introOverlay .intro-splash img{
  width:100%; height:100%; object-fit:contain;
  filter:drop-shadow(0 10px 18px rgba(0,0,0,0.45));
}
/* carousel: IntroScreen cycles through the cast automatically, picking a
   different one of these entrance effects each turn so the cover screen
   stays lively instead of showing one static character */
#introOverlay .intro-splash img.fx-zoom{ animation: splashZoom 1.15s cubic-bezier(.16,1,.3,1) both; }
#introOverlay .intro-splash img.fx-spin{ animation: splashSpin 1.1s cubic-bezier(.2,.9,.3,1.1) both; }
#introOverlay .intro-splash img.fx-slide{ animation: splashSlide 0.95s cubic-bezier(.16,1,.3,1) both; }
#introOverlay .intro-splash img.fx-flip{ animation: splashFlip 1.05s cubic-bezier(.3,.6,.3,1.1) both; }
#introOverlay .intro-splash img.fx-pop{ animation: splashPop 0.85s cubic-bezier(.34,1.6,.4,1) both; }
@keyframes splashZoom{
  0%{ transform:scale(2.6) rotate(-6deg); opacity:0; }
  55%{ opacity:1; }
  100%{ transform:scale(1) rotate(0deg); opacity:1; }
}
@keyframes splashSpin{
  0%{ transform:scale(0.4) rotate(340deg); opacity:0; }
  60%{ opacity:1; }
  100%{ transform:scale(1) rotate(0deg); opacity:1; }
}
@keyframes splashSlide{
  0%{ transform:translateX(-140%) rotate(-10deg); opacity:0; }
  65%{ opacity:1; }
  100%{ transform:translateX(0) rotate(0deg); opacity:1; }
}
@keyframes splashFlip{
  0%{ transform:perspective(400px) rotateY(90deg) scale(0.7); opacity:0; }
  60%{ opacity:1; }
  100%{ transform:perspective(400px) rotateY(0deg) scale(1); opacity:1; }
}
@keyframes splashPop{
  0%{ transform:scale(0); opacity:0; }
  70%{ transform:scale(1.15); opacity:1; }
  100%{ transform:scale(1); opacity:1; }
}
#introOverlay .intro-splash-glow{
  position:absolute; inset:-10%; border-radius:50%;
  background:radial-gradient(circle, rgba(255,205,110,0.5), rgba(255,205,110,0) 70%);
  animation: splashGlowPulse 2.2s ease-in-out infinite;
  pointer-events:none;
}
@keyframes splashGlowPulse{
  0%,100%{ opacity:0.5; transform:scale(0.92); }
  50%{ opacity:0.9; transform:scale(1.05); }
}

/* Round 21, Fase 1: the señoría legend popup's rules (seniority-legend
   classes, plus the progress bar and hint under .intro-seniority-*) live
   in their own styles/seniority-legend.css -- see that file's header
   comment for why (it's opened from the game's own HUD badge too, not
   just this screen, so it can't be scoped under #introOverlay). */

/* ---- Fase 5: prefers-reduced-motion, the rest -- ui/intro.js's
   prefersReducedMotion() already skips the splash's fx-* entrance class and
   its auto-cycle timer (see initSplash()'s render()/start()), but those two
   are the only motion driven from JS. These two CONTINUOUS, always-on CSS
   animations (the cast cards' idle bounce, the splash's glow pulse) run
   regardless of any JS state, so they need their own media-query off
   switch: settle each element in the pose its animation already rests at
   (frame 0%/100% of introBounce is translateY(0) scale(1); the glow's
   resting opacity/scale is the middle of its range for a calmer static
   look) rather than just freezing it mid-motion. */
@media (prefers-reduced-motion: reduce){
  #introOverlay .intro-char img{ animation:none; }
  #introOverlay .intro-splash-glow{ animation:none; opacity:0.7; transform:scale(0.98); }
}
