:root {
  color-scheme: dark;

  /* The game's palette (lib/src/ui/palette.dart) and the store artwork's indigo. */
  --bg: #12141c;
  --bg-indigo: #242548;
  --bg-indigo-light: #393773;
  --well: #1b1e2a;
  --panel: #242836;
  --line: rgb(255 255 255 / 0.1);
  --text: #f4f4f8;
  --muted: rgb(255 255 255 / 0.66);
  --gold: #ffd54f;
  --warning: #ff6b6b;

  --tile-0: linear-gradient(#ea696d, #c33d41);
  --tile-1: linear-gradient(#f7c560, #d09c34);
  --tile-2: linear-gradient(#55b486, #298b5c);
  --tile-3: linear-gradient(#61a3ee, #357ac7);
  --tile-4: linear-gradient(#b479e0, #8b4db8);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --content: 1080px;
  --gutter: 16px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--gold);
  text-underline-offset: 0.2em;
}

h1,
h2,
h3 {
  line-height: 1.15;
  text-wrap: balance;
}

.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.lang-switch {
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
}

.lang-switch:hover {
  color: var(--text);
  border-color: rgb(255 255 255 / 0.3);
}

/* Hero */

.hero {
  background:
    radial-gradient(1200px 500px at 85% 0%, rgb(255 213 79 / 0.08), transparent 60%),
    linear-gradient(160deg, var(--bg-indigo-light), var(--bg-indigo) 55%, var(--bg));
  padding-bottom: 56px;
}

.hero-grid {
  display: grid;
  gap: 40px;
  align-items: center;
  padding-top: 24px;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr 440px;
    gap: 64px;
    padding-top: 48px;
  }
}

.hero h1 {
  font-size: clamp(44px, 9vw, 76px);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
}

.tagline {
  color: var(--gold);
  font-size: clamp(20px, 3.4vw, 26px);
  font-weight: 700;
  margin: 8px 0 20px;
}

.lead {
  font-size: 19px;
  color: rgb(255 255 255 / 0.85);
  max-width: 34em;
  margin: 0 0 28px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgb(0 0 0 / 0.3);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 18px;
  font-weight: 700;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgb(255 213 79 / 0.2);
}

.text-link {
  color: var(--text);
  font-weight: 600;
}

/* Demo */

.demo {
  background: rgb(18 20 28 / 0.75);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.demo-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 4px 10px;
}

.chain-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--panel);
  margin-bottom: 12px;
  transition: border-color 0.12s, opacity 0.12s;
}

.chain-letters {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-bar.idle .chain-letters {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.chain-bar.word {
  border-color: var(--gold);
}

.chain-bar.word .chain-letters,
.chain-bar.word .chain-points {
  color: var(--gold);
}

.chain-bar.dead .chain-letters {
  opacity: 0.45;
}

.chain-points {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chain-bonus {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.board {
  --cols: 7;
  --rows: 5;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 5px;
  padding: 6px;
  aspect-ratio: calc(var(--cols) / var(--rows));
  background: var(--well);
  border-radius: 16px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 18%;
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 5.4vw, 26px);
  line-height: 1;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.18);
  transition: transform 0.12s, filter 0.12s, opacity 0.2s;
}

.tile[data-color="0"] { background: var(--tile-0); }
.tile[data-color="1"] { background: var(--tile-1); color: #2b1d00; }
.tile[data-color="2"] { background: var(--tile-2); }
.tile[data-color="3"] { background: var(--tile-3); }
.tile[data-color="4"] { background: var(--tile-4); }

.tile.qu {
  font-size: clamp(14px, 4.2vw, 20px);
}

.tile.rare::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 12%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.board.tracing .tile:not(.selected) {
  filter: brightness(0.7) saturate(0.85);
}

.tile.selected {
  transform: scale(1.06);
}

.tile.scored {
  animation: pop 0.45s ease-out;
}

@keyframes pop {
  40% { transform: scale(0.6); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}

.board.refused {
  animation: nudge 0.25s;
}

@keyframes nudge {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.trace polyline {
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trace .glow {
  stroke-width: 16px;
  stroke-opacity: 0.18;
}

.trace .path {
  stroke-width: 5px;
}

.board:not(.word-ready) .trace .path {
  stroke: #fff;
  stroke-opacity: 0.75;
}

.board:not(.word-ready) .trace .glow {
  stroke-opacity: 0;
}

.demo-status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 12px 4px 6px;
  font-size: 15px;
  color: var(--muted);
}

.demo-status strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.reset {
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 12px;
  cursor: pointer;
}

.reset:hover {
  color: var(--text);
}

.found {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin: 0 4px;
  padding: 0;
  list-style: none;
}

.found li {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--panel);
  border-radius: 8px;
  padding: 3px 8px;
}

.found li.long {
  color: var(--gold);
}

.demo-hint {
  margin: 10px 4px 2px;
  font-size: 14px;
  color: var(--muted);
}

.demo noscript p {
  margin: 0;
  color: var(--muted);
}

/* Sections */

section {
  padding: 64px 0;
}

section h2 {
  font-size: clamp(28px, 5vw, 38px);
  margin: 0 0 8px;
}

.section-lead {
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 40em;
}

/* Screenshots */

.shots {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px var(--gutter) 16px;
  margin: 0 calc(-1 * var(--gutter));
  scrollbar-width: thin;
}

.shots figure {
  flex: 0 0 auto;
  width: min(62vw, 230px);
  margin: 0;
  scroll-snap-align: center;
}

@media (min-width: 1080px) {
  .shots {
    justify-content: space-between;
    overflow: visible;
  }

  .shots figure {
    width: 196px;
  }
}

.shots img {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.shots figcaption {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

/* Features */

.features {
  background: var(--well);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.feature {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
}

.feature h3 {
  font-size: 20px;
  margin: 14px 0 8px;
}

.feature p {
  margin: 0;
  color: rgb(255 255 255 / 0.78);
  font-size: 16px;
}

.chips {
  display: flex;
  gap: 5px;
}

.chips span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.18);
}

.chips .c0 { background: var(--tile-0); }
.chips .c1 { background: var(--tile-1); color: #2b1d00; }
.chips .c2 { background: var(--tile-2); }
.chips .c3 { background: var(--tile-3); }
.chips .c4 { background: var(--tile-4); }

.points {
  display: grid;
  grid-template-columns: repeat(5, auto);
  justify-content: start;
  gap: 2px 16px;
  margin: 14px 0 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.points dt {
  color: var(--muted);
  grid-row: 1;
}

.points dd {
  margin: 0;
  font-weight: 700;
  grid-row: 2;
}

/* Privacy policy */

.hero-slim {
  padding-bottom: 0;
}

.policy {
  max-width: 760px;
  padding-top: 40px;
  padding-bottom: 24px;
}

.policy h1 {
  font-size: clamp(34px, 7vw, 48px);
  margin: 0 0 6px;
}

.policy h2 {
  font-size: 24px;
  margin: 40px 0 10px;
}

.policy .effective {
  color: var(--muted);
  margin: 0 0 32px;
}

.policy p,
.policy ul {
  margin: 0 0 16px;
}

.policy li + li {
  margin-top: 6px;
}

/* Footer */

.site-footer {
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer a {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .chain-bar {
    transition: none;
  }

  .tile.scored,
  .board.refused {
    animation: none;
  }
}
