/**
 * ETAPA 17C–17H — Fairy-tale HUD / pexeso / story / done (preview only).
 * Scoped under .jdemo-hud17c. Live demo (shell.php) does not load this file.
 * 17G: map glass header, universal story intro, parchment polish, pexeso balance.
 * 17H: pure CSS .jdemo-parchment-card (no bitmap ornaments), L/R column centering.
 */

.jdemo-hud17c {
  --jv2-navy: #0b1a33;
  --jv2-gold: #e6c36a;
  --jv2-gold-soft: #ffe9a8;
  --jv2-parchment: #f3e6c8;
  --jv2-ink: #2a1c0e;
  --jv2-touch: 44px;
  --jdemo-ui-title-ribbon: url('/pics/journey_demo/ui/title-ribbon.webp?v=06cbbccd');
  --jdemo-ui-btn-back: url('/pics/journey_demo/ui/button-back.webp?v=9da9849d');
  --jdemo-ui-btn-audio: url('/pics/journey_demo/ui/button-audio.webp?v=13bb4228');
  --jdemo-ui-btn-settings: url('/pics/journey_demo/ui/button-settings.webp?v=a974338e');
  --jdemo-ui-btn-hint: url('/pics/journey_demo/ui/button-hint.webp?v=03471af2');
  --jdemo-ui-progress-star: url('/pics/journey_demo/ui/progress-star.webp?v=e11f4f92');
  /* Swap this URL when final Andělka+Hvězdulka intro art is delivered */
  --jdemo-ui-story-intro: url('/pics/journey_demo/ui/story-intro.webp?v=58d2c18b');
  --jdemo-parch-cream-1: #faf3df;
  --jdemo-parch-cream-2: #f0e0b8;
  --jdemo-parch-cream-3: #e8d4a4;
  --jdemo-parch-gold: rgba(201, 162, 74, 0.72);
  --jdemo-parch-gold-soft: rgba(230, 195, 106, 0.45);
  --jdemo-font-display: 'Cinzel', 'Palatino Linotype', Palatino, serif;
  --jdemo-font-body: 'Source Serif 4', 'Palatino Linotype', Palatino, serif;
}

/* Badge: bottom-left — never overlaps HUD controls */
.jdemo-hud17c-badge {
  position: fixed;
  left: max(8px, env(safe-area-inset-left));
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 25;
  margin: 0;
  padding: 2px 8px;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 233, 168, 0.65);
  background: rgba(7, 16, 31, 0.55);
  border: 1px solid rgba(230, 195, 106, 0.28);
  border-radius: 999px;
  pointer-events: none;
}

/* ===== GameHeader ===== */
.jdemo-hud17c .jdemo-gameheader.jv2-topbar {
  display: grid;
  grid-template-columns: var(--jv2-touch) minmax(0, 1fr) auto;
  grid-template-areas: "back title tools";
  align-items: center;
  gap: 6px 10px;
  min-height: 58px;
  padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(7, 16, 31, 0.55) 0%, rgba(7, 16, 31, 0.22) 100%);
  border-bottom: 1px solid rgba(230, 195, 106, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 30;
}

/* Map: header floats over the world — soft glass, map visible underneath */
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-stage.jv2-stage {
  grid-template-rows: 1fr;
}
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-gameheader.jv2-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 16, 31, 0.42) 0%,
    rgba(7, 16, 31, 0.18) 55%,
    rgba(7, 16, 31, 0.02) 100%
  );
  border-bottom: 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: none;
}
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-gameheader .jdemo-circle-btn,
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-gameheader .jdemo-parchment-title,
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-gameheader .jdemo-settings,
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-gameheader .jdemo-gameheader__tools {
  pointer-events: auto;
}
.jdemo-hud17c:has(#jdemoMapView:not([hidden])) .jdemo-main.jv2-main {
  min-height: 100%;
  height: 100%;
}

