:root {
  color-scheme: light;
  --paper: #e9e1d3;
  --board: #f1f2ff;
  --ink: #151d3b;
  --muted: #7c7972;
  --red: #d85242;
  --gold: #e1a33d;
  --green: #39766c;
  --phase-blue: #315ed3;
  --phase-amber: #cc7a1d;
  --phase-mint: #29936f;
  --phase-purple: #8b55bd;
  --phase-rose: #d44f7b;
  --phase-cyan: #268aa3;
  --game-font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --game-display-font: "Arial Black", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.72), transparent 38rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--game-font);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

.game-shell {
  width: min(100%, 540px);
  padding: 20px 16px 16px;
}

.screen[hidden] {
  display: none !important;
}

.home-screen {
  position: relative;
  display: flex;
  min-height: min(820px, calc(100vh - 36px));
  overflow: hidden;
  flex-direction: column;
  padding: 20px 20px 14px;
  border: 1px solid rgba(34, 45, 48, 0.1);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 10%, rgba(49, 94, 211, 0.14), transparent 25%),
    radial-gradient(circle at 90% 52%, rgba(212, 79, 123, 0.11), transparent 27%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 42%),
    var(--board);
  box-shadow: 0 24px 70px rgba(40, 39, 64, 0.14);
}

.home-screen::before,
.home-screen::after {
  position: absolute;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(49, 94, 211, 0.1);
  content: "";
  transform: rotate(45deg);
}

.home-screen::before {
  top: -82px;
  left: -46px;
}

.home-screen::after {
  right: -76px;
  bottom: -52px;
  border-color: rgba(204, 122, 29, 0.13);
}

.home-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.home-brand > span:last-child {
  display: grid;
  line-height: 1;
}

.home-brand strong {
  font-size: 14px;
  letter-spacing: 0.12em;
}

.home-brand small {
  margin-top: 5px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.home-brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(21, 29, 59, 0.13);
  border-radius: 11px;
  background: var(--ink);
  box-shadow: 0 7px 18px rgba(21, 29, 59, 0.18);
}

.home-brand-mark i {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  background: white;
}

.home-brand-mark i::after {
  position: absolute;
  top: -2px;
  right: -1px;
  width: 5px;
  height: 5px;
  border-top: 2px solid white;
  border-right: 2px solid white;
  content: "";
  transform: rotate(45deg);
}

.home-brand-mark i:nth-child(1) {
  top: 11px;
  left: 8px;
  width: 20px;
}

.home-brand-mark i:nth-child(2) {
  top: 19px;
  left: 12px;
  width: 15px;
  background: #79d0bb;
}

.home-brand-mark i:nth-child(2)::after {
  border-color: #79d0bb;
}

.home-brand-mark i:nth-child(3) {
  top: 27px;
  left: 8px;
  width: 21px;
  background: #efa3b8;
}

.home-brand-mark i:nth-child(3)::after {
  border-color: #efa3b8;
}

.home-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(34, 45, 48, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
  cursor: pointer;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button.muted {
  color: var(--muted);
}

.icon-button.muted::after {
  position: absolute;
  width: 21px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
  content: "";
  transform: rotate(-45deg);
}

.energy-pill {
  display: flex;
  min-width: 86px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(34, 45, 48, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
}

.energy-pill strong {
  color: var(--phase-amber);
  font-size: 14px;
}

.energy-pill small {
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 10px;
}

.pk-trial .game-energy {
  display: none;
}

.energy-ad-button[hidden] {
  display: none;
}

.home-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  padding: 28px 0 0;
  text-align: left;
}

.home-heading {
  padding-inline: 3px;
}

.home-heading .eyebrow {
  margin-bottom: 7px;
}

.home-heading h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 39px);
  letter-spacing: 0.08em;
}

.home-subtitle {
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.home-mode-grid {
  display: grid;
  width: 100%;
  gap: 11px;
}

.home-mode-grid[hidden],
.home-dock[hidden],
.internal-home-action[hidden],
.pk-lobby-panel[hidden],
.pk-lobby-choice[hidden],
.pk-join-view[hidden],
.pk-ranked-view[hidden],
.pk-leaderboard-view[hidden],
.pk-room-view[hidden],
.rules-panel[hidden],
.ranking-panel[hidden],
.milestone-panel[hidden],
.milestone-challenge[hidden],
.milestone-hint[hidden],
.tutorial-overlay[hidden],
.result-record[hidden],
.settings-panel[hidden] {
  display: none;
}

.pk-lobby-panel {
  position: absolute;
  z-index: 34;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.56), transparent 32%),
    linear-gradient(rgba(200, 240, 238, 0.94), rgba(200, 240, 238, 0.98));
}

.pk-lobby-card {
  width: min(100%, 410px);
  padding: 21px 20px 20px;
  border: 4px solid #fff9e9;
  border-radius: 25px;
  background: rgba(255, 250, 226, 0.98);
  box-shadow:
    0 0 0 3px #2a6871,
    0 9px 0 #3c9295,
    0 20px 34px rgba(30, 86, 91, 0.22);
  color: #28555d;
  animation: settings-rise 260ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pk-lobby-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 17px;
}

.pk-lobby-card > header p {
  margin: 0 0 4px;
  color: #dc4f79;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.pk-lobby-card h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 white;
}

.pk-lobby-choice {
  display: grid;
  gap: 10px;
}

.pk-mode-option {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border: 3px solid #fff9e9;
  border-radius: 16px;
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
  box-shadow:
    0 0 0 2px #265a8a,
    0 5px 0 #245f9d;
  color: white;
  cursor: pointer;
  text-align: center;
}

.pk-mode-option:active {
  transform: translateY(2px);
}

.pk-mode-option > span {
  display: grid;
  align-items: baseline;
  grid-template-columns: 82px 1fr;
  gap: 9px;
  width: min(100%, 226px);
  text-align: left;
}

.pk-mode-option b {
  font-size: 19px;
  font-weight: 1000;
  letter-spacing: 0.07em;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(30, 74, 126, 0.55);
}

