/* Sugaku landing page. Layout: full-bleed marker-colour bands with torn edges,
   one loud live game in the hero, every other band waits for a click. One
   deliberate look in every theme: the bands are the colours. */

@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka_600SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka_700Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/Nunito_800ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/Nunito_900Black.ttf') format('truetype'); font-weight: 900; font-display: swap; }

:root {
  /* Ink and paper from the Sugaku Notebook */
  --ink: #22304A;
  --ink-deep: #0F1A2E;
  --ink-soft: #46557A;
  --paper: #FFFFFF;
  --grid: #E3ECF7;
  --margin-pink: #F4A3B8;
  /* Marker colours, each with its edge */
  --blue: #2F6BFF;
  --blue-edge: #1C47B8;
  --yellow: #FFD23F;
  --yellow-edge: #E0A800;
  --pink: #FF7EB6;
  --pink-edge: #E0508F;
  --grape: #8B5CF6;
  --grape-edge: #6D3FD6;
  --grape-deep: #5B2FC4;
  --mint: #3BB273;
  --mint-edge: #26874F;
  --orange: #FF9A4D;
  --orange-edge: #E0712A;
  --sky: #9CC3FF;
  --sky-edge: #5E8FE0;
  --ice: #E2EEFF;
  --ice-deep: #CFE1FF;
  --stone: #DCE3EE;
  --stone-line: #B3BFD3;
  --stone-edge: #9AA8C0;
  --slate: #C9D2E0;
  --slate-edge: #8592AB;
  --miss: #E3E9F2;

  --font-display: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --font-text: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  --step-hero: clamp(3.4rem, 9.2vw, 8.6rem);
  --step-band: clamp(2.5rem, 6.4vw, 5.4rem);
  --step-lede: clamp(1.1rem, 1.6vw, 1.35rem);
  --step-body: 1.125rem;
  --step-small: 0.95rem;

  --outline: 4px;
  --tear: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--blue);
  color: var(--ink);
  font-family: var(--font-text);
  font-weight: 800;
  font-size: var(--step-body);
  line-height: 1.5;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--yellow); outline-offset: 4px; border-radius: 12px; }
.icon { width: 100%; height: 100%; display: block; }

/* ---------- Loud type ---------- */

.hero-title,
.band-title,
.get-title {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.hero-title,
.get-title {
  color: var(--paper);
  -webkit-text-stroke: calc(var(--outline) * 2.4) var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 0.075em 0 var(--ink);
}

.band-title {
  font-size: var(--step-band);
  max-width: 14ch;
}

.band-text {
  font-size: var(--step-lede);
  max-width: 38ch;
  margin: 0;
}

/* ---------- Bands and torn edges ---------- */

.band-inner {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@media (min-width: 720px) {
  .band-inner {
    padding-left: max(40px, env(safe-area-inset-left, 0px));
    padding-right: max(40px, env(safe-area-inset-right, 0px));
  }
}

.band {
  position: relative;
  background: var(--band-ground);
  color: var(--band-ink);
  padding-block: clamp(72px, 10vw, 140px);
}

/* Each band tears into the one above it with its own colour. */
.band::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--tear) * -1 + 1px);
  height: var(--tear);
  background: var(--band-ground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22'%3E%3Cpath d='M0 22 L9 6 L16 14 L26 0 L35 12 L44 4 L44 22 Z'/%3E%3C/svg%3E") repeat-x bottom / 44px 22px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22'%3E%3Cpath d='M0 22 L9 6 L16 14 L26 0 L35 12 L44 4 L44 22 Z'/%3E%3C/svg%3E") repeat-x bottom / 44px 22px;
  z-index: 2;
  pointer-events: none;
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand,
.get-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 16px 6px 8px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

.brand:active,
.get-button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }

.brand-mark { width: 34px; height: 36px; display: block; }
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; line-height: 1; }

.topbar-actions { display: flex; gap: 10px; }

