* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --amber: #ffa63d;
  --amber-soft: #ffcf8a;
  --ink: #e9f0f6;
  --muted: #8fa3b5;
  --line: rgba(255, 255, 255, .1);
  --panel: rgba(17, 23, 29, .92);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080b0e;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }
#app.playing { cursor: none; }
#scene { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }

/* ---------- 受击红晕 ---------- */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(255, 40, 30, .55) 100%);
  transition: opacity .35s ease;
}
#vignette.hit {
  opacity: 1;
  transition: opacity .05s ease;
}

/* ---------- 准星 ---------- */
#crosshair {
  position: fixed;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  pointer-events: none;
  z-index: 20;
  border: 1px solid rgba(255, 166, 61, .38);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 166, 61, .95) 0 2px, transparent 2.6px);
}
#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 166, 61, .9);
}
#crosshair::before { left: 50%; top: -4px; width: 2px; height: calc(100% + 8px); margin-left: -1px; opacity: .55; }
#crosshair::after { top: 50%; left: -4px; height: 2px; width: calc(100% + 8px); margin-top: -1px; opacity: .55; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hud-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 18px;
  padding: 20px 26px;
}

.hud-left { max-width: 320px; }

.hp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.label {
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--muted);
}

.hp-text {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #cfdbe6;
  letter-spacing: .04em;
}

.bar {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar .ghost,
.bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 100%;
  border-radius: 2px;
}
.bar .ghost {
  background: rgba(255, 255, 255, .32);
  transition: width .5s ease .18s;
}
.bar .fill {
  background: linear-gradient(90deg, #9bd35a, #ffb03a);
  transition: width .16s ease-out, background .3s;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 26px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1;
  animation: chipIn .28s ease both;
}
.chip i {
  font-style: normal;
  font-size: 10px;
  color: var(--amber-soft);
  font-variant-numeric: tabular-nums;
}
@keyframes chipIn {
  from { opacity: 0; transform: translateY(-4px) scale(.9); }
  to { opacity: 1; transform: none; }
}

.hud-center { text-align: center; }

/* 挑战词条标签 */
.modifier {
  margin-top: 6px;
  display: inline-block;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--amber-soft);
  background: rgba(255, 166, 61, .1);
  border: 1px solid rgba(255, 166, 61, .25);
  border-radius: 6px;
  padding: 3px 10px;
}

.wave-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px 9px;
  border-radius: 10px;
  background: rgba(12, 18, 23, .72);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.wave-label {
  font-size: 9px;
  letter-spacing: .28em;
  color: var(--muted);
}
.wave-chip b {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 166, 61, .5);
}
.enemy-left {
  font-style: normal;
  font-size: 10px;
  color: #7d90a0;
  letter-spacing: .06em;
}
.enemy-left em {
  font-style: normal;
  color: var(--amber-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- Boss 血条 ---------- */
.boss-bar {
  position: absolute;
  top: 104px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 64vw);
  padding: 8px 12px 9px;
  border-radius: 9px;
  background: rgba(12, 18, 23, .78);
  border: 1px solid rgba(255, 74, 58, .35);
  backdrop-filter: blur(7px);
  animation: bossIn .3s ease both;
}
@keyframes bossIn {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.boss-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 6px;
}
.boss-tag {
  font-size: 8px;
  letter-spacing: .22em;
  padding: 2px 5px;
  border-radius: 3px;
  color: #ffd7d2;
  background: rgba(255, 74, 58, .28);
  border: 1px solid rgba(255, 74, 58, .5);
}
#boss-name {
  font-size: 14px;
  letter-spacing: .08em;
  color: #ffe9e4;
  text-shadow: 0 0 12px rgba(255, 74, 58, .55);
}
#boss-hp-text {
  margin-left: auto;
  font-size: 10px;
  color: #b99b95;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}
.boss-track {
  height: 10px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .09);
  overflow: hidden;
}
#boss-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff3a2a, #ff9a3d);
  box-shadow: 0 0 12px rgba(255, 74, 58, .55);
  transition: width .12s linear;
}
.boss-bar[data-kind="prism"] {
  border-color: rgba(56, 216, 255, .35);
}
.boss-bar[data-kind="prism"] .boss-tag {
  color: #d4f8ff;
  background: rgba(56, 216, 255, .22);
  border-color: rgba(56, 216, 255, .5);
}
.boss-bar[data-kind="prism"] #boss-name {
  color: #e2fbff;
  text-shadow: 0 0 12px rgba(56, 216, 255, .6);
}
.boss-bar[data-kind="prism"] #boss-fill {
  background: linear-gradient(90deg, #1fb6e8, #7bf0d0);
  box-shadow: 0 0 12px rgba(56, 216, 255, .55);
}
.boss-bar.enraged {
  animation: bossEnrage .65s ease-in-out infinite alternate;
}
.boss-bar.enraged #boss-fill {
  background: linear-gradient(90deg, #ff2a1a, #ff5a3a);
}
@keyframes bossEnrage {
  from { border-color: rgba(255, 74, 58, .35); }
  to { border-color: rgba(255, 74, 58, .95); }
}

