/* ============================================================
   Kancha Go -- Solo Run: the Home button, the level map, the level
   intro card, the in-level display, Undo Shot and the end-of-level
   cards. (Placeholder art: the Home button and the Undo icon are CSS
   until real art is supplied -- see docs/ASSETS.md.)
   ============================================================ */

/* ---- Home button (a banner button, like Play with Friends) ---- */
.gbtn2--solo {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  font-size: clamp(17px, 5vw, 22px);
  padding: 11px 16px 11px 54px;
}
.solo-ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gbtn2-border);
  background: radial-gradient(circle at 35% 30%, #fff 0 9%, #8fd6ff 12%, #1d74e6 58%, #0b2f7d 100%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

/* ---- the level map ---- */
#solo {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding-bottom: 8px;
  color: #fff;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: url("assets/solo-bg.jpg") center top / cover no-repeat, #071634;
  display: flex;
  flex-direction: column;
}
/* the back button stays put at the top (flex: none, its natural height);
   the card floats centered in whatever room is left below it instead of
   sitting flush under the header with empty background showing beneath. */
/* .solo__top already centers itself with max-width + margin:auto, which
   collides with flexbox's own stretch/auto-margin cross-axis behaviour
   (it was collapsing to content width and drifting to the middle) --
   align-self:center replaces that centering instead of fighting it. */
.solo__top { flex: none; align-self: center; width: 100%; margin: 0; }
/* the title used to be a separate image sharing this header row with the
   back button; the map background now bakes its own "Solo Challenge"
   title/marbles/leaves in at the top, so this header holds just the back
   button -- min-height replaces the height the title image used to give it,
   since an absolutely-positioned button contributes none of its own. */
