/* blippyarcade site styles. Mobile first: the base rules are for phones, wider screens add to them.
   Colors come from docs/architecture.md (Palette). Fonts are self-hosted from /assets/fonts/ (OFL). */

/* ----- fonts ----- */

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin.woff2?v=27d49d7c83") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin-ext.woff2?v=337681f6b8") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin.woff2?v=20fc9b6fc6") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-ext.woff2?v=511ce96737") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ----- tokens ----- */

:root {
  --sky: #7CC8FF;
  --ink: #1E2A44;
  --cream: #FFF8EC;
  --sun: #FFD23F;
  --pink: #FF6B9A;
  --mint: #4CD98A;
  --violet: #8B6CFF;
  --orange: #FF9F43;
  --felt: #2E9E6A;
  --wood: #C9803F;
  --gold: #E9A21C;

  --bg: var(--cream);
  --text: var(--ink);
  --muted: #4A5675;
  --panel: #FFFFFF;
  --rule: rgba(30, 42, 68, 0.14);

  --font-display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: 16px;
  --maxw: 1180px;
  --radius: 18px;
  --radius-sm: 12px;
  --border: 3px solid var(--ink);
  --chunk: 0 4px 0 var(--ink);
  --chunk-lg: 0 6px 0 var(--ink);
  --touch: 44px;
  --header-h: 60px;
  --bar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
}

