:root {
  --bg: #fff6e9;
  --bg2: #fdebd3;
  --ink: #3a2417;
  --accent: #ff8a3d;
  --accent-dark: #c4611a;
  --accent2: #b5591f;
  --accent3: #d9a441;
  --card: #fffdf7;
  --muted: #8a5a3b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 10;
  color: var(--ink);
}

.brand {
  font-weight: 800;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  overflow: visible;
}
.brand-buffalo {
  display: inline-block;
  transform-origin: 70% 90%;
  animation: brand-charge 2.6s ease-in-out infinite;
}
.brand-text {
  display: inline-block;
  color: var(--accent);
  animation: brand-shove 2.6s ease-in-out infinite;
}

@keyframes brand-charge {
  0%, 55%  { transform: translateX(0) scaleX(-1); }
  65%      { transform: translateX(7px) scaleX(-1.15); }
  75%      { transform: translateX(2px) scaleX(-0.9); }
  85%, 100%{ transform: translateX(0) scaleX(-1); }
}

@keyframes brand-shove {
  0%, 55%  { transform: translateX(0) rotate(0deg); }
  67%      { transform: translateX(9px) rotate(-3deg); }
  78%      { transform: translateX(3px) rotate(1.5deg); }
  88%, 100%{ transform: translateX(0) rotate(0deg); }
}

.tabs { display: flex; gap: 8px; }

.tab-btn {
  background: none;
  border: 2px solid transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

/* With four tabs the header no longer fits one narrow line, so stack the
   brand above a nav that scrolls sideways instead of wrapping mid-label. */
@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .brand { justify-content: center; font-size: 1.15rem; }
  .tabs {
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; padding: 7px 12px; font-size: 0.86rem; }
}
.tab-btn.active, .tab-btn:hover {
  border-color: var(--accent2);
  background: #fef0c7;
}

main {
  flex: 1;
  max-width: 1020px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.hero { text-align: center; margin-bottom: 20px; max-width: 680px; margin-left: auto; margin-right: auto; }
/* Katta of the Day: heading, subtitle and card share one centred column
   so they line up instead of the card stretching wider than the text. */
#feed { text-align: center; }
#feed h2,
#feed > .subtitle,
#feed .kattay-card {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
#feed h2 { margin-bottom: 8px; }
#feed > .subtitle { margin-top: 0; margin-bottom: 24px; }
.hero h1 { font-family: "Baloo 2", sans-serif; font-size: 1.8rem; margin-bottom: 8px; }
main h2 { font-family: "Baloo 2", sans-serif; }
.subtitle { color: var(--muted); line-height: 1.5; }

/* Roam-page strip: same village palette as the game's Village theme.
   Paint order back-to-front: sky, far town, near street, grass, buffalo. */
.wander-stage {
  position: relative;
  height: 230px;
  background: linear-gradient(180deg, #8fd3f4 0%, #bfe6f7 55%, #fdf0c6 100%);
  border-radius: 16px;
  overflow: hidden;
  margin: 20px 0;
  border: 3px solid var(--ink);
  box-shadow: 0 10px 24px rgba(90,50,20,0.18);
}

/* Parallax scenery bands. Each is a seamlessly tileable SVG scrolled by
   animating background-position, so it loops forever with no seam. */
.layer {
  position: absolute;
  left: 0;
  right: 0;
  background-repeat: repeat-x;
  background-size: auto 100%;
  pointer-events: none;
}
.layer-far {
  bottom: 52px;
  height: 120px;
  z-index: 1;
  opacity: 0.75;
  animation: layer-scroll-far 26s linear infinite;
}
.layer-near {
  bottom: 46px;
  height: 150px;
  z-index: 2;
  animation: layer-scroll-near 15s linear infinite;
}
.layer-far { background-image: url("assets/village-far.svg"); }
.layer-near { background-image: url("assets/village-near.svg"); }

@keyframes layer-scroll-far {
  from { background-position-x: 0; }
  to   { background-position-x: -800px; }
}
@keyframes layer-scroll-near {
  from { background-position-x: 0; }
  to   { background-position-x: -900px; }
}

/* Grass band / street the buffalo walks along, in front of the houses. */
.wander-stage::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  background: #7dc36b;
  border-top: 5px solid #5fa34f;
  z-index: 3;
}

/* Scrolling ground dashes — the moving ground is what sells the walk. */
.wander-stage::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 16px;
  width: 200%;
  height: 4px;
  background: repeating-linear-gradient(90deg,
    rgba(95,163,79,0.9) 0 26px,
    transparent 26px 90px);
  animation: ground-scroll 1.1s linear infinite;
  z-index: 4;
}