.solo__top {
  position: relative;
  z-index: 2;
  min-height: 58px;
  max-width: 460px;
  margin: 0 auto;
  padding: max(12px, var(--safe-area-inset-top, env(safe-area-inset-top))) 14px 0;
}
.solo__top .ui-btn--back {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
/* .ui-btn:active's own transform (styles.css) would otherwise completely
   replace translateY(-50%) instead of adding to it, so the button visually
   jumps away from under the finger the instant it's pressed -- pointerdown
   lands on the button but pointerup (now over .solo__top instead) never
   fires a click. Keep the same centering, just also nudged for the press. */
.solo__top .ui-btn--back:active:not(:disabled) {
  transform: translateY(calc(-50% + 2px)) scale(0.97);
}
/* ---- Home's glossy pill buttons (Play Online / Solo Challenge / Play with
   Friends) all share one look: a rounded shape, a bright top gloss streak and
   a colour glow. The panels below reuse that same look, colour-coded per the
   product owner's choice, so this screen reads as the same glossy-pill
   family as Home instead of a flatter, separate style. ---- */
/* ---- Solo Challenge map: the single, uncropped template PNG the user
   supplied (assets/solo-map-bg.png) -- one continuous piece of art, no
   splitting it into slices. Header hotspots (prev/next/world text/Daily
   Quest/Play) are positioned by percentages measured off that image.
   The level grid sits in the image's blank body as a real CSS grid of
   true squares (aspect-ratio: 1); since a 4x5 grid of squares sized to
   the full body width would need more height than that blank body has
   (it would run into the baked-in Play pill), the squares are sized by
   the available HEIGHT instead and centred, leaving even gutters on the
   sides rather than stretching or shrinking the image itself. */
/* margin-top/bottom: auto -- #solo is now a flex column (see above) so this
   centers the card vertically in whatever room is left below the back
   button, instead of sitting flush under it with empty background below. */
.solomap { position: relative; width: 100%; max-width: 460px; margin: auto auto; padding: 0 10px; transform: translateY(-11%); }
.solomap__bg { display: block; width: 100%; height: auto; }
.solomap__hit { position: absolute; border: none; background: none; box-shadow: none; padding: 0; margin: 0; -webkit-tap-highlight-color: transparent; }
button.solomap__hit { cursor: pointer; }
.solomap__hit--prev { left: 6.64%; top: 12.96%; width: 18.26%; height: 9.96%; }
.solomap__hit--next { left: 75%; top: 12.96%; width: 18.36%; height: 9.96%; }

.solomap__hit--worldtext {
  left: 24.9%; top: 12.5%; width: 50.1%; height: 10.87%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  text-align: center; pointer-events: none;
  overflow: hidden; /* a safety net so all 3 lines never spill past the bar, even at odd viewport widths */
}
.solo__worldno { font-size: clamp(8px, 2.6vw, 10px); letter-spacing: 0.12em; color: #dcefff; font-weight: 600; line-height: 1; }
.solo__worldname { font-size: clamp(13px, 4.4vw, 18px); font-weight: 700; line-height: 1.05; color: #fff; text-shadow: 0 2px 0 #052a66; }
.solo__worldstat { font-size: clamp(8px, 2.6vw, 10px); color: #ffe27a; font-weight: 600; line-height: 1; }

.solomap__hit--daily { left: 6.5%; top: 23.44%; width: 87%; height: 6.44%; }
.solomap__dailysub {
  position: absolute; left: 57%; top: 0; width: 34%; height: 100%;
  display: flex; align-items: center;
  font-size: clamp(10px, 3.4vw, 13.5px); font-weight: 700; color: #fff3d6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  line-height: 1.15;
  pointer-events: none;
}
.solomap__dailychev {
  position: absolute; left: 89%; top: 20%; width: 8%; height: 60%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(16px, 5vw, 22px); color: #fff; opacity: 0.85;
  pointer-events: none;
}

.solomap__hit--play { left: 3.32%; top: 82.94%; width: 92.29%; height: 10.16%; }

/* 5 columns x 4 rows (still SOLO.PER_WORLD's 20 levels, just laid out
   wider). .solomap__gridwrap spans the card's flat interior fill (measured
   just past the glowing side rim, not the rim's own outer edge) and the
   full height budget between the Daily Quest bar and the Play pill, then
   flex-centers the grid inside it on BOTH axes -- the grid's own width is
   a little less than the wrap's, so there's real margin from the rim
   instead of sitting flush against it, and any leftover height (true
   squares sized by that narrower width don't need the whole budget)
   becomes an even gap above and below instead of being wasted at the
   bottom only. */
.solomap__gridwrap {
  position: absolute;
  left: 8.1%; top: 30%;
  width: 83.9%; height: 52.5%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.solomap__grid {
  width: 96%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(2px, 0.8vw, 4px);
}
.mstile { position: relative; aspect-ratio: 1; padding: 0; border: none; background: none; box-shadow: none; -webkit-tap-highlight-color: transparent; }
/* styles.css's site-wide button:disabled { opacity: 0.45 } would otherwise
   wash out every locked tile's number and lock icon -- .mstile:disabled has
   to out-specificity that rule, not just override it in source order (a
   plain .mstile{opacity:1} would still lose to it) */
.mstile:disabled { opacity: 1; }
.mstile__box {
  position: absolute;
  inset: 0;
  /* tiles are true squares (aspect-ratio: 1 on .mstile) matching the
     source art's own near-square shape, so "contain" needs no stretching
     to fill the box -- no distortion, unlike when tiles were wider than
     tall and the art had to be force-stretched to cover the gap */
  background: center / contain no-repeat;
  background-image: url("assets/solo-tilebox-gold.png");
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.mstile.is-locked .mstile__box { background-image: url("assets/solo-tilebox-locked.png"); }
.mstile.is-boss:not(.is-locked) .mstile__box { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)) hue-rotate(-42deg) saturate(1.35); }
/* a real flex column instead of hand-guessed top/height percentages for
   the number and the stars-or-lock below it -- flexbox centers the whole
   group both ways reliably at any tile size, instead of two independently
   inset bands that can drift off-centre as the tile itself resizes. */
.mstile__content {
  position: absolute;
  inset: 9%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8%;
}
.mstile__n {
  font-size: clamp(11px, 4vw, 15px); font-weight: 700; line-height: 1;
  color: #fff; -webkit-text-stroke: 0.8px #7a4300; paint-order: stroke fill;
  text-shadow: 0 1.5px 0 #7a4300;
}
.mstile.is-locked .mstile__n { font-size: clamp(8px, 2.9vw, 11px); color: #cfe0f5; -webkit-text-stroke: 0; text-shadow: none; }
.mstile__stars { display: flex; align-items: center; justify-content: center; gap: 4%; }
.mstile__star { width: clamp(9px, 3.6vw, 14px); height: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
/* a dimmed gold star still reads as gold-on-gold against the tile's own
   background -- brightness(0) turns it into a solid black silhouette
   (keeping its shape/alpha) so unearned stars actually stand out */
.mstile__star.is-empty { opacity: 0.55; filter: brightness(0); }
.mstile__lockicon {
  width: clamp(13px, 5.2vw, 20px); height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.mstile__boss {
  position: absolute; left: 50%; top: -10%; transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 7px; font-weight: 700; letter-spacing: 0.06em; color: #fff;
  background: #c8362c; border: 1px solid #ffb3ac; white-space: nowrap;
}
.mstile.is-next .mstile__box { animation: soloNext 1.2s ease-in-out infinite; }
@keyframes soloNext {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 207, 63, 0)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(255, 207, 63, 0.9)); }
}

.solomap__hit--play {
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: clamp(16px, 5.5vw, 21px); font-weight: 700;
  color: #4a2a05;
}
.solomap__hit--play::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #4a2a05;
  vertical-align: middle;
}
/* the shared gloss streak: still used by the end-of-level / pay-to-continue
   panels, which are separate CSS-styled cards, not this asset-based screen */
.soloend__go::after,
.soloask__go::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 6%;
  height: 30%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* ---- the level intro card ---- */
.solo__brief {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 8, 20, 0.72);
}
/* The user's supplied template, used literally (like Profile/Forfeit) --
   real text/values sit on top at coordinates measured off the image
   (percentages of 1024/1536). Its content varies level to level (hint
   text, a best-score line, rule count), so rather than growing the whole
   card, everything from "An even fight" down to "Your best" lives in one
   scrollable region (.brief__body) sized to the image's own wide box --
   the card itself stays a fixed shape, matching the fixed art. */
.brief__card {
  position: relative;
  width: min(100%, 340px);
  animation: slam 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.brief__bg { display: block; width: 100%; height: auto; }
/* no dedicated "boss" art was supplied -- reuse the same template with a
   hue shift toward red/orange so a boss level still reads as distinct. */
.brief__card.is-boss .brief__bg { filter: hue-rotate(150deg) saturate(1.5) brightness(0.95); }
.brief__x {
  position: absolute;
  left: 83.8%; top: 10.6%; width: 12.1%; height: 8.1%;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.brief__kicker {
  position: absolute;
  left: 8%; top: 14.3%; width: 84%; height: 4%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(10px, 3.2vw, 13px); letter-spacing: 0.14em; font-weight: 700;
  color: #ffe27a; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.brief__title {
  position: absolute;
  left: 6%; top: 19%; width: 88%; height: 10.5%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 7vw, 28px); font-weight: 800; color: #f2a11c;
  line-height: 1.05; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 3px 4px rgba(0, 0, 0, 0.3);
}
.brief__side {
  position: absolute;
  top: 30.6%; width: 32.7%; height: 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.brief__side--you { left: 11.2%; }
.brief__side--ai { left: 56.6%; }
.brief__side b { font-size: clamp(22px, 8vw, 32px); line-height: 1; font-weight: 700; }
.brief__side span { font-size: clamp(9px, 2.8vw, 11px); color: #d8ecff; }
.brief__side--you b { color: #fff; }
.brief__side--ai b { color: #ffd97a; }
.brief__vs {
  position: absolute;
  left: 44%; top: 34.5%; width: 12%; height: 5%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #ffe27a;
}
.brief__body {
  position: absolute;
  left: 6.3%; top: 45.6%; width: 87.5%; height: 23%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 8px;
  text-align: center;
}
.brief__arr { font-size: 11px; color: #d8ecff; flex: none; }
.brief__rules {
  flex: none;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  font-size: clamp(10px, 3.2vw, 12px);
  font-weight: 500;
  line-height: 1.2;
  color: #eef4ff;
}
.brief__rules li { padding: 0 0 0 15px; position: relative; }
.brief__rules li::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 5px; height: 5px; border-radius: 50%; background: #ffd21a; }
.brief__hint { flex: none; font-size: 10px; color: #fff3b8; font-weight: 500; line-height: 1.15; }
.brief__stars {
  flex: none;
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow-x: auto;
  font-size: clamp(7.5px, 2.4vw, 9.5px);
  font-weight: 600;
  color: #ffe27a;
  white-space: nowrap;
}
.brief__stars span { flex: none; }
.brief__best { color: #fff; }
.brief__play {
  position: absolute;
  left: 6.3%; top: 73.6%; width: 87.5%; height: 10.4%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: clamp(16px, 5.5vw, 20px);
  font-weight: 700;
  color: #4a2a05;
  background: none;
  border: none;
  box-shadow: none;
}

/* ---- inside a level ---- */
#solo-stars { display: none; }
#app.is-solo #solo-stars { display: flex; justify-content: center; gap: calc(var(--cu) * 3); }
#solo-stars i {
  font-style: normal;
  font-size: calc(var(--cu) * 18);
  line-height: 1;
  color: rgba(0, 0, 0, 0.3);
  text-shadow: 0 calc(var(--cu) * 1) 0 rgba(255, 255, 255, 0.12);
  transition: color 0.25s;
}
#solo-stars i.is-on {
  color: #ffd21a;
  text-shadow: 0 calc(var(--cu) * 1.2) 0 #b8760b, 0 0 calc(var(--cu) * 4) rgba(255, 210, 26, 0.55);
}
#app.is-solo .settabs,
#app.is-solo .pcard__sets { display: none; }
#app.is-solo .pcard__stats { grid-template-columns: 1fr; }
#app.is-solo .setbox { justify-content: center; }
.lead__solo { display: none; }
#app.is-solo .lead__set { display: none; }
#app.is-solo .lead__solo { display: inline; }

/* Undo Shot swaps in for Chat (there is nobody to chat with).
   .ico-undo's own look (the real btn-undo-v2.png art + its count badge)
   lives in styles.css, shared with the other sidebtn icons -- this used
   to duplicate it here with a CSS-drawn placeholder circle, which (being
   later in the cascade) silently overrode the real art with equal
   selector specificity. */
#btn-undo { display: none; }
#app.is-solo #btn-undo { display: flex; }
#app.is-solo #btn-chat { display: none; }

/* ---- end-of-level and question cards (they live in the board overlay) ---- */
.soloend,
.soloask {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: slam 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.soloend__kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.soloend__title { font-size: clamp(24px, 7.4vw, 36px); font-weight: 700; line-height: 1.05; }
.soloend--win .soloend__title { color: var(--gold); text-shadow: 0 4px 0 #6a3d0a, 0 0 24px rgba(255, 207, 63, 0.6); }
.soloend--lose .soloend__title { color: #ff9a8f; text-shadow: 0 4px 0 #5e150f, 0 0 20px rgba(236, 90, 80, 0.5); }
.soloend__stars { display: flex; gap: 6px; font-size: 42px; line-height: 1; }
.soloend__stars .star {
  color: rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: scale(0.2);
  animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}
.soloend__stars .star.is-on { color: #ffd21a; text-shadow: 0 3px 0 #b8760b, 0 0 14px rgba(255, 210, 26, 0.7); }
@keyframes starPop { to { opacity: 1; transform: scale(1); } }
.soloend__sub { font-size: 14px; font-weight: 500; color: #fff; }
.soloend__reward { font-size: 16px; font-weight: 700; color: var(--gold); }
.soloend__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; margin-top: 2px; }
.soloend__actions button,
.soloend__help button { font-family: inherit; font-weight: 700; padding: 9px 14px; font-size: 15px; }
.soloend__go,
.soloask__go {
  position: relative;
  width: 84%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #4a2a05;
  background: linear-gradient(180deg, #ffe382, var(--gold-deep));
  border-color: #fff2c0;
}
.soloend__actions .soloend__go { width: 100%; font-size: 18px; padding: 11px 14px; }
.soloend__help { display: flex; gap: 8px; justify-content: center; }
.soloend__help small { font-size: 10px; opacity: 0.8; margin-left: 3px; }
.soloend__link,
.soloask__cancel {
  padding: 4px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border-color: transparent;
  box-shadow: none;
  text-decoration: underline;
}
.soloask__title { font-size: 26px; font-weight: 700; color: var(--gold); text-shadow: 0 3px 0 #6a3d0a; }
.soloask__text { font-size: 14px; font-weight: 500; color: #fff; padding: 0 4px; }
.soloask__coins { width: 84%; padding: 10px 14px; font-family: inherit; font-size: 16px; font-weight: 700; }

/* ---- the test ad (a placeholder until the real ad network is wired in) ---- */
.adbreak {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.9);
  font-family: "Fredoka", system-ui, sans-serif;
  color: #fff;
}
.adbreak__card {
  width: min(100%, 340px);
  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;
}
.adbreak__tag { padding: 2px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; background: #ffd21a; color: #4a2a05; }
.adbreak__title { font-size: 24px; font-weight: 700; }
.adbreak__note { font-size: 13px; color: #9aa6c0; }
.adbreak__bar { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.5); }
.adbreak__bar i { display: block; height: 100%; background: #45d17a; transform-origin: left; transform: scaleX(0); }
.adbreak__count { font-size: 15px; font-weight: 600; min-height: 1.2em; }
.adbreak__close { font-family: inherit; font-size: 13px; padding: 6px 12px; color: #9aa6c0; background: none; border-color: transparent; box-shadow: none; text-decoration: underline; }

/* ---- short phones: make room on Home for the extra Solo Run button ---- */
@media (max-height: 700px) {
  .home__buttons { gap: 6px; }
  .gbtn--play.gbtn--img { max-width: 230px; }
  .gbtn--solo.gbtn--img { max-width: 168px; }
  .gbtn2--solo { max-width: 200px; padding-top: 8px; padding-bottom: 8px; font-size: 17px; }
  .tagline { margin-top: 2px; }
}