.pk-mode-option small {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pk-option-create {
  background: linear-gradient(180deg, #58c999, #2d9f78);
  box-shadow: 0 0 0 2px #28745f, 0 5px 0 #2b7d66;
}

.pk-option-ranked {
  background: linear-gradient(180deg, #9973e7, #7551c5);
  box-shadow: 0 0 0 2px #5e438f, 0 5px 0 #62469f;
}

.pk-option-join {
  background: linear-gradient(180deg, #f0b45b, #d78a35);
  box-shadow: 0 0 0 2px #9b6429, 0 5px 0 #b06e2c;
}

.pk-rank-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 12px;
  border: 2px solid rgba(113, 82, 178, 0.22);
  border-radius: 13px;
  background: rgba(143, 108, 210, 0.08);
  color: #5c477e;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  text-align: left;
}

.pk-rank-strip span {
  white-space: nowrap;
}

.pk-rank-strip strong {
  margin-left: 3px;
  color: #7c59c4;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 16px;
}

.pk-rank-strip small {
  overflow: hidden;
  color: #806e93;
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-rank-strip > b {
  color: #7c59c4;
  white-space: nowrap;
}

.pk-join-view {
  display: grid;
  justify-items: center;
  padding: 23px 15px 8px;
}

.pk-join-view > strong {
  font-size: 19px;
  font-weight: 1000;
}

.pk-join-view > span {
  margin: 5px 0 18px;
  color: rgba(100, 128, 135, 0.72);
  font-size: 11px;
  font-weight: 800;
}

.pk-join-view input {
  width: min(100%, 218px);
  height: 49px;
  padding: 0 17px;
  border: 2px solid rgba(42, 104, 113, 0.14);
  border-radius: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.78);
  color: #28555d;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.28em;
  text-align: center;
}

.pk-join-view input::placeholder {
  color: rgba(55, 76, 81, 0.2);
}

.pk-join-view input:focus {
  border-color: #3d91d9;
  box-shadow: 0 0 0 3px rgba(61, 145, 217, 0.14);
}

.pk-join-confirm {
  width: min(100%, 230px);
  margin-top: 17px;
  padding: 12px 18px;
  border: 3px solid #fff9e9;
  border-radius: 14px;
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
  box-shadow: 0 0 0 2px #265a8a, 0 5px 0 #245f9d;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 1000;
}

.pk-join-back {
  margin-top: 17px;
  border: 0;
  background: transparent;
  color: #789199;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-decoration: underline;
}

.pk-ranked-view {
  display: grid;
  justify-items: center;
  padding: 9px 12px 4px;
  text-align: center;
}

.pk-ranked-emblem {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  margin: 3px 0 24px;
  place-items: center;
  border: 5px solid #fff9e9;
  border-radius: 50%;
  background: linear-gradient(145deg, #a987ef, #6e48ba);
  box-shadow:
    0 0 0 3px #5c3c94,
    0 7px 0 #4d347e,
    0 15px 24px rgba(88, 56, 143, 0.22);
  color: white;
}

.pk-ranked-emblem::before,
.pk-ranked-emblem::after {
  position: absolute;
  z-index: -1;
  bottom: -17px;
  width: 28px;
  height: 34px;
  background: #e7bd53;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 50% 78%, 18% 100%);
  content: "";
}

.pk-ranked-emblem::before {
  left: 13px;
  transform: rotate(10deg);
}

.pk-ranked-emblem::after {
  right: 13px;
  transform: rotate(-10deg);
}

.pk-ranked-emblem i {
  display: none;
}

.pk-ranked-emblem strong {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 44px;
  font-weight: 1000;
  text-shadow: 0 4px 0 #51347f;
}

.pk-ranked-view.quick .pk-ranked-emblem {
  width: 158px;
  height: 78px;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  padding: 0 12px;
  border-radius: 23px;
  background: linear-gradient(145deg, #ff7d76, #e74b69);
  box-shadow:
    0 0 0 3px #a93d55,
    0 7px 0 #8e3348,
    0 15px 24px rgba(212, 62, 91, 0.22);
}

.pk-ranked-view.quick .pk-ranked-emblem::before,
.pk-ranked-view.quick .pk-ranked-emblem::after {
  display: none;
}

.pk-ranked-view.quick .pk-ranked-emblem i {
  position: relative;
  display: block;
  width: 45px;
  height: 45px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: #35b9ad;
  box-shadow: 0 3px 0 rgba(95, 35, 52, 0.36);
}

.pk-ranked-view.quick .pk-ranked-emblem i:last-child {
  background: #4c91dd;
}

.pk-ranked-view.quick .pk-ranked-emblem i::before,
.pk-ranked-view.quick .pk-ranked-emblem i::after {
  position: absolute;
  left: 50%;
  background: white;
  content: "";
  transform: translateX(-50%);
}

.pk-ranked-view.quick .pk-ranked-emblem i::before {
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.pk-ranked-view.quick .pk-ranked-emblem i::after {
  bottom: 7px;
  width: 24px;
  height: 12px;
  border-radius: 13px 13px 7px 7px;
}

.pk-ranked-view.quick .pk-ranked-emblem strong {
  font-size: 23px;
  letter-spacing: -0.06em;
  text-shadow: 0 4px 0 #9c344b;
}

.pk-ranked-view.quick .pk-ranked-pulse i {
  background: #eb5a73;
}

.pk-match-wait-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.pk-match-wait-heading strong {
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.08em;
}

.pk-match-wait-heading time {
  min-width: 43px;
  padding: 3px 7px;
  border: 1px solid rgba(99, 70, 155, 0.16);
  border-radius: 999px;
  background: rgba(140, 103, 209, 0.1);
  color: #7759ad;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 11px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.pk-ranked-view.quick .pk-match-wait-heading time {
  border-color: rgba(180, 61, 87, 0.16);
  background: rgba(235, 90, 115, 0.1);
  color: #b43d57;
}

.pk-ranked-view > span {
  margin-top: 5px;
  color: #6f6280;
  font-size: 12px;
  font-weight: 800;
}

.pk-ranked-pulse {
  display: flex;
  gap: 8px;
  margin: 20px 0 15px;
}

.pk-ranked-pulse i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8c67d1;
  animation: pk-ranked-dot 1050ms linear infinite both;
  will-change: opacity, transform;
}

.pk-ranked-pulse i:nth-child(2) {
  animation-delay: -700ms;
}

.pk-ranked-pulse i:nth-child(3) {
  animation-delay: -350ms;
}

.pk-ranked-view p {
  margin: 0 0 18px;
  color: #9a7a48;
  font-size: 11px;
  font-weight: 900;
}

.pk-ranked-view button {
  min-width: 145px;
  padding: 10px 18px;
  border: 2px solid rgba(42, 104, 113, 0.2);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  color: #59757b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.pk-leaderboard-view {
  display: grid;
  gap: 11px;
}

.pk-leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 2px solid rgba(113, 82, 178, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(165, 128, 226, 0.15), rgba(255, 255, 255, 0.48));
}

.pk-leaderboard-head span {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pk-leaderboard-head small {
  color: #786b86;
  font-size: 10px;
  font-weight: 900;
}

.pk-leaderboard-head strong {
  color: #7650bd;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 25px;
}

.pk-leaderboard-head b {
  color: #5c477e;
  font-size: 12px;
}

.pk-leaderboard-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 12px;
  background: rgba(42, 104, 113, 0.08);
}

.pk-leaderboard-tabs button {
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #72888d;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.pk-leaderboard-tabs button.active {
  background: #fffdf4;
  box-shadow: 0 2px 6px rgba(42, 104, 113, 0.14);
  color: #6d4db0;
}

.pk-leaderboard-list {
  display: grid;
  min-height: 222px;
  max-height: 262px;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
}

.pk-rank-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid rgba(42, 104, 113, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.54);
  color: #526f76;
}

.pk-rank-row.self {
  border-color: rgba(126, 86, 201, 0.38);
  background: rgba(143, 108, 210, 0.12);
  box-shadow: inset 3px 0 #8760ce;
}

.pk-rank-row > b {
  color: #9c792d;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 13px;
}

.pk-rank-row > span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-rank-row > strong {
  color: #7650bd;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 13px;
}

.pk-rank-empty {
  display: grid;
  min-height: 190px;
  place-items: center;
  color: #789199;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pk-lobby-status,
.pk-room-hint {
  min-height: 20px;
  margin: 0;
  color: #648087;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.pk-lobby-status {
  margin-top: 13px;
}

.pk-room-view {
  display: grid;
  justify-items: center;
}

.pk-room-code {
  display: grid;
  width: min(100%, 270px);
  min-height: 60px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 8px 12px;
  border: 2px solid rgba(42, 104, 113, 0.2);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 4px 0 rgba(42, 104, 113, 0.1);
  color: #28555d;
  cursor: pointer;
}

.pk-room-code span {
  color: #789199;
  font-size: 11px;
  font-weight: 900;
}

.pk-room-code strong {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: 0.14em;
  line-height: 1;
  text-shadow: 0 2px 0 white;
}

.pk-room-code i {
  display: grid;
  width: 3.6em;
  box-sizing: border-box;
  place-items: center;
  padding: 5px 0;
  border-radius: 8px;
  background: #3c97d8;
  color: white;
  font-size: 10px;
  font-style: normal;
  font-weight: 1000;
}

.pk-room-seats {
  display: grid;
  width: 100%;
  gap: 8px;
  margin-bottom: 15px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pk-room-seat {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 8px 10px;
  border: 2px dashed rgba(42, 104, 113, 0.18);
  border-radius: 13px;
  color: #789199;
}

.pk-room-seat.joined {
  border-style: solid;
  background: rgba(80, 188, 155, 0.09);
  color: #28555d;
}

.pk-room-seat i {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(42, 104, 113, 0.1);
  font-size: 12px;
  font-style: normal;
  font-weight: 1000;
}

.pk-room-seat.joined i {
  background: #49b78a;
  color: white;
  box-shadow: 0 3px 0 #2f7c67;
}

.pk-room-seat span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pk-room-seat strong {
  font-size: 12px;
}

.pk-room-seat small {
  color: inherit;
  font-size: 10px;
  font-weight: 800;
}

.pk-ready-button {
  min-width: 0;
  flex: 1;
  padding: 13px 20px;
  border: 4px solid #fff9e9;
  border-radius: 15px;
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
  box-shadow: 0 0 0 3px #265a8a, 0 6px 0 #245f9d;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 1000;
}

.pk-room-actions {
  display: flex;
  width: 100%;
  max-width: 340px;
  gap: 12px;
  margin-top: 13px;
}

.pk-start-button {
  min-width: 0;
  flex: 1;
  padding: 13px 20px;
  border: 4px solid #fff9e9;
  border-radius: 15px;
  background: linear-gradient(180deg, #f5bd55, #dd8d32);
  box-shadow: 0 0 0 3px #9b6429, 0 6px 0 #b06e2c;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 1000;
}

.pk-start-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.75);
  opacity: 0.52;
}

.pk-ready-button.ready {
  background: linear-gradient(180deg, #59c997, #2e9c78);
  box-shadow: 0 0 0 3px #28745f, 0 6px 0 #2b7d66;
}

.mode-card {
  position: relative;
  display: grid;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(21, 29, 59, 0.12);
  border-radius: 21px;
  box-shadow: 0 13px 32px rgba(21, 29, 59, 0.12);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.mode-card:active {
  transform: translateY(1px) scale(0.995);
}

.mode-card:focus-visible {
  outline: 3px solid rgba(49, 94, 211, 0.24);
  outline-offset: 2px;
}

.classic-mode-card {
  min-height: 354px;
  align-content: end;
  padding: 0 19px 18px;
  border-color: rgba(104, 130, 211, 0.32);
  background: #111a37;
  box-shadow: 0 18px 42px rgba(21, 29, 59, 0.22);
  color: white;
}

.pk-mode-card {
  min-height: 126px;
  align-content: center;
  padding: 17px 19px;
  background:
    radial-gradient(circle at 90% 25%, rgba(212, 79, 123, 0.16), transparent 35%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.9), rgba(251, 242, 246, 0.88));
}

.classic-card-visual {
  position: absolute;
  z-index: 0;
  inset: 0 0 112px;
  display: block;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(17, 26, 55, 0.04), rgba(17, 26, 55, 0.18)),
    radial-gradient(circle at 75% 28%, rgba(49, 94, 211, 0.18), transparent 40%);
}

.classic-card-visual::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 82px;
  background: linear-gradient(transparent, #111a37);
  content: "";
}

.classic-card-visual svg {
  width: 100%;
  height: 100%;
}

.lobby-dot-field {
  fill: rgba(255, 255, 255, 0.08);
}

.lobby-dot-field + .lobby-route {
  animation-delay: -1.8s;
}

.lobby-route {
  fill: none;
  marker-end: url("#homeArrow");
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-width: 4;
  animation: lobby-route-flow 5.4s linear infinite;
}

.lobby-route.route-thin {
  opacity: 0.62;
  stroke-width: 3;
}

.lobby-route.route-blue { stroke: #7397ff; }
.lobby-route.route-mint { stroke: #65c4a6; animation-delay: -4.1s; }
.lobby-route.route-rose { stroke: #eb7da0; animation-delay: -3.2s; }
.lobby-route.route-purple { stroke: #ad7be0; animation-delay: -2.4s; }
.lobby-route.route-amber { stroke: #e6a457; animation-delay: -1.1s; }
.lobby-route.route-cyan { stroke: #55b6ce; animation-delay: -4.7s; }

.lobby-route + .lobby-route {
  opacity: 0.92;
}

.lobby-scan {
  position: absolute;
  top: 0;
  bottom: 56px;
  left: -30%;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(151, 174, 255, 0.16), transparent);
  filter: blur(2px);
  transform: skewX(-13deg);
  animation: lobby-scan 4.8s ease-in-out infinite;
}

.classic-card-head {
  position: absolute;
  z-index: 2;
  top: 15px;
  right: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-badge {
  position: static;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(26, 39, 79, 0.92);
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.progress-count {
  color: rgba(255, 255, 255, 0.68);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 9px;
  font-weight: 800;
}

.mode-card-art {
  position: absolute;
  top: 12px;
  right: 13px;
  width: 48%;
  height: calc(100% - 24px);
}

.duel-card-art {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.duel-card-art i {
  position: relative;
  width: 42px;
  height: 76px;
  overflow: hidden;
  border: 2px solid rgba(49, 94, 211, 0.46);
  border-radius: 8px;
  background:
    radial-gradient(circle, rgba(49, 94, 211, 0.23) 1px, transparent 1.5px) 0 0 / 8px 8px,
    var(--board);
}

.duel-card-art i:last-child {
  border-color: rgba(212, 79, 123, 0.5);
  transform: scale(0.9) translateX(-2px);
}

.duel-card-art i b {
  position: absolute;
  width: 30px;
  height: 2px;
  background: var(--phase-blue);
  animation: duel-route-shift 2.6s ease-in-out infinite alternate;
}

.duel-card-art i:last-child b {
  background: var(--phase-rose);
  animation-delay: -1.2s;
}

.duel-card-art i b:nth-child(1) { top: 17px; left: 5px; }
.duel-card-art i b:nth-child(2) { top: 36px; left: 9px; width: 24px; }
.duel-card-art i b:nth-child(3) { top: 56px; left: 4px; width: 27px; }

.duel-card-art > strong {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 6px 15px rgba(21, 29, 59, 0.22);
  color: white;
  font-family: "Arial Black", sans-serif;
  font-size: 9px;
  font-style: italic;
  animation: duel-vs-pulse 2.4s ease-in-out infinite;
}

.mode-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: start;
}

.mode-copy small {
  margin-bottom: 3px;
  color: #8fb0ff;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.pk-mode-card .mode-copy small {
  color: var(--phase-rose);
}

.mode-copy strong {
  font-size: 27px;
  letter-spacing: 0.06em;
}

.mode-copy em {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.57);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.pk-mode-card .mode-copy {
  align-self: center;
}

.pk-mode-card .mode-copy strong {
  font-size: 21px;
}

.pk-mode-card .mode-copy em {
  color: var(--muted);
}

.mode-progress {
  position: relative;
  z-index: 2;
  height: 5px;
  overflow: hidden;
  margin: 12px 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.mode-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--phase-cyan), var(--phase-blue));
  transition: width 240ms ease-out;
}

.progress-scale {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  margin-bottom: 13px;
}

.progress-scale i {
  color: rgba(255, 255, 255, 0.4);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
}

.mode-action {
  position: relative;
  z-index: 2;
  justify-self: start;
  padding: 10px 16px;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.pk-mode-card .mode-action {
  align-self: end;
  margin-top: 11px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.pk-mode-card .mode-action b {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-left: 5px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 12px;
}

.internal-home-action {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.home-mark {
  width: min(70%, 270px);
  margin: 20px 0 14px;
  filter: drop-shadow(0 7px 14px rgba(49, 94, 211, 0.1));
}

.home-mark polyline,
.home-mark path {
  fill: none;
  stroke: var(--phase-blue);
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-width: 7;
}

.home-mark polyline:nth-of-type(2) {
  stroke: var(--phase-amber);
}

.home-mark polyline:nth-of-type(3) {
  stroke: var(--phase-mint);
}

.home-mark path {
  stroke: var(--ink);
  stroke-width: 4;
}

.home-level {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.primary-button {
  min-width: 210px;
  padding: 15px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 10px 26px rgba(21, 29, 59, 0.2);
  color: white;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.primary-button:active {
  transform: translateY(1px);
}

.home-notice {
  max-width: 280px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.home-dock {
  display: grid;
  width: min(250px, 72%);
  align-self: center;
  grid-template-columns: repeat(3, 1fr);
  margin-top: auto;
  padding-top: 14px;
}

.home-dock-item {
  display: grid;
  min-height: 48px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 3px 10px;
  border: 0;
  background: transparent;
  color: rgba(21, 29, 59, 0.45);
  cursor: pointer;
}

.home-dock-item.active {
  color: var(--ink);
}

.home-dock-item small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.home-dock-item > b {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.dock-home-icon::before {
  position: absolute;
  inset: 3px 3px 2px;
  border: 2px solid currentColor;
  border-radius: 3px;
  content: "";
  transform: rotate(45deg);
}

.dock-home-icon::after {
  position: absolute;
  right: 6px;
  bottom: 1px;
  left: 6px;
  height: 9px;
  border-radius: 2px 2px 0 0;
  background: var(--board);
  content: "";
}

.dock-rules-icon {
  display: grid !important;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 12px;
}

.dock-settings-icon {
  border: 2px dotted currentColor;
  border-radius: 50%;
}

.dock-settings-icon::before {
  position: absolute;
  inset: 5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.rules-panel,
.ranking-panel,
.milestone-panel,
.settings-panel {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(21, 29, 59, 0.35);
  cursor: pointer;
  backdrop-filter: blur(2px);
}

.settings-card,
.rules-card {
  position: relative;
  z-index: 1;
  overflow: auto;
  width: min(100%, 460px);
  max-height: min(88dvh, 650px);
  padding: 22px 22px 24px;
  border: 1px solid rgba(21, 29, 59, 0.1);
  border-radius: 24px;
  background: rgba(248, 248, 255, 0.98);
  box-shadow: 0 18px 50px rgba(21, 29, 59, 0.22);
  animation: settings-rise 260ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-card header,
.rules-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 15px;
}

.settings-card header p,
.rules-card header p {
  margin: 0 0 3px;
  color: var(--phase-blue);
  font-family: var(--game-display-font);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.settings-card h2,
.rules-card h2 {
  margin: 0;
  font-family: var(--game-display-font);
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: 0.06em;
}

.rule-guide-list {
  display: grid;
  gap: 0;
}

.rule-guide-list article {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: start;
  gap: 11px;
  padding: 13px 0;
  border-top: 1px solid rgba(21, 29, 59, 0.09);
}

.rule-guide-list article > b {
  color: var(--phase-blue);
  font-family: var(--game-display-font);
  font-size: 14px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.rule-guide-list article span {
  display: grid;
  gap: 4px;
}

.rule-guide-list article strong {
  font-family: var(--game-font);
  font-size: 14px;
  font-weight: 1000;
}

.rule-guide-list article small,
.duel-rule-note span {
  color: var(--muted);
  font-family: var(--game-font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.duel-rule-note {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding: 14px 15px;
  border: 1px solid rgba(212, 79, 123, 0.14);
  border-radius: 14px;
  background: rgba(212, 79, 123, 0.07);
}

.duel-rule-note strong {
  color: var(--phase-rose);
  font-family: var(--game-font);
  font-size: 14px;
  font-weight: 1000;
}

.settings-close-button {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(21, 29, 59, 0.12);
  border-radius: 50%;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 0;
  line-height: 0;
}

.settings-close-button::before,
.settings-close-button::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.settings-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.settings-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 0;
  border-top: 1px solid rgba(21, 29, 59, 0.09);
  text-align: left;
}

.setting-row span {
  min-width: 0;
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 14px;
  font-weight: 1000;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.setting-toggle {
  position: relative;
  width: 72px;
  height: 34px;
  flex: 0 0 72px;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(45, 89, 96, 0.16);
  border-radius: 999px;
  background: #aebcbb;
  box-shadow: inset 0 2px 4px rgba(34, 69, 74, 0.18);
  color: white;
  cursor: pointer;
  font-size: 0;
  font-weight: 900;
  transition: background 180ms ease;
}

.setting-toggle::before {
  position: absolute;
  top: 50%;
  right: 8px;
  content: "关闭";
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(34, 69, 74, 0.25);
  transform: translateY(-50%);
}

.setting-toggle::after {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(45, 89, 96, 0.1);
  border-radius: 50%;
  background: #fffdf2;
  box-shadow: 0 2px 5px rgba(34, 69, 74, 0.28);
  content: "";
  transition: transform 180ms ease;
}

.setting-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
}

.setting-toggle[aria-pressed="true"]::before {
  right: auto;
  left: 8px;
  content: "开启";
}

.setting-toggle[aria-pressed="true"]::after {
  transform: translateX(38px);
}

.settings-version {
  margin: 15px 0 0;
  color: rgba(124, 121, 114, 0.75);
  font-size: 10px;
  text-align: center;
}

.game-screen {
  width: 100%;
}

.topbar,
.status,
.guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.game-energy {
  color: var(--phase-amber);
  font-size: 11px;
}

.race-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 11px;
  padding: 8px;
  border: 2px solid rgba(34, 45, 48, 0.1);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.52);
  overflow: hidden;
}

.race-panel[hidden] {
  display: none;
}

.group-race-panel {
  position: relative;
  margin: 0 0 11px;
  padding: 8px 12px 10px;
  border: 2px solid rgba(143, 181, 255, 0.54);
  border-radius: 17px;
  background:
    radial-gradient(circle at 50% 0%, rgba(91, 128, 207, 0.18), transparent 56%),
    linear-gradient(180deg, rgba(22, 33, 67, 0.96), rgba(13, 21, 46, 0.93));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 5px 0 rgba(16, 23, 43, 0.35);
  color: white;
  overflow: hidden;
}

.group-race-panel[hidden] {
  display: none;
}

.group-race-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  padding: 0 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.group-race-panel > header strong {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.group-race-panel > header strong::before {
  content: none;
}

.group-race-panel > header span {
  color: rgba(255, 255, 255, 0.54);
  font-size: 9px;
  font-weight: 800;
}

.group-race-list {
  position: relative;
  display: grid;
  width: min(100%, var(--race-list-width, 444px));
  align-items: start;
  gap: 5px;
  margin-inline: auto;
  padding-top: 3px;
}

.group-race-list::before {
  content: none;
}

.group-racer {
  --racer-color: #46aef1;
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  min-height: 62px;
  justify-items: center;
  align-content: start;
  gap: 3px;
  padding: 5px 2px 2px;
}

.group-racer.self {
  z-index: 2;
  transform: translateY(-2px);
}

.group-racer-rank {
  position: absolute;
  z-index: 3;
  top: 0;
  left: calc(50% - 27px);
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: #43516e;
  color: white;
  font-family: "Arial Black", sans-serif;
  font-size: 9px;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(8, 14, 35, 0.36);
}

.group-racer.rank-1 .group-racer-rank {
  background: #f3b72f;
  color: #64420d;
}

.group-racer.rank-2 .group-racer-rank {
  background: #d6e0e9;
  color: #42536b;
}

.group-racer.rank-3 .group-racer-rank {
  background: #d98a54;
  color: #5e301b;
}

.group-racer-avatar {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.95) 0 16%, transparent 17%),
    radial-gradient(ellipse at 50% 83%, rgba(255, 255, 255, 0.9) 0 27%, transparent 28%),
    var(--racer-color);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 3px 0 rgba(8, 14, 35, 0.46);
}

.group-racer.self .group-racer-avatar {
  width: 42px;
  height: 42px;
  border-color: #ffe075;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.96),
    0 0 0 6px #f0b52e,
    0 4px 0 rgba(8, 14, 35, 0.46),
    0 0 18px rgba(255, 203, 66, 0.56);
}

.group-racer.finished .group-racer-avatar::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: #f2b536;
  color: #31415a;
  content: "✓";
  font-size: 9px;
  font-style: normal;
  font-weight: 1000;
}

.group-racer.out {
  opacity: 0.48;
  filter: grayscale(0.5);
}

.group-racer > em {
  display: block;
  width: 100%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-racer.self > em {
  color: #ffe784;
  font-size: 10px;
  text-shadow: 0 1px 5px rgba(255, 205, 64, 0.44);
}

.group-countdown {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(25, 35, 70, 0.16), rgba(15, 23, 48, 0.46)),
    rgba(20, 30, 57, 0.32);
  backdrop-filter: blur(3px) saturate(0.8);
  -webkit-backdrop-filter: blur(3px) saturate(0.8);
}

.group-countdown[hidden] {
  display: none;
}

.group-countdown > span {
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.72);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.24em;
  text-shadow: 0 2px 5px rgba(7, 12, 28, 0.7);
}

.group-countdown > strong {
  display: grid;
  min-width: 98px;
  min-height: 98px;
  place-items: center;
  padding: 0 12px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(255, 218, 84, 0.96), rgba(238, 146, 44, 0.96));
  box-shadow:
    0 0 0 5px rgba(31, 44, 83, 0.68),
    0 9px 0 rgba(111, 63, 15, 0.68),
    0 18px 38px rgba(7, 12, 28, 0.42);
  color: white;
  font-family: "Arial Black", "Microsoft YaHei", sans-serif;
  font-size: 61px;
  font-weight: 1000;
  line-height: 1;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(126, 68, 19, 0.44);
  -webkit-text-stroke: 2px rgba(112, 59, 16, 0.2);
}

.group-countdown.tick > strong {
  animation: group-countdown-pop 520ms both cubic-bezier(0.16, 0.86, 0.24, 1.18);
}

.race-side {
  --race-accent: #3e8df3;
  position: relative;
  min-width: 0;
  flex: 1;
  padding: 7px 9px 8px;
  border: 1px solid color-mix(in srgb, var(--race-accent) 55%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--race-accent) 13%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.race-player {
  --race-accent: #42b8ff;
}

.race-opponent {
  --race-accent: #ff637e;
}

.race-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 900;
}

.race-label span {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.race-label em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-side-mark {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: var(--race-accent);
  box-shadow: 0 2px 0 rgba(15, 22, 44, 0.32);
  color: white;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

.race-opponent .race-label {
  flex-direction: row-reverse;
}

.race-opponent .race-label span {
  flex-direction: row-reverse;
}

.race-label strong {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 15px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.race-meter {
  position: relative;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(21, 29, 59, 0.1);
  box-shadow: inset 0 2px 3px rgba(12, 20, 45, 0.25);
}

.race-meter::after {
  position: absolute;
  inset: 1px 3px auto;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.27);
  content: "";
}

.race-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  box-shadow: 0 0 10px color-mix(in srgb, var(--race-accent) 70%, transparent);
  transition: width 180ms ease-out;
}

.race-player .race-meter i {
  background: linear-gradient(90deg, #25d0ff, #3674ef);
}

.race-opponent .race-meter i {
  margin-left: auto;
  background: linear-gradient(90deg, #efbc3e, #ff496d);
}

.race-vs {
  position: relative;
  z-index: 2;
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-content: center;
  border: 3px solid #ffe49a;
  border-radius: 50%;
  background: linear-gradient(145deg, #243050, #10172e);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.11),
    0 5px 0 rgba(12, 18, 38, 0.45),
    0 0 18px rgba(255, 188, 59, 0.25);
  color: white;
  font-family: "Microsoft YaHei", sans-serif;
  line-height: 1;
  text-align: center;
  transform: rotate(-4deg);
}

.race-vs small,
.race-vs i {
  display: block;
  color: #ffe49a;
  font-size: 7px;
  font-style: normal;
  font-weight: 1000;
  letter-spacing: 0.12em;
}

.race-vs b {
  display: block;
  margin: 1px 0;
  font-size: 20px;
  font-weight: 1000;
  letter-spacing: -0.08em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.race-side.race-hit {
  animation: race-hit 260ms ease-out;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

h1 {
  margin: 0;
  font-size: clamp(25px, 7vw, 32px);
  letter-spacing: 0.08em;
}

.quiet-button,
.text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.quiet-button {
  padding: 8px 10px;
  border: 1px solid rgba(34, 45, 48, 0.15);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.status {
  gap: 10px;
  margin-bottom: 9px;
}

.status-block,
.phase-block {
  min-width: 0;
}

.status span {
  display: block;
  margin-bottom: 1px;
  color: var(--muted);
  font-family: var(--game-font);
  font-size: 11px;
  font-weight: 800;
}

.status-block strong {
  font-family: var(--game-display-font);
  font-size: 20px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.status-right {
  text-align: right;
}

.phase-block {
  flex: 1;
  padding: 5px 12px;
  border-right: 1px solid rgba(34, 45, 48, 0.13);
  border-left: 1px solid rgba(34, 45, 48, 0.13);
  text-align: center;
}

.phase-block strong {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink);
  font-family: var(--game-font);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.phase-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.phase-dot + .phase-dot {
  margin-left: -4px;
}

.phase-blue {
  background: var(--phase-blue);
  color: var(--phase-blue);
}

.phase-amber {
  background: var(--phase-amber);
  color: var(--phase-amber);
}

.phase-mint {
  background: var(--phase-mint);
  color: var(--phase-mint);
}

.phase-purple {
  background: var(--phase-purple);
  color: var(--phase-purple);
}

.phase-rose {
  background: var(--phase-rose);
  color: var(--phase-rose);
}

.phase-cyan {
  background: var(--phase-cyan);
  color: var(--phase-cyan);
}

.hearts {
  display: inline-flex;
  gap: 4px;
  color: var(--red);
}

.hearts.heart-hit {
  animation: heart-hit 360ms ease-out;
}

.hearts b,
.hearts i {
  display: inline-block;
  font-family: Arial, "Segoe UI Symbol", sans-serif;
  font-style: normal;
  line-height: 1;
  transform: scaleX(1.18);
}

.hearts i {
  color: rgba(216, 82, 66, 0.2);
}

.board-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid rgba(34, 45, 48, 0.11);
  border-radius: 17px;
  background: var(--board);
  box-shadow: 0 16px 45px rgba(56, 48, 38, 0.07);
}

.board-wrap.success-pulse {
  animation: board-success 320ms ease-out;
}

.game-screen.finish-pulse .board-wrap {
  animation: board-finish 400ms ease-out;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 19 / 28;
  touch-action: none;
  cursor: pointer;
}

.race-intro {
  position: absolute;
  z-index: 6;
  inset: 0;
}

.race-intro[hidden] {
  display: none;
}

.race-intro {
  display: grid;
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: center;
  padding: 6% 4.5%;
  background:
    linear-gradient(135deg, rgba(49, 94, 211, 0.06), transparent 34%),
    linear-gradient(315deg, rgba(212, 79, 123, 0.07), transparent 34%),
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.98), rgba(241, 242, 255, 0.96) 48%, rgba(228, 232, 252, 0.98));
  text-align: center;
}

.race-intro-kicker,
.race-intro-rule {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.race-intro-kicker {
  color: var(--phase-blue);
  font-family: ui-monospace, "Cascadia Mono", monospace;
}

.race-intro-title {
  position: relative;
  z-index: 2;
  margin: 5px 0 0;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Arial Black", sans-serif;
  font-size: clamp(27px, 7vw, 40px);
  font-weight: 1000;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 0 5px 18px rgba(49, 94, 211, 0.15);
}

.race-intro-rule {
  color: var(--ink);
  font-family: "Microsoft YaHei UI", sans-serif;
}

.race-intro-stage {
  position: relative;
  width: 100%;
  height: min(65vh, 520px);
  margin: 10px 0 8px;
}

.race-map-card {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 43%;
  overflow: hidden;
  border: 2px solid rgba(21, 29, 59, 0.14);
  border-radius: 15px;
  background: rgba(241, 242, 255, 0.95);
  box-shadow: 0 15px 38px rgba(21, 29, 59, 0.18);
  transform: translateY(-50%);
}

.race-map-card::after {
  position: absolute;
  z-index: 2;
  top: -15%;
  bottom: -15%;
  left: -52%;
  width: 24%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.86), transparent);
  content: "";
  pointer-events: none;
  transform: skewX(-18deg);
}

.race-map-card canvas {
  width: 100%;
  aspect-ratio: 19 / 28;
  cursor: default;
  touch-action: auto;
}

.race-map-card span {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  padding: 9px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.97));
  color: var(--ink);
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.08em;
}

.race-map-player {
  z-index: 2;
  left: 1%;
  border-color: rgba(49, 94, 211, 0.42);
  box-shadow: 0 15px 38px rgba(49, 94, 211, 0.19);
}

.race-map-rival {
  right: 1%;
  border-color: rgba(212, 79, 123, 0.42);
  box-shadow: 0 15px 38px rgba(212, 79, 123, 0.18);
}

.race-intro-vs {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: linear-gradient(145deg, #24376d, var(--ink) 62%);
  box-shadow: 0 0 0 7px rgba(21, 29, 59, 0.08), 0 9px 24px rgba(21, 29, 59, 0.27);
  color: white;
  font-family: "Arial Black", ui-monospace, monospace;
  font-size: 18px;
  font-style: italic;
  letter-spacing: -0.06em;
  transform: translate(-50%, -50%);
}

.race-intro.playing {
  animation: race-intro-shell 3.9s both ease-out;
}

.race-intro.playing .race-intro-kicker {
  animation: race-intro-copy 3.9s both;
}

.race-intro.playing .race-intro-title {
  animation: race-intro-copy 3.9s both;
}

.race-intro.playing .race-intro-rule {
  animation: race-intro-rule 3.9s both;
}

.race-intro.playing .race-map-player {
  animation: race-player-map 3.9s both cubic-bezier(0.22, 0.72, 0.16, 1);
}

.race-intro.playing .race-map-rival {
  animation: race-rival-map 3.9s both cubic-bezier(0.22, 0.72, 0.16, 1);
}

.race-intro.playing .race-map-card::after {
  animation: race-map-scan 3.9s both ease-in-out;
}

.race-intro.playing .race-map-card span {
  animation: race-map-label 3.9s both ease-out;
}

.race-intro.playing .race-intro-vs {
  animation: race-vs-slam 3.9s both cubic-bezier(0.22, 0.72, 0.16, 1);
}

.board-wrap.race-intro-active > #gameCanvas {
  animation: race-board-reveal 3.9s both ease-out;
}

#remaining.count-change {
  animation: count-change 260ms ease-out;
}

.result-panel {
  position: absolute;
  z-index: 5;
  inset: 0;
  place-content: center;
  padding: 30px;
  background: rgba(241, 242, 255, 0.93);
  text-align: center;
  backdrop-filter: blur(8px);
}

.result-panel:not([hidden]) {
  display: grid;
  animation: fade-in 240ms ease-out;
}

.result-panel:not([hidden]) > p,
.result-panel:not([hidden]) > h2,
.result-panel:not([hidden]) > .result-score,
.result-panel:not([hidden]) > .result-record,
.result-panel:not([hidden]) > .race-result-summary,
.result-panel:not([hidden]) > .result-actions {
  animation: result-rise 360ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.result-panel:not([hidden]) > h2 { animation-delay: 35ms; }
.result-panel:not([hidden]) > .result-score { animation-delay: 70ms; }
.result-panel:not([hidden]) > .result-record { animation-delay: 90ms; }
.result-panel:not([hidden]) > .race-result-summary { animation-delay: 35ms; }
.result-panel:not([hidden]) > .result-actions { animation-delay: 105ms; }

.result-panel p {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.result-panel h2 {
  margin: 0 0 22px;
  font-size: 31px;
}

.result-score span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.result-score strong {
  display: block;
  margin: 3px 0 22px;
  color: var(--red);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 32px;
  letter-spacing: 0.08em;
}

.result-panel.race-result-mode {
  align-content: center;
  grid-template-columns: minmax(0, 1fr);
  background-color: #c8f0ee;
  background-image:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.5), transparent 25%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 7 47 24h-9v18H26V24h-9Z' fill='%23168d98' fill-opacity='.075'/%3E%3C/svg%3E");
  background-size: auto, 64px 64px;
  color: #28555d;
  backdrop-filter: none;
}

.result-panel.race-result-mode.loss {
  background-color: #d6efea;
  background-image:
    radial-gradient(circle at 82% 19%, rgba(255, 221, 184, 0.46), transparent 27%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 7 47 24h-9v18H26V24h-9Z' fill='%23168d98' fill-opacity='.07'/%3E%3C/svg%3E");
  background-size: auto, 64px 64px;
}

.result-panel.race-result-mode > #resultKicker,
.result-panel.race-result-mode > #resultTitle,
.result-panel.race-result-mode > .result-score {
  display: none;
}

.race-result-summary {
  display: grid;
  box-sizing: border-box;
  justify-items: center;
  width: 100%;
  max-width: 380px;
  margin: 0 auto 34px;
  padding: 25px 22px 24px;
  border: 4px solid #fff9e9;
  border-radius: 23px;
  background: rgba(255, 250, 226, 0.96);
  box-shadow:
    0 0 0 3px #2a6871,
    0 9px 0 #3c9295,
    0 16px 24px rgba(30, 86, 91, 0.22);
}

.race-result-summary[hidden] {
  display: none;
}

.race-result-glyph {
  position: relative;
  display: grid;
  width: 142px;
  height: 128px;
  place-items: center;
  color: #40b982;
  filter:
    drop-shadow(0 3px 0 #fff9e9)
    drop-shadow(1px 9px 0 #236a70)
    drop-shadow(0 15px 11px rgba(38, 107, 108, 0.2));
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 90px;
  font-weight: 1000;
  letter-spacing: -0.04em;
  line-height: 1;
  paint-order: stroke fill;
  transform: rotate(-2deg) scaleX(1.1);
  -webkit-text-stroke: 8px #fff9e9;
}

.race-result-glyph::before,
.race-result-glyph::after {
  position: absolute;
  color: #f3b92f;
  content: "✦";
  filter: drop-shadow(0 2px 0 rgba(169, 101, 22, 0.22));
  font-size: 29px;
  -webkit-text-stroke: 0;
}

.race-result-glyph::before {
  top: 19px;
  right: 111%;
  transform: rotate(-12deg);
}

.race-result-glyph::after {
  right: -37px;
  bottom: 18px;
  font-size: 21px;
  transform: rotate(16deg);
}

.race-result-mode.loss .race-result-glyph {
  color: #ef6858;
  filter:
    drop-shadow(0 3px 0 #fff9e9)
    drop-shadow(1px 9px 0 #a64d48)
    drop-shadow(0 15px 11px rgba(145, 66, 61, 0.2));
  transform: rotate(2deg) scaleX(1.1);
}

.race-result-mode.loss .race-result-glyph::before,
.race-result-mode.loss .race-result-glyph::after {
  color: #ef9c49;
}

.race-result-glyph.rank-result {
  width: 180px;
  font-size: 68px;
  letter-spacing: -0.1em;
  transform: rotate(-2deg) scaleX(1.04);
}

.race-result-stats {
  display: grid;
  width: 100%;
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 2px solid rgba(42, 104, 113, 0.23);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.72);
}

.race-result-stats div {
  min-width: 0;
  padding: 13px 7px 14px;
}

.race-result-stats div + div {
  border-left: 2px solid rgba(42, 104, 113, 0.14);
}

.race-result-stats span {
  display: block;
  margin-bottom: 6px;
  color: #648087;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.race-result-stats strong {
  display: block;
  overflow: hidden;
  color: #2e7e91;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranked-result {
  display: grid;
  width: 100%;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 13px;
  border: 2px solid rgba(118, 80, 189, 0.22);
  border-radius: 13px;
  background: rgba(145, 108, 215, 0.1);
  color: #645078;
}

.ranked-result[hidden] {
  display: none;
}

.ranked-result > span {
  font-size: 10px;
  font-weight: 900;
}

.ranked-result > strong {
  color: #7650bd;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 18px;
}

.ranked-result.win > strong {
  color: #249b70;
}

.ranked-result.loss > strong {
  color: #df5c67;
}

.ranked-result > small {
  color: #776d80;
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.result-panel.race-result-mode button {
  min-width: 186px;
  padding: 12px 24px;
  border: 4px solid #fff9e9;
  border-radius: 15px;
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
  box-shadow:
    0 0 0 3px #265a8a,
    0 7px 0 #245f9d,
    0 12px 14px rgba(31, 92, 121, 0.22);
  color: white;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(30, 74, 126, 0.55);
}

.result-panel.race-result-mode .result-home-button {
  min-width: 112px;
  padding: 8px 15px;
  border: 3px solid #fff9e9;
  border-radius: 12px;
  background: #f3c75b;
  box-shadow:
    0 0 0 2px #a66d25,
    0 4px 0 #bd7c2b;
  color: #6b481e;
  font-size: 11px;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.result-panel.race-result-mode .result-actions {
  gap: 21px;
}

.result-panel button {
  justify-self: center;
  min-width: 150px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.result-actions {
  display: grid;
  justify-items: center;
  gap: 9px;
}

.result-panel .secondary-button {
  border: 1px solid rgba(21, 29, 59, 0.18);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.result-panel .result-home-button {
  min-width: auto;
  padding: 7px 16px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.guide {
  gap: 10px;
  padding: 12px 3px 0;
}

.guide p {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.guide p.error {
  color: var(--red);
}

.guide p.success {
  color: var(--green);
}

.signal-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(57, 118, 108, 0.1);
}

.error .signal-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(216, 82, 66, 0.12);
}

.text-button {
  flex: 0 0 auto;
  padding: 7px 0 7px 10px;
  color: var(--ink);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes lobby-route-flow {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); opacity: 0.78; }
  48% { filter: drop-shadow(0 0 5px currentColor); opacity: 1; }
}

@keyframes lobby-scan {
  0%, 12% { left: -30%; opacity: 0; }
  22% { opacity: 1; }
  60%, 100% { left: 112%; opacity: 0; }
}

@keyframes duel-route-shift {
  from { transform: translateX(-2px); }
  to { transform: translateX(3px); }
}

@keyframes duel-vs-pulse {
  0%, 100% { transform: scale(0.94); }
  50% { transform: scale(1.06); }
}

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

@keyframes settings-rise {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes board-success {
  0% { border-color: rgba(34, 45, 48, 0.11); }
  35% { border-color: rgba(57, 118, 108, 0.42); box-shadow: 0 16px 45px rgba(56, 48, 38, 0.07), 0 0 0 3px rgba(57, 118, 108, 0.08); }
  100% { border-color: rgba(34, 45, 48, 0.11); }
}

@keyframes board-finish {
  0% { transform: scale(1); }
  40% { transform: scale(0.994); box-shadow: 0 18px 52px rgba(49, 94, 211, 0.15); }
  100% { transform: scale(1); }
}

@keyframes count-change {
  0% { transform: scale(1); color: var(--ink); }
  42% { transform: scale(1.2); color: var(--green); }
  100% { transform: scale(1); color: var(--ink); }
}

@keyframes result-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heart-hit {
  0% { transform: translateX(0) scale(1); }
  20% { transform: translateX(-3px) scale(1.16); }
  42% { transform: translateX(3px) scale(0.94); }
  66% { transform: translateX(-2px) scale(1.06); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes race-hit {
  0% { transform: translateX(0) scale(1); filter: brightness(1); }
  35% { transform: translateX(-2px) scale(1.035); filter: brightness(1.3) saturate(1.2); }
  70% { transform: translateX(2px) scale(1.015); }
  100% { transform: translateX(0) scale(1); filter: brightness(1); }
}

@keyframes race-intro-shell {
  0%, 91% { opacity: 1; }
  97% { opacity: 0.22; }
  100% { opacity: 0; }
}

@keyframes race-intro-copy {
  0% { opacity: 0; transform: translateY(-8px); }
  8%, 36% { opacity: 1; transform: translateY(0); }
  54%, 100% { opacity: 0; transform: translateY(-7px); }
}

@keyframes race-intro-rule {
  0%, 16% { opacity: 0; transform: translateY(7px); }
  24%, 39% { opacity: 1; transform: translateY(0); }
  55%, 100% { opacity: 0; transform: translateY(5px); }
}

@keyframes race-player-map {
  0% {
    left: -48%;
    width: 43%;
    opacity: 0;
    border-color: rgba(49, 94, 211, 0.42);
    border-radius: 15px;
    transform: translateY(-50%);
  }
  12%, 36% {
    left: 1%;
    width: 43%;
    opacity: 1;
    border-color: rgba(49, 94, 211, 0.42);
    border-radius: 15px;
    transform: translateY(-50%);
  }
  82%, 92% {
    left: -4.95%;
    width: 109.9%;
    opacity: 1;
    border-color: rgba(49, 94, 211, 0.1);
    border-radius: 17px;
    transform: translateY(-50%);
  }
  97%, 100% {
    left: -4.95%;
    width: 109.9%;
    opacity: 0;
    border-color: transparent;
    border-radius: 17px;
    transform: translateY(-50%);
  }
}

@keyframes race-rival-map {
  0% { right: -48%; opacity: 0; transform: translateY(-50%); }
  12%, 36% { right: 1%; opacity: 1; transform: translateY(-50%); }
  72% { right: -18%; opacity: 0.34; transform: translateY(-50%) scale(0.48); }
  84%, 100% { right: -28%; opacity: 0; transform: translateY(-50%) scale(0.22); }
}

@keyframes race-map-scan {
  0%, 15% { left: -52%; opacity: 0; }
  22% { opacity: 0.72; }
  36% { left: 128%; opacity: 0; }
  100% { left: 128%; opacity: 0; }
}

@keyframes race-map-label {
  0%, 39% { opacity: 1; }
  57%, 100% { opacity: 0; }
}

@keyframes race-vs-slam {
  0%, 10% { left: 50%; opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
  16%, 36% { left: 50%; opacity: 1; transform: translate(-50%, -50%) scale(1); }
  66% { left: 84%; opacity: 0.38; transform: translate(-50%, -50%) scale(0.62); }
  79%, 100% { left: 96%; opacity: 0; transform: translate(-50%, -50%) scale(0.34); }
}

@keyframes race-board-reveal {
  0%, 93% { opacity: 0; }
  98%, 100% { opacity: 1; }
}

@media (max-width: 420px) {
  .game-shell {
    padding: 13px 10px 10px;
  }

  .home-screen {
    min-height: calc(100vh - 23px);
    padding: 16px 16px 10px;
    border-radius: 19px;
  }

  .home-hero {
    padding: 21px 0 0;
  }

  .home-subtitle {
    margin: 5px 0 14px;
  }

  .home-mode-grid {
    gap: 10px;
  }

  .mode-card {
    border-radius: 17px;
  }

  .classic-mode-card {
    min-height: 326px;
    padding: 0 16px 16px;
  }

  .pk-mode-card {
    min-height: 116px;
    padding: 14px 16px;
  }

  .mode-card-art {
    top: 9px;
    right: 8px;
    height: calc(100% - 18px);
  }

  .mode-copy strong {
    font-size: 25px;
  }

  .pk-mode-card .mode-copy strong {
    font-size: 19px;
  }

  .home-dock {
    padding-top: 8px;
  }

  .settings-card,
  .rules-card {
    padding: 20px 18px 21px;
  }

  .topbar {
    margin-bottom: 9px;
  }

  .top-actions {
    gap: 2px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .quiet-button {
    min-height: 40px;
    padding-inline: 8px;
  }

  .board-wrap {
    width: min(100%, 50dvh);
    margin-inline: auto;
    border-radius: 14px;
  }

  .race-intro {
    padding: 5% 3.5%;
  }

  .race-intro-title {
    font-size: 26px;
  }

  .race-intro-stage {
    height: min(61vh, 380px);
    margin-block: 6px;
  }

  .race-map-card {
    width: 43.5%;
    border-radius: 11px;
  }

  .race-map-card span {
    padding-block: 7px;
    font-size: 9px;
  }

  .race-intro-vs {
    width: 46px;
    height: 46px;
    font-size: 16px;
  }

  .result-panel.race-result-mode {
    padding: 20px 18px;
  }

  .race-result-summary {
    width: 100%;
    max-width: 380px;
    padding: 22px 17px 21px;
  }

  .race-result-glyph {
    width: 126px;
    height: 112px;
    font-size: 80px;
  }

  .race-result-glyph::before,
  .race-result-glyph::after {
    font-size: 22px;
  }

  .race-result-stats strong {
    font-size: 14px;
  }

  .phase-block {
    padding-inline: 10px;
  }

  .guide p {
    font-size: 10px;
  }

  .text-button,
  .result-panel button {
    min-height: 44px;
  }
}

body.ui-motion-reduced *,
body.ui-motion-reduced *::before,
body.ui-motion-reduced *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}

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

  .pk-trial .race-intro.playing,
  .pk-trial .race-intro.playing .race-intro-kicker,
  .pk-trial .race-intro.playing .race-intro-title,
  .pk-trial .race-intro.playing .race-intro-rule,
  .pk-trial .race-intro.playing .race-map-player,
  .pk-trial .race-intro.playing .race-map-rival,
  .pk-trial .race-intro.playing .race-map-card::after,
  .pk-trial .race-intro.playing .race-map-card span,
  .pk-trial .race-intro.playing .race-intro-vs,
  .pk-trial .board-wrap.race-intro-active > #gameCanvas {
    animation-duration: 3.9s !important;
  }

}

/* Reference-led casual-game skin. The gameplay geometry stays unchanged. */
body:not(.game-active) {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.78), transparent 34rem),
    #d8f3ef;
}

body.game-active {
  background: #3d4765;
}

.home-screen {
  min-height: min(880px, calc(100vh - 24px));
  padding: 28px 26px 22px;
  border: 0;
  border-radius: 26px;
  background-color: #c8f0ee;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='76' viewBox='0 0 76 76'%3E%3Cpath d='M38 8 55 27H45v20H31V27H21Z' fill='%23168d98' fill-opacity='.075'/%3E%3C/svg%3E");
  background-size: 76px 76px;
  box-shadow:
    inset 0 0 0 2px rgba(33, 91, 98, 0.08),
    0 22px 60px rgba(26, 69, 73, 0.18);
}

.home-screen::before,
.home-screen::after {
  display: none;
}

.home-topbar {
  min-height: 52px;
}

.home-tools {
  gap: 12px;
}

.arcade-square-button,
.arcade-sound-switch {
  display: grid;
  height: 48px;
  place-items: center;
  border: 3px solid #2b4c55;
  background: #fffdf2;
  box-shadow: 0 5px 0 rgba(43, 76, 85, 0.28);
  color: #30424a;
  cursor: pointer;
}

.arcade-square-button {
  width: 48px;
  border-radius: 13px;
}

.settings-gear-button span {
  font-size: 27px;
  line-height: 1;
}

.arcade-sound-switch {
  width: 76px;
  justify-content: end;
  padding: 4px 7px;
  border-color: #3b6aa8;
  border-radius: 999px;
  background: linear-gradient(90deg, #6199e8, #407bcf);
}

.sound-switch-moon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #ffe46c;
  box-shadow: inset -5px -2px 0 #f6c83f;
  color: #27518d;
  font-size: 18px;
  font-weight: 900;
  transition: transform 180ms ease;
}

.arcade-sound-switch.muted {
  background: #93a3b5;
}

.arcade-sound-switch.muted .sound-switch-moon {
  transform: translateX(-28px);
  background: #e7ecf4;
  box-shadow: inset -5px -2px 0 #c4cfdd;
}

.energy-pill {
  min-width: 100px;
  padding: 9px 15px;
  border: 3px solid #2b4c55;
  background: #fffdf2;
  box-shadow: 0 5px 0 rgba(43, 76, 85, 0.25);
}

.energy-pill strong {
  color: #efb51f;
  font-size: 17px;
  text-shadow: 0 1px 0 #a76c00;
}

.energy-pill small {
  color: #49616a;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 10px;
  font-weight: 800;
}

.energy-pill.energy-empty {
  gap: 7px;
  padding: 7px 9px 7px 12px;
}

.energy-ad-button {
  min-width: 72px;
  min-height: 30px;
  padding: 5px 8px;
  border: 2px solid #fff9e9;
  border-radius: 999px;
  background: linear-gradient(180deg, #54b9ef, #2f86d8);
  box-shadow: 0 0 0 2px #2b628b, 0 3px 0 #24577d;
  color: #fff;
  cursor: pointer;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.energy-ad-button:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 2px #2b628b, 0 1px 0 #24577d;
}

.energy-ad-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.home-hero {
  min-height: 0;
  padding: 6px 0 0;
}

.home-mode-grid {
  position: relative;
  display: flex;
  min-height: 735px;
  flex: 1;
  align-items: center;
  flex-direction: column;
}

.home-logo-kicker {
  margin: 24px 0 3px;
  color: #28747b;
  font-family: "Arial Rounded MT Bold", "Microsoft YaHei", sans-serif;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.arcade-logo {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  filter:
    drop-shadow(0 4px 0 #274e55)
    drop-shadow(0 7px 3px rgba(26, 69, 73, 0.2));
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 48px;
  font-weight: 1000;
  letter-spacing: -0.12em;
  line-height: 1.15;
  white-space: nowrap;
}

.arcade-logo span {
  paint-order: stroke fill;
  -webkit-text-stroke: 6px #fff9e9;
}

.arcade-logo span:nth-of-type(1) { color: #ef6d4b; }
.arcade-logo span:nth-of-type(2) { color: #f0a52d; }
.arcade-logo span:nth-of-type(3) { color: #389ee7; }
.arcade-logo span:nth-of-type(4) { color: #43bd86; }

.arcade-logo i {
  position: relative;
  width: 32px;
  height: 10px;
  margin: 2px 7px 0 10px;
  border-radius: 999px;
  background: #56a5e6;
  box-shadow: 0 0 0 5px #fff9e9;
}

.arcade-logo i::before,
.arcade-logo i::after {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-top: 7px solid #ef6d4b;
  border-right: 7px solid #ef6d4b;
  content: "";
  transform: rotate(45deg);
}

.arcade-logo i::before {
  left: -14px;
  transform: rotate(-135deg);
}

.arcade-logo i::after {
  right: -14px;
}

.mascot-stage {
  position: relative;
  z-index: 1;
  width: 285px;
  height: 285px;
  margin-top: 21px;
}

.mascot-stage img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 13px 5px rgba(34, 83, 88, 0.24));
  animation: mascot-float 3.2s ease-in-out infinite;
}

.mascot-burst {
  position: absolute;
  z-index: 0;
  inset: 35px;
  border: 3px dashed rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  animation: mascot-burst-spin 18s linear infinite;
}

.mascot-burst::before,
.mascot-burst::after {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffd556;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.55);
  content: "";
}

.mascot-burst::before {
  top: 15px;
  right: 14px;
}

.mascot-burst::after {
  bottom: 19px;
  left: 8px;
  background: #f18ba7;
}

.home-side-menu {
  position: absolute;
  z-index: 5;
  top: 218px;
  right: -13px;
  display: grid;
  gap: 13px;
}

.side-feature-button {
  display: grid;
  width: 67px;
  justify-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2e5359;
  cursor: pointer;
}

.side-feature-button b {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 4px solid #fff9e9;
  border-radius: 17px;
  background: linear-gradient(150deg, #ffdc57, #f09a2e);
  box-shadow:
    0 0 0 3px #2d5960,
    0 6px 0 rgba(45, 89, 96, 0.23);
  color: #fff;
  font-family: "Arial Black", sans-serif;
  font-size: 16px;
  font-style: italic;
  text-shadow: 0 2px 0 rgba(107, 54, 0, 0.4);
}

.rules-feature-button b {
  background: linear-gradient(150deg, #68c9f1, #3c8fda);
  font-size: 25px;
}

.side-feature-button span {
  padding: 2px 5px;
  color: #fffef0;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.02em;
  line-height: 1;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(30, 78, 84, 0.34);
  -webkit-text-stroke: 3px #356269;
  white-space: nowrap;
}

.duel-feature-button {
  width: 79px;
  margin: -4px 0 2px -6px;
}

.duel-feature-button b {
  width: 64px;
  height: 64px;
  border-radius: 21px;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.68), transparent 22%),
    linear-gradient(145deg, #ff7d76, #e74b69);
  box-shadow:
    0 0 0 3px #315d66,
    0 7px 0 rgba(45, 89, 96, 0.24),
    0 0 20px rgba(232, 72, 105, 0.2);
  font-size: 22px;
  animation: duel-feature-pulse 2.7s ease-in-out infinite;
}

.duel-feature-button span {
  font-size: 13px;
}

.milestone-feature-button b {
  position: relative;
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 27%, #fff9af 0 13%, transparent 14%),
    linear-gradient(145deg, #ffd75b, #ec9631);
  color: #fff7bd;
  font-style: normal;
  font-size: 27px;
  text-shadow:
    0 2px 0 #c87520,
    0 0 5px rgba(255, 255, 255, 0.7);
}

.milestone-feature-button b::before,
.milestone-feature-button b::after {
  position: absolute;
  z-index: -1;
  bottom: -10px;
  width: 16px;
  height: 23px;
  border: 3px solid #fff9e9;
  background: #f26b64;
  content: "";
}

.milestone-feature-button b::before {
  left: 8px;
  transform: rotate(18deg);
}

.milestone-feature-button b::after {
  right: 8px;
  transform: rotate(-18deg);
}

.milestone-feature-button b i {
  font-style: normal;
}

.ranking-feature-button b {
  position: relative;
  border-radius: 16px;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.5), transparent 20%),
    linear-gradient(145deg, #9b79e0, #7553bf);
  color: white;
  font-style: normal;
  text-shadow: none;
}

.ranking-feature-button b i {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 35px;
  font-style: normal;
}

.ranking-feature-button b em {
  display: grid;
  width: 13px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-bottom: 0;
  border-radius: 4px 4px 1px 1px;
  background: #61b6e7;
  color: white;
  font-family: "Arial Black", sans-serif;
  font-size: 8px;
  font-style: normal;
  line-height: 1;
}

.ranking-feature-button b em:nth-child(1) {
  height: 23px;
}

.ranking-feature-button b em:nth-child(2) {
  height: 32px;
  background: #f3bc3e;
}

.ranking-feature-button b em:nth-child(3) {
  height: 18px;
  background: #ed8b70;
}

.ranking-panel {
  place-items: center;
  padding: 18px;
}

.ranking-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 460px);
  max-height: min(90dvh, 700px);
  gap: 12px;
  padding: 20px 18px 16px;
  border: 4px solid #fff9e9;
  border-radius: 26px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)),
    #c9f0ee;
  box-shadow:
    0 0 0 3px #2d5960,
    0 10px 0 #3c9295,
    0 25px 56px rgba(39, 75, 80, 0.34);
  color: #294f57;
  animation: milestone-pop 260ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ranking-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 22px;
  background-image:
    linear-gradient(45deg, transparent 44%, rgba(55, 152, 154, 0.07) 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, rgba(55, 152, 154, 0.07) 45% 55%, transparent 56%);
  background-size: 35px 35px;
  content: "";
}

.ranking-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ranking-card > header p {
  margin: 0 0 2px;
  color: #7c59c4;
  font-family: var(--game-display-font);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.ranking-card h2 {
  margin: 0;
  color: #fff9df;
  font-family: var(--game-display-font);
  font-size: 31px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(35, 95, 101, 0.25);
  -webkit-text-stroke: 5px #2f646b;
}

.ranking-card .settings-close-button {
  border: 3px solid #fff9e9;
  background: linear-gradient(180deg, #a985ef, #7650bd);
  box-shadow: 0 0 0 2px #2d5960, 0 4px 0 rgba(45, 89, 96, 0.22);
  color: white;
  font-weight: 1000;
}

.ranking-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
  padding: 11px 13px;
  border: 3px solid #fff9e9;
  border-radius: 17px;
  background: linear-gradient(145deg, #9270d7, #6543aa);
  box-shadow: 0 0 0 2px #315d66, 0 5px 0 rgba(45, 89, 96, 0.23);
  color: white;
}

.ranking-hero > span {
  display: flex;
  grid-row: 1 / 3;
  align-items: end;
  gap: 2px;
  height: 54px;
}

.ranking-hero > span i,
.ranking-hero > span b {
  display: grid;
  width: 27px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px 7px 3px 3px;
  background: #60aee0;
  color: white;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 13px;
  font-style: normal;
}

.ranking-hero > span i {
  height: 35px;
}

.ranking-hero > span i:last-child {
  height: 27px;
  background: #ed8b67;
}

.ranking-hero > span b {
  height: 48px;
  background: #f4be42;
}

.ranking-hero > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.ranking-hero small {
  font-size: 11px;
  font-weight: 900;
  opacity: 0.9;
}

.ranking-hero strong {
  color: #fff5a8;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 27px;
}

.ranking-hero > b {
  font-size: 12px;
  font-weight: 900;
}

.home-leaderboard-tabs {
  border: 2px solid rgba(45, 89, 96, 0.16);
  background: rgba(255, 255, 255, 0.4);
}

.home-leaderboard-tabs button {
  min-height: 38px;
  font-size: 12px;
}

.home-leaderboard-list {
  min-height: 248px;
  max-height: 355px;
  padding-right: 2px;
}

.ranking-note {
  margin: -2px 0 0;
  color: #608087;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.milestone-panel {
  place-items: center;
  padding: 18px;
}

.milestone-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 540px);
  max-height: min(92dvh, 790px);
  padding: 20px 17px 15px;
  border: 4px solid #fff9e9;
  border-radius: 26px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
    #c9f0ee;
  box-shadow:
    0 0 0 3px #2d5960,
    0 22px 55px rgba(39, 75, 80, 0.34);
  color: #294f57;
  animation: milestone-pop 260ms both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.milestone-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 22px;
  background-image:
    linear-gradient(45deg, transparent 44%, rgba(55, 152, 154, 0.08) 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, rgba(55, 152, 154, 0.08) 45% 55%, transparent 56%);
  background-size: 35px 35px;
  content: "";
  opacity: 0.65;
}

.milestone-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.milestone-card header p {
  margin: 0 0 2px;
  color: #248a98;
  font-family: var(--game-display-font);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.milestone-card h2 {
  margin: 0;
  color: #fff9df;
  font-family: var(--game-display-font);
  font-size: 30px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(35, 95, 101, 0.25);
  -webkit-text-stroke: 5px #2f646b;
}

.milestone-card .settings-close-button {
  border: 3px solid #fff9e9;
  background: linear-gradient(180deg, #6bc8e8, #3897d0);
  box-shadow: 0 0 0 2px #2d5960, 0 4px 0 rgba(45, 89, 96, 0.22);
  color: white;
  font-weight: 1000;
}

.milestone-summary {
  display: grid;
  align-items: center;
  justify-items: center;
  margin-top: 12px;
  padding: 9px 11px;
  border: 3px solid #fff9e9;
  border-radius: 12px;
  background: linear-gradient(180deg, #53b4ed, #358bd3);
  box-shadow: 0 0 0 2px #2d5960, 0 4px 0 rgba(45, 89, 96, 0.18);
  color: white;
  font-family: var(--game-font);
  font-size: 13px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(26, 79, 126, 0.38);
}

.milestone-summary strong {
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.milestone-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 4px 8px;
  padding: 8px 10px;
  border: 2px solid #fff9e9;
  border-radius: 11px;
  background: linear-gradient(155deg, #fff2ac, #f5cb67);
  box-shadow: 0 0 0 2px rgba(45, 89, 96, 0.62);
  color: #79551e;
  font-family: var(--game-font);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
}

.milestone-hint button {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: #388fd1;
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 1000;
}

.milestone-grid {
  display: grid;
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  padding: 13px 5px 12px;
  scrollbar-color: rgba(45, 89, 96, 0.35) transparent;
}

.milestone-level {
  display: grid;
  min-height: 66px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 0;
  border: 3px solid #fff9e9;
  border-radius: 13px;
  box-shadow: 0 0 0 2px rgba(45, 89, 96, 0.72), 0 4px 0 rgba(45, 89, 96, 0.16);
  text-align: center;
}

.milestone-level:not(:disabled) {
  cursor: pointer;
}

.milestone-level:not(:disabled):active {
  transform: translateY(2px);
}

.milestone-level.selected {
  box-shadow:
    0 0 0 3px #ffe45d,
    0 0 0 6px #2d5960,
    0 7px 0 rgba(45, 89, 96, 0.2);
  transform: translateY(-2px);
}

.milestone-level strong {
  display: block;
  width: 100%;
  color: white;
  font-family: "Arial Black", "Microsoft YaHei", sans-serif;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 0 rgba(21, 65, 98, 0.38);
}

.milestone-level span {
  display: flex;
  justify-content: center;
  gap: 1px;
}

.milestone-level i {
  color: rgba(255, 255, 255, 0.26);
  font-size: 11px;
  font-style: normal;
  line-height: 1;
  text-shadow: none;
}

.milestone-level i.earned {
  color: #ffe45d;
  text-shadow: 0 1px 0 #c7811c;
}

.milestone-level.completed {
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.5), transparent 20%),
    linear-gradient(155deg, #68d2ac, #319373);
}

.milestone-level.locked {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(114, 145, 151, 0.28);
  box-shadow: 0 0 0 2px rgba(69, 105, 111, 0.28);
  cursor: default;
}

.milestone-level.locked strong {
  color: rgba(56, 91, 97, 0.47);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
}

.milestone-level.current {
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(219, 244, 231, 0.9);
  box-shadow: 0 0 0 2px rgba(79, 158, 133, 0.66), 0 3px 0 rgba(45, 89, 96, 0.12);
}

.milestone-level.current strong {
  color: #3f7767;
  text-shadow: 0 1px 0 white;
}

.milestone-level.current i {
  color: rgba(63, 119, 103, 0.23);
}

.milestone-challenge {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 22px;
  align-items: center;
  gap: 10px;
  margin: 8px 4px 0;
  padding: 11px 12px;
  border: 3px solid #fff9e9;
  border-radius: 15px;
  background: linear-gradient(155deg, #fff5c8, #f8dda0);
  box-shadow: 0 0 0 2px #2d5960, 0 5px 0 rgba(45, 89, 96, 0.17);
}

.milestone-challenge > div {
  display: grid;
  gap: 2px;
}

.milestone-challenge > div strong {
  color: #315f67;
  font-family: var(--game-display-font);
  font-size: 16px;
}

.milestone-challenge > div span {
  color: #9b691f;
  font-size: 11px;
  font-weight: 900;
}

.milestone-challenge > button:not(.milestone-challenge-cancel) {
  grid-column: 2;
  grid-row: 1;
  min-height: 39px;
  padding: 8px 13px;
  border: 3px solid #fff9e9;
  border-radius: 11px;
  background: linear-gradient(180deg, #55b7ed, #378ad2);
  box-shadow: 0 0 0 2px #2d5960, 0 4px 0 rgba(45, 89, 96, 0.2);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(27, 76, 125, 0.38);
  white-space: nowrap;
}

.milestone-challenge-cancel {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7d876e;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.milestone-challenge.energy-warning {
  animation: milestone-energy-warning 360ms ease;
}

.milestone-note {
  margin: 9px 0 0;
  color: #54757a;
  font-family: var(--game-font);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
  text-align: center;
}

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

@keyframes milestone-pop {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes milestone-energy-warning {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  65% { transform: translateX(5px); }
}

.home-level-panel {
  display: grid;
  min-width: 210px;
  justify-items: center;
  margin-top: 13px;
}

.home-level-panel > strong {
  color: #294a51;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 21px;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 0 white;
}

.home-level-panel > small {
  margin-top: 4px;
  color: #537077;
  font-size: 11px;
  font-weight: 800;
}

.home-level-panel .mode-progress {
  width: 190px;
  height: 7px;
  margin: 7px 0 0;
  border: 2px solid rgba(43, 76, 85, 0.22);
  background: rgba(255, 255, 255, 0.55);
}

.home-level-panel .mode-progress i {
  background: linear-gradient(90deg, #45b98b, #328fdb);
}

.arcade-start-button {
  display: flex;
  min-width: 235px;
  min-height: 65px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin-top: 13px;
  padding: 11px 30px;
  border: 4px solid #fff9e9;
  border-radius: 15px;
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
  box-shadow:
    0 0 0 3px #265a8a,
    0 8px 0 #245f9d,
    0 13px 14px rgba(31, 92, 121, 0.24);
  color: white;
  cursor: pointer;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 20px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(30, 74, 126, 0.55);
}

.arcade-start-button b {
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 18px solid white;
  filter: drop-shadow(0 2px 0 rgba(35, 83, 137, 0.45));
}

.arcade-start-button:active {
  box-shadow:
    0 0 0 3px #265a8a,
    0 3px 0 #245f9d;
  transform: translateY(5px);
}

.rules-card,
.settings-card {
  border: 4px solid #fff9e9;
  background: #f9f3dd;
  box-shadow:
    0 0 0 3px #2d5960,
    0 12px 40px rgba(39, 75, 80, 0.25);
}

.settings-card h2,
.rules-card h2 {
  color: #2e5359;
  font-family: var(--game-display-font);
  font-weight: 1000;
}

.settings-card header p,
.rules-card header p {
  color: #308aa0;
}

.setting-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, #4eacf0, #2e80d4);
}

body.game-active .game-shell {
  width: min(100%, 620px);
  padding-block: 12px;
}

.game-screen {
  color: white;
}

.game-screen .topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 70px;
  align-items: center;
  padding: 3px 6px 11px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
}

.game-screen .topbar > div:first-child {
  grid-column: 2;
  text-align: center;
}

.game-screen .topbar .eyebrow {
  margin: 0;
  color: white;
  font-size: 0;
  font-family: "Microsoft YaHei", sans-serif;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.game-screen .topbar .eyebrow span {
  font-size: 25px;
  font-weight: 1000;
}

.game-screen .topbar h1 {
  display: none;
}

.game-screen .top-actions {
  grid-column: 3;
  justify-self: end;
}

.game-screen .game-energy {
  display: none;
}

.game-screen .quiet-button {
  position: relative;
  min-width: 42px;
  min-height: 39px;
  padding: 7px 9px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 0 rgba(22, 31, 53, 0.35);
  color: #38435d;
  font-size: 10px;
  font-weight: 900;
}

.game-screen .game-icon-button {
  width: 42px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.game-screen .game-icon-button.muted::after {
  position: absolute;
  width: 25px;
  height: 3px;
  border-radius: 3px;
  background: #ff6259;
  content: "";
  transform: rotate(-45deg);
}

.game-screen .status {
  min-height: 66px;
  margin: 0;
  padding: 9px 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.game-screen .status span {
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--game-font);
  font-size: 11px;
  font-weight: 800;
}

.game-screen .status-block strong {
  color: white;
  font-family: var(--game-display-font);
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.game-screen .status-right {
  display: none;
}

.game-screen .phase-block {
  flex: 1;
  padding: 0;
  border: 0;
  text-align: right;
}

.game-screen .phase-block > span {
  display: none;
}

.game-screen .phase-block strong {
  justify-content: flex-end;
  font-size: 12px;
}

.game-screen .status {
  min-height: 46px;
  justify-content: space-between;
  padding-block: 5px 6px;
}

.game-screen .lives-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-screen .lives-block > span {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.pk-trial .game-screen .guide {
  min-height: 52px;
  padding-top: 8px;
}

.pk-trial .game-screen .guide p {
  font-size: 12px;
  line-height: 1.45;
}

.game-screen .phase-block {
  border-color: rgba(255, 255, 255, 0.22);
}

.game-screen .phase-block strong {
  color: white;
  font-family: var(--game-font);
  font-size: 13px;
  font-weight: 1000;
}

.game-screen .status-block .hearts {
  color: #ff6259;
  font-size: 23px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25));
}

.game-screen .hearts i {
  color: rgba(255, 98, 89, 0.22);
}

.game-screen .board-wrap {
  border: 0;
  border-radius: 0;
  background: #3d4765;
  box-shadow: none;
}

.game-screen .guide {
  min-height: 62px;
  padding: 10px 7px 0;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.game-screen .guide p {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.game-screen .text-button {
  min-height: 42px;
  padding: 9px 13px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 0 rgba(22, 31, 53, 0.35);
  color: #38435d;
  font-weight: 900;
  text-decoration: none;
}


.game-screen .race-panel {
  border-color: rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(104deg, rgba(43, 126, 226, 0.28) 0 44%, transparent 44.5% 55.5%, rgba(226, 65, 101, 0.28) 56% 100%),
    rgba(19, 27, 51, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 5px 0 rgba(16, 23, 43, 0.28);
}

.game-screen .race-player {
  border-color: rgba(84, 190, 255, 0.58);
  background: linear-gradient(115deg, rgba(45, 135, 226, 0.34), rgba(31, 66, 123, 0.2));
}

.game-screen .race-opponent {
  border-color: rgba(255, 99, 126, 0.58);
  background: linear-gradient(245deg, rgba(222, 69, 105, 0.34), rgba(116, 52, 80, 0.2));
}

.game-screen .race-label {
  color: rgba(255, 255, 255, 0.88);
}

.game-screen .race-label strong {
  color: white;
}

.game-screen .race-meter {
  background: rgba(8, 14, 35, 0.5);
}

.game-screen .race-vs {
  color: white;
}

.game-screen .race-intro {
  background:
    radial-gradient(circle at 50% 42%, rgba(78, 101, 160, 0.72), rgba(61, 71, 101, 0.97) 62%),
    #3d4765;
}

.game-screen .race-intro-kicker {
  color: #8edcf0;
}

.game-screen .race-intro-title,
.game-screen .race-intro-rule {
  color: white;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.23);
}

.game-screen .race-map-card {
  border: 3px solid rgba(255, 255, 255, 0.72);
  background: #3d4765;
  box-shadow: 0 15px 38px rgba(14, 22, 43, 0.42);
}

.game-screen .race-map-card span {
  background: rgba(255, 255, 255, 0.92);
  color: #38435d;
}

.game-screen .race-intro-vs {
  border-width: 4px;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 9px 24px rgba(11, 18, 37, 0.5);
}

.tutorial-overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 40%, rgba(83, 112, 181, 0.64), rgba(24, 32, 57, 0.9) 68%),
    rgba(24, 32, 57, 0.9);
  backdrop-filter: blur(5px);
}

.tutorial-card {
  display: grid;
  width: min(100%, 330px);
  justify-items: center;
  padding: 24px 22px 19px;
  border: 4px solid #fff9e9;
  border-radius: 24px;
  background: linear-gradient(160deg, #c9f3ef, #a8e1e1);
  box-shadow: 0 0 0 3px #2d5960, 0 18px 45px rgba(13, 22, 44, 0.42);
  color: #2d5960;
  text-align: center;
  animation: tutorial-card-in 320ms both cubic-bezier(0.18, 0.86, 0.22, 1.08);
}

.tutorial-card > p {
  margin: 0;
  color: #2e8b99;
  font-family: "Arial Black", sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.tutorial-card h2 {
  margin: 13px 0 5px;
  color: #fff9df;
  font-family: "Arial Black", "Microsoft YaHei", sans-serif;
  font-size: 28px;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(34, 89, 96, 0.22);
  -webkit-text-stroke: 5px #2d5960;
}

.tutorial-card > span {
  max-width: 235px;
  color: #456b72;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.6;
}

.tutorial-visual {
  position: relative;
  width: 210px;
  height: 78px;
  margin-top: 15px;
  border: 3px solid rgba(45, 89, 96, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle, rgba(62, 117, 126, 0.2) 1.5px, transparent 2px) 0 0 / 17px 17px,
    rgba(255, 255, 255, 0.52);
}

.tutorial-visual > i {
  position: absolute;
  top: 36px;
  left: 29px;
  width: 123px;
  height: 7px;
  border-radius: 5px 0 0 5px;
  background: #3868d8;
}

.tutorial-visual > b {
  position: absolute;
  top: 24px;
  left: 145px;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 25px solid #3868d8;
  animation: tutorial-arrow-move 1.2s ease-in-out infinite;
}

.tutorial-visual > em {
  display: none;
}

.tutorial-visual.collision > em {
  position: absolute;
  top: 15px;
  right: 38px;
  display: block;
  width: 7px;
  height: 49px;
  border-radius: 4px;
  background: #ef5e70;
  box-shadow: 0 0 12px rgba(239, 94, 112, 0.6);
}

.tutorial-visual.collision > b {
  left: 128px;
  animation: tutorial-arrow-collision 1.2s ease-in-out infinite;
}

.tutorial-dots {
  display: flex;
  gap: 7px;
  margin: 17px 0 13px;
}

.tutorial-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(45, 89, 96, 0.22);
}

.tutorial-dots i.active {
  width: 20px;
  border-radius: 999px;
  background: #3f96d4;
}

.tutorial-card > button {
  min-width: 170px;
  min-height: 45px;
  border: 3px solid #fff9e9;
  border-radius: 12px;
  background: linear-gradient(180deg, #55b7ed, #378ad2);
  box-shadow: 0 0 0 2px #2d5960, 0 5px 0 rgba(45, 89, 96, 0.22);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(27, 76, 125, 0.38);
}

.tutorial-card > #tutorialSkipButton {
  min-width: auto;
  min-height: auto;
  margin-top: 11px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #668086;
  font-size: 10px;
  text-shadow: none;
}

.result-panel.main-result-mode {
  overflow: hidden;
  align-content: center;
  background:
    radial-gradient(circle at 50% 34%, rgba(77, 105, 173, 0.94), rgba(39, 49, 81, 0.985) 56%, rgba(24, 31, 55, 0.99));
  color: white;
  backdrop-filter: none;
}

.result-panel.main-result-mode.failure-result {
  background:
    radial-gradient(circle at 50% 34%, rgba(129, 62, 79, 0.95), rgba(58, 35, 55, 0.985) 58%, rgba(31, 24, 42, 0.99));
}

.result-panel.main-result-mode.failure-result .result-score {
  display: none;
}

.result-panel.main-result-mode.journey-complete {
  background:
    radial-gradient(circle at 50% 34%, rgba(149, 109, 44, 0.96), rgba(64, 52, 61, 0.985) 58%, rgba(29, 30, 45, 0.99));
}

.result-panel.main-result-mode > #resultKicker {
  color: #8fe2dc;
  font-size: 11px;
  letter-spacing: 0.15em;
}

.result-panel.main-result-mode.journey-complete > #resultKicker {
  color: #ffe47d;
}

.result-panel.main-result-mode > #resultTitle {
  margin: 8px 0 15px;
  color: #fff;
  font-family: "Arial Black", "Microsoft YaHei", sans-serif;
  font-size: clamp(38px, 11vw, 58px);
  line-height: 1.05;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(14, 23, 52, 0.35), 0 15px 32px rgba(0, 0, 0, 0.25);
  -webkit-text-stroke: 6px rgba(18, 31, 67, 0.72);
}

.result-panel.main-result-mode .result-score span {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
}

.result-panel.main-result-mode .result-score strong {
  margin: 7px 0 13px;
  color: #ffe35d;
  font-family: "Arial Black", sans-serif;
  font-size: clamp(46px, 14vw, 67px);
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 4px 0 #bd7620, 0 0 20px rgba(255, 221, 77, 0.36);
}

.result-panel .result-record {
  display: inline-block;
  justify-self: center;
  margin: 0 0 21px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.result-panel .result-record[hidden] {
  display: none;
}

.result-panel.main-result-mode button {
  min-width: 0;
  min-height: 48px;
  border: 3px solid #fff9e9;
  border-radius: 13px;
  background: linear-gradient(180deg, #55b7ed, #378ad2);
  box-shadow: 0 0 0 2px #1e355c, 0 6px 0 rgba(17, 29, 56, 0.35);
  font-size: 13px;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(27, 76, 125, 0.38);
}

.result-panel.main-result-mode .result-actions {
  width: min(100%, 330px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
}

.result-panel.main-result-mode #restartButton {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  min-height: 54px;
  font-size: 15px;
}

.result-panel.main-result-mode .secondary-button {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-height: 43px;
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 12px;
}

.result-panel.main-result-mode .result-home-button {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-height: 43px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.result-panel.main-result-mode.failure-result > #resultTitle {
  margin-bottom: 28px;
}

.result-panel.main-result-mode.failure-result .result-actions {
  gap: 13px 10px;
}

.result-panel.main-result-mode.failure-result #restartButton {
  grid-column: 1 / -1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-color: #fff5cf;
  background: linear-gradient(180deg, #ffd86d, #f2ad32);
  box-shadow: 0 0 0 2px #9b5f1c, 0 6px 0 #a96620, 0 12px 22px rgba(31, 18, 36, 0.24);
  color: #694019;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
}

.result-panel.main-result-mode.failure-result #restartButton::before {
  display: inline-grid;
  width: 25px;
  height: 18px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 5px;
  content: "▶";
  font-size: 9px;
  line-height: 1;
}

.result-panel.main-result-mode.failure-result .revive-note {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: -1px 0 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.result-panel.main-result-mode.failure-result .revive-note[hidden] {
  display: none;
}

.result-panel.main-result-mode.failure-result .secondary-button,
.result-panel.main-result-mode.failure-result .result-home-button {
  grid-row: 3;
  min-height: 45px;
  border: 3px solid #eef7ff;
  background: linear-gradient(180deg, #55b7ed, #378ad2);
  box-shadow: 0 0 0 2px #1e4f7e, 0 5px 0 #235e99;
  color: white;
  font-size: 12px;
  text-shadow: 0 2px 0 rgba(27, 76, 125, 0.42);
}

.result-panel.main-result-mode.failure-result .result-home-button {
  grid-column: 1;
}

.result-panel.main-result-mode.failure-result .secondary-button {
  grid-column: 2;
}

.result-panel.main-result-mode.perfect-result .result-score strong {
  animation: result-stars-pop 720ms both cubic-bezier(0.16, 0.86, 0.26, 1.2);
}

@keyframes tutorial-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tutorial-arrow-move {
  0%, 100% { transform: translateX(-4px); }
  50% { transform: translateX(7px); }
}

@keyframes tutorial-arrow-collision {
  0%, 100% { transform: translateX(-10px); }
  45%, 65% { transform: translateX(7px); }
}

@keyframes result-stars-pop {
  0% { opacity: 0; transform: scale(0.52) rotate(-5deg); }
  70% { transform: scale(1.13) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes group-countdown-pop {
  0% { opacity: 0; transform: scale(1.28) rotate(-4deg); }
  55% { opacity: 1; transform: scale(0.94) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes pk-ranked-dot {
  0%, 66%, 100% {
    opacity: 0.28;
    transform: translateY(0) scale(0.82);
  }
  33% {
    opacity: 1;
    transform: translateY(-5px) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.ui-motion-reduced) .pk-ranked-pulse i {
    animation-duration: 1050ms !important;
    animation-iteration-count: infinite !important;
  }
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-9px) rotate(1deg); }
}

@keyframes mascot-burst-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 420px) {
  .game-shell {
    padding: 0;
  }

  .home-screen {
    min-height: 0;
    height: 100dvh;
    padding: 20px 18px 14px;
    border-radius: 0;
  }

  .home-mode-grid {
    min-height: 0;
  }

  .home-logo-kicker {
    margin-top: 18px;
  }

  .arcade-logo {
    font-size: 42px;
  }

  .mascot-stage {
    width: 250px;
    height: 250px;
    margin-top: 17px;
  }

  .home-side-menu {
    top: 204px;
    right: -10px;
    gap: 11px;
  }

  .side-feature-button b {
    width: 49px;
    height: 49px;
  }

  .duel-feature-button b {
    width: 59px;
    height: 59px;
  }

  .milestone-card {
    max-height: calc(100dvh - 30px);
  }

  .home-level-panel {
    margin-top: 8px;
  }

  .arcade-start-button {
    min-width: 225px;
    min-height: 61px;
    margin-top: 11px;
  }

  body.game-active .game-shell {
    width: 100%;
    padding: 8px 0 0;
  }

  .game-screen .topbar,
  .game-screen .status,
  .game-screen .guide {
    padding-inline: 12px;
  }

  .game-screen .race-panel {
    gap: 4px;
    padding: 6px;
    border-radius: 14px;
  }

  .game-screen .race-side {
    padding: 6px 7px 7px;
    border-radius: 10px;
  }

  .game-screen .race-label {
    margin-bottom: 5px;
  }

  .game-screen .race-label em {
    font-size: 9px;
  }

  .game-screen .race-label strong {
    font-size: 13px;
  }

  .game-screen .race-side-mark {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    border-width: 1px;
    font-size: 9px;
  }

  .game-screen .race-meter {
    height: 9px;
  }

  .game-screen .race-vs {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-width: 2px;
  }

  .game-screen .race-vs b {
    font-size: 17px;
  }

  .game-screen .board-wrap {
    width: min(100%, 50dvh);
    border-radius: 0;
  }
}