/* ETAPA 18J.1 / 18J.2 — film intro + FS gate: remove HUD entirely */
.jdemo-hud17c:has(#jdemoFilmIntro:not([hidden])) .jdemo-stage.jv2-stage,
.jdemo-hud17c .jdemo-app.is-film-intro .jdemo-stage.jv2-stage,
.jdemo-hud17c:has(#jdemoFsGate:not([hidden])) .jdemo-stage.jv2-stage,
.jdemo-hud17c .jdemo-app.is-fs-gate .jdemo-stage.jv2-stage {
  grid-template-rows: 1fr;
}
.jdemo-hud17c:has(#jdemoFilmIntro:not([hidden])) .jdemo-gameheader.jv2-topbar,
.jdemo-hud17c .jdemo-app.is-film-intro .jdemo-gameheader.jv2-topbar,
.jdemo-hud17c:has(#jdemoFsGate:not([hidden])) .jdemo-gameheader.jv2-topbar,
.jdemo-hud17c .jdemo-app.is-fs-gate .jdemo-gameheader.jv2-topbar {
  display: none !important;
}
.jdemo-hud17c:has(#jdemoFilmIntro:not([hidden])) .jdemo-main.jv2-main,
.jdemo-hud17c .jdemo-app.is-film-intro .jdemo-main.jv2-main,
.jdemo-hud17c:has(#jdemoFsGate:not([hidden])) .jdemo-main.jv2-main,
.jdemo-hud17c .jdemo-app.is-fs-gate .jdemo-main.jv2-main {
  min-height: 100%;
  height: 100%;
}
.jdemo-hud17c .jdemo-gameheader > .jdemo-ui-btn-back { grid-area: back; }
.jdemo-hud17c .jdemo-gameheader > .jdemo-parchment-title { grid-area: title; }
.jdemo-hud17c .jdemo-gameheader > .jdemo-gameheader__tools { grid-area: tools; }

.jdemo-hud17c .jdemo-brand--sr {
  /* Must not participate in GameHeader grid (would steal columns). */
  display: none !important;
}

.jdemo-hud17c .jdemo-circle-btn {
  width: var(--jv2-touch);
  height: var(--jv2-touch);
  min-width: var(--jv2-touch);
  min-height: var(--jv2-touch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-circle-btn:hover,
.jdemo-hud17c .jdemo-circle-btn:focus-visible {
  transform: scale(1.06);
  outline: 2px solid rgba(255, 233, 168, 0.65);
  outline-offset: 2px;
}
.jdemo-hud17c .jdemo-circle-btn:active { transform: scale(0.96); }

/* Keep grid slot for back even when inactive (hidden attribute would collapse columns). */
.jdemo-hud17c .jdemo-ui-btn-back[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.jdemo-hud17c .jdemo-ui-btn-back { background-image: var(--jdemo-ui-btn-back); }
.jdemo-hud17c .jdemo-ui-btn-audio { background-image: var(--jdemo-ui-btn-audio); }
.jdemo-hud17c .jdemo-ui-btn-settings { background-image: var(--jdemo-ui-btn-settings); }

.jdemo-hud17c .jdemo-ui-btn-audio.is-muted,
.jdemo-hud17c .jdemo-ui-btn-audio[aria-pressed="true"] {
  filter: grayscale(0.85) brightness(0.72);
  opacity: 0.78;
}
.jdemo-hud17c .jdemo-ui-btn-audio.is-muted::after,
.jdemo-hud17c .jdemo-ui-btn-audio[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    transparent 44%,
    rgba(180, 40, 40, 0.9) 46%,
    rgba(180, 40, 40, 0.9) 54%,
    transparent 56%
  );
  pointer-events: none;
}
.jdemo-hud17c .jdemo-ui-btn-audio {
  position: relative;
}

/*
 * 17H.1 TITLE — CSS parchment strip (bitmap ribbon retired for HUD titles).
 *
 * WHY NOT title-ribbon.webp HERE:
 * Asset is 900×283. At a HUD-safe height (~48–64px) aspect-locked width is
 * only ~153–204px. Ornamental ends need ~40–50px each side, leaving ~70–110px
 * for text — not enough for "Ježíškova výprava" or "Den 2 – Pomíchané ozdoby"
 * without clipping into ornaments or non-uniform bitmap stretch (forbidden).
 * Growing height to ~150px to fit text would dominate the header.
 *
 * FIX: one cream CSS strip (same language as .jdemo-parchment-card), no
 * nested cream-on-ribbon layer, no bitmap deformation. Map vs day title
 * still differs via syncParchmentTitle() text content only.
 */
.jdemo-hud17c .jdemo-parchment-title {
  position: relative;
  justify-self: center;
  z-index: 1;
  box-sizing: border-box;
  width: auto;
  max-width: min(640px, calc(100% - 8px));
  min-height: 44px;
  max-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px clamp(22px, 4vw, 40px);
  background:
    linear-gradient(165deg, rgba(255, 252, 242, 0.55) 0%, transparent 42%),
    linear-gradient(180deg, var(--jdemo-parch-cream-1) 0%, var(--jdemo-parch-cream-2) 55%, var(--jdemo-parch-cream-3) 100%);
  border: 2px solid var(--jdemo-parch-gold);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 4px 14px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  filter: none;
}
/* Decorative bitmap ribbon layer unused (see comment above) */
.jdemo-hud17c .jdemo-parchment-title__ribbon {
  display: none !important;
}
.jdemo-hud17c .jdemo-parchment-title__text {
  position: relative;
  z-index: 1;
  font-family: var(--jdemo-font-display);
  font-weight: 700;
  font-size: clamp(0.82rem, 1.6vw, 1.12rem);
  line-height: 1.2;
  color: var(--jv2-ink);
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  hyphens: auto;
}

.jdemo-hud17c .jdemo-gameheader__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  flex-shrink: 0;
}

/*
 * Fullscreen control — same circular gold/navy family as audio/settings.
 * SVG data-URI icon (expand); .is-active swaps to compress glyph.
 * Fullscreen API wiring unchanged (demo-app + hud17c.js).
 */
.jdemo-hud17c .jdemo-fs-circle,
.jdemo-hud17c .jdemo-ui-btn-fullscreen {
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  border: 0;
  overflow: hidden;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffe9a8'/%3E%3Cstop offset='55%25' stop-color='%23e6c36a'/%3E%3Cstop offset='100%25' stop-color='%23c9a24a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='32' cy='32' r='30' fill='%230b1a33' stroke='url(%23g)' stroke-width='3.5'/%3E%3Cpath fill='none' stroke='%23ffe9a8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M20 26V20h6M44 26V20h-6M20 38v6h6M44 38v6h-6'/%3E%3C/svg%3E");
}
.jdemo-hud17c .jdemo-fs-circle.is-active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23fff1c2'/%3E%3Cstop offset='100%25' stop-color='%23e6c36a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='32' cy='32' r='30' fill='%231a2f52' stroke='url(%23g)' stroke-width='3.5'/%3E%3Cpath fill='none' stroke='%23ffe9a8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M26 20v6H20M38 20v6h6M26 44v-6H20M38 44v-6h6'/%3E%3C/svg%3E");
  filter: none;
}
.jdemo-hud17c .jdemo-fs-circle.is-unsupported,
.jdemo-hud17c .jdemo-fs-circle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.jdemo-hud17c .jdemo-fs-circle[hidden] {
  display: none !important;
}

.jdemo-hud17c .jdemo-settings {
  position: relative;
}
.jdemo-hud17c .jdemo-settings__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 200px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(12, 24, 44, 0.96);
  border: 1px solid rgba(230, 195, 106, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jdemo-hud17c .jdemo-settings__panel[hidden] { display: none !important; }
.jdemo-hud17c .jdemo-settings__age {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--jv2-gold-soft);
  font-size: 0.85rem;
}
.jdemo-hud17c .jdemo-settings__age select {
  min-height: var(--jv2-touch);
  font-size: 1rem;
}
.jdemo-hud17c .jdemo-settings__panel .jdemo-fs-btn {
  min-height: var(--jv2-touch);
  font-size: 0.9rem;
}
/* ETAPA 18F — music toggle inside existing settings (no HUD redesign) */
.jdemo-hud17c .jdemo-settings__bgm {
  min-height: var(--jv2-touch);
  width: 100%;
  justify-content: center;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(230, 195, 106, 0.35);
  color: var(--jv2-gold-soft, #ffe9a8);
  background: rgba(255, 255, 255, 0.04);
}
.jdemo-hud17c .jdemo-settings__bgm[aria-pressed="false"] {
  opacity: 0.72;
}

/* Hide legacy age/mute chrome when still present in tools */
.jdemo-hud17c .jdemo-topbar__tools > .jdemo-age:not(.jdemo-settings__age) {
  display: none;
}

/* ===== ETAPA 17D — character dedupe =====
 * Pexeso-bg + map scene already paint Andělka/Hvězdulka.
 * Hide overlay sprites in this preview only; do not touch other game animators.
 */
.jdemo-hud17c .jdemo-pex-chars {
  display: none !important;
}
.jdemo-hud17c .jv2-char-stage {
  display: none !important;
}
.jdemo-hud17c .jdemo-day.is-andelka-voice #jdemoSceneImg {
  filter: drop-shadow(0 0 18px rgba(255, 220, 120, 0.55));
}
.jdemo-hud17c .jdemo-day.is-andelka-voice .jv2-pexeso.is-bg-ready {
  box-shadow: inset 40px 0 60px -30px rgba(255, 220, 120, 0.35);
}

/* ===== Gold controls ===== */
.jdemo-hud17c .jdemo-gold-btn,
.jdemo-hud17c .jdemo-gold-btn.jv2-btn,
.jdemo-hud17c #jdemoToGame.jdemo-gold-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px !important;
  min-width: 44px;
  padding: 0 18px;
  border: 2px solid #c9a24a;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff1c2 0%, #e6c36a 55%, #c9a24a 100%);
  color: var(--jv2-ink);
  font-family: var(--jdemo-font-display);
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  text-decoration: none;
  white-space: nowrap;
}
.jdemo-hud17c .jdemo-gold-btn:hover,
.jdemo-hud17c .jdemo-gold-btn:focus-visible {
  filter: brightness(1.06);
  outline: 2px solid rgba(255, 233, 168, 0.7);
  outline-offset: 2px;
}
.jdemo-hud17c .jdemo-gold-btn--ghost {
  background: linear-gradient(180deg, rgba(20, 36, 64, 0.95), rgba(10, 20, 40, 0.95));
  color: var(--jv2-gold-soft);
  border-color: rgba(230, 195, 106, 0.65);
}
.jdemo-hud17c .jdemo-gold-btn--soft {
  background: linear-gradient(180deg, #f7e7b8, #d4b56a);
}

/*
 * ETAPA 17H — shared CSS parchment card (no bitmap ornaments).
 * Used for story, done, instruction, progress across all days.
 * Modifiers: --story | --done | --instruction | --progress
 */
.jdemo-hud17c .jdemo-parchment-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  flex: 0 1 auto;
  color: var(--jv2-ink);
  font-family: var(--jdemo-font-body);
  padding: 16px 16px 14px;
  border-radius: 14px;
  border: 2px solid var(--jdemo-parch-gold);
  background:
    linear-gradient(165deg, rgba(255, 252, 242, 0.55) 0%, transparent 42%),
    linear-gradient(180deg, var(--jdemo-parch-cream-1) 0%, var(--jdemo-parch-cream-2) 55%, var(--jdemo-parch-cream-3) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 0 0 1px rgba(255, 248, 230, 0.4),
    0 8px 20px rgba(0, 0, 0, 0.28);
  overflow: hidden; /* nothing escapes the rounded outline */
}
.jdemo-hud17c .jdemo-parchment-card__body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(48vh, calc(100dvh - 200px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0; /* card already pads */
}
.jdemo-hud17c .jdemo-parchment-card__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 2px;
  padding-bottom: max(2px, env(safe-area-inset-bottom, 0px));
  background: transparent !important;
  box-shadow: none !important;
  position: relative !important;
  z-index: 2;
}

/* ===== Story / Done day panel ===== */
.jdemo-hud17c .jdemo-day-panel.jv2-day__panel {
  background: transparent;
  padding: 8px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.jdemo-hud17c .jv2-day:not(.is-playing) {
  /* Illustration dominant; compact story column */
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.72fr);
}
/* Story step: give left scene more hero width (panel logic unchanged) */
.jdemo-hud17c .jv2-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) {
  grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.58fr);
  gap: 0;
}
.jdemo-hud17c .jv2-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) .jdemo-day-scene {
  border-radius: 0;
}

/* ===== Universal story intro (Andělka + Hvězdulka) ===== */
.jdemo-hud17c .jdemo-day-scene {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 0 12px;
}
.jdemo-hud17c .jdemo-story-intro {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  align-items: stretch;
  justify-content: stretch;
  background: #0f1927;
}
/*
 * 17H.1 polish: full-bleed cover in the left scene (hero, not letterboxed inset).
 * Image is wider than the left rail → cover crops sides; bias LEFT so Andělka +
 * Hvězdulka stay in frame. No non-uniform stretch (object-fit: cover).
 */
.jdemo-hud17c .jdemo-story-intro__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  pointer-events: none;
  user-select: none;
}
/* Show intro only on story step (not during game / done keeps day scene) */
.jdemo-hud17c .jdemo-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) .jdemo-story-intro {
  display: flex;
}
.jdemo-hud17c .jdemo-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) .jdemo-day-scene__day,
.jdemo-hud17c .jdemo-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) #jdemoSceneImg {
  opacity: 0;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) #jdemoCharStage {
  display: none !important;
}
.jdemo-hud17c .jdemo-step--story,
.jdemo-hud17c .jdemo-step--done {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 4px;
}