.get-button { padding-left: 16px; background: var(--pink); font-weight: 900; }

@media (max-width: 560px) {
  .get-button { display: none; }
}

/* ---------- Store badges ---------- */

/* Apple's and Google's official badges, shown as they come: no tilt, border or
   recolouring (both stores' badge guidelines). Google's image carries its own
   clear space, so it is drawn taller to make the two badges look the same size. */
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.store-badges--centre { justify-content: center; }

.store-badge { display: block; line-height: 0; border-radius: 10px; }
.store-badge img { display: block; width: auto; height: 100%; }
.store-badge--apple { height: 56px; }
.store-badge--play { height: 84px; margin: -14px; }

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

.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--blue);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.13) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.13) 2px, transparent 2px);
  background-size: 52px 52px;
  color: var(--paper);
  padding-top: calc(env(safe-area-inset-top, 0px) + 104px);
  padding-bottom: clamp(80px, 9vw, 130px);
}

.hero-inner {
  display: grid;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

@media (min-width: 960px) {
  .hero-inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

.hero-copy { display: grid; gap: 28px; min-width: 0; }

.hero-title { font-size: var(--step-hero); }
.title-line { display: block; }
.title-line:nth-child(2) { color: var(--yellow); transform: rotate(-2deg); transform-origin: left; }

.hero-title.is-jolted .title-line:nth-child(1) { animation: jolt-left 380ms ease-out; }
.hero-title.is-jolted .title-line:nth-child(2) { animation: jolt-right 380ms ease-out; }

@keyframes jolt-left {
  0% { transform: none; }
  30% { transform: translate(-10px, -6px) rotate(-3deg) scale(1.05); }
  100% { transform: none; }
}
@keyframes jolt-right {
  0% { transform: rotate(-2deg); }
  30% { transform: translate(12px, 4px) rotate(2deg) scale(1.07); }
  100% { transform: rotate(-2deg); }
}

.hero-lede {
  margin: 0;
  max-width: 34ch;
  font-size: var(--step-lede);
  color: var(--paper);
}

/* ---------- The arena: Mr. Plus's live game ---------- */

.arena {
  position: relative;
  width: 100%;
  max-width: 460px;
  justify-self: center;
  min-width: 0;
}

.arena-foot {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
}

.scorecard {
  flex: none;
  display: grid;
  padding: 10px 18px 8px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--outline) solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
  transform: rotate(-6deg);
  line-height: 1;
}

.scorecard-label { font-size: 0.85rem; font-weight: 900; }
.scorecard-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  font-variant-numeric: tabular-nums;
}
.scorecard.is-bumped { animation: bump 300ms ease-out; }

@keyframes bump {
  30% { transform: rotate(-9deg) scale(1.2); }
  100% { transform: rotate(-6deg) scale(1); }
}

.stage {
  position: relative;
  padding-top: calc(var(--pitch-px, 70px) * 2.4);
}

.board {
  position: relative;
  padding: 14px;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
  border: var(--outline) solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 12px 0 var(--ink);
  transform: rotate(-1.5deg);
}

.board-tiles {
  position: relative;
  width: 100%;
  height: calc(6 * var(--pitch-px, 70px) - var(--gap-px, 8px));
}

.board-columns {
  position: absolute;
  inset: 0;
  display: flex;
}

.column-button {
  flex: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
}
.column-button:hover { background: rgba(47, 107, 255, 0.1); }

/* ---------- Tiles ---------- */

.tile {
  --size: var(--tile-px, 64px);
  position: absolute;
  top: 0;
  left: 0;
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 24%;
  box-shadow: 0 calc(var(--size) * 0.07) 0 var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--size) * 0.56);
  line-height: 1;
  transform: translate(calc(var(--col, 0) * var(--pitch-px, 70px)), calc((5 - var(--row, 0)) * var(--pitch-px, 70px)));
  transition: transform 300ms cubic-bezier(0.55, 0, 1, 0.45), background-color 120ms, color 120ms;
  user-select: none;
}