@keyframes ground-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-90px); }
}

/* Above every scenery layer (z 1-4) so the buffalo walks in front of the
   houses, not behind them. */
.buffalo {
  position: absolute;
  bottom: 22px;
  left: 0;
  z-index: 5;
  font-size: 3.6rem;
  line-height: 1;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,0.28));
  animation: roam 14s linear infinite;
}

/* Inner span does the gait; outer element does the travel, so the two
   never fight over `transform`. */
.buffalo span {
  display: inline-block;
  animation: buffalo-gait 0.42s ease-in-out infinite;
}

@keyframes roam {
  0%        { left: -80px; transform: scaleX(-1); }
  47%       { left: 100%;  transform: scaleX(-1); }
  47.001%   { left: 100%;  transform: scaleX(1); }
  94%       { left: -80px; transform: scaleX(1); }
  94.001%   { left: -80px; transform: scaleX(-1); }
  100%      { left: -80px; transform: scaleX(-1); }
}

/* Bob up on the push-off, dip and tilt on the plant. */
@keyframes buffalo-gait {
  0%   { transform: translateY(0) rotate(0deg); }
  25%  { transform: translateY(-5px) rotate(-2.5deg); }
  50%  { transform: translateY(0) rotate(0deg); }
  75%  { transform: translateY(-3px) rotate(2.5deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .buffalo, .buffalo span, .wander-stage::after { animation: none; }
  .buffalo { left: 40%; transform: scaleX(-1); }
}

.big-btn {
  display: block;
  margin: 12px auto;
  background: var(--accent);
  color: var(--ink);
  border: none;
  padding: 14px 36px;
  border-radius: 100px;
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--accent-dark);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }

/* Roam button: deep brown so it reads against the green/blue stage
   instead of competing with the game's orange Start button. */
#roamBtn {
  background: var(--accent2);
  color: #fff6e9;
  box-shadow: 0 6px 0 #7d3c12;
}
#roamBtn:active { box-shadow: 0 1px 0 #7d3c12; }

/* ---- Suggestion card: English, then Urdu, then Punjabi ---- */
.suggestion-card {
  max-width: 640px;
  margin: 6px auto 0;
  padding: 18px 22px;
  text-align: center;
  background: var(--card);
  border: 2px solid var(--accent3);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(90,50,20,0.12);
  animation: sg-pop 0.28s ease;
}
.suggestion-card[hidden] { display: none; }

@keyframes sg-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.sg-line { margin: 6px 0; line-height: 1.6; }
.sg-en { font-size: 1.18rem; font-weight: 700; color: var(--ink); }
.sg-ur { font-size: 1.1rem; color: var(--accent2); }
.sg-pa { font-size: 1.02rem; color: var(--muted); }

/* ---- Acting buffalo ---- */
/* Clipped so the "hide" act can duck right out of frame; the top padding
   keeps hops and horns from being clipped on the way up. */
.act-stage {
  width: min(300px, 78vw);
  margin: 4px auto 0;
  padding-top: 54px;
  overflow: hidden;
}
.bf2 { display: block; width: 100%; height: auto; }