.hud-right { display: flex; justify-content: flex-end; gap: 26px; }
.stat { text-align: right; }
.stat span {
  display: block;
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--muted);
  margin-bottom: 3px;
}
.stat b {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255, 166, 61, .3);
}

.weapon-hud {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: 208px;
  text-align: center;
  padding: 8px 10px 9px;
  border-radius: 9px;
  background: rgba(12, 18, 23, .66);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

/* ---- 小地图 ---- */
.minimap-wrap {
  position: absolute;
  right: 22px;
  bottom: 22px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(12, 18, 23, .62);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38);
  line-height: 0;
}
#minimap { display: block; border-radius: 5px; }
.weapon-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: .05em;
}
.weapon-line span { font-size: 14px; line-height: 1; }
.weapon-line b { font-weight: 700; color: #eaf2f8; }
.weapon-line i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .12em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .06);
}
.reload {
  width: 100%;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
#reload-fill {
  height: 100%;
  width: 100%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 166, 61, .85);
  transform-origin: left;
}
.heat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--muted);
}
.heat-row.over { color: #ff6a4a; }
.heat-bar {
  flex: 1;
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
#heat-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #38d8ff, #7bf0d0);
  box-shadow: 0 0 8px rgba(56, 216, 255, .7);
  transition: width .08s linear, background .2s;
}
#heat-fill.hot {
  background: linear-gradient(90deg, #ffb03a, #ff7a3a);
  box-shadow: 0 0 8px rgba(255, 138, 58, .8);
}
#heat-fill.over {
  background: linear-gradient(90deg, #ff5a3a, #d01e1e);
  box-shadow: 0 0 10px rgba(255, 60, 40, .9);
}

.center-msg {
  position: absolute;
  left: 0;
  right: 0;
  top: 24%;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--amber-soft);
  text-shadow: 0 6px 30px rgba(0, 0, 0, .85);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}