.tile > span { display: block; transition: transform 160ms ease-out; }
.tile.is-landing > span { animation: squash 260ms ease-out; }
.tile.is-landing { animation: land-edge 260ms ease-out; }

@keyframes squash {
  0% { transform: scale(1.25, 0.7); }
  60% { transform: scale(0.92, 1.1); }
  100% { transform: none; }
}
@keyframes land-edge {
  0% { box-shadow: 0 1px 0 var(--ink); }
  100% { box-shadow: 0 calc(var(--size) * 0.07) 0 var(--ink); }
}

.tile.is-popping {
  background: var(--mint);
  color: var(--paper);
  z-index: 3;
}
.tile.is-popping > span { transform: scale(1.3) rotate(-8deg); }
.tile.is-popping[data-chain="true"] { background: var(--grape); }

.tile--static {
  position: relative;
  transform: none;
  flex: none;
}

.held-tile { position: relative; transform: none; transition: opacity 80ms; }
.held-tile.is-empty { opacity: 0; }

/* Special tile looks, after the Sugaku Notebook's */
.tile--gift {
  background:
    linear-gradient(90deg, transparent 42%, var(--pink) 42% 58%, transparent 58%),
    linear-gradient(transparent 42%, var(--pink) 42% 58%, transparent 58%),
    var(--yellow);
  color: var(--ink);
}
.tile--gift > span { background: var(--yellow); border-radius: 30%; padding: 0 0.12em; }
.tile--marker { background: var(--grape); color: var(--paper); }
.tile--marker::after {
  content: "×2";
  position: absolute;
  top: -12px;
  right: -12px;
  padding: 2px 6px;
  background: var(--yellow);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  font-size: 0.85rem;
  transform: rotate(10deg);
}
.tile--dare { background: var(--orange); color: var(--ink); }
.tile--bomb { background: var(--ink); color: var(--paper); border-radius: 50%; border-color: var(--ink-deep); }
.tile--bomb::before {
  content: "";
  position: absolute;
  top: -16px;
  right: 6px;
  width: 16px;
  height: 18px;
  border-top: 4px solid var(--ink);
  border-right: 4px solid var(--ink);
  border-radius: 0 14px 0 0;
}
.tile--bomb::after {
  content: "";
  position: absolute;
  top: -22px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: var(--orange);
  border: 3px solid var(--ink);
  border-radius: 50%;
  animation: spark 600ms steps(2) infinite;
}
@keyframes spark { 50% { background: var(--yellow); transform: scale(1.3); } }
.tile--frozen { background: var(--ice); color: var(--ink-soft); border-color: var(--sky-edge); box-shadow: 0 calc(var(--size) * 0.07) 0 var(--sky-edge); }
.tile--thick { background: var(--ice-deep); color: var(--ink-soft); border: 6px double var(--sky-edge); box-shadow: 0 calc(var(--size) * 0.07) 0 var(--sky-edge); }
.tile--stone {
  background:
    radial-gradient(circle at 30% 30%, var(--stone-line) 0 6%, transparent 7%),
    radial-gradient(circle at 68% 58%, var(--stone-line) 0 5%, transparent 6%),
    radial-gradient(circle at 40% 74%, var(--stone-line) 0 4%, transparent 5%),
    var(--stone);
  border-color: var(--stone-edge);
  border-radius: 40% 24% 34% 28% / 28% 36% 24% 40%;
  box-shadow: 0 calc(var(--size) * 0.07) 0 var(--stone-edge);
}
.tile--hidden {
  background: repeating-linear-gradient(45deg, var(--grid) 0 6px, var(--paper) 6px 12px);
  color: var(--ink-soft);
  border-style: dashed;
}
.tile--countdown { background: var(--slate); border-color: var(--slate-edge); box-shadow: 0 calc(var(--size) * 0.07) 0 var(--slate-edge); }
.tile--changing { border-color: var(--ink); }