.bf2-all,
.bf2-head,
.bf2-jaw,
.bf2-legs,
.bf2-leg,
.bf2-tail,
.bf2-pupil,
.bf2-lid,
.bf2-ear,
.prop {
  transform-box: fill-box;
  transform-origin: center;
}
.bf2-head { transform-origin: 50% 90%; }
.bf2-leg  { transform-origin: 50% 0%; }
.bf2-jaw  { transform-origin: 50% 20%; }
.bf2-tail { transform-origin: 0% 0%; }
.bf2-ear-l { transform-origin: 100% 50%; }
.bf2-ear-r { transform-origin: 0% 50%; }

/* Lids park just above the eyes and drop down to blink. */
.bf2-lid { transform: translateY(-38px); }
.bf2-o { opacity: 0; }
.prop { font-size: 30px; opacity: 0; }

/* Always-on life: breathing, idle blink, tail flick. */
.bf2-all { animation: bf-breathe 3.4s ease-in-out infinite; }
.bf2-lid { animation: bf-blink 5s ease-in-out infinite; }
.bf2-tail { animation: bf-tail 2.6s ease-in-out infinite; }

@keyframes bf-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.012); }
}
@keyframes bf-blink {
  0%, 92%, 100% { transform: translateY(-38px); }
  95%           { transform: translateY(0); }
}
@keyframes bf-tail {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-14deg); }
}

/* ---------- Acts ---------- */

/* stare — leans in slowly, eyes go huge, then one big deliberate blink */
[data-act="stare"] .bf2-all { animation: bf-lean 3.6s ease-in-out infinite; }
[data-act="stare"] .bf2-pupil { animation: bf-widen 3.6s ease-in-out infinite; }
[data-act="stare"] .bf2-lid { animation: bf-big-blink 3.6s ease-in-out infinite; }
[data-act="stare"] .bf2-ear { animation: bf-flick 3.6s ease-in-out infinite; }
@keyframes bf-lean {
  0%, 100% { transform: translateY(0) scale(1); }
  45%, 70% { transform: translateY(10px) scale(1.09); }
}
@keyframes bf-widen {
  0%, 100% { transform: scale(1); }
  45%, 70% { transform: scale(1.55); }
}
@keyframes bf-big-blink {
  0%, 84%, 100% { transform: translateY(-38px); }
  90%, 93%      { transform: translateY(0); }
}
@keyframes bf-flick {
  0%, 40%, 100% { transform: rotate(0deg); }
  50%           { transform: rotate(-22deg); }
}

/* pace — marches right across the stage and back, legs pumping */
[data-act="pace"] .bf2-all { animation: bf-pace 3s ease-in-out infinite; }
[data-act="pace"] .bf2-leg-l { animation: bf-step 0.4s ease-in-out infinite; }
[data-act="pace"] .bf2-leg-r { animation: bf-step 0.4s ease-in-out infinite reverse; }
[data-act="pace"] .bf2-head { animation: bf-nod 0.8s ease-in-out infinite; }
@keyframes bf-pace {
  0%, 100% { transform: translateX(-74px) scaleX(1); }
  46%      { transform: translateX(74px) scaleX(1); }
  50%      { transform: translateX(74px) scaleX(-1); }
  96%      { transform: translateX(-74px) scaleX(-1); }
}
@keyframes bf-step {
  0%, 100% { transform: rotate(26deg); }
  50%      { transform: rotate(-26deg); }
}

/* spin — whips around on the spot, tilting as it goes */
[data-act="spin"] .bf2-all { animation: bf-spin 1.6s linear infinite; }
[data-act="spin"] .bf2-leg-l { animation: bf-step 0.4s ease-in-out infinite; }
[data-act="spin"] .bf2-leg-r { animation: bf-step 0.4s ease-in-out infinite reverse; }
[data-act="spin"] .bf2-ear { animation: bf-flop 0.8s ease-in-out infinite; }
@keyframes bf-spin {
  0%       { transform: scaleX(1) rotate(0deg); }
  25%      { transform: scaleX(0.08) rotate(-5deg); }
  50%      { transform: scaleX(-1) rotate(0deg); }
  75%      { transform: scaleX(0.08) rotate(5deg); }
  100%     { transform: scaleX(1) rotate(0deg); }
}

