/* ================= 星核竞技场 · UI ================= */
:root {
  --bg: #050912;
  --bg2: #0a1224;
  --cyan: #5ef2ff;
  --cyan-dim: #2aa7bd;
  --magenta: #ff5ec4;
  --amber: #ffd166;
  --green: #4ef08a;
  --red: #ff5f6d;
  --text: #e9f3ff;
  --muted: #8fa6c4;
  --glass: rgba(12, 20, 38, 0.72);
  --stroke: rgba(110, 180, 255, 0.18);
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  touch-action: none;
}

#app { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.hidden { display: none !important; }

/* ================= 主菜单 ================= */
#menu {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(35, 90, 160, 0.35), transparent 60%),
    radial-gradient(900px 600px at 90% 110%, rgba(160, 40, 140, 0.22), transparent 60%),
    linear-gradient(180deg, #04070f 0%, #060b18 45%, #04070f 100%);
  overflow: hidden;
}

.menu-grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(94, 242, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 242, 255, 0.07) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(600px) rotateX(62deg) translateY(12%);
  mask-image: radial-gradient(60% 60% at 50% 45%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(60% 60% at 50% 45%, #000 0%, transparent 78%);
  animation: gridDrift 22s linear infinite;
  opacity: 0.85;
  pointer-events: none;
}
@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 58px, 58px 0; }
}

.menu-glow {
  position: absolute;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}
.menu-glow.g1 { background: rgba(40, 180, 255, 0.28); top: -260px; left: -160px; animation: float1 16s ease-in-out infinite; }
.menu-glow.g2 { background: rgba(255, 60, 170, 0.20); bottom: -300px; right: -180px; animation: float2 19s ease-in-out infinite; }
@keyframes float1 { 50% { transform: translate(60px, 40px) scale(1.08); } }
@keyframes float2 { 50% { transform: translate(-50px, -40px) scale(1.1); } }

.menu-inner {
  position: relative;
  z-index: 3;
  width: min(760px, 94vw);
  max-height: 100vh;
  padding: 22px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
.menu-inner::-webkit-scrollbar { display: none; }

.brand { text-align: center; position: relative; }

.brand-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--cyan);
  border: 1px solid rgba(94, 242, 255, 0.35);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 10px;
  background: rgba(94, 242, 255, 0.07);
  box-shadow: 0 0 22px rgba(94, 242, 255, 0.18) inset;
}

.logo {
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 800;
  letter-spacing: 9px;
  color: #bfe9ff;
  opacity: 0.85;
}
.logo span { color: var(--magenta); margin-left: 6px; letter-spacing: 5px; }

