/* Doge 2048: Brainrot Edition */

/* Lilita One and Rubik, SIL Open Font License 1.1 (see fonts/OFL.txt) */
@font-face {
  font-family: 'Lilita One';
  src: url(../fonts/lilita-one.woff2) format('woff2');
  font-display: swap;
}

@font-face {
  font-family: Rubik;
  font-weight: 500;
  src: url(../fonts/rubik-500.woff2) format('woff2');
  font-display: swap;
}

@font-face {
  font-family: Rubik;
  font-weight: 700;
  src: url(../fonts/rubik-700.woff2) format('woff2');
  font-display: swap;
}

@font-face {
  font-family: Rubik;
  font-weight: 900;
  src: url(../fonts/rubik-900.woff2) format('woff2');
  font-display: swap;
}

:root {
  --bg: #0b0614;
  --bg2: #1b0b3a;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #b9a9d9;
  --lime: #c6ff3d;
  --pink: #ff4fd8;
  --cyan: #3df5ff;
  --gold: #ffd447;
  --red: #ff3d6e;
  --purple: #b65cff;
  --display: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --ui: Rubik, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ad-bottom: 0px;
  --rail-left: 0px;
  --rail-right: 0px;
  --play-w: calc(100vw - var(--rail-left) - var(--rail-right));
  --board: min(calc(var(--play-w) * 0.92), calc(100dvh - 330px - var(--ad-bottom)), 470px);
  --gap: calc(var(--board) * 0.028);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
}

@supports not (height: 100dvh) {
  :root {
    --board: min(calc(var(--play-w) * 0.92), calc(100vh - 330px - var(--ad-bottom)), 470px);
  }
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

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

a {
  color: var(--muted);
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

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

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  mix-blend-mode: screen;
}

.haptic {
  position: fixed;
  left: -100px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- background ---------- */

.bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%);
}

.blob {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite alternate;
}

.b1 {
  background: var(--purple);
  left: -30vmax;
  top: -20vmax;
}

.b2 {
  background: var(--pink);
  right: -35vmax;
  top: 20vh;
  animation-duration: 22s;
  opacity: 0.22;
}

.b3 {
  background: var(--cyan);
  left: 10vw;
  bottom: -45vmax;
  animation-duration: 26s;
  opacity: 0.18;
}

@keyframes drift {
  to {
    transform: translate(8vmax, 6vmax) scale(1.15);
  }
}