/* nap — sinks down, head flops right over, zzz stream off */
[data-act="nap"] .bf2-lid { animation: none; transform: translateY(0); }
[data-act="nap"] .bf2-all { animation: bf-snore 3.4s ease-in-out infinite; }
[data-act="nap"] .bf2-head { animation: bf-droop 3.4s ease-in-out infinite; }
[data-act="nap"] .bf2-ear { animation: bf-flop 3.4s ease-in-out infinite; }
[data-act="nap"] .bf2-leg { animation: bf-sit-legs 3.4s ease-in-out infinite; }
[data-act="nap"] .prop-zzz { animation: bf-float 1.7s ease-out infinite; }
@keyframes bf-snore {
  0%, 100% { transform: translateY(22px) scale(1.02, 0.9); }
  50%      { transform: translateY(28px) scale(1.06, 0.86); }
}
@keyframes bf-droop {
  0%, 100% { transform: rotate(14deg) translateY(16px); }
  50%      { transform: rotate(20deg) translateY(22px); }
}
@keyframes bf-float {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translate(26px, -60px) scale(1.4); }
}

/* munch — jaw chomps hard, whole head works at it */
[data-act="munch"] .bf2-jaw { animation: bf-chew 0.34s ease-in-out infinite; }
[data-act="munch"] .bf2-head { animation: bf-munch-head 0.68s ease-in-out infinite; }
[data-act="munch"] .bf2-ear { animation: bf-flop 0.68s ease-in-out infinite; }
@keyframes bf-chew {
  0%, 100% { transform: scaleY(1) translateY(0); }
  50%      { transform: scaleY(0.62) translateY(11px); }
}
@keyframes bf-munch-head {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(9px) rotate(3deg); }
}
@keyframes bf-nod {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(7px); }
}

/* lookup — cranes right back, eyes roll up, cloud sails past */
[data-act="lookup"] .bf2-all { animation: bf-lean-back 4s ease-in-out infinite; }
[data-act="lookup"] .bf2-head { animation: bf-lookup 4s ease-in-out infinite; }
[data-act="lookup"] .bf2-pupil { animation: bf-eyes-up 4s ease-in-out infinite; }
[data-act="lookup"] .prop-cloud { animation: bf-drift 4.5s linear infinite; }
@keyframes bf-lean-back {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45%, 70% { transform: translateY(-8px) rotate(-4deg); }
}
@keyframes bf-lookup {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  45%, 70% { transform: rotate(-24deg) translateY(-16px); }
}
@keyframes bf-eyes-up {
  0%, 100% { transform: translateY(0); }
  45%, 70% { transform: translateY(-11px); }
}
@keyframes bf-drift {
  0%   { opacity: 0; transform: translateX(-30px); }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(80px); }
}

/* shrug — big heave up, head swings, ears fly */
[data-act="shrug"] .bf2-all { animation: bf-shrug 1.6s ease-in-out infinite; }
[data-act="shrug"] .bf2-head { animation: bf-rock 1.6s ease-in-out infinite; }
[data-act="shrug"] .bf2-ear { animation: bf-flop 0.8s ease-in-out infinite; }
[data-act="shrug"] .bf2-leg { animation: bf-splay 1.6s ease-in-out infinite; }
@keyframes bf-shrug {
  0%, 100% { transform: translateY(0) scaleY(1); }
  20%      { transform: translateY(6px) scaleY(0.92); }
  50%      { transform: translateY(-26px) scaleY(1.07); }
  75%      { transform: translateY(0) scaleY(1); }
}
@keyframes bf-rock {
  0%, 100% { transform: rotate(-15deg); }
  50%      { transform: rotate(15deg); }
}
@keyframes bf-flop {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(34deg); }
}
@keyframes bf-splay {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(15deg); }
}

