/* Block Cascade web — tokens and components from the app (lib/config/theme, lib/game/theme). */

@font-face {
  font-family: "Righteous";
  src: url("/assets/fonts/righteous-400.woff2?v=3944041858") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Chakra Petch";
  src: url("/assets/fonts/chakra-petch-600.woff2?v=91ed2001bd") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* App light theme */
  --bg: #F5F5FA;
  --surface: #FFFFFF;
  --fill: #EEEEF5;
  --line: #DFDFEC;
  --ink: #14142B;
  --muted: #5B5B78;
  --primary: #6C63FF;
  --primary-ink: #4F46E5;
  --on-primary: #FFFFFF;
  --primary-tint: #E9E8FF;
  --secondary: #00B8D9;
  --pro: #8A6500;
  --pro-tint: #FFF6D1;

  --shadow: 0 2px 14px rgba(20, 20, 43, 0.07);
  --card-border: 1px solid transparent;
  --frame: #14142B;

  /* Classic block palette (base / light / dark) */
  --fire: #FF3050;  --fire-l: #FF7088;  --fire-d: #C81030;
  --water: #3388FF; --water-l: #70B0FF; --water-d: #1060CC;
  --earth: #50E068; --earth-l: #88FF98; --earth-d: #30B048;
  --wind: #FFD700;  --wind-l: #FFE860;  --wind-d: #CCA800;

  --gradient: linear-gradient(90deg, #6C63FF, #00D9FF);

  --display: "Righteous", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --label: "Chakra Petch", ui-rounded, system-ui, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-button: 14px;
  --r-card: 20px;
  --r-sheet: 32px;
  --gutter: 20px;
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* App dark theme */
    --bg: #0D0D1A;
    --surface: #1A1A2E;
    --fill: #202038;
    --line: #2C2C48;
    --ink: #F1F1FA;
    --muted: #A3A3C2;
    --primary-ink: #A29CFF;
    --primary-tint: #25224A;
    --secondary: #00D9FF;
    --pro: #FFD700;
    --pro-tint: #2E2A14;

    --shadow: none;
    --card-border: 1px solid var(--line);
    --frame: #2A2A44;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--primary-ink); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }

h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 10vw, 4.5rem); line-height: 1.02; }
h2 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.08; }
h3 { font-size: 1.0625rem; line-height: 1.3; font-weight: 600; }

.grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-button);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--muted); }

/* ---------- Header / footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.375rem;
  line-height: 1;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) {
  display: none;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.nav a:not(.btn):hover, .nav a[aria-current] { color: var(--ink); }
@media (min-width: 760px) { .nav a:not(.btn) { display: inline-block; } }

.site-footer {
  margin-top: 40px;
  padding-block: 40px 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer .wrap { display: grid; gap: 20px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 0; list-style: none; }
.footer-links a { color: var(--ink); text-decoration: none; font-weight: 500; display: inline-block; padding-block: 6px; }
.footer-links a:hover { text-decoration: underline; }
/* The app opens /#privacy and /#terms; without JS the footer link is the landing spot. */
.footer-links li:target a { color: var(--primary-ink); text-decoration: underline; }
.site-footer p { max-width: 64ch; }

/* ---------- Buttons, badges, chips ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-button);
  background: var(--primary);
  color: var(--on-primary);
  font: 600 0.9375rem/1 var(--label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn-lg { min-height: 52px; padding-inline: 24px; font-size: 1rem; }

.store-badge { display: inline-block; border-radius: 10px; line-height: 0; }
.store-badge img { width: 168px; height: 56px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-ink);
  font: 600 0.8125rem/1.2 var(--label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--fill);
  color: var(--muted);
  font: 600 0.75rem/1 var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-pro { background: var(--pro-tint); color: var(--pro); }

.card {
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

/* ---------- Blocks ---------- */
/* One glossy block, like the in-game BlockPalette: base, light highlight, dark edge.
   Size comes from the parent grid; colours from --c / --l / --d. */

