:root {
  color-scheme: dark;
  --ink: #ece7da;
  --muted: #928d80;
  --amber: #d8a34a;
  --line: rgba(255, 255, 255, 0.08);
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  background: radial-gradient(120% 90% at 50% 38%, #141821 0%, #0a0c12 46%, #040509 100%);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(216, 163, 74, 0.28);
}

/* 画布容器：固定 4:3，按视口等比缩放 */
.stage {
  position: relative;
  width: min(100vw, calc(100vh * 4 / 3));
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 1px rgba(216, 163, 74, 0.16),
    0 0 0 7px rgba(0, 0, 0, 0.28),
    0 40px 120px rgba(0, 0, 0, 0.8);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* 上下渐隐，保证 HUD 在亮色地板上也能读清 */
.stage::before,
.stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: clamp(64px, 18%, 120px);
  pointer-events: none;
  z-index: 1;
}

.stage::before {
  top: 0;
  background: linear-gradient(180deg, rgba(3, 4, 7, 0.82) 0%, rgba(3, 4, 7, 0) 100%);
}

.stage::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(3, 4, 7, 0.86) 0%, rgba(3, 4, 7, 0) 100%);
}

.chrome {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(12px, 2.4vw, 22px) clamp(14px, 2.8vw, 26px);
  pointer-events: none;
  user-select: none;
}

.chrome--top {
  top: 0;
}

.chrome--bottom {
  bottom: 0;
  align-items: flex-end;
}

.brand {
  display: flex;
  flex-direction: column;
}

.kicker {
  font: 600 9px/1.2 var(--mono);
  letter-spacing: 0.3em;
  color: var(--amber);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
}

.floor {
  margin-top: 7px;
  font-size: clamp(13px, 1.55vw, 17px);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #f1ebdc;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.95);
}

.readout {
  display: flex;
  gap: 7px;
}

.stat {
  min-width: 58px;
  padding: 6px 8px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(6, 8, 12, 0.5);
  backdrop-filter: blur(6px);
}

.stat span {
  display: block;
  font: 500 8px/1 var(--mono);
  letter-spacing: 0.18em;
  color: var(--muted);
}

.stat b {
  display: block;
  margin-top: 4px;
  font: 600 13px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: #e7deca;
}

.legend {
  margin: 0;
  font-size: 10px;
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: #aaa396;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

kbd {
  display: inline-block;
  min-width: 17px;
  margin: 0 1px;
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  background: rgba(12, 14, 19, 0.68);
  font: 500 9px/1 var(--mono);
  color: #d9d2c4;
  text-align: center;
}

.slash {
  margin: 0 6px;
  color: #6f6a60;
}

.label {
  margin-left: 4px;
}

.sep {
  display: inline-block;
  width: 1px;
  height: 9px;
  margin: 0 9px;
  vertical-align: -1px;
  background: rgba(255, 255, 255, 0.14);
}

.meta {
  margin: 0;
  text-align: right;
  font: 500 8px/1.7 var(--mono);
  letter-spacing: 0.14em;
  color: #6d685e;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

@media (max-width: 640px) {
  .meta {
    display: none;
  }

  .legend {
    font-size: 9px;
  }

  .sep {
    margin: 0 6px;
  }
}

@media (max-width: 480px) {
  .keys--arrows,
  .slash {
    display: none;
  }

  .extra {
    display: none;
  }
}

@media (max-width: 420px) {
  .kicker {
    font-size: 8px;
    letter-spacing: 0.22em;
  }

  .floor {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .stat {
    min-width: 48px;
    padding: 5px 6px 4px;
  }

  .stat b {
    font-size: 11px;
  }

  kbd {
    min-width: 15px;
    padding: 2px 3px;
    font-size: 8px;
  }
}