/* dance — bounces hard, rocks, kicks, notes everywhere */
[data-act="dance"] .bf2-all { animation: bf-dance 0.5s ease-in-out infinite; }
[data-act="dance"] .bf2-head { animation: bf-rock 0.5s ease-in-out infinite; }
[data-act="dance"] .bf2-leg-l { animation: bf-kick 0.5s ease-in-out infinite; }
[data-act="dance"] .bf2-leg-r { animation: bf-kick 0.5s ease-in-out infinite reverse; }
[data-act="dance"] .bf2-ear { animation: bf-flop 0.25s ease-in-out infinite; }
[data-act="dance"] .prop-note { animation: bf-float 1s ease-out infinite; }
[data-act="dance"] .prop-sparkle { animation: bf-float 1s ease-out infinite 0.5s; }
@keyframes bf-dance {
  0%, 100% { transform: translateY(0) rotate(-9deg) scaleY(0.96); }
  50%      { transform: translateY(-24px) rotate(9deg) scaleY(1.05); }
}
@keyframes bf-kick {
  0%, 100% { transform: rotate(34deg); }
  50%      { transform: rotate(-34deg); }
}

/* sniff — nose right down to the floor, quick twitching */
[data-act="sniff"] .bf2-all { animation: bf-sniff-body 2.6s ease-in-out infinite; }
[data-act="sniff"] .bf2-head { animation: bf-sniff 2.6s ease-in-out infinite; }
[data-act="sniff"] .bf2-jaw { animation: bf-twitch 0.22s ease-in-out infinite; }
[data-act="sniff"] .bf2-ear { animation: bf-flop 1.3s ease-in-out infinite; }
[data-act="sniff"] .prop-sparkle { animation: bf-float 2s ease-out infinite; }
@keyframes bf-sniff-body {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45%, 70% { transform: translateY(14px) rotate(4deg); }
}
@keyframes bf-sniff {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  45%, 70% { transform: rotate(16deg) translateY(34px); }
}
@keyframes bf-twitch {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50%      { transform: translateY(-5px) scaleY(0.9); }
}

/* whistle — head thrown back, mouth pursing, notes streaming */
[data-act="whistle"] .bf2-mouth { opacity: 0; }
[data-act="whistle"] .bf2-o { opacity: 1; animation: bf-purse 0.55s ease-in-out infinite; }
[data-act="whistle"] .bf2-all { animation: bf-whistle-body 1.6s ease-in-out infinite; }
[data-act="whistle"] .bf2-head { animation: bf-whistle-head 1.6s ease-in-out infinite; }
[data-act="whistle"] .prop-note { animation: bf-float 1.1s ease-out infinite; }
[data-act="whistle"] .prop-sparkle { animation: bf-float 1.1s ease-out infinite 0.55s; }
@keyframes bf-purse {
  0%, 100% { r: 10; }
  50%      { r: 4; }
}
@keyframes bf-whistle-body {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-8px) rotate(4deg); }
}
@keyframes bf-whistle-head {
  0%, 100% { transform: rotate(-12deg) translateY(-6px); }
  50%      { transform: rotate(12deg) translateY(-12px); }
}

