/* ============================================================================
   TUTORIAL COMPLETE flow (tutorial-complete.js). Needs styles.css (.tut-bubble, .ui-btn,
   .ref-share), deckbox.css and characters/larry/larry.css.
   ============================================================================ */
/* in the game: the flow's full-screen host, over everything (the duel, its HUD, the menus) */
.tcf-host { position: fixed; inset: 0; z-index: 3000; }
.tcf-root {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse 80% 70% at 60% 45%, rgba(40, 62, 110, 0.55), rgba(6, 10, 22, 0.96) 70%), #070b16;
  opacity: 0; transition: opacity .45s ease;
  font-family: var(--font-ui, "Space Grotesk", system-ui, sans-serif);
}
.tcf-root.is-in { opacity: 1; }

/* LARRY — same size as in the tutorial (styles.css: --larry-width), bottom-left, walks in */
.tcf-larry {
  position: absolute; left: clamp(4px, 1.5vw, 28px); bottom: -3%; width: clamp(250px, 26vw, 420px);
  transform: translateX(-130%); transition: transform .7s cubic-bezier(.2, .9, .3, 1.15);
  z-index: 3; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.55));
}
.tcf-larry.is-in { transform: none; }
.tcf-larry-host { width: 100%; }

/* speech bubble (the game's .tut-bubble) ABOVE his head, tail pointing down at him — the same
   arrangement as the tutorial's narrator. JS places it (left / bottom / --tail-x). */
.tcf-bubble.tut-bubble {
  position: absolute; width: min(440px, 34vw); z-index: 4; margin-bottom: 14px;
  opacity: 0; transform: translateY(8px) scale(.96); transform-origin: var(--tail-x, 40px) 100%;
  transition: opacity .22s ease, transform .22s ease; animation: none; pointer-events: none;
}
.tcf-bubble.tut-bubble.is-on { opacity: 1; transform: none; }
.tcf-bubble.tut-bubble::before, .tcf-bubble.tut-bubble::after { top: auto; }
.tcf-bubble.tut-bubble::before {
  left: calc(var(--tail-x, 40px) - 14px); bottom: -14px;
  border-width: 14px 14px 0 14px; border-right-color: transparent; border-left-color: transparent;
  border-top-color: var(--bubble-line, #f5c14a);
}
.tcf-bubble.tut-bubble::after {
  left: calc(var(--tail-x, 40px) - 12px); bottom: -11px;
  border-width: 12px 12px 0 12px; border-right-color: transparent; border-left-color: transparent;
  border-top-color: rgba(17, 23, 40, 0.98);
}
.tcf-bubble .tut-bubble-name { display: block; margin-bottom: 6px; }
.tcf-bubble-text { font-size: clamp(14px, 1.15vw, 18px); line-height: 1.45; font-weight: 600; }
.tcf-bubble-text .said { color: #fff; }
.tcf-bubble-text .rest { color: rgba(255, 255, 255, 0.28); }

/* the stage right of Larry: dealt cards, then the box */
.tcf-stage { position: absolute; left: 30%; right: 3%; top: 16%; bottom: 7%; z-index: 2;
  transition: transform .8s cubic-bezier(.2, .9, .3, 1.05); }
.tcf-card { position: absolute; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)); will-change: transform; }
.tcf-card-in, .tcf-card-in .card { width: 100%; }
.tcf-box { position: absolute; z-index: 1; }
/* the packed box glows yellow along its outline, PERMANENTLY. The filter sits on this host, OUTSIDE the
   3D scene (a filter on a preserve-3d node would flatten the box); drop-shadow follows its silhouette. */
.tcf-box.is-glowing { animation: tcfBoxGlow .9s ease-out forwards; }
@keyframes tcfBoxGlow {
  from { filter: drop-shadow(0 0 0 rgba(255, 214, 102, 0)); }
  to { filter: drop-shadow(0 0 6px rgba(255, 214, 102, 0.85)) drop-shadow(0 0 18px rgba(245, 193, 74, 0.45)); }
}   /* under the stage: the rising cards fly OVER the pile */
/* (the box is placed on the LEFT of the stage from the start: see boxRect in the JS) */

/* STARTER DECK / COMPLETED */
/* placed by JS right above the packed box (left = its centre); `translate` centres it without
   touching `transform`, which the pop-in animation owns */
