/* ============================================================
   Kancha Go — Home / main menu
   Every visual is a discrete element so real PNG/SVG art can be
   swapped in by setting background-image, with no layout change.
   ============================================================ */

#home {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: max(12px, var(--safe-area-inset-top, env(safe-area-inset-top))) 14px calc(96px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  color: #fff;
  --px: 0;
  --py: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* parallax background */
.home__bg {
  position: absolute;
  inset: -7%;
  background: #3a2a18 url("assets/home-bg.jpg") center top / cover no-repeat;
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -10px), 0) scale(1.08);
  transition: transform 0.18s ease-out;
  z-index: 0;
}
.home__vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 6%, rgba(255, 225, 160, 0.16), transparent 55%),
    linear-gradient(rgba(20, 12, 4, 0.22) 0%, rgba(20, 12, 4, 0) 26%, rgba(28, 17, 6, 0.55) 62%, rgba(14, 9, 3, 0.9) 100%);
}
#home > *:not(.home__bg):not(.home__vignette) { position: relative; z-index: 2; }

/* ---- top bar ---- */
.home__top {
  width: 100%;
  max-width: 460px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.coin-panel,
.icon-round {
  border: 1px solid rgba(255, 214, 140, 0.55);
  background: linear-gradient(180deg, #3a3126, #1c1712);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.profile-panel {
  display: block;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 999px;
  cursor: pointer;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}
.profile-panel img { display: block; height: 44px; width: auto; }
.profile-panel:active { transform: scale(0.96); }
.home__topright { display: flex; align-items: center; gap: 6px; }
.coin-panel {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  color: #ffe6ad;
}
/* The two Home counters (energy + coins): your painted art, one picture each -- a medallion on the left of a
   wooden bar. A 9-slice (774 x 258 picture; left cap = the medallion, 257px; right cap 62px), so the round
   ends stay round and a long number just makes the bar longer. The coins picture is the same bar with the
   $ coin on it (built from the energy counter). */
.coin-panel.counter {
  --h: 32px;
  height: var(--h);
  box-sizing: border-box;
  min-width: calc(var(--h) * 2.3);
  align-items: center;
  gap: 4px;
  padding: 0 2px 2px 4px;
  border: 0 solid transparent;
  border-width: 0 calc(var(--h) * 0.24) 0 var(--h);
  border-image: var(--art) 0 62 0 257 fill / 0 calc(var(--h) * 0.24) 0 var(--h) stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font: 700 15px/1 "Fredoka", system-ui, sans-serif;
  color: #fff8e1;
  text-shadow: -1.5px 0 #4a2205, 1.5px 0 #4a2205, 0 -1.5px #4a2205, 0 1.5px #4a2205, 0 2px 2px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
  -webkit-tap-highlight-color: transparent;
}
.counter--energy { --art: url(assets/energy-counter.png); }
.counter--coins { --art: url(assets/coin-counter.png); }
.counter:active { transform: translateY(1px); }
.counter--energy.is-empty b { color: #ff7a66; } /* 0/5 */
.counter__plus { display: block; flex: none; width: 20px; height: 20px; margin-left: 2px; }
.icon-round {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
}
/* the user's own gear icon (assets/ui-settings-icon-gold.png -- cropped to
   just the gold gear, dropping its blue badge, since this button already
   draws its own round dark badge) instead of the plain "⚙" glyph. */
#home-settings {
  font-size: 0;
  background-image: url("assets/ui-settings-icon-gold.png"), linear-gradient(180deg, #3a3126, #1c1712);
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: 58%, cover;
}

/* ---- hero: logo + taglines ---- */
.home__hero {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: translate3d(calc(var(--px) * 6px), calc(var(--py) * 6px), 0);
  transition: transform 0.18s ease-out;
}
.logo {
  margin: 0;
  /* pushed down clear of the top bar -- same full logo size as before, just
     moved down instead of shrunk to fit */
  margin-top: 36px;
  text-align: center;
  animation: logoFloat 5s ease-in-out infinite;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}
.logo img {
  display: block;
  width: min(78vw, 420px, 34.5vh);
  height: auto;
  margin: 0 auto;
}
.tagline {
  margin: 10px 0 0;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(15px, 4.6vw, 22px);
  color: #f4ead6;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.tagline em { color: #ffd15a; font-style: normal; }
.chalk {
  position: absolute;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(11px, 3.4vw, 16px);
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
.chalk--l { left: 0; top: 12%; transform: rotate(-8deg); }
.chalk--r { right: 0; top: 6%; text-align: right; transform: rotate(6deg); }

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-10px) rotate(0.6deg); }
}

/* ---- glass buttons ---- */
.home__buttons {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.2vw, 12px);
}
.home__row2 { display: flex; gap: clamp(6px, 2vw, 10px); width: 100%; }

.gbtn {
  --c1: #4ee187;
  --c2: #1f9e54;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: clamp(12px, 3.4vw, 18px) clamp(14px, 4vw, 22px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    inset 0 -8px 14px rgba(0, 0, 0, 0.28),
    0 8px 18px rgba(0, 0, 0, 0.45),
    0 0 24px -6px var(--c1);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}
.gbtn::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 6%;
  height: 34%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  pointer-events: none;
}
@media (hover: hover) {
  .gbtn:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.12) saturate(1.05); }
}
.gbtn:active { transform: translateY(2px) scale(0.97); filter: brightness(0.96); }

.gbtn--play {
  width: 100%;
  font-size: clamp(20px, 6vw, 30px);
  padding: clamp(14px, 4.4vw, 22px);
  animation: logoFloat 6s ease-in-out infinite;
}
/* real button artwork (pill shape, glow, glass shine already baked in) --
   strip the CSS chrome, just size the image. */
.gbtn--img {
  background: none;
  box-shadow: none;
  padding: 0;
  flex: 1;
  display: flex;
  justify-content: center;
}
.gbtn--img::after { content: none; }
.gbtn--img img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
}
.gbtn--play.gbtn--img { max-width: 280px; margin: 0 auto; }
.gbtn--play.gbtn--img img { max-width: 100%; }
/* Solo Challenge: a touch smaller than Play Online, on purpose -- it's the
   secondary mode on Home, Play Online is the primary one */