/* sit — drops down, legs tuck under */
[data-act="sit"] .bf2-all { animation: bf-sit 4s ease-in-out infinite; }
[data-act="sit"] .bf2-leg { animation: bf-sit-legs 4s ease-in-out infinite; }
[data-act="sit"] .bf2-head { animation: bf-sit-head 4s ease-in-out infinite; }
/* Stand, plop down with a small bounce, settle, then get back up. */
@keyframes bf-sit {
  0%, 12%   { transform: translateY(0) scaleY(1); }
  26%       { transform: translateY(32px) scaleY(0.84); }
  34%       { transform: translateY(26px) scaleY(0.91); }
  80%       { transform: translateY(26px) scaleY(0.91); }
  92%, 100% { transform: translateY(0) scaleY(1); }
}
@keyframes bf-sit-legs {
  0%, 12%   { transform: scaleY(1); }
  26%, 80%  { transform: scaleY(0.38); }
  92%, 100% { transform: scaleY(1); }
}
@keyframes bf-sit-head {
  0%, 12%   { transform: rotate(0deg) translateY(0); }
  26%       { transform: rotate(0deg) translateY(-6px); }
  40%, 80%  { transform: rotate(4deg) translateY(0); }
  92%, 100% { transform: rotate(0deg) translateY(0); }
}

/* hide — drops right out of sight, then sneaks a peek back up */
[data-act="hide"] .bf2-all { animation: bf-hide 3.4s ease-in-out infinite; }
[data-act="hide"] .bf2-pupil { animation: bf-shifty 3.4s ease-in-out infinite; }
@keyframes bf-hide {
  0%, 8%    { transform: translateY(0); }
  22%, 52%  { transform: translateY(190px); }
  66%, 78%  { transform: translateY(120px); }
  92%, 100% { transform: translateY(0); }
}
@keyframes bf-shifty {
  0%, 60%, 100% { transform: translateX(0); }
  70%           { transform: translateX(-7px); }
  82%           { transform: translateX(7px); }
}

/* ponder — head swings right over, eyes roll up, bubble pulses */
[data-act="ponder"] .bf2-all { animation: bf-ponder-body 3.4s ease-in-out infinite; }
[data-act="ponder"] .bf2-head { animation: bf-ponder 3.4s ease-in-out infinite; }
[data-act="ponder"] .bf2-pupil { animation: bf-ponder-eyes 3.4s ease-in-out infinite; }
[data-act="ponder"] .bf2-ear { animation: bf-flop 3.4s ease-in-out infinite; }
[data-act="ponder"] .prop-think { animation: bf-pulse 1.7s ease-in-out infinite; }
@keyframes bf-ponder-body {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}
@keyframes bf-ponder {
  0%, 100% { transform: rotate(-26deg); }
  50%      { transform: rotate(14deg); }
}
@keyframes bf-ponder-eyes {
  0%, 100% { transform: translate(-6px, -9px); }
  50%      { transform: translate(6px, -9px); }
}
@keyframes bf-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1; transform: scale(1.25); }
}

/* celebrate — big air, legs kicking, confetti everywhere */
[data-act="celebrate"] .bf2-all { animation: bf-hop 0.66s ease-in-out infinite; }
[data-act="celebrate"] .bf2-head { animation: bf-rock 0.66s ease-in-out infinite; }
[data-act="celebrate"] .bf2-leg-l { animation: bf-kick 0.66s ease-in-out infinite; }
[data-act="celebrate"] .bf2-leg-r { animation: bf-kick 0.66s ease-in-out infinite reverse; }
[data-act="celebrate"] .bf2-ear { animation: bf-flop 0.33s ease-in-out infinite; }
[data-act="celebrate"] .prop-party { animation: bf-float 0.9s ease-out infinite; }
[data-act="celebrate"] .prop-sparkle { animation: bf-float 0.9s ease-out infinite 0.45s; }
@keyframes bf-hop {
  0%, 100% { transform: translateY(0) scaleY(0.9) scaleX(1.05); }
  20%      { transform: translateY(-46px) scaleY(1.12) scaleX(0.94); }
  55%      { transform: translateY(0) scaleY(0.88) scaleX(1.07); }
}

@media (prefers-reduced-motion: reduce) {
  .bf2-all, .bf2-head, .bf2-jaw, .bf2-leg, .bf2-tail,
  .bf2-pupil, .bf2-lid, .bf2-ear, .prop { animation: none !important; }
}