/* Story / done modifiers — content-sized, scroll body, CTAs below */
.jdemo-hud17c .jdemo-parchment-card--story,
.jdemo-hud17c .jdemo-parchment-card--done {
  width: 100%;
  max-height: 100%;
  align-self: stretch;
  height: auto;
}
.jdemo-hud17c .jdemo-parchment-card--story .jdemo-parchment-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(48vh, calc(100dvh - 200px));
  /* Override demo.css .jdemo-story-scroll padding */
  padding: 2px 2px 0 !important;
}
.jdemo-hud17c .jdemo-parchment-card--done .jdemo-parchment-card__body {
  max-height: min(52vh, 400px);
}
.jdemo-hud17c .jv2-step[data-step="story"] .jdemo-story-actions {
  background: transparent !important;
  box-shadow: none !important;
  position: relative !important;
}

/* Hide inline skip / Přehrát — Hrát + Poslechnout cover both */
.jdemo-hud17c .jv2-dialogue__toolbar,
.jdemo-hud17c .jv2-dialogue__skip,
.jdemo-hud17c .jv2-dialogue__play {
  display: none !important;
}
.jdemo-hud17c .jdemo-parchment-card__actions .jv2-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.jdemo-hud17c .jdemo-parchment-card--story #jdemoToGame {
  order: 0;
  flex: 0 0 auto;
}

/* Dialog → story → instruction hierarchy */
.jdemo-hud17c .jdemo-parchment-card--story .jdemo-dialog {
  margin: 0;
  flex: 0 0 auto;
  order: 1;
}
.jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue {
  margin-bottom: 0;
}
.jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue__line {
  background: rgba(255, 248, 230, 0.55);
  border: 1px solid rgba(201, 162, 74, 0.45);
  color: var(--jv2-ink);
  border-radius: 10px;
  padding: 8px 10px;
}
.jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue__line.is-active {
  background: rgba(255, 252, 240, 0.95);
  border-color: rgba(201, 162, 74, 0.9);
  box-shadow: 0 0 0 1px rgba(230, 195, 106, 0.35);
}
.jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue__speaker {
  color: #8a5a12;
  font-family: var(--jdemo-font-display);
  font-weight: 700;
  font-size: clamp(0.9rem, 1.45vw, 1.05rem);
}
.jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue__text {
  font-size: clamp(1rem, 1.65vw, 1.18rem);
  line-height: 1.4;
  color: var(--jv2-ink);
}
.jdemo-hud17c .jdemo-parchment-card--story .jdemo-story {
  order: 2;
  margin: 0;
  flex: 0 0 auto;
  font-size: clamp(0.9rem, 1.35vw, 1.02rem);
  line-height: 1.45;
  color: rgba(42, 28, 14, 0.9);
}
.jdemo-hud17c .jdemo-parchment-card--story .jdemo-instruction {
  order: 3;
  margin: 0;
  flex: 0 0 auto;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(230, 195, 106, 0.28);
  border: 1px solid rgba(201, 162, 74, 0.5);
  font-size: clamp(0.88rem, 1.3vw, 1rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--jv2-ink);
}

/* Done: reward-first */
.jdemo-hud17c .jdemo-done-kicker {
  margin: 0 0 8px;
  font-family: var(--jdemo-font-display);
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  font-weight: 700;
  color: #8a5a12;
  text-align: center;
}
.jdemo-hud17c .jdemo-reward-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px auto 14px;
}
.jdemo-hud17c .jdemo-reward-hero img,
.jdemo-hud17c .jdemo-parchment-card--done .jv2-reward img {
  width: clamp(128px, 26vw, 200px) !important;
  max-width: min(46vh, 220px) !important;
  height: auto !important;
  padding: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1a3358 0%, #0b1a33 70%);
  box-shadow:
    0 0 0 3px rgba(230, 195, 106, 0.85),
    0 10px 24px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 0 16px rgba(255, 233, 168, 0.45));
}
.jdemo-hud17c .jdemo-reward-label,
.jdemo-hud17c .jdemo-parchment-card--done .jdemo-reward-label {
  margin: 0;
  font-family: var(--jdemo-font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 1.9vw, 1.35rem);
  color: #5c3a0e !important;
  text-align: center;
  text-shadow: none;
}
.jdemo-hud17c .jdemo-done-text {
  margin: 0;
  text-align: center;
  font-size: clamp(0.88rem, 1.4vw, 1.05rem);
  line-height: 1.4;
  color: rgba(42, 28, 14, 0.9);
}

/* ===== Pexeso shell — 17H.3 compositional 3 zones ===== */
.jdemo-hud17c .jv2-day.is-playing .jv2-day__panel {
  padding: 0;
  background: transparent;
}
.jdemo-hud17c .jv2-step--game {
  min-height: 0;
  height: 100%;
}
/*
 * 17H.6: side chrome = direct % of game viewport from hand mock (17h5-ref-manual).
 * Measured (white edit artifacts ignored): left≈3.3%, right≈82.7% of frame width.
 * NO board-edge / rail sync — fixed custom properties only.
 */
.jdemo-hud17c .jdemo-pex-shell {
  /* Manual mock @1024: left cream≈33px (3.22%), right cream≈847px (82.71%) */
  --jdemo-ui-left-x: 3.3%;
  --jdemo-ui-right-x: 82.7%;
  --jdemo-ui-left-width: clamp(168px, 18vw, 236px);
  --jdemo-ui-right-width: clamp(120px, 11.3vw, 168px);
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  /* No horizontal pad on desktop so % left maps to stage width */
  padding: 4px 0 8px;
  box-sizing: border-box;
  position: relative;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="other"] .jdemo-pex-shell__left,
