/* First-play intro (ui/intro.js, ui/introview.js). #intro = the stage (under pop-ups, z 25), #intro-ui = skip button and the cat (over pop-ups, z 35). */
#intro { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(#F6C9A8, #E3A878); }
#intro [hidden], #intro-ui [hidden] { display: none; }
.intro-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.intro-frame { padding: 8px; background: var(--wood); border-radius: 12px; border: 3px solid var(--wood-d); box-shadow: inset 2px 2px 0 var(--wood-l), 0 6px 18px rgba(74,52,101,.3); }
.intro-ring { position: absolute; border: 3px solid #FFE08A; border-radius: 8px; box-shadow: 0 0 12px #FFE08A; pointer-events: none; z-index: 5; animation: coach-ring 1s infinite; }
.intro-wig { position: absolute; border: 3px solid #FF6FA0; border-radius: 8px; box-shadow: 0 0 12px #FF6FA0; pointer-events: none; z-index: 5; animation: intro-wig .3s infinite; }
@keyframes intro-wig { 0%, 100% { transform: rotate(-7deg) scale(1.08); } 50% { transform: rotate(7deg) scale(1.08); } }

/* the top bar: the real board HUD panel (style.css .board-hud), items pop in one by one */
.intro-hud { flex-wrap: wrap; justify-content: center; gap: 10px 24px; }
.intro-item { position: relative; }
.intro-item .ic { display: flex; }
.intro-hud .moves { min-width: 60px; }
.intro-item.pop { animation: intro-pop .45s; }
@keyframes intro-pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
.intro-item.gain { animation: intro-gain .8s; }
@keyframes intro-gain { 30% { transform: scale(1.3); filter: drop-shadow(0 0 8px #FFE08A) brightness(1.25); } }
.intro-float { position: absolute; left: 50%; top: 0; pointer-events: none; font-weight: 800; font-size: 22px; color: #2F6B3A; -webkit-text-stroke: .5px #FFF4E2; text-shadow: 0 2px 0 rgba(92,66,40,.35); animation: intro-float 1.3s ease-out forwards; z-index: 10; }
@keyframes intro-float { 0% { opacity: 0; transform: translate(-50%, 0); } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -46px); } }

#intro-ui { position: absolute; inset: 0; z-index: 35; pointer-events: none; display: flex; flex-direction: column; padding: calc(10px + var(--safe-t)) 12px 10px; gap: 8px; }
#intro-ui > * { pointer-events: auto; }
.intro-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.intro-top > * { pointer-events: auto; }
.intro-count { background: var(--cream); border: 2px solid var(--wood); border-radius: 8px; padding: 2px 10px; font-weight: 700; font-size: 14px; }
.intro-skip { min-height: 36px; padding: 2px 14px; font-size: 15px; }
.intro-cat { position: relative; display: flex; align-items: flex-end; gap: 10px; }
.intro-catbox { display: flex; align-items: flex-end; gap: 8px; flex: none; }
.intro-pet { position: relative; width: 96px; height: 96px; flex: none; animation: intro-bob 1.6s steps(2) infinite; } /* 2x of the 48 px sprite on a phone, 3x on desktop */
.intro-pet img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.intro-pet .cat2 { animation: intro-blink 3.6s steps(1) infinite; opacity: 0; } /* the optional blink frame shows for a moment */
@keyframes intro-blink { 0%, 94% { opacity: 0; } 95%, 100% { opacity: 1; } }
@keyframes intro-bob { 50% { transform: translateY(-4px); } }
.intro-book { width: 96px; height: 96px; image-rendering: pixelated; animation: intro-float-book 2s steps(4) infinite; }
@keyframes intro-float-book { 50% { transform: translateY(-8px); } }
.intro-bubble { position: relative; flex: 1; max-width: 420px; background: #FFF8EC; border: 3px solid var(--wood); border-radius: 12px; padding: 10px 12px; font-size: 15px; box-shadow: 0 3px 0 var(--wood-d); }
.intro-bubble p { margin: 0; line-height: 1.35; }
.intro-bubble::before { content: ''; position: absolute; left: -11px; bottom: 16px; border: 8px solid transparent; border-right-color: var(--wood); border-left: 0; } /* the tail points at the cat */
.intro-bar { display: flex; justify-content: flex-end; margin-top: 8px; } .intro-bar:empty { display: none; }
.intro-bar .wood-btn { min-height: 34px; padding: 2px 14px; font-size: 15px; }
#intro-ui.solo { justify-content: center; align-items: center; } #intro-ui.solo .intro-top { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); }
#intro-ui.solo .intro-cat { max-width: 520px; }
#intro.solo { justify-content: flex-end; padding-bottom: 14vh; } /* no board: the bar sits low, the cat above it */
#intro-ui.solo { padding-bottom: 28vh; }

/* desktop: the cat and the board sit together in the middle, the cat panel at the left of the board */
@media (min-width: 761px) and (min-aspect-ratio: 1/1) {
  #intro { align-items: flex-start; padding-left: var(--board-left, 400px); }
  #intro.solo { align-items: center; padding-left: 16px; }
  #intro-ui:not(.solo) { justify-content: center; padding-left: var(--cat-left, 24px); }
  #intro-ui:not(.solo) .intro-cat { flex-direction: column; align-items: center; width: 340px; margin-top: 40px; }
  #intro-ui:not(.solo) .intro-top { position: absolute; left: 24px; right: 24px; top: calc(10px + var(--safe-t)); }
  .intro-pet, .intro-book { width: 144px; height: 144px; }
  #intro-ui:not(.solo) .intro-bubble { max-width: none; width: 100%; font-size: 16px; }
  #intro-ui:not(.solo) .intro-bubble::before { left: 50%; bottom: auto; top: -11px; margin-left: -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: var(--wood); }
}
/* phone: the board at the bottom, the bar on it, the cat bubble right above the bar */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  #intro { justify-content: flex-end; padding: 8px 8px calc(10px + var(--safe-b)); }
  #intro.solo { padding-bottom: 14vh; }
  #intro-ui:not(.solo):not(.compact) { justify-content: flex-end; padding-bottom: calc(var(--stage-h, 400px) + 22px + var(--safe-b)); }
  #intro-ui:not(.solo) .intro-top { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); }
  #intro-ui:not(.solo):not(.compact):not(.booked) .intro-cat { align-self: center; max-width: 100%; } /* a wide, tall window: the cat and the bubble sit in the middle, over the board */
  /* the Books step: the book (4x of 48 px) floats in the middle, the cat head and the bubble sit in one row under it */
  #intro-ui.booked { padding-bottom: 12px; }
  #intro-ui.booked .intro-cat { display: grid; grid-template-columns: auto 1fr; align-items: end; justify-items: stretch; }
  #intro-ui.booked .intro-catbox { display: contents; }
  #intro-ui.booked .intro-book { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: 192px; height: 192px; }
  #intro-ui.booked .intro-pet { grid-row: 2; }
  #intro-ui.booked .intro-bubble { grid-row: 2; }
}

body.intro-on .modal-back { padding-top: 112px; } /* pop-ups start under the cat's one-line strip */
/* a pop-up (the Books screen) is open: the cat shrinks to one strip and sits on the pop-up's top edge (ui/introview.js perch sets --perch) */
#intro-ui.compact .intro-top { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); }
#intro-ui.compact .intro-cat { position: absolute; left: 12px; right: 12px; bottom: calc(var(--perch, 0px) + 6px); max-width: none; align-items: center; }
#intro-ui.compact .intro-pet { width: 48px; height: 48px; } /* 1x of the 48 px head */
#intro-ui.compact .intro-book { display: none; }
#intro-ui.compact .intro-bubble { padding: 6px 10px; font-size: 14px; }
#intro-ui.compact .intro-bar { display: none; }
@media (min-width: 761px) and (min-aspect-ratio: 1/1) {
  body.intro-on .modal-back { padding-top: 80px; }
  #intro-ui.compact .intro-top { left: 24px; right: 24px; }
  #intro-ui.compact .intro-cat { left: 50%; right: auto; transform: translateX(-50%); flex-direction: row; width: min(640px, calc(100% - 24px)); margin: 0; }
  #intro-ui.compact .intro-bubble::before { left: -11px; top: auto; bottom: 14px; margin: 0; border: 8px solid transparent; border-right-color: var(--wood); border-left: 0; }
}