.b {
  --c: var(--fire); --l: var(--fire-l); --d: var(--fire-d);
  display: block;
  aspect-ratio: 1;
  border-radius: 22%;
  background:
    linear-gradient(160deg, color-mix(in srgb, #fff 45%, transparent) 0 18%, transparent 42%),
    linear-gradient(150deg, var(--l), var(--c) 48%, var(--d));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--d) 80%, #000), 0 0 10px color-mix(in srgb, var(--c) 35%, transparent);
}
.b.w { --c: var(--water); --l: var(--water-l); --d: var(--water-d); }
.b.e { --c: var(--earth); --l: var(--earth-l); --d: var(--earth-d); }
.b.y { --c: var(--wind); --l: var(--wind-l); --d: var(--wind-d); }

/* ---------- Sections ---------- */

.section { padding-block: 64px; }
@media (min-width: 960px) { .section { padding-block: 104px; } }

.section-head { display: grid; gap: 14px; max-width: 42rem; margin-bottom: 36px; }
.section-head p { color: var(--muted); font-size: 1.125rem; }

.tinted { background: var(--fill); }

/* ---------- Hero ---------- */

.hero { position: relative; padding-block: 32px 64px; overflow: clip; }
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: min(900px, 120vw);
  aspect-ratio: 1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 26%, transparent), transparent);
  pointer-events: none;
}
.hero .wrap { position: relative; display: grid; gap: 48px; align-items: center; }
.hero-copy { display: grid; gap: 20px; justify-items: start; }
.hero .lead { color: var(--muted); font-size: 1.1875rem; line-height: 1.5; max-width: 34rem; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 4px; }
.cta-note { color: var(--muted); font-size: 0.9375rem; }

.ticks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; list-style: none; color: var(--muted); font-size: 0.9375rem; }
.ticks li { display: inline-flex; align-items: center; gap: 6px; }
.ticks .icon { color: var(--primary); width: 16px; height: 16px; stroke-width: 2.6; }

@media (min-width: 960px) {
  .hero { padding-block: 56px 96px; }
  .hero .wrap { grid-template-columns: 1.1fr 0.9fr; gap: 64px; }
}

/* ---------- Phone + game screen mock (always the dark Classic theme, like a screenshot) ---------- */

.phone {
  --phone-w: min(300px, 78vw);
  position: relative;
  width: var(--phone-w);
  margin-inline: auto;
  padding: 9px;
  border-radius: 48px;
  background: var(--frame);
  box-shadow: 0 30px 60px -20px rgba(20, 16, 60, 0.45), 0 0 80px -10px color-mix(in srgb, var(--primary) 40%, transparent);
}
.phone::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 50%;
  width: 29%;
  height: 22px;
  border-radius: 12px;
  background: #05050C;
  transform: translateX(-50%);
}

/* --u is one iOS point of the 393pt-wide screen. */
.game {
  --u: calc((var(--phone-w) - 18px) / 393);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 22);
  aspect-ratio: 393 / 852;
  padding: calc(var(--u) * 70) calc(var(--u) * 18) calc(var(--u) * 40);
  border-radius: 39px;
  overflow: hidden;
  color: #F1F1FA;
  background:
    radial-gradient(120% 60% at 50% 45%, rgba(64, 64, 221, 0.28), transparent 70%),
    #0A0A2E;
  font-family: var(--label);
}