.pips {
  position: absolute;
  bottom: 8%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 3px;
}
.pips > i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.pips > i.is-spent { opacity: 0.2; }

.plus-one {
  position: absolute;
  top: -12px;
  right: -10px;
  padding: 1px 6px;
  background: var(--mint);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  font-style: normal;
  font-size: 0.8rem;
}

/* ---------- Mr. Plus, the player ---------- */

.player {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: var(--tile-px, 64px);
  display: grid;
  justify-items: center;
  transform: translate(calc(var(--player-col, 2) * var(--pitch-px, 70px)), calc(var(--pitch-px, 70px) * -2.3));
  transition: transform 260ms cubic-bezier(0.3, 1.4, 0.5, 1);
  pointer-events: none;
}

.player-body {
  width: calc(var(--tile-px, 64px) * 1.35);
  margin-bottom: calc(var(--tile-px, 64px) * -0.28);
  position: relative;
  z-index: 1;
  animation: hover-bob 1.4s ease-in-out infinite;
}

.player.is-dropping .player-body { animation: none; transform: translateY(14px) scaleY(0.88); transition: transform 100ms; }
.player.is-cheering .player-body { animation: cheer 500ms ease-out; }

@keyframes hover-bob {
  50% { transform: translateY(-6px) rotate(3deg); }
}
@keyframes cheer {
  0% { transform: none; }
  35% { transform: translateY(-28px) rotate(-20deg) scale(1.15); }
  70% { transform: translateY(-10px) rotate(200deg) scale(1.1); }
  100% { transform: rotate(360deg); }
}

.speech {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 6px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-3deg);
}

.arena-caption {
  margin: 0;
  max-width: 24ch;
  font-size: var(--step-small);
  color: var(--paper);
}

.mr-plus-art { display: block; width: 100%; height: auto; overflow: visible; }

/* Stickers slapped on during play */
.slap-sticker {
  position: absolute;
  z-index: 7;
  display: grid;
  place-items: center;
  align-content: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 5px solid var(--paper);
  box-shadow: 0 0 0 3px var(--ink), 0 7px 0 3px var(--ink);
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  pointer-events: none;
  text-align: center;
  line-height: 1;
}
.slap-sticker b { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; }
.slap-sticker small { font-weight: 900; font-size: 0.72rem; }
.slap-sticker--yellow { background: var(--yellow); color: var(--ink); }
.slap-sticker--pink { background: var(--pink); color: var(--ink); }
.slap-sticker--grape { background: var(--grape); color: var(--paper); }
.slap-sticker--mint { background: var(--mint); color: var(--ink); }
.slap-sticker--orange { background: var(--orange); color: var(--ink); }
.slap-sticker--sky { background: var(--sky); color: var(--ink); }

/* ---------- Effects layer ---------- */

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

.fx-shard {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 3px;
}
.fx-shard--round { border-radius: 50%; width: 12px; height: 12px; }

.fx-burst { position: absolute; display: grid; place-items: center; }
.fx-burst svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-burst span {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  transform: rotate(-8deg);
}

.fx-points {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--yellow);
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  white-space: nowrap;
}

.fx-flash {
  position: absolute;
  inset: 0;
  background: var(--paper);
  pointer-events: none;
  z-index: 30;
}

/* ---------- Make 10 ---------- */

.rule { --band-ground: var(--yellow); --band-ink: var(--ink); }

.rule-inner { display: grid; gap: 36px; justify-items: start; }

.equation {
  position: relative;
  width: 100%;
  min-height: clamp(150px, 22vw, 230px);
  display: grid;
  place-items: center;
}

.equation-tiles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 24px);
  --tile-px: clamp(78px, 14vw, 170px);
}

.equation-tiles .tile { position: relative; transform: none; transition: transform 380ms cubic-bezier(0.6, -0.4, 0.4, 1.4); border-width: 5px; }
.equation-plus { width: clamp(54px, 9vw, 110px); flex: none; }

