:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  background: #0b1324;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(75, 183, 255, 0.28), transparent 28%),
    radial-gradient(circle at 82% 84%, rgba(255, 184, 82, 0.22), transparent 26%),
    linear-gradient(160deg, #060916 0%, #14203c 46%, #070910 100%);
  letter-spacing: 0;
}

.game-shell {
  position: relative;
  width: min(100vw, 56.58vh, 500px);
  aspect-ratio: 430 / 760;
  max-height: 100vh;
  overflow: hidden;
  border: 1px solid rgba(255, 239, 179, 0.35);
  border-radius: 10px;
  background: #111a2d;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.56),
    0 0 42px rgba(85, 214, 255, 0.18);
  touch-action: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.icon-button,
.start-button {
  border: 0;
  font: inherit;
  cursor: pointer;
  letter-spacing: 0;
}

.icon-button {
  position: absolute;
  z-index: 4;
  display: grid;
  width: clamp(34px, 8.2vw, 42px);
  height: clamp(34px, 8.2vw, 42px);
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #fff8ce;
  background:
    linear-gradient(145deg, rgba(44, 193, 206, 0.92), rgba(32, 86, 177, 0.92)),
    #246db9;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.28);
  font-weight: 900;
  line-height: 1;
}

.sound-button {
  right: 12px;
  bottom: 92px;
}

.reset-button {
  right: 12px;
  bottom: 42px;
}

.start-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 247, 201, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(5, 8, 18, 0.35), rgba(5, 8, 18, 0.82));
  transition: opacity 240ms ease, visibility 240ms ease;
}

.start-layer.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.title-mark {
  display: grid;
  gap: 8px;
  min-width: min(78vw, 360px);
  margin-bottom: 4px;
  padding: 24px 18px 22px;
  border: 2px solid rgba(255, 235, 145, 0.82);
  border-radius: 8px;
  text-align: center;
  color: #fff6ca;
  background:
    linear-gradient(180deg, rgba(25, 64, 118, 0.8), rgba(20, 24, 48, 0.76)),
    rgba(16, 25, 47, 0.88);
  box-shadow:
    inset 0 0 22px rgba(105, 236, 255, 0.22),
    0 16px 34px rgba(0, 0, 0, 0.42);
  text-shadow: 0 3px 0 #723b08, 0 0 18px rgba(255, 226, 119, 0.75);
}

.title-mark span {
  font-size: clamp(42px, 12vw, 66px);
  font-weight: 900;
  line-height: 1;
}

.title-mark strong {
  color: #75f1ff;
  font-size: clamp(18px, 5.5vw, 26px);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 2px 0 #10365d, 0 0 14px rgba(99, 239, 255, 0.8);
}

.start-button {
  min-width: 132px;
  min-height: 48px;
  padding: 0 28px;
  border: 2px solid #fff8c9;
  border-radius: 999px;
  color: #4b2200;
  background:
    linear-gradient(180deg, #fff8a8 0%, #ffc43b 50%, #e47414 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.72),
    0 8px 0 #8d3506,
    0 18px 30px rgba(0, 0, 0, 0.36);
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 900;
}

.hero-select {
  display: grid;
  width: min(82vw, 372px);
  max-height: min(30vh, 228px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.hero-card {
  position: relative;
  min-height: 74px;
  border: 2px solid rgba(255, 248, 201, 0.64);
  border-radius: 8px;
  color: #fff8d2;
  background:
    linear-gradient(160deg, rgba(74, 204, 219, 0.78), rgba(28, 47, 106, 0.9)),
    #193463;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 8px 16px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font: inherit;
  letter-spacing: 0;
}

.hero-card.is-selected {
  border-color: #fff28b;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 0 0 3px rgba(255, 213, 75, 0.28),
    0 10px 18px rgba(0, 0, 0, 0.32);
}

.hero-card.is-selected::after {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #4b2200;
  background: #fff28b;
  content: "✓";
  font-size: 14px;
  font-weight: 900;
  line-height: 18px;
}

.hero-card strong,
.hero-card span {
  display: block;
  text-shadow: 0 2px 0 rgba(20, 24, 48, 0.75);
}

.hero-card strong {
  margin-top: 16px;
  font-size: clamp(16px, 4.4vw, 20px);
  font-weight: 900;
  line-height: 1;
}

.hero-card span {
  margin-top: 6px;
  color: #9ff3ff;
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 800;
  line-height: 1;
}

.hero-limit {
  min-height: 20px;
  color: #fff2a8;
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 0 #663006;
}

.start-button:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.72),
    0 3px 0 #8d3506,
    0 10px 22px rgba(0, 0, 0, 0.32);
}

.start-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.72);
  opacity: 0.7;
}

@media (max-width: 460px) {
  .game-shell {
    width: min(100vw, 56.58vh);
    max-height: 100vh;
    border: 0;
    border-radius: 0;
  }
}
