@font-face {
  font-family: Poppins;
  src: url("/fonts/Poppins-700-normal-latin.woff2");
  font-weight: 700;
  font-display: swap;
}
/* One variable Inter file; the 500-600 range keeps body text at medium. */
@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-variable-latin.woff2");
  font-weight: 500 600;
  font-display: swap;
}
:root {
  font-family: Inter, system-ui, sans-serif;
  color: #f6f5ff;
  background: #0c102c;
  font-synthesis: none;
  color-scheme: dark;
  --acid: #bdff8b;
  --ink: #081828;
  --pink: #ff689e;
  --line: #ffffff25;
  --muted: #c0c5dd;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 280px;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  font:
    600 14px Inter,
    system-ui;
  cursor: pointer;
  border: 1px solid #ffffff36;
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 16px;
  background: #1e2948;
  color: #fff;
}
button:hover {
  filter: brightness(1.15);
}
button:active {
  transform: translateY(2px);
}
button:disabled {
  opacity: 0.48;
  cursor: default;
  transform: none;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ffe7a1;
  outline-offset: 4px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: Poppins, system-ui;
  font-weight: 700;
}
button.big-play {
  min-height: 56px;
  padding: 14px 30px;
  font: 700 18px Poppins;
  background: var(--acid);
  color: #102426;
  border: 0;
  border-radius: 15px;
  box-shadow: 0 5px 0 #54805d;
}
.topbar {
  height: 62px;
  padding: 8px clamp(12px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #091128f2;
  position: relative;
  z-index: 5;
}
.brand-group,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.arcade-back {
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #c9cfe5;
}
.game-title {
  font-size: 22px;
  font-style: italic;
  letter-spacing: -1px;
  white-space: nowrap;
}
.top-actions {
  gap: 7px;
}
.top-actions button {
  padding: 8px 12px;
  font-size: 12px;
  background: #ffffff0c;
}
.play-surface {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}
.floating-hud {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  inset: 16px 20px auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.hud-score small,
.hud-time small {
  font-size: 10px;
  letter-spacing: 2px;
  color: #ced4f3;
  display: block;
}
.hud-score strong,
.hud-time strong {
  font: 700 30px Poppins;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #060a24;
}
.hud-time {
  text-align: right;
}
.hud-hearts {
  color: #ff87ab;
  letter-spacing: 3px;
  font-size: 22px;
  margin-top: 5px;
  text-shadow: 0 2px 0 #06121a;
}
.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: #bfc6db;
  padding: 10px 18px;
  background: #080e24;
}
.key-help {
  font-size: 11px;
  color: #c0ccdb;
}
.announcement {
  position: absolute;
  z-index: 3;
  top: 22%;
  left: 5%;
  width: 90%;
  pointer-events: none;
  text-align: center;
  font: 700 clamp(22px, 5vw, 50px) Poppins;
  font-style: italic;
  text-shadow: 0 4px 0 #152442;
  opacity: 0;
  transition: opacity 0.12s;
}
.announcement.visible {
  opacity: 1;
}
.primary {
  background: var(--acid);
  color: #102526;
  border-color: transparent;
}
.secondary {
  background: #ffffff10;
}
.danger {
  background: #63394f;
}
.dialog {
  width: min(590px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  margin: auto;
  padding: 30px;
  border: 1px solid #ffffff38;
  border-radius: 24px;
  background: #131c39;
  color: #fff;
  box-shadow: 0 26px 100px #0009;
}
.dialog::backdrop {
  background: #060b24c9;
  backdrop-filter: blur(7px);
}
.dialog .eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #cbd3ed;
  font-weight: 600;
  margin-bottom: 10px;
}
.dialog h2 {
  font-size: clamp(26px, 6vw, 42px);
  line-height: 1.08;
  letter-spacing: -1.3px;
}
.dialog h2 em {
  color: var(--acid);
  font-style: normal;
}
.dialog .lede {
  font-size: 16px;
  line-height: 1.65;
  color: #d2d7e9;
  margin: 18px 0 24px;
}
.dialog .smallprint {
  font-size: 11px;
  line-height: 1.6;
  color: #aebbd4;
  margin-top: 18px;
}
.dialog .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
/* Labels stay on one line; buttons that can't share a row wrap to their own. */
.dialog .actions > * {
  flex: 1 1 auto;
  white-space: nowrap;
}
.dialog .result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0;
}
.result-grid > div {
  padding: 13px 15px;
  border-radius: 12px;
  background: #ffffff09;
}
.result-grid small {
  display: block;
  font-size: 11px;
  color: #bfc9e5;
  margin-bottom: 5px;
}
.result-grid strong {
  font: 700 25px Poppins;
}
.intro-visual {
  height: 130px;
  margin: -10px 0 14px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.intro-visual .drop-mascot {
  width: 87px;
  height: 96px;
  border-radius: 52% 48% 51% 49%;
  background:
    radial-gradient(ellipse at 30% 25%, #fff8 0 12%, transparent 15%),
    radial-gradient(ellipse at 38% 28%, #b7fff1, #3fd6d1 55%, #2c84bc 85%);
  border: 4px solid #10344d;
  box-shadow:
    0 8px 0 #04142c,
    0 0 0 12px #72ecd319;
  transform: rotate(-12deg);
  position: relative;
}
.drop-mascot::before,
.drop-mascot::after {
  content: "";
  position: absolute;
  top: 40px;
  width: 10px;
  height: 15px;
  background: #072641;
  border-radius: 50%;
  box-shadow: 2px 3px 0 #fff3;
}
.drop-mascot::before {
  left: 25px;
}
.drop-mascot::after {
  right: 17px;
}
.intro-orbit {
  position: absolute;
  width: 230px;
  height: 75px;
  border: 2px solid #d2ff7877;
  border-radius: 50%;
  transform: rotate(-18deg);
}
.intro-orbit::after {
  content: "✦";
  color: #d2ff78;
  font-size: 42px;
  position: absolute;
  right: 3px;
  top: -10px;
}
.intro-note {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #ccd9ef;
  padding: 12px 0;
}
.intro-note b {
  color: var(--acid);
}
.upgrade-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.upgrade {
  display: grid;
  grid-template-columns: 46px 1fr;
  text-align: left;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #202d4e;
  min-height: 82px;
  border: 1px solid #66779b;
}
.upgrade > span:first-child {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #0b2b3b;
  background: var(--acid);
  font: 700 26px Poppins;
}
.upgrade strong {
  font: 700 17px Poppins;
  display: block;
}
.upgrade small {
  display: block;
  color: #cbd4e9;
  line-height: 1.5;
  margin-top: 4px;
}
.upgrade:hover {
  border-color: var(--acid);
  background: #293e57;
}
.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;
}
#load-error {
  position: fixed;
  inset: auto 12px 12px;
  z-index: 30;
  padding: 20px;
  background: #481e39;
  border: 2px solid #ff9cc3;
  border-radius: 14px;
}
[hidden] {
  display: none !important;
}
.touch-hint {
  display: none;
}
@media (max-width: 600px) {
  .topbar {
    height: 57px;
    padding: 6px 10px;
  }
  .game-title {
    font-size: 20px;
  }
  .brand-group {
    gap: 10px;
  }
  .top-actions button {
    min-width: 44px;
    padding: 8px;
  }
  .top-actions #sound {
    font-size: 0;
  }
  .top-actions #sound::after {
    content: "♫";
    font-size: 20px;
  }
  .top-actions #sound[aria-pressed="true"]::after {
    color: var(--acid);
  }
  .floating-hud {
    inset: 14px 14px auto;
  }
  .hud-score strong,
  .hud-time strong {
    font-size: 25px;
  }
  .hud-hearts {
    font-size: 20px;
  }
  .dialog {
    padding: 24px;
  }
  .key-help {
    display: none;
  }
  .touch-hint {
    display: inline;
  }
  .game-footer {
    font-size: 10px;
  }
  .dialog .lede {
    font-size: 14px;
  }
  .intro-visual {
    height: 100px;
  }
  .intro-note {
    font-size: 12px;
  }
  .game-title {
    letter-spacing: -0.8px;
  }
}
/* Touch-only devices get touch hints at any size, such as a tablet or a landscape phone. */
@media (hover: none) and (pointer: coarse) {
  .key-help {
    display: none;
  }
  .touch-hint {
    display: inline;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Avery chip-world identity. The scene supplies the artwork. */
:root {
  --acid: #5de4ff;
  --pink: #ff5eed;
  --ink: #222039;
  background: #10101d;
}
.topbar {
  background: #171524ee;
  border-bottom: 1px solid #a693d82b;
}
.arcade-back {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 17px;
  border-right: 1px solid #b5a8d637;
}
.arcade-back img {
  display: block;
  width: 88px;
  height: auto;
}
.arcade-back span {
  font: 600 9px Inter;
  letter-spacing: 0.17em;
  color: #c3b5de;
}
.game-title {
  color: #eee7ff;
  font-style: normal;
  font-size: 20px;
  letter-spacing: -0.05em;
}
button {
  border-radius: 7px;
  background: #29253c;
}
button.big-play,
.primary {
  background: linear-gradient(105deg, #00a6ff, #8152f2);
  color: #fff;
  border-radius: 8px;
  box-shadow:
    0 3px 0 #312162,
    0 0 24px #8152f235;
}
.dialog {
  background: #222039f2;
  border-color: #afa0da50;
  border-radius: 16px;
  box-shadow: 0 25px 100px #05031388;
}
.dialog h2 {
  letter-spacing: -0.055em;
}
.dialog em {
  color: #5de4ff;
}
.dialog::backdrop {
  background: #090617b0;
  backdrop-filter: blur(5px);
}
#intro.dialog {
  width: min(460px, calc(100vw - 40px));
  margin: auto auto 72px max(34px, calc((100vw - 1320px) / 2));
  padding: 30px;
  background: #222039e8;
}
#intro::backdrop {
  background: linear-gradient(90deg, #08061130, transparent 65%);
  backdrop-filter: none;
}
#intro .intro-visual,
#intro .candy-intro {
  display: none;
}
#intro h2 {
  font-size: clamp(34px, 3.3vw, 49px);
  margin-top: 18px;
  line-height: 1.09;
}
#intro .lede {
  font-size: 15px;
  line-height: 1.65;
}
#intro .intro-note {
  margin: 22px 0;
  font-size: 12px;
}
#intro .smallprint {
  font-size: 10px;
  line-height: 1.6;
}
#intro .eyebrow {
  font-size: 9px;
  color: #cda9f6;
  letter-spacing: 0.17em;
}
.boss-direction {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 8px 12px;
  background: #3a172a;
  border: 1px solid #ff9ace;
  border-radius: 20px;
  font: 600 10px Inter;
  color: #ffc4ec;
  pointer-events: none;
}
canvas:focus-visible {
  outline: 1px solid #5de4ff55;
}
.upgrade {
  background: #302b4c;
  border-color: #a598cf45;
  border-radius: 9px;
}
.upgrade > span:first-child {
  background: #8152f2;
  color: white;
}
@media (max-width: 600px) {
  .topbar {
    padding: 7px 10px;
    gap: 7px;
    height: 58px;
  }
  .brand-group {
    gap: 9px;
    min-width: 0;
  }
  .arcade-back {
    padding-right: 8px;
    gap: 0;
  }
  .arcade-back img {
    width: 58px;
  }
  .arcade-back span {
    display: none;
  }
  /* Without the ARCADE label, an arrow keeps the logo reading as a way back. The logo
     shrinks to make room for it. */
  .arcade-back::before {
    content: "←";
    margin-right: 4px;
    font-size: 15px;
    color: #c3b5de;
  }
  .game-title {
    font-size: 15px;
    max-width: 120px;
    line-height: 1.1;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions button {
    padding: 5px;
    min-width: 44px;
  }
  #intro.dialog {
    margin: auto 14px 40px;
    width: calc(100vw - 28px);
    /* The 40px bottom margin plus 14px of top clearance. */
    max-height: calc(100dvh - 54px);
    padding: 22px;
  }
  #intro h2 {
    font-size: 35px;
  }
  #intro .lede {
    font-size: 13px;
  }
  #intro .intro-note {
    margin: 15px 0;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  #intro.dialog {
    width: 380px;
    margin: auto auto 14px 18px;
    padding: 18px;
  }
  #intro h2 {
    font-size: 29px;
    margin-top: 10px;
  }
  #intro .lede {
    margin-top: 10px;
    font-size: 12px;
  }
  #intro .intro-note {
    margin: 10px 0;
  }
  #intro .smallprint {
    margin-top: 10px;
  }
  #intro .big-play {
    min-height: 44px;
    font-size: 15px;
    padding: 9px 20px;
  }
}

