:root {
  color-scheme: dark;
  --ink: #eef1ea;
  --muted: #aab0a6;
  --night: #090d15;
  --panel: rgba(17, 24, 35, 0.88);
  --line: rgba(239, 204, 121, 0.22);
  --gold: #efcc79;
  --gold-bright: #ffe7a6;
  --jade: #77b7a4;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 8%, rgba(58, 77, 105, 0.6), transparent 32rem),
    linear-gradient(150deg, #111827 0%, #080b12 58%, #120d10 100%);
  font-family: "Noto Serif TC", "Songti TC", "STSong", Georgia, serif;
}

button,
a {
  font: inherit;
}

.game-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 28px;
}

.masthead {
  margin-bottom: 24px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 5.8rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  letter-spacing: 0.15em;
}

.game-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.scoreboard div {
  display: grid;
  gap: 4px;
  padding: 15px 20px;
  text-align: center;
}

.scoreboard div + div {
  border-left: 1px solid var(--line);
}

.scoreboard span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}

.scoreboard strong {
  color: var(--gold-bright);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.1rem;
}

.duel-scene {
  position: relative;
  height: 230px;
  overflow: hidden;
  background:
    linear-gradient(to top, rgba(9, 13, 21, 0.9), transparent 60%),
    linear-gradient(150deg, #263448, #101722 65%);
}

.moon {
  position: absolute;
  top: 28px;
  left: 50%;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #f3ddb0;
  box-shadow: 0 0 55px rgba(243, 221, 176, 0.3);
  transform: translateX(-50%);
}

.mountain {
  position: absolute;
  bottom: -74px;
  width: 390px;
  height: 240px;
  background: #151e2b;
  transform: rotate(45deg);
}

.mountain-back {
  left: -50px;
  opacity: 0.62;
}

.mountain-front {
  right: -90px;
  bottom: -96px;
  background: #0c121b;
}

.fighter {
  position: absolute;
  z-index: 3;
  bottom: 40px;
  width: 44px;
  height: 85px;
  border-radius: 45% 45% 12% 12%;
  background: #05070b;
}

.fighter::before {
  position: absolute;
  top: -23px;
  left: 10px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #05070b;
  content: "";
}

.fighter span {
  position: absolute;
  top: 16px;
  width: 100px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(90deg, #07090d 0 78%, #d7dbe0 78%);
  transform-origin: left center;
}

.fighter-left {
  left: 25%;
  transform: skew(-4deg);
}

.fighter-left span {
  left: 22px;
  transform: rotate(-14deg);
}

.fighter-right {
  right: 25%;
  transform: scaleX(-1) skew(-4deg);
}

.fighter-right span {
  left: 22px;
  transform: rotate(-14deg);
}

.play-area {
  padding: 30px clamp(20px, 6vw, 64px) 34px;
  text-align: center;
}

h2 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.15em;
}

.status {
  min-height: 1.6em;
  margin: 9px 0 27px;
  color: var(--muted);
}

.status.is-perfect {
  color: var(--gold-bright);
}

.status.is-hit {
  color: var(--jade);
}

.status.is-miss {
  color: #e17a73;
}

.timing-track {
  position: relative;
  height: 58px;
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, transparent 0 9.8%, rgba(255, 255, 255, 0.03) 10%),
    #090d14;
  box-shadow: inset 0 6px 18px rgba(0, 0, 0, 0.4);
  cursor: crosshair;
}

.timing-track.is-idle {
  opacity: 0.55;
}

.target-zone {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 42%;
  width: 16%;
  border: 1px solid rgba(255, 231, 166, 0.7);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(239, 204, 121, 0.15), rgba(239, 204, 121, 0.5), rgba(239, 204, 121, 0.15));
  box-shadow: 0 0 25px rgba(239, 204, 121, 0.15);
}

.cursor {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 4px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.85);
  transform: translateX(-50%);
}

.cursor span {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}

.action-button {
  min-width: 210px;
  min-height: 54px;
  padding: 13px 28px;
  border: 1px solid rgba(255, 231, 166, 0.72);
  border-radius: 999px;
  color: #16120b;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 10px 30px rgba(239, 204, 121, 0.16);
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.action-button:hover {
  box-shadow: 0 13px 38px rgba(239, 204, 121, 0.25);
  transform: translateY(-2px);
}

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

.action-button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--jade);
  outline-offset: 4px;
}

.action-button.is-strike {
  color: var(--ink);
  border-color: rgba(201, 84, 77, 0.9);
  background: linear-gradient(135deg, #b94640, #7f2826);
}

.control-hint {
  margin: 14px 0 0;
  color: #757d78;
  font-size: 0.78rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 8px 0;
  color: #747b76;
  font-size: 0.78rem;
}

footer p {
  margin: 0;
}

footer a {
  color: #aeb6ae;
  text-decoration-color: rgba(174, 182, 174, 0.35);
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .game-shell {
    width: min(100% - 20px, 920px);
    padding-top: 28px;
  }

  .duel-scene {
    height: 190px;
  }

  .fighter-left {
    left: 17%;
  }

  .fighter-right {
    right: 17%;
  }

  .scoreboard div {
    padding-inline: 8px;
  }

  footer {
    align-items: center;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