.jdemo-hud17c .jdemo-pex-shell[data-mode="other"] .jdemo-pex-shell__right {
  display: none;
}
.jdemo-hud17c .jdemo-pex-shell__center {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.jdemo-hud17c .jdemo-pex-shell__left,
.jdemo-hud17c .jdemo-pex-shell__right {
  grid-column: 1;
  grid-row: 1;
  z-index: 6;
  box-sizing: border-box;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}
.jdemo-hud17c .jdemo-pex-shell__left > *,
.jdemo-hud17c .jdemo-pex-shell__right > * {
  pointer-events: auto;
}

/* LEFT: bottom; X from mock % of shell (= game viewport) — Day 2 pexeso */
.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__left {
  position: absolute;
  left: var(--jdemo-ui-left-x);
  right: auto;
  top: auto;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  width: var(--jdemo-ui-left-width);
  height: auto;
  max-height: 42%;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
  align-items: stretch;
  transform: none;
}
/* RIGHT: V-mid; X from mock % — NOT derived from board edge — Day 2 pexeso */
.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__right {
  position: absolute;
  left: var(--jdemo-ui-right-x);
  right: auto;
  top: 50%;
  bottom: auto;
  width: var(--jdemo-ui-right-width);
  height: auto;
  margin: 0;
  padding: 0;
  justify-content: center;
  align-items: center;
  transform: translateY(-50%);
}

/*
 * Day 1 starlight — same right X as pexeso, stack optically lower
 * (upper-mid, not glued under top HUD / sky). Day 2 keeps top:50%.
 */
.jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] {
  /* Desktop only: optically lower vs pexeso mid (50%). Compact MQ keeps 50%. */
  --jdemo-ui-right-top: 62%;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__left {
  position: absolute;
  left: var(--jdemo-ui-left-x);
  right: auto;
  top: auto;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  width: var(--jdemo-ui-left-width);
  height: auto;
  max-height: 42%;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
  align-items: stretch;
  transform: none;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__right {
  position: absolute;
  left: var(--jdemo-ui-right-x);
  right: auto;
  top: var(--jdemo-ui-right-top, 58%);
  bottom: auto;
  width: var(--jdemo-ui-right-width);
  height: auto;
  margin: 0;
  padding: 0;
  justify-content: center;
  align-items: center;
  transform: translateY(-50%);
}
/* Prefer parchment right stack; hide native starlight top HUD (duplicate score/hint) */
.jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jv2-starlight__hud {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jv2-starlight__intro {
  display: none;
}

/*
 * ETAPA 18G.2 — Day 3 spot: info column | image A | image B.
 * Chrome lives in the left column (JS moves score + hint). No overlays on art.
 */
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] {
  display: grid;
  grid-template-columns:
    minmax(120px, 0.2fr)
    minmax(0, 0.4fr)
    minmax(0, 0.4fr);
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(4px, 0.8vw, 10px);
  padding: 4px 6px 8px;
  align-items: stretch;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-shell__left {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  inset: auto;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  transform: none;
  width: auto;
  max-width: none;
  max-height: none;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
  z-index: 2;
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-shell__center {
  grid-column: 2 / 4;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  z-index: 1;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-shell__right {
  display: none !important;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-right-stack {
  display: contents;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-progress,
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-instruction,
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-hint {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-instruction {
  max-height: none;
  overflow: visible;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-hint {
  align-self: center;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__hud {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-game-mount,
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__stage.is-mode-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(4px, 0.8vw, 10px);
  height: 100%;
  min-height: 0;
  align-items: center;
  justify-items: center;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__pane {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
/* Square art pairs: frame = largest square in pane; contain fills frame (no crop). */
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__frame {
  position: relative;
  flex: 0 0 auto;
  width: min(100cqi, 100cqh);
  height: min(100cqi, 100cqh);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jv2-spot__overlay {
  position: absolute;
  inset: 0;
}

@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] {
    grid-template-columns:
      minmax(100px, 0.2fr)
      minmax(0, 0.4fr)
      minmax(0, 0.4fr);
    gap: 4px;
    padding: 2px 4px 4px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-shell__left {
    gap: 4px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-progress {
    padding: 6px 6px 4px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-progress__star {
    width: 26px;
    height: 24px;
    margin: 2px auto;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-progress__score {
    font-size: 1rem;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-progress__label {
    font-size: 0.58rem;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-instruction {
    padding: 6px 7px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-instruction__text {
    font-size: 0.72rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-replay {
    font-size: 0.62rem;
    min-height: 44px;
    padding: 0 6px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="spot"] .jdemo-pex-hint {
    width: 52px;
    height: 52px;
    min-width: 44px;
    min-height: 44px;
  }
}

.jdemo-hud17c .jdemo-pex-right-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.jdemo-hud17c .jdemo-parchment-card--instruction,
.jdemo-hud17c .jdemo-pex-instruction {
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 0;
  max-height: min(32vh, 200px);
  padding: 10px 10px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.jdemo-hud17c .jdemo-pex-instruction__text {
  margin: 0 0 8px;
  font-size: clamp(0.72rem, 1.05vw, 0.9rem);
  line-height: 1.3;
  text-align: center;
  color: var(--jv2-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.jdemo-hud17c .jdemo-pex-replay {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: clamp(0.72rem, 1.05vw, 0.86rem);
  padding: 0 8px;
  white-space: normal;
  line-height: 1.2;
  height: auto;
  min-height: 44px;
}

.jdemo-hud17c .jdemo-parchment-card--progress,
.jdemo-hud17c .jdemo-pex-progress {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: center;
  text-align: center;
  padding: 10px 8px 8px;
}
.jdemo-hud17c .jdemo-pex-progress__label {
  margin: 0 0 4px;
  font-family: var(--jdemo-font-display);
  font-size: clamp(0.7rem, 1.15vw, 0.88rem);
  font-weight: 700;
  color: var(--jv2-ink);
}
.jdemo-hud17c .jdemo-pex-progress__star {
  display: block;
  width: clamp(40px, 6vw, 64px);
  height: clamp(36px, 5.5vw, 58px);
  margin: 4px auto;
  background-image: var(--jdemo-ui-progress-star);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.jdemo-hud17c .jdemo-pex-progress__score {
  margin: 2px 0 0;
  font-family: var(--jdemo-font-display);
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 700;
}

.jdemo-hud17c .jdemo-pex-hint {
  flex: 0 0 auto;
  align-self: center;
  width: clamp(72px, 10vw, 104px);
  height: clamp(72px, 10vw, 104px);
  min-width: var(--jv2-touch);
  min-height: var(--jv2-touch);
  border: 0;
  padding: 0;
  background-color: transparent;
  background-image: var(--jdemo-ui-btn-hint);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: contain;
  cursor: pointer;
  position: relative;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
}
.jdemo-hud17c .jdemo-pex-hint__label {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  font-family: var(--jdemo-font-display);
  font-size: clamp(0.65rem, 1.1vw, 0.8rem);
  font-weight: 700;
  color: #fff8e6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-pex-hint:hover,
.jdemo-hud17c .jdemo-pex-hint:focus-visible {
  transform: scale(1.05);
  outline: 2px solid rgba(255, 233, 168, 0.7);
  outline-offset: 3px;
}
.jdemo-hud17c .jdemo-pex-hint:disabled {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: default;
  transform: none;
}

.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso {
  border-radius: 0;
  background-color: transparent;
  --jdemo-pex-hud: 0px;
  --jdemo-pex-pad-x: clamp(4px, 1vw, 16px);
  --jdemo-pex-pad-y: clamp(4px, 1vh, 12px);
  grid-template-rows: minmax(0, 1fr);
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso__hud {
  display: none !important;
}
.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso__board {
  --jdemo-pex-cell-h: calc(
    (
      100cqh
      - 2 * var(--jdemo-pex-pad-y)
      - (var(--jdemo-pex-rows) - 1) * var(--jdemo-pex-gap)
    ) / var(--jdemo-pex-rows)
  );
}
/* Keep workshop characters visible under left chrome (faces above bottom panel) */
.jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso.is-bg-ready {
  --jdemo-pex-bg-pos: 22% center;
}

/* ===== Compact / mobile landscape (dedicated, not shrunk desktop) ===== */
@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c {
    --jv2-touch: 44px;
  }
  .jdemo-hud17c .jdemo-gameheader.jv2-topbar {
    min-height: 48px;
    padding-top: 4px;
    padding-bottom: 4px;
    gap: 4px 6px;
  }
  .jdemo-hud17c .jdemo-parchment-title {
    min-height: 40px;
    max-height: 52px;
    padding: 4px clamp(14px, 3vw, 24px);
  }
  .jdemo-hud17c .jdemo-parchment-title__text {
    font-size: clamp(0.62rem, 2.2vh, 0.82rem);
    line-height: 1.15;
  }
  .jdemo-hud17c .jv2-day:not(.is-playing) {
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  }
  .jdemo-hud17c .jv2-day:not(.is-playing):has(.jv2-step[data-step="story"]:not([hidden])) {
    grid-template-columns: minmax(0, 1.35fr) minmax(200px, 0.7fr);
  }
  .jdemo-hud17c .jdemo-parchment-card {
    padding: 10px 10px 9px;
    border-radius: 12px;
  }
  .jdemo-hud17c .jdemo-parchment-card--story .jdemo-parchment-card__body {
    max-height: none;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-parchment-card__body {
    max-height: min(58vh, 260px);
  }
  .jdemo-hud17c .jdemo-parchment-card--story .jv2-dialogue__text {
    font-size: clamp(0.95rem, 2.4vh, 1.1rem);
  }
  .jdemo-hud17c .jdemo-parchment-card--story .jdemo-story {
    font-size: clamp(0.88rem, 2.1vh, 1rem);
  }
  .jdemo-hud17c .jdemo-parchment-card--story .jdemo-instruction {
    font-size: clamp(0.88rem, 2vh, 0.98rem);
  }
  .jdemo-hud17c .jdemo-pex-shell {
    position: relative;
    gap: 4px;
    padding: 2px 4px 4px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    /* Compact: ignore desktop mock % — use edge-pinned chrome below */
    --jdemo-ui-left-x: 4px;
    --jdemo-ui-right-x: auto;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__center,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__left,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__right {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }
  /*
   * Compact floating chrome — Day 1 starlight only (left BOTTOM, right mid).
   * Day 2 pexeso uses a real 3-column grid below (ETAPA 18G.1).
   */
  .jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__left {
    position: absolute;
    left: 4px;
    right: auto;
    top: auto;
    bottom: max(6px, env(safe-area-inset-bottom, 0px));
    transform: none;
    width: min(30%, 168px);
    height: auto;
    max-height: 46%;
    z-index: 6;
    pointer-events: auto;
    margin: 0;
    padding: 0;
    justify-content: flex-end;
    align-items: center;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="starlight"] .jdemo-pex-shell__right {
    position: absolute;
    left: auto;
    right: 4px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: min(22%, 118px);
    height: auto;
    z-index: 6;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /*
   * ETAPA 18G.1 — Day 2 pexeso short landscape:
   * Real left | board | right columns so cards size to the center gutter
   * (no overlay under instruction / score). Desktop absolute layout unchanged.
   */
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] {
    display: grid;
    grid-template-columns:
      minmax(112px, 22%)
      minmax(0, 1fr)
      minmax(72px, 15%);
    grid-template-rows: minmax(0, 1fr);
    gap: 4px;
    align-items: stretch;
    overflow: hidden;
    isolation: isolate;
  }
  /*
   * ETAPA 18G.1a/1b — SINGLE full-bleed workshop art on the shell only.
   * Do not also paint pexeso-bg on .jv2-pexeso (that caused dual crops / seams).
   */
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"]::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #0a1628;
    background-image: url('/pics/journey_demo/pexeso/pexeso-bg.webp?v=97eaa43c');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__left {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: auto;
    max-width: none;
    max-height: none;
    height: 100%;
    z-index: 2;
    pointer-events: auto;
    margin: 0;
    padding: 0 0 2px;
    justify-content: flex-end;
    align-items: stretch;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__center {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__right {
    position: relative;
    grid-column: 3;
    grid-row: 1;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: auto;
    height: 100%;
    z-index: 2;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-game-mount,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  /*
   * ETAPA 18G.1b — kill every workshop paint on descendants (demo.css
   * .jv2-pexeso / .is-bg-ready). Shell::before is the only art layer.
   */
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-game-mount,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso.is-bg-ready {
    --jdemo-pex-bg: none;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
    background-size: auto !important;
    background-position: 0 0 !important;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-parchment-card {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso__board {
    max-width: 100%;
    overflow-x: hidden;
  }
  .jdemo-hud17c .jdemo-pex-right-stack {
    gap: 8px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-parchment-card--instruction,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-instruction {
    max-height: 96px;
    padding: 6px 7px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-instruction__text {
    font-size: 0.78rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-parchment-card--progress,
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-progress {
    padding: 6px 6px 4px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-progress__star {
    width: 28px;
    height: 26px;
    margin: 2px auto;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-progress__score {
    font-size: 1rem;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-progress__label {
    font-size: 0.58rem;
  }
  .jdemo-hud17c .jdemo-pex-hint {
    width: 56px;
    height: 56px;
    min-width: 44px;
    min-height: 44px;
  }
  .jdemo-hud17c .jdemo-gold-btn {
    min-height: 44px !important;
    font-size: 0.78rem;
    padding: 0 10px;
  }
  .jdemo-hud17c .jdemo-pex-replay {
    font-size: 0.62rem;
    min-height: 44px;
    padding: 0 6px;
  }
  .jdemo-hud17c .jdemo-reward-hero img,
  .jdemo-hud17c .jdemo-parchment-card--done .jv2-reward img {
    width: clamp(72px, 16vw, 110px) !important;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso {
    --jdemo-pex-max-card: 96px;
    --jdemo-pex-min-card: 44px;
    --jdemo-pex-gap: 3px;
    --jdemo-pex-pad-x: 2px;
    --jdemo-pex-pad-y: 2px;
  }
}

/* 9+ short landscape: cards first — hide replay to save space */
@media (orientation: landscape) and (max-height: 430px) and (max-width: 960px) {
  .jdemo-hud17c .jdemo-pex-shell[data-pairs="10"] .jdemo-pex-replay {
    display: none;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso {
    --jdemo-pex-max-card: 88px;
    --jdemo-pex-min-card: 44px;
  }
  /* 18G.1: column width already from grid; keep chrome compact for 10 pairs */
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"][data-pairs="10"] {
    grid-template-columns:
      minmax(100px, 20%)
      minmax(0, 1fr)
      minmax(68px, 14%);
  }
}

@media (orientation: landscape) and (max-height: 390px) {
  .jdemo-hud17c .jdemo-circle-btn,
  .jdemo-hud17c .jdemo-fs-circle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .jdemo-hud17c .jdemo-pex-hint {
    width: 52px;
    height: 52px;
    min-width: 44px;
    min-height: 44px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] {
    grid-template-columns:
      minmax(96px, 20%)
      minmax(0, 1fr)
      minmax(64px, 14%);
    gap: 3px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jdemo-pex-shell__left {
    justify-content: flex-end;
  }
  .jdemo-hud17c .jdemo-parchment-card__actions { gap: 6px; }
}

/* Full-bleed stage when in browser fullscreen */
.jdemo-hud17c:fullscreen .jdemo-stage,
.jdemo-hud17c:-webkit-full-screen .jdemo-stage {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
}
.jdemo-hud17c.is-fs-layout .jdemo-app,
.jdemo-hud17c.is-fs-layout .jdemo-stage {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 0;
}

/* Wide desktop comfort */
@media (min-width: 1100px) and (min-height: 640px) {
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso:has(.jv2-pexeso__card:nth-child(8)):not(:has(.jv2-pexeso__card:nth-child(9))) {
    --jdemo-pex-max-card: 220px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso:has(.jv2-pexeso__card:nth-child(12)):not(:has(.jv2-pexeso__card:nth-child(13))) {
    --jdemo-pex-max-card: 188px;
  }
  .jdemo-hud17c .jdemo-pex-shell[data-mode="pexeso"] .jv2-pexeso:has(.jv2-pexeso__card:nth-child(20)) {
    --jdemo-pex-max-card: 148px;
  }
}

/* ===== ETAPA 18I.4 — thematic story FX + done parchment ===== */

.jdemo-hud17c .jdemo-story-intro {
  isolation: isolate;
}
.jdemo-hud17c .jdemo-story-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-story-fx__glow,
.jdemo-hud17c .jdemo-story-fx__sparkles,
.jdemo-hud17c .jdemo-story-fx__snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

/* Day 1 — soft sky glow + gold sparkles */
.jdemo-hud17c .jdemo-story-intro[data-day-fx="1"] .jdemo-story-fx__glow {
  opacity: 1;
  background:
    radial-gradient(ellipse 42% 36% at 58% 28%, rgba(255, 233, 168, 0.28), transparent 70%),
    radial-gradient(ellipse 28% 22% at 22% 38%, rgba(255, 214, 120, 0.18), transparent 72%);
  animation: jdemo18i4-glow-pulse 4.8s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-story-intro[data-day-fx="1"] .jdemo-story-fx__sparkles {
  opacity: 1;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 22%, rgba(255, 248, 210, 0.95), transparent),
    radial-gradient(1.5px 1.5px at 42% 14%, rgba(255, 233, 168, 0.85), transparent),
    radial-gradient(2px 2px at 63% 26%, rgba(255, 250, 220, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 74% 18%, rgba(255, 220, 140, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 51% 8%, rgba(255, 248, 210, 0.75), transparent),
    radial-gradient(2px 2px at 33% 30%, rgba(255, 233, 168, 0.7), transparent);
  animation: jdemo18i4-twinkle 3.6s ease-in-out infinite;
}

/* Day 2 — warm ornament / lantern glow + particles */
.jdemo-hud17c .jdemo-story-intro[data-day-fx="2"] .jdemo-story-fx__glow {
  opacity: 1;
  background:
    radial-gradient(ellipse 36% 40% at 28% 62%, rgba(255, 196, 110, 0.22), transparent 70%),
    radial-gradient(ellipse 30% 28% at 62% 48%, rgba(255, 230, 160, 0.16), transparent 72%);
  animation: jdemo18i4-glow-pulse 5.2s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-story-intro[data-day-fx="2"] .jdemo-story-fx__sparkles {
  opacity: 1;
  background-image:
    radial-gradient(1.5px 1.5px at 24% 58%, rgba(255, 220, 150, 0.9), transparent),
    radial-gradient(2px 2px at 48% 44%, rgba(255, 236, 180, 0.85), transparent),
    radial-gradient(1.5px 1.5px at 66% 60%, rgba(255, 210, 130, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 38% 36%, rgba(255, 245, 200, 0.75), transparent),
    radial-gradient(2px 2px at 72% 42%, rgba(255, 220, 150, 0.7), transparent);
  animation: jdemo18i4-twinkle 4.2s ease-in-out infinite;
}

/* Day 3 — soft snow + lantern spark */
.jdemo-hud17c .jdemo-story-intro[data-day-fx="3"] .jdemo-story-fx__glow {
  opacity: 1;
  background:
    radial-gradient(ellipse 34% 30% at 46% 58%, rgba(255, 214, 140, 0.16), transparent 70%),
    radial-gradient(ellipse 26% 24% at 72% 42%, rgba(255, 236, 180, 0.12), transparent 72%);
  animation: jdemo18i4-glow-pulse 5.6s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-story-intro[data-day-fx="3"] .jdemo-story-fx__sparkles {
  opacity: 0.85;
  background-image:
    radial-gradient(1.5px 1.5px at 30% 40%, rgba(255, 236, 190, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 58% 52%, rgba(255, 220, 150, 0.75), transparent),
    radial-gradient(2px 2px at 70% 36%, rgba(255, 248, 210, 0.7), transparent);
  animation: jdemo18i4-twinkle 4.8s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-story-intro[data-day-fx="3"] .jdemo-story-fx__snow {
  opacity: 0.55;
  background-image:
    radial-gradient(2px 2px at 12% 10%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 28% 0%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(2px 2px at 46% 6%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 64% 2%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(2px 2px at 82% 8%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 20% 18%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(2px 2px at 54% 14%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 76% 20%, rgba(255, 255, 255, 0.5), transparent);
  background-size: 100% 140%;
  animation: jdemo18i4-snow 14s linear infinite;
}

@keyframes jdemo18i4-glow-pulse {
  0%, 100% { opacity: 0.72; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.08); }
}
@keyframes jdemo18i4-twinkle {
  0%, 100% { opacity: 0.45; }
  40% { opacity: 0.95; }
  70% { opacity: 0.6; }
}
@keyframes jdemo18i4-snow {
  from { transform: translateY(-8%); }
  to { transform: translateY(35%); }
}

@media (prefers-reduced-motion: reduce) {
  .jdemo-hud17c .jdemo-story-fx__glow,
  .jdemo-hud17c .jdemo-story-fx__sparkles,
  .jdemo-hud17c .jdemo-story-fx__snow {
    animation: none !important;
  }
  .jdemo-hud17c .jdemo-story-intro[data-day-fx] .jdemo-story-fx__glow {
    opacity: 0.55;
  }
  .jdemo-hud17c .jdemo-story-intro[data-day-fx] .jdemo-story-fx__sparkles,
  .jdemo-hud17c .jdemo-story-intro[data-day-fx] .jdemo-story-fx__snow {
    opacity: 0.25;
  }
}

/* Done scene: cover left plate, keep characters in frame */
.jdemo-hud17c .jdemo-day.is-done .jdemo-day-scene__day,
.jdemo-hud17c .jdemo-day.is-done #jdemoSceneImg {
  object-fit: cover;
  object-position: left center;
}

/* Done parchment: reward always visible outside scroll body */
.jdemo-hud17c .jdemo-parchment-card--done {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  gap: 6px;
}
.jdemo-hud17c .jdemo-parchment-card--done > .jdemo-done-kicker,
.jdemo-hud17c .jdemo-parchment-card--done > .jdemo-reward-hero {
  flex: 0 0 auto;
}
.jdemo-hud17c .jdemo-parchment-card--done .jdemo-parchment-card__body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.jdemo-hud17c .jdemo-parchment-card--done .jdemo-done-footer {
  flex: 0 0 auto;
  position: relative;
  background: transparent;
  border-top: 1px solid rgba(201, 162, 74, 0.28);
  padding-top: 8px;
}
.jdemo-hud17c .jdemo-reward-hero.is-reward-celebrate img {
  animation: jdemo18i4-reward-pop 0.95s ease-out both;
}
.jdemo-hud17c .jdemo-reward-hero.is-reward-celebrate .jdemo-reward-label {
  animation: jdemo18i4-reward-label 0.7s ease-out 0.2s both;
}
@keyframes jdemo18i4-reward-pop {
  from { opacity: 0; transform: scale(0.86); filter: drop-shadow(0 0 0 rgba(255, 233, 168, 0)); }
  55% { opacity: 1; transform: scale(1.06); filter: drop-shadow(0 0 22px rgba(255, 233, 168, 0.65)); }
  to { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 16px rgba(255, 233, 168, 0.45)); }
}
@keyframes jdemo18i4-reward-label {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .jdemo-hud17c .jdemo-reward-hero.is-reward-celebrate img,
  .jdemo-hud17c .jdemo-reward-hero.is-reward-celebrate .jdemo-reward-label {
    animation: none;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c .jdemo-parchment-card--done {
    gap: 4px;
    padding: 8px 8px 7px;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-done-kicker {
    margin: 0;
    font-size: clamp(0.72rem, 2vh, 0.9rem);
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-reward-hero {
    margin: 0 auto 2px;
    gap: 2px;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-reward-hero img,
  .jdemo-hud17c .jdemo-parchment-card--done .jv2-reward img {
    width: clamp(64px, 14vh, 96px) !important;
    max-width: 96px !important;
    padding: 4px;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-reward-label {
    font-size: clamp(0.78rem, 2.1vh, 0.95rem);
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-parchment-card__body {
    max-height: none;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-done-text {
    font-size: clamp(0.78rem, 2vh, 0.92rem);
    line-height: 1.3;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-done-footer {
    padding: 6px 0 0;
    gap: 6px;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-done-actions {
    gap: 6px;
  }
  .jdemo-hud17c .jdemo-parchment-card--done .jdemo-gold-btn {
    min-height: 40px;
    padding: 6px 10px;
    font-size: clamp(0.72rem, 1.9vh, 0.86rem);
  }
}

/* ===== ETAPA 18J.2 — fullscreen entry gate ===== */
.jdemo-hud17c .jdemo-view--fs-gate {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  background: #07101f;
}
.jdemo-hud17c .jdemo-view--fs-gate[hidden] {
  display: none !important;
}
.jdemo-hud17c .jdemo-fs-gate {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jdemo-hud17c .jdemo-fs-gate__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-fs-gate__panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 440px);
  margin-left: min(18vw, 120px);
  padding: 18px 18px 16px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(180deg, rgba(250, 243, 223, 0.95), rgba(236, 218, 170, 0.92));
  border: 2px solid rgba(201, 162, 74, 0.7);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 214, 120, 0.2);
}
.jdemo-hud17c .jdemo-fs-gate__title {
  margin: 0 0 8px;
  font-family: var(--jdemo-font-display);
  font-size: clamp(1.15rem, 3.2vw, 1.65rem);
  font-weight: 700;
  color: #5c3a0e;
  line-height: 1.2;
}
.jdemo-hud17c .jdemo-fs-gate__text {
  margin: 0 0 14px;
  font-family: var(--jdemo-font-body);
  font-size: clamp(0.88rem, 2vw, 1.05rem);
  line-height: 1.4;
  color: rgba(42, 28, 14, 0.9);
}
.jdemo-hud17c .jdemo-fs-gate__go {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.jdemo-hud17c .jdemo-fs-gate__go-icon {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
  position: relative;
  flex: 0 0 auto;
}
.jdemo-hud17c .jdemo-fs-gate__go-icon::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  opacity: 0.85;
}
.jdemo-hud17c .jdemo-fs-gate__skip {
  margin-top: 10px;
  background: transparent;
  border: 0;
  color: rgba(60, 40, 16, 0.78);
  font-family: var(--jdemo-font-body);
  font-size: clamp(0.8rem, 1.7vw, 0.92rem);
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
  padding: 6px 8px;
}
@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c .jdemo-fs-gate__panel {
    width: min(56vw, 420px);
    margin-left: min(12vw, 80px);
    padding: 12px 14px 10px;
  }
  .jdemo-hud17c .jdemo-fs-gate__title {
    font-size: clamp(1rem, 3.4vh, 1.35rem);
  }
  .jdemo-hud17c .jdemo-fs-gate__text {
    font-size: clamp(0.78rem, 2.4vh, 0.95rem);
    margin-bottom: 10px;
  }
}

/* ===== ETAPA 18J / 18J.2 — film intro (16:9 stage) ===== */
.jdemo-hud17c .jdemo-view--film-intro {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: #07101f;
}
.jdemo-hud17c .jdemo-view--film-intro[hidden] {
  display: none !important;
}
.jdemo-hud17c .jdemo-film-intro {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.45s ease;
  background: #07101f;
}
.jdemo-hud17c .jdemo-film-intro.is-fading {
  opacity: 0;
}
/* True 16:9 film plane — overlays are relative to this box, not the letterbox */
.jdemo-hud17c .jdemo-film-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc(100dvh * 16 / 9));
  max-width: 100%;
  max-height: 100%;
  height: auto;
  overflow: hidden;
  background: #07101f;
  flex: 0 1 auto;
}
.jdemo-hud17c .jdemo-film-intro__video,
.jdemo-hud17c .jdemo-film-intro__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #07101f;
}
.jdemo-hud17c .jdemo-film-intro__poster[hidden] {
  display: none !important;
}
.jdemo-hud17c .jdemo-film-intro__titles {
  position: absolute;
  left: 52%;
  right: 4%;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 44%;
  margin: 0;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  filter: drop-shadow(0 0 0 rgba(255, 214, 120, 0));
}
/* Title animates only after real playback starts */
.jdemo-hud17c .jdemo-film-intro.is-playing .jdemo-film-intro__titles {
  animation: jdemo18j1-title-in 1.15s ease-out 1s forwards;
}
.jdemo-hud17c .jdemo-film-intro.is-fallback .jdemo-film-intro__titles,
.jdemo-hud17c .jdemo-film-intro.is-title-ready .jdemo-film-intro__titles {
  animation: none;
  opacity: 1;
  transform: translateY(-50%) scale(1);
  filter: drop-shadow(0 0 14px rgba(255, 214, 120, 0.28));
}
.jdemo-hud17c .jdemo-film-intro__title-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: 38%;
  object-fit: contain;
  object-position: center center;
  filter: drop-shadow(0 0 18px rgba(255, 214, 120, 0.35));
}
.jdemo-hud17c .jdemo-film-intro__actions {
  position: absolute;
  right: 3.5%;
  bottom: 4%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.jdemo-hud17c .jdemo-film-intro__skip {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(230, 195, 106, 0.45);
  background: rgba(7, 16, 31, 0.55);
  color: rgba(255, 233, 168, 0.92);
  font-family: var(--jdemo-font-body);
  font-size: clamp(0.78rem, 1.6vw, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.jdemo-hud17c .jdemo-film-intro__skip:hover,
.jdemo-hud17c .jdemo-film-intro__skip:focus-visible {
  background: rgba(11, 26, 51, 0.72);
  border-color: rgba(255, 233, 168, 0.7);
  outline: none;
}
.jdemo-hud17c .jdemo-film-intro__skip[hidden],
.jdemo-hud17c .jdemo-film-intro__start[hidden] {
  display: none !important;
}
.jdemo-hud17c .jdemo-film-intro__start {
  min-height: 48px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}
@keyframes jdemo18j1-title-in {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.96);
    filter: drop-shadow(0 0 0 rgba(255, 214, 120, 0));
  }
  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    filter: drop-shadow(0 0 16px rgba(255, 214, 120, 0.32));
  }
}
@media (prefers-reduced-motion: reduce) {
  .jdemo-hud17c .jdemo-film-intro.is-playing .jdemo-film-intro__titles,
  .jdemo-hud17c .jdemo-film-intro__titles {
    animation: none !important;
    opacity: 1;
    transform: translateY(-50%) scale(1);
    filter: drop-shadow(0 0 12px rgba(255, 214, 120, 0.25));
  }
  .jdemo-hud17c .jdemo-film-intro {
    transition: none;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c .jdemo-film-intro__titles {
    left: 50%;
    right: 3%;
    max-width: 46%;
  }
  .jdemo-hud17c .jdemo-film-intro__title-art {
    max-height: 46%;
  }
  .jdemo-hud17c .jdemo-film-intro__skip {
    font-size: 0.78rem;
    padding: 7px 12px;
  }
}

/* ===== ETAPA 18K — festive finale ===== */
.jdemo-hud17c:has(#jdemoFinale:not([hidden])) .jdemo-stage.jv2-stage,
.jdemo-hud17c .jdemo-app.is-finale .jdemo-stage.jv2-stage {
  grid-template-rows: 1fr;
}
.jdemo-hud17c:has(#jdemoFinale:not([hidden])) .jdemo-gameheader.jv2-topbar,
.jdemo-hud17c .jdemo-app.is-finale .jdemo-gameheader.jv2-topbar {
  display: none !important;
}
.jdemo-hud17c:has(#jdemoFinale:not([hidden])) .jdemo-main.jv2-main,
.jdemo-hud17c .jdemo-app.is-finale .jdemo-main.jv2-main {
  min-height: 100%;
  height: 100%;
}

.jdemo-hud17c .jdemo-finale {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  text-align: center;
  background: #07101f;
}
.jdemo-hud17c .jdemo-finale[hidden] {
  display: none !important;
}
.jdemo-hud17c .jdemo-finale-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #07101f;
}
.jdemo-hud17c .jdemo-finale__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
}
.jdemo-hud17c .jdemo-finale__fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.jdemo-hud17c .jdemo-finale__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 42% 48% at 50% 46%, rgba(255, 233, 168, 0.18), transparent 70%),
    radial-gradient(ellipse 28% 30% at 50% 58%, rgba(255, 214, 120, 0.1), transparent 72%);
  animation: jdemo18k-glow 5.5s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-finale__sparkles {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 18%, rgba(255, 248, 210, 0.85), transparent),
    radial-gradient(2px 2px at 78% 22%, rgba(255, 233, 168, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 42% 12%, rgba(255, 250, 220, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 62% 16%, rgba(255, 220, 140, 0.7), transparent),
    radial-gradient(2px 2px at 88% 40%, rgba(255, 248, 210, 0.65), transparent);
  animation: jdemo18k-twinkle 4.2s ease-in-out infinite;
}
.jdemo-hud17c .jdemo-finale__mute {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  z-index: 4;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(230, 195, 106, 0.45);
  background: rgba(7, 16, 31, 0.55);
  color: rgba(255, 233, 168, 0.95);
  font-family: var(--jdemo-font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.jdemo-hud17c .jdemo-finale__mute.is-muted {
  opacity: 0.85;
}
.jdemo-hud17c .jdemo-finale__panel {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(42vw, 520px);
  max-width: calc(100% - 28px);
  max-height: min(86vh, 640px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: clamp(14px, 2.2vw, 22px) clamp(14px, 2.4vw, 26px) clamp(12px, 1.8vw, 18px);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(250, 243, 223, 0.96) 0%, rgba(240, 224, 184, 0.94) 100%);
  border: 2px solid rgba(201, 162, 74, 0.72);
  box-shadow:
    0 0 0 1px rgba(255, 233, 168, 0.35),
    0 16px 36px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(255, 214, 120, 0.22);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.jdemo-hud17c .jdemo-finale__title {
  margin: 0;
  font-family: var(--jdemo-font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  line-height: 1.2;
  color: #5c3a0e;
}
.jdemo-hud17c .jdemo-finale__text {
  margin: 0;
  font-family: var(--jdemo-font-body);
  font-size: clamp(0.88rem, 1.55vw, 1.05rem);
  line-height: 1.4;
  color: rgba(42, 28, 14, 0.9);
  max-width: 36em;
}
.jdemo-hud17c .jdemo-finale__rewards {
  list-style: none;
  margin: 4px 0 2px;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 18px);
  width: 100%;
}
.jdemo-hud17c .jdemo-finale__reward {
  flex: 1 1 0;
  min-width: 0;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.jdemo-hud17c .jdemo-finale__reward img {
  width: clamp(56px, 9vw, 96px);
  height: auto;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle at 50% 40%, #1a3358 0%, #0b1a33 72%);
  box-shadow: 0 0 0 2px rgba(230, 195, 106, 0.75);
}
.jdemo-hud17c .jdemo-finale__reward span {
  font-family: var(--jdemo-font-display);
  font-size: clamp(0.68rem, 1.2vw, 0.82rem);
  font-weight: 700;
  color: #5c3a0e;
  line-height: 1.2;
}
.jdemo-hud17c .jdemo-finale__reward.is-locked {
  opacity: 0.42;
  filter: grayscale(0.85);
}
.jdemo-hud17c .jdemo-finale__reward.is-locked span::after {
  content: none;
}
.jdemo-hud17c .jdemo-finale__reward.is-earned img {
  filter: drop-shadow(0 0 10px rgba(255, 233, 168, 0.45));
}
.jdemo-hud17c .jdemo-finale__cta {
  margin-top: 4px;
  min-height: 48px;
  padding: 10px 18px;
  text-decoration: none;
  width: auto;
  max-width: 100%;
}
.jdemo-hud17c .jdemo-finale__price {
  margin: 0;
  font-size: clamp(0.78rem, 1.3vw, 0.92rem);
  font-weight: 600;
  color: rgba(92, 58, 14, 0.82);
}
.jdemo-hud17c .jdemo-finale__replay {
  min-height: 44px;
}
/* ETAPA 18K.1 — secondary listen CTA; sales CTA stays dominant */
.jdemo-hud17c .jdemo-finale__listen {
  min-height: 40px;
  padding: 6px 14px;
  font-size: clamp(0.72rem, 1.2vw, 0.86rem);
  opacity: 0.92;
}
@keyframes jdemo18k-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@keyframes jdemo18k-twinkle {
  0%, 100% { opacity: 0.4; }
  45% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .jdemo-hud17c .jdemo-finale__glow,
  .jdemo-hud17c .jdemo-finale__sparkles {
    animation: none;
    opacity: 0.55;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .jdemo-hud17c .jdemo-finale__panel {
    top: 50%;
    width: min(58vw, 560px);
    max-height: calc(100vh - 16px);
    gap: 6px;
    padding: 10px 12px 8px;
    border-radius: 14px;
  }
  .jdemo-hud17c .jdemo-finale__title {
    font-size: clamp(0.95rem, 3.2vh, 1.25rem);
  }
  .jdemo-hud17c .jdemo-finale__text {
    font-size: clamp(0.75rem, 2.4vh, 0.9rem);
    line-height: 1.3;
  }
  .jdemo-hud17c .jdemo-finale__rewards {
    gap: 8px;
  }
  .jdemo-hud17c .jdemo-finale__reward img {
    width: clamp(40px, 10vh, 64px);
    padding: 3px;
  }
  .jdemo-hud17c .jdemo-finale__reward span {
    font-size: clamp(0.62rem, 2vh, 0.72rem);
  }
  .jdemo-hud17c .jdemo-finale__cta {
    min-height: 42px;
    padding: 8px 14px;
    font-size: clamp(0.78rem, 2.2vh, 0.92rem);
  }
  .jdemo-hud17c .jdemo-finale__price {
    font-size: clamp(0.68rem, 2vh, 0.8rem);
  }
  .jdemo-hud17c .jdemo-finale__replay {
    min-height: 40px;
    font-size: clamp(0.72rem, 2vh, 0.86rem);
  }
  .jdemo-hud17c .jdemo-finale__listen {
    min-height: 36px;
    padding: 4px 12px;
    font-size: clamp(0.68rem, 2vh, 0.8rem);
  }
  .jdemo-hud17c .jdemo-finale__mute {
    top: 6px;
    right: 6px;
    padding: 6px 10px;
    font-size: 0.74rem;
  }
  .jdemo-hud17c .jdemo-finale__bg {
    object-fit: cover;
    object-position: center 42%;
  }
}
@media (min-width: 1100px) and (min-height: 640px) {
  .jdemo-hud17c .jdemo-finale__panel {
    width: min(40vw, 560px);
    padding: 24px 28px 20px;
    gap: 12px;
  }
  .jdemo-hud17c .jdemo-finale__reward img {
    width: clamp(72px, 7vw, 110px);
  }
}