.hud { display: flex; align-items: flex-end; justify-content: space-between; }
.hud small { display: block; color: #8C8CB8; font-size: calc(var(--u) * 11); letter-spacing: 0.16em; }
.hud b { display: block; font: 400 calc(var(--u) * 34)/1 var(--display); }
.hud .best { text-align: right; }
.hud .best b { font-size: calc(var(--u) * 20); color: #FFD700; }

.combo {
  align-self: center;
  padding: calc(var(--u) * 5) calc(var(--u) * 14);
  border-radius: 99px;
  background: linear-gradient(90deg, #6C63FF, #00D9FF);
  color: #fff;
  font-size: calc(var(--u) * 14);
  letter-spacing: 0.14em;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: calc(var(--u) * 4);
  padding: calc(var(--u) * 8);
  border-radius: calc(var(--u) * 16);
  background: #0A0A28;
  box-shadow: 0 0 0 1px #2E2E6A, 0 0 calc(var(--u) * 40) rgba(51, 136, 255, 0.25);
}
.board > i:not(.b) {
  display: block;
  aspect-ratio: 1;
  border-radius: 22%;
  background: #1A1A48;
  box-shadow: inset 0 0 0 1px #2E2E6A;
}

.tray { display: flex; align-items: center; justify-content: space-around; padding-top: calc(var(--u) * 6); }
.piece { display: grid; gap: calc(var(--u) * 3); grid-auto-rows: calc(var(--u) * 22); grid-auto-columns: calc(var(--u) * 22); }
.piece > * { grid-row: var(--r, 1); grid-column: var(--k, 1); }

.game-foot { display: flex; justify-content: space-between; margin-top: auto; }
.game-foot span {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 8);
  height: calc(var(--u) * 44);
  padding: 0 calc(var(--u) * 16);
  border-radius: 99px;
  background: #1A1A48;
  box-shadow: inset 0 0 0 1px #2E2E6A;
  color: #C8C8F0;
  font-size: calc(var(--u) * 14);
  letter-spacing: 0.12em;
}
.game-foot .icon { width: calc(var(--u) * 18); height: calc(var(--u) * 18); stroke-width: 2.2; }
.game-foot b { color: #FFD700; }

/* The full row flashes and clears, then the combo chip pops — once, after load. */
@media (prefers-reduced-motion: no-preference) {
  .board .clear { animation: clear-row 2.4s ease-in 0.9s both; }
  .combo { animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 2.2s both; }
}
/* Flash, shrink away, then settle as empty cells (same look as .board > i:not(.b)). */
@keyframes clear-row {
  0%, 30% { filter: none; transform: none; opacity: 1; }
  45% { filter: brightness(2.2) saturate(0.4); transform: scale(1.08); }
  58% { filter: brightness(2.2); transform: scale(0.2); opacity: 0; }
  60%, 100% { background: #1A1A48; box-shadow: inset 0 0 0 1px #2E2E6A; filter: none; transform: none; opacity: 1; }
}
@keyframes pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }

/* ---------- How to play ---------- */

.steps { display: grid; gap: 14px; padding: 0; list-style: none; }
.steps li { display: grid; gap: 12px; align-content: start; padding: 22px; }
.steps p { color: var(--muted); }
.step-art {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 132px;
  padding: 6px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: #0A0A28;
}
.step-art > i:not(.b) { display: block; aspect-ratio: 1; border-radius: 22%; background: #1A1A48; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }

.scoring { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 0; list-style: none; }
.scoring li {
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--surface);
  border: var(--card-border);
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
}
.scoring b { font-family: var(--label); color: var(--primary-ink); }

/* ---------- Features ---------- */

.features { display: grid; gap: 14px; padding: 0; list-style: none; }
.features li { display: grid; gap: 8px; align-content: start; padding: 22px; }
.features .icon {
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--primary-tint);
  color: var(--primary-ink);
}
.features p { color: var(--muted); font-size: 0.9375rem; }
@media (min-width: 640px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); } }

