/* GLP-1 Life Bingo (/bingo, /bingo/{edition}). Prefix bgo-.

   The board is art: the companion's night sky from the home page and Your story
   (#07020f, #110521, #190a2e, #2a1145, a warm glow low down, stars and fireflies),
   the same in light and dark, with marked squares lit like lanterns (#f6c86e).
   Everything around it is page chrome and uses the theme variables, so a member
   in dark mode gets a dark page. The share image (bingo.js drawShare) paints the
   same board, so keep the two in step. Animations always run. */

.bgo-page {
  --bgo-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --bgo-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bgo-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bgo-gold: #f6c86e;
  --bgo-mint: #86f2da;
  --bgo-cream: #f5ede2;
}
.bgo-page [hidden] { display: none !important; }

.bgo-wrap { max-width: 760px; margin: 0 auto; padding: 1.75rem 16px 3rem; }
.bgo-page--app .bgo-wrap { padding: 0; }

/* ---- Hero (guests) ------------------------------------------------------ */
.bgo-hero {
  position: relative; overflow: hidden; color: #fff; text-align: center;
  background:
    radial-gradient(90% 70% at 50% 120%, rgba(162,73,111,.55), transparent 62%),
    linear-gradient(180deg, #07020f 0%, #110521 42%, #190a2e 72%, #2a1145 100%);
}
.bgo-hero-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; padding: 2.75rem 16px 2.5rem; }
.bgo-kicker {
  font-family: var(--bgo-mono); font-weight: 500; font-size: .76rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--bgo-mint);
}
.bgo-hero h1 {
  font-family: var(--bgo-serif); font-weight: 400; color: #fff; letter-spacing: -.02em; line-height: 1.04;
  font-size: clamp(2.2rem, 8vw, 3.4rem); margin: .45rem 0 .55rem;
}
.bgo-hero p { color: rgba(245,237,226,.88); font-size: 1.06rem; line-height: 1.55; max-width: 34rem; margin: 0 auto; }
.bgo-hero-emoji { display: inline-block; font-size: 2.4rem; line-height: 1; animation: bgo-float 3.6s ease-in-out infinite; }

/* Member head: the app's own page head. */
.bgo-head h1 { display: flex; align-items: center; gap: .45rem; }
.bgo-intro { margin: 0 0 1rem; }

/* ---- Edition picker (/bingo) ------------------------------------------- */
.bgo-editions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.bgo-ed {
  position: relative; display: flex; flex-direction: column; overflow: hidden; text-decoration: none;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.bgo-ed:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--plum); }
