/* Chainfall — the playable daily.
 *
 * The board is the game's own palette, deliberately: it is a window into the
 * app, and a visitor who installs should recognise what they played. The rest
 * of the page now carries that palette too, because the page is the app's
 * page, not a light marketing sheet with a dark box bolted into it.
 *
 * Site chrome (header, footer) stays Puzzlica's. */

.cf-page {
  --cf-bg:      #0E1116;
  --cf-bg-2:    #121722;
  --cf-panel:   #171C24;
  --cf-panel-2: #212936;
  --cf-line:    #2C3543;
  --cf-ink:     #F2F5F9;
  --cf-mute:    #98A4B6;
  --cf-blue:    #4CC2FF;
  --cf-gold:    #FFC24B;
  background: var(--cf-bg);
}

/* Shared type ------------------------------------------------------------ */
.cf-h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.14;
  margin: 0 0 10px;
  color: var(--cf-ink);
}
.cf-section-sub {
  color: var(--cf-mute);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 26px;
  max-width: 54ch;
}
.cf-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.cf-badges-center { justify-content: center; }
.cf-badges img { display: block; height: 48px; width: auto; }

/* Hero ------------------------------------------------------------------- */
.cf-hero {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(76,194,255,0.16), transparent 62%),
    var(--cf-bg);
  border-bottom: 1px solid var(--cf-line);
  padding: 48px 0 40px;
  color: var(--cf-ink);
}
.cf-hero-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 40px;
  align-items: flex-end;
  justify-content: space-between;
}
.cf-hero-id { display: flex; gap: 22px; align-items: flex-start; min-width: min(100%, 380px); }
.cf-hero-icon {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  flex-shrink: 0;
  box-shadow: 0 10px 34px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06) inset;
}
.cf-hero-text { min-width: 0; }
.cf-hero h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.04;
  margin: 2px 0 8px;
  color: var(--cf-ink);
}
.cf-hero-tag {
  color: var(--cf-mute);
  font-size: 15px;
  line-height: 1.58;
  margin: 0 0 14px;
  max-width: 46ch;
}
.cf-chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; margin: 0; padding: 0; }
.cf-chips li {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--cf-ink);
  background: var(--cf-panel-2);
  border: 1px solid var(--cf-line);
  border-radius: 999px;
  padding: 5px 12px;
}
.cf-hero-cta { display: flex; flex-direction: column; gap: 10px; }
.cf-hero-note { color: var(--cf-mute); font-size: 13px; margin: 0; }
.cf-hero-note a { color: var(--cf-blue); }

.cf-play {
  background: var(--cf-bg-2);
  color: var(--cf-ink);
  border-bottom: 1px solid var(--cf-line);
  padding: 46px 0 52px;
}
.cf-play-inner { max-width: 560px; }
.cf-play .cf-title { margin-top: 0; }

.cf-eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #98A4B6;
  margin: 0 0 6px;
}
.cf-title {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.08;
  margin: 0 0 10px;
  color: #F2F5F9;
  text-wrap: balance;
}
.cf-sub {
  color: #98A4B6;
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 22px;
  max-width: 46ch;
}

.cf-rungs { display: flex; gap: 6px; margin-bottom: 14px; }
.cf-rungs button {
  flex: 1;
  padding: 10px 8px;
  background: #171C24;
  color: #98A4B6;
  border: 1px solid #2C3543;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.cf-rungs button[aria-current='true'] {
  background: #212936;
  color: #F2F5F9;
  border-color: #4CC2FF;
}

.cf-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
}
.cf-stat {
  flex: 1 1 0;
  min-width: 84px;
  background: var(--cf-panel);
  border: 1px solid var(--cf-line);
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cf-stat b {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 22px;
  line-height: 1.1;
  color: var(--cf-ink);
  font-weight: 500;
}
.cf-stat span {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cf-mute);
}
.cf-hud-rung {
  align-self: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cf-blue);
  border: 1px solid rgba(76,194,255,.35);
  background: rgba(76,194,255,.08);
  border-radius: 999px;
  padding: 6px 13px;
}

.cf-board {
  display: grid;
  grid-template-columns: repeat(var(--cf-cols, 5), 1fr);
  gap: 6px;
  margin: 0 auto;
  /* Positioning context for the bullets, which are absolutely positioned and
     therefore never become grid items. */
  position: relative;
}

/* A bullet in flight. Without these the cascade was invisible: gems simply
   stopped existing, with nothing on screen to explain why. */
.cf-shot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: #EAF6FF;
  box-shadow:
    0 0 6px 2px rgba(76, 194, 255, 0.9),
    0 0 16px 5px rgba(76, 194, 255, 0.35);
  pointer-events: none;
  z-index: 2;
  will-change: transform;
}
/* The tail, pointing back down the line of travel. */
.cf-shot::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 50%;
  width: 210%;
  height: 34%;
  transform: translateY(-50%) rotate(var(--cf-rot, 0deg));
  transform-origin: right center;
  background: linear-gradient(to left,
    rgba(76, 194, 255, 0.55), rgba(76, 194, 255, 0));
  border-radius: 999px;
  z-index: -1;
}

