:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --bg: #0b0912;
  --panel: rgba(24, 20, 38, 0.88);
  --line: rgba(255, 255, 255, 0.11);
  --cream: #fff6db;
  --muted: #a8a1b8;
  --amber: #ffc857;
  --orange: #ff7a3d;
  --cyan: #64e6e2;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% -10%, rgba(87, 58, 133, 0.26), transparent 44%),
    linear-gradient(145deg, #07060c 0%, #100d19 52%, #080711 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.18;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle, black 20%, transparent 80%);
}

.game-shell {
  width: min(1460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 24px;
}

.topbar,
.hud,
.controls {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border: 2px solid var(--amber);
  border-radius: 50% 50% 44% 44%;
  box-shadow: 0 0 24px rgba(255, 200, 87, 0.4), inset 0 0 16px rgba(255, 200, 87, 0.12);
}

.brand-mark::after {
  position: absolute;
  bottom: -7px;
  left: 11px;
  width: 16px;
  height: 9px;
  content: "";
  border-top: 2px solid var(--amber);
  border-bottom: 2px solid var(--amber);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--amber);
  font-family: Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 800;
  letter-spacing: 0.09em;
}

.stage-readout {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stage-readout strong {
  color: var(--cream);
  font-family: Consolas, monospace;
  font-size: 30px;
  line-height: 1;
}

.stage-readout small {
  margin-left: 4px;
  color: #716a83;
  font-size: 13px;
}

.hud {
  gap: 10px;
  margin-bottom: 10px;
}

.ability-bar {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 7px;
}

.ability-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  gap: 8px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(22, 18, 34, 0.88);
  cursor: pointer;
  transition: border-color 160ms, background 160ms, opacity 160ms;
}

.ability-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.ability-card.ready {
  border-color: rgba(100, 230, 226, 0.34);
  background: rgba(23, 33, 43, 0.92);
}

.ability-card.active {
  border-color: rgba(255, 200, 87, 0.62);
  box-shadow: inset 0 0 22px rgba(255, 200, 87, 0.08);
}

.ability-card.disabled { opacity: 0.45; }
.ability-card.ultimate { border-color: rgba(255, 122, 61, 0.34); }
.ability-card.return-card { border-color: rgba(100, 230, 226, 0.24); }
.ability-card.upgrade-card { border-color: rgba(198, 143, 255, 0.3); }
.ability-card.freeze-card { border-color: rgba(120, 190, 255, 0.34); }

.ability-card kbd {
  min-width: 29px;
  height: 29px;
  padding: 6px 5px;
  color: var(--cyan);
  font-size: 12px;
}

.ability-card span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.ability-card b,
.ability-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-card b { font-size: 11px; }
.ability-card small { color: var(--muted); font: 10px Consolas, monospace; }

.stat-strip {
  display: flex;
  margin-bottom: 8px;
  padding: 5px 10px;
  gap: 18px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 7px;
  color: #857e94;
  background: rgba(12, 10, 19, 0.72);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.stat-strip b { margin-left: 4px; color: var(--cream); font-family: Consolas, monospace; }

.hp-panel,
.skill-panel {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.hp-panel {
  flex: 1;
  padding: 12px 14px;
}

.panel-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.panel-label span {
  color: var(--muted);
}

.panel-label b {
  font-family: Consolas, monospace;
  font-size: 13px;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--amber));
  box-shadow: 0 0 14px rgba(255, 122, 61, 0.62);
  transition: width 100ms linear;
}

.skill-panel {
  position: relative;
  display: flex;
  width: 300px;
  padding: 9px 13px;
  gap: 11px;
  align-items: center;
  overflow: hidden;
}

.skill-panel::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(100deg, transparent, rgba(100, 230, 226, 0.13), transparent);
  transform: translateX(-100%);
}

.skill-panel.ready::before {
  opacity: 1;
  animation: sweep 2.4s infinite;
}

@keyframes sweep {
  to { transform: translateX(100%); }
}

.keycap,
kbd {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: linear-gradient(#2f2940, #1a1725);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 2px 0 #08070d;
  font-family: Consolas, monospace;
  font-weight: 800;
}

.keycap {
  display: grid;
  z-index: 1;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--cyan);
  font-size: 18px;
}