.kattay-card {
  background: var(--card);
  border: 2px solid var(--accent2);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 8px var(--accent3);
}
.kattay-emoji { font-size: 3rem; margin-bottom: 10px; }
.kattay-text { font-size: 1.15rem; font-weight: 600; }

.game-wrap {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 900 / 420;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  border: 6px solid var(--ink);
  box-shadow: 0 18px 40px rgba(90,50,20,0.25);
  background: #000;
  touch-action: none;
}

canvas { display: block; width: 100%; height: 100%; }

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 10, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Above the thumb pads, so they're covered on the start and game-over
     screens rather than floating over the buttons. */
  z-index: 10;
}
.game-overlay.hidden { display: none; }
.overlay-inner { padding: 20px; }
.overlay-inner h3 { margin-top: 0; font-family: "Baloo 2", sans-serif; }
.overlay-inner p { color: #ffe9c7; }
.best-score { margin-top: 10px; color: #ffd9a0; font-weight: 700; }

.touch-controls {
  display: flex;
  gap: 14px;
  max-width: 520px;
  margin: 18px auto 0;
}
.touch-controls button {
  flex: 1;
  min-height: 56px;
  border-radius: 16px;
  border: none;
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
#touchUp { background: var(--accent); box-shadow: 0 5px 0 var(--accent-dark); }
#touchDown { background: #e8d3b4; box-shadow: 0 5px 0 #c0a882; }
.touch-controls button:active { transform: translateY(3px); box-shadow: none; }

/* ---- On-screen thumb pads (phones/tablets) ----
   Overlaid on the canvas so both thumbs stay on the game instead of
   reaching for a bar underneath. Hidden by default; enabled only for
   coarse pointers below. */
.thumb-pads { display: none; }

/* Vertically centred on each edge — that's where a thumb naturally sits
   when holding a phone, and it keeps the pads clear of the buffalo, which
   runs along the bottom of the canvas. Hollow ring rather than a filled
   disc so nothing behind them is hidden. */
.pad {
  position: absolute;
  top: 50%;
  width: 15%;
  max-width: 62px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(30, 18, 10, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(17px, 4.6vw, 24px);
  line-height: 1;
  font-weight: 700;
  display: grid;
  place-items: center;
  z-index: 6;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  transform: translateY(-50%);
  transition: background 0.1s ease, transform 0.1s ease, border-color 0.1s ease;
}
.pad-jump { left: 2.5%; }
.pad-duck { right: 2.5%; }
/* Keeps the centring translate — a bare scale() here would drop it. */
.pad:active {
  background: rgba(255, 138, 61, 0.75);
  border-color: rgba(255, 255, 255, 0.95);
  color: #fff;
  transform: translateY(-50%) scale(0.9);
}

/* Only devices that actually need them: touch input, no hover. The bar
   buttons and the hint text swap over at the same time. */
.hint-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
  .thumb-pads { display: block; }
  .touch-controls { display: none; }
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}

/* Each script sits in its own nowrap element — mixing RTL and LTR in one
   wrapping run garbles the Urdu. */
.title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  text-align: center;
  margin-bottom: 8px;
}
.title-row > span:first-child {
  font-size: clamp(26px, 5.5vw, 42px);
  color: var(--ink);
  white-space: nowrap;
}
.title-row .script-line {
  font-size: clamp(17px, 3.4vw, 24px);
  color: var(--accent2);
  white-space: nowrap;
}
[lang="ur"] {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
}

.name-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 6px;
  font-weight: 600;
}
.name-row > span:first-child { color: var(--ink); white-space: nowrap; }
.name-row .script-line {
  color: var(--accent2);
  white-space: nowrap;
  unicode-bidi: isolate;
}

.subtitle-block { text-align: center; margin-bottom: 18px; }
.subtitle-block .subtitle { margin: 4px 0; font-size: clamp(15px, 2.6vw, 19px); }
.subtitle-block [lang="ur"],
.subtitle-block [lang="pa"] { font-size: clamp(14px, 2.5vw, 18px); }

.hint-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin: 14px auto 0;
  font-size: 14px;
  color: var(--muted);
}