.brand h1 {
  margin: 6px 0 6px;
  font-size: clamp(34px, 6.4vw, 58px);
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(100deg, #ffffff 0%, #9fe8ff 38%, #5ef2ff 55%, #ff9ade 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(94, 242, 255, 0.35));
}

.brand .tag {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1.6px;
}

.panel {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  padding: 18px 18px 16px;
}

.field { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.field label {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--muted);
  white-space: nowrap;
}
.field input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: rgba(3, 8, 18, 0.75);
  border: 1px solid rgba(110, 180, 255, 0.22);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  user-select: text;
}
.field input:focus {
  border-color: rgba(94, 242, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(94, 242, 255, 0.12), 0 0 22px rgba(94, 242, 255, 0.18);
}

.mode-title {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--muted);
  margin: 4px 0 10px;
}

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 13px 13px 12px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(110, 180, 255, 0.16);
  background: linear-gradient(160deg, rgba(18, 30, 56, 0.7), rgba(8, 14, 28, 0.85));
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s, background 0.16s;
  overflow: hidden;
}
.mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(94, 242, 255, 0.16), transparent 55%);
  opacity: 0;
  transition: opacity 0.2s;
}
.mode-card:hover { transform: translateY(-2px); border-color: rgba(94, 242, 255, 0.36); }
.mode-card:hover::after { opacity: 0.7; }
.mode-card.active {
  border-color: rgba(94, 242, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(94, 242, 255, 0.25), 0 12px 34px rgba(20, 140, 200, 0.28), 0 0 26px rgba(94, 242, 255, 0.14) inset;
  background: linear-gradient(160deg, rgba(24, 62, 96, 0.85), rgba(10, 18, 34, 0.9));
}
.mode-card.active::after { opacity: 1; }

.mc-ico { font-size: 17px; color: var(--cyan); line-height: 1; }
.mc-name { font-size: 15px; font-weight: 700; letter-spacing: 1.5px; }
.mc-desc { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

.cta {
  position: relative;
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #02121a;
  background: linear-gradient(100deg, #7dfaff 0%, #5ef2ff 32%, #7fd0ff 62%, #ff9ade 100%);
  box-shadow: 0 10px 30px rgba(60, 200, 255, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  overflow: hidden;
  transition: transform 0.14s, box-shadow 0.18s, filter 0.18s;
}
.cta span { position: relative; z-index: 2; }
.cta::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-18deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.cta:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 38px rgba(60, 200, 255, 0.45); }
.cta:active { transform: translateY(1px) scale(0.995); }
.cta:disabled { filter: grayscale(0.6) brightness(0.7); cursor: wait; }
.cta.small { height: 46px; font-size: 15px; letter-spacing: 3px; width: auto; padding: 0 26px; }

.tips { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.tip-row { font-size: 11.5px; color: var(--muted); line-height: 1.6; letter-spacing: 0.2px; }
.tip-row b { color: var(--cyan); font-weight: 700; margin-right: 6px; letter-spacing: 1px; }

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #6b7b93;
  box-shadow: 0 0 10px currentColor;
  transition: background 0.3s;
}
.dot.ok { background: var(--green); box-shadow: 0 0 12px var(--green); }
.dot.bad { background: var(--red); box-shadow: 0 0 12px var(--red); }
.sep { opacity: 0.3; }
.mini {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.mini:hover { background: rgba(94, 242, 255, 0.12); }

/* ================= 结算 ================= */
#result {
  background: rgba(3, 7, 15, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 30;
}
.result-box {
  width: min(680px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: pop 0.32s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.result-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 6px;
  text-align: center;
  background: linear-gradient(100deg, #fff, #8ee6ff, #ff9ade);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 16px; letter-spacing: 1px; }

.table-wrap { overflow-x: auto; }
#resultTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#resultTable th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--stroke);
}
#resultTable td { padding: 9px 10px; border-bottom: 1px solid rgba(110, 180, 255, 0.07); }
#resultTable tr.me td { background: rgba(94, 242, 255, 0.09); }
#resultTable td.rank { font-weight: 800; color: var(--amber); width: 34px; }
#resultTable td.name { font-weight: 700; }
#resultTable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 14px;
  padding: 0 22px;
  height: 46px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 2px;
}
.ghost:hover { border-color: rgba(94, 242, 255, 0.5); color: var(--cyan); }

/* ================= 击杀提示 / 聊天 ================= */
#killfeed {
  position: absolute;
  top: 74px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 12;
  pointer-events: none;
}
.kf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(6, 12, 24, 0.72);
  border: 1px solid rgba(110, 180, 255, 0.16);
  font-size: 12px;
  letter-spacing: 0.4px;
  animation: slideIn 0.24s ease-out;
  backdrop-filter: blur(6px);
}
@keyframes slideIn { from { transform: translateX(-18px); opacity: 0; } }
.kf .k { color: var(--cyan); font-weight: 700; }
.kf .v { color: #ff8f8f; }
.kf .x { color: var(--muted); opacity: 0.8; }
.kf .st { color: var(--amber); font-weight: 800; }

#chatlog {
  position: absolute;
  left: 16px;
  bottom: 118px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 12;
  pointer-events: none;
  max-width: 46vw;
}
.chat-item {
  font-size: 12px;
  color: #cfe4ff;
  background: rgba(6, 12, 24, 0.6);
  border-left: 2px solid var(--cyan);
  padding: 3px 9px;
  border-radius: 0 8px 8px 0;
  animation: slideIn 0.2s ease-out;
}
.chat-item b { color: var(--cyan); }

#chatwrap {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(420px, 80vw);
}
#chatInput {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(6, 12, 24, 0.92);
  border: 1px solid rgba(94, 242, 255, 0.5);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  user-select: text;
}

#toast {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast-item {
  padding: 7px 18px;
  border-radius: 999px;
  background: rgba(8, 16, 30, 0.86);
  border: 1px solid rgba(94, 242, 255, 0.35);
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 2px;
  box-shadow: 0 0 24px rgba(94, 242, 255, 0.18);
  animation: toastIn 0.24s ease-out;
}
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }

/* ================= 载入 / 横屏提示 ================= */
#boot { background: #04070f; z-index: 50; }
.boot-text { color: var(--cyan); letter-spacing: 6px; font-size: 14px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

#rotate {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(8, 16, 30, 0.86);
  border: 1px solid rgba(94, 242, 255, 0.28);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1.5px;
  z-index: 26;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.rotate-icon { font-size: 15px; color: var(--cyan); animation: spin 3.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 手机适配 ================= */
@media (max-width: 760px) {
  .menu-inner { padding: 14px 12px 12px; gap: 12px; width: 100%; }
  .panel { padding: 14px; border-radius: 16px; }
  .brand h1 { font-size: clamp(28px, 9vw, 40px); letter-spacing: 4px; }
  .logo { letter-spacing: 6px; font-size: 13px; }
  .brand .tag { font-size: 11px; letter-spacing: 0.8px; }
  .modes { grid-template-columns: 1fr; gap: 8px; }
  .mode-card { flex-direction: row; align-items: center; gap: 10px; padding: 11px 12px; }
  .mc-desc { display: none; }
  .mc-name { font-size: 14px; }
  .cta { height: 50px; font-size: 16px; letter-spacing: 4px; }
  .field { flex-direction: column; align-items: stretch; gap: 6px; }
  .field label { letter-spacing: 2px; font-size: 11px; }
  .field input { height: 42px; }
  .tip-row { font-size: 10.5px; }
  #killfeed { top: 64px; left: 8px; }
  .kf { font-size: 10.5px; padding: 4px 8px; }
  #chatlog { left: 8px; bottom: 132px; max-width: 70vw; }
  .result-box { padding: 16px; border-radius: 16px; }
  .result-title { font-size: 20px; letter-spacing: 4px; }
  #resultTable { font-size: 12px; }
  #resultTable th, #resultTable td { padding: 7px 6px; }
}

@media (max-height: 460px) and (orientation: landscape) {
  .brand h1 { font-size: 26px; }
  .brand .tag, .tips { display: none; }
  .panel { padding: 10px 12px; }
  .cta { height: 42px; }
  .field { margin-bottom: 8px; }
  .mode-card { padding: 8px 10px; }
  .menu-inner { gap: 8px; }
}
