/* © 2026 The Weeby Challenge. All rights reserved. Proprietary: see LICENSE. */
@font-face {
  font-family: 'Luckiest Guy';
  src: url('../assets/luckiest-guy.woff2') format('woff2');
  font-display: swap;
}

:root {
  --sky: #19c3e6;
  --wave1: #36d0ee;
  --wave2: #5cdcf3;
  --wave3: #8de8f8;
  --ink: #1d1340;
  --yellow: #ffd21f;
  --white: #ffffff;
  --panel: #ffffff;
  --orange: #ff9a1a;
  --orange-dark: #ff6f00;
  --green: #21c55d;
  --red: #ef3b3b;
  --text: #0e2a3a;
  --muted: #0e3b50;
  --glass: rgba(255, 255, 255, .28);
  --dlg: #ffffff;
  --dlg-text: #1d1340;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky: #07384d;
    --wave1: #0a465f;
    --wave2: #0d5573;
    --wave3: #106688;
    --text: #e8f8ff;
    --muted: #bfe8f6;
    --glass: rgba(255, 255, 255, .12);
    --dlg: #10243a;
    --dlg-text: #e8f8ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--sky);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.btn, .past-link, .club-head, .chip, .pill, .hud-level, .hud-score, .flash, .score-big, .rank, .next, .kicker, .dlg-title, .combo, .floater {
  font-family: 'Luckiest Guy', 'Arial Black', Impact, sans-serif; font-weight: 400;
}

/* ---------- moving wavy background ---------- */
.waves { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.wave {
  position: absolute; left: 0; width: 200%; bottom: -10px;
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 100' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C100 10 200 10 300 50 S500 90 600 50 S700 10 800 50 V100 H0Z'/%3E%3C/svg%3E") repeat-x 0 0 / 50% 90px, linear-gradient(#000, #000) no-repeat 0 89px / 100% 100%;
  -webkit-mask: var(--m);
  mask: var(--m);
  animation: drift linear infinite;
  will-change: transform;
}
.w1 { top: 22%; background: var(--wave1); animation-duration: 22s; }
.w2 { top: 50%; background: var(--wave2); animation-duration: 30s; animation-direction: reverse; }
.w3 { top: 76%; background: var(--wave3); animation-duration: 38s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- screens ---------- */
#app {
  position: relative; z-index: 1;
  height: 100%; max-width: 760px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.screen { height: 100%; display: flex; flex-direction: column; align-items: center; }
.screen.scroll { overflow-y: auto; justify-content: safe center; gap: 10px; padding: 4px 0 16px; text-align: center; animation: screenIn .28s ease-out; }
@keyframes screenIn { from { transform: translateY(12px); } }

.title {
  font-family: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  font-weight: 400; letter-spacing: .02em; line-height: .95; margin: 0;
  text-transform: uppercase; text-align: center;
  font-size: clamp(38px, 12vw, 64px);
}
.title span {
  display: block;
  -webkit-text-stroke: .16em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--ink);
}
.white { color: var(--white); }
.yellow { color: var(--yellow); }
.title-game { font-size: clamp(20px, 5.6vw, 32px); margin: 0 0 4px; }
.title-game span { display: inline; }

.topbar { display: flex; justify-content: space-between; width: 100%; }
.topbar-right { display: flex; gap: 8px; }
.logo-big { width: min(40vw, 190px); height: auto; filter: drop-shadow(0 5px 0 var(--ink)); animation: bob 3.2s ease-in-out infinite; }
/* Comic-book rays turning slowly behind the starburst: the brand's energy without extra clutter. */
.logo-wrap { position: relative; display: grid; place-items: center; }
.logo-wrap::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: min(175%, 96vw); aspect-ratio: 1; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, .2) 0 7.5deg, transparent 7.5deg 15deg);
  -webkit-mask: radial-gradient(closest-side, #000 30%, transparent 100%); mask: radial-gradient(closest-side, #000 30%, transparent 100%);
  transform: translate(-50%, -50%); animation: rays 48s linear infinite; pointer-events: none;
}
.logo-wrap img { position: relative; }
@keyframes rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }

.chip {
  margin: 4px 0 0; padding: 6px 14px 3px; border-radius: 999px;
  background: var(--ink); color: var(--white);
  letter-spacing: .04em; font-size: 17px; text-transform: uppercase;
}
.small { margin: 0; font-weight: 700; color: var(--muted); min-height: 1.4em; }
.kicker { margin: 0; font-size: 26px; color: var(--yellow); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-transform: uppercase; }

