/* ==========================================================================
   SKILLSHOT — 30 秒靶场
   交付形态：手机版优先（单列、安全区适配、无横向滚动）。
   桌面仅做居中限宽，不额外排布。
   ========================================================================== */

:root {
  --ink:      #06070b;
  --ink-2:    #0c0f16;
  --ink-3:    #131824;
  --line:     #1e2534;
  --line-2:   #2b3446;
  --acid:     #d8ff3e;
  --acid-dim: #8fa82a;
  --ember:    #ff4b2b;
  --cyan:     #46e0ff;
  --text:     #e9edf5;
  --muted:    #78859b;
  --muted-2:  #4d5769;

  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --disp: "Chakra Petch", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;

  --r: 14px;
  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--disp);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  min-height: 100svh;
  padding-bottom: calc(var(--safe-b) + 8px);
  /* 底部一层极淡的径向光，避免大面积死黑 */
  background-image:
    radial-gradient(120% 55% at 50% -10%, rgba(216,255,62,.09), transparent 62%),
    radial-gradient(90% 40% at 100% 100%, rgba(70,224,255,.06), transparent 70%);
  background-attachment: fixed;
}

/* 颗粒噪点：给深色面加质感，防止塑料感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: .30;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- 顶栏 */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  /* 顶栏贴顶，必须自己避让刘海/状态栏（viewport-fit=cover 下 insets 才非 0） */
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--pad) 12px;
  background: rgba(6,7,11,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 8px; }

.brand-mark {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 3px rgba(255,75,43,.16), 0 0 14px rgba(255,75,43,.7);
  align-self: center;
  animation: pulseMark 2.4s ease-in-out infinite;
}
@keyframes pulseMark {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

.brand-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .10em;
  white-space: nowrap;
}
.brand-name b { color: var(--acid); font-weight: 700; }

.brand-sub {
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

.wallet {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(216,255,62,.07), transparent);
}
.wallet-label { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.wallet-value { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--acid); }

/* ---------------------------------------------------------------- 骨架 */
.shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------------------------------------------------------- 靶场 */
.stage {
  position: relative;
  container-type: inline-size;   /* 下面的 HUD 用 cqw 跟着舞台宽度缩放 */
  border: 1px solid var(--line-2);
  border-radius: 18px;
  overflow: hidden;
  background: var(--ink-2);
  box-shadow: 0 24px 60px -28px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,255,255,.03);
  /* 固定 3:4 游玩区 —— 所有设备同一难度，服务端复算才成立 */
  aspect-ratio: 3 / 4;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#field {
  display: block;
  width: 100%;
  height: 100%;
}

/* HUD */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding: 12px 14px;
  pointer-events: none;
}
.hud-cell { display: flex; flex-direction: column; gap: 2px; }
.hud-cell:last-child { text-align: right; align-items: flex-end; }
.hud-combo { align-items: center; }

.hud-k {
  font-family: var(--mono);
  font-size: clamp(7px, 2.5cqw, 9px);
  letter-spacing: .18em;
  color: var(--muted-2);
}
.hud-v {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(15px, 6.1cqw, 22px);
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
#hudScore { color: var(--acid); text-shadow: 0 0 18px rgba(216,255,62,.35); }
#hudCombo { color: var(--text); font-size: clamp(12px, 4.7cqw, 17px); transition: color .18s, transform .18s; }
#hudCombo.hot { color: var(--acid); }
#hudCombo.blazing { color: var(--ember); text-shadow: 0 0 16px rgba(255,75,43,.5); }
.hud-combo.bump #hudCombo { transform: scale(1.28); }
#hudTime { color: var(--text); }
#hudTime.low { color: var(--ember); }

/* 顶部计时条 */
.tickbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,.06);
}
.tickbar i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--acid), var(--ember));
}

/* ---------------------------------------------------------- 覆盖层/面板 */
.veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(120% 90% at 50% 30%, rgba(12,15,22,.90), rgba(6,7,11,.97));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.veil[hidden] { display: none; }

.panel { width: 100%; text-align: center; animation: rise .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--acid-dim);
}

.title {
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -.015em;
}
.title em {
  font-style: normal;
  color: var(--acid);
  /* 手写感的下划强调线，替代普通的粗体 */
  background-image: linear-gradient(var(--acid), var(--acid));
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-position: 0 92%;
}

.rules {
  /* 宽度收成内容宽再居中，让三个字形徽标对齐成一列（整块居中时文字会参差） */
  width: fit-content;
  margin: 0 auto 18px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
}
.rules b {
  display: inline-grid;
  place-items: center;
  width: 19px; height: 19px;
  margin-right: 7px;
  border-radius: 5px;
  background: var(--ink-3);
  border: 1px solid var(--line-2);
  color: var(--acid);
  font-family: var(--mono);
  font-size: 11px;
  vertical-align: -4px;
}

.payout-preview {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 20px;
  padding: 7px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
}
.payout-preview b { font-family: var(--mono); font-size: 15px; color: var(--acid); }

/* 按钮 */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  padding: 15px 22px;
  border-radius: 12px;
  width: 100%;
  transition: transform .12s, filter .2s, background .2s;
  min-height: 52px;
}
.btn:active { transform: scale(.975); }

.btn-primary {
  color: #0a0d05;
  background: linear-gradient(180deg, #e6ff62, var(--acid));
  box-shadow: 0 10px 26px -10px rgba(216,255,62,.6), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--ink-3); }

.fineprint {
  margin: 14px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted-2);
}