.bg-grid {
  position: absolute;
  inset: -50%;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  transform: perspective(600px) rotateX(55deg) translateY(10%);
  mask-image: linear-gradient(transparent, #000 60%);
  -webkit-mask-image: linear-gradient(transparent, #000 60%);
  animation: grid 6s linear infinite;
}

@keyframes grid {
  to {
    background-position: 0 44px;
  }
}

body.locked-in .b1 {
  background: var(--lime);
}

body.locked-in .b2 {
  background: var(--cyan);
  opacity: 0.35;
}

/* ---------- screens ---------- */

.screen {
  position: absolute;
  /* screens end where the ads begin, so nothing ever sits under an ad */
  inset: 0 var(--rail-right) var(--ad-bottom) var(--rail-left);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out), visibility 0.35s;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* icons (icons.js): currentColor strokes plus one accent fill */
.ico {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  vertical-align: -0.22em;
  overflow: visible;
}

[data-icon] {
  display: inline-flex;
}

.icon-btn {
  --ico-accent: var(--lime);
  width: 46px;
  height: 46px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(180deg, #2e1860, #1b0c38);
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.icon-btn .ico {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.chip {
  --ico-accent: var(--lime);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.chip-btn:active {
  transform: scale(0.95);
}

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

.btn {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 18px 12px;
  border-radius: 20px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.1s, box-shadow 0.1s;
  overflow: hidden;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.btn-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.5px;
  line-height: 1;
}

.btn-title .ico {
  width: 0.95em;
  height: 0.95em;
  vertical-align: 0;
}

.btn-primary,
.btn-blitz,
.btn-revive {
  --ico-accent: #0b0614;
}

.btn-daily {
  --ico-accent: var(--gold);
}

.btn-share {
  --ico-accent: var(--pink);
  --ico-muted: var(--cyan);
}

.btn-sub {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(180deg, #d8ff5c, #9fe51c);
  border-color: #eaff9e;
  color: #0b0614;
  box-shadow: 0 6px 0 #5c8a00, 0 0 40px rgba(198, 255, 61, 0.35);
}

.btn-primary:active {
  box-shadow: 0 2px 0 #5c8a00, 0 0 40px rgba(198, 255, 61, 0.35);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 3.2s ease-in-out infinite;
}

@keyframes shine {
  60%,
  100% {
    transform: translateX(100%);
  }
}

.btn-daily {
  background: linear-gradient(180deg, #ff6be0, #c42fb0);
  border-color: #ffa8ef;
  box-shadow: 0 6px 0 #6e1462;
}

.btn-blitz {
  background: linear-gradient(180deg, #4ff7ff, #13a8d6);
  border-color: #b3fbff;
  color: #04121a;
  box-shadow: 0 6px 0 #0a5a78;
}

.btn.is-done {
  filter: saturate(0.4);
}

.btn-revive {
  background: linear-gradient(180deg, #ffe066, #ffab1a);
  border-color: #fff0a8;
  color: #1a0b00;
  box-shadow: 0 6px 0 #8a5200;
}

.btn-share {
  padding: 12px 10px;
}

.btn-share .btn-title {
  font-size: 18px;
  white-space: nowrap;
}

.link-btn {
  margin-top: 6px;
  padding: 10px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: underline;
}

/* ---------- splash ---------- */

#splash {
  justify-content: flex-start;
  gap: 12px;
}

#splash > * {
  flex-shrink: 0;
}

#splash {
  /* vertical scroll only: overflow-y alone would make x scrollable too, and
     the full-bleed Doge strip and full-width ads would let it drift sideways */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.splash-top {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  position: relative;
  margin: 1vh 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: inherit;
  font-weight: inherit;
}

.logo-word {
  display: flex;
  font-family: var(--display);
  font-size: min(24vw, 118px);
  line-height: 0.9;
  color: var(--gold);
  -webkit-text-stroke: 3px #1a0b2e;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #1a0b2e, 0 0 40px rgba(255, 212, 71, 0.45);
}

.logo-word span {
  display: inline-block;
  animation: slam 0.5s var(--ease-pop) both, wobble 3s ease-in-out 1.4s infinite;
}

.logo-word span:nth-child(1) {
  animation-delay: 0.9s, 1.4s;
}
.logo-word span:nth-child(2) {
  animation-delay: 0.97s, 1.6s;
}
.logo-word span:nth-child(3) {
  animation-delay: 1.04s, 1.8s;
}
.logo-word span:nth-child(4) {
  animation-delay: 1.11s, 2s;
}

@keyframes slam {
  0% {
    transform: scale(3) rotate(-10deg);
    opacity: 0;
    filter: blur(6px);
  }
  60% {
    transform: scale(0.9);
    opacity: 1;
    filter: none;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wobble {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-4px) rotate(-2deg);
  }
}

.logo-tiles {
  display: flex;
  gap: min(2.4vw, 12px);
  margin-top: 10px;
}

.logo-tile {
  display: block;
  width: min(19vw, 92px);
  aspect-ratio: 1;
  perspective: 600px;
  animation: drop 0.6s var(--ease-pop) both;
}

.logo-tile-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: flip 0.6s var(--ease-pop) both;
}

/* after the intro, app.js flips the tiles between Shibas and 2048 */
.logo-tile-inner.is-cycling {
  animation: none;
  transform: rotateY(0deg);
  transition: transform 0.7s var(--ease-pop);
}

.logo-tile-inner.is-cycling.show-doge {
  transform: rotateY(180deg);
}

.logo-tile-face {
  position: absolute;
  inset: 0;
  background: var(--tile-bg);
  border-radius: 22%;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.4);
}

.logo-tile-face.front {
  font-family: var(--display);
  font-size: min(12vw, 58px);
  color: #fff;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.35);
}

.logo-tile-face.back {
  transform: rotateY(180deg);
}

.logo-tile-face.back img {
  width: 104%;
  height: 104%;
  margin-top: -8%;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes drop {
  0% {
    transform: translateY(-110vh) rotate(-25deg);
  }
  100% {
    transform: none;
  }
}

@keyframes flip {
  to {
    transform: rotateY(180deg);
  }
}

.logo-sticker {
  position: relative;
  margin-top: 12px;
  padding: 6px 16px 4px;
  border-radius: 12px;
  background: var(--lime);
  color: #0b0614;
  font-family: var(--display);
  font-size: min(6vw, 28px);
  transform: rotate(-4deg);
  box-shadow: 0 4px 0 #5c8a00, 0 0 30px rgba(198, 255, 61, 0.5);
  animation: slap 0.45s var(--ease-pop) 1.35s both;
}

@keyframes slap {
  0% {
    transform: scale(2.4) rotate(12deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(-4deg);
    opacity: 1;
  }
}

.tagline {
  margin: 4px 0 0;
  max-width: 340px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
  animation: rise 0.5s var(--ease-out) 1.55s both;
}

.challenge {
  width: 100%;
  max-width: 420px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 61, 110, 0.18);
  border: 2px solid rgba(255, 61, 110, 0.6);
  font-weight: 700;
  font-size: 14px;
  animation: rise 0.5s var(--ease-out) 1.6s both, pulse-border 1.6s ease-in-out 2s infinite;
}

.challenge-icon .ico {
  width: 30px;
  height: 30px;
}

@keyframes pulse-border {
  50% {
    border-color: rgba(255, 61, 110, 1);
  }
}

.menu {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.menu .btn {
  animation: rise 0.5s var(--ease-out) both;
}

.menu .btn:nth-child(1) {
  animation-delay: 1.65s;
}
.menu .btn:nth-child(2) {
  animation-delay: 1.72s;
}
.menu .btn:nth-child(3) {
  animation-delay: 1.79s;
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  animation: rise 0.5s var(--ease-out) 1.85s both;
}

.rank-chip {
  color: var(--lime);
}

.parade {
  /* full bleed: stretch over the splash's 16px side padding, not 100vw,
     which is wider than the splash when a side rail is showing */
  align-self: stretch;
  overflow: hidden;
  margin: 4px -16px 0;
  padding: 6px 0;
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  animation: rise 0.5s var(--ease-out) 1.9s both;
}

.parade.is-dragging {
  cursor: grabbing;
}

.parade-track {
  display: flex;
  gap: 8px;
  width: max-content;
  will-change: transform;
}

.parade-track img {
  width: 64px;
  height: 64px;
  flex: none;
  pointer-events: none;
  animation: bob 2.4s ease-in-out infinite;
}

.parade-track img:nth-child(odd) {
  animation-delay: -1.2s;
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}

.scroll-hint .ico {
  transform: rotate(90deg);
}

.noscript {
  position: relative;
  z-index: 90;
  margin: 0;
  padding: 12px 16px;
  background: var(--lime);
  color: #0b0614;
  font-weight: 700;
  text-align: center;
}

/* ---------- page content below the title screen ---------- */

.about {
  width: 100%;
  max-width: 640px;
  margin-top: 28px;
  padding: 22px 20px 8px;
  border-radius: 24px;
  background: rgba(14, 6, 30, 0.72);
  border: 1px solid var(--panel-line);
  line-height: 1.55;
  font-size: 15px;
  color: #e9e2fb;
}

.about h2 {
  margin: 22px 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
  color: #fff;
}

.about h2:first-child {
  margin-top: 0;
}

.about a {
  color: var(--cyan);
}

.about strong {
  color: #fff;
}

.about ol,
.about ul {
  padding-left: 20px;
}

.about li {
  margin: 4px 0;
}

.about-roster {
  list-style: none;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 12px;
}

.about-roster b {
  display: inline-block;
  min-width: 44px;
  font-family: var(--display);
  font-weight: 400;
  color: var(--lime);
}

.about-roster em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.about-faq details {
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--panel);
}

.about-faq summary {
  cursor: pointer;
  font-weight: 700;
  color: #fff;
}

.about-faq p {
  margin: 8px 0 2px;
}

.site-foot {
  width: 100%;
  max-width: 640px;
  margin: 18px 0 8px;
  padding: 18px 20px 8px;
  border-top: 1px solid var(--panel-line);
  font-size: 14px;
}

.site-foot-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 20px;
}

.site-foot h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 18px;
  color: var(--lime);
}

.site-foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-foot li {
  margin: 5px 0;
}

.site-foot a {
  color: #e9e2fb;
  text-decoration: none;
}

.site-foot a:hover {
  color: #fff;
  text-decoration: underline;
}

.site-foot-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- ads: always outside the play area ---------- */

/* AdSense marks units it could not fill; collapse them */
ins.adsbygoogle[data-ad-status='unfilled'] {
  display: none !important;
}

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ad-slot.is-empty,
.ad-rail.is-empty {
  display: none;
}

/* small label so an ad never reads as part of the game */
.ad-card:not(:empty)::before,
.ad-incontent:not(:empty)::before {
  content: 'Advertisement';
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

.ad-card {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-line);
}

.ad-card:empty {
  display: none;
}

.ad-incontent {
  margin: 18px 0;
  min-height: 1px;
}

.ad-video {
  display: block;
  margin: 16px 0;
  min-height: 1px;
}

.ad-rail {
  position: fixed;
  top: calc(50% - var(--ad-bottom) / 2);
  z-index: 5;
  transform: translateY(-50%);
  line-height: 0;
}

@media (max-width: 1023px) {
  .ad-rail {
    display: none;
  }
}

@media (max-width: 1639px) {
  .ad-rail-right {
    display: none;
  }
}

.ad-rail-left {
  left: 12px;
}

.ad-rail-right {
  right: 12px;
}

.ad-rail:empty {
  display: none;
}

.ad-anchor {
  position: fixed;
  left: 50%;
  bottom: env(safe-area-inset-bottom);
  z-index: 40;
  transform: translateX(-50%);
  line-height: 0;
}

body.has-anchor .screen {
  bottom: calc(var(--ad-bottom) + env(safe-area-inset-bottom));
  padding-bottom: 12px;
}

/* the close button only appears once there is an ad to close */
body:not(.has-anchor) .ad-close {
  display: none;
}

.ad-close {
  position: absolute;
  right: -10px;
  top: -14px;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #1b0c38;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.ad-close .ico {
  width: 14px;
  height: 14px;
}

/* returning in the same session: skip the long intro */
body.fast-intro .logo-word span,
body.fast-intro .logo-tile,
body.fast-intro .logo-tile-inner,
body.fast-intro .logo-sticker,
body.fast-intro .tagline,
body.fast-intro .challenge,
body.fast-intro .menu .btn,
body.fast-intro .meta-row,
body.fast-intro .parade {
  animation-delay: 0s !important;
  animation-duration: 0.01s !important;
}

body.fast-intro .logo-word span {
  animation: wobble 3s ease-in-out infinite !important;
}

/* ---------- HUD ---------- */

.hud {
  width: 100%;
  max-width: calc(var(--board) + 8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-right {
  display: flex;
  gap: 8px;
}

.mode-chip {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
}

.scores {
  width: 100%;
  max-width: calc(var(--board) + 8px);
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.score-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px 8px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  min-width: 0;
}

.score-main {
  flex: 1.6;
  background: linear-gradient(180deg, rgba(198, 255, 61, 0.18), rgba(198, 255, 61, 0.05));
  border-color: rgba(198, 255, 61, 0.4);
}

.score-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.score-box output {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.score-main output {
  color: var(--lime);
  font-size: 32px;
}

.score-box output.bump {
  animation: bump 0.25s var(--ease-pop);
}

@keyframes bump {
  40% {
    transform: scale(1.25);
  }
}

.timer-box output {
  color: var(--cyan);
}

.timer-box.hurry output {
  color: var(--red);
  animation: bump 0.5s var(--ease-pop) infinite;
}

.heat {
  position: relative;
  width: 100%;
  max-width: calc(var(--board) + 8px);
  height: 18px;
  margin: 10px 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-line);
  overflow: hidden;
}

.heat-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8a00, #ff3d6e, #ff4fd8);
  transition: width 0.3s var(--ease-out);
}

.heat-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

body.locked-in .heat-fill {
  width: 100% !important;
  background: linear-gradient(90deg, var(--lime), var(--cyan), var(--pink), var(--lime));
  background-size: 300% 100%;
  animation: slide-bg 1s linear infinite;
}

@keyframes slide-bg {
  to {
    background-position: 150% 0;
  }
}

/* ---------- board ---------- */

#game {
  touch-action: none;
  justify-content: center;
}

.board-wrap {
  position: relative;
  padding: 4px;
  border-radius: 28px;
  overflow: hidden;
}

.board-wrap::before {
  content: '';
  position: absolute;
  inset: -60%;
  background: conic-gradient(var(--lime), var(--cyan), var(--pink), var(--gold), var(--lime));
  opacity: 0;
  transition: opacity 0.3s;
  animation: spin 2.2s linear infinite;
}

body.locked-in .board-wrap::before {
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.board {
  position: relative;
  width: var(--board);
  height: var(--board);
  border-radius: 24px;
  background: rgba(20, 10, 40, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cells {
  position: absolute;
  inset: var(--gap);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--gap);
}

.cell {
  border-radius: 18%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.25);
}

.tiles,
.floats {
  position: absolute;
  inset: var(--gap);
}

.floats {
  pointer-events: none;
  z-index: 20;
}

.tile {
  --x: 0;
  --y: 0;
  position: absolute;
  left: 0;
  top: 0;
  width: calc((100% - 3 * var(--gap)) / 4);
  height: calc((100% - 3 * var(--gap)) / 4);
  transform: translate(calc(var(--x) * (100% + var(--gap))), calc(var(--y) * (100% + var(--gap))));
  transition: transform 0.11s var(--ease-out);
  z-index: 2;
}

.tile.is-gone {
  z-index: 1;
}

.tile-body {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20%;
  background: var(--tile-bg, #444);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 6px 14px rgba(0, 0, 0, 0.4);
}

.tile-body img {
  position: absolute;
  left: -4%;
  top: -10%;
  width: 108%;
  height: 108%;
  pointer-events: none;
  animation: bob 2.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-3%) rotate(-2deg);
  }
}

.tile-val {
  position: absolute;
  left: 5%;
  bottom: 5%;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-family: var(--display);
  font-size: calc(var(--board) * 0.03);
  line-height: 1.3;
  letter-spacing: 0.3px;
  z-index: 2;
}

.tile.is-new .tile-body {
  animation: spawn 0.28s var(--ease-pop) both;
}

.tile.is-merged .tile-body {
  animation: pop 0.32s var(--ease-pop) both;
}

.tile.is-merged .tile-body::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  animation: blink 0.3s ease-out both;
}

@keyframes spawn {
  0% {
    transform: scale(0) rotate(-14deg);
  }
  100% {
    transform: none;
  }
}

@keyframes pop {
  0% {
    transform: scale(0.55);
  }
  45% {
    transform: scale(1.24) rotate(3deg);
  }
  70% {
    transform: scale(0.94) rotate(-1deg);
  }
  100% {
    transform: none;
  }
}

@keyframes blink {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 0;
  }
}

/* rarity foils */
.r-common {
  --tile-bg: linear-gradient(160deg, #6b7489, #3f4557);
}
.t-2.r-common {
  --tile-bg: linear-gradient(160deg, #5f8a93, #37525c);
}
.r-rare {
  --tile-bg: linear-gradient(160deg, #3d9bff, #1b45b0);
}
.t-4.r-rare {
  --tile-bg: linear-gradient(160deg, #36c3ff, #1668a8);
}
.r-epic {
  --tile-bg: linear-gradient(160deg, #a660ff, #5a1fb5);
}
.t-6.r-epic {
  --tile-bg: linear-gradient(160deg, #7a6bff, #3a2aa8);
}
.r-legendary {
  --tile-bg: linear-gradient(160deg, #ffc93d, #e0730f);
}
.t-8.r-legendary {
  --tile-bg: linear-gradient(160deg, #ff9f43, #c2410c);
}
.r-mythic {
  --tile-bg: linear-gradient(160deg, #ff5c8a, #b3125a);
}
.r-god {
  --tile-bg: linear-gradient(120deg, #3bff8f, #3df5ff, #b65cff, #ff4fd8, #ffd447, #3bff8f);
}
.r-og {
  --tile-bg: radial-gradient(circle at 50% 28%, #8a55e6, #3a1478 58%, #1c0840);
}
.r-secret {
  --tile-bg: linear-gradient(160deg, #1f1f2e, #050508);
}

.r-god .tile-body {
  background-size: 300% 300%;
  animation: slide-bg 2.5s linear infinite;
}

.r-og .tile-body,
.r-og .logo-tile-face {
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 -6px 0 rgba(0, 0, 0, 0.3), 0 0 22px rgba(255, 212, 71, 0.6),
    0 8px 20px rgba(0, 0, 0, 0.4);
}

.r-secret .tile-body {
  box-shadow: inset 0 0 0 2px #e8e8ff, 0 0 22px rgba(160, 160, 255, 0.6);
}

.r-legendary .tile-body::before,
.r-mythic .tile-body::before,
.r-god .tile-body::before,
.r-og .tile-body::before,
.m-1 .tile-body::before,
.m-2 .tile-body::before,
.m-3 .tile-body::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
  background-size: 250% 100%;
  animation: foil 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes foil {
  0% {
    background-position: 130% 0;
  }
  60%,
  100% {
    background-position: -30% 0;
  }
}

/* mutations */
.m-1 .tile-body {
  box-shadow: inset 0 0 0 3px #ffd447, 0 0 18px rgba(255, 212, 71, 0.8), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.m-2 .tile-body {
  box-shadow: inset 0 0 0 3px #aefaff, 0 0 20px rgba(120, 240, 255, 0.9), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.m-3 .tile-body {
  box-shadow: inset 0 0 0 3px #fff, 0 0 24px rgba(255, 120, 230, 0.9), 0 6px 14px rgba(0, 0, 0, 0.4);
  animation: hue 2s linear infinite;
}

@keyframes hue {
  to {
    filter: hue-rotate(1turn);
  }
}

.mut-tag {
  position: absolute;
  right: 3%;
  top: 3%;
  display: flex;
  font-size: calc(var(--board) * 0.036);
  z-index: 2;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

/* bonk targeting */
body.bonking .tile {
  cursor: crosshair;
}

body.bonking .tile-body {
  animation: jiggle 0.3s ease-in-out infinite alternate;
}

@keyframes jiggle {
  from {
    transform: rotate(-4deg);
  }
  to {
    transform: rotate(4deg);
  }
}

body.bonking .board {
  box-shadow: inset 0 0 0 3px var(--red), 0 0 40px rgba(255, 61, 110, 0.5);
}

/* crash out: tiles tumble off the board */
.board.crashed .tile {
  transition: none;
}

.board.crashed .tile-body {
  animation: tumble 1s cubic-bezier(0.5, 0, 0.9, 0.5) both;
  animation-delay: var(--fall, 0s);
}

@keyframes tumble {
  0% {
    transform: none;
  }
  20% {
    transform: translateY(-12%) rotate(calc(var(--spin, 20deg) * -0.2));
  }
  100% {
    transform: translateY(160vh) rotate(var(--spin, 200deg));
    opacity: 0.9;
  }
}

.board.crashed {
  animation: table-flip 0.6s var(--ease-out);
}

@keyframes table-flip {
  30% {
    transform: rotate(-6deg) translateY(-10px);
  }
  100% {
    transform: none;
  }
}

/* floating text */
.float {
  position: absolute;
  font-family: var(--display);
  font-size: calc(var(--board) * 0.075);
  white-space: nowrap;
  color: #fff;
  -webkit-text-stroke: 2px #1a0b2e;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #1a0b2e;
  pointer-events: none;
}

.float.gain {
  font-size: calc(var(--board) * 0.06);
  color: var(--lime);
}

.float.speak {
  font-family: 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', var(--ui);
  font-weight: 700;
  font-size: calc(var(--board) * 0.058);
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.float.combo {
  font-size: calc(var(--board) * 0.12);
  color: var(--gold);
}

.float.big {
  font-size: calc(var(--board) * 0.14);
  color: var(--lime);
}

/* below the board */
.below-board {
  width: 100%;
  max-width: calc(var(--board) + 8px);
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.next-up {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
}

.next-up img {
  width: 48px;
  height: 48px;
  flex: none;
}

.next-up.is-locked img {
  animation: tease 1.8s ease-in-out infinite;
}

@keyframes tease {
  50% {
    transform: scale(1.08) rotate(4deg);
  }
}

.next-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.next-kicker {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.next-text b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.powerups {
  display: flex;
  gap: 8px;
}

.pu {
  position: relative;
  width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.1s;
}

.pu:active {
  transform: translateY(3px);
}

.pu:disabled {
  opacity: 0.4;
}

.pu.is-active {
  background: rgba(255, 61, 110, 0.35);
  border-color: var(--red);
}

.pu-icon {
  --ico-accent: var(--gold);
  font-size: 22px;
}

.pu-name {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.pu-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pink);
  font-size: 12px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.controls-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0 var(--rail-right) var(--ad-bottom) var(--rail-left);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(7, 3, 15, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.25s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* reveal: the "aura edit" moment */
.reveal {
  --c: var(--gold);
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 35%, transparent), rgba(7, 3, 15, 0.94) 60%);
  cursor: pointer;
}

.reveal-rays {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 220vmax;
  height: 220vmax;
  margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 30%, transparent) 0 6deg, transparent 6deg 18deg);
  animation: spin 14s linear infinite;
  opacity: 0.8;
}

.reveal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
}

.reveal-kicker {
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 13px;
  animation: rise 0.4s var(--ease-out) 0.1s both;
}

.reveal-rarity {
  margin-top: 8px;
  padding: 6px 18px 4px;
  border-radius: 999px;
  background: var(--c);
  color: #0b0614;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 1px;
  animation: slap 0.4s var(--ease-pop) 0.2s both;
}

.reveal-img {
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  margin: 4px 0 -6px;
  filter: drop-shadow(0 0 30px var(--c));
  animation: summon 0.7s var(--ease-pop) 0.15s both, bob 2.4s ease-in-out 1s infinite;
}

@keyframes summon {
  0% {
    transform: scale(0.2) rotate(-30deg);
    filter: brightness(0) drop-shadow(0 0 30px var(--c));
  }
  50% {
    filter: brightness(0) drop-shadow(0 0 30px var(--c));
  }
  75% {
    transform: scale(1.12) rotate(4deg);
    filter: brightness(2.2) drop-shadow(0 0 40px var(--c));
  }
  100% {
    transform: none;
    filter: drop-shadow(0 0 30px var(--c));
  }
}

.reveal-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: min(10vw, 44px);
  line-height: 1;
  background: linear-gradient(180deg, #fff 30%, #c9c9d6 55%, #fff 70%, #9a9ab0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #1a0b2e);
  animation: rise 0.45s var(--ease-out) 0.55s both;
}

.reveal-line {
  margin: 8px 0 0;
  font-family: 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', var(--ui);
  font-weight: 700;
  font-size: 17px;
  color: var(--c);
  animation: rise 0.45s var(--ease-out) 0.65s both;
}

.reveal-meta {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  animation: rise 0.45s var(--ease-out) 0.75s both;
}

.reveal-tap {
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.7;
  animation: fade-in 0.4s 1s both, blinky 1.2s ease-in-out 1.4s infinite;
}

@keyframes blinky {
  50% {
    opacity: 0.3;
  }
}

/* run over */
.over-card,
.dex-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 16px 12px;
  border-radius: 28px;
  background: linear-gradient(180deg, #24104a, #140828);
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: card-in 0.45s var(--ease-pop) both;
  scrollbar-width: none;
}

@keyframes card-in {
  from {
    transform: translateY(40px) scale(0.92);
    opacity: 0;
  }
}

.over-title {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 2px #1a0b2e;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #1a0b2e;
}

.over-sub {
  margin: 6px 0 0;
  text-align: center;
  font-family: 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', var(--ui);
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
}

.over-break {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(59, 255, 143, 0.12);
  border: 1px solid rgba(59, 255, 143, 0.4);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.over-title.is-win {
  color: var(--gold);
}

.over-pull {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 6px;
  padding: 8px 12px 8px 8px;
  border-radius: 20px;
  background: var(--panel);
}

.over-pull img {
  width: 84px;
  height: 84px;
  flex: none;
  animation: bob 2.4s ease-in-out infinite;
}

.over-pull > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.over-kicker {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--muted);
}

.over-pull b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.05;
}

.over-rarity {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: #0b0614;
}

.over-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.over-score output {
  font-family: var(--display);
  font-size: 54px;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

.over-score span {
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--muted);
}

.over-badge {
  width: max-content;
  margin: -4px auto 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a0b00;
  font-weight: 900;
  font-size: 13px;
  animation: slap 0.4s var(--ease-pop) 0.5s both;
}

.over-squares {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 8px;
}

.over-squares i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  animation: spawn 0.3s var(--ease-pop) both;
}

.over-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 10px;
  text-align: center;
}

.over-stats div {
  padding: 6px 2px;
  border-radius: 12px;
  background: var(--panel);
}

.over-stats dt {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--muted);
}

.over-stats dd {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
}

.rank-progress {
  margin-bottom: 12px;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.rank-row span:first-child {
  color: var(--lime);
}

.rank-row span:last-child {
  color: var(--muted);
}

.rank-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rank-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  transition: width 1.2s var(--ease-out) 0.3s;
}

.over-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.over-row {
  display: flex;
  gap: 10px;
}

/* dex */
.dex-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dex-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
}

.dex-sub {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dex-item {
  --c: #888;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, transparent), rgba(255, 255, 255, 0.03));
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  text-align: center;
}

.dex-item img {
  width: 80%;
  aspect-ratio: 1;
}

.dex-item b {
  font-size: 11px;
  line-height: 1.15;
  min-height: 2.3em;
}

.dex-item small {
  font-size: 10px;
  font-weight: 900;
  color: var(--c);
  letter-spacing: 0.5px;
}

.dex-item .dex-muts {
  position: absolute;
  top: 5px;
  right: 6px;
  display: flex;
  font-size: 14px;
}

.dex-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.dex-legend .ico {
  margin-left: 4px;
}

.dex-item.is-locked {
  --c: #4a4060;
}

/* toast */
.toast {
  --ico-accent: var(--lime);
  display: flex;
  align-items: center;
  gap: 8px;
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(20, 10, 40, 0.95);
  border: 1px solid var(--panel-line);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  transform: translate(-50%, -150%);
  transition: transform 0.35s var(--ease-pop);
  pointer-events: none;
}

.toast.is-shown {
  transform: translate(-50%, 0);
}

/* ---------- small / short screens ---------- */

@media (max-height: 700px) {
  :root {
    --board: min(calc(var(--play-w) * 0.92), calc(100dvh - 290px - var(--ad-bottom)), 470px);
  }
  .logo-tile {
    width: min(15vw, 72px);
  }
  .logo-word {
    font-size: min(18vw, 84px);
  }
  .controls-hint {
    display: none;
  }
}

@media (min-width: 900px) and (min-height: 760px) {
  :root {
    --board: min(calc(100dvh - 340px - var(--ad-bottom)), 500px);
  }
}

/* Wide screens (landscape phones, tablets, laptops, desktops): HUD on the
   left, board on the right, so the board uses the full height */
@media (min-aspect-ratio: 5/4) {
  :root {
    --side: min(340px, calc(var(--play-w) * 0.42));
    --board: min(calc(100dvh - var(--ad-bottom) - 40px), calc(var(--play-w) - var(--side) - 64px), 640px);
  }

  #game {
    display: grid;
    grid-template-columns: var(--side) auto;
    /* spare height goes to the first and last rows, centring the HUD */
    grid-template-rows: 1fr auto auto auto auto 1fr;
    column-gap: 24px;
    align-content: center;
    justify-content: center;
  }

  #game .hud,
  #game .scores,
  #game .heat,
  #game .below-board,
  #game .controls-hint {
    grid-column: 1;
    width: var(--side);
    max-width: none;
  }

  #game .hud {
    grid-row: 2;
  }

  #game .scores {
    grid-row: 3;
  }

  #game .heat {
    grid-row: 4;
  }

  #game .below-board {
    grid-row: 5;
    flex-wrap: wrap;
  }

  #game .controls-hint {
    grid-row: 6;
    align-self: start;
    text-align: center;
  }

  #game .board-wrap {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
  }
}

@media (min-aspect-ratio: 5/4) and (max-width: 520px) {
  :root {
    --side: 0px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05s !important;
  }
}
