:root {
  --mint: #83ffe7;
  --ink: #14332f;
  --navy: #1e2a78;
  --blue: #2f6fed;
  --gap: 16px;
  --radius: 16px;
  --shadow: 0 8px 18px rgba(16, 70, 60, 0.14);
  --font: "Nunito", system-ui, sans-serif;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--mint);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cpath d='M90 8 152 90 90 172 28 90Z' fill='%23ffffff' fill-opacity='.18'/%3E%3Cpath d='M90 42 124 90 90 138 56 90Z' fill='%23ffffff' fill-opacity='.12'/%3E%3Cpath d='M8 18 36 46 8 74 -20 46Z' fill='%23e7fffb' fill-opacity='.45'/%3E%3Cpath d='M150 110 186 146 150 182 114 146Z' fill='%23ffffff' fill-opacity='.16'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

.page {
  --tile: 156px;
  padding: 16px 16px 28px;
}

.finder {
  width: min(1000px, 100%);
  margin: 0 auto 14px;
  background: #fff;
  border-radius: 20px;
  padding: 12px 14px 14px;
  box-shadow: var(--shadow);
}

.finder[hidden] {
  display: none;
}

.finder input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--navy);
  padding: 6px 4px 10px;
}

.finder input::placeholder {
  color: #8aa0b8;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 0;
  background: #e7fffb;
  color: #14574c;
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.chip.is-on,
.chip:hover {
  background: var(--navy);
  color: #fff;
}

.filterbar {
  width: min(1000px, 100%);
  margin: 0 auto 12px;
  display: flex;
  justify-content: center;
}

.filterbar[hidden] {
  display: none;
}

.filterbar button {
  border: 0;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.board {
  --tile: 156px;
  width: min(100%, calc(6 * var(--tile) + 5 * var(--gap)));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--tile));
  grid-auto-rows: var(--tile);
  grid-auto-flow: dense;
  gap: var(--gap);
  justify-content: center;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dffcf6;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: inherit;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.tile--lg {
  grid-column: span 2;
  grid-row: span 2;
}

.tile:hover,
.tile:focus-visible {
  transform: scale(1.045);
  z-index: 2;
  box-shadow: 0 14px 28px rgba(16, 60, 55, 0.22);
}

.tile:active {
  transform: scale(0.98);
}

.tile.is-current {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

.tile__art,
.tile__art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tile__name {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #1c2430;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.2;
  padding: 6px 8px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.15s ease;
  pointer-events: none;
}

.tile:hover .tile__name,
.tile:focus-visible .tile__name {
  opacity: 1;
  transform: none;
}

.tile__played {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.tile--brand {
  display: flex;
  flex-direction: column;
  background: #fff;
  cursor: default;
  container-type: inline-size;
}

.tile--brand:hover,
.tile--brand:focus-visible,
.tile--brand:active {
  transform: none;
  box-shadow: var(--shadow);
}

.brand__mark {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

.logo {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22cqi;
  letter-spacing: -0.04em;
  color: var(--navy);
  line-height: 1;
}

.brand__tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 34%;
  border-top: 1px solid #e7eef5;
}

.brand__tools button {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.brand__tools button + button {
  border-left: 1px solid #e7eef5;
}

.brand__tools button.is-on,
.brand__tools button:hover {
  background: #f3f7ff;
}

.brand__tools svg {
  width: 42%;
  height: 42%;
}

.empty {
  width: min(1000px, 100%);
  margin: 28px auto 0;
  text-align: center;
  font-weight: 800;
  color: #0f4f48;
}

.empty[hidden] {
  display: none;
}

.foot {
  width: min(1000px, 100%);
  margin: 28px auto 0;
  text-align: center;
  color: #0f4f48;
}

.foot p {
  margin: 0 0 12px;
  font-weight: 800;
}

.foot__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
}

.foot__nav button {
  border: 0;
  background: transparent;
  color: #0f4f48;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.player {
  --tile: 108px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.player[hidden],
.page[hidden] {
  display: none;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-width: 0;
}

.player-bar .tile--brand {
  width: var(--tile);
  height: var(--tile);
  flex: 0 0 var(--tile);
  cursor: pointer;
}

.rail {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 6px 2px;
}

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

.rail .tile {
  width: var(--tile);
  height: var(--tile);
  flex: 0 0 var(--tile);
  scroll-snap-align: start;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  border-radius: 20px;
  overflow: hidden;
  background: #f4fffd;
  box-shadow: 0 10px 28px rgba(16, 70, 60, 0.12);
}

.stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.stage.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f4fffd 0%, #ffffff 45%, #f4fffd 100%);
  background-size: 200% 100%;
  animation: shine 1.1s linear infinite;
  z-index: 1;
  pointer-events: none;
}

@keyframes shine {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

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

@media (max-width: 520px) {
  .page {
    --tile: calc((100vw - 48px) / 2);
    padding: 12px;
  }

  .board {
    --tile: calc((100vw - 40px) / 2);
    width: 100%;
    grid-template-columns: var(--tile) var(--tile);
  }

  .player {
    --tile: 84px;
    padding: 12px;
    gap: 12px;
  }

  .logo {
    font-size: 18cqi;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .tile__name,
  .stage.is-loading::before {
    transition: none;
    animation: none;
  }

  .tile:hover,
  .tile:active {
    transform: none;
  }
}