.buttons { display: flex; flex-direction: column; gap: 12px; width: min(100%, 380px); margin-top: 6px; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.btn {
  position: relative; display: block; width: 100%; min-height: 54px; padding: 12px 16px 9px;
  border: 3px solid var(--ink); border-radius: 18px;
  background: var(--white); color: var(--ink);
  font-size: 20px; letter-spacing: .03em; text-transform: uppercase; line-height: 1.1;
  text-decoration: none; cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(29, 19, 64, .12), 0 5px 0 var(--ink);
  transition: transform .08s ease-out, box-shadow .08s ease-out;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: inset 0 -3px 0 rgba(29, 19, 64, .12), 0 1px 0 var(--ink); }
.btn:disabled { opacity: .6; cursor: default; }
.btn small { display: block; font-size: 13px; opacity: .9; margin-top: 2px; }
.btn small:empty { display: none; }
.btn-main { background: var(--yellow); font-size: 24px; }
.btn-play { min-height: 66px; font-size: 27px; animation: nudge 2.6s ease-in-out infinite; }
.btn-play.btn-done { min-height: 46px; padding: 9px 14px 6px; background: var(--white); font-size: 16px; animation: none;
  box-shadow: inset 0 -4px 0 rgba(29, 19, 64, .1), 0 4px 0 var(--ink); }
.btn-rush.btn-main { min-height: 66px; font-size: 27px; }
/* The other modes: a row of small tiles under the one big button. */
.modes { display: flex; gap: 10px; }
.btn.mode { flex: 1 1 0; min-width: 0; min-height: 74px; padding: 10px 6px 7px; font-size: 15px; line-height: 1.05;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; overflow-wrap: anywhere;
  box-shadow: inset 0 -4px 0 rgba(29, 19, 64, .12), 0 4px 0 var(--ink); }
.btn.mode small { font-size: 11px; margin: 0; }
.btn.mode span { display: block; }
.btn .ico { font-style: normal; }
.btn.mode .ico { display: block; font-size: 24px; line-height: 1; margin-bottom: 2px; }
body:not(.first-visit) .logo-big { width: min(36vw, 160px); }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 86% { transform: scale(1.04) rotate(-1deg); } 93% { transform: scale(1.04) rotate(1deg); } }
.btn-rush { background: linear-gradient(180deg, #ffad3a, var(--orange-dark)); color: var(--white); text-shadow: 0 2px 0 var(--ink); }
.btn-rush.btn-main { font-size: 24px; }
.btn-yt { background: #ff3d3d; color: var(--white); font-size: 17px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.streak-badge {
  position: absolute; top: -14px; right: -8px; padding: 4px 9px 1px; border-radius: 999px;
  background: var(--orange-dark); color: var(--white); border: 3px solid var(--ink); font-size: 18px;
  transform: rotate(6deg);
}
.btn:focus-visible, .cell:focus-visible, .icon-btn:focus-visible, .link:focus-visible, .kofi:focus-visible, .sub-link:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

.challenge {
  width: min(100%, 380px); padding: 12px; border-radius: 18px; border: 3px dashed var(--ink);
  background: var(--glass); font-weight: 800;
}
.challenge p { margin: 0 0 10px; }

.sub-link, .kofi {
  padding: 10px 16px; border-radius: 14px; color: var(--text); font-weight: 800; text-decoration: none; background: var(--glass);
}
.sub-link:hover, .kofi:hover { background: rgba(255, 255, 255, .4); }
.row-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.link {
  border: 0; background: var(--glass); color: var(--text); font-weight: 800; padding: 10px 14px; border-radius: 12px; cursor: pointer; min-height: 44px;
}
.install { background: var(--white); color: var(--ink); border: 2px solid var(--ink); }
body.portal .kofi, body.portal .sub-link, body.portal .btn-yt { display: none; }

.icon-btn {
  min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px; border: 3px solid var(--ink);
  background: var(--white); color: var(--ink); font-size: 20px; font-weight: 900; cursor: pointer; touch-action: manipulation;
  box-shadow: 0 3px 0 var(--ink);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
#btn-quit { justify-self: start; }
#btn-quit.armed { background: var(--red); color: var(--white); font-size: 14px; font-family: 'Luckiest Guy', sans-serif; padding-top: 3px; }

/* ---------- game ---------- */
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; margin-bottom: 4px; }
.hud-mid { text-align: center; }
.hud-level { white-space: nowrap; font-size: 20px; color: var(--white); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-transform: uppercase; }
.hud-sub { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 2px; }
.pill {
  display: inline-block; padding: 3px 10px 0; border-radius: 999px;
  font-size: 14px; letter-spacing: .05em; text-transform: uppercase;
  background: var(--green); color: var(--white); border: 2px solid var(--ink);
}
.pill[data-tier='medium'] { background: #2f8cff; }
.pill[data-tier='hard'] { background: var(--orange-dark); }
.pill[data-tier='impossible'] { background: #b02cff; }
.hearts { font-size: 15px; letter-spacing: 1px; }
.hud-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.hud-score {
  font-size: 20px; white-space: nowrap;
  background: var(--white); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 9px 1px; box-shadow: 0 3px 0 var(--ink);
}
.hud-score small { font-size: 14px; opacity: .6; }

.dots { display: flex; gap: 5px; justify-content: center; margin: 0 0 8px; }
.dots i { width: 22px; height: 8px; border-radius: 4px; background: rgba(29, 19, 64, .25); transition: background .2s, transform .2s; }
.dots i.now { background: var(--white); box-shadow: 0 0 0 2px var(--ink); transform: scaleY(1.3); }
.dots i.g { background: var(--green); }
.dots i.y { background: var(--yellow); }
.dots i.r { background: var(--red); }

.timer {
  position: relative; width: 100%; height: 26px; flex: none;
  border: 3px solid var(--ink); border-radius: 999px; background: var(--white); overflow: visible;
}
.timer-fill {
  position: absolute; inset: 0; border-radius: 999px; transform-origin: left center;
  background: repeating-linear-gradient(-45deg, var(--orange) 0 12px, var(--orange-dark) 12px 24px);
  background-size: 34px 34px;
  animation: stripes .6s linear infinite;
}
.timer-fill.low { background-image: repeating-linear-gradient(-45deg, #ff5a3a 0 12px, #e02424 12px 24px); }
@keyframes stripes { to { background-position: 34px 0; } }
.timer-num {
  position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
  min-width: 40px; height: 40px; padding-top: 5px; border-radius: 50%; text-align: center;
  background: var(--yellow); border: 3px solid var(--ink);
  font-family: 'Luckiest Guy', sans-serif; font-size: 22px; color: var(--ink);
}
.timer-num.low { background: var(--red); color: var(--white); animation: throb .5s ease-in-out infinite; }
@keyframes throb { 50% { transform: translateY(-50%) scale(1.15); } }

.board-wrap { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 10px; }
.board {
  display: grid; gap: 0; padding: 8px;
  background: var(--panel); border: 4px solid var(--ink); border-radius: 22px;
  box-shadow: 0 7px 0 var(--ink);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.board.hidden { visibility: hidden; }
.board.enter { animation: boardIn .22s cubic-bezier(.2, 1.3, .4, 1); }
.board.jolt { animation: jolt .25s ease-out; }
@keyframes boardIn { from { transform: scale(.92); } }
@keyframes jolt { 30% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
.cell {
  width: var(--cell); height: var(--cell); padding: calc(var(--cell) * .07);
  border: 0; border-radius: 12px; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.cell img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
@media (hover: hover) { .cell:hover { background: rgba(25, 195, 230, .12); } }
.cell.miss { animation: shake .3s ease-out; background: rgba(239, 59, 59, .2); }
.cell.found { animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); box-shadow: inset 0 0 0 4px var(--green); background: rgba(33, 197, 93, .2); position: relative; z-index: 1; }
.cell.reveal { animation: pulse .7s ease-in-out infinite; box-shadow: inset 0 0 0 4px var(--red); position: relative; z-index: 1; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes pop { 50% { transform: scale(1.35); } }
@keyframes pulse { 50% { transform: scale(1.18); } }

.combo {
  margin-top: 16px;
  padding: 7px 14px 3px; border-radius: 999px; background: var(--orange-dark); color: var(--white);
  border: 3px solid var(--ink); font-size: 20px; white-space: nowrap; pointer-events: none; text-transform: uppercase;
}
.combo.pop { animation: comboPop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes comboPop { from { transform: scale(.5); } }

.flash { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.flash.in { animation: flashIn .3s cubic-bezier(.2, 1.4, .4, 1); }
.flash-big, .flash-small {
  text-transform: uppercase; paint-order: stroke fill;
  -webkit-text-stroke: .16em var(--ink); text-shadow: 0 .08em 0 var(--ink);
}
.flash-big { font-size: clamp(44px, 14vw, 80px); color: var(--white); }
.flash-small { font-size: clamp(26px, 8vw, 44px); color: var(--yellow); }
.flash.tier-medium .flash-small { color: #7cc0ff; }
.flash.tier-hard .flash-small { color: #ffad3a; }
.flash.tier-impossible .flash-small { color: #e3a2ff; }
.flash.tier-medium.in, .flash.tier-hard.in, .flash.tier-impossible.in { animation: flashBig .45s cubic-bezier(.2, 1.4, .4, 1); }
.flash-low { place-content: end center; padding-bottom: 8%; }
.flash-low .flash-big { font-size: clamp(30px, 9vw, 52px); }
.flash-low .flash-small { font-size: clamp(20px, 6vw, 30px); }
@keyframes flashIn { from { transform: scale(.6); } }
@keyframes flashBig { from { transform: scale(1.8) rotate(-6deg); } }

/* effects layer */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.bit { position: absolute; width: 9px; height: 9px; border-radius: 2px; }
.bit.big { width: 11px; height: 15px; }
.floater {
  position: absolute; font-size: 30px; color: var(--white); white-space: nowrap;
  -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-transform: uppercase;
}
.floater.fast { color: var(--yellow); font-size: 32px; }
.floater.bad { color: var(--red); -webkit-text-stroke: 6px var(--white); }

/* ---------- result ---------- */
.score-big { font-size: clamp(72px, 22vw, 110px); line-height: 1; color: var(--yellow); -webkit-text-stroke: 14px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); animation: stamp .5s cubic-bezier(.2, 1.5, .4, 1); }
.score-big .of { font-size: .5em; color: var(--white); }
@keyframes stamp { from { transform: scale(2.2) rotate(-8deg); } }
.rank { margin: 0; font-size: 30px; text-transform: uppercase; color: var(--white); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; }
.squares { display: flex; gap: 6px; margin: 2px 0; justify-content: center; }
.squares i { width: min(26px, 7vw); height: min(26px, 7vw); border-radius: 6px; border: 3px solid var(--ink); animation: sqIn .3s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.squares i.g { background: var(--green); }
.squares i.y { background: var(--yellow); }
.squares i.r { background: var(--red); }
@keyframes sqIn { from { transform: scale(0); } }
.toast { margin: -4px 0 0; min-height: 1.3em; font-weight: 800; white-space: pre-line; color: var(--text); }
.next { margin: 2px 0 0; font-size: 20px; color: var(--white); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.noscript { position: relative; z-index: 1; text-align: center; font-weight: 700; }

/* ---------- dialogs ---------- */
.dlg {
  width: min(92vw, 420px); max-height: 88dvh; padding: 18px 18px 16px; overflow-y: auto;
  border: 4px solid var(--ink); border-radius: 24px; background: var(--dlg); color: var(--dlg-text);
  box-shadow: 0 8px 0 var(--ink); text-align: center;
}
.dlg[open] { animation: dlgIn .25s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes dlgIn { from { transform: scale(.85); } }
.dlg::backdrop { background: rgba(7, 30, 45, .55); }
.dlg-wide { width: min(94vw, 640px); }
.dlg-title { margin: 0 0 10px; font-size: 30px; text-transform: uppercase; color: var(--yellow); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; }
.dlg-sub { margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.dlg form { margin-top: 14px; }
.dlg-foot { position: sticky; bottom: -16px; padding: 10px 0 0; background: var(--dlg); }
.demo { display: grid; grid-template-columns: repeat(3, 64px); gap: 4px; justify-content: center; padding: 8px; margin: 0 auto 8px; width: max-content; background: #fff; border: 3px solid var(--ink); border-radius: 16px; }
.demo img { width: 64px; height: 64px; }
.demo-odd { border-radius: 12px; animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 0%, 50% { box-shadow: none; } 70%, 100% { box-shadow: inset 0 0 0 4px var(--green); } }
.steps { text-align: left; margin: 8px 0; padding-left: 22px; line-height: 1.45; }
.steps li { margin: 4px 0; }
.legend { font-weight: 700; margin: 6px 0 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 8px 4px; border-radius: 14px; background: rgba(25, 195, 230, .15); }
.stat b { display: block; font-family: 'Luckiest Guy', sans-serif; font-weight: 400; font-size: 28px; }
.stat span { font-size: 12px; font-weight: 700; }
.dist { display: flex; flex-direction: column; gap: 3px; }
.bar-row { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: center; font-weight: 800; font-size: 13px; }
.bar { text-align: left; }
.bar i { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 4px; background: #7c8aa0; color: #fff; font-style: normal; text-align: right; }
.bar i.today { background: var(--green); }
.settings { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; margin-top: 14px; font-weight: 800; }
.settings input { width: 20px; height: 20px; vertical-align: -4px; accent-color: var(--orange-dark); }
.fineprint { font-size: 12px; opacity: .75; margin: 10px 0 0; }
.album section { margin: 6px 0 12px; }
.album h3 { margin: 0 0 6px; font-size: 15px; text-align: left; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 3px; padding: 6px; border-radius: 14px; background: #fff; border: 2px solid var(--ink); }
.album-grid img { width: 100%; aspect-ratio: 1; border-radius: 10px; background: rgba(25, 195, 230, .1); }
.album-grid img:not(.locked) { background: rgba(33, 197, 93, .14); }
.album-grid img.locked { filter: brightness(0); opacity: .14; }

/* Short screens (landscape phones, small embeds) */
@media (max-height: 600px) {
  .title-game, .dots { display: none; }
  .logo-big { width: 110px; }
  .title { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .wave, .timer-fill, .flash.in, .cell.reveal, .logo-big, .logo-wrap::before, .btn-play, .timer-num.low, .score-big, .screen.scroll, .board.enter { animation: none !important; }
}

/* ===================== v3: progression, power-ups, music-era polish ===================== */

/* drifting theme emoji behind everything */
.drift { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.drift img { position: absolute; bottom: -90px; opacity: .16; animation: floatUp linear infinite; will-change: transform; }
body[data-screen='game'] .drift img { opacity: .09; }
@keyframes floatUp { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-120vh) rotate(8deg); } }

/* player chip on home */
.player {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  background: var(--white); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); color: var(--ink); text-align: left;
}
.player-lv {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; padding-top: 3px;
  background: var(--yellow); border: 3px solid var(--ink); font-family: 'Luckiest Guy', sans-serif; font-size: 18px;
}
.player-info b { display: block; font-size: 13px; line-height: 1.1; }
.xpbar { display: block; width: 92px; height: 8px; margin-top: 3px; border-radius: 4px; background: rgba(29, 19, 64, .15); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #2f8cff, #21c55d); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.xpbar.big { width: 100%; height: 14px; border: 2px solid var(--ink); background: var(--white); }

/* missions */
.missions { width: min(100%, 380px); padding: 10px 12px; border-radius: 18px; background: var(--glass); text-align: left; }
.missions h3 { margin: 0 0 6px; font-family: 'Luckiest Guy', sans-serif; font-weight: 400; font-size: 17px; text-transform: uppercase; color: var(--white); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.missions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.missions li { display: grid; grid-template-columns: 1fr 60px 24px; gap: 8px; align-items: center; font-weight: 800; font-size: 14px; }
.missions li.done { opacity: .7; }
.m-bar { height: 8px; border-radius: 4px; background: rgba(29, 19, 64, .2); overflow: hidden; }
.m-bar i { display: block; height: 100%; background: var(--green); }
.m-reward { text-align: center; }

/* HUD points + multiplier */
.hud-points {
  position: relative; font-family: 'Luckiest Guy', sans-serif; font-size: 20px; white-space: nowrap;
  background: var(--white); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 9px 1px; box-shadow: 0 3px 0 var(--ink);
}
.hud-points small { font-size: 12px; opacity: .6; margin-left: 2px; }
.hud-points.bump { animation: bump .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 50% { transform: scale(1.18); } }
.mult {
  position: absolute; top: -12px; right: -10px; padding: 2px 6px 0; border-radius: 8px; font-weight: 400;
  background: var(--orange-dark); color: var(--white); border: 2px solid var(--ink); font-size: 14px; transform: rotate(8deg);
}
.pill[data-tier='all'] { background: #ff3d8b; }
.pill[data-tier='boss'] { background: var(--ink); color: var(--yellow); }

/* find-all target strip */
.targets { display: flex; gap: 6px; justify-content: center; margin: 0 0 6px; padding: 5px 8px; border-radius: 16px; background: var(--white); border: 3px solid var(--ink); }
.targets img { width: 42px; height: 42px; transition: opacity .2s, transform .2s; }
.targets img.got { opacity: .25; transform: scale(.8); filter: grayscale(1); }

/* power-ups */
.powerbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; padding: 8px 0 2px; }
.power {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 12px 6px; min-height: 48px; border-radius: 16px; cursor: pointer;
  background: var(--white); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); touch-action: manipulation;
}
#btn-hint { justify-self: start; grid-column: 1; }
.powerbar .combo { grid-column: 2; }
#btn-freeze { justify-self: end; grid-column: 3; }
.power:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.power:disabled { opacity: .45; }
.pw-icon { font-size: 22px; }
.pw-name { font-family: 'Luckiest Guy', sans-serif; font-size: 15px; text-transform: uppercase; padding-top: 3px; }
.power b { position: absolute; top: -10px; right: -8px; min-width: 22px; height: 22px; padding-top: 1px; border-radius: 11px; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 13px; text-align: center; }
.combo { margin-top: 0; font-size: 16px; padding: 6px 10px 2px; }
.cell.hinted { background: rgba(255, 210, 31, .45); box-shadow: inset 0 0 0 3px var(--yellow); }
.timer-fill.frozen { background-image: repeating-linear-gradient(-45deg, #8fe3ff 0 12px, #4cc3f0 12px 24px) !important; animation-play-state: paused; }

/* coach / mission bubble */
.coach {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%); z-index: 3; pointer-events: none;
  width: max-content; max-width: 94%; text-align: center; line-height: 1.15;
  padding: 9px 16px 6px; border-radius: 999px; background: var(--ink); color: var(--white);
  font-family: 'Luckiest Guy', sans-serif; font-size: 17px; text-transform: uppercase; animation: coachIn .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes coachIn { from { transform: translateX(-50%) scale(.5); } }

/* 3-2-1-GO */
.countdown {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none;
  font-family: 'Luckiest Guy', sans-serif; font-size: clamp(110px, 38vw, 220px); color: var(--yellow);
  -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill; text-shadow: 0 .06em 0 var(--ink); background: rgba(7, 40, 60, .35);
}
.countdown.beat { animation: beat .42s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes beat { from { transform: scale(2.4); } }

/* the comparison shown when time runs out */
.compare { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px auto 0; padding: 8px 14px; border-radius: 18px; background: var(--white); border: 3px solid var(--ink); }
.compare img { width: 64px; height: 64px; }
.compare img:last-child { border-radius: 12px; box-shadow: inset 0 0 0 3px var(--red); }
.compare span { font-family: 'Luckiest Guy', sans-serif; font-size: 28px; color: var(--ink); }

/* results */
.points-big { margin: -4px 0 0; font-family: 'Luckiest Guy', sans-serif; font-size: 34px; color: var(--white); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; }
.points-big small { font-size: 18px; }
.xp-card { width: min(100%, 380px); }
.xp-card:empty { display: none; }
.xp-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-weight: 800; }
.xp-lv { font-family: 'Luckiest Guy', sans-serif; font-weight: 400; font-size: 20px; color: var(--yellow); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.xp-gain { margin-left: auto; color: var(--green); font-family: 'Luckiest Guy', sans-serif; font-weight: 400; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.dlg-level { text-align: center; }
.lv-badge {
  display: grid; place-items: center; width: 110px; height: 110px; margin: 6px auto; border-radius: 50%; padding-top: 8px;
  background: var(--yellow); border: 5px solid var(--ink); box-shadow: 0 6px 0 var(--ink);
  font-family: 'Luckiest Guy', sans-serif; font-size: 60px; color: var(--ink); animation: stamp .5s cubic-bezier(.2, 1.5, .4, 1);
}
.floater.ice { color: #8fe3ff; }

/* narrow phones: power-ups show just the icon and count, so long labels never push them off screen */
@media (max-width: 440px) {
  .pw-name { display: none; }
  .power { padding: 8px 16px 6px; }
  .pw-icon { font-size: 26px; }
}
@media (max-height: 640px) {
  .targets img { width: 32px; height: 32px; }
  .power { min-height: 40px; padding: 4px 10px 2px; }
  .pw-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .drift { display: none; }
  .countdown.beat, .coach, .hud-points.bump { animation: none !important; }
}

/* ===================== v4: reward week, relax ===================== */
.week { width: min(100%, 380px); padding: 10px 12px; border-radius: 18px; background: var(--glass); }
.week h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; text-align: left; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.week-days div {
  display: grid; justify-items: center; gap: 1px; padding: 5px 0 4px; border-radius: 10px;
  background: rgba(255, 255, 255, .5); border: 2px solid rgba(29, 19, 64, .25); color: var(--ink); font-size: 12px;
}
.week-days div b { font-family: 'Luckiest Guy', sans-serif; font-weight: 400; font-size: 14px; }
.week-days div:last-child { background: #ffe58a; }
.week-days .got { background: var(--green); color: #fff; border-color: var(--ink); }
.week-days .got span { visibility: hidden; }
.week-days .got::after { content: '✓'; margin-top: -16px; font-weight: 900; }
.week-days .now { background: var(--yellow); border: 3px solid var(--ink); transform: scale(1.08); }
.week-days .now.open { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) .3s backwards; }

.btn-relax {
  min-height: 44px; padding: 9px 14px 6px; font-size: 16px; background: #d9f7e6; color: var(--ink);
  box-shadow: inset 0 -4px 0 rgba(29, 19, 64, .1), 0 4px 0 var(--ink);
}
#game.relax .timer-fill { background: repeating-linear-gradient(-45deg, #8fe3b0 0 12px, #5ccf8d 12px 24px); }
#game.relax #btn-freeze { visibility: hidden; }
#rushover.relax .row, #rushover.relax #btn-daily-from-rush { display: none; }

/* Landscape phones: power-ups move to the sides so the board gets the full height. */
@media (orientation: landscape) and (max-height: 520px) {
  #game { position: relative; }
  .powerbar { position: absolute; left: 0; right: 0; top: 55%; padding: 0; pointer-events: none; }
  .powerbar > * { pointer-events: auto; }
  .powerbar .combo { display: none; }
  .hud { margin-bottom: 2px; }
  .hud-level { font-size: 16px; }
  .timer { height: 20px; }
  .timer-num { min-width: 32px; height: 32px; font-size: 18px; padding-top: 4px; }
  .board-wrap { padding-top: 6px; }
}

/* Tablets and desktops: a bigger HUD to match the bigger board. */
@media (min-width: 700px) and (min-height: 700px) {
  .hud-level { font-size: 26px; }
  .hud-points { font-size: 26px; }
  .pill { font-size: 17px; }
  .icon-btn { min-width: 52px; height: 52px; font-size: 24px; }
  .title-game { font-size: 40px; }
  .timer { height: 32px; }
  .timer-num { min-width: 48px; height: 48px; font-size: 26px; }
  .targets img { width: 56px; height: 56px; }
}

/* ===================== v5: punch ===================== */
.ring { position: absolute; width: 70px; height: 70px; border-radius: 50%; border: 6px solid #21c55d; pointer-events: none; }
.board.cheer .cell img { animation: hop .42s cubic-bezier(.3, 1.6, .5, 1) var(--d, 0ms) backwards; }
@keyframes hop { 45% { transform: translateY(-14%) scale(1.12); } }
/* the glow lives on a pseudo-element: its opacity animates cheaply and never overrides the board's
   own entrance animation */
.board { position: relative; }
.board::after {
  content: ''; position: absolute; inset: -9px; border-radius: 28px; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 5px #ff8a00, 0 0 34px 10px rgba(255, 110, 0, .6);
  transition: opacity .3s;
}
#game.onfire .board::after { opacity: 1; animation: fireGlow 1.1s ease-in-out infinite; }
@keyframes fireGlow { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .board.cheer .cell img, #game.onfire .board { animation: none !important; }
}
.weekly { margin-top: 10px; padding-top: 8px; border-top: 2px dashed rgba(29, 19, 64, .2); }
.weekly p { margin: 0 0 5px; font-weight: 800; font-size: 14px; display: flex; justify-content: space-between; gap: 6px; }
.weekly small { font-size: 12px; opacity: .8; white-space: nowrap; }
.weekly-bar { display: block; height: 10px; }
.weekly-bar i { background: linear-gradient(90deg, #ffad3a, #ff6f00); }

/* ===================== v7: pop-ups, colour-blind marks, first visit ===================== */
.notes {
  position: fixed; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%); z-index: 70;
  width: max-content; max-width: min(92vw, 420px); padding: 10px 16px 7px; border-radius: 18px; text-align: center;
  background: var(--ink); color: var(--white); border: 3px solid var(--yellow); box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
  font-family: 'Luckiest Guy', sans-serif; font-size: 17px; line-height: 1.2; pointer-events: none;
}
.notes.in { animation: noteIn .35s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes noteIn { from { transform: translateX(-50%) translateY(-24px) scale(.8); } }
/* colour-blind: squares and dots carry a mark, not just a colour */
body.cb .squares i, body.cb .dots i { display: grid; place-items: center; font: 900 14px/1 system-ui, sans-serif; color: var(--ink); }
body.cb .squares i.g::after, body.cb .dots i.g::after { content: '✓'; }
body.cb .squares i.y::after, body.cb .dots i.y::after { content: '~'; }
body.cb .squares i.r::after, body.cb .dots i.r::after { content: '✗'; color: #fff; }
body.cb .dots i { height: 14px; width: 24px; font-size: 11px; }
/* first visit: just Play and Rush, nothing else to read */
body.first-visit #btn-relax, body.first-visit #week, body.first-visit #missions, body.first-visit .player { display: none; }
@media (prefers-reduced-motion: reduce) { .notes.in { animation: none; } }
body.first-visit .topbar { justify-content: flex-end; }

/* ===================== v9: album rarity ===================== */
.album-grid img.rare { background: rgba(47, 140, 255, .22); box-shadow: inset 0 0 0 2px #2f8cff; }
.album-grid img.legend { background: rgba(255, 210, 31, .4); box-shadow: inset 0 0 0 2px #ff9a1a; }

/* ===================== v10: theme-week Rush ===================== */
.btn-week { background: linear-gradient(180deg, #ff6fb0, #e0367f); color: var(--white); text-shadow: 0 2px 0 var(--ink); font-size: 19px; }
.btn-week small { text-shadow: none; }
body.first-visit #btn-week { display: none; }

/* ===================== v11: audit 3 ===================== */
.floater.gem { font-size: 34px; }
/* on the game screen pop-ups sit low, over the power-up bar, never over the board's header or targets */
body[data-screen='game'] .notes { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); font-size: 15px; }

/* ===================== v13: arrival card (?play=daily) ===================== */
.ready {
  position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px 16px; text-align: center; background: var(--sky);
}
.ready img { width: min(46vw, 200px); height: auto; filter: drop-shadow(0 5px 0 var(--ink)); animation: bob 3.2s ease-in-out infinite; }
.ready-hi { margin: 0; font-family: 'Luckiest Guy', sans-serif; font-size: clamp(24px, 7vw, 34px); color: var(--white); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-transform: uppercase; }
.ready .btn-play { width: min(100%, 360px); }

.legal { margin: 2px 0 0; font-size: 12px; opacity: .75; }
.legal a { color: inherit; }

/* Past puzzles and the Weeby Club */
.past-link {
  margin: 4px 0 0; padding: 8px 16px 6px; border: 3px solid var(--ink); border-radius: 999px;
  background: rgba(255, 255, 255, .9); color: var(--ink); font: inherit; font-size: 16px; letter-spacing: .03em;
  text-transform: uppercase; cursor: pointer; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation;
}
.past-link b { margin-left: 4px; padding: 1px 7px 0; border-radius: 999px; background: var(--orange-dark); color: #fff; font-size: 13px; }
.past-link b:empty { display: none; }
body.first-visit #btn-past { display: none; }
.club { margin: 4px 0; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 18px; background: #fff4c2; color: var(--ink); text-align: center; }
.club-head { margin: 0 0 4px; font-size: 19px; text-transform: uppercase; letter-spacing: .03em; }
.club-perks { margin: 0 0 10px; font-weight: 700; font-size: 13px; line-height: 1.35; }
.club.member { padding: 8px 12px; }
.club.member .club-perks { display: none; }
.club-slot { list-style: none; }
.club-code { margin-top: 8px; }
.club-code summary { cursor: pointer; font-weight: 800; font-size: 14px; text-decoration: underline; }
.club .btn-main { display: block; font-size: 20px; min-height: 0; padding: 11px 12px 8px; }
.club-form { display: flex; gap: 8px; margin-top: 10px; }
.club-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 14px; font: inherit; background: #fff; color: var(--ink); font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
.club-form .btn { width: auto; min-height: 0; padding: 10px 14px 7px; font-size: 16px; }
.club-msg { margin: 6px 0 0; font-weight: 700; font-size: 13px; min-height: 1em; }
.club.member #club-join { display: none; }
.past { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.past li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--white); color: var(--ink); }
.past li img { width: 38px; height: 38px; flex: none; }
.past li .pl { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.past li .pl b { font-size: 16px; letter-spacing: .02em; text-transform: uppercase; }
.past li .pl small { font-weight: 700; opacity: .7; }
.past li .btn { width: auto; min-height: 0; padding: 8px 12px 5px; font-size: 15px; flex: none; }
.past li .btn.done { background: #d9f7e6; }
.past li.bonus { background: #fff4c2; }
.past li.locked { background: #e6e9f2; }
.past li.locked img { filter: grayscale(1); opacity: .55; }
.past li.club-slot { display: block; padding: 0; border: 0; background: transparent; }

body.portal .club { display: none !important; }
/* First visit: Rush is the only mode shown, so it is a normal one-line button, not a tile. */
body.first-visit #btn-rush.mode { flex-direction: row; min-height: 56px; font-size: 20px; }
body.first-visit #btn-rush.mode .ico { display: inline; font-size: inherit; margin: 0; }
