/* Balance It Unlimited: cream silhouettes on a plum card, the balance point in gold. */
:root {
  --bg: #f6f7f9;
  --bl-hi: #9a4683; --bl-bg: #6d2e5e; --bl-deep: #4f1f44; --bl-cream: #fff1e2; --bl-gold: #ffd166;
  --bl-stand: #e4cfdd; --bl-dim: rgba(255, 241, 226, .82); --bl-soft: rgba(255, 241, 226, .14);
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --disp: "Inter Display", "Inter Tight", Inter, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #5a2550; }
body { background: radial-gradient(90% 70% at 80% 0%, #7a3168, #5a2550 60%, #45193c) fixed; }
body {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 100svh; padding: 20px 16px;
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; margin: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--bl-cream); outline-offset: 3px; }

/* ---------- Card ---------- */
.gc {
  position: relative; isolation: isolate; overflow: hidden;
  flex: none; width: min(720px, 100%); height: min(580px, calc(100svh - 170px)); min-height: 520px;
  border-radius: 34px; color: #fff; letter-spacing: -.01em;
  background: radial-gradient(120% 90% at 85% 0%, var(--bl-hi), var(--bl-bg) 70%);
  box-shadow: 0 40px 80px -30px rgba(25, 3, 20, .75), 0 0 0 1px rgba(255, 241, 226, .1);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
#screen { position: absolute; inset: 0; }

/* ---------- Top bar: progress | logo | watermark ---------- */
.gc-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 18px 20px; font-size: 13px; font-weight: 600; color: var(--bl-dim);
}
.top-left { display: flex; align-items: center; min-width: 0; }
.top-btns { display: flex; gap: 8px; }
.progress { display: none; align-items: center; gap: 14px; }
.gc.in-round .top-btns { display: none; }
.gc.in-round .progress { display: flex; }
.gc.in-round .gc-top > .watermark { visibility: hidden; }
.bl-stage .watermark { position: absolute; top: 16px; right: 18px; z-index: 2; pointer-events: none; }
.gc-dots { display: flex; gap: 5px; }
.gc-dots i { width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: .25; transition: opacity .3s, transform .3s; }
.gc-dots i.done { opacity: .85; }
.gc-dots i.now { opacity: 1; transform: scale(1.35); }
.gc-pts { color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gc-sound {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--bl-soft); color: #fff; transition: background .2s;
}
.gc-sound:hover { background: rgba(255, 241, 226, .24); }
.gc-sound svg { width: 15px; height: 15px; }

.game-title { display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff; user-select: none; }
.game-title h1 { margin: 0; font: 800 76px/.9 var(--disp); letter-spacing: -.055em; text-shadow: 0 10px 30px rgba(25, 3, 20, .35); }
.game-title small { margin-top: 8px; padding-left: .42em; font: 800 15px/1 var(--disp); letter-spacing: .42em; color: var(--bl-gold); }

/* Site watermark: top-right of the card on intro/results, top-right of the play box in rounds. */
.watermark {
  justify-self: end; font: 700 16px/1 var(--disp); letter-spacing: -.015em;
  color: rgba(255, 241, 226, .5); white-space: nowrap; user-select: all; -webkit-user-select: all;
}

/* ---------- Shared bits ---------- */
.gc-title { margin: 0; font: 800 62px/.95 var(--disp); letter-spacing: -.05em; color: #fff; }
.gc-sub { max-width: 330px; margin: 16px 0 0; font-size: 18px; line-height: 1.4; font-weight: 500; color: var(--bl-dim); }
.gc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gc-chips span {
  display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--bl-soft); font-size: 12px; font-weight: 600;
}
.gc-go, .gc-round {
  position: absolute; z-index: 6; display: grid; place-items: center; border-radius: 50%;
  background: var(--bl-cream); color: var(--bl-deep);
  box-shadow: 0 0 0 6px rgba(255, 241, 226, .14), 0 14px 30px -14px rgba(40, 5, 30, .75);
  transition: transform .2s var(--spring), opacity .2s;
}
.gc-go { width: 84px; height: 84px; right: 26px; bottom: 26px; }
.gc-go svg { width: 30px; height: 30px; margin-left: 4px; }
.gc-round { width: 68px; height: 68px; }
.gc-round svg { width: 26px; height: 26px; }
.gc-go:hover, .gc-round:hover { transform: scale(1.06); }
.gc-go:active, .gc-round:active { transform: scale(.94); }
.gc-round:disabled { opacity: .45; cursor: wait; transform: none; }
.fade-in { animation: gc-fade .35s var(--ease) both; }
@keyframes gc-fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes gc-rise { to { opacity: 1; transform: none; } }
@keyframes gc-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- Intro ---------- */
.bl-intro { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 92px 30px 30px; }
.bl-intro :is(.gc-title, .gc-sub, .gc-chips) { flex-shrink: 0; }
.bl-intro .gc-title { max-width: 460px; font-size: 54px; }
.bl-intro-art { flex: 1; min-height: 0; width: 100%; margin: 14px 0 22px; overflow: visible; pointer-events: none; }
.bl-intro .gc-chips { padding-right: 110px; }

/* ---------- Round ---------- */
.bl-round { position: absolute; inset: 64px 0 0; display: flex; flex-direction: column; }
.bl-q { padding: 0 26px; }
.bl-q h2 { margin: 0; font: 800 28px/1.1 var(--disp); letter-spacing: -.035em; color: var(--bl-dim); text-wrap: balance; }
.bl-q h2 b { color: #fff; }
.bl-stage {
  position: relative; flex: 1; min-height: 0; margin: 12px 14px 0; border-radius: 22px;
  background: rgba(255, 241, 226, .06); touch-action: none; cursor: ew-resize; outline: none; overflow: hidden;
}
.bl-stage.locked { cursor: default; }
.bl-stage:focus-visible .bl-stand, .bl-stage.dragging .bl-stand { fill: var(--bl-cream); }
.bl-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bl-stand { fill: var(--bl-stand); transition: fill .15s; }
.bl-obj { fill: var(--bl-cream); stroke: var(--bl-cream); stroke-width: 1px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.bl-dot { fill: var(--bl-gold); }
.bl-plumb, .bl-gap { stroke: var(--bl-gold); stroke-linecap: round; fill: none; vector-effect: non-scaling-stroke; }
.bl-plumb { stroke-width: 2px; stroke-dasharray: 5 5; }
.bl-gap { stroke-width: 3px; }
.bl-ground { stroke: rgba(255, 241, 226, .22); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.bl-mark { animation: gc-fade .35s var(--ease) both; }

.bl-foot { display: flex; flex: none; align-items: center; gap: 16px; height: 112px; padding: 12px 20px 18px; }
.bl-foot .gc-round { position: static; flex: none; margin-left: auto; }
.bl-hint { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; color: var(--bl-dim); }
.bl-award { flex: 1; min-width: 0; }
.bl-score { display: flex; align-items: baseline; gap: 6px; }
.bl-score b { display: inline-block; transform-origin: left bottom; font: 800 54px/.95 var(--disp); letter-spacing: -.05em; font-variant-numeric: tabular-nums; animation: gc-pop .5s var(--spring) both; }
.bl-score span { color: var(--bl-dim); font-size: 15px; font-weight: 700; }
.bl-award p { margin: 6px 0 0; font-size: 14px; font-weight: 600; line-height: 1.3; }

/* ---------- Results ---------- */
.bl-results { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 76px 24px 18px; }
.bl-results .gc-title { font-size: 34px; letter-spacing: -.04em; }
.gc-verdict { margin: 8px 0 0; font-size: 15px; color: var(--bl-dim); }
.gc-total { margin-top: 14px; }
.gc-total b { font: 800 88px/.9 var(--disp); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.gc-total small { margin-left: 6px; font: 800 26px var(--disp); letter-spacing: -.02em; color: var(--bl-dim); opacity: .7; }
.bl-shelf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 18px 0 0; }
.bl-shelf-item { display: flex; flex-direction: column; align-items: center; min-width: 0; opacity: 0; transform: translateY(8px); animation: gc-rise .4s var(--ease) forwards; }
.bl-shelf-art { display: block; width: 100%; height: 84px; overflow: visible; }
.bl-shelf-item p { display: flex; flex-direction: column; align-items: center; margin: 6px 0 0; max-width: 100%; }
.bl-shelf-item span { max-width: 100%; font-size: 12px; line-height: 1.25; color: var(--bl-dim); text-align: center; }
.bl-shelf-item b { font: 800 18px var(--disp); font-variant-numeric: tabular-nums; }
.bl-key { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 12px; color: var(--bl-dim); }
.bl-key i { width: 3px; height: 14px; border-radius: 2px; background: var(--bl-gold); box-shadow: 0 -5px 0 1px var(--bl-gold); }
.bl-key .bl-stats { margin-left: auto; }
.gc-acts { display: flex; gap: 10px; margin-top: auto; }
.gc-btn {
  display: flex; flex: 1; align-items: center; justify-content: center; gap: 8px; height: 54px; border-radius: 999px;
  background: var(--bl-cream); color: var(--bl-deep); font-size: 15px; font-weight: 700;
  box-shadow: 0 12px 24px -14px rgba(40, 5, 30, .75); transition: transform .2s var(--spring);
}
.gc-btn.ghost { background: var(--bl-soft); color: #fff; box-shadow: none; }
.gc-btn:hover { transform: scale(1.02); }
.gc-btn:active { transform: scale(.97); }
.gc-btn svg { width: 16px; height: 16px; }
.bl-toast { min-height: 16px; margin: 8px 0 0; font-size: 12px; color: var(--bl-dim); text-align: center; }

/* ---------- How to play ---------- */
.howto {
  position: absolute; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 28px 30px; background: linear-gradient(160deg, #7c3569, var(--bl-deep));
  animation: gc-fade .3s var(--ease) both; user-select: text; scrollbar-width: thin; scrollbar-color: rgba(255,241,226,.25) transparent; -webkit-user-select: text;
}
.howto[hidden] { display: none; }
.howto-x { position: sticky; top: 0; float: right; margin: -6px -10px 0 0; }
.howto h2 { margin: 0 0 14px; font: 800 34px/1 var(--disp); letter-spacing: -.04em; }
.howto h3 { margin: 22px 0 10px; font: 800 20px/1.1 var(--disp); letter-spacing: -.03em; }
.howto-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.45; color: var(--bl-dim); }
.howto-steps b { color: #fff; }
.howto kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; background: var(--bl-soft);
  font: 700 12px/1.5 var(--sans); text-align: center; color: #fff;
}
.ico-chip { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bl-cream); color: var(--bl-deep); font-size: 11px; font-weight: 800; }
.howto-ex { padding: 14px; border-radius: 18px; background: rgba(255, 241, 226, .07); }
.howto-ex svg { display: block; width: 100%; height: 160px; overflow: visible; }
.howto-ex p { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--bl-dim); }
.howto-ex p b { color: #fff; }
.ex-mid { fill: rgba(228, 207, 221, .45); }
.ex-label { font-family: var(--sans); font-weight: 700; fill: var(--bl-dim); }
.howto-note { margin: 0 0 10px; font-size: 14px; color: var(--bl-dim); }
.howto-table { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.howto-table div { padding: 8px 4px; border-radius: 12px; background: var(--bl-soft); text-align: center; }
.howto-table small { display: block; font-size: 11.5px; color: var(--bl-dim); }
.howto-table b { font: 800 18px var(--disp); }

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  body { padding: 10px; }
  .gc { height: min(660px, calc(100svh - 110px)); min-height: 540px; border-radius: 28px; }
  body { gap: 14px; padding: 16px 10px 10px; }
  .game-title h1 { font-size: 50px; }
  .game-title small { margin-top: 6px; font-size: 12px; }
  .gc-top { padding: 16px 18px; }
  .watermark { font-size: 13px; }
  .bl-stage .watermark { top: 12px; right: 14px; }
  .gc.in-round .gc-top > .watermark { display: none; }
  .bl-intro { padding: 74px 24px 24px; }
  .bl-intro .gc-title { font-size: 42px; }
  .bl-intro .gc-sub { font-size: 17px; max-width: 290px; }
  .bl-intro .gc-chips { padding-right: 96px; }
  .gc-go { width: 76px; height: 76px; right: 22px; bottom: 22px; }
  .bl-round { inset: 66px 0 0; }
  .bl-q { padding: 0 20px; }
  .bl-q h2 { font-size: 23px; }
  .bl-stage { margin: 10px 10px 0; }
  .bl-foot { gap: 12px; height: 120px; padding: 10px 16px 16px; }
  .bl-score b { font-size: 46px; }
  .bl-award p { font-size: 13.5px; }
  .bl-results { padding: 70px 20px 16px; }
  .bl-results .gc-title { font-size: 30px; }
  .gc-total b { font-size: 72px; }
  .bl-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .bl-shelf-art { height: 48px; }
  .bl-key { flex-wrap: wrap; }
  .howto { padding: 22px 20px 26px; }
  .howto-table { grid-template-columns: repeat(3, 1fr); }
}
/* ---------- Shared EVERYTHINGLE home logo ----------
   Desktop: it is pinned top-left (games/home-button.css); the card and its top-left buttons sit
   below the centred title, well clear of it. At <=1000px it joins the flex column above the
   title, so the card gives up that height to keep the whole game on the first screen. */
@media (max-width: 1000px) {
  .gc { height: min(580px, calc(100svh - 220px)); }
}
@media (max-width: 600px) {
  body { gap: 10px; padding-top: 4px; }
  a.site-logo { margin-top: 4px; }
  .gc { height: min(660px, calc(100svh - 150px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .bl-shelf-item { opacity: 1; transform: none; }
}