.cf-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 800;
  font-size: clamp(14px, 4.4vw, 22px);
  color: #fff;
  cursor: pointer;
  /* Lit from the top-left, like the app's gems. */
  background-image: radial-gradient(circle at 32% 28%,
    rgba(255,255,255,0.34), rgba(0,0,0,0.34));
  transition: transform 90ms ease, filter 90ms ease;
}
.cf-cell[data-lives='1'] { background-color: #3E7CB1; border-color: #6FA8DC; }
.cf-cell[data-lives='2'] { background-color: #3E9E86; border-color: #66C7AC; }
.cf-cell[data-lives='3'] { background-color: #D08B2C; border-color: #EDB25A; }
.cf-cell[data-lives='4'] { background-color: #C4525F; border-color: #E88592; }

.cf-cell.cf-empty {
  background-image: none;
  background-color: rgba(0,0,0,0.32);
  border-color: #212936;
  cursor: default;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.06);
}
.cf-cell.cf-boom {
  animation: cf-boom 190ms ease-out;
  filter: brightness(2.1);
}
@keyframes cf-boom {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .cf-cell { transition: none; }
  .cf-cell.cf-boom { animation: none; }
  /* play.js also skips spawning them; this is the belt to that braces. */
  .cf-shot { display: none; }
}

.cf-actions { display: flex; justify-content: center; margin-top: 16px; }
.cf-btn-ghost {
  background: transparent;
  color: #98A4B6;
  border: 1px solid #2C3543;
  border-radius: 10px;
  padding: 9px 20px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.cf-fallback { color: #98A4B6; text-align: center; padding: 30px 0; }

.cf-result {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #2C3543;
  border-radius: 14px;
  background: #171C24;
}
.cf-result h3 {
  font-family: Fraunces, Georgia, serif;
  font-size: 24px;
  margin: 0 0 6px;
  color: #FFC24B;
}
.cf-result p { color: #98A4B6; font-size: 14px; line-height: 1.55; margin: 0; }
.cf-install { margin-top: 16px; border-top: 1px solid #2C3543; padding-top: 14px; }
.cf-install-line { margin-bottom: 12px !important; }
.cf-badges { display: flex; gap: 10px; flex-wrap: wrap; }

/* These three inherited their colour from the light page background before the
   page went dark. They need explicit colours now, or they render dark-on-dark. */
.cf-facts {
  background: var(--cf-bg);
  border-bottom: 1px solid var(--cf-line);
  padding: 46px 0 50px;
  color: var(--cf-ink);
}
.cf-facts-inner {
  display: grid;
  gap: 26px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.cf-facts article {
  background: var(--cf-panel);
  border: 1px solid var(--cf-line);
  border-radius: 14px;
  padding: 20px 20px 22px;
}
.cf-facts h3 {
  font-family: Fraunces, Georgia, serif;
  font-size: 19px;
  margin: 0 0 8px;
  color: var(--cf-gold);
}
.cf-facts p { margin: 0; line-height: 1.6; color: var(--cf-mute); font-size: 14.5px; }

/* Screenshots ------------------------------------------------------------ */
.cf-shots {
  background: var(--cf-bg);
  border-bottom: 1px solid var(--cf-line);
  padding: 46px 0 48px;
  color: var(--cf-ink);
}
.cf-shots-scroll {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 18px;
  /* Bleed to the viewport edge so the strip reads as scrollable, while the
     first shot still lines up with the container above it. */
  padding-inline: max(1rem, calc((100vw - 1120px) / 2));
  scrollbar-width: thin;
  scrollbar-color: var(--cf-line) transparent;
}
.cf-shots-scroll::-webkit-scrollbar { height: 8px; }
.cf-shots-scroll::-webkit-scrollbar-thumb {
  background: var(--cf-line);
  border-radius: 999px;
}
.cf-shots-scroll figure {
  margin: 0;
  flex: 0 0 auto;
  width: 208px;
  scroll-snap-align: start;
}
.cf-shots-scroll img {
  display: block;
  width: 208px;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--cf-line);
  background: var(--cf-panel);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.cf-shots-scroll figcaption {
  margin-top: 11px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--cf-mute);
}

/* App details ------------------------------------------------------------ */
.cf-specs {
  background: var(--cf-bg-2);
  border-bottom: 1px solid var(--cf-line);
  padding: 44px 0 48px;
  color: var(--cf-ink);
}
.cf-specs-grid {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--cf-line);
  border: 1px solid var(--cf-line);
  border-radius: 14px;
  overflow: hidden;
  margin: 0;
}
.cf-specs-grid > div { background: var(--cf-panel); padding: 15px 18px; }
.cf-specs-grid dt {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cf-mute);
  margin-bottom: 5px;
}
.cf-specs-grid dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--cf-ink);
}

/* Bottom CTA ------------------------------------------------------------- */
.cf-cta {
  background:
    radial-gradient(110% 130% at 50% 100%, rgba(76,194,255,0.15), transparent 60%),
    var(--cf-bg);
  padding: 52px 0 58px;
  text-align: center;
  color: var(--cf-ink);
}
.cf-cta .cf-section-sub { margin-left: auto; margin-right: auto; }

@media (max-width: 640px) {
  .cf-hero { padding: 34px 0 30px; }
  .cf-hero-id { gap: 16px; }
  .cf-hero-icon { width: 76px; height: 76px; border-radius: 18px; }
  .cf-hero-inner { align-items: flex-start; }
  .cf-shots-scroll figure, .cf-shots-scroll img { width: 168px; }
  /* Clear the sticky install bar. */
  .cf-cta { padding-bottom: 96px; }
}