.center-msg.show { opacity: 1; transform: none; }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 42%, rgba(18, 26, 33, .74), rgba(4, 7, 9, .95));
  backdrop-filter: blur(4px);
  animation: fadeIn .22s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(92vw, 460px);
  padding: 38px 34px 30px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 39, 47, .94), rgba(14, 19, 24, .98));
  border: 1px solid rgba(255, 166, 61, .2);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .06);
  text-align: center;
  animation: panelIn .3s cubic-bezier(.2, .9, .3, 1.1) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.panel h1 {
  font-size: 34px;
  letter-spacing: .1em;
  font-weight: 800;
  background: linear-gradient(180deg, #fff, #ffcf8a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.panel h2 {
  font-size: 26px;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.panel h2.fail { color: #ff7a5c; }

.logo-line {
  width: 46px;
  height: 3px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}

.sub {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .12em;
  margin: 8px 0 24px;
}

.keys {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 24px;
}
.keys li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: #b9c8d4;
}
.keys span { margin-left: 8px; color: #7a8e9f; }

/* ---------- 车体选择 ---------- */
.chassis-block { margin-bottom: 22px; }
.chassis-title {
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--amber-soft);
  margin-bottom: 10px;
}
.chassis-title span { color: var(--muted); letter-spacing: 0; }
.chassis-title kbd {
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
}
.chassis-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chassis-card {
  position: relative;
  padding: 10px 8px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.chassis-card:hover { background: rgba(255, 166, 61, .08); transform: translateY(-1px); }
.chassis-card.sel {
  border-color: var(--amber);
  background: rgba(255, 166, 61, .12);
  box-shadow: 0 0 0 1px var(--amber), 0 6px 18px rgba(255, 166, 61, .15);
}
.chassis-card .chassis-key {
  position: absolute;
  top: 5px; left: 7px;
  font-size: 10px;
  color: var(--muted);
}
.chassis-card.sel .chassis-key { color: var(--amber); }
.chassis-card .chassis-icon { font-size: 20px; display: block; margin-bottom: 3px; }
.chassis-card b { display: block; font-size: 13px; letter-spacing: .04em; }
.chassis-card i {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.chassis-card em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--amber-soft);
  margin-top: 2px;
}
.start-panel { width: min(92vw, 520px); }

/* ---------- 呼号与开始按钮 ---------- */
.callsign {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.callsign input {
  width: 150px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  outline: none;
}
.callsign input:focus { border-color: var(--amber); }

.callsign-err {
  margin: -10px 0 12px;
  font-size: 12px;
  color: #ff8a6a;
}
.callsign input.shake { animation: shake .4s ease; border-color: #ff6a4a; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.link {
  color: var(--amber-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link:hover { color: var(--amber); }

/* ---------- 排行榜面板 ---------- */
.lb-panel { width: min(94vw, 480px); }
.lb-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 14px;
  letter-spacing: .04em;
}
.lb-source { color: var(--amber-soft); }

/* 排行榜说明 / 结算页成绩去向提示 */
.lb-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: -6px 0 14px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(255, 166, 61, .07);
  border-left: 2px solid rgba(255, 166, 61, .45);
}
.go-note {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--amber-soft);
  margin: 10px 0 0;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(255, 166, 61, .08);
  border: 1px solid rgba(255, 166, 61, .22);
}
.go-note.hidden { display: none; }
.go-note.warn {
  color: #ffb4a4;
  background: rgba(255, 90, 70, .09);
  border-color: rgba(255, 90, 70, .3);
}

/* 排行榜模式切换（每日挑战 / 训练） */
.lb-modes {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.lb-mode {
  padding: 7px 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
.lb-mode + .lb-mode { border-left: 1px solid var(--line); }
.lb-mode:hover { color: var(--ink); }
.lb-mode.sel {
  background: rgba(255, 166, 61, .16);
  color: var(--amber-soft);
  font-weight: 600;
}

.lb-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}
.lb-tab {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
.lb-tab:hover { color: var(--ink); border-color: rgba(255, 166, 61, .4); }
.lb-tab.sel {
  background: rgba(255, 166, 61, .14);
  border-color: var(--amber);
  color: var(--amber-soft);
}
.lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 2px;
}
.lb-list li {
  display: grid;
  grid-template-columns: 26px 1fr 64px 66px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .03);
  font-size: 12.5px;
  text-align: left;
}
.lb-list li i { font-style: normal; color: var(--muted); }
.lb-list li b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list li span { color: var(--muted); text-align: right; }
.lb-list li em { font-style: normal; color: var(--amber-soft); text-align: right; font-weight: 700; }
.lb-list li.me { background: rgba(255, 166, 61, .12); outline: 1px solid rgba(255, 166, 61, .35); }
.lb-list li.lb-day { cursor: pointer; grid-template-columns: 26px 1fr auto; }
.lb-list li.lb-day:hover { background: rgba(255, 166, 61, .09); }
.lb-list li.lb-empty { display: block; text-align: center; color: var(--muted); background: none; padding: 22px 0; }
.ghost-btn {
  padding: 9px 26px;
  border-radius: 9px;
  border: 1px solid rgba(255, 166, 61, .4);
  background: transparent;
  color: var(--amber-soft);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.ghost-btn:hover { background: rgba(255, 166, 61, .1); }
.start-btns { display: flex; gap: 10px; justify-content: center; }
.start-btns button {
  padding: 13px 30px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #ffb45c, #f08a1d);
  color: #1a1206;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s ease, filter .12s ease;
}
.start-btns button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.start-btns button:active { transform: translateY(1px); }
#daily-btn {
  background: transparent;
  border-color: rgba(255, 166, 61, .45);
  color: var(--amber-soft);
  font-weight: 600;
}

/* ---------- 每日排行榜 ---------- */
.lb { margin: 4px 0 14px; }
.lb-title {
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--amber-soft);
  margin-bottom: 8px;
}
.lb ol { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.lb li {
  display: grid;
  grid-template-columns: 26px 1fr 64px 62px;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .03);
  font-size: 12.5px;
  text-align: left;
}
.lb li i { font-style: normal; color: var(--muted); }
.lb li b { font-weight: 600; }
.lb li span { color: var(--muted); text-align: right; }
.lb li em { font-style: normal; color: var(--amber-soft); text-align: right; font-weight: 700; }
.lb li.me { background: rgba(255, 166, 61, .12); outline: 1px solid rgba(255, 166, 61, .35); }

/* 分组标题（"今日"/"历史总榜"）：.lb li 是四列 grid，标题必须脱离 grid，
   否则四个字会被挤进第一列（26px），变成竖排两行 */
.lb li.lb-group {
  display: block;
  padding: 10px 10px 2px;
  background: none;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--muted);
}
.lb li.lb-group:first-child { padding-top: 0; }

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 4px 7px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
  color: #ffe1c2;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .16);
  border-bottom-width: 2px;
}

