@font-face {
  font-display: swap;
  font-family: "GT Walsheim";
  src: url("./fonts/gt-walsheim-cn-bl.otf") format("opentype");
}

@font-face {
  font-display: swap;
  font-family: "GT Walsheim";
  font-weight: 800;
  src: url("./fonts/gt-walsheim-bd.otf") format("opentype");
}

@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-weight: 400;
  src: url("./fonts/montserrat-regular.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-weight: 700;
  src: url("./fonts/montserrat-bold.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: Montserrat;
  font-weight: 900;
  src: url("./fonts/montserrat-black.ttf") format("truetype");
}

:root {
  color-scheme: dark;
  font-family: Montserrat, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080914;
  color: #f7f4ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 100, 48, 0.22), transparent 26rem),
    radial-gradient(circle at 63% 44%, rgba(255, 180, 66, 0.14), transparent 30rem),
    radial-gradient(circle at 88% 70%, rgba(190, 52, 24, 0.22), transparent 28rem),
    linear-gradient(180deg, #070302 0%, #120706 48%, #030204 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 500px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand,
.hud-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(7, 9, 22, 0.58);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
  color: rgba(247, 244, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 22px rgba(255, 89, 49, 0.64);
}

.brand {
  pointer-events: auto;
  text-decoration: none;
  transition: filter 140ms ease;
}

.brand:hover {
  filter: brightness(1.12);
}

.brand-word {
  font-family: "GT Walsheim", Montserrat, ui-sans-serif, system-ui, sans-serif;
  font-weight: 950;
  font-size: 17px;
  letter-spacing: 0.3px;
  color: #ffffff;
  text-shadow:
    0 0 16px rgba(255, 118, 77, 0.7),
    0 0 38px rgba(255, 138, 77, 0.34);
}

.hud-stats span {
  min-width: 48px;
  text-align: center;
}

.side-leaderboard {
  position: absolute;
  top: max(76px, calc(env(safe-area-inset-top) + 76px));
  right: max(14px, env(safe-area-inset-right));
  z-index: 5;
  width: min(300px, 26vw);
  max-height: calc(100dvh - 104px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(32, 12, 9, 0.54), rgba(7, 5, 10, 0.48)),
    rgba(7, 5, 10, 0.32);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.32),
    inset 0 0 36px rgba(255, 84, 38, 0.06);
  backdrop-filter: blur(18px);
  padding: 12px;
  pointer-events: auto;
}

.side-leaderboard-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.side-leaderboard-title small {
  color: rgba(247, 244, 255, 0.5);
  font-size: 11px;
  font-weight: 850;
  text-transform: none;
}

.side-leaderboard ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leader-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(247, 244, 255, 0.9);
  padding: 5px 7px;
  text-decoration: none;
}

.leader-row:hover {
  border-color: rgba(255, 118, 77, 0.42);
  background: rgba(255, 118, 77, 0.1);
}

.leader-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4a2f, #ffcf5a);
  color: #160603;
  font-size: 11px;
  font-weight: 950;
}

.leader-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.leader-handle {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-mrr {
  color: #ffcf5a;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.leader-empty {
  color: rgba(247, 244, 255, 0.62);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.leaderboard-credit {
  display: block;
  margin-top: 10px;
  color: rgba(247, 244, 255, 0.42);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2px;
  text-align: center;
  text-decoration: none;
  transition: color 140ms ease;
}

.leaderboard-credit:hover {
  color: #ff764d;
}

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 520px);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(32, 12, 9, 0.9), rgba(7, 5, 10, 0.84)),
    rgba(8, 9, 20, 0.78);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.42),
    inset 0 0 60px rgba(255, 84, 38, 0.08);
  backdrop-filter: blur(22px);
  padding: clamp(22px, 5vw, 38px);
  text-align: center;
  max-height: calc(100dvh - 36px);
  overflow: auto;
}