/* 倒计时 */
.panel-count { text-align: center; }
.count {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(56px, 30cqw, 108px);
  line-height: 1;
  color: var(--acid);
  text-shadow: 0 0 50px rgba(216,255,62,.45);
  animation: countPop .62s cubic-bezier(.2,.9,.2,1);
}
@keyframes countPop {
  0%   { opacity: 0; transform: scale(2.1); filter: blur(9px); }
  45%  { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

/* 结算 */
.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 16px;
}
.result-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 60px;
  line-height: .92;
  letter-spacing: -.03em;
  color: var(--acid);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 40px rgba(216,255,62,.35);
}
.result-unit { font-size: 14px; color: var(--muted); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 14px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.result-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--ink-2);
  text-align: left;
}
.result-grid span { font-size: 10px; letter-spacing: .1em; color: var(--muted-2); }
.result-grid b {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.payout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(216,255,62,.3);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(216,255,62,.1), transparent);
}
.payout-k { font-size: 13px; color: var(--text); }
.payout-v { font-family: var(--mono); font-size: 21px; font-weight: 700; color: var(--acid); }
.payout.is-zero { border-color: var(--line-2); background: none; }
.payout.is-zero .payout-v { color: var(--muted); }

.verify {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .04em;
  color: var(--muted-2);
  overflow-wrap: break-word;   /* 只在词间断行：数字不能被折成两半 */
}
.verify.ok { color: var(--acid-dim); }
.verify.bad { color: var(--ember); }

.result-actions { display: grid; gap: 9px; }

/* ---------------------------------------------------------------- 侧栏卡片 */
.rail { display: flex; flex-direction: column; gap: 12px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--ink-2), rgba(12,15,22,.5));
  padding: 14px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text);
}

.tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.tab {
  appearance: none; border: 0; cursor: pointer;
  padding: 5px 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--disp);
  font-size: 11.5px;
  font-weight: 600;
  transition: background .18s, color .18s;
}
.tab.is-on { background: var(--acid); color: #0a0d05; }

/* 榜单 */
.board { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.board li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(30,37,52,.6);
  font-size: 13.5px;
}
.board li:last-child { border-bottom: 0; }
.board .rk {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-2);
  text-align: center;
}
.board .nm { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .sc {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--acid);
  font-variant-numeric: tabular-nums;
}
.board li.top1 .rk { color: var(--acid); }
.board li.top1 { background: linear-gradient(90deg, rgba(216,255,62,.09), transparent); }
.board li.top2 .rk { color: #c9d4e4; }
.board li.top3 .rk { color: #d49a6a; }
.board li.is-me {
  background: rgba(70,224,255,.07);
  box-shadow: inset 2px 0 0 var(--cyan);
  margin: 0 -14px;
  padding-left: 16px;
  padding-right: 16px;
}
.board li.is-me .nm { color: var(--cyan); }
.board .tagme {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--cyan);
  border: 1px solid rgba(70,224,255,.4);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 6px;
}

.board-skeleton {
  display: block !important;
  height: 150px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--ink-3), var(--line), var(--ink-3));
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border: 0 !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* 我的排名 */
.me-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 10px;
  border: 1px solid rgba(70,224,255,.28);
  border-radius: 10px;
  background: rgba(70,224,255,.06);
  font-size: 13.5px;
}
.me-row[hidden] { display: none; }
.me-rank { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--cyan); text-align: center; }
.me-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-score { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }

/* KV 表 */
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 7px 0; border-bottom: 1px solid rgba(30,37,52,.6); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { color: var(--muted); width: 84px; }
.kv td:last-child { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--text); }
.note { margin: 10px 0 0; font-size: 11px; line-height: 1.55; color: var(--muted-2); }

/* 形状倍率图例 */
.shape-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(30,37,52,.6);
}
.sl-item { text-align: center; }
.sl-sprite {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.6));
}
.sl-name { display: block; margin-top: 5px; font-size: 10px; color: var(--muted); }
.sl-mult { display: block; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--acid); }

/* 奖励 */
.rewards { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rewards li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ink-3);
  font-size: 13px;
}
.rewards .rk { color: var(--muted); }
.rewards b { font-family: var(--mono); font-size: 12.5px; color: var(--acid); white-space: nowrap; }

/* ---------------------------------------------------------------- 页脚 */
.foot {
  max-width: 480px;
  margin: 0 auto;
  padding: 6px var(--pad) 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  color: var(--muted-2);
  text-align: center;
}
.foot .dot { opacity: .5; }

/* 命中时的全屏微闪 —— 只在连击高温时出现 */
.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(60% 40% at 50% 50%, rgba(216,255,62,.5), transparent 70%);
  transition: opacity .28s ease-out;
}
.flash.on { opacity: .5; transition: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------- 手机横屏：明确提示竖屏
   必须放在文件末尾：`.shell { display:flex }` 在下面（基础段落里），同权重下
   后出现的规则胜出，写在前面会被它盖掉。 */
.rotate-hint { display: none; }

@media (orientation: landscape) and (max-height: 560px) {
  .rotate-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: calc(100svh - 72px);
    padding: 24px var(--pad) 60px;
    text-align: center;
  }
  .rotate-hint svg { width: 46px; height: 46px; color: var(--acid); animation: tilt 2.2s ease-in-out infinite; }
  .rotate-hint b { font-size: 19px; font-weight: 700; }
  .rotate-hint span { font-size: 13px; color: var(--muted); }
  .shell, .foot { display: none; }
}

@keyframes tilt {
  0%, 55%, 100% { transform: rotate(0deg); }
  75%           { transform: rotate(-88deg); }
}

/* 320px 这类窄屏：品牌副标题挤掉，否则顶栏换行、品牌和额度各占两行 */
@media (max-width: 359px) {
  .brand-sub { display: none; }
  .wallet { padding: 5px 9px; gap: 4px; }
  .brand-name { font-size: 14px; }
  .wallet-value { font-size: 13px; }
}