/* ---- Manifesto: styled as a mock-official charter ---- */
.charter {
  max-width: 720px;
  margin: 0 auto;
  padding: 42px clamp(22px, 5vw, 54px) 36px;
  background: var(--card);
  border: 2px solid var(--accent3);
  border-radius: 6px;
  box-shadow: 0 0 0 7px var(--card), 0 0 0 9px var(--accent2),
              0 18px 40px rgba(90,50,20,0.18);
  text-align: center;
}

.charter-crest { font-size: 2.6rem; line-height: 1; }

.charter-title {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  margin: 6px 0 4px;
  letter-spacing: 0.01em;
}

.charter-sub {
  max-width: 42ch;
  margin: 0 auto 22px;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--muted);
}

.charter-preamble {
  position: relative;
  margin: 0 0 26px;
  padding: 20px 0;
  border-top: 1px solid var(--accent3);
  border-bottom: 1px solid var(--accent3);
  font-size: 1rem;
  line-height: 1.75;
  text-align: left;
  color: var(--ink);
}

/* Roman numerals, because a charter with plain digits is not a charter. */
.articles {
  list-style: none;
  counter-reset: article;
  margin: 0;
  padding: 0;
  text-align: left;
}
.articles > li {
  counter-increment: article;
  padding: 16px 0 16px 62px;
  position: relative;
  border-bottom: 1px dashed rgba(181,89,31,0.28);
}
.articles > li:last-child { border-bottom: 0; }
.articles > li::before {
  content: "Art. " counter(article, upper-roman);
  position: absolute;
  left: 0;
  top: 19px;
  width: 54px;
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent2);
  text-transform: uppercase;
}
.articles h3 {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.08rem;
  margin: 0 0 4px;
}
.articles p { margin: 0; line-height: 1.7; color: var(--muted); }

.charter-oath-label {
  margin: 30px 0 10px;
  font-family: "Fredoka", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent2);
}

.charter-oath {
  padding: 18px 20px;
  background: #fff6e3;
  border: 1px solid var(--accent3);
  border-radius: 12px;
}
.charter-oath p { margin: 6px 0; line-height: 1.8; }
.charter-oath p:first-child { font-weight: 700; color: var(--ink); }
.charter-oath [lang="ur"],
.charter-oath [lang="pa"] { color: var(--accent2); }

.charter-seal { margin-top: 30px; }
.seal-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  border: 2px dashed var(--accent2);
  border-radius: 50%;
  transform: rotate(-9deg);
}
.seal-text {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.65;
  color: var(--muted);
}
.seal-fine {
  margin: 12px 0 0;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: #b08762;
}

/* ---- Legal page ---- */
.legal-doc {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 4px 20px;
}
.legal-doc h2 {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  margin-bottom: 4px;
  text-align: center;
}
.legal-updated {
  margin: 0 0 22px;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.legal-intro {
  padding: 16px 18px;
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  line-height: 1.75;
}
.legal-doc h3 {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.12rem;
  margin: 26px 0 6px;
  color: var(--accent2);
}
.legal-doc p,
.legal-doc li { line-height: 1.75; color: var(--ink); }
.legal-doc ul { padding-left: 20px; }
.legal-doc li { margin-bottom: 12px; }
.legal-doc a { color: var(--accent2); }
.legal-footnote {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed var(--accent3);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  text-align: center;
}

footer {
  text-align: center;
  padding: 16px;
  color: var(--accent-dark);
  font-size: 0.85rem;
}
.footer-links {
  margin: 6px 0 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 0.82rem;
}
.footer-links a {
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer-links a:hover { border-bottom-color: var(--accent2); }