.start-panel {
  --start-content-width: min(100%, 620px);
  width: min(94vw, 760px);
}

.hidden {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: #ff764d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.result-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.result-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 22px rgba(255, 89, 49, 0.6);
}

.result-wordmark {
  font-family: "GT Walsheim", Montserrat, ui-sans-serif, system-ui, sans-serif;
  font-weight: 950;
  font-size: 24px;
  letter-spacing: 0.3px;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 118, 77, 0.62);
}

.hero-logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 32px rgba(255, 89, 49, 0.72),
    0 0 90px rgba(255, 173, 71, 0.2);
}

.presenter {
  margin: 10px 0 2px;
  color: #ff764d;
  font-size: 14.4px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: none;
  white-space: nowrap;
}

h1,
h2 {
  font-family: "GT Walsheim", Montserrat, ui-sans-serif, system-ui, sans-serif;
  margin: 0;
  color: #ffffff;
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(58px, 8vw, 108px);
  white-space: nowrap;
  text-shadow:
    0 8px 0 rgba(124, 23, 12, 0.68),
    0 0 48px rgba(255, 92, 49, 0.34);
}

h2 {
  font-size: 54px;
  text-shadow:
    0 6px 0 rgba(124, 23, 12, 0.68),
    0 0 40px rgba(255, 92, 49, 0.34);
}

.lede {
  width: min(100%, 410px);
  margin: 16px auto 18px;
  color: rgba(247, 244, 255, 0.78);
  font-size: 18px;
  line-height: 1.45;
}

.start-panel .lede {
  width: var(--start-content-width);
  max-width: 620px;
}

.how-to {
  display: grid;
  gap: 12px;
  margin: 0 auto 22px;
  width: min(100%, 440px);
  border: 1px solid rgba(255, 118, 77, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  padding: 12px;
  text-align: left;
}

.start-panel .how-to {
  width: var(--start-content-width);
}

.control-demo {
  display: grid;
  grid-template-columns: 96px 64px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 4px 6px 2px;
}

.keys-demo {
  display: grid;
  grid-template-areas:
    ". up ."
    "left down right";
  grid-template-columns: repeat(3, 28px);
  gap: 4px;
}

.key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
  animation: keyPulse 1.6s ease-in-out infinite;
}

.key-up {
  grid-area: up;
}

.key-left {
  grid-area: left;
  animation-delay: 0.18s;
}

.key-down {
  grid-area: down;
  animation-delay: 0.36s;
}

.key-right {
  grid-area: right;
  animation-delay: 0.54s;
}

.mouse-demo {
  position: relative;
  width: 48px;
  height: 48px;
}

.mouse-orbit {
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}

.mouse-dot {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #5cf2d6;
  box-shadow: 0 0 16px rgba(92, 242, 214, 0.85);
  animation: mouseDrag 1.8s ease-in-out infinite;
}

.how-to-main {
  display: grid;
  gap: 3px;
  color: rgba(247, 244, 255, 0.86);
  font-size: 13px;
  line-height: 1.3;
}

.how-to-main strong {
  color: #ffffff;
  font-size: 14px;
}

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

.power-grid > span {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(7, 5, 10, 0.38);
  color: rgba(247, 244, 255, 0.74);
  padding: 8px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

.power-grid > span > img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(255, 118, 77, 0.16);
}

.power-copy {
  display: block;
}

.power-grid b {
  color: #ffcf5a;
}

.legend {
  display: grid;
  gap: 7px;
}

.legend-title {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.legend-good {
  color: #5cf2d6;
}

.legend-bad {
  color: #ff6b6b;
}

.legend-note {
  margin: 0;
  color: rgba(247, 244, 255, 0.5);
  font-size: 11px;
  font-weight: 700;
}

.villain-grid > span {
  border-color: rgba(255, 107, 107, 0.28);
  background: rgba(40, 10, 12, 0.4);
}

.villain-grid b {
  color: #ff6b6b;
}

@keyframes keyPulse {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(0);
  }

  42% {
    border-color: rgba(255, 207, 90, 0.88);
    background: rgba(255, 207, 90, 0.18);
    transform: translateY(2px);
  }
}