/* each button PNG has a different amount of transparent canvas baked in
   above/below its pill (Solo Challenge and Play with Friends noticeably
   more than Play Online), so the equal flex `gap` above still left visibly
   uneven space between the pills themselves -- pulled up to compensate,
   measured against the real rendered pixels, not the PNG canvas size. */
.gbtn--challenge.gbtn--img { max-width: 250px; margin: -22px auto 0; }
.gbtn--challenge.gbtn--img img { max-width: 100%; }
/* a single centred secondary button below Play Now (Practice / How to Play
   moved into the bottom nav, so Play with Friend stands alone here now) */
/* (the class names are swapped: .gbtn--solo is the Play with Friends button.) Its picture (btn-play-friend.webp) is cropped tight to the
   button, unlike the Solo and Play Online PNGs above which carry transparent canvas. So it is as wide as Solo Challenge (250 px,
   keeping the order Play Online > the other two) and pulled up only 9 px: that keeps the whole button stack exactly as tall as it was
   with the old picture, so the logo, the tagline and the bottom menu stay where they were, and the gap under Solo matches the gap
   under Play Online.
   Then made a little smaller (250 -> 220 px wide, so 94 -> 83 px tall): 4 px less pull-up on top plus 7 px of margin below give
   back the 11 px of height it lost, so the stack is still the same height and nothing else on Home moves. */
.gbtn--solo.gbtn--img { max-width: 220px; margin: -5px auto 7px; }
.gbtn--solo.gbtn--img img { max-width: 100%; }

/* ---- gbtn2: flat cartoon "banner" buttons (slanted parallelogram, bold
   outlined text, a little icon tab on the left) -- reference style supplied
   by the user. One shape, colour set via --gbtn2-a/--gbtn2-b/--gbtn2-border. ---- */