.world-score {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -50%);
  font: 700 clamp(14px, 2vw, 24px) Poppins;
  text-shadow:
    0 2px 3px #151027,
    0 0 15px #222039;
  white-space: nowrap;
}

.science-note {
  margin-top: 22px;
  border-top: 1px solid #ffffff25;
  padding-top: 10px;
  color: #cfcae3;
  font-size: 12px;
  line-height: 1.65;
}
.science-note summary {
  min-height: 44px;
  display: list-item;
  padding: 12px 0;
  cursor: pointer;
  color: #5de4ff;
}
.science-note p {
  margin: 4px 0 0;
}

/* Landscape phones: fit result, pause and upgrade dialogs on one screen instead of opening
   scrolled past their own headline. The intro keeps its own short-screen layout above. */
@media (max-height: 500px) and (min-width: 601px) {
  .dialog:not(#intro) {
    width: min(760px, calc(100vw - 28px));
    padding: 16px 22px;
  }
  .dialog:not(#intro) h2 {
    font-size: 26px;
    line-height: 1.1;
  }
  /* The result's save line stays: it is where a new personal best shows. */
  .dialog:not(#intro) .smallprint:not(#saved, #saved-notice) {
    display: none;
  }
  .dialog .result-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
  }
  .result-grid > div {
    padding: 8px 10px;
  }
  .result-grid strong {
    font-size: 19px;
  }
  .upgrade-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
  }
}