.skill-copy {
  z-index: 1;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.skill-copy span {
  color: var(--muted);
  font-size: 11px;
}

.skill-copy b {
  overflow: hidden;
  font-family: Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-ring {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) 360deg, rgba(255,255,255,0.08) 0);
}

.skill-ring::after {
  position: absolute;
  inset: 4px;
  content: "";
  border-radius: 50%;
  background: #171421;
}

.canvas-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  background: #090812;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.48), inset 0 0 40px rgba(0, 0, 0, 0.5);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  cursor: crosshair;
  outline: none;
  user-select: none;
}

.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.corner-tl {
  top: 10px;
  left: 10px;
  border-top: 2px solid rgba(255, 200, 87, 0.6);
  border-left: 2px solid rgba(255, 200, 87, 0.6);
}

.corner-br {
  right: 10px;
  bottom: 10px;
  border-right: 2px solid rgba(255, 200, 87, 0.6);
  border-bottom: 2px solid rgba(255, 200, 87, 0.6);
}

.announcement {
  position: absolute;
  top: 22px;
  left: 50%;
  min-width: 230px;
  padding: 9px 22px;
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-radius: 99px;
  opacity: 0;
  color: var(--cream);
  background: rgba(13, 11, 22, 0.78);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 180ms, transform 180ms;
}

.announcement.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.upgrade-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(7, 6, 13, 0.78);
  backdrop-filter: blur(7px);
}

.upgrade-modal.open { display: grid; }

.upgrade-box {
  width: min(820px, calc(100% - 44px));
  padding: 28px;
  border: 1px solid rgba(198, 143, 255, 0.38);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(31,25,47,0.98), rgba(17,14,27,0.98));
  box-shadow: 0 28px 90px rgba(0,0,0,0.65);
  text-align: center;
}

.upgrade-box > p {
  margin: 0 0 5px;
  color: #c68fff;
  font: 700 11px Consolas, monospace;
  letter-spacing: 0.18em;
}

.upgrade-box h2 { margin: 0 0 22px; font-size: 25px; }
.upgrade-box > small { display: block; margin-top: 16px; color: #7e768e; }

.upgrade-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.upgrade-option {
  min-height: 136px;
  padding: 17px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: var(--cream);
  background: rgba(255,255,255,0.035);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms, border-color 150ms, background 150ms;
}

.upgrade-option:hover,
.upgrade-option:focus-visible {
  border-color: rgba(255,200,87,0.58);
  background: rgba(255,200,87,0.07);
  outline: none;
  transform: translateY(-3px);
}

.upgrade-option em {
  display: grid;
  width: 27px;
  height: 27px;
  margin-bottom: 17px;
  place-items: center;
  border-radius: 6px;
  color: #0d0b15;
  background: var(--amber);
  font: 800 12px Consolas, monospace;
}

.upgrade-option b { display: block; margin-bottom: 7px; font-size: 15px; }
.upgrade-option span { color: var(--muted); font-size: 11px; line-height: 1.55; }

.controls {
  gap: 22px;
  min-height: 56px;
  padding: 11px 4px 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.controls > div {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

kbd {
  min-width: 24px;
  padding: 4px 7px;
  color: #ded8ea;
  font-size: 10px;
  text-align: center;
}

.controls p {
  margin: 0 0 0 auto;
  color: #726b82;
  text-align: right;
}

.mouse-icon {
  position: relative;
  width: 16px;
  height: 23px;
  border: 1px solid #766f86;
  border-radius: 8px;
}

.mouse-icon::before {
  position: absolute;
  top: 3px;
  left: 7px;
  width: 1px;
  height: 6px;
  content: "";
  background: var(--amber);
}

@media (max-width: 840px) {
  .game-shell { width: min(100vw - 16px, 1460px); padding-top: 12px; }
  .skill-panel { width: 245px; }
  .controls { flex-wrap: wrap; gap: 10px 16px; }
  .controls p { width: 100%; margin-left: 0; text-align: left; }
  .ability-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-strip { flex-wrap: wrap; gap: 5px 14px; }
}