.medals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.medal { font: 600 0.75rem/1 var(--label); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 10px; border-radius: 99px; }
.medal.bronze { background: #F3DCC8; color: #7A4A20; }
.medal.silver { background: #E4E6EE; color: #4A4E5E; }
.medal.gold { background: #FFF1B8; color: #7A5E00; }

/* ---------- Themes ---------- */

.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0; list-style: none; }
.theme { display: grid; gap: 10px; padding: 12px; }
.swatch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-t);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--glow) 35%, transparent), inset 0 0 28px color-mix(in srgb, var(--glow) 30%, transparent);
}
.swatch .b { --d: color-mix(in srgb, var(--c) 70%, #000); --l: color-mix(in srgb, var(--c) 60%, #fff); }
.theme-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
@media (min-width: 640px) { .themes { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .themes { grid-template-columns: repeat(5, 1fr); } }

/* ---------- Pro ---------- */

.plans { display: grid; gap: 14px; }
.plan { display: grid; gap: 14px; align-content: start; padding: 26px; }
.plan h3 { font: 400 1.5rem/1.1 var(--display); }
.plan ul { display: grid; gap: 10px; padding: 0; list-style: none; }
.plan li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.plan li .icon { width: 20px; height: 20px; margin-top: 2px; color: var(--primary-ink); stroke-width: 2.4; }
.plan-pro { position: relative; border: 2px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box; }
.plan-pro li .icon { color: var(--secondary); }
.plan .fine { color: var(--muted); font-size: 0.875rem; }
@media (min-width: 760px) { .plans { grid-template-columns: 1fr 1fr; } }

/* ---------- FAQ ---------- */

.faq { display: grid; gap: 10px; max-width: 48rem; }
.faq details { padding: 0 20px; }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding-block: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -1px); }
.faq details > div { display: grid; gap: 10px; padding-bottom: 20px; color: var(--muted); }

/* ---------- Download ---------- */

.download {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 48px 24px;
  border-radius: var(--r-sheet);
  background:
    radial-gradient(80% 90% at 50% 0%, rgba(108, 99, 255, 0.45), transparent 70%),
    #0D0D1A;
  color: #F1F1FA;
  text-align: center;
}
.download p { color: #A3A3C2; max-width: 32rem; }
.download .app-icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 12px 40px rgba(108, 99, 255, 0.5); }

/* ---------- Legal / support pages ---------- */

.page-head { padding-block: 40px 8px; }
.page-head .wrap { display: grid; gap: 14px; max-width: 48rem; margin-inline: 0; }
.page-head p { color: var(--muted); font-size: 1.125rem; }
@media (min-width: 960px) { .page-head { padding-top: 72px; } }

.page-body { padding-block: 24px 40px; }
.page-body .wrap { max-width: 48rem; margin-inline: 0; }
@media (min-width: 1120px) {
  .page-head .wrap, .page-body .wrap { margin-inline: auto; }
}

.prose { display: grid; gap: 16px; font-size: 1.0625rem; line-height: 1.6; }
.prose h2 { margin-top: 28px; font-size: clamp(1.5rem, 5vw, 1.875rem); line-height: 1.15; }
.prose h3 { margin-top: 8px; }
.prose ul, .prose ol { display: grid; gap: 8px; padding-left: 1.25em; }
.prose li::marker { color: var(--muted); }
.prose .note { padding: 16px 18px; border-radius: 16px; background: var(--primary-tint); }
.prose .note.pro { background: var(--pro-tint); }

.toc { padding: 18px 20px; }
.toc ol { display: grid; gap: 6px; margin-top: 8px; padding-left: 1.25em; font-size: 0.9375rem; }

.table-scroll { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.table-scroll table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.45; }
.table-scroll th, .table-scroll td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-scroll th { background: var(--fill); font-weight: 600; }
.table-scroll tr:last-child td { border-bottom: 0; }

/* Phones: each row becomes a small card, with the column name above each value. */
@media (max-width: 639px) {
  .table-scroll table { min-width: 0; }
  .table-scroll thead { display: none; }
  .table-scroll tr, .table-scroll td { display: block; }
  .table-scroll tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-scroll tr:last-child { border-bottom: 0; }
  .table-scroll td { padding: 0; border: 0; }
  .table-scroll td:first-child { font-weight: 600; font-size: 1rem; }
  .table-scroll td[data-label] { margin-top: 8px; }
  .table-scroll td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
}

.contact-card { display: grid; gap: 12px; padding: 24px; }
.contact-card .btn { justify-self: start; text-transform: none; letter-spacing: 0.02em; }

/* ---------- 404 ---------- */

.not-found { display: grid; place-items: center; gap: 16px; min-height: 60vh; padding-block: 64px; text-align: center; }
.not-found p { color: var(--muted); }