@keyframes mouseDrag {
  0%,
  100% {
    transform: translate(-12px, -8px);
  }

  25% {
    transform: translate(12px, -10px);
  }

  50% {
    transform: translate(10px, 12px);
  }

  75% {
    transform: translate(-12px, 10px);
  }
}

.start-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: var(--start-content-width);
  margin: 0 auto;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
  letter-spacing: 0;
  transition:
    transform 140ms ease,
    filter 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.start-actions .primary-button,
.start-actions .icon-button {
  min-width: 170px;
}

.primary-button {
  background: linear-gradient(135deg, #ff4a2f 0%, #ffcf5a 100%);
  color: #160603;
  box-shadow: 0 12px 32px rgba(255, 91, 49, 0.24);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(247, 244, 255, 0.84);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 12px;
}

.best-line {
  margin: 0 0 4px;
  color: #ffcf5a;
  font-size: 14px;
  font-weight: 900;
}

.next-rank {
  margin: 0;
  color: rgba(247, 244, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
}

.result-grid div {
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px 8px;
}

.metric-label {
  display: block;
  color: rgba(247, 244, 255, 0.62);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-grid strong {
  display: block;
  margin-top: 7px;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.lead-form {
  margin-top: 18px;
  text-align: left;
}

.lead-form label {
  display: block;
  margin-bottom: 8px;
  color: rgba(247, 244, 255, 0.78);
  font-size: 13px;
  font-weight: 850;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 0 14px;
}

input:focus {
  border-color: rgba(255, 118, 77, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 118, 77, 0.16);
}

.lead-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: #5cf2d6;
  font-size: 12px;
  font-weight: 750;
}

.leaderboard-form {
  margin-top: 8px;
}

.leaderboard {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  text-align: left;
}

.leaderboard-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(247, 244, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-title button {
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(247, 244, 255, 0.7);
  font-size: 11px;
  font-weight: 800;
}

.leaderboard ol {
  display: grid;
  gap: 5px;
  max-height: 126px;
  margin: 9px 0 0;
  padding: 0 0 0 24px;
  overflow: auto;
}

.leaderboard li {
  color: rgba(247, 244, 255, 0.88);
  font-size: 13px;
  font-weight: 760;
}

.leaderboard small {
  color: rgba(247, 244, 255, 0.52);
  font-weight: 700;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 620px) {
  .hud {
    align-items: stretch;
  }

  .brand {
    display: none;
  }

  .hud-stats {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    top: 8px;
    transform: translate(-50%, 0);
    /* leave room for the single-row bottom leaderboard so buttons scroll above it */
    max-height: calc(100dvh - 8px - 104px);
  }

  .side-leaderboard {
    top: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    max-height: none;
    overflow: hidden;
    padding: 8px 10px;
  }

  .side-leaderboard-title {
    margin-bottom: 6px;
  }

  /* Single horizontal row that scrolls sideways — keeps gameplay visible. */
  .side-leaderboard ol {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .side-leaderboard ol::-webkit-scrollbar {
    display: none;
  }

  .side-leaderboard li {
    flex: 0 0 auto;
  }

  .side-leaderboard .leader-row {
    min-width: 150px;
    min-height: 34px;
  }

  h1 {
    font-size: clamp(42px, 14vw, 50px);
  }

  h2 {
    font-size: 38px;
  }

  .lede {
    font-size: 16px;
  }

  .power-grid {
    grid-template-columns: 1fr;
  }

  .control-demo {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .mouse-demo {
    display: none;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-grid div {
    min-height: 58px;
  }

  .result-grid strong {
    font-size: 24px;
  }

  .form-row,
  .actions,
  .start-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