.gbtn2 {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  cursor: pointer;
  clip-path: polygon(4% 0%, 100% 0%, 96% 100%, 0% 100%);
  padding: 14px 22px 14px 56px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #fff;
  -webkit-text-stroke: 1.5px var(--gbtn2-border);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--gbtn2-border), 0 6px 10px rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, var(--gbtn2-a) 0%, var(--gbtn2-b) 100%);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.45),
    inset 0 -10px 14px rgba(0, 0, 0, 0.22),
    0 5px 0 var(--gbtn2-border),
    0 10px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease, filter 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .gbtn2:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.08); }
}
.gbtn2:active { transform: translateY(2px) scale(0.97); filter: brightness(0.95); }
.gbtn2--green { --gbtn2-a: #a3f26a; --gbtn2-b: #349c1f; --gbtn2-border: #1f5c12; }
.gbtn2--yellow { --gbtn2-a: #ffe37a; --gbtn2-b: #e8a417; --gbtn2-border: #7a4a0a; }
.gbtn2--red { --gbtn2-a: #ff8a6a; --gbtn2-b: #d43a1f; --gbtn2-border: #6e1a0a; }
.gbtn2--purple { --gbtn2-a: #cd9dff; --gbtn2-b: #8a3fe0; --gbtn2-border: #4a1a7a; }
.gbtn2--play {
  max-width: 320px;
  margin: 0 auto;
  font-size: clamp(18px, 5.6vw, 26px);
  animation: logoFloat 6s ease-in-out infinite;
}
.gbtn2__tab {
  position: absolute;
  left: 7px;
  top: 50%;
  width: 38px;
  height: 66%;
  transform: translateY(-50%) skewX(-6deg);
  background: linear-gradient(180deg, #fff8e0, #ffe08a);
  border: 3px solid var(--gbtn2-border);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--gbtn2-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gbtn2__triangle {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid var(--gbtn2-border);
  transform: skewX(6deg);
}
.gbtn2__label { display: block; line-height: 1; }

.gbtn__ico { font-size: 1.1em; line-height: 1; }
.gbtn__ico--play {
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25);
  position: relative;
}
.gbtn__ico--play::before {
  content: "";
  position: absolute;
  left: 56%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0.42em solid transparent;
  border-left-color: #1f9e54;
  border-right-width: 0;
}
.gbtn__label { line-height: 1.05; text-align: center; }
.gbtn__chev { margin-left: auto; font-size: 1.3em; opacity: 0.8; }

.gbtn--gold { --c1: #ffc24a; --c2: #d67f14; flex: 1; font-size: clamp(13px, 3.6vw, 16px); color: #3a2200; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35); }
.gbtn--purple { --c1: #b06bff; --c2: #6a24c8; flex: 1; font-size: clamp(13px, 3.6vw, 16px); }
.gbtn--dark { --c1: #5a5f6b; --c2: #2b2f38; font-size: clamp(12px, 3.4vw, 15px); }
.gbtn--wide { width: 76%; }

/* ---- floating decorative marbles ---- */
.home__marbles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.fmarble {
  position: absolute;
  background: center / contain no-repeat;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
  animation: floatSpin 9s ease-in-out infinite;
}
.fmarble--1 { width: clamp(28px, 8vw, 46px); height: clamp(28px, 8vw, 46px); left: 4%; top: 38%; background-image: url("assets/marble-blue.png"); animation-delay: 0s; }
.fmarble--2 { width: clamp(24px, 7vw, 40px); height: clamp(24px, 7vw, 40px); right: 5%; top: 44%; background-image: url("assets/marble-green.png"); animation-delay: -3s; }
.fmarble--3 { width: clamp(18px, 5vw, 30px); height: clamp(18px, 5vw, 30px); left: 12%; top: 26%; background-image: url("assets/marble-green.png"); animation-delay: -5s; }
.fmarble--4 { width: clamp(22px, 6vw, 36px); height: clamp(22px, 6vw, 36px); right: 3%; top: 24%; background-image: url("assets/marble-blue.png"); animation-delay: -1.5s; }
@keyframes floatSpin {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(180deg); }
}

/* ---- bottom nav ---- */
.home__nav {
  position: absolute;
  left: 50%;
  bottom: max(10px, var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  width: min(94%, 460px);
  display: flex;
  z-index: 3;
}
/* The rule above centres the menu with left: 50% + translateX(-50%), which only works for position: absolute. But
   "#home > *:not(.home__bg):not(.home__vignette) { position: relative }" (near the top of this file) outranks it, so the menu
   has really been position: relative, IN the page flow (the layout of the buttons above it relies on that), and left: 50%
   shoved it to the right: about 11 px on a phone, far more on a tablet or a wide window. Keep it in the flow, where #home's
   align-items: center already centres it, and cancel only the sideways shift. (Making it truly absolute would pull it out
   of the flow and move the buttons down by the menu's height.) The doubled class outranks the rule above. */
#home > .home__nav.home__nav { left: 0; transform: none; }
/* the literal reference artwork as the bar itself (icons + labels baked in)
   -- an aspect-ratio box keeps it from distorting at any width. */
.home__nav--art {
  aspect-ratio: 2172 / 724;
  background: url("assets/nav-bar.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Practice / How to Play sit in wider segments of the art than the plain
   Friends/Leaderboard/Profile icons -- match the invisible hit-target to it. */
.nav-item[data-nav="practice"],
.nav-item[data-nav="howto"] { flex: 1.3; }
.nav-item.is-active { filter: drop-shadow(0 0 10px rgba(255, 207, 63, 0.8)); }
.nav-item:active { transform: scale(0.94); }

/* ---- online-match tickets (chip on Home + the card it opens) ---- */
/* The energy card is painted art (assets/energy-card.png: gold-framed blue panel, bolt badge,
   "ENERGY" title, empty inset), stretched as a 9-slice so it grows with its content. The slice
   lines sit inside the flat part of the inset (source px: 600 from the top, 358 from the bottom,
   115 from the sides, scaled to the 800px file). It is a fixed 340px wide; home.js (fitTicketsCard)
   scales the whole card down, never distorts it, on a small screen. */
.modal__card.is-tix { width: 340px; flex: none; }
.tix {
  box-sizing: border-box;
  width: 340px;
  text-align: center;
  font-family: "Fredoka", system-ui, sans-serif;
  border-style: solid;
  border-width: 188px 36px 112px 36px;
  border-image: url(assets/energy-card.png) 442 85 264 85 fill / 188px 36px 112px 36px stretch;
  padding: 4px 6px 2px;
}
.tix h2 { /* the title is painted on the card; kept for screen readers */
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.tix p { color: #cfe2ff; margin: 4px 0 8px; font-size: 15px; font-weight: 500; line-height: 1.3; }
.tix p b { color: #fff; font-weight: 700; }
.tix__pips { display: flex; justify-content: center; gap: 6px; margin: 6px 0 2px; }
.tix__pip { width: 34px; height: 34px; background: url(assets/energy-bolt-off.png) center / contain no-repeat; }
.tix__pip.is-on { background-image: url(assets/energy-bolt-on.png); }
.tix__actions { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 4px; }
/* Painted pill buttons (blank art; the label is live text). A 9-slice with round caps, so a button is only as
   wide as its label needs (min-width keeps the stack tidy) instead of stretching across the whole card. */
.tix .tix__actions button {
  --btn: url(assets/energy-btn-gold.png);
  --ol: #7a3a00; /* label outline colour */
  position: relative;
  min-width: 164px;
  min-height: 42px;
  padding: 6px 2px 8px;
  border: 0 solid transparent;
  border-width: 0 24px;
  border-image: var(--btn) 50% 80 50% 80 fill / 50% 24px 50% 24px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font: 700 16px/1.1 "Fredoka", system-ui, sans-serif;
  color: #fff8e1;
  text-shadow: -1.5px 0 var(--ol), 1.5px 0 var(--ol), 0 -1.5px var(--ol), 0 1.5px var(--ol),
    -1px -1px var(--ol), 1px -1px var(--ol), -1px 1px var(--ol), 1px 1px var(--ol), 0 3px 2px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.tix .tix__actions button::after { content: none; } /* the generic glossy overlay: the art has its own shine */
.tix .tix__actions button:active { transform: translateY(2px); filter: brightness(0.95); }
.tix .tix__actions button[data-act="tickets-solo"] { --btn: url(assets/energy-btn-green.png); --ol: #0d4a14; }
.tix .tix__actions button[data-act="tickets-ad"] { --btn: url(assets/energy-btn-purple.png); --ol: #3d0f66; }
.tix .tix__actions button[data-act="energy-remind"] { --btn: url(assets/energy-btn-blue.png); --ol: #0a2a68; }
.tix .tix__actions button[data-act="tickets-coins"] { --btn: url(assets/energy-btn-purple.png); --ol: #3d0f66; }
.tix .tix__actions button:disabled { --btn: url(assets/energy-btn-grey.png); --ol: #243044; opacity: 0.9; cursor: default; filter: none; transform: none; }
.tix-coin { width: 20px; height: 20px; margin-right: 6px; vertical-align: -5px; }

/* "Get +1 energy FREE!" -- the rewarded-video offer (home.js offerHtml): a lighter panel with the video
   icon on a slowly turning glow burst, the headline, the watched count and the green Watch button. Only
   exists when an ad is really on offer (ads.available()). */
.tix__offer {
  align-self: stretch; /* the offer panel keeps the full card width; only the buttons are compact */
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  padding: 8px 8px 8px 2px;
  overflow: hidden;
  text-align: left;
  border-radius: 16px;
  border: 2px solid #62c8ff;
  background: radial-gradient(120% 150% at 12% 50%, #3f8cf5 0%, #1f55bd 55%, #143b8e 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), inset 0 -8px 14px rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.35);
}
.tix__hero { position: relative; flex: none; width: 88px; height: 88px; display: grid; place-items: center; }
.tix__hero::before { /* the glow burst: a warm core + turning gold rays that fade out toward the edge */
  content: "";
  position: absolute;
  inset: -26px;
  background:
    radial-gradient(circle, #ffd24a 0%, rgba(255, 160, 40, 0.9) 26%, rgba(255, 110, 30, 0.45) 46%, rgba(255, 110, 30, 0) 64%),
    repeating-conic-gradient(rgba(255, 226, 90, 0.95) 0 9deg, rgba(255, 226, 90, 0) 9deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 14%, rgba(0, 0, 0, 0.75) 40%, transparent 68%);
  mask-image: radial-gradient(circle, #000 14%, rgba(0, 0, 0, 0.75) 40%, transparent 68%);
  animation: tix-burst 16s linear infinite;
}
.tix__hero img {
  position: relative;
  width: 86px;
  height: 86px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
  animation: tix-bob 2.2s ease-in-out infinite;
}
.tix__offer-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tix__offer-title {
  font: 700 17px/1 "Fredoka", system-ui, sans-serif;
  color: #fff8e1;
  --ol: #0c2f73;
  text-shadow: -1.5px 0 var(--ol), 1.5px 0 var(--ol), 0 -1.5px var(--ol), 0 1.5px var(--ol), 0 3px 2px rgba(0, 0, 0, 0.3);
}
.tix__offer-title b {
  display: block;
  margin-top: 1px;
  font-size: 27px;
  line-height: 0.95;
  color: #ffd83a;
  --ol: #7a3a00;
  text-shadow: -2px 0 var(--ol), 2px 0 var(--ol), 0 -2px var(--ol), 0 2px var(--ol), 0 4px 2px rgba(0, 0, 0, 0.35);
}
.tix .tix__offer-sub { margin: 0 0 2px; font-size: 13px; line-height: 1.2; color: #bfe1ff; }
.tix__offer-sub b { color: #fff; }
.tix .tix__actions .tix__offer button {
  --btn: url(assets/energy-btn-green.png);
  --ol: #0d4a14;
  white-space: nowrap; /* "Next in 40s" must never wrap onto a second line */
  min-width: 116px;
  border-width: 0 20px;
  border-image-width: 50% 20px;
  font-size: 17px;
}
.tix .tix__actions .tix__offer button:disabled { --btn: url(assets/energy-btn-grey.png); --ol: #243044; }
@keyframes tix-burst { to { transform: rotate(360deg); } }
@keyframes tix-bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .tix__hero::before, .tix__hero img { animation: none; } }
/* The two counters would push the Settings gear off a 360 dp phone: tighten the top bar below 400px, and below
   370px drop the + (it only says "coin store"; the whole counter is the button anyway) so a 5-digit coin
   number still fits. Measured at 320-460px with 250 and 12,345 coins. */
@media (max-width: 400px) {
  .home__top, .home__topright { gap: 4px; }
  .profile-panel img { height: 38px; }
  .coin-panel.counter { --h: 30px; font-size: 14px; }
}
@media (max-width: 369px) {
  .counter__plus { display: none; }
}
@media (max-width: 345px) {
  .profile-panel img { height: 32px; }
  .coin-panel.counter { --h: 28px; font-size: 13px; }
}

/* ---- "Energy full" banner on Home (index.html #energy-banner; built from the stashed notif-energy-full art) ---- */
.energy-banner {
  position: fixed;
  z-index: 40; /* over Home, under the modal (60) */
  left: 14px;
  right: 14px;
  top: calc(max(12px, var(--safe-area-inset-top, env(safe-area-inset-top))) + 54px);
  max-width: 432px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 18px;
  border: 1px solid #2f7fd8;
  background: linear-gradient(180deg, #123a73, #0b2147);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: energy-banner-in 0.35s ease-out;
}
.energy-banner[hidden] { display: none; }
.energy-banner__icon { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 2px solid #31a5ff; }
.energy-banner__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.energy-banner__text b { font-size: 15px; font-weight: 900; white-space: nowrap; }
.energy-banner__text span { font-size: 11px; color: #cfe2ff; }
.energy-banner__bolt { width: 16px; height: 16px; vertical-align: -2px; margin-right: 4px; }
.energy-banner__go {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(180deg, #4db2ff, #1677f2);
  box-shadow: 0 3px 0 #0b4fb0, inset 0 1px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
}
.energy-banner__go:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b4fb0; }
@keyframes energy-banner-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .energy-banner { animation: none; } }
@media (max-width: 345px) {
  .energy-banner__icon { width: 34px; height: 34px; }
  .energy-banner__text b { font-size: 13px; }
  .energy-banner__text span { font-size: 10px; }
  .energy-banner__go { padding: 8px 10px; font-size: 12px; }
}

/* ---- the shop (the "+" by the coins; src/shop-ui.js) ---- */
/* PLACEHOLDER look, all CSS. The pictures to paint to replace it are listed in docs/ASSETS.md ("Shop panel"):
   the panel, the pack card, the pack's hero picture (.shop__art), the Buy button and the "owned" badge. */
/* the shared modal card is 92% wide; the shop wants up to 360px of it (the X also pokes out past the corner) */
.modal__card:has(.shop) { width: min(100%, 360px); flex: none; }
.shop {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  padding: 16px 14px 14px;
  text-align: center;
  font-family: "Fredoka", system-ui, sans-serif;
  color: #eef4ff;
  background: linear-gradient(180deg, #2c5ba3, #10264d);
  border: 3px solid #f2a11c;
  border-radius: 22px;
  box-shadow: inset 0 0 0 2px #ffe382, 0 14px 40px rgba(0, 0, 0, 0.6);
}
.shop__title { margin: 0 0 10px; font-size: 28px; font-weight: 700; color: #ffe382; text-shadow: 0 3px 0 #7a3a00; }
.shop__x {
  position: absolute; top: -14px; right: -10px; width: 40px; height: 40px; padding: 0;
  background: none; border: 0; box-shadow: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}
.shop__x img { display: block; width: 100%; height: 100%; }
.shop__test {
  margin: 0 0 10px; padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  color: #4a2a05; background: repeating-linear-gradient(45deg, #ffd21a 0 10px, #f2b705 10px 20px);
}
.shop__card {
  display: grid;
  grid-template-columns: 78px 1fr;
  grid-template-areas: "art info" "act act";
  gap: 10px 12px;
  align-items: center;
  padding: 12px;
  text-align: left;
  background: rgba(4, 12, 32, 0.45);
  border: 1px solid #5aa0e6;
  border-radius: 16px;
}
.shop__card.is-owned { border-color: #62e35b; }
.shop__art {
  grid-area: art; width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%;
  font-size: 42px; line-height: 1; color: #7a3a00;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #f2a11c 68%, #b86a00);
  box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.45);
}
.shop__info { grid-area: info; min-width: 0; }
.shop__name { font-size: 22px; font-weight: 700; color: #fff; }
.shop__perks { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; font-weight: 500; line-height: 1.35; color: #cfe2ff; }
.shop__perks li { padding-left: 16px; position: relative; }
.shop__perks li::before { content: "✓"; position: absolute; left: 0; color: #62e35b; font-weight: 700; }
.shop__perks b { color: #fff; }
.shop__buy, .shop__owned { grid-area: act; justify-self: stretch; }
.shop__buy {
  position: relative; padding: 10px 16px; font: 700 17px/1.1 "Fredoka", system-ui, sans-serif; color: #4a2a05;
  background: linear-gradient(180deg, #ffe382, #f2a11c); border: 1px solid #fff2c0; border-radius: 999px;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.55), inset 0 -8px 14px rgba(0, 0, 0, 0.2), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.shop__buy:disabled { background: linear-gradient(180deg, #8a93a6, #5d6577); border-color: #aab2c3; color: #e6e9f0; box-shadow: none; }
.shop__owned {
  padding: 9px 16px; text-align: center; font-size: 17px; font-weight: 700; color: #0d4a14;
  background: linear-gradient(180deg, #9cf08a, #3fbd4a); border: 1px solid #d6ffd0; border-radius: 999px;
}
.shop__restore {
  margin-top: 10px; padding: 6px 12px; font: 600 14px "Fredoka", system-ui, sans-serif; color: #bfe1ff;
  background: none; border: 0; box-shadow: none; text-decoration: underline;
}
.shop__soon { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: #8fa6c8; }
.shop__dev {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; padding: 8px;
  border: 1px dashed #ffd21a; border-radius: 10px; font-size: 11px; color: #ffd21a;
}
.shop__dev span { flex: 1 0 100%; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.shop__dev button { padding: 4px 8px; font-size: 12px; }

/* the fake payment sheet of the test store (?teststore; src/shop.js) -- same idea as the test ad */
.teststore {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.82); font-family: "Fredoka", system-ui, sans-serif; color: #fff;
}
.teststore__card {
  width: min(100%, 320px); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 18px;
  border-radius: 18px; text-align: center; background: linear-gradient(180deg, #2a3350, #151b2e); border: 2px solid #4a5570;
}
.teststore__tag { padding: 2px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; background: #ffd21a; color: #4a2a05; }
.teststore__title { font-size: 24px; font-weight: 700; }
.teststore__price { font-size: 30px; font-weight: 700; color: #62e35b; }
.teststore__note { font-size: 12px; color: #9aa6c0; }
.teststore__pay { width: 100%; padding: 11px; font: 700 17px "Fredoka", system-ui, sans-serif; color: #0d3a16; background: linear-gradient(180deg, #9cf08a, #3fbd4a); border-color: #d6ffd0; border-radius: 999px; }
.teststore__cancel { font-family: inherit; font-size: 13px; padding: 6px 12px; color: #9aa6c0; background: none; border-color: transparent; box-shadow: none; text-decoration: underline; }

/* ---- shared modal ---- */
#modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 12, 24, 0.78);
}
.modal__card {
  position: relative;
  width: min(92%, 380px);
  background: linear-gradient(180deg, #294f8c, #10254a);
  border: 1px solid #5aa0e6;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  color: #eef4ff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
/* a "plain" popup: just its own art/content floating on the dim backdrop,
   no card box, border or shadow behind it */
.modal__card.is-plain { background: none; border: none; box-shadow: none; padding: 0; }

/* Daily Quest popup: the banner art has "Play"/"Not now" already painted in,
   so these sit as invisible hotspots over those exact painted positions
   (measured off the source art) instead of drawing real buttons on top. */
.daily-banner { position: relative; width: min(92%, 340px); margin: 0 auto; }
.daily-banner img { display: block; width: 100%; }
.daily-banner__hit {
  position: absolute;
  top: 71.5%;
  height: 21%;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
}
.daily-banner__hit--play { left: 6%; width: 43%; }
.daily-banner__hit--notnow { left: 51%; width: 43%; }
.modal__body h2 { margin: 0 0 8px; font-size: 20px; }
.modal__body ul { text-align: left; font-size: 13px; line-height: 1.6; padding-left: 18px; margin: 0 0 14px; }
/* pill + glossy shine -- same recipe as Home's Play/Solo/Friend button art,
   so "Got it" reads as one visual family with the rest of the app. */
.modal__close {
  position: relative;
  font: inherit;
  font-weight: 800;
  color: #4a2a05;
  background: linear-gradient(180deg, #ffe382, #f2a11c);
  border: 1px solid #fff2c0;
  border-radius: 999px;
  padding: 11px 26px;
  cursor: pointer;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    inset 0 -8px 14px rgba(0, 0, 0, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.modal__close::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 8%;
  height: 32%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.modal__close:active { transform: translateY(2px) scale(0.97); filter: brightness(0.96); }
@media (hover: hover) {
  .modal__close:hover { filter: brightness(1.1); }
}

/* The Energy card's own corner X -- real painted art (assets/energy-close-x.png),
   cropped from the user's own close-X badge already used on the Profile card
   (profile-card.png's `.profile__hit--close` hotspot), not a CSS shape -- so it's
   the same actual theme element, not an approximation of it. Only the Energy card
   uses this; every other modal (Friend room, How to Play, Coming soon) keeps "Got it". */
.modal__x {
  display: none;
  position: absolute;
  top: 78px;
  right: -8px;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  box-shadow: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  z-index: 2;
}
.modal__x img { display: block; width: 100%; height: 100%; }
.modal__card.is-tix .modal__x { display: flex; }
.modal__card.is-tix .modal__close { display: none; }
.modal__x:active { transform: translateY(1px) scale(0.94); }
@media (hover: hover) {
  .modal__x:hover { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)) brightness(1.1); }
}

/* Update-available card: the user's own supplied template art (update-card.png,
   1091x1442), real invisible hit-buttons over its painted close X / Update Now /
   Not Now -- same "art + invisible hotspots" pattern as .daily-banner/.profile
   below. Percentages are px-measured / 1091 (width) or / 1442 (height). */
.updatecard { position: relative; width: min(92%, 380px); margin: 0 auto; }
.updatecard__bg { display: block; width: 100%; height: auto; }
.updatecard__hit { position: absolute; border: none; background: none; box-shadow: none; padding: 0; margin: 0; cursor: pointer; }
.updatecard__hit--close { left: 85%; top: 15%; width: 10%; height: 7.5%; border-radius: 50%; }
.updatecard__hit--go { left: 18%; top: 65.5%; width: 65%; height: 9.5%; border-radius: 999px; }
.updatecard__hit--later { left: 34%; top: 80%; width: 33%; height: 5.5%; border-radius: 999px; }

/* ---- Profile card: the exact template PNG the user supplied
   (assets/profile-card.png) -- real text/values sit on top at coordinates
   measured off that image, same "art + invisible hotspots" pattern as
   .daily-banner above. Baloo 2 for every overlaid label, per the user's
   font brief. Percentages are all px-measured / 964 (width) or / 1632
   (height), so a square stays square regardless of the card's rendered size. */
.profile { position: relative; width: 100%; }
.profile__bg { display: block; width: 100%; height: auto; }
.profile__hit { position: absolute; border: none; background: none; box-shadow: none; padding: 0; margin: 0; }
button.profile__hit { cursor: pointer; }
.profile__hit--close { top: 4.9%; left: 84%; width: 14.5%; height: 8.6%; border-radius: 50%; }
.profile__hit--avatarphoto {
  /* matches the art's inner ring (the actual photo slot), not its outer
     gold rim -- the box was sized to the rim before, so the photo circle
     bulged past the ring and covered part of the pencil badge */
  top: 13.5%; left: 36.8%; width: 25.9%; height: 12.5%;
  border-radius: 50%; overflow: hidden;
}
.profile__avatarimg { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile__hit--avatarbtn { top: 22.9%; left: 55.7%; width: 9.2%; height: 5%; border-radius: 50%; }
.profile__hit--name {
  top: 29.6%; left: 24.79%; width: 50.31%; height: 6.56%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.profile__nametext {
  font-family: "Baloo 2", "Fredoka", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(11px, 3.6vw, 16px);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile__hit--nameedit { top: 29.6%; left: 67.6%; width: 7.1%; height: 6.56%; border-radius: 50%; }
.profile__hit--level {
  position: absolute;
  top: 36.7%; left: 33.61%; width: 32.99%; height: 2.76%;
  display: flex; align-items: center; justify-content: center;
  background: rgb(1, 30, 86); /* covers the template's baked-in "Level" word so the real "Level N" can be drawn fresh, centred --
    matches the pill's own flat interior colour exactly, and stops short of its glossy top/bottom bevel so the patch doesn't show */
  font-family: "Baloo 2", "Fredoka", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(11px, 3.4vw, 15px);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
/* The XP bar is its own painted picture (assets/xp-bar.webp: the star and the empty track, with a transparent background), laid
   over the card at the spot of the example bar that is baked into profile-card.png, and big enough to hide it completely. Placed so
   the new star sits on the old star and the track ends just past the old track's end; measured on the 964 x 1632 card: the picture
   is 800 px wide (83% of the card) with its left edge at x = 76 and its top at y = 634. The real fill is drawn on top of the track's
   navy inner area (x 292..1850, y 92..229 of the 1889 x 292 picture). */
.profile__xp {
  position: absolute;
  top: 38.86%; left: 7.88%; width: 83%;
  aspect-ratio: 1889 / 292;
  pointer-events: none;
}
.profile__xpimg { display: block; width: 100%; height: 100%; }
.profile__xpfill {
  position: absolute;
  left: 15.46%; top: 31.5%; width: 82.5%; height: 46.9%;
  box-sizing: border-box;
  padding: 2px; /* the fill sits just inside the track's edge (px, not %: vertical % padding is measured against the width) */
}
/* gold like the star: dark-orange outline, bright top. At least as wide as it is tall, so a few XP never draw as a thin crescent;
   not drawn at all at 0 XP (home.js). */
.profile__xpfill i {
  display: block;
  height: 100%;
  min-width: 9%;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1.5px solid #c27319;
  background: linear-gradient(180deg, #fee813 0%, #fdd602 55%, #fcbd00 100%);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.55);
}
.profile__val {
  position: absolute;
  width: 23.9%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Baloo 2", "Fredoka", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(10px, 3vw, 13px);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.profile__val--1, .profile__val--2 { top: 51.23%; height: 3.55%; }
.profile__val--3, .profile__val--4 { top: 60.05%; height: 3.62%; }
.profile__val--5, .profile__val--6 { top: 69.12%; height: 3.62%; }
.profile__val--7, .profile__val--8 { top: 78.31%; height: 3.68%; }
.profile__val--1, .profile__val--3, .profile__val--5, .profile__val--7 { left: 24.17%; width: 21.16%; }
.profile__val--2, .profile__val--4, .profile__val--6, .profile__val--8 { left: 68.26%; width: 21.47%; }
.profile__hit--gotit { top: 85.5%; left: 22.8%; width: 54.5%; height: 9.2%; }
.profile__note { color: var(--muted); font-size: 11px; font-weight: 600; margin: 10px 0 0; text-align: center; }

/* ---- Profile: the last few online matches, each with a Watch button (replay.js). Placeholder look: plain
   CSS, no painted art yet. ---- */
.recent {
  margin-top: 10px;
  padding: 10px 10px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1c4aa8, #0f2f72);
  border: 2px solid #4f86e8;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.14), 0 4px 8px rgba(0, 0, 0, 0.4);
  color: #fff;
}
.recent__head { margin: 0 0 6px; text-align: center; font-size: 15px; font-weight: 800; color: #ffe8a8; text-shadow: 0 1px 0 #6a3d08; }
/* (the .modal__body prefix beats the modal's own plain-list rule: indent, size, line height) */
.modal__body .recent__list { list-style: none; margin: 0; padding: 0; font-size: inherit; line-height: normal; display: flex; flex-direction: column; gap: 6px; }
.recent__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(5, 14, 40, 0.55);
  border-left: 4px solid #8aa0c8;
}
.recent__row--win { border-left-color: #3fd07a; }
.recent__row--lose { border-left-color: #ef5b4d; }
.recent__res { flex: none; width: 40px; font-size: 12px; font-weight: 800; letter-spacing: 0.4px; color: #cfe0f5; }
.recent__row--win .recent__res { color: #7bf0a8; }
.recent__row--lose .recent__res { color: #ff9a90; }
.recent__info { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.recent__info b { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__info small { font-size: 11px; font-weight: 600; color: #b9cbe8; }
.recent__info .recent__when { color: #8fa6cc; font-size: 10px; }
.recent__watch {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: #4a2a05;
  background: linear-gradient(180deg, #ffe382, #f2a11c);
  border: 2px solid #fff2c0;
  border-radius: 999px;
  box-shadow: 0 2px 0 #a86a0a;
  cursor: pointer;
}
.recent__watch i { font-style: normal; font-size: 10px; }
.recent__watch:active { transform: translateY(2px); box-shadow: none; }
.recent__empty { margin: 4px 6px 6px; text-align: center; font-size: 12px; font-weight: 600; line-height: 1.4; color: #cfe0f5; }

/* ---- Country flag: Profile chip + the searchable picker ---- */
.flag { width: 1.5em; height: 1.1em; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); vertical-align: -0.12em; flex: none; }
.profile__country {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin: 10px 0 0; padding: 9px 12px;
  border-radius: 999px; border: 1px solid #5aa0e6;
  background: linear-gradient(180deg, #294f8c, #10254a);
  color: #eef4ff; font: 700 13px/1 "Baloo 2", "Fredoka", system-ui, sans-serif;
  cursor: pointer;
}
.profile__country em { font-style: normal; font-size: 18px; line-height: 1; margin-left: 2px; opacity: 0.8; }
.profile__country .flag { font-size: 13px; }
/* optional Google sign-in block under the country chip */
.profile__acct {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin: 8px 0 0; padding: 9px 12px; box-sizing: border-box;
  border-radius: 999px; border: none; cursor: pointer;
  background: #fff; color: #1f2937; font: 700 13px/1 "Baloo 2", "Fredoka", system-ui, sans-serif;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.profile__acct:disabled { opacity: 0.7; cursor: default; }
.profile__g {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  color: #fff; font: 800 12px/1 system-ui, sans-serif;
}
.profile__acct--on {
  flex-direction: column; align-items: stretch; gap: 8px; border-radius: 16px;
  background: linear-gradient(180deg, #294f8c, #10254a); color: #eef4ff; border: 1px solid #5aa0e6; cursor: default;
}
.profile__acctline { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.profile__acctline span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile__acctbtns { display: flex; gap: 8px; }
.profile__acctbtns button {
  flex: 1; padding: 8px; border-radius: 999px; border: 1px solid #5aa0e6; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: #eef4ff; font: 700 12px/1 "Baloo 2", "Fredoka", system-ui, sans-serif;
}
.profile__acctbtns button.is-danger { border-color: #e0605a; color: #ffb3ae; }
.cpick { display: flex; flex-direction: column; gap: 10px; }
.cpick__title { font: 800 18px/1 "Baloo 2", "Fredoka", system-ui, sans-serif; }
.cpick__search {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
  border: 1px solid #5aa0e6; background: #0b1a36; color: #eef4ff; font-size: 16px; /* 16px stops iOS zooming on focus */
}
.cpick__list { max-height: min(46vh, 340px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; text-align: left; -webkit-overflow-scrolling: touch; }
.cpick__row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 1px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, 0.06);
  color: #eef4ff; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.cpick__row[hidden] { display: none; }
.cpick__row.is-on { border-color: #ffd21a; background: rgba(255, 210, 26, 0.16); }
.cpick__row .flag { font-size: 16px; }
.cpick__none { width: 1.5em; height: 1.1em; font-size: 16px; border: 1px dashed #7d93b8; border-radius: 2px; flex: none; }
/* the profile picture chooser: a grid of painted pictures, then the local-photo option */
.apick { display: flex; flex-direction: column; gap: 10px; }
.apick__note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.apick__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.apick__item {
  padding: 3px; aspect-ratio: 1; border: 2px solid transparent; border-radius: 16px; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); box-shadow: none;
}
.apick__item img { display: block; width: 100%; height: 100%; border-radius: 12px; object-fit: cover; }
.apick__item.is-on { border-color: #ffd21a; background: rgba(255, 210, 26, 0.18); }
.apick__photo {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 10px; cursor: pointer;
  color: #cfe0ff; font: 700 14px/1.1 "Baloo 2", "Fredoka", system-ui, sans-serif;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px; box-shadow: none;
}
.apick__photo small { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.cpick__back {
  padding: 10px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(180deg, #ffe382, #e0a82b); color: #3a2400; font: 800 14px/1 "Baloo 2", "Fredoka", system-ui, sans-serif;
}

/* ---- Settings card: the exact template PNG the user supplied
   (assets/settings-card.png), same "art + invisible hotspots" pattern as
   .profile above. The art's own checkbox glyph is always painted "on" --
   .settings__soundcover is a patch matching the card's local background
   that we show only while sound is OFF, so the real checked/unchecked
   state still reads correctly. */
.settings { position: relative; width: 100%; }
.settings__bg { display: block; width: 100%; height: auto; }
.settings__hit { position: absolute; border: none; background: none; box-shadow: none; padding: 0; margin: 0; }
button.settings__hit, a.settings__hit { cursor: pointer; }
.settings__hit--close { top: 9%; left: 81%; width: 11.5%; height: 17.5%; border-radius: 50%; }
.settings__soundinput,
.settings__soundcover {
  position: absolute;
  top: 42.09%; left: 83.33%; width: 5.53%; height: 8.4%;
}
.settings__soundinput { opacity: 0; cursor: pointer; z-index: 2; }
.settings__soundcover {
  border-radius: 22%;
  background: linear-gradient(180deg, #0a3f8c 0%, #04326f 55%, #002a6e 100%);
  border: 2px solid rgba(180, 220, 255, 0.5);
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}
.settings__soundinput:not(:checked) ~ .settings__soundcover { opacity: 1; }
.settings__hit--privacy { top: 58.2%; left: 9.38%; width: 25.06%; height: 5.67%; }
.settings__hit--gotit { top: 65.43%; left: 33.14%; width: 33.72%; height: 19.04%; }
.settings__note { color: var(--muted); font-size: 11px; font-weight: 600; margin: 10px 8px 0; text-align: center; line-height: 1.4; }
/* "Ad privacy choices": a plain text link, not one of the card's painted buttons */
.settings__link { background: none; border: none; box-shadow: none; padding: 10px 12px; margin: -6px 0; color: var(--cyan); font: inherit; text-decoration: underline; cursor: pointer; }

@media (max-height: 680px) {
  .logo img { width: min(60vw, 320px); }
  .chalk { display: none; }
}

/* small text links at the very bottom of Home (web only): the rules pages + privacy */
/* (doubled class: has to outrank "#home > *:not(...) { position: relative }" above) */
#home > .home__guides.home__guides {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(8px, var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 230, 173, 0.75);
}
#home .home__guides a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Tablets (and any tall, wide window): grow the Home column. The logo and the Play / Solo / Friends buttons have fixed pixel
   caps (420, 280, 250, 220 px) and the top bar and menu are capped at 460 px, so on a tablet they were a small phone-sized
   column in the middle of the screen. zoom scales a block and everything inside it together (logo, buttons, their overlaps,
   the top bar); the menu is a picture, so it only needs a wider cap (460 px x the zoom). Home is a stack that has to fit the
   window's height: measured, it needs about 163 px + 707 px x zoom, and with too much zoom the logo gets squeezed down over
   the tagline. So the zoom goes in steps by height, each the biggest that fits: 1.2 from 1020 px high (a 768 x 1024 tablet),
   1.3 from 1100 px. Shorter windows and phones (under 600 px wide) are unchanged (at 910-1019 px there would only be 5% to gain). */
@media (min-width: 600px) and (min-height: 1020px) {
  .home__top, .home__hero, .home__buttons { zoom: 1.2; }
  .home__nav { width: min(94%, 552px); }
}
@media (min-width: 600px) and (min-height: 1100px) {
  .home__top, .home__hero, .home__buttons { zoom: 1.3; }
  .home__nav { width: min(94%, 600px); }
}

/* ---- Play with a Friend: the supplied blue card (assets/friend-card.webp, 1386 x 1135) ----
   Every word and button is painted into the picture, so the real buttons sit invisibly over the painted ones
   (positions measured off the art, as percentages of the card, so it scales with any phone). */
.friendcard { position: relative; width: 100%; }
.friendcard__bg { display: block; width: 100%; height: auto; }
button.friendcard__hit {
  position: absolute;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  text-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.friendcard__hit:active { background: rgba(0, 0, 0, 0.2); transform: none; }
.friendcard__hit--create { left: 11.2%; top: 37.1%; width: 38%; height: 12.1%; }
.friendcard__hit--join { left: 51.2%; top: 37.1%; width: 37.7%; height: 12.1%; }
.friendcard__hit--lobby { left: 29.1%; top: 61.4%; width: 41.7%; height: 11.9%; }
.friendcard__hit--gotit { left: 34.4%; top: 75.6%; width: 31.1%; height: 11.1%; }
/* the room-code box that opens under the card when Join Room is tapped: same blue glow, gold Join */
.friendjoin { display: flex; gap: 8px; width: 88%; margin: 10px auto 0; }
.friendjoin[hidden] { display: none; }
.friendjoin input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 14px;
  font: 800 19px/1.1 "Baloo 2", "Fredoka", system-ui, sans-serif;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  background: rgba(2, 18, 72, 0.92);
  border: 2px solid #2fc3ff;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(47, 195, 255, 0.55), inset 0 0 10px rgba(47, 195, 255, 0.25);
  outline: none;
}
.friendjoin input::placeholder { color: #7fb4ee; letter-spacing: 0.12em; font-size: 14px; }
.friendjoin button {
  flex: none;
  padding: 10px 24px;
  font: 800 17px/1.1 "Baloo 2", "Fredoka", system-ui, sans-serif;
  color: #3a2204;
  background: linear-gradient(180deg, #ffe382, #f6b53a);
  border: 2px solid #fff3b0;
  border-radius: 999px;
  box-shadow: 0 3px 0 #a86a10;
  cursor: pointer;
}
.friendjoin button:active { transform: translateY(2px); box-shadow: 0 1px 0 #a86a10; }
/* the painted card has small words in it, so it may use nearly the whole phone width (the plain cards stay narrower) */
.modal__card:has(.friendcard) { width: min(calc(100vw - 16px), 400px); }

/* ---- "Rate Kancha Go" card (home.js reviewCardHtml; src/review.js decides when: only right after a win, Android app) ----
   The user's painted picture (assets/rate-card.webp, 760 x 704) used literally. Every word and both buttons are painted in,
   so two invisible buttons sit over the painted "Rate on Google Play" and "Not now" (measured off the art, % of the card). */
.reviewcard {
  position: relative;
  width: 100%;
  margin: 0 auto;
  animation: reviewPop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
/* the modal box sets the width (a card wider than its box would spill to one side, not sit in the middle) */
.modal__card:has(.reviewcard) { width: min(calc(100vw - 32px), 340px); }
@keyframes reviewPop { from { opacity: 0; transform: scale(0.86) translateY(10px); } to { opacity: 1; transform: none; } }
.reviewcard__bg { display: block; width: 100%; height: auto; }
button.reviewcard__hit {
  position: absolute;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  text-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.reviewcard__hit:active { background: rgba(0, 0, 0, 0.18); transform: none; }
.reviewcard__hit--go { left: 5.8%; top: 59.8%; width: 88.4%; height: 20.2%; }
.reviewcard__hit--later { left: 33%; top: 83.8%; width: 34%; height: 9.6%; }
@media (prefers-reduced-motion: reduce) { .reviewcard { animation: none; } }