.best {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 9px 14px;
  border-radius: 9px;
  background: rgba(255, 166, 61, .08);
  border: 1px solid rgba(255, 166, 61, .2);
  font-size: 12px;
  color: #b9a382;
}
.best b {
  color: var(--amber-soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

button {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .14em;
  color: #1a1206;
  background: linear-gradient(180deg, #ffc266, #ff8a3d);
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(255, 138, 61, .28);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
button:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(255, 138, 61, .4); filter: brightness(1.04); }
button:active { transform: translateY(0); }

.tip {
  margin-top: 16px;
  font-size: 11px;
  color: #6d8090;
  letter-spacing: .06em;
}
.tip b { color: var(--amber-soft); }

/* ---------- 三选一 ---------- */
.reward-panel {
  width: min(94vw, 880px);
  text-align: center;
}
.reward-head { margin-bottom: 26px; }
.reward-kicker {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--amber);
  padding: 4px 10px;
  border-radius: 5px;
  background: rgba(255, 166, 61, .1);
  border: 1px solid rgba(255, 166, 61, .24);
  margin-bottom: 14px;
}
.reward-kicker b { font-variant-numeric: tabular-nums; }
.reward-head h2 {
  font-size: 28px;
  letter-spacing: .14em;
  margin-bottom: 8px;
}
.reward-sub { font-size: 12px; color: var(--muted); letter-spacing: .06em; }

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

.card {
  position: relative;
  width: 100%;
  padding: 26px 16px 18px;
  border-radius: 14px;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(34, 44, 54, .96), rgba(15, 20, 26, .98));
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  animation: cardIn .3s cubic-bezier(.2, .9, .3, 1.1) both;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--rarity, #93a7b8);
  box-shadow: 0 0 16px var(--rarity, #93a7b8);
  opacity: .95;
}
.card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 60%;
  background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--rarity, #93a7b8) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }

.card:hover {
  transform: translateY(-8px);
  border-color: var(--rarity, #93a7b8);
  box-shadow: 0 24px 50px -16px var(--rarity, #93a7b8);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: none; }
}

.card-rarity {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  font-size: 9.5px;
  letter-spacing: .28em;
  color: var(--rarity, #93a7b8);
  opacity: .9;
}
.card-icon {
  font-size: 32px;
  line-height: 1;
  margin-top: 6px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5));
}
.card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  margin: 12px 0 6px;
}
.card-desc {
  font-size: 12px;
  line-height: 1.6;
  color: #9fb1c0;
  min-height: 38px;
}
.card-lv {
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: .14em;
  color: #6d8090;
  font-variant-numeric: tabular-nums;
}
.card-key {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  line-height: 17px;
  border-radius: 4px;
  font-size: 10px;
  color: #8fa3b5;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}

.reward-hint {
  margin-top: 20px;
  font-size: 11px;
  color: #6d8090;
  letter-spacing: .08em;
}
.reward-hint kbd { margin: 0 2px; }

/* ---------- 结算 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 22px 0 26px;
}
.stats-grid div {
  padding: 12px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
}
.stats-grid span {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--muted);
  margin-bottom: 5px;
}
.stats-grid b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.new-record {
  display: inline-block;
  margin: 4px 0 2px;
  font-size: 12px;
  letter-spacing: .18em;
  color: #ffd479;
  text-shadow: 0 0 18px rgba(255, 190, 80, .7);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .hud-top { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .hud-center { display: none; }
  .boss-bar { top: 74px; width: min(440px, 88vw); }
  .hud-left { max-width: 180px; }
  .hud-right { gap: 14px; }
  .stat b { font-size: 16px; }
  .center-msg { font-size: 22px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; text-align: left; padding: 14px 16px; }
  .card-rarity { position: static; grid-column: 2; }
  .card-icon { grid-row: 1 / span 2; font-size: 26px; margin: 0; align-self: center; }
  .card-name { margin: 0 0 2px; }
  .card-desc { min-height: 0; }
  .card-lv { position: absolute; right: 14px; bottom: 12px; margin: 0; }
  .card-key { display: none; }
  .panel { padding: 28px 20px 24px; }
  .panel h1 { font-size: 26px; }
  .reward-head h2 { font-size: 22px; }
  .minimap-wrap { right: 10px; bottom: 104px; padding: 4px; }
}

/* ---------- 好友挑战：开局横幅 ---------- */
.ch-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 166, 61, .38);
  background: linear-gradient(90deg, rgba(255, 166, 61, .14), rgba(255, 166, 61, .03));
}
.ch-tag {
  font-size: 10.5px;
  letter-spacing: .12em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--amber);
  color: #1a1206;
  font-weight: 700;
}
.ch-banner b {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .14em;
  color: var(--amber-soft);
  font-size: 14px;
}
.ch-banner i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  flex-basis: 100%;
}

