:root {
  --bg: #f1f2ff;
  --ink: #292b46;
  --muted: #777493;
  --purple: #7563cf;
  --line: #d9d5f0;
  --coral: #ff838c;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(
    ellipse at 50% 45%,
    #fafaff 0,
    #f3f2ff 53%,
    #eeefff 100%
  );
  min-height: 100svh;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font-family: inherit;
  font-size: 15px;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #8873db;
  outline-offset: 5px;
}
button {
  transition:
    background 0.16s,
    transform 0.16s,
    box-shadow 0.16s;
}
button:active {
  transform: translateY(1px);
}
.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.app {
  max-width: 1504px;
  margin: auto;
  padding: 0 48px 18px;
}
header {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand > span:nth-child(2) {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
}
.brand small {
  font-size: 12px;
  color: var(--purple);
  font-weight: 500;
  line-height: 1.3;
  margin-left: 2px;
}
.brand-melon {
  width: 48px;
  height: 48px;
  transform: rotate(-38deg);
  display: block;
}
.brand-melon svg {
  width: 100%;
  height: 100%;
}
.tagline {
  font-size: 16px;
  color: #6e639e;
  letter-spacing: 5px;
  margin-right: 40px;
}
nav {
  display: flex;
  gap: 22px;
}
.icon-button {
  background: none;
  border: 0;
  padding: 3px;
  color: #68618e;
  display: grid;
  justify-items: center;
  gap: 5px;
  font-size: 11px;
}
.icon-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button:hover {
  color: var(--purple);
}
.icon-button[aria-pressed="true"] {
  color: var(--purple);
}
#sound[aria-pressed="false"] svg {
  opacity: 0.45;
}
main {
  display: grid;
  grid-template-columns: minmax(210px, 270px) minmax(340px, 1fr) minmax(
      240px,
      290px
    );
  gap: 36px;
  align-items: center;
}
.intro {
  align-self: center;
  padding-bottom: 12px;
}
h1 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: clamp(42px, 4.25vw, 64px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.35;
  margin: 0;
}
.squiggle {
  display: block;
  color: #a594e6;
  font-family: serif;
  font-size: 64px;
  line-height: 0.45;
  margin: 12px 0 25px;
  letter-spacing: -10px;
  height: 13px;
  overflow: hidden;
  width: 77px;
}
.intro-copy {
  font-size: 17px;
  line-height: 1.9;
  margin: 0 0 28px;
}
.scores {
  display: grid;
  gap: 12px;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff40;
  font-size: 15px;
}
.score-row svg {
  width: 22px;
  height: 22px;
  stroke: #a6a1b9;
  stroke-width: 1.6;
  fill: #dedbe9;
  stroke-linejoin: round;
}
.score-row .crown {
  stroke: #e9b24f;
  fill: #fbd792;
}
.score-row strong {
  font-size: 26px;
  color: #7160b8;
  font-weight: 600;
  margin-left: auto;
  letter-spacing: -1px;
}
.next {
  border: 1.5px dashed var(--line);
  border-radius: 15px;
  text-align: center;
  margin-top: 18px;
  padding: 12px 0 7px;
  font-size: 15px;
  min-height: 123px;
}
.next canvas {
  display: block;
  width: 76px;
  height: 76px;
  margin: 6px auto 0;
}
.game-area {
  position: relative;
  min-width: 0;
  justify-self: center;
  width: 100%;
  max-width: 568px;
}
.aim-tip {
  border: 1px solid #bbaeea;
  background: linear-gradient(#faf9ff, #eae6ff);
  border-radius: 30px;
  width: max-content;
  max-width: 100%;
  padding: 8px 22px;
  font-size: 15px;
  color: #7160b8;
  margin: 0 auto 3px;
  position: relative;
  z-index: 1;
}
.canvas-wrap {
  position: relative;
}
#game {
  width: 100%;
  aspect-ratio: 5/6;
  display: block;
  touch-action: none;
  cursor: crosshair;
  outline-offset: -3px;
}
#loading {
  position: absolute;
  left: 0;
  right: 0;
  top: 45%;
  text-align: center;
  color: var(--muted);
}
#loading[hidden] {
  display: none;
}
#toast {
  position: absolute;
  top: 45%;
  width: 100%;
  text-align: center;
  pointer-events: none;
  color: var(--purple);
  font-size: 22px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
}
#toast.visible {
  opacity: 1;
}
.physics {
  align-self: center;
  padding-bottom: 20px;
}
.physics h2 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 25px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 22px;
}
.modes {
  display: flex;
  border: 1.5px solid #cfc7ee;
  border-radius: 15px;
  padding: 3px;
  background: #f7f6ff80;
}
.modes button {
  flex: 1;
  padding: 10px 1px;
  border: 0;
  border-radius: 11px;
  background: none;
  font-size: 16px;
  white-space: nowrap;
}
.modes button[aria-pressed="true"] {
  background: linear-gradient(#9e86ef, #7563ce);
  color: white;
  box-shadow:
    0 1px 4px #7462bf45,
    inset 0 1px 1px #c7baff;
  font-weight: 600;
}
#mode-desc {
  text-align: center;
  font-size: 14px;
  color: #69617f;
  margin: 15px 0 30px;
  min-height: 20px;
}
.stir {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 1px solid #8975d4;
  border-radius: 18px;
  background: linear-gradient(170deg, #a18bed, #7762d1);
  box-shadow:
    inset 0 2px 2px #ffffff61,
    0 4px 8px #9480d824;
  padding: 15px;
  color: white;
  font-size: 22px;
  font-weight: 600;
}
.stir:hover {
  box-shadow:
    inset 0 2px 2px #ffffff61,
    0 5px 12px #9480d844;
}
.stir svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.energy-cost {
  font-size: 14px;
  color: #7160a2;
  text-align: center;
  margin: 12px 0 22px;
}
.energy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff40;
  font-size: 13px;
  white-space: nowrap;
}
.energy-row span {
  font-size: 11px;
  color: #827595;
}
.energy-row b {
  font-weight: 600;
  color: #4d4667;
}
progress {
  flex: 1;
  width: 50px;
  height: 11px;
  appearance: none;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #e8e7e8;
}
progress::-webkit-progress-bar {
  background: #e4e6da;
  border-radius: 20px;
}
progress::-webkit-progress-value {
  background: linear-gradient(#c9e99a, #abd476);
  border: 1px solid #9fcb6d;
  border-radius: 20px;
}
progress::-moz-progress-bar {
  background: #b9dc83;
}
.rules {
  border: 1.5px dashed var(--line);
  border-radius: 17px;
  padding: 13px 16px;
  margin-top: 31px;
}
.rules p {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 14px;
  line-height: 1.7;
  margin: 12px 0;
}
.rules svg {
  width: 40px;
  height: 32px;
  fill: none;
  stroke: #8b81ae;
  stroke-width: 1.4;
  flex: none;
}
.rule-bubbles {
  display: flex;
  gap: 5px;
  width: 40px;
  flex: none;
}
.rule-bubbles i {
  width: 17px;
  height: 22px;
  border: 1.5px solid #8b81ae;
  border-radius: 45% 50% 40% 45%;
  transform: rotate(-12deg);
  position: relative;
}
.rule-bubbles i:after {
  content: "··";
  position: absolute;
  top: -7px;
  left: 2px;
  font-size: 21px;
  color: #8b81ae;
}
.rule-bubbles i + i {
  transform: rotate(18deg);
}
.rule-line {
  width: 40px;
  border-top: 3px dashed var(--coral);
  flex: none;
}
.evolution {
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 20px 0 13px;
  padding: 11px 23px;
  display: flex;
  align-items: center;
  gap: 22px;
  background: #ffffff2b;
}
.evolution h2 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 22px;
  margin: 0;
  white-space: nowrap;
}
.evolution .squiggle {
  font-size: 44px;
  height: 10px;
  width: 63px;
  margin: 8px 0 0;
}
.evolution > div {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-around;
  min-width: 0;
}
.fruit-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.fruit-step canvas {
  width: clamp(33px, 5.1vw, 73px);
  height: clamp(33px, 5.1vw, 73px);
  display: block;
  transition:
    filter 0.3s,
    transform 0.3s;
}
.fruit-step:last-child canvas {
  transform: scale(1.16);
}
.fruit-step svg {
  width: 15px;
  height: 15px;
  position: absolute;
  right: -7px;
  stroke: #9b90b7;
  stroke-width: 1.8;
  fill: none;
}
.fruit-step.new canvas {
  animation: unlock 0.6s;
}
.mobile-tilt {
  display: none;
}
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  font-size: 12px;
  color: #827596;
  min-height: 26px;
}
footer > span {
  display: flex;
  align-items: center;
  gap: 7px;
}
kbd {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bdb3d9;
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 23px;
  color: #7664a5;
  background: #ffffff40;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #f7f6ff;
  color: var(--ink);
  padding: 30px;
  max-width: min(430px, calc(100vw - 32px));
  text-align: center;
  box-shadow: 0 28px 100px #39304f33;
}
dialog::backdrop {
  background: #44385944;
  backdrop-filter: blur(6px);
}
dialog h2 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 31px;
  margin: 8px 0 15px;
}
#dialog-body {
  font-size: 15px;
  line-height: 1.9;
  color: #746586;
  margin-bottom: 22px;
}
#dialog-body strong {
  font-size: 44px;
  color: var(--purple);
  display: block;
  margin: 10px 0;
}
#dialog-body p {
  margin: 10px 0;
}
.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 17px 15px 0;
  font-size: 13px;
}
#dialog-close[hidden] {
  display: none;
}
.dialog-melon {
  width: 82px;
  height: 82px;
  margin: auto;
  background-size: 300% 300%;
  background-position: 100% 100%;
  background-image: url(fruits.png);
}
@keyframes unlock {
  50% {
    transform: scale(1.25);
  }
}
@media (min-width: 1101px) and (max-height: 930px) {
  header {
    height: 94px;
  }
  .game-area {
    max-width: calc((100svh - 224px) * 0.8333);
  }
  main {
    gap: 27px;
  }
  h1 {
    font-size: 51px;
  }
  .intro-copy {
    font-size: 15px;
    margin-bottom: 20px;
  }
  .score-row {
    padding: 10px 14px;
  }
  .next {
    min-height: 101px;
    padding: 8px;
  }
  .next canvas {
    width: 60px;
    height: 60px;
  }
  .physics h2 {
    margin-bottom: 15px;
  }
  .rules {
    margin-top: 23px;
  }
  .rules p {
    font-size: 12px;
  }
  .evolution {
    margin-top: 13px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .evolution canvas {
    width: 56px;
    height: 56px;
  }
  .tagline {
    font-size: 14px;
    letter-spacing: 3px;
  }
}
@media (max-width: 1100px) {
  .app {
    padding: 0 26px 15px;
  }
  header {
    height: 95px;
  }
  .brand > span:nth-child(2) {
    font-size: 29px;
  }
  .tagline {
    display: none;
  }
  main {
    grid-template-columns: 200px minmax(300px, 1fr);
    gap: 25px;
  }
  .physics {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 30px;
    align-items: center;
    padding: 0 15px;
  }
  .physics h2 {
    display: none;
  }
  .modes {
    grid-column: 1;
  }
  #mode-desc {
    grid-column: 1;
    margin: 12px 0;
  }
  .stir {
    grid-column: 2;
    grid-row: 1;
    font-size: 19px;
    padding: 12px;
  }
  .energy-cost {
    display: none;
  }
  .energy-row {
    grid-column: 2;
    grid-row: 2;
    padding: 8px 14px;
  }
  .rules {
    display: none;
  }
  .game-area {
    max-width: 500px;
  }
  h1 {
    font-size: 43px;
  }
  .intro-copy {
    font-size: 13px;
  }
  .score-row {
    font-size: 12px;
    padding: 12px;
  }
  .evolution {
    padding: 12px;
    gap: 12px;
  }
  .evolution h2 {
    font-size: 18px;
  }
  .evolution canvas {
    width: 52px;
    height: 52px;
  }
  .key-help {
    display: none !important;
  }
}
@media (max-width: 640px) {
  .app {
    padding: 0 16px 14px;
  }
  header {
    height: 74px;
    gap: 10px;
  }
  .brand {
    gap: 7px;
  }
  .brand > span:nth-child(2) {
    font-size: 25px;
    letter-spacing: 0;
  }
  .brand small {
    display: none;
  }
  .brand-melon {
    width: 33px;
    height: 33px;
  }
  nav {
    gap: 14px;
  }
  .icon-button {
    font-size: 9px;
    gap: 3px;
  }
  .icon-button svg {
    width: 21px;
    height: 21px;
  }
  main {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .intro {
    width: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .intro h1,
  .intro > .squiggle,
  .intro-copy {
    display: none;
  }
  .scores {
    display: flex;
    flex: 1;
    gap: 8px;
  }
  .score-row {
    flex: 1;
    border-radius: 12px;
    font-size: 10px;
    padding: 8px;
    gap: 5px;
  }
  .score-row svg {
    width: 15px;
    height: 15px;
  }
  .score-row strong {
    font-size: 21px;
  }
  .next {
    margin: 0;
    border: 0;
    padding: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 9px;
    min-width: 44px;
  }
  .next canvas {
    margin: 0;
    width: 35px;
    height: 35px;
  }
  .game-area {
    width: min(100%, 360px);
    margin-top: 12px;
    max-width: 100%;
  }
  .aim-tip {
    font-size: 11px;
    padding: 5px 17px;
  }
  #game {
    max-height: calc(100svh - 275px);
    min-height: 330px;
    object-fit: contain;
    aspect-ratio: 5/6;
  }
  .canvas-wrap {
    width: 100%;
    aspect-ratio: 5/6;
    max-height: calc(100svh - 275px);
    min-height: 330px;
  }
  .mobile-tilt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    color: #9990ae;
    margin: 0 8px 12px;
  }
  .mobile-tilt button {
    border: 1px solid #d5ceeb;
    border-radius: 16px;
    background: #fff4;
    font-size: 10px;
    padding: 5px 12px;
    touch-action: none;
  }
  .physics {
    display: grid;
    width: 100%;
    padding: 0;
    gap: 7px 12px;
    grid-template-columns: 1.15fr 1fr;
  }
  .modes {
    padding: 2px;
    border-radius: 12px;
  }
  .modes button {
    font-size: 12px;
    padding: 9px 1px;
    border-radius: 8px;
  }
  .stir {
    border-radius: 13px;
    font-size: 15px;
    padding: 9px;
    gap: 8px;
  }
  .stir svg {
    width: 22px;
    height: 22px;
  }
  #mode-desc {
    font-size: 10px;
    margin: 3px 0;
  }
  .energy-row {
    padding: 3px 8px;
    font-size: 10px;
    border: none;
    background: none;
    gap: 6px;
  }
  .energy-row span {
    font-size: 9px;
  }
  .evolution {
    margin-top: 14px;
    border-radius: 13px;
    padding: 8px;
    gap: 8px;
  }
  .evolution h2 {
    font-family: inherit;
    font-size: 9px;
    writing-mode: vertical-rl;
    font-weight: 500;
  }
  .evolution .squiggle {
    display: none;
  }
  .evolution canvas {
    width: 30px;
    height: 30px;
  }
  .fruit-step svg {
    width: 8px;
    height: 8px;
    right: -4px;
  }
  footer {
    font-size: 9px;
    gap: 12px;
  }
  footer > span {
    gap: 4px;
  }
  footer > span:nth-child(2) {
    display: none;
  }
  kbd {
    min-width: 16px;
    padding: 0 4px;
  }
  .dialog-melon {
    width: 65px;
    height: 65px;
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  .fruit-step canvas,
  #toast {
    transition: none;
  }
  .fruit-step.new canvas {
    animation: none;
  }
}

.squiggle {
  height: 14px;
  margin: 10px 0 23px;
  overflow: visible;
}
.squiggle svg {
  display: block;
  width: 77px;
  height: 14px;
  fill: none;
  stroke: #a594e6;
  stroke-width: 3;
  stroke-linecap: round;
}
.evolution .squiggle svg {
  width: 60px;
  height: 12px;
}

h1 {
  font-size: clamp(42px, 3.6vw, 54px);
  white-space: nowrap;
}
#game.pointer-focused:focus-visible {
  outline: none;
}
