:root {
  --cream: #FFF6E5;
  --cream-2: #FFFDF8;
  --ink: #3D2C1E;
  --ink-soft: #6A5340;
  --sky: #7EC8E3;
  --sky-deep: #5B9BD5;
  --gold: #FFE08A;
  --orange: #FFB347;
  --coral: #FF8A6B;
  --pink: #FFB3C7;
  --green: #8FCB6B;
  --mint: #B8E0D2;
  --lavender: #C9B6E4;
  --navy: #2C3E6B;
  --shadow: 0 10px 24px rgba(61, 44, 30, 0.14);
  --radius: 22px;
  --font-display: "Fredoka", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  --font-ui: "Nunito", "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink);
  font-family: var(--font-ui); font-weight: 700; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }
img { max-width: 100%; display: block; }

.screen { display: none; min-height: 100dvh; padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) calc(20px + var(--safe-b)) calc(14px + var(--safe-l)); }
.screen.on { display: flex; flex-direction: column; gap: 10px; }

/* Home */
#home { align-items: center; text-align: center; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #B8E8F5 0%, #E8F8FF 28%, var(--cream) 60%, #FFE8C8 100%); }
.home-sky { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 15% 12%, #fff 0 18px, transparent 19px),
    radial-gradient(circle at 20% 14%, #fff 0 12px, transparent 13px),
    radial-gradient(circle at 82% 10%, #fff 0 22px, transparent 23px),
    radial-gradient(circle at 88% 13%, #fff 0 14px, transparent 15px); }
.logo { position: relative; margin: 18px 0 8px; }
.logo-mark { display: block; font-size: 42px; animation: bob 2.8s ease-in-out infinite; }
.logo-title { display: block; font-family: var(--font-display); font-size: clamp(34px, 9vw, 56px);
  font-weight: 700; letter-spacing: 0.01em; color: var(--navy); text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(91,155,213,0.25); }
.logo-sub { display: block; margin-top: 6px; font-size: clamp(15px, 4vw, 20px); color: var(--ink-soft); }
.lang-picks { display: flex; gap: 8px; width: min(520px, 100%); position: relative; }
.lang-btn { flex: 1; padding: 12px 8px; border-radius: 999px; background: #fff; box-shadow: var(--shadow);
  font-size: 16px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lang-btn .lang-mini { font-size: 11px; font-weight: 800; opacity: 0.7; }
.lang-btn.on { background: var(--navy); color: #fff; box-shadow: 0 6px 0 #1a2748; }
.home-btns { width: min(520px, 100%); display: flex; flex-direction: column; gap: 12px; position: relative; }
.mode-btn { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px;
  border-radius: var(--radius); box-shadow: var(--shadow); min-height: 88px; }
.mode-btn.caller-btn { background: var(--orange); }
.mode-btn.board-btn { background: var(--coral); color: #4a2014; }
.mode-ico { font-size: 36px; }
.mode-txt { display: flex; flex-direction: column; gap: 2px; }
.mode-txt strong { font-family: var(--font-display); font-size: clamp(20px, 5.4vw, 26px); }
.mode-txt small { font-size: 14px; font-weight: 700; opacity: 0.85; }
.home-preview { display: flex; gap: 8px; justify-content: center; width: min(520px, 100%); position: relative;
  margin-top: 4px; }
.home-preview .lot-card { width: 70px; flex: 0 0 auto; animation: bob 3s ease-in-out infinite; }
.home-preview .lot-card:nth-child(2) { animation-delay: 0.3s; }
.home-preview .lot-card:nth-child(3) { animation-delay: 0.6s; }
.home-preview .lot-card:nth-child(4) { animation-delay: 0.9s; }
.home-preview .lot-card .card-names { display: none; }
.site-foot { position: relative; margin-top: auto; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.site-foot a { color: var(--navy); }
.site-foot .domains { opacity: 0.7; }

/* Bars & chrome */
.bar { display: flex; align-items: center; gap: 8px; }
.bar b { flex: 1; font-family: var(--font-display); font-size: 22px; }
.icon-btn { width: 48px; height: 48px; border-radius: 16px; background: #fff; box-shadow: var(--shadow);
  font-size: 32px; line-height: 1; }
.text-btn { padding: 8px 12px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); font-size: 14px; }
.pill { background: var(--navy); color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 15px; }

/* Cards — golden scalloped frame, #badge, bilingual banner, 3D tilt */
.lot-card { --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%;
  position: relative; width: min(250px, 64vw, calc((100dvh - 260px) / 1.62)); margin: 0 auto; padding: 9px 9px 9px;
  border-radius: 26px; overflow: visible; display: flex; flex-direction: column; gap: 7px;
  background: linear-gradient(150deg, #FFE792 0%, #FFC83D 48%, #F5A623 100%);
  box-shadow: 0 12px 26px rgba(120, 72, 10, 0.28), inset 0 0 0 2px rgba(255,255,255,0.55);
  transform: perspective(800px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.18s ease-out; transform-style: preserve-3d; }
.lot-card.tilting { transition: none; }
.lot-card::before { content: ""; position: absolute; inset: 2px; border-radius: 24px; pointer-events: none;
  border: 5px dotted #FFF7CF; z-index: 4; }
.lot-card .card-art { position: relative; overflow: hidden; border-radius: 17px; aspect-ratio: 3 / 4; width: 100%;
  background: #FFF3D6; container-type: inline-size; --u: 1cqw; perspective: 700px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.8); }
.lot-card.tilting .card-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255,255,255,0.32), transparent 55%); }
.art-bg, .art-img { position: absolute; inset: 0; }
.art-bg { background: center / cover no-repeat; filter: blur(14px) saturate(1.1); transform: scale(1.3); }
.art-bg.flat { filter: none; transform: none; }
.art-img > i { position: absolute; inset: 0; background: center / cover no-repeat; }
.lot-card .card-num { position: absolute; top: 3px; left: 3px; z-index: 6; min-width: 46px; height: 46px; padding: 0 8px;
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px; color: var(--navy);
  background: linear-gradient(160deg, #FFFBE6, #FFDB6B); border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(120,72,10,0.3); transform: translateZ(14px); }
.lot-card .card-num::before { content: "#"; font-size: 0.7em; margin-right: 1px; opacity: 0.75; }
.lot-card { container-type: inline-size; }
.lot-card .card-names { position: relative; z-index: 4; background: linear-gradient(180deg, #FFFDF4, #FFF1C9);
  border: 3px solid #fff; border-radius: 15px; padding: 6px 8px 7px; text-align: center; line-height: 1.12;
  box-shadow: 0 3px 0 rgba(180,110,10,0.35); transform: translateZ(10px); }
.lot-card .nm-es, .lot-card .nm-en, .lot-card .nm-both { display: block; }
.lot-card .nm-es { font-family: var(--font-display); font-size: 24px; color: var(--navy); }
.lot-card .nm-en { font-size: 17px; color: var(--ink-soft); }
.lot-card .nm-both { display: none; font-family: var(--font-display); color: var(--navy); }
.lot-card.empty .card-art { background: linear-gradient(160deg, var(--gold), var(--sky)); display: flex;
  align-items: center; justify-content: center; }
.lot-card.empty .card-art::after { content: "🐾"; font-size: 72px; position: static; background: none; }
.lot-card.empty .card-names, .lot-card.empty .card-num { display: none; }
.lot-card.pop { animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.3, 1); }
.lot-card.sm { width: 92px; padding: 4px; border-radius: 15px; gap: 0; flex: 0 0 auto; transition: none; transform: none; }
.lot-card.sm::before { inset: 1px; border-radius: 14px; border-width: 3px; }
.lot-card.sm .card-art { border-radius: 10px; box-shadow: none; }
.lot-card.sm .card-num { min-width: 24px; height: 24px; font-size: 12px; padding: 0 4px; top: 1px; left: 1px; border-width: 2px; }
.lot-card.sm .card-names { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 2px 3px; border-width: 2px; border-radius: 8px; box-shadow: none; transform: none; }
.lot-card.sm .nm-es { font-size: 10px; }
.lot-card.sm .nm-en { font-size: 9px; }
.lot-card.sm.empty .card-art::after { font-size: 32px; }
.lang-es .nm-en { display: none !important; }
.lang-en .nm-es { display: none !important; }
.lang-en .nm-en { font-family: var(--font-display); font-size: 24px; color: var(--navy); }
.lang-en .lot-card.sm .nm-en { font-size: 10px; }
.lang-both .nm-es { font-size: 22px; }
.lang-both .nm-en { font-size: 16px; }
.lang-both .lot-card.sm .nm-es, .lang-both .lot-card.sm .nm-en, .lang-both .cell .nm-es, .lang-both .cell .nm-en { display: none; }
.lang-both .lot-card.sm .nm-both, .lang-both .cell .nm-both { display: block; font-size: 9px; }

.caller-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.phrase { min-height: 2.2em; margin: 0; text-align: center; font-size: clamp(16px, 4.4vw, 22px);
  color: var(--ink-soft); padding: 0 8px; }

.ctrls { display: flex; gap: 8px; }
.big-btn { flex: 1; background: var(--orange); border-radius: 18px; padding: 16px 12px;
  font-family: var(--font-display); font-size: 22px; box-shadow: 0 6px 0 #e39a2e; min-height: 58px; }
.mid-btn { background: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 16px; }
.ghost-btn { background: #fff; border-radius: 16px; padding: 12px; box-shadow: var(--shadow); font-size: 16px; }
.set-row { background: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { background: var(--cream); border-radius: 999px; padding: 8px 12px; font-size: 14px; min-height: 40px; }
.seg button.on { background: var(--navy); color: #fff; }
.voice-tog { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 16px; }
.history { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; }
.history .lot-card { width: 70px; flex: 0 0 auto; }
.history .lot-card.last { outline: 3px solid var(--orange); }
h3 { margin: 8px 0 0; font-family: var(--font-display); font-size: 18px; color: var(--navy); }

/* Board */
.board-screen { gap: 8px; }
.now-row { display: flex; gap: 10px; align-items: flex-start; }
.now-ctrls { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.now-mini { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seg.compact { gap: 4px; }
.seg.compact button { padding: 4px 6px; font-size: 11px; min-height: 32px; }
.token-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg.tokens button { font-size: 22px; min-width: 48px; min-height: 48px; padding: 4px; background: #fff; box-shadow: var(--shadow); }
.seg.tokens button.on { background: var(--gold); box-shadow: 0 4px 0 #e6c200; }

.tabla { flex: 1; display: grid; gap: clamp(6px, 1.2vw, 12px); min-height: 0;
  padding: 8px; background: #fff; border-radius: 20px; box-shadow: var(--shadow);
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr); }
.cell { position: relative; border-radius: 16px; overflow: hidden; border: 3px solid #FFD25E;
  background: #FFF3D6; min-height: 0; display: flex; flex-direction: column; cursor: pointer;
  aspect-ratio: auto; padding: 0; box-shadow: inset 0 0 0 2px #fff; }
.cell .card-art { position: relative; flex: 1; min-height: 0; width: 100%; aspect-ratio: auto; overflow: hidden; border-radius: 0; box-shadow: none; container-type: inline-size; --u: 1cqw; perspective: 600px; }
.cell .card-num { position: absolute; top: 3px; left: 3px; z-index: 6; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display);
  font-size: clamp(12px, 3vw, 17px); color: var(--navy); background: linear-gradient(160deg, #FFFBE6, #FFDB6B); border: 2px solid #fff; }
.cell .card-num::before { content: "#"; font-size: 0.72em; opacity: 0.75; }
.cell .card-names { position: relative; z-index: 4; margin: 0; flex: 0 0 auto;
  background: linear-gradient(180deg, #FFFDF4, #FFF1C9); padding: 3px 4px; text-align: center; line-height: 1.1; }
.cell .art-img > i { background-size: contain; }
.cell .nm-es { display: block; font-family: var(--font-display); font-size: clamp(11px, 2.8vw, 17px); color: var(--navy); }
.cell .nm-en { display: block; font-size: clamp(10px, 2.3vw, 14px); color: var(--ink-soft); }
.cell .nm-both { display: none; font-family: var(--font-display); color: var(--navy); font-size: clamp(10px, 2.4vw, 15px); }
.lang-en .cell .nm-en { font-family: var(--font-display); font-size: clamp(11px, 2.8vw, 17px); color: var(--navy); }
.cell.pulse { animation: pulse 1s ease-in-out 3; outline: 4px solid var(--orange); }
.cell.shake { animation: shake 0.4s; }
.cell.mk::after { content: var(--token, "⭐"); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: clamp(36px, 10vw, 64px);
  text-shadow: 0 4px 0 rgba(0,0,0,0.15); pointer-events: none; animation: token-pop 0.35s cubic-bezier(0.2, 1.6, 0.3, 1); }
.cell.win { outline: 4px solid var(--green); }
.hint { margin: 0; text-align: center; color: var(--ink-soft); font-size: 15px; min-height: 1.2em; }

@media (orientation: landscape) {
  .tabla { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }
  #caller.screen.on { display: grid; grid-template-columns: minmax(180px, 250px) 1fr; align-content: start; gap: 8px 14px;
    grid-template-areas: "bar bar" "stage ctrls" "stage set" "stage new" "h3 h3" "hist hist"; }
  #caller .bar { grid-area: bar; }
  .caller-stage { grid-area: stage; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; }
  #caller .ctrls { grid-area: ctrls; align-self: end; }
  #caller .set-row { grid-area: set; align-self: start; }
  #callerNew { grid-area: new; align-self: start; }
  #caller h3 { grid-area: h3; margin: 0; }
  #caller .history { grid-area: hist; }
  .caller-stage .lot-card { width: min(220px, 30vw, calc((100dvh - 150px) / 1.64)); }
  #board.screen.on { display: grid; grid-template-columns: 236px 1fr; grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "bar bar" "now tabla" "tokens tabla" "hint hint"; gap: 8px 10px; height: 100dvh; min-height: 0; overflow: hidden; }
  #board .bar { grid-area: bar; }
  #board .now-row { grid-area: now; }
  #board .token-row { grid-area: tokens; align-self: start; }
  #board .tabla { grid-area: tabla; }
  #board .hint { grid-area: hint; }
  .home-preview { display: none; }
}

@media (orientation: portrait) {
  .tabla { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr); }
  /* 2×4 portrait cells are wide and short: picture on the left, word on the right */
  .cell { flex-direction: row; align-items: stretch; }
  .cell .card-art { flex: 0 0 auto; width: auto; height: 100%; aspect-ratio: 3 / 4; }
  .cell .card-names { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(90deg, #FFF1C9, #FFFDF4); padding: 2px 4px; }
  .cell .card-num { top: 2px; left: 2px; }
  .cell .nm-es { font-size: clamp(13px, 4.2vw, 19px); }
  .cell .nm-en { font-size: clamp(11px, 3.3vw, 15px); }
  .lang-en .cell .nm-en { font-size: clamp(13px, 4.2vw, 19px); }
  .lang-both .cell .nm-es, .lang-both .cell .nm-en { display: block; }
  .lang-both .cell .nm-both { display: none; }
}

/* Win overlay + confetti */
.overlay { position: fixed; inset: 0; background: rgba(44, 62, 107, 0.45); display: flex;
  align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.overlay[hidden] { display: none; }
.win-card { background: var(--cream-2); border-radius: 28px; padding: 28px 22px; text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25); width: min(420px, 100%); animation: pop 0.5s; }
.win-title { font-family: var(--font-display); font-size: clamp(40px, 10vw, 64px); margin: 0;
  color: var(--coral); text-shadow: 0 4px 0 #ffe08a; }
.win-sub { font-size: 20px; color: var(--ink-soft); margin: 4px 0 16px; }
.win-actions { display: flex; flex-direction: column; gap: 8px; }

#confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 25; }
#confetti[hidden] { display: none; }
.confetti-bit { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 2px;
  animation: fall var(--dur, 2.4s) linear forwards; }

#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 14px; z-index: 30;
  font-size: 16px; box-shadow: var(--shadow); }
#toast[hidden] { display: none; }

/* Legal pages */
body.legal { max-width: 720px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 20px calc(32px + var(--safe-b));
  line-height: 1.55; background: var(--cream); }
body.legal h1 { font-family: var(--font-display); color: var(--navy); font-size: 32px; margin-bottom: 4px; }
body.legal h2 { font-family: var(--font-display); color: var(--navy); font-size: 22px; margin-top: 24px; }
body.legal a { color: var(--sky-deep); }
body.legal .back-link { display: inline-block; margin-bottom: 12px; background: #fff; padding: 8px 14px;
  border-radius: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }

@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes pop { 0% { transform: scale(0.82) rotate(-3deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes token-pop { 0% { transform: scale(0.2); } 100% { transform: scale(1); } }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); opacity: 0.2; } }

@media (prefers-reduced-motion: reduce) {
  .logo-mark, .home-preview .lot-card, .card-art.idle .art-img, .confetti-bit { animation: none !important; }
}

@media (max-height: 700px) and (orientation: portrait) {
  .lot-card { width: min(215px, 56vw, calc((100dvh - 260px) / 1.62)); }
  .logo-title { font-size: 34px; }
  .mode-btn { min-height: 72px; padding: 12px 14px; }
}

/* ================= Deck switcher, gallery, sound toggle ================= */
.deck-row { display: flex; gap: 8px; width: min(520px, 100%); position: relative; }
.deck-chip { flex: 1; min-height: 64px; border-radius: 18px; padding: 8px 6px; background: #fff; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; position: relative; font-size: 15px; }
.deck-chip .dk-ico { font-size: 22px; line-height: 1; }
.deck-chip .dk-name { font-family: var(--font-display); font-size: 16px; color: var(--navy); }
.deck-chip .dk-sub { font-size: 12px; opacity: 0.75; }
.deck-chip.live { background: linear-gradient(160deg, #FFF3B8, #FFC83D); box-shadow: 0 5px 0 #d99a14; }
.deck-chip.soon { background: #f2ece0; color: #8a7a66; box-shadow: none; cursor: default; }
.deck-chip.soon .dk-name { color: #8a7a66; }
.deck-chip.soon .dk-sub { font-weight: 800; color: #b07a1e; opacity: 1; }
.mode-btn.gallery-btn { background: #FFD25E; color: #4a3410; }
.sfx-tog { display: flex; align-items: center; gap: 6px; font-size: 16px; }

.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px 2px 12px; }
.gal-tile { position: relative; aspect-ratio: 3 / 4; padding: 0; width: 100%; border-radius: 16px; overflow: hidden;
  background: linear-gradient(150deg, #FFE792, #FFC83D); padding: 4px; box-shadow: var(--shadow); display: block; }
.gal-tile .gal-img { position: absolute; inset: 4px; border-radius: 12px; background: center / cover no-repeat; }
.gal-tile .gal-n { position: absolute; top: 5px; left: 5px; min-width: 28px; height: 28px; border-radius: 999px; padding: 0 6px;
  background: linear-gradient(160deg, #FFFBE6, #FFDB6B); border: 2px solid #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px; color: var(--navy); }
.gal-tile .gal-n::before { content: "#"; font-size: 0.72em; opacity: 0.75; }
.gal-tile .gal-name { position: absolute; left: 7px; right: 7px; bottom: 7px; background: rgba(255,253,244,0.94); border-radius: 9px;
  font-family: var(--font-display); font-size: clamp(11px, 3vw, 15px); color: var(--navy); line-height: 1.1; padding: 3px 2px; text-align: center; }
.gal-tile .gal-name small { display: block; font-family: var(--font-ui); font-size: 0.82em; color: var(--ink-soft); }
.lang-es .gal-name small { display: none; }
.lang-en .gal-name .es { display: none; }
.lang-en .gal-name small { font-family: var(--font-display); font-size: 1em; color: var(--navy); }
#gallery .hint { margin: 0 0 4px; }

.viewer { position: fixed; inset: 0; z-index: 22; background: rgba(44, 62, 107, 0.62); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: calc(10px + var(--safe-t)) 12px calc(12px + var(--safe-b)); }
.viewer[hidden] { display: none; }
.viewer .lot-card { width: min(300px, 66vw, calc((100dvh - 190px) / 1.64)); }
.viewer-phrase { margin: 0; color: #fff; text-align: center; font-size: clamp(15px, 4vw, 20px); min-height: 2.4em; text-shadow: 0 2px 4px rgba(0,0,0,0.4); max-width: 520px; }
.viewer-ctrls { display: flex; gap: 8px; align-items: center; justify-content: center; width: min(420px, 100%); }
.viewer-ctrls .big-btn { flex: 1; }
.viewer-ctrls .icon-btn { flex: 0 0 auto; }
.viewer-close { align-self: flex-end; }

/* ================= Idle life + per-animal motion ================= */
.card-art.idle:not(.playing) .art-img { animation: idle-breathe 3.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes idle-breathe { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-1.2%) scale(1.012); } }
.card-art.playing .art-img { animation-duration: var(--ad, 1.6s); animation-timing-function: ease-in-out; animation-fill-mode: both; }
.art-img { transform-origin: 50% 88%; }
.art-img > i { transform-origin: 50% 60%; }

.an-perro .art-img { animation-name: k-perro; --ad: 1.5s; }
@keyframes k-perro { 0%,100% { transform: none; } 10% { transform: translateY(-9%) scale(.97,1.05); } 22% { transform: translateY(0) scale(1.06,.93); } 32%,40% { transform: none; }
  50% { transform: translateY(-9%) scale(.97,1.05); } 62% { transform: translateY(0) scale(1.06,.93); } 74% { transform: none; } }
.an-gato .art-img { animation-name: k-gato; --ad: 2.2s; transform-origin: 50% 95%; }
@keyframes k-gato { 0%,100% { transform: none; } 12% { transform: rotate(-4deg) scaleY(1.02); } 30% { transform: rotate(4deg) scaleY(.99); } 48% { transform: rotate(-4deg) scaleY(1.02); } 66% { transform: rotate(3deg); } 84% { transform: rotate(-2deg); } }
.an-pato .art-img { animation-name: k-pato; --ad: 1.8s; }
@keyframes k-pato { 0%,100% { transform: none; } 10% { transform: translateY(-4%) rotate(-3deg); } 22% { transform: translateY(1%) rotate(2deg); } 34% { transform: translateY(-4%) rotate(-3deg); }
  46% { transform: translateY(1%) rotate(2deg); } 58% { transform: scaleX(1.05) skewY(-3deg); } 64% { transform: scaleX(.96) skewY(3deg); } 70% { transform: scaleX(1.05) skewY(-3deg); } 76% { transform: scaleX(.96) skewY(3deg); } 84% { transform: none; } }
.an-oso .art-img { animation-name: k-oso; --ad: 2.2s; transform-origin: 50% 95%; }
@keyframes k-oso { 0%,100% { transform: none; } 20% { transform: scale(1.06) rotate(-3deg); } 45% { transform: scale(1.08) rotate(3deg); } 70% { transform: scale(1.05) rotate(-2deg); } }
.an-rana .art-img { animation-name: k-rana; --ad: 1.9s; }
@keyframes k-rana { 0%,100% { transform: none; } 12% { transform: scale(1.06,.92); } 24% { transform: translateY(-11%) scale(.96,1.06); } 38% { transform: translateY(0) scale(1.06,.93); } 48% { transform: none; }
  55% { transform: scale(1.03,.97); } 85% { transform: scale(1.03,.97); } }
.an-pez .art-img { animation-name: k-pez; --ad: 2.2s; transform-origin: 85% 50%; }
@keyframes k-pez { 0%,100% { transform: none; } 12% { transform: rotate(-6deg) translateY(-1%); } 24% { transform: rotate(6deg) translateY(1%); } 36% { transform: rotate(-6deg) translateY(-1%); } 48% { transform: rotate(6deg) translateY(1%); } 60% { transform: rotate(-5deg); } 72% { transform: rotate(5deg); } 86% { transform: rotate(-2deg); } }
.an-conejo .art-img { animation-name: k-conejo; --ad: 1.7s; }
@keyframes k-conejo { 0%,100% { transform: none; } 6% { transform: scale(1.06,.92); } 18% { transform: translateY(-13%) scale(.95,1.08); } 30% { transform: translateY(0) scale(1.06,.93); } 40% { transform: none; }
  46% { transform: scale(1.06,.92); } 58% { transform: translateY(-13%) scale(.95,1.08); } 70% { transform: translateY(0) scale(1.06,.93); } 80% { transform: none; } }
.an-vaca .art-img { animation-name: k-vaca; --ad: 2s; transform-origin: 50% 80%; }
@keyframes k-vaca { 0%,100% { transform: none; } 15% { transform: rotate(-3deg) translateY(1.5%); } 35% { transform: rotate(3deg) translateY(2%); } 55% { transform: rotate(-2deg) translateY(1%); } 75% { transform: rotate(2deg); } }
.an-cerdo .art-img { animation-name: k-cerdo; --ad: 1.5s; }
@keyframes k-cerdo { 0%,100% { transform: none; } 10% { transform: rotate(-5deg) scale(1.04,.97); } 20% { transform: rotate(5deg) scale(.98,1.03); } 30% { transform: rotate(-5deg) scale(1.04,.97); } 40% { transform: rotate(5deg) scale(.98,1.03); } 55% { transform: rotate(-4deg) scale(1.03,.98); } 70% { transform: rotate(4deg); } }
.an-oveja .art-img { animation-name: k-oveja; --ad: 1.8s; }
@keyframes k-oveja { 0%,100% { transform: none; } 10% { transform: scale(1.07,.93); } 25% { transform: translateY(-8%) scale(.97,1.05); } 38% { transform: scale(1.06,.94); } 52% { transform: translateY(-6%) scale(.98,1.04); } 66% { transform: scale(1.04,.96); } 80% { transform: none; } }
.an-caballo .art-img { animation-name: k-caballo; --ad: 2s; }
@keyframes k-caballo { 0%,100% { transform: none; } 12% { transform: translate(-4%,-7%) rotate(-4deg); } 24% { transform: translate(-4%,0) rotate(0); } 38% { transform: translate(4%,-7%) rotate(4deg); } 50% { transform: translate(4%,0); }
  64% { transform: translate(-3%,-7%) rotate(-4deg); } 76% { transform: translate(-3%,0); } 90% { transform: none; } }
.an-pollo .art-img { animation-name: k-pollo; --ad: 2s; }
@keyframes k-pollo { 0%,100% { transform: none; } 10% { transform: translate(-3%,-2%) rotate(-3deg); } 20% { transform: translate(-6%,1%) rotate(0); } 30% { transform: translate(-3%,-2%) rotate(3deg); } 42% { transform: translate(3%,1%) rotate(3deg); } 55% { transform: translate(6%,-2%) rotate(0); } 68% { transform: translate(3%,1%) rotate(-3deg); } 82% { transform: translate(0,0); } }
.an-leon .art-img { animation-name: k-leon; --ad: 2s; transform-origin: 50% 40%; }
@keyframes k-leon { 0%,100% { transform: none; } 12% { transform: scale(1.12); } 22% { transform: scale(1.08) rotate(-3deg); } 32% { transform: scale(1.12) rotate(3deg); } 42% { transform: scale(1.08) rotate(-3deg); } 52% { transform: scale(1.1) rotate(3deg); } 70% { transform: scale(1.04); } }
.an-elefante .art-img { animation-name: k-elefante; --ad: 2.1s; transform-origin: 50% 98%; }
@keyframes k-elefante { 0%,100% { transform: none; } 15% { transform: rotate(-3.5deg) skewX(2deg); } 35% { transform: rotate(3.5deg) skewX(-2deg) scaleY(1.03); } 55% { transform: rotate(-3deg) skewX(2deg); } 75% { transform: rotate(2.5deg) skewX(-1.5deg); } }
.an-jirafa .art-img { animation-name: k-jirafa; --ad: 2.4s; transform-origin: 50% 96%; }
@keyframes k-jirafa { 0%,100% { transform: none; } 20% { transform: scaleY(1.13) scaleX(.97); } 38% { transform: scaleY(1.13) scaleX(.97) rotate(-4deg); } 56% { transform: scaleY(1.12) scaleX(.97) rotate(4deg); } 74% { transform: scaleY(1.06) rotate(-2deg); } }
.an-mono .art-img { animation-name: k-mono; --ad: 2.4s; }
@keyframes k-mono { 0%,100% { transform: none; } 8% { transform: translateY(-5%) rotate(-8deg); } 16% { transform: rotate(8deg); } 24% { transform: translateY(-5%) rotate(-8deg); } 32% { transform: rotate(8deg); } 40% { transform: translateY(-5%) rotate(-7deg); } 48% { transform: rotate(7deg); } 58% { transform: translateY(-4%) scale(.98,1.04); } 70% { transform: scale(1.05,.92); } 80% { transform: scale(1.01,.98); } 90% { transform: none; } }
.an-pinguino .art-img { animation-name: k-pinguino; --ad: 2s; transform-origin: 50% 97%; }
@keyframes k-pinguino { 0%,100% { transform: none; } 6% { transform: rotate(-6deg) translate(-2%,-1.5%); } 12% { transform: rotate(0) translate(-2%,0); } 18% { transform: rotate(6deg) translate(2%,-1.5%); } 24% { transform: rotate(0) translate(2%,0); }
  30% { transform: rotate(-6deg) translate(-2%,-1.5%); } 36% { transform: translate(-2%,0); } 42% { transform: rotate(6deg) translate(2%,-1.5%); } 48% { transform: translate(2%,0); } 54% { transform: rotate(-5deg) translate(-1.5%,-1.5%); } 60% { transform: translate(-1.5%,0); } 66% { transform: rotate(5deg) translate(1.5%,-1.5%); } 72% { transform: none; } }
.an-mariposa .art-img { animation-name: k-mariposa; --ad: 2.4s; transform-origin: 50% 50%; }
@keyframes k-mariposa { 0%,100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-4%) rotate(-2deg); } 50% { transform: translateY(-1%) rotate(2deg); } 75% { transform: translateY(-4.5%) rotate(-1deg); } }
.an-mariposa .art-img > i { animation: k-flap .34s ease-in-out 7; transform-origin: 50% 50%; }
@keyframes k-flap { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(.72) scaleY(1.02); } }
.an-abeja .art-img { animation-name: k-abeja; --ad: 2.2s; transform-origin: 50% 60%; }
@keyframes k-abeja { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-2%,-4%) rotate(-2deg); } 45% { transform: translate(2%,-2%) rotate(2deg); } 70% { transform: translate(-1%,-5%) rotate(-1deg); } }
.an-abeja .art-img > i { animation: k-buzz .08s linear 27; transform-origin: 50% 55%; }
@keyframes k-buzz { 0%,100% { transform: scaleX(1) skewX(0); } 50% { transform: scaleX(.93) skewX(1.2deg); } }
.an-buho .art-img { animation-name: k-buho; --ad: 2.5s; transform-origin: 50% 70%; }
@keyframes k-buho { 0%,100% { transform: none; } 12% { transform: rotateY(-24deg) rotate(-4deg); } 28% { transform: rotateY(-24deg) rotate(-4deg); } 44% { transform: rotateY(24deg) rotate(4deg); } 60% { transform: rotateY(24deg) rotate(4deg); } 78% { transform: rotateY(-8deg) rotate(-1deg); } }
.an-ballena .art-img { animation-name: k-ballena; --ad: 2.6s; transform-origin: 50% 50%; }
@keyframes k-ballena { 0%,100% { transform: none; } 20% { transform: translate(-2%,-3%) rotate(-3deg); } 45% { transform: translate(2%,2%) rotate(3deg); } 70% { transform: translate(-1%,-3%) rotate(-2deg); } }
.an-delfin .art-img { animation-name: k-delfin; --ad: 2s; transform-origin: 50% 55%; }
@keyframes k-delfin { 0%,100% { transform: none; } 20% { transform: translate(-3%,-3%) rotate(-7deg); } 45% { transform: translate(3%,3%) rotate(6deg); } 70% { transform: translate(-2%,-3%) rotate(-5deg); } 85% { transform: translate(1%,0) rotate(2deg); } }
.an-dino .art-img { animation-name: k-dino-a; --ad: 2.1s; transform-origin: 50% 95%; }
.an-dino .art-img > i { animation: k-dino-b 2.1s ease-in-out both; transform-origin: 60% 40%; }
@keyframes k-dino-a { 0%,100% { transform: none; } 15% { transform: translateY(-3%) skewX(3deg); } 30% { transform: translateY(0) skewX(-3deg); } 45% { transform: translateY(-3%) skewX(3deg); } 60% { transform: translateY(0) skewX(-3deg); } 80% { transform: skewX(1deg); } }
@keyframes k-dino-b { 0%,100% { transform: none; } 15% { transform: rotate(-3deg); } 30% { transform: rotate(3deg); } 45% { transform: rotate(-3deg); } 60% { transform: rotate(3deg); } 80% { transform: rotate(-1deg); } }

/* Turtle: starts tucked in a cute shell, then pokes out head, arms and legs */
.card-art.tucked .art-img { opacity: 0; }
.card-art.tucked .fx::before, .an-tortuga:not(.playing) .fx::before { content: none; }
.card-art.tucked .fx { background: none; }
.card-art.tucked .fx .tuck-shell { position: absolute; left: 50%; top: 69%; width: 60%; translate: -50% -50%; }
.an-tortuga .art-img { animation-name: k-tortuga; --ad: 3s; transform-origin: 50% 80%; }
@keyframes k-tortuga { 0%,50% { clip-path: circle(0% at 50% 76%); transform: none; }
  52% { clip-path: circle(14% at 50% 76%); } 70% { clip-path: circle(46% at 50% 70%); transform: scale(1.03); } 88% { clip-path: circle(110% at 50% 60%); transform: scale(1.05,.97); } 100% { clip-path: circle(120% at 50% 60%); transform: none; } }
.p-shell { width: 60%; translate: -50% -50%; animation-name: shell-life !important; transform-origin: 50% 95%; animation-timing-function: ease-in-out !important; }
.p-shell svg { width: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(30,60,30,0.3)); }
@keyframes shell-life { 0% { opacity: 1; transform: none; } 8% { opacity: 1; transform: scale(1.03,.97); }
  20% { opacity: 1; transform: rotate(-5deg) scale(1.02,.96); } 32% { opacity: 1; transform: rotate(5deg); } 44% { opacity: 1; transform: rotate(-4deg); } 56% { opacity: 1; transform: rotate(3deg) scale(1.04,.94); }
  70% { opacity: 1; transform: translateY(-6%) scale(1.12,1.1); } 100% { opacity: 0; transform: translateY(-12%) scale(1.45); } }

/* ================= Particles ================= */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.p { position: absolute; translate: -50% -50%; opacity: 0; font-style: normal; font-size: calc(var(--s, 5) * var(--u, 3px)); line-height: 1;
  animation: p-float var(--l, 1.2s) var(--d, 0s) ease-out both; will-change: transform, opacity; }
@keyframes p-float { 0% { opacity: 0; transform: translate(0,0) scale(.3) rotate(0); } 15% { opacity: 1; transform: translate(calc(var(--dx,0px) * .15), calc(var(--dy,-20cqw) * .15)) scale(1) rotate(calc(var(--r,0deg) * .2)); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -20cqw)) scale(1.1) rotate(var(--r, 0deg)); } }
.p-spark { color: #FFD43B; text-shadow: 0 0 6px #FFF3A0, 0 0 2px #fff; }
.p-spark::before { content: "✦"; }
.p-note { color: #FF8A6B; text-shadow: 0 1px 0 #fff, 0 0 4px #fff; }
.p-word { font-family: var(--font-display); font-weight: 700; color: #fff; white-space: nowrap; -webkit-text-stroke: calc(var(--u,3px) * 1.1) #2C3E6B; paint-order: stroke fill; text-shadow: 0 calc(var(--u,3px) * .5) 0 rgba(44,62,107,.5);
  animation-name: p-pop; }
.p-word.en { color: #FFE9A0; }
@keyframes p-pop { 0% { opacity: 0; transform: scale(.2) rotate(var(--r,0deg)); } 20% { opacity: 1; transform: scale(1.3) rotate(var(--r,0deg)); } 34% { transform: scale(1) rotate(var(--r,0deg)); } 80% { opacity: 1; transform: scale(1.04) rotate(var(--r,0deg)); } 100% { opacity: 0; transform: translateY(-4cqw) scale(1) rotate(var(--r,0deg)); } }
.p-bubble { width: calc(var(--s,4) * var(--u,3px)); height: calc(var(--s,4) * var(--u,3px)); border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.95) 0 14%, rgba(190,235,255,.45) 40%, rgba(150,215,250,.22) 100%); border: calc(var(--u,3px) * .35) solid rgba(255,255,255,.8); }
.p-drop { width: calc(var(--s,3) * var(--u,3px)); height: calc(var(--s,3) * var(--u,3px) * 1.3); border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: linear-gradient(#e8f8ff, #8fd3f4); border: 1px solid #fff; }
.p-drop.arc { animation-name: p-arc; animation-timing-function: cubic-bezier(.3,.7,.5,1); }
@keyframes p-arc { 0% { opacity: 0; transform: translate(0,0) scale(.5); } 12% { opacity: 1; } 45% { opacity: 1; transform: translate(calc(var(--dx) * .6), -14cqw) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.9); } }
.p-puff { width: calc(var(--s,7) * var(--u,3px)); height: calc(var(--s,7) * var(--u,3px)); border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,.55) 60%, transparent 72%); }
.p-puff.cloud { background: radial-gradient(circle, #fff 55%, #f3f0ea 100%); box-shadow: 0 0 calc(var(--u,3px) * 2) rgba(255,255,255,.8); }
.p-puff.mane { background: radial-gradient(circle, rgba(255,214,120,.95), rgba(240,160,40,.6) 60%, transparent 72%); }
.p-ring { width: calc(var(--s,22) * var(--u,3px)); height: calc(var(--s,22) * var(--u,3px) * .3); border-radius: 50%; border: calc(var(--u,3px) * .7) solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(120,190,230,.5);
  animation-name: p-ring; }
@keyframes p-ring { 0% { opacity: 0; transform: scale(.2); } 20% { opacity: .95; } 100% { opacity: 0; transform: scale(1.3); } }
.p-glow { width: calc(var(--s,80) * var(--u,3px)); height: calc(var(--s,80) * var(--u,3px)); border-radius: 50%; background: radial-gradient(circle, rgba(255,232,140,.85), rgba(255,200,80,.35) 50%, transparent 70%); animation-name: p-glow; }
@keyframes p-glow { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1); } 55% { opacity: .55; transform: scale(.9); } 75% { opacity: 1; transform: scale(1.05); } 100% { opacity: 0; transform: scale(1.1); } }
.p-tongue { width: calc(8 * var(--u,3px)); height: calc(26 * var(--u,3px)); translate: -50% 0; border-radius: 0 0 calc(5 * var(--u,3px)) calc(5 * var(--u,3px)); background: linear-gradient(90deg, #ff6f9c, #ff9ab9 50%, #ff6f9c); transform-origin: 50% 0;
  box-shadow: inset 0 calc(-2 * var(--u,3px)) 0 rgba(200,40,90,.25); animation-name: p-tongue; animation-timing-function: cubic-bezier(.2,1.3,.4,1); }
@keyframes p-tongue { 0% { opacity: 0; transform: scaleY(.05) scaleX(.6); } 30% { opacity: 1; transform: scaleY(1) scaleX(1) rotate(-6deg); } 70% { opacity: 1; transform: scaleY(1) rotate(4deg); } 100% { opacity: 1; transform: scaleY(.04) scaleX(.6); } }
.p-tongue { animation-fill-mode: both; }


.sfx-btn { font-size: 22px; }
.sfx-btn.off { opacity: 0.55; }
.now-row .lot-card.sm { width: 96px; margin: 0; }
.now-mini { flex-wrap: wrap; }
.now-row .lot-card.sm .card-names { left: 4px; right: 4px; bottom: 4px; }
.confetti-bit.star { background: none !important; width: auto !important; height: auto !important; font-size: 18px; line-height: 1; }

/* Landscape overrides for the viewer + gallery (kept last so they win) */
@media (orientation: landscape) {
  .viewer { display: grid; grid-template-columns: auto auto; grid-template-areas: "card phrase" "card ctrls"; align-content: center; justify-content: center; column-gap: 24px; row-gap: 10px; }
  .viewer[hidden] { display: none; }
  #viewerCard { grid-area: card; }
  .viewer-phrase { grid-area: phrase; align-self: end; }
  .viewer-ctrls { grid-area: ctrls; align-self: start; }
  .viewer-close { position: absolute; top: calc(8px + var(--safe-t)); right: 10px; }
  .viewer .lot-card { width: min(300px, 40vw, calc((100dvh - 30px) / 1.64)); margin: 0; }
  .viewer-phrase, .viewer-ctrls { width: min(380px, 44vw); }
  .gal-grid { grid-template-columns: repeat(6, 1fr); }
  .caller-stage .lot-card { width: min(220px, 30vw, calc((100dvh - 170px) / 1.64)); }
}
@media (orientation: portrait) and (min-width: 700px) {
  .gal-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Banner text scales with the card width so long names (El Dinosaurio) never wrap on small cards */
.lot-card:not(.sm) .nm-es, .lang-en .lot-card:not(.sm) .nm-en { font-size: clamp(14px, 9cqw, 26px); }
.lot-card:not(.sm) .nm-en { font-size: clamp(12px, 6.4cqw, 18px); }
.lang-en .lot-card:not(.sm) .nm-en { font-size: clamp(14px, 9cqw, 26px); }
.lang-both .lot-card:not(.sm) .nm-es { font-size: clamp(13px, 8.2cqw, 23px); }
.lang-both .lot-card:not(.sm) .nm-en { font-size: clamp(11px, 5.8cqw, 16px); }