/* 挑战局锁定车体：其它卡片压暗但保留信息 */
.chassis-cards.locked .chassis-card:not(.sel) {
  opacity: .34;
  filter: grayscale(.7);
  pointer-events: none;
}

/* ---------- 榜单：我的名次 + 车体徽章 ---------- */
.lb-me {
  margin: -4px 0 10px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--amber-soft);
  background: rgba(255, 166, 61, .1);
  border: 1px solid rgba(255, 166, 61, .28);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.lb-me b { color: var(--ink); }
.lb-me.miss { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line); }

.lb-list li b { display: flex; align-items: center; gap: 6px; }
.chd {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 9.5px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
  color: #0d0f11;
  background: var(--muted);
}
.chd.c-balanced { background: #8fae5c; }
.chd.c-light { background: #6f9ab5; }
.chd.c-heavy { background: #b0b39c; }
.chd.c-hunter { background: #c79a5a; }
.lb-list li span small { display: block; font-size: 10px; color: rgba(143, 163, 181, .7); }

/* 多人局的人数额标（单人局不显示，避免整榜都是"单人"） */
.lb-list li b .lb-team {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  color: rgba(255, 255, 255, .66);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  text-align: center;
}

/* ---------- 结算：分享挑战 ---------- */
.ch-share {
  margin: 16px 0 4px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 166, 61, .32);
  background: rgba(255, 166, 61, .05);
}
.ch-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.ch-share-head b {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .14em;
  color: var(--amber-soft);
  font-size: 13.5px;
}
.ch-share-tip {
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 10px;
}
.ch-share .ghost-btn { width: 100%; }

/* ---------- 组队大厅 ---------- */
.lobby-panel { width: min(94vw, 460px); }
.lobby-panel h2 { margin-bottom: 6px; }

#lobby-choose { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 8px; }
#lobby-create { width: 100%; }

.lobby-join { display: flex; gap: 8px; }
#room-code {
  flex: 1;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 16px;
  letter-spacing: .3em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  user-select: text;
}
#room-code:focus { border-color: var(--amber); }
.lobby-join .ghost-btn { padding: 10px 18px; }

.room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 166, 61, .08);
  border: 1px solid rgba(255, 166, 61, .3);
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
}
.room-head b {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 19px;
  letter-spacing: .34em;
  color: var(--amber-soft);
  margin-right: auto;
}
.mini-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(255, 166, 61, .45);
  background: transparent;
  color: var(--amber-soft);
  cursor: pointer;
}
.mini-btn:hover { background: rgba(255, 166, 61, .14); }

.room-players {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.room-players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
}
.room-players li.empty { color: rgba(143, 163, 181, .55); border: 1px dashed var(--line); background: none; }
.room-players li.me { outline: 1px solid rgba(255, 166, 61, .4); background: rgba(255, 166, 61, .1); }
.room-players .room-tag { margin-left: auto; color: var(--muted); font-size: 12px; }
.room-host {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #1a1206;
  background: var(--amber);
}

/* 战斗中的房间浮层：不挡视线，但随时能喊朋友进来 */
.room-chip {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(8, 12, 16, .62);
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  pointer-events: none;
  z-index: 6;
}
.room-chip b { color: var(--amber-soft); letter-spacing: .18em; font-size: 14px; }
.room-chip i { font-style: normal; color: var(--ink); }

.lobby-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
}
.lobby-actions { display: flex; gap: 8px; }
.lobby-actions button { flex: 1; }

/* ---------- 无 WebGL 时的兜底提示 ---------- */
/* 无 WebGL 的提示：底部中间已经被武器条和小地图占满，放到画布纵向中部才不会压字 */
.gl-fallback {
  position: absolute;
  inset: 40% 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  width: fit-content;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 14, 20, .72);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 5;
}
.gl-fallback b { color: var(--amber-soft); font-size: 13px; }
.gl-fallback span { color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
