/* The website's look: the app's Night colours (src/theme.ts), on a simple page. */
:root {
  --background: #141721;
  --surface: #252a3a;
  --surface-raised: #313749;
  --edge: #0b0d14;
  --text: #eef1f7;
  --text-soft: #c4cad8;
  --text-muted: #9aa2b8;
  --tile: #f4eedf;
  --tile-edge: #d2c6ab;
  --tile-text: #141a2c;
  --primary: #336cf0;
  --primary-edge: #1f48b0;
  --primary-text: #93b3ff;
  --gold: #ffb938;
  --gold-edge: #c7861a;
  --on-gold: #1a1305;
  --valid: #2dbe6c;
  --valid-edge: #1f8a4c;
  --valid-text: #3fcb7b;
  --on-valid: #05210f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.5;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

a {
  color: var(--primary-text);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

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

/* The app icon, with iOS's rounded corners. */
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The home page's sample round: a 4 × 4 board the script swipes words on. */
.demo {
  width: 100%;
  max-width: 340px;
  margin: 6px auto 2px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.demo-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.demo-word {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text);
}

.demo-word.valid {
  color: var(--valid-text);
}

.demo-score {
  color: var(--text-muted);
  font-size: 15px;
  white-space: nowrap;
}

.demo-score strong {
  color: var(--gold);
  font-size: 22px;
}

.board {
  position: relative;
  aspect-ratio: 1;
  container-type: inline-size;
}

.tile {
  position: absolute;
  left: calc(var(--c) * 26%);
  top: calc(var(--r) * 26%);
  width: 22%;
  height: 22%;
  border-radius: 16%;
  border-bottom: 4px solid var(--tile-edge);
  background: var(--tile);
  color: var(--tile-text);
  font-size: 30px;
  font-size: 10cqw;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.tile.on {
  background: var(--primary);
  border-bottom-color: var(--primary-edge);
  color: #ffffff;
}

.board.valid .tile.on {
  background: var(--valid);
  border-bottom-color: var(--valid-edge);
  color: var(--on-valid);
}

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

.trail polyline {
  fill: none;
  stroke: var(--primary-text);
  stroke-width: 15;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}

.board.valid .trail polyline {
  stroke: var(--valid-text);
}

/* The ghost finger, as in the tutorial. */
.finger {
  position: absolute;
  left: 11%;
  top: 11%;
  width: 15%;
  height: 15%;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.25);
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  transition: left 0.17s linear, top 0.17s linear, opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.finger.down {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.pop {
  position: absolute;
  left: 50%;
  top: 38%;
  color: var(--valid-text);
  font-size: 44px;
  font-size: 15cqw;
  font-weight: 900;
  text-shadow: 0 3px 0 var(--edge);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.pop.show {
  animation: pop 0.9s ease-out;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%);
  }
  20% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -90%);
  }
}

.found {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  /* Room for two rows of words, so the button below doesn't jump when the last one wraps. */
  min-height: 78px;
  align-content: flex-start;
}

.chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.chip b {
  color: var(--valid-text);
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin: 8px 0 0;
  font-size: 19px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border-bottom: 5px solid var(--edge);
  background: var(--surface);
}

.card.gold {
  border: 2px solid var(--gold);
}

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

.soft {
  color: var(--text-soft);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-bottom: 5px solid var(--primary-edge);
  background: var(--primary);
  color: #ffffff;
}

.button.gold {
  border-bottom: 5px solid var(--gold-edge);
  background: var(--gold);
  color: var(--on-gold);
}

.button.plain {
  border-bottom: 4px solid var(--edge);
  background: var(--surface-raised);
  color: var(--text);
}

.code {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--background);
}

.code strong {
  flex: 1;
  font-size: 28px;
  letter-spacing: 4px;
}

ol,
ul {
  margin: 0;
  padding-left: 22px;
}

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

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 14px;
}