.equation-result {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(8rem, 26vw, 20rem);
  line-height: 0.8;
  color: var(--mint);
  -webkit-text-stroke: 14px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 0.06em 0 var(--ink);
  opacity: 0;
  pointer-events: none;
}

.combo-row { display: flex; flex-wrap: wrap; gap: 12px; }

.combo,
.big-button {
  min-height: 52px;
  padding: 8px 20px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.combo:hover,
.big-button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); }
.combo:active,
.big-button:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.combo[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }

/* ---------- Chains ---------- */

.chains { --band-ground: var(--ink); --band-ink: var(--paper); }

.chains-inner { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) {
  .chains-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
}

.chains-copy { display: grid; gap: 24px; min-width: 0; }
.chains .band-title { color: var(--yellow); }

.chain-ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.chain-ladder li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 18px;
  border: 3px solid var(--ink-soft);
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--slate-edge);
  font-variant-numeric: tabular-nums;
  transition: background-color 120ms, color 120ms, transform 160ms cubic-bezier(0.3, 1.6, 0.5, 1);
}
.chain-ladder li:nth-child(1) { margin-right: 25%; }
.chain-ladder li:nth-child(2) { margin-right: 18%; }
.chain-ladder li:nth-child(3) { margin-right: 11%; }
.chain-ladder li:nth-child(4) { margin-right: 5%; }

.chain-ladder li.is-lit {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--paper);
  transform: rotate(-1.5deg) scale(1.04);
}
.chain-ladder li.is-lit:nth-child(even) { background: var(--pink); transform: rotate(1.5deg) scale(1.04); }
.chain-ladder li:nth-child(5).is-lit { background: var(--mint); transform: rotate(-2deg) scale(1.1); }

.chain-total { margin: 0; font-size: var(--step-lede); }
.chain-total b { color: var(--yellow); font-family: var(--font-display); font-weight: 600; font-size: 1.4em; }

.chains-play { display: grid; gap: 22px; justify-items: center; min-width: 0; width: 100%; max-width: 420px; justify-self: center; }

.next-tile-row { display: flex; align-items: center; gap: 14px; font-weight: 900; }
.tile--next { --size: 58px; background: var(--yellow); }

.board--chain { width: 100%; transform: rotate(1.5deg); box-shadow: 0 12px 0 var(--grape); }

.drop-arrow {
  position: absolute;
  top: -40px;
  left: calc(14px + var(--arrow-col, 3) * var(--pitch-px, 70px) + var(--tile-px, 64px) / 2);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 22px solid var(--yellow);
  transform: translateX(-50%);
  animation: point 800ms ease-in-out infinite;
}
@keyframes point { 50% { transform: translate(-50%, 8px); } }
.board--chain.is-played .drop-arrow { visibility: hidden; }

.big-button--yellow { background: var(--yellow); }

/* ---------- Power-ups ---------- */

.powers { --band-ground: var(--pink); --band-ink: var(--ink); }

.powers-inner { position: relative; display: grid; gap: 28px; }

.power-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px 28px;
  margin-top: 16px;
}

.power {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  align-items: center;
  padding: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 20px;
}
.power b { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1.05; align-self: end; }
.power > span:last-child { grid-column: 2; font-size: 1rem; line-height: 1.35; align-self: start; }

.power-disc {
  grid-row: span 2;
  width: 92px;
  height: 92px;
  padding: 20px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  border: 5px solid var(--paper);
  box-shadow: 0 0 0 3px var(--ink), 0 7px 0 3px var(--ink);
  transition: transform 160ms cubic-bezier(0.3, 1.6, 0.5, 1);
}
.power:nth-child(odd) .power-disc { transform: rotate(-8deg); }
.power:nth-child(even) .power-disc { transform: rotate(6deg); }
.power:hover .power-disc { transform: rotate(0deg) scale(1.1); }
.power:active .power-disc { transform: translateY(5px) scale(0.96); box-shadow: 0 0 0 3px var(--ink), 0 2px 0 3px var(--ink); }
.power.is-aimed .power-disc { background: var(--blue); color: var(--paper); }