.tcf-title {
  position: absolute; left: 47%; top: 3%; translate: -50% 0; width: max-content; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; line-height: 0.95; text-align: center;
  opacity: 0; transform: scale(0.4);
}
.tcf-title.is-on { animation: tcfTitleIn .7s cubic-bezier(.2, 1.4, .3, 1) forwards; }
.tcf-title span, .tcf-title b {
  font-family: var(--font-display, "Bowlby One"), system-ui, sans-serif; font-weight: 400; letter-spacing: 0.03em;
  -webkit-text-stroke: 2.5px #0a1428; paint-order: stroke fill; text-shadow: 0 4px 0 #0a1428, 0 10px 22px rgba(0, 0, 0, 0.6);
}
.tcf-title span { font-size: clamp(17px, 2vw, 30px); color: #fff3d0; }
.tcf-title b {
  font-size: clamp(26px, 3.4vw, 52px);
  background: linear-gradient(180deg, #fff6c8 0%, #fde68a 35%, #f5c14a 70%, #d9961c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #0a1428) drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55));
  -webkit-text-stroke: 0; text-shadow: none;
}
@keyframes tcfTitleIn {
  0% { opacity: 0; transform: scale(0.4) rotate(-4deg); }
  60% { opacity: 1; transform: scale(1.08) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.tcf-spark { position: absolute; z-index: 8; pointer-events: none; }

/* ---------------- QUICK DUEL: locked → charging → unlocked ----------------
   A WIDE button like the DUEL lobby's modes: icon | name + state | padlock. The padlock has its
   own slot on the right (it covers nothing) and, once it flies off, the lobby's ▶ is there. */
/* QUICK DUEL + share: one column, its middle on the box's centre line (BOX_LINE = 56 %) */
.tcf-side {
  position: absolute; left: 63%; top: 56%; transform: translateY(-50%); width: clamp(320px, 30vw, 460px); z-index: 5;
  display: flex; flex-direction: column; align-items: stretch; gap: 22px;
}
.tcf-qd { position: relative; opacity: 0; transform: scale(0.5); pointer-events: none; }
.tcf-qd.is-on { animation: tcfPopIn .5s cubic-bezier(.2, 1.4, .3, 1) forwards; }
@keyframes tcfPopIn { 0% { opacity: 0; transform: scale(0.5); } 70% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
.tcf-qd-card {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: clamp(12px, 1.2vw, 18px);
  padding: clamp(12px, 1.2vw, 18px) clamp(16px, 1.5vw, 22px); border-radius: 20px;
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.95), rgba(12, 21, 39, 0.97));
  border: 3px solid var(--gv-ink, #070f1d); transform-origin: 50% 90%;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.13), inset 0 -8px 0 rgba(0, 0, 0, 0.34), 0 14px 30px rgba(0, 0, 0, 0.5);
  transition: box-shadow .3s ease, border-color .3s ease;
}
.tcf-qd-icon { width: clamp(58px, 5.4vw, 84px); height: auto; flex: none; filter: drop-shadow(0 5px 0 rgba(3, 7, 15, 0.5)); transition: filter .4s ease; }
.tcf-qd-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tcf-qd-name {
  font-family: var(--font-display, "Bowlby One"); font-weight: 400; font-size: clamp(22px, 1.9vw, 30px); line-height: 1; color: var(--gold-bright, #fde68a);
  -webkit-text-stroke: 2px #0a1428; paint-order: stroke fill; text-shadow: 0 3px 0 #0a1428; transition: color .4s ease; white-space: nowrap;
}
.tcf-qd-state {
  font-weight: 800; font-size: 12px; letter-spacing: 0.16em; padding: 4px 12px; border-radius: 999px;
  color: #c3cde6; background: rgba(0, 0, 0, 0.35);
}
/* the padlock's own slot, right end */
.tcf-qd-lock { position: relative; flex: none; width: clamp(44px, 3.8vw, 58px); aspect-ratio: 64 / 80; }
.tcf-lock { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 5px 0 rgba(3, 7, 15, 0.55)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45)); }
.tcf-lock-shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .25s cubic-bezier(.2, 1.6, .4, 1); }
.tcf-qd-go {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: scale(.4);
  font-size: clamp(26px, 2.2vw, 34px); color: var(--gold-bright, #fde68a); text-shadow: 0 3px 0 #0a1428;
}
.tcf-qd-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
/* LOCKED: grey and dim */
.tcf-qd.is-locked .tcf-qd-icon { filter: grayscale(1) brightness(0.55); }
.tcf-qd.is-locked .tcf-qd-name { color: #7d879c; }
/* CHARGING: a SIDEWAYS shake that grows (the chest's, symmetric) while a gold glow builds */
.tcf-qd.is-charging .tcf-qd-card { animation: tcfShake 1.5s ease-in-out forwards, tcfGlow 1.5s ease-in forwards; }
.tcf-qd.is-charging .tcf-lock { animation: tcfLockHeat 1.5s ease-in forwards; }
@keyframes tcfShake {
  0%   { transform: translateX(0); }
  9%   { transform: translateX(-2px); }  18% { transform: translateX(2px); }
  27%  { transform: translateX(-3px); }  36% { transform: translateX(3px); }
  45%  { transform: translateX(-4px); }  54% { transform: translateX(4px); }
  63%  { transform: translateX(-5px); }  72% { transform: translateX(5px); }
  81%  { transform: translateX(-6px); }  90% { transform: translateX(6px); }
  100% { transform: translateX(0); }
}
@keyframes tcfGlow {
  0% { box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.13), inset 0 -8px 0 rgba(0, 0, 0, 0.34), 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 0 rgba(245, 193, 74, 0); border-color: #070f1d; }
  100% { box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.2), inset 0 -8px 0 rgba(0, 0, 0, 0.34), 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 46px rgba(245, 193, 74, 0.95); border-color: #f5c14a; }
}
@keyframes tcfLockHeat { 0% { filter: drop-shadow(0 5px 0 rgba(3, 7, 15, 0.55)); } 100% { filter: drop-shadow(0 0 14px #ffe08a) brightness(1.35); } }
/* UNLOCKED: flash + the CHEST's pop (stretch up, squash, settle), the shackle springs, the
   padlock flies off and the ▶ takes its slot, colour comes in */
.tcf-qd.is-unlocked .tcf-qd-card {
  border-color: #f5c14a; animation: tcfUnlockPop .6s cubic-bezier(0.2, 1.4, 0.35, 1);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.2), inset 0 -8px 0 rgba(0, 0, 0, 0.34), 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(245, 193, 74, 0.55);
}
@keyframes tcfUnlockPop {
  0%   { transform: scale(1, 1) translateY(0); }
  22%  { transform: scale(0.95, 1.1) translateY(-10px); }
  44%  { transform: scale(1.07, 0.94) translateY(2px); }
  64%  { transform: scale(0.99, 1.03) translateY(-3px); }
  82%  { transform: scale(1.02, 0.99) translateY(0); }
  100% { transform: scale(1, 1) translateY(0); }
}
.tcf-qd.is-unlocked .tcf-qd-flash { animation: tcfFlash .5s ease-out; }
@keyframes tcfFlash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.tcf-qd.is-unlocked .tcf-lock-shackle { transform: translateY(-14%) rotate(24deg); }
.tcf-qd.is-unlocked .tcf-lock { animation: tcfLockOff .6s .1s cubic-bezier(.3, 0, .6, 1) forwards; }
@keyframes tcfLockOff {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  35% { transform: translateY(-40%) scale(1.12) rotate(-10deg); opacity: 1; }
  100% { transform: translateY(-110%) scale(0.5) rotate(20deg); opacity: 0; }
}
.tcf-qd.is-unlocked .tcf-qd-go { animation: tcfGoIn .4s .45s cubic-bezier(.2, 1.5, .3, 1) forwards; }
@keyframes tcfGoIn { to { opacity: 1; transform: scale(1); } }
/* "UNLOCKED!" — gold chip, no outline */
.tcf-qd.is-unlocked .tcf-qd-state { color: #1a1206; background: var(--gold, #f5c14a); }

/* ---------------- share (under QUICK DUEL) + continue (bottom centre) ---------------- */
.tcf-share-box {
  /* its room is reserved from the start, so the column doesn't re-centre when it fills */
  min-height: 78px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.tcf-share-box.is-on { opacity: 1; pointer-events: auto; }
.tcf-share-title { font-weight: 700; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #c3cde6; }
.tcf-share-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
/* the WRAPPER centres and enters; the button keeps its own (hover) transform untouched */
.tcf-continue-wrap {
  position: absolute; left: 0; right: 0; bottom: clamp(18px, 4.5vh, 44px); z-index: 6;
  display: flex; justify-content: center; padding-left: 20%; pointer-events: none;
  opacity: 0; transform: translateY(20px); transition: opacity .35s ease, transform .35s cubic-bezier(.2, 1.4, .3, 1);
}
.tcf-continue-wrap.is-on { opacity: 1; transform: none; }
.tcf-continue-wrap.is-on .tcf-continue { pointer-events: auto; }
.tcf-continue { min-width: 230px; }