.bgo-ed-art {
  position: relative; display: grid; place-items: center; padding: 1.1rem 1rem .9rem; overflow: hidden;
  background:
    radial-gradient(90% 70% at 50% 125%, rgba(162,73,111,.55), transparent 62%),
    linear-gradient(180deg, #07020f 0%, #110521 45%, #2a1145 100%);
}
.bgo-ed-mini { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(5, 18px); gap: 5px; transform: rotate(-4deg); }
.bgo-ed-mini i { width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.08); border: 1px solid rgba(245,237,226,.16); }
.bgo-ed-mini i.on { background: radial-gradient(circle at 50% 40%, #ffe7b0, #f6c86e 60%, #e3a24e); border-color: rgba(255,236,190,.9); box-shadow: 0 0 10px rgba(246,200,110,.6); }
.bgo-ed-mini i.free { background: radial-gradient(circle, #e4fff5 0 18%, rgba(134,242,218,.5) 30%, rgba(134,242,218,.08) 70%); }
.bgo-ed-emoji { position: absolute; z-index: 3; right: 14px; bottom: 8px; font-size: 1.9rem; animation: bgo-float 3.6s ease-in-out infinite; }
.bgo-ed-body { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem 1.15rem; flex: 1; }
.bgo-ed-body h2 { margin: 0; font-family: var(--bgo-serif); font-weight: 500; font-size: 1.45rem; letter-spacing: -.01em; }
.bgo-ed-body p { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.5; flex: 1; }
.bgo-ed-go { font-weight: 700; color: var(--plum); margin-top: .35rem; }
.bgo-badge {
  align-self: flex-start; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  background: var(--teal); color: #10141a; border-radius: 999px; padding: .15rem .55rem;
}

.bgo-section { margin-top: 2rem; }
.bgo-section h2 { font-family: var(--bgo-serif); font-weight: 500; font-size: 1.45rem; margin: 0 0 .7rem; }
.bgo-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.bgo-steps li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; }
.bgo-steps strong { display: block; margin-bottom: .2rem; }
.bgo-steps span { color: var(--muted); font-size: .92rem; line-height: 1.45; }

/* ---- The board ---------------------------------------------------------- */
.bgo-board {
  position: relative; container-type: inline-size; max-width: 560px; margin: 0 auto; overflow: hidden;
  border-radius: 22px; padding: 3.2cqw 2.6cqw 3.4cqw; color: #fff;
  background:
    radial-gradient(110% 55% at 50% 112%, rgba(162,73,111,.5), transparent 62%),
    linear-gradient(180deg, #07020f 0%, #110521 38%, #190a2e 72%, #2a1145 100%);
  box-shadow: 0 18px 50px rgba(17,5,33,.35), inset 0 0 0 1px rgba(245,237,226,.08);
  -webkit-tap-highlight-color: transparent;
}
/* Space kept for the board before the script draws it, so the page doesn't jump. */
.bgo-board:empty { aspect-ratio: 5 / 6.2; }
.bgo-sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.bgo-star {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  border-radius: 50%; background: #fff; opacity: .3;
  animation: bgo-twinkle 4.6s ease-in-out var(--d) infinite;
}
.bgo-fly {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  border-radius: 50%; background: #e4fff5;
  box-shadow: 0 0 6px 2px rgba(134,242,218,.95), 0 0 22px 7px rgba(110,240,210,.35);
  animation: bgo-drift var(--t) ease-in-out var(--d) infinite alternate, bgo-blink var(--b) ease-in-out var(--d) infinite;
}
.bgo-fly--gold { background: #fff4d6; box-shadow: 0 0 6px 2px rgba(255,214,140,.95), 0 0 22px 7px rgba(246,200,110,.38); }

.bgo-board-head { position: relative; z-index: 2; text-align: center; margin-bottom: 1.6cqw; }
.bgo-board-kicker {
  font-family: var(--bgo-mono); font-weight: 500; font-size: max(10px, 2.5cqw); letter-spacing: .16em;
  text-transform: uppercase; color: var(--bgo-mint);
}
.bgo-board-title {
  font-family: var(--bgo-serif); font-weight: 400; font-size: 7.2cqw; line-height: 1.05; letter-spacing: -.02em;
  margin-top: .6cqw; text-shadow: 0 2px 18px rgba(10,3,20,.5);
}
.bgo-letters {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.3cqw;
  text-align: center; font-family: var(--bgo-serif); font-weight: 500; font-size: 7.4cqw; line-height: 1;
  color: var(--bgo-gold); text-shadow: 0 0 18px rgba(246,200,110,.55); margin: 1.4cqw 0 1.4cqw;
}
.bgo-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.3cqw; }
.bgo-sq {
  position: relative; aspect-ratio: 1; min-width: 0; margin: 0; padding: 1cqw;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  border-radius: 2.4cqw; border: 1px solid rgba(245,237,226,.17); background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.93); font-family: var(--bgo-sans); font-weight: 600; cursor: pointer;
  transition: background .2s ease, transform .12s ease, box-shadow .25s ease;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.bgo-sq-t { display: block; width: 100%; font-size: clamp(7px, 2.95cqw, 15px); line-height: 1.13; overflow-wrap: normal; word-break: normal; }
.bgo-sq-t.is-tight { overflow-wrap: anywhere; }
.bgo-sq:hover { background: rgba(255,255,255,.11); }
.bgo-sq:active { transform: scale(.95); }
.bgo-sq:focus-visible { outline: 2px solid var(--bgo-mint); outline-offset: 2px; }
.bgo-sq[aria-pressed="true"] {
  color: #2a1145; border-color: rgba(255,236,190,.9);
  background: radial-gradient(circle at 50% 38%, #fff0c8 0%, #f6c86e 55%, #e3a24e 100%);
  box-shadow: 0 0 2.6cqw rgba(246,200,110,.6), inset 0 0 0 1px rgba(255,255,255,.35);
}
.bgo-sq.is-pop { animation: bgo-stamp .42s cubic-bezier(.2,.9,.3,1.35); }
.bgo-sq.is-win { animation: bgo-win 1.8s ease-in-out infinite; }
.bgo-sq--free {
  flex-direction: column; gap: .9cqw; cursor: default; color: var(--bgo-mint);
  background: radial-gradient(circle at 50% 42%, rgba(134,242,218,.25), rgba(255,255,255,.04) 72%);
  border-color: rgba(134,242,218,.35);
}
.bgo-sq--free:hover { background: radial-gradient(circle at 50% 42%, rgba(134,242,218,.25), rgba(255,255,255,.04) 72%); }
.bgo-sq--free:active { transform: none; }
.bgo-free-fly {
  width: 3.2cqw; height: 3.2cqw; border-radius: 50%; background: #e4fff5;
  box-shadow: 0 0 1.4cqw .5cqw rgba(134,242,218,.95), 0 0 5cqw 1.6cqw rgba(110,240,210,.4);
  animation: bgo-blink 3s ease-in-out infinite, bgo-float 3.6s ease-in-out infinite;
}
.bgo-free-t { font-family: var(--bgo-mono); font-weight: 500; font-size: max(8px, 2.3cqw); letter-spacing: .18em; text-transform: uppercase; }

/* A line through each finished row, column or diagonal. */
.bgo-lines { position: absolute; z-index: 3; left: 0; top: 0; pointer-events: none; overflow: visible; }
.bgo-lines line {
  stroke: #fff4d6; stroke-width: 1.1cqw; stroke-linecap: round; opacity: .55;
  filter: drop-shadow(0 0 1.2cqw rgba(246,200,110,.95));
}
/* bingo.js sets the dash to the line's own length; this runs it down to nothing. */
.bgo-lines line.is-new { animation: bgo-draw .55s cubic-bezier(.4,0,.2,1) forwards; }

.bgo-burst {
  position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--bgo-serif); font-weight: 500; font-size: 17cqw; letter-spacing: -.02em; color: #ffe2a0;
  text-shadow: 0 0 4cqw rgba(246,200,110,.95), 0 .6cqw 3cqw rgba(10,3,20,.6);
  animation: bgo-burst 1.9s cubic-bezier(.2,.9,.25,1.1) forwards;
}

.bgo-board.is-readonly .bgo-sq { cursor: default; }
.bgo-board.is-readonly .bgo-sq:hover { background: rgba(255,255,255,.06); }
.bgo-board.is-readonly .bgo-sq[aria-pressed="true"]:hover { background: radial-gradient(circle at 50% 38%, #fff0c8 0%, #f6c86e 55%, #e3a24e 100%); }
.bgo-board.is-readonly .bgo-sq:active { transform: none; }
.bgo-board.is-dealing .bgo-sq { animation: bgo-deal .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 18ms); }

/* ---- Under the board ---------------------------------------------------- */
.bgo-status { text-align: center; margin: .95rem 0 .15rem; font-weight: 700; font-size: 1.02rem; min-height: 1.5em; }
.bgo-status .bgo-hit { color: var(--plum); }
[data-theme="dark"] .bgo-status .bgo-hit { color: var(--teal); }
.bgo-hint { text-align: center; color: var(--muted); font-size: .88rem; margin: 0; }
.bgo-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .9rem; }
.bgo-actions .btn.is-glow { animation: bgo-nudge 1.3s ease-in-out 4; }

.bgo-viewing {
  display: flex; align-items: center; gap: .8rem 1rem; flex-wrap: wrap; margin: 0 auto 1rem; max-width: 560px;
  background: linear-gradient(135deg, var(--plum-tint), var(--teal-tint)), var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1rem;
}
.bgo-viewing p { flex: 1 1 14rem; margin: 0; }
.bgo-viewing strong { display: block; }

.bgo-printopts {
  max-width: 560px; margin: .9rem auto 0; padding: .9rem 1rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card);
}
.bgo-printopts p { margin: 0 0 .6rem; font-size: .92rem; }
.bgo-printopts-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.bgo-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bgo-seg button {
  border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600;
  padding: .45rem .85rem; cursor: pointer;
}
.bgo-seg button + button { border-left: 1px solid var(--line); }
.bgo-seg button[aria-pressed="true"] { background: var(--plum); color: #fff; }
[data-theme="dark"] .bgo-seg button[aria-pressed="true"] { background: var(--teal); color: #10141a; }

.bgo-more { display: grid; gap: .6rem; }
.bgo-more a {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); color: var(--ink); text-decoration: none;
}
.bgo-more a:hover { border-color: var(--plum); text-decoration: none; }
.bgo-more-emoji { font-size: 1.6rem; }
.bgo-more-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bgo-more-body small { color: var(--muted); }

.bgo-pitch {
  margin-top: 2.2rem; border-radius: 18px; padding: 1.6rem 1.25rem; text-align: center; color: #fff;
  background:
    radial-gradient(90% 80% at 50% 120%, rgba(162,73,111,.55), transparent 62%),
    linear-gradient(180deg, #110521 0%, #2a1145 100%);
}
.bgo-pitch h2 { color: #fff; font-family: var(--bgo-serif); font-weight: 400; font-size: 1.6rem; margin: 0 0 .45rem; }
.bgo-pitch p { color: rgba(245,237,226,.86); margin: 0 auto 1.1rem; max-width: 30rem; }
.bgo-pitch .btn.ghost { color: #fff; border: 1px solid rgba(255,255,255,.4); }
.bgo-pitch-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.bgo-foot { margin-top: 1.4rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---- Share sheet ---------------------------------------------------------- */
html.bgo-sheet-open { overflow: hidden; }
.bgo-sheet {
  position: fixed; inset: 0; z-index: 4100; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(7,2,15,.62);
}
.bgo-sheet[hidden] { display: none !important; }
.bgo-sheet-box {
  width: 100%; max-width: 460px; max-height: 94dvh; overflow-y: auto; background: var(--card); color: var(--ink);
  border-radius: 18px 18px 0 0; padding: 1rem 16px 1.15rem; box-shadow: 0 -10px 40px rgba(0,0,0,.35);
  animation: bgo-sheet-up .3s cubic-bezier(.2,.8,.2,1) both;
}
.bgo-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.bgo-sheet-head h2 { margin: 0; font-size: 1.1rem; }
.bgo-sheet-x { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 1.15rem; cursor: pointer; border-radius: 8px; padding: .2rem .5rem; }
.bgo-sheet-x:hover { background: var(--plum-tint); color: var(--ink); }
.bgo-preview { display: flex; justify-content: center; align-items: center; min-height: 200px; margin-bottom: .8rem; }
.bgo-preview img {
  display: block; width: auto; max-width: 100%; height: 44dvh; max-height: 380px; min-height: 180px;
  border-radius: 12px; background: #07020f; box-shadow: var(--shadow); object-fit: contain;
}
.bgo-preview img.is-post { height: 36dvh; max-height: 320px; }
.bgo-opt { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.bgo-opt-label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.bgo-sheet-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.bgo-sheet-actions .btn { flex: 1 1 8rem; justify-content: center; }
.bgo-sheet-note { margin: .7rem 0 0; font-size: .82rem; color: var(--muted); }
.bgo-sheet-status { margin: .55rem 0 0; font-size: .88rem; font-weight: 600; color: var(--good); min-height: 1.2em; }
@media (min-width: 640px) {
  .bgo-sheet { align-items: center; padding: 1rem; }
  .bgo-sheet-box { border-radius: 18px; }
}

.bgo-confetti { position: fixed; inset: 0; z-index: 4200; pointer-events: none; width: 100vw; height: 100vh; }

/* ---- Printed cards ---------------------------------------------------------
   Built by bingo.js into .bgo-print (a direct child of <body>) when a member asks
   to print. Scoped to pages holding the game (body:has(.bgo-page)): app.css loads
   on every layout, and an unscoped print rule once blanked every printed page. */
.bgo-print { display: none; }
@media print {
  body:has(.bgo-page) > *:not(.bgo-print) { display: none !important; }
  body:has(.bgo-page) .bgo-print { display: block !important; color: #1f2430; font-family: var(--bgo-sans, Arial, sans-serif); }
  .bgo-print-page { display: grid; grid-template-columns: 1fr 1fr; gap: 7mm; break-after: page; page-break-after: always; }
  .bgo-print-page:last-child { break-after: auto; page-break-after: auto; }
  .bgo-pcard { break-inside: avoid; border: 1.4pt solid #2a1145; border-radius: 4mm; padding: 3.5mm 3.5mm 3mm; }
  .bgo-pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 2mm; margin-bottom: 1.5mm; }
  .bgo-pcard-head img { height: 6mm; width: auto; }
  .bgo-pcard-title { font-family: "Newsreader", Georgia, serif; font-size: 13pt; line-height: 1.05; }
  .bgo-pcard-title small { display: block; margin-bottom: .8mm; font-family: "IBM Plex Mono", monospace; font-size: 6.5pt; letter-spacing: .12em; text-transform: uppercase; color: #6d3f7a; }
  .bgo-pletters { display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; font-family: "Newsreader", Georgia, serif; font-weight: 600; font-size: 15pt; color: #6d3f7a; margin: 1mm 0 1mm; }
  .bgo-pgrid { display: grid; grid-template-columns: repeat(5, 1fr); border-top: .8pt solid #555; border-left: .8pt solid #555; }
  .bgo-pcell {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center;
    border-right: .8pt solid #555; border-bottom: .8pt solid #555; padding: .9mm; font-size: 7.6pt; line-height: 1.12; font-weight: 600;
  }
  .bgo-pcell--free { background: #fbe7b8; font-family: "IBM Plex Mono", monospace; letter-spacing: .14em; font-size: 7pt; color: #6d3f7a; }
  .bgo-pcard-foot { display: flex; justify-content: space-between; margin-top: 1.5mm; font-family: "IBM Plex Mono", monospace; font-size: 6pt; color: #4b5563; }
}

/* ---- Motion --------------------------------------------------------------- */
@keyframes bgo-twinkle { 0%, 100% { opacity: .12; } 50% { opacity: .75; } }
@keyframes bgo-drift {
  0% { transform: translate(0, 0); }
  35% { transform: translate(var(--dx), calc(var(--dy) * -1)); }
  70% { transform: translate(calc(var(--dx) * -.5), calc(var(--dy) * .6)); }
  100% { transform: translate(calc(var(--dx) * .3), var(--dy)); }
}
@keyframes bgo-blink { 0%, 100% { opacity: .2; } 35% { opacity: 1; } 55% { opacity: .85; } 75% { opacity: .35; } }
@keyframes bgo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bgo-stamp { 0% { transform: scale(.82); } 55% { transform: scale(1.1) rotate(-2deg); } 100% { transform: none; } }
@keyframes bgo-win {
  0%, 100% { box-shadow: 0 0 2.6cqw rgba(246,200,110,.6), inset 0 0 0 1px rgba(255,255,255,.35); }
  50% { box-shadow: 0 0 5cqw rgba(255,226,160,.95), inset 0 0 0 1px rgba(255,255,255,.6); }
}
@keyframes bgo-draw { to { stroke-dashoffset: 0; } }
@keyframes bgo-burst {
  0% { opacity: 0; transform: scale(.4) rotate(-8deg); }
  22% { opacity: 1; transform: scale(1.12) rotate(2deg); }
  34% { transform: scale(1); }
  78% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.18); }
}
@keyframes bgo-deal { from { opacity: 0; transform: translateY(10px) scale(.9) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes bgo-nudge { 0%, 100% { transform: none; box-shadow: none; } 50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(246,200,110,.35); } }
@keyframes bgo-sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