.crack {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  width: 520px;
  height: 520px;
  transform: translate(-50%, -50%);
}

.hammer-swing {
  position: absolute;
  z-index: 21;
  width: 170px;
  height: 170px;
  pointer-events: none;
  transform-origin: 50% 95%;
}

.peek-strip {
  position: absolute;
  z-index: 22;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink);
  pointer-events: none;
  --tile-px: 46px;
}
.peek-strip .tile { position: relative; transform: none; }

/* ---------- Special tiles ---------- */

.specials {
  --band-ground: var(--paper);
  --band-ink: var(--ink);
  background-image:
    linear-gradient(var(--grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 26px 26px;
}

.specials-inner { position: relative; display: grid; gap: 28px; }

.special-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 26px 22px;
  margin-top: 20px;
}

.special {
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 20px;
  --tile-px: 74px;
}
.special .tile { margin-bottom: 12px; transition: transform 160ms cubic-bezier(0.3, 1.6, 0.5, 1); }
.special:hover .tile { transform: translateY(-4px) rotate(-5deg); }
.special:active .tile { transform: translateY(4px); }
.special b { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1; }
.special > span:last-child { font-size: 1rem; line-height: 1.35; color: var(--ink-soft); }

.special.is-blasted { visibility: hidden; }

/* ---------- Daily Drop ---------- */

.daily { --band-ground: var(--mint); --band-ink: var(--ink); }

.daily-inner { display: grid; gap: 56px; align-items: center; }
@media (min-width: 900px) {
  .daily-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
}

.daily-copy { display: grid; gap: 24px; min-width: 0; }

.daily-clock { margin: 0; font-size: var(--step-lede); }
.daily-clock b {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 16px;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.share-card {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: 400px;
  justify-self: center;
  display: grid;
  gap: 16px;
  padding: 26px;
  background: var(--paper);
  color: var(--ink);
  border: var(--outline) solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 14px 0 var(--ink);
  transform: rotate(3deg);
}

.share-head { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; }
.share-mark { width: 40px; display: block; }
.share-score { font-family: var(--font-display); font-weight: 600; font-size: 4.6rem; line-height: 0.9; font-variant-numeric: tabular-nums; }

.drop-strip { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.drop-strip i { aspect-ratio: 1; border-radius: 5px; background: var(--miss); }
.drop-strip i.is-pop { background: var(--mint); }
.drop-strip i.is-chain { background: var(--grape); }
.drop-strip i.is-power { background: var(--yellow); }

.strip-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.9rem; color: var(--ink-soft); }
.strip-key li { display: flex; align-items: center; gap: 6px; }
.key { width: 14px; height: 14px; border-radius: 4px; }
.key--pop { background: var(--mint); }
.key--chain { background: var(--grape); }
.key--power { background: var(--yellow); }
.key--miss { background: var(--miss); }

.share-streak {
  position: absolute;
  top: -28px;
  right: -20px;
  width: 98px;
  height: 98px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink);
  border: 5px solid var(--paper);
  box-shadow: 0 0 0 3px var(--ink), 0 7px 0 3px var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 0.9;
  transform: rotate(10deg);
}
.share-streak small { font-family: var(--font-text); font-weight: 900; font-size: 0.8rem; }

.share-card figcaption { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Get the app ---------- */

.get { --band-ground: var(--grape-deep); --band-ink: var(--paper); text-align: center; }

.sunburst-clip { position: absolute; inset: 0; overflow: hidden; }

.sunburst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260vmax;
  height: 260vmax;
  margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(from 0deg, var(--grape) 0deg 9deg, var(--grape-deep) 9deg 18deg);
  animation: turn 80s linear infinite;
}
@keyframes turn { to { transform: rotate(360deg); } }

.get-inner { position: relative; display: grid; justify-items: center; gap: 28px; }

.get-mascot {
  width: clamp(180px, 26vw, 280px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 40px;
  animation: hover-bob 1.6s ease-in-out infinite;
}
.get-mascot.is-poked { animation: cheer 600ms ease-out; }

.get-title { font-size: var(--step-band); max-width: 15ch; }
.get-text { margin: 0; max-width: 40ch; font-size: var(--step-lede); }

/* ---------- Footer ---------- */

.footer { background: var(--ink); color: var(--paper); padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); font-size: var(--step-small); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer a { color: var(--yellow); }
.footer-legal { flex-basis: 100%; font-size: 0.75rem; font-weight: 800; opacity: 0.7; }

/* ---------- Play in the browser ---------- */

.play-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 26px 8px 12px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--outline) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 7px 0 var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transform: rotate(-2deg);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.play-button:hover { transform: rotate(1deg) scale(1.04); }
.play-button:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--ink); }
.play-button-mark { width: 44px; display: block; }
.get-inner .play-button { justify-self: center; }