/* Neighborhood accent colors, used by sections, chips and category heroes. */
[data-color="mint"] { --accent: var(--mint); --accent-soft: #DDF7E8; }
[data-color="violet"] { --accent: var(--violet); --accent-soft: #E9E3FF; }
[data-color="sun"] { --accent: var(--sun); --accent-soft: #FFF2BF; }
[data-color="sky"] { --accent: var(--sky); --accent-soft: #DDF0FF; }
[data-color="felt"] { --accent: var(--felt); --accent-soft: #D6F0E2; }
[data-color="wood"] { --accent: var(--wood); --accent-soft: #F7E6D2; }
[data-color="orange"] { --accent: var(--orange); --accent-soft: #FFE6CC; }
[data-color="pink"] { --accent: var(--pink); --accent-soft: #FFE0EA; }
[data-color="teal"] { --accent: #2EC4B6; --accent-soft: #D5F5F1; }

/* ----- base ----- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
  /* No rubber-band bounce: on phones it pulled the dark footer away from the page edge. */
  overscroll-behavior-y: none;
  background: var(--cream);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  min-height: 100vh;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

body.is-locked {
  overflow: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.5em;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.8rem, 7vw, 3rem);
}

h2 {
  font-size: clamp(1.3rem, 4.6vw, 1.75rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

button {
  font: inherit;
  color: inherit;
}

button,
a,
[role="button"] {
  touch-action: manipulation;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(30, 42, 68, 0.08);
  padding: 0 4px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

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

.i {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  flex: 0 0 auto;
  vertical-align: -0.22em;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

main {
  position: relative;
  z-index: 1;
  padding-bottom: 40px;
}

main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 100;
  background: var(--sun);
  color: var(--ink);
  border: var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  text-decoration: none;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}

.skip-link:focus {
  top: 8px;
}

.lede {
  font-size: 1.08rem;
  max-width: 60ch;
}

.small-note {
  font-size: 0.92rem;
  color: var(--muted);
}

.empty-note {
  color: var(--muted);
  font-weight: 700;
}

/* ----- buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 20px;
  border: var(--border);
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  box-shadow: var(--chunk);
  font: 800 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sun {
  background: var(--sun);
}

.btn-ghost {
  background: var(--panel);
  box-shadow: none;
  min-height: 40px;
  padding: 0 14px;
  border-width: 2px;
  font-size: 0.95rem;
}

.btn-ghost:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* ----- header ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 248, 236, 0.94);
  border-bottom: var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.wordmark-mark {
  width: 36px;
  height: 36px;
}

.wordmark-text {
  font: 700 1.45rem/1 var(--font-display);
  letter-spacing: -0.02em;
}

.wordmark-text span {
  color: var(--pink);
}

.site-nav {
  display: none;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--sun);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px 0 6px;
  border: var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 3px 0 var(--ink);
  font: 800 1.02rem/1 var(--font-body);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.coin-pill .i {
  width: 26px;
  height: 26px;
}

.coin-pill.is-bump {
  animation: bump 420ms ease;
}

.me-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  border: var(--border);
  border-radius: 50%;
  background: var(--sky);
  overflow: hidden;
  box-shadow: 0 3px 0 var(--ink);
}

.me-face {
  width: 100%;
  height: 100%;
}

@media (max-width: 359px) {
  :root {
    --gutter: 12px;
  }

  .wordmark-text {
    font-size: 1.2rem;
  }

  .wordmark-mark {
    width: 30px;
    height: 30px;
  }
}

@media (min-width: 900px) {
  .site-nav {
    display: block;
  }

  .wordmark {
    margin-right: 12px;
  }

  .site-nav {
    margin-right: auto;
  }
}

/* ----- homepage hero and town ----- */

.town {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 330px;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.town svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: calc(100% + 60px);
  transform: translate3d(0, var(--parallax, 0px), 0);
  will-change: transform;
}

.hero {
  padding: 22px 0 6px;
  display: grid;
  gap: 16px;
}

.hero-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin-bottom: 8px;
  max-width: 14ch;
}

.hero .lede {
  margin: 0;
  max-width: 36ch;
}

@media (min-width: 760px) {
  .town {
    height: 380px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: end;
    padding: 44px 0 12px;
  }
}

/* ----- daily bonus card ----- */

.daily {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--chunk);
}

.daily-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: var(--border);
  border-radius: 14px;
  background: var(--sun);
}

.daily-icon .i {
  width: 28px;
  height: 28px;
}

.daily.is-ready .daily-icon {
  animation: wiggle 2.2s ease-in-out infinite;
}

.daily-text {
  flex: 1 1 auto;
  min-width: 0;
}

.daily-title {
  display: block;
  font: 600 1.08rem/1.2 var(--font-display);
}

.daily-sub {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
}

.streak {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.streak span {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
}

.streak span.is-on {
  background: var(--sun);
}

.daily .btn {
  flex: 0 0 auto;
  padding: 0 16px;
}

/* ----- finder: search and chips ----- */

.finder {
  position: relative;
  z-index: 2;
  margin-top: 18px;
  padding: 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--chunk);
}

.no-js .finder {
  display: none;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
}

.search .i {
  width: 22px;
  height: 22px;
}

.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  font: 700 1rem var(--font-body);
  color: var(--ink);
  outline: none;
}

.search:focus-within {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.chip-row {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Chips scroll sideways on phones (one line, no wrap), and wrap on wider screens. */
.filters {
  margin: 10px -14px -4px;
  padding: 2px 14px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* Snap points respect the row's padding, so the first chip lines up with the search box. */
  scroll-padding-inline: 14px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip,
.chip-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: 800 0.95rem/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
}

.chip .i {
  width: 16px;
  height: 16px;
}

.chip:hover,
.chip-links a:hover {
  background: var(--accent-soft, #FFF2BF);
}

.chip[aria-pressed="true"] {
  background: var(--accent, var(--sun));
  box-shadow: 0 3px 0 var(--ink);
}

.chip-live[aria-pressed="false"] {
  background: #DDF7E8;
}

.chip-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.chip-links {
  flex-wrap: wrap;
}

.chip-links a {
  border-left: 8px solid var(--accent, var(--sun));
}

@media (min-width: 760px) {
  .finder {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }

  .filters {
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* The homepage's search button: looks like a search box, opens the search sheet. */
.search-button {
  width: 100%;
  cursor: pointer;
  font: 700 1rem var(--font-body);
  color: var(--muted);
  text-align: left;
}

.search-button .search-label {
  flex: 1 1 auto;
}

.search-hint {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.search-button:hover {
  background: #FFF2BF;
}

/* ----- the search sheet ----- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--cream);
  animation: sheet-in 220ms ease;
}

.search-top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 248, 236, 0.96);
  border-bottom: var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 68px;
}

.search-bar .search {
  flex: 1 1 auto;
  background: var(--panel);
}

.search-bar .pbtn-light {
  width: 48px;
  height: 48px;
  border: var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

.search-bar .pbtn-light:hover {
  background: var(--sun);
}

.search-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding-top: 14px;
  padding-bottom: calc(40px + var(--safe-b));
}

.search-body > * {
  min-width: 0;
}

.filter-group {
  margin: 0 0 6px;
}

.filter-title {
  margin: 0 0 6px;
  font: 800 0.85rem/1.2 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-row {
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.chip-filter {
  min-height: 40px;
  padding: 0 6px 0 14px;
  gap: 8px;
}

.chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--cream);
  border: 2px solid var(--ink);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.chip-filter[aria-pressed="true"] {
  background: var(--sun);
  box-shadow: 0 3px 0 var(--ink);
}

.chip-filter[aria-pressed="true"] .chip-count {
  background: var(--ink);
  color: var(--cream);
}

.chip-filter:disabled {
  opacity: 0.4;
  cursor: default;
}

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 8px 0 10px;
}

.results-count {
  margin: 0;
  font: 600 1.35rem/1.2 var(--font-display);
}

.sort-pills {
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-sort[aria-checked="true"] {
  background: var(--ink);
  color: var(--cream);
}

.active-filters {
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.chip-active {
  background: var(--sun);
  gap: 6px;
}

.chip-active .i {
  width: 14px;
  height: 14px;
}

.chip-clear {
  border-style: dashed;
}

.results-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px;
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}

.results-empty p {
  margin: 0;
}

.empty-face {
  width: 80px;
  height: 80px;
  border: var(--border);
  border-radius: 50%;
  background: var(--sky);
}

@media (min-width: 900px) {
  .search-body {
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }

  .search-filters {
    position: sticky;
    top: 90px;
    padding: 16px;
    border: var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--chunk);
  }

  .filter-row {
    flex-wrap: wrap;
    margin: 0;
    padding: 0 0 4px;
    overflow: visible;
  }

  .search-results .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

.fact-tag a {
  color: var(--ink);
}

/* ----- rows and neighborhoods ----- */

.row {
  margin: 28px 0 0;
}

.row-title {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.hood {
  margin: 34px 0 0;
}

.hood-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hood-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hood h2::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 5px;
  background: var(--accent, var(--sun));
  transform: rotate(8deg);
}

.hood-count {
  margin: 2px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.see-all {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-height: var(--touch);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.see-all .i {
  width: 18px;
  height: 18px;
}

.see-all:hover {
  text-decoration: underline;
}

/* A row of tiles: a side-scrolling shelf on phones, a grid on wider screens. */
.tile-row {
  list-style: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 42%);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.tile-row::-webkit-scrollbar {
  display: none;
}

.tile-row > .tile {
  scroll-snap-align: start;
}

.tile-row-feature {
  grid-auto-columns: minmax(240px, 78%);
}

.tile-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

@media (min-width: 600px) {
  .tile-row {
    grid-auto-columns: minmax(170px, 30%);
  }

  .tile-row-feature {
    grid-auto-columns: minmax(260px, 46%);
  }

  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px 16px;
  }
}

@media (min-width: 1024px) {
  .tile-row {
    margin: 0;
    padding: 4px 0 6px;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    grid-auto-columns: auto;
    overflow: visible;
    gap: 20px 16px;
  }

  .tile-row-feature {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

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

.tile {
  position: relative;
  min-width: 0;
}

.tile-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--chunk);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

a.tile-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--chunk-lg);
}

a.tile-link:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

a.tile-link:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius);
}

.tile-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--sky);
  border-bottom: var(--border);
  overflow: hidden;
}

.tile-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font: 800 0.72rem/1.4 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-new {
  background: var(--sun);
}

.badge-soon {
  background: var(--panel);
}

.tile-spark {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
}

.tile-spark .i {
  width: 16px;
  height: 16px;
  animation: twinkle 1.8s ease-in-out infinite;
}

.tile-body {
  display: block;
  padding: 9px 11px 11px;
}

.tile-title {
  display: block;
  font: 600 1.06rem/1.2 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.tile-meta .i {
  width: 16px;
  height: 16px;
}

.tile.is-soon .tile-link {
  box-shadow: 0 4px 0 rgba(30, 42, 68, 0.35);
  border-color: rgba(30, 42, 68, 0.55);
  cursor: default;
}

.tile.is-soon .tile-art img {
  filter: saturate(0.75);
  opacity: 0.88;
}

.tile.is-soon .tile-title {
  color: #39466A;
}

.tile-feature .tile-title {
  font-size: 1.3rem;
}

.tile-feature .tile-body {
  padding: 12px 14px 14px;
}

.tile-more .tile-link {
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 160px;
  background: var(--accent-soft, var(--cream));
  border-style: dashed;
  box-shadow: none;
}

.more-count {
  font: 700 2rem/1 var(--font-display);
}

.more-label {
  font-weight: 800;
}

/* Keep playing: small cards with the best score. */
.recent-row {
  list-style: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 10px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.recent-row::-webkit-scrollbar {
  display: none;
}

/* Every card the same size: a fixed width, and each stretches to the tallest in the row (a long
   name like Brick Breaker wraps to two lines). */
.recent-row li {
  display: flex;
  flex: 0 0 auto;
}

.recent-row a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 210px;
  padding: 6px 14px 6px 6px;
  border: var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 3px 0 var(--ink);
  text-decoration: none;
}

.recent-row img {
  width: 64px;
  height: 40px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  object-fit: cover;
}

.recent-name {
  display: block;
  font: 600 1rem/1.2 var(--font-display);
}

.recent-best {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.search-results {
  margin-top: 24px;
}

.coming-soon {
  margin: 0;
  padding: 18px 20px;
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

/* ----- ad slots: every size is fixed in CSS so the layout never shifts ----- */

.ad-wrap {
  margin: 28px auto;
  width: fit-content;
  max-width: 100%;
}

.ad-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ad-slot {
  position: relative;
  display: block;
  max-width: 100%;
  border: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(100deg, var(--sun) 0%, var(--orange) 60%, var(--pink) 100%);
  color: var(--ink);
}

.ad-slot[data-size="728x90"] {
  width: 320px;
  aspect-ratio: 320 / 50;
}

.ad-slot[data-size="300x250"] {
  width: 300px;
  aspect-ratio: 300 / 250;
}

.ad-slot a.ad-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 0 14px;
  color: var(--ink);
  text-decoration: none;
}

.ad-slot .ad-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
}

.ad-slot .ad-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ad-slot .ad-title {
  font: 600 1rem/1.15 var(--font-display);
}

.ad-slot .ad-copy {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-slot[data-size="728x90"] .ad-title {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-slot .ad-cta {
  display: none;
}

.ad-slot[data-size="300x250"] a.ad-link {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 18px;
  gap: 8px;
}

.ad-slot[data-size="300x250"] .ad-text {
  align-items: center;
}

.ad-slot[data-size="300x250"] .ad-title {
  font-size: 1.5rem;
}

.ad-slot[data-size="300x250"] .ad-copy,
.ad-slot[data-size="300x250"] .ad-cta {
  display: block;
}

.ad-slot[data-size="300x250"] .ad-icon {
  width: 72px;
  height: 72px;
}

.ad-slot .ad-cta {
  margin-top: 6px;
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 800;
  font-size: 0.85rem;
}

.billboard {
  margin: 34px 0 0;
  padding: 6px 0 2px;
  border-top: 2px dashed var(--rule);
  border-bottom: 2px dashed var(--rule);
}

.billboard .ad-wrap {
  margin: 16px auto;
}

@media (min-width: 760px) {
  .ad-slot[data-size="728x90"] {
    width: 728px;
    aspect-ratio: 728 / 90;
  }

  .ad-slot[data-size="728x90"] .ad-copy {
    font-size: 0.92rem;
  }

  .ad-slot[data-size="728x90"] .ad-icon {
    width: 34px;
    height: 34px;
  }

  .ad-slot[data-size="728x90"] .ad-title {
    font-size: 1.25rem;
  }

  .ad-slot[data-size="728x90"] .ad-cta {
    display: block;
    margin: 0 0 0 auto;
  }
}

/* ----- category pages ----- */

.cat-hero {
  background: var(--accent-soft, var(--cream));
  border-bottom: var(--border);
  padding: 4px 0 18px;
}

.cat-hero h1 {
  margin-top: 8px;
}

.cat-count {
  display: inline-block;
  margin: 0;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 800;
  font-size: 0.88rem;
}

/* ----- breadcrumbs ----- */

.crumbs {
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
}

.crumbs li + li::before {
  content: "/";
  margin-right: 8px;
  opacity: 0.5;
}

.crumbs a {
  font-weight: 700;
}

/* ----- game page: the theater ----- */

/* The game owns the screen. A full-width dark band holds the player: the console bar on top and the
   stage under it. On phones the site header is hidden and the theater fills the viewport; the page
   copy sits below, one tap (the info button) away. The engine letterboxes inside the canvas. */

.theater {
  position: relative;
  z-index: 3;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(139, 108, 255, 0.35), transparent 60%),
    var(--ink);
  border-bottom: var(--border);
}

.player {
  margin: 0 auto;
  width: 100%;
  height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--cream);
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--bar-h);
  padding: 0 8px;
  flex: 0 0 auto;
}

.player-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.player-name {
  font: 600 1.1rem/1.15 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-best {
  font-size: 0.78rem;
  font-weight: 800;
  color: #C9D3E8;
}

.pbtn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 248, 236, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.pbtn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.pbtn:active {
  transform: translateY(1px);
}

.pbtn:focus-visible {
  outline-color: var(--sun);
}

.pbtn .i {
  width: 20px;
  height: 20px;
}

.pbtn .i-down {
  transform: rotate(90deg);
}

.pbtn .i-off {
  display: none;
}

.pbtn[data-action="sound"][aria-pressed="false"] .i-on,
.pbtn[data-action="pause"][aria-pressed="true"] .i-on,
.pbtn[data-action="fullscreen"][aria-pressed="true"] .i-on {
  display: none;
}

.pbtn[data-action="sound"][aria-pressed="false"] .i-off,
.pbtn[data-action="pause"][aria-pressed="true"] .i-off,
.pbtn[data-action="fullscreen"][aria-pressed="true"] .i-off {
  display: block;
}

.pbtn[data-action="pause"][aria-pressed="true"] {
  background: var(--mint);
  border-color: var(--mint);
  color: var(--ink);
}

.coin-pill-bar {
  min-height: 36px;
  padding: 0 10px 0 4px;
  border-width: 2px;
  box-shadow: none;
  font-size: 0.95rem;
}

.coin-pill-bar .i {
  width: 24px;
  height: 24px;
}

.stage-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  /* Cream, like the engine's loading screen, so the game appears without a dark flash. */
  background: var(--cream);
  overflow: hidden;
}

.stage-frame > canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

/* The game is the focus; a ring around it only helps keyboard users on wide screens. */
.stage-frame > canvas:focus,
.stage-frame > canvas:focus-visible {
  outline: none;
}

@media (min-width: 760px) and (hover: hover) {
  .stage-frame:has(canvas:focus-visible) {
    border-color: var(--sun);
  }
}

/* Phones: no site header on game pages; the theater is the screen. */
@media (max-width: 759px) {
  body[data-page="play"] .site-header {
    display: none;
  }

  body[data-page="play"] {
    overscroll-behavior-y: none;
  }

  .player {
    height: 100svh;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .pbtn-fs {
    display: none;
  }
}

@media (max-width: 359px) {
  .coin-pill-bar {
    display: none;
  }
}

/* Wider screens: the header stays, and the theater holds a framed stage as tall as the window. */
@media (min-width: 760px) {
  .theater {
    padding: 14px var(--gutter) 22px;
  }

  .pbtn-info {
    display: none;
  }

  .player {
    height: auto;
    max-width: calc((100svh - var(--header-h) - var(--bar-h) - 48px) * 9 / 16);
    min-width: 340px;
  }

  .player.is-landscape {
    max-width: min(100%, calc((100svh - var(--header-h) - var(--bar-h) - 48px) * 16 / 9));
  }

  .player-bar {
    padding: 0 2px 8px;
  }

  .stage-frame {
    flex: none;
    aspect-ratio: 9 / 16;
    border: 3px solid rgba(255, 248, 236, 0.9);
    border-radius: var(--radius);
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35);
  }

  .player.is-landscape .stage-frame {
    aspect-ratio: 16 / 9;
  }
}

/* Docking: scrolled down, the player undocks into a mini window in the top corner (top, not
   bottom: phone toolbars move bottom-fixed things around), paused. Tapping it docks it back. */

.theater-hold {
  display: none;
}

.theater.is-holding .theater-hold {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #C9D3E8;
  font-weight: 800;
}

.theater-hold .i {
  width: 44px;
  height: 44px;
  opacity: 0.6;
}

.dock-button {
  display: none;
}

.player.is-undocked {
  position: fixed;
  z-index: 55;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 10px;
  left: auto;
  width: 92px;
  height: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
  border: var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 12px 26px rgba(30, 42, 68, 0.28);
  animation: undock-in 240ms cubic-bezier(.2, 1.3, .4, 1);
}

.player.is-undocked .player-bar {
  display: none;
}

.player.is-undocked .stage-frame {
  flex: none;
  height: auto;
  aspect-ratio: 9 / 16;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.player.is-landscape.is-undocked {
  width: 170px;
}

.player.is-landscape.is-undocked .stage-frame {
  aspect-ratio: 16 / 9;
}

.player.is-undocked .dock-button {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.dock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font: 800 0.8rem/1 var(--font-body);
  box-shadow: 0 2px 0 var(--ink);
}

.dock-pill .i {
  width: 12px;
  height: 12px;
}

@media (min-width: 760px) {
  .player.is-undocked {
    top: calc(var(--header-h) + 14px);
    right: 20px;
    width: 140px;
  }

  .player.is-landscape.is-undocked {
    width: 260px;
  }
}

@keyframes undock-in {
  from { transform: scale(0.6) translateY(-20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Full screen (real, or the immersive fallback): the player covers everything. */
.player:fullscreen,
.player.is-immersive {
  position: fixed;
  inset: 0;
  z-index: 60;
  max-width: none;
  width: 100%;
  height: 100%;
  background: var(--ink);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.player:-webkit-full-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  background: var(--ink);
}

.player:fullscreen .stage-frame,
.player.is-immersive .stage-frame {
  flex: 1 1 auto;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.play-wrap {
  padding-top: 4px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 32px;
}

.play-main .ad-wrap {
  margin: 20px auto 8px;
}

.game-info {
  max-width: 68ch;
}

.game-info h1 {
  margin: 6px 0 10px;
}

.game-info h2 {
  margin-top: 1.5em;
}

.game-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #F1EDFF;
  font-weight: 700;
  font-size: 0.92rem;
}

.game-notice p {
  margin: 0;
}

.game-notice .i {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  color: var(--violet);
}

.facts {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.facts li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.86rem;
  font-weight: 800;
}

.facts a {
  text-decoration: none;
}

.facts .i {
  width: 18px;
  height: 18px;
}

.fact-coins {
  background: #FFF2BF !important;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.stat {
  padding: 10px 10px 8px;
  border: var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.stat-label .i {
  width: 14px;
  height: 14px;
}

.stat-value {
  display: block;
  font: 600 1.4rem/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.steps {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

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

.play-side .ad-wrap[data-for="game-side"] {
  display: none;
}

.related {
  margin-top: 28px;
}

.tile-grid-compact .tile-meta {
  display: none;
}

@media (min-width: 1024px) {
  .play-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    margin-top: 12px;
  }

  .play-side {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }

  .play-side .ad-wrap[data-for="game-side"] {
    display: block;
    margin: 6px 0 0;
  }

  .related {
    margin-top: 22px;
  }

  .related .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .related .tile-title {
    font-size: 0.95rem;
  }
}

/* ----- achievements ----- */

.ach-list {
  list-style: none;
  margin: 0 0 1em;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ach {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--panel);
}

.ach-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #E8ECF5;
  color: #8A94AD;
}

.ach.is-done .ach-icon {
  background: var(--sun);
  color: var(--ink);
}

.ach-text {
  flex: 1 1 auto;
  min-width: 0;
}

.ach-name {
  display: block;
  font: 600 1rem/1.2 var(--font-display);
}

.ach-desc {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
}

.ach-unlock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #6A4FE0;
}

.ach-unlock .i {
  width: 14px;
  height: 14px;
}

.ach-reward {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ach.is-done .ach-reward {
  color: var(--felt);
}

.ach.is-done .ach-reward .i-coin {
  display: none;
}

/* Tiers: the medal colors, on earned achievements and on the tier labels and chips. */
.ach[data-tier="bronze"].is-done .ach-icon,
.ach[data-tier="bronze"] .ach-tier,
.chip-tier[data-tier="bronze"] .tier-dot {
  background: #F2B58A;
}

.ach[data-tier="silver"].is-done .ach-icon,
.ach[data-tier="silver"] .ach-tier,
.chip-tier[data-tier="silver"] .tier-dot {
  background: #D6DEEC;
}

.ach[data-tier="gold"].is-done .ach-icon,
.ach[data-tier="gold"] .ach-tier,
.chip-tier[data-tier="gold"] .tier-dot {
  background: var(--sun);
}

.ach[data-tier="diamond"].is-done .ach-icon,
.ach[data-tier="diamond"] .ach-tier,
.chip-tier[data-tier="diamond"] .tier-dot {
  background: #A8EEF5;
}

.ach-tier {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font: 800 0.66rem/1.5 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.ach:not(.is-done) .ach-tier {
  opacity: 0.6;
}

.ach-meta {
  display: block;
  margin-top: 3px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}

.ach-meta a {
  color: inherit;
}

/* ----- avatar studio ----- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.studio > * {
  min-width: 0;
}

.studio-stage .stage-frame.is-avatar {
  aspect-ratio: 9 / 8;
  max-width: 520px;
  margin: 0 auto;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--chunk);
  background: var(--sky);
}

.move-row {
  margin: 10px calc(-1 * var(--gutter)) 0;
  padding: 2px var(--gutter) 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.move-row::-webkit-scrollbar {
  display: none;
}

.studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.studio-head h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 12px calc(-1 * var(--gutter)) 0;
  padding: 2px var(--gutter) 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 800;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--cream);
}

.tab-panel {
  padding: 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--chunk);
}

.panel-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 800;
}

.option-grid {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 6px 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  cursor: pointer;
  text-align: center;
}

.option canvas {
  width: 72px;
  height: 72px;
}

.option-name {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.15;
}

.option-price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sun);
  font-size: 0.75rem;
  font-weight: 800;
}

.option-price .i {
  width: 14px;
  height: 14px;
}

.option-lock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #6A4FE0;
}

.option-lock .i {
  width: 13px;
  height: 13px;
}

.option[aria-pressed="true"] {
  background: #DDF7E8;
  box-shadow: inset 0 0 0 3px var(--mint);
}

.option[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='%231E2A44' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.option.is-locked canvas {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.option[data-rarity="rare"] {
  border-color: #2E6FD8;
}

.option[data-rarity="legendary"] {
  border-color: var(--gold);
  background: #FFF6D6;
}

.option[data-rarity="signature"] {
  border-color: var(--violet);
  background: #F1EDFF;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.swatch {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 6px var(--ink);
}

@media (min-width: 520px) {
  .option-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .studio {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: start;
    gap: 32px;
  }

  .studio-stage {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }

  .move-row {
    margin: 12px 0 0;
    padding: 0;
    flex-wrap: wrap;
  }

  .tabs {
    margin: 12px 0 0;
    padding: 0 0 10px;
    flex-wrap: wrap;
  }
}

/* Profile: coins and achievements. */
.profile-grid {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.coins-panel,
.trophies {
  padding: 16px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.coins-panel h2,
.trophies h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coins-panel h2 .i,
.trophies h2 .i {
  width: 28px;
  height: 28px;
}

.coin-balance {
  font: 600 2.2rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  margin: 0 0 12px;
}

.earn-list {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

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

.coin-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.coin-log li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 0.92rem;
}

.coin-log .amt {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coin-log .amt.is-plus {
  color: var(--felt);
}

.coin-log .amt.is-minus {
  color: #C2334F;
}

.trophy-progress {
  font-weight: 800;
}

.trophy-tools {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.trophy-tools[hidden] {
  display: none;
}

.trophy-tiers {
  flex-wrap: wrap;
}

.tier-dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.trophy-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trophy-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
}

.trophy-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 36px 0 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--cream) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9.5 6 6 6-6' fill='none' stroke='%231E2A44' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 16px 16px;
  color: var(--ink);
  font: 700 0.95rem var(--font-body);
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.trophy-field select:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.trophy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-weight: 800;
  cursor: pointer;
}

.trophy-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--violet);
}

.trophy-more {
  display: flex;
  margin: 4px auto 0;
}

.trophy-more[hidden] {
  display: none;
}

@media (min-width: 900px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* Buy sheet: slides up from the bottom on phones, a centered dialog on wider screens. */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(30, 42, 68, 0.5);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  padding: 0 0 var(--safe-b);
  background: var(--cream);
  border-top: var(--border);
  border-radius: 24px 24px 0 0;
  animation: sheet-in 220ms ease;
}

.sheet-body {
  max-width: 480px;
  margin: 0 auto;
  padding: 22px var(--gutter) 22px;
  text-align: center;
}

.sheet-preview {
  width: 120px;
  height: 120px;
  margin: 0 auto 6px;
  display: block;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 600px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 420px;
    transform: translate(-50%, -50%);
    border: var(--border);
    border-radius: 24px;
    box-shadow: var(--chunk-lg);
    animation: none;
  }
}

/* ----- content pages ----- */

.page {
  padding-top: 24px;
  max-width: 70ch;
}

.page h2 {
  margin-top: 1.4em;
}

.page-404 {
  max-width: none;
}

.page-404 .tile-grid {
  max-width: 640px;
  margin-bottom: 20px;
}

.draft-note {
  display: inline-block;
  margin: 0 0 16px;
  padding: 8px 14px;
  border: var(--border);
  border-radius: 12px;
  background: var(--sun);
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 1.2em;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-weight: 800;
  padding: 10px 12px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-top: 2px solid var(--rule);
  word-break: break-word;
}

thead th {
  border-top: 0;
  border-bottom: var(--border);
}

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

.site-footer {
  position: relative;
  z-index: 2;
  background: var(--ink);
  color: var(--cream);
  padding: 28px 0 calc(48px + var(--safe-b));
}

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

.site-footer :focus-visible {
  outline-color: var(--sun);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.wordmark-footer {
  margin-right: 0;
  color: var(--cream);
}

.footer-tag {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.85;
}

.footer-links ul {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 700;
}

.footer-links a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.footer-prefs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pref {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--cream);
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  font-weight: 800;
  cursor: pointer;
}

.pref::before {
  content: "";
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: inset 2px 0 0 2px transparent;
  transition: background 150ms ease;
}

.pref[aria-pressed="true"]::before {
  background: var(--mint) radial-gradient(circle at 20px 8px, var(--cream) 5px, transparent 5.5px);
}

.pref[aria-pressed="false"]::before {
  background: rgba(255, 255, 255, 0.25) radial-gradient(circle at 8px 8px, var(--cream) 5px, transparent 5.5px);
}

.footer-note {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
  max-width: 60ch;
}

/* ----- casino games: never shown to a player who said they are a child ----- */

.age-child [data-casino] {
  display: none !important;
}

/* ----- the update notice: a deploy needs open pages refreshed (core.js) ----- */

.update-banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 24px), 560px);
  padding: 10px 10px 10px 14px;
  border: var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--chunk);
  transform: translateX(-50%);
}

.update-banner > .i {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--violet);
}

.update-text {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.update-go {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
}

.update-later {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.update-later .i {
  width: 16px;
  height: 16px;
}

/* ----- games that cost coins to play ----- */

.tile.is-short .tile-meta,
.fact-coins.is-short {
  color: var(--muted);
}

.coin-gate {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  background: rgba(30, 42, 68, 0.94);
  color: var(--cream);
  text-align: center;
}

.coin-gate-icon {
  width: 72px;
  height: 72px;
}

.coin-gate-title {
  margin: 0;
  font: 600 1.6rem/1.2 var(--font-display);
}

.coin-gate-text {
  margin: 0 0 6px;
  max-width: 30ch;
  font-weight: 700;
}

.coin-gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ----- share: the button, and the panel shown when a link cannot be copied ----- */

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.share-btn .i {
  width: 18px;
  height: 18px;
}

.hero-copy .share-btn {
  margin-top: 14px;
}

.share-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 42, 68, 0.5);
}

.share-card {
  position: relative;
  width: min(100%, 420px);
  padding: 18px;
  border: var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--chunk);
}

.share-card-title {
  margin: 4px 52px 14px 0;
  font: 600 1.2rem/1.25 var(--font-display);
}

.share-card-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}

.share-card-close .i {
  width: 18px;
  height: 18px;
}

.share-card-link {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  font: 700 0.95rem var(--font-body);
}

.share-card-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ----- toasts ----- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  z-index: 80;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  width: min(92vw, 380px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--chunk);
  font-weight: 800;
  animation: toast-in 260ms cubic-bezier(.2, 1.4, .4, 1);
}

.toast .i {
  width: 28px;
  height: 28px;
}

.toast-sub {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.toast.is-coins {
  background: #FFF6D6;
}

.toast.is-trophy {
  background: #F1EDFF;
}

.toast.is-leaving {
  animation: toast-out 220ms ease forwards;
}

/* While a sheet or the search is open, toasts move to the top so they never cover its buttons. */
body.is-locked .toasts {
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  flex-direction: column;
}

/* On a game page the toasts sit at the top, clear of the player's thumbs. */
body[data-page="play"] .toasts {
  top: calc(var(--bar-h) + 8px + env(safe-area-inset-top, 0px));
  bottom: auto;
  flex-direction: column;
}

@media (min-width: 760px) {
  body[data-page="play"] .toasts {
    top: calc(var(--header-h) + 12px);
  }
}

@media (min-width: 900px) {
  .toasts {
    left: auto;
    right: 20px;
    transform: none;
  }
}

/* ----- companion (the player's avatar on the homepage, never blocks input) ----- */

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

.companion {
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  height: 96px;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.companion canvas {
  display: block;
  width: 100%;
  height: 100%;
  animation: bob 1.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}

.companion.is-cheer canvas {
  animation: hop 380ms ease-in-out 3;
}

/* On phones the companion perches on the daily bonus card instead of floating: nothing is pinned
   to the bottom of a phone screen, where the browser's toolbar moves things around. */
.daily-wrap {
  position: relative;
}

.daily-wrap > .companion {
  position: absolute;
  left: auto;
  top: -58px;
  right: 26px;
  width: 48px;
  height: 64px;
  transform: none !important;
  z-index: 3;
  pointer-events: none;
}

.companion-layer.is-still .companion canvas,
.daily-wrap > .companion.is-still canvas {
  animation: none;
}

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

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  40% { transform: translateY(-14px) scale(0.96, 1.04); }
}

@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85% { transform: rotate(-10deg); }
  90% { transform: rotate(10deg); }
  95% { transform: rotate(-6deg); }
}

@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(0.75) rotate(20deg); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

/* The player's in-site Motion setting (footer) and the system setting both calm things down. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .town svg {
    transform: none;
  }
}

html.calm *,
html.calm *::before,
html.calm *::after {
  animation: none !important;
  transition: none !important;
}

html.calm .town svg {
  transform: none;
}