.play {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: var(--outline) solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 14px 0 var(--ink);
  background-color: var(--blue);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.13) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.13) 2px, transparent 2px);
  background-size: 40px 40px;
  color: var(--paper);
  overflow: visible;
}
.play::backdrop { background: rgba(15, 26, 46, 0.72); }
.play[open] { animation: play-in 260ms cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes play-in { from { transform: scale(0.85) rotate(-3deg); } }

.play-inner {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.play-head { display: flex; align-items: center; gap: 12px; }
.play-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; flex: 1; }

.play-stats { display: flex; gap: 8px; margin: 0; }
.play-stats > div {
  display: grid;
  min-width: 64px;
  padding: 4px 10px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  text-align: center;
  line-height: 1.1;
}
.play-stats dt { font-size: 0.72rem; font-weight: 900; }
.play-stats dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.play-stats > div:first-child { background: var(--yellow); }

.play-close {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.play-close:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.play-next { display: flex; align-items: center; gap: 12px; font-weight: 900; }
.play-next .tile--next { --size: 54px; }
.play-next .tile--next.is-fresh > span { animation: squash 260ms ease-out; }
.play-rise { margin-left: auto; font-size: 0.95rem; }
.play-rise.is-close { color: var(--yellow); }

.play-stage { position: relative; display: grid; justify-items: center; align-content: center; }
.board--play {
  width: min(100%, calc((100dvh - 290px) / 1.24));
  min-width: 240px;
  transform: none;
}

.play-over {
  position: absolute;
  inset: -6px;
  z-index: 8;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  border: var(--outline) solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 10px 0 var(--ink);
  text-align: center;
}
.play-over p { margin: 0; }
.play-over-title { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.play-over-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 5rem;
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 10px var(--ink);
  paint-order: stroke fill;
  font-variant-numeric: tabular-nums;
}
.play-over-best { font-weight: 900; color: var(--ink-soft); }
.play-over-more { max-width: 30ch; font-size: 0.95rem; color: var(--ink-soft); }
.play-over-link { color: var(--blue-edge); font-weight: 900; }

.play-hint { margin: 0; font-size: 0.9rem; text-align: center; }

.column-button.is-full { animation: refuse 260ms linear; }
@keyframes refuse {
  25% { background: rgba(255, 126, 182, 0.35); transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* On phones the game takes the whole screen. */
@media (max-width: 600px) {
  .play {
    width: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .play-inner {
    min-height: 100dvh;
    max-height: none;
    grid-template-rows: auto auto 1fr auto;
    padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .play-title { font-size: 1.3rem; }
  .play-stats > div { min-width: 54px; padding: 3px 6px; }
  .board--play { width: min(100%, calc((100dvh - 250px) / 1.24)); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .sunburst { animation: none; }
}
