/* ============================================================
   COINHUB — 深空 HUD 视觉系统
   配色经 dataviz 校验器验证：分类槽位在深色面 #0B111C 上
   全部通过亮度带 / 彩度 / 色盲分离 / 对比度检查。
   ============================================================ */

:root {
  color-scheme: dark;

  --void:       #05080f;
  --surface-1:  #0b111c;      /* 图表与面板底 */
  --surface-2:  #101a2b;
  --surface-3:  #16233a;
  --line:       rgba(126, 183, 219, 0.16);
  --line-hot:   rgba(30, 158, 184, 0.55);

  --ink:        #e8f2ff;
  --ink-2:      #9db3cd;
  --ink-3:      #5f7592;

  /* 分类槽位（孩子）—— 基准色仍是校验过的那四个 */
  --s1: #1e9eb8;
  --s2: #d9468e;
  --s3: #9085e9;
  --s4: #c98500;
  /* 亮一档的同色，只用在发光、描边、粒子上，不承担数据编码 */
  --s1-hi: #5fdcf2;
  --s2-hi: #ff7ab8;
  --s3-hi: #b9b1ff;
  --s4-hi: #ffc04d;

  /* 游戏化 */
  --xp:     #46cde6;
  --flame:  #ff8a3d;
  --gold:   #ffc94a;
  --locked: #33445c;

  /* 极性 / 状态 —— 永远配符号和文字，不靠颜色单独表意 */
  --good: #19a974;
  --bad:  #e05252;
  --warn: #c98500;

  --glow:   0 0 24px rgba(30, 158, 184, 0.35);
  --glow-s: 0 0 10px rgba(30, 158, 184, 0.45);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;

  --r: 3px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--void);
  background-image:
    radial-gradient(900px 620px at 12% -8%,  rgba(30, 158, 184, 0.16), transparent 62%),
    radial-gradient(820px 560px at 88% 4%,   rgba(144, 133, 233, 0.13), transparent 60%),
    radial-gradient(700px 700px at 50% 118%, rgba(217, 70, 142, 0.10), transparent 60%),
    linear-gradient(transparent 95%, rgba(126, 183, 219, 0.045) 95%),
    linear-gradient(90deg, transparent 95%, rgba(126, 183, 219, 0.045) 95%);
  background-size: auto, auto, auto, 34px 34px, 34px 34px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 扫描线 —— 极低透明度，不干扰阅读 */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ---------------------------------------------------------- 版式骨架 */

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 22px 64px; }

header.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(5,8,15,0.96), rgba(5,8,15,0.72));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark {
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  letter-spacing: 3px; color: var(--s1); text-shadow: var(--glow-s);
}
.brand .sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: 2.4px;
  color: var(--ink-3); text-transform: uppercase;
}

nav.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.tabs a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 1.6px;
  color: var(--ink-2); text-decoration: none;
  padding: 7px 13px; border: 1px solid transparent; border-radius: var(--r);
  transition: .16s; white-space: nowrap;
}
nav.tabs a .t-cn { color: var(--ink-3); margin-left: 5px; }
nav.tabs a.on .t-cn { color: inherit; }
nav.tabs a:hover { color: var(--ink); background: rgba(126,183,219,.07); border-color: var(--line); }
nav.tabs a.on {
  color: var(--s1); border-color: var(--line-hot);
  background: rgba(30,158,184,.10); box-shadow: inset 0 0 18px rgba(30,158,184,.14);
}

.clock {
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  letter-spacing: 1.4px; padding-left: 14px; border-left: 1px solid var(--line);
}
.clock b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------- 面板 */

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(16,26,43,.72), rgba(11,17,28,.86));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
}
/* 四角切角 */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 13px; height: 13px; pointer-events: none;
  border-color: var(--line-hot); border-style: solid; opacity: .8;
}
.panel::before { top: -1px; left: -1px;  border-width: 1px 0 0 1px; }
.panel::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.panel > h2, .panel-title {
  margin: 0 0 14px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 2.2px; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: 9px;
}
.panel > h2::before, .panel-title::before {
  content: ""; width: 5px; height: 5px; background: var(--s1);
  box-shadow: var(--glow-s); transform: rotate(45deg);
}

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 1080px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------- 文字 */

.mono { font-family: var(--mono); }
.dim  { color: var(--ink-2); }
.dimmer { color: var(--ink-3); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.center { text-align: center; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px;
  padding: 3px 8px; border-radius: 2px;
  border: 1px solid var(--line); color: var(--ink-2);
  background: rgba(126,183,219,.05);
}
.tag.ok   { color: var(--good); border-color: rgba(25,169,116,.5); background: rgba(25,169,116,.10); }
.tag.bad  { color: var(--bad);  border-color: rgba(224,82,82,.5);  background: rgba(224,82,82,.10); }
.tag.warn { color: var(--warn); border-color: rgba(201,133,0,.5);  background: rgba(201,133,0,.10); }

/* ---------------------------------------------------------- 控件 */

button, .btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 1.2px;
  color: var(--ink); background: rgba(126,183,219,.07);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 15px; cursor: pointer; transition: .15s;
}
button:hover, .btn:hover { border-color: var(--line-hot); background: rgba(30,158,184,.14); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .35; cursor: not-allowed; }

button.primary {
  color: #04121a; font-weight: 700;
  background: linear-gradient(180deg, #35bcd6, #1e9eb8);
  border-color: #46cde6; box-shadow: 0 0 18px rgba(30,158,184,.4);
}
button.primary:hover { background: linear-gradient(180deg, #4bcde6, #23aac6); }
button.danger { color: var(--bad); border-color: rgba(224,82,82,.45); }
button.ghost { background: transparent; }
button.sm { padding: 6px 10px; font-size: 11px; }

input, select, textarea {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: rgba(5,8,15,.65); border: 1px solid var(--line);
  border-radius: var(--r); padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--line-hot); box-shadow: 0 0 0 3px rgba(30,158,184,.13);
}
label.f { display: block; margin-bottom: 12px; }
label.f > span {
  display: block; margin-bottom: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ink-3);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 分段选择器 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  border: 0; border-radius: 0; background: transparent; padding: 8px 14px;
  color: var(--ink-2); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: rgba(30,158,184,.18); color: var(--s1); box-shadow: inset 0 -2px 0 var(--s1); }

/* ---------------------------------------------------------- 表格 */

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-3); text-align: left;
  padding: 9px 10px; border-bottom: 1px solid var(--line); font-weight: 600;
}
table.data td { padding: 10px; border-bottom: 1px solid rgba(126,183,219,.07); vertical-align: middle; }
table.data tr:hover td { background: rgba(126,183,219,.04); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); }

.scroll-x { overflow-x: auto; }

/* ---------------------------------------------------------- 弹层 */

.modal-bg {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(3,5,10,.82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg[hidden] { display: none !important; }
.modal { width: min(460px, 100%); }

/* ---------------------------------------------------------- 提示条 */

#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(16px);
  z-index: 300; padding: 11px 20px; border-radius: var(--r);
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px;
  background: rgba(11,17,28,.96); border: 1px solid var(--line-hot);
  box-shadow: var(--glow); opacity: 0; pointer-events: none; transition: .22s;
  max-width: min(520px, 90vw); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(224,82,82,.7); color: #ffc9c9; box-shadow: 0 0 24px rgba(224,82,82,.3); }

/* ---------------------------------------------------------- 通用动画 */

@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.live { display: inline-block; width: 6px; height: 6px; border-radius: 50%;
        background: var(--good); box-shadow: 0 0 8px var(--good); animation: pulse 2s infinite; }

@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sweep { position: relative; overflow: hidden; }
.sweep::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(30,158,184,.14), transparent);
  animation: sweep 5.5s infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------- 图表通用 */

.viz { width: 100%; display: block; }
.viz .grid-line { stroke: rgba(126,183,219,.13); stroke-width: 1; }
.viz .axis-txt { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
.viz .zero { stroke: rgba(126,183,219,.35); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.legend i {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 7px;
  vertical-align: -1px;
}
.legend span { font-family: var(--mono); font-size: 11px; color: var(--ink-2); letter-spacing: 1px; }

.tip {
  position: fixed; z-index: 400; pointer-events: none;
  background: rgba(5,8,15,.97); border: 1px solid var(--line-hot);
  border-radius: var(--r); padding: 9px 12px; font-size: 12px;
  font-family: var(--mono); box-shadow: var(--glow); opacity: 0; transition: opacity .1s;
  max-width: 260px;
}
.tip.show { opacity: 1; }
.tip .t-h { color: var(--ink-3); font-size: 10px; letter-spacing: 1.3px; margin-bottom: 5px; }
.tip .t-r { display: flex; justify-content: space-between; gap: 16px; }



/* ============================================================
   舰桥 · BRIDGE —— 星域背景、全息面板、游戏化组件
   动效全部走 transform / opacity，交给合成器，不碰布局。
   标签页切走时 fx.js 会整体暂停（body.fx-idle）。
   ============================================================ */

/* ---------------------------------------------------------- 星域背景 */

#space { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }

/* 三层星野，尺寸和速度不同 = 视差。整层只做 translate3d，GPU 合成，几乎不吃 CPU。 */
#space .stars {
  position: absolute; left: 0; right: 0; top: 0; height: 200%;
  background-repeat: repeat;
  will-change: transform;
  animation: drift linear infinite;
}
@keyframes drift { from { transform: translate3d(0,0,0); } to { transform: translate3d(0,-50%,0); } }

/* 星云：两团巨大的模糊光斑，缓慢呼吸和位移 */
#space .neb {
  position: absolute; border-radius: 50%; filter: blur(70px);
  will-change: transform, opacity;
  animation: nebula ease-in-out infinite alternate;
}
@keyframes nebula {
  from { transform: translate3d(0,0,0) scale(1);      opacity: .5; }
  to   { transform: translate3d(4%,-3%,0) scale(1.18); opacity: .82; }
}

/* 整屏扫描光带，每隔十几秒扫一次 */
#space .scan {
  position: absolute; left: -10%; right: -10%; height: 180px;
  background: linear-gradient(180deg, transparent,
              rgba(95,220,242,.055) 45%, rgba(95,220,242,.085) 50%,
              rgba(95,220,242,.055) 55%, transparent);
  will-change: transform;
  animation: scandown 14s linear infinite;
}
@keyframes scandown {
  0%   { transform: translate3d(0,-200px,0); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translate3d(0,100vh,0);  opacity: 0; }
}

/* 粒子画布：只在打卡、升级这类时刻画几百毫秒，画完自己停 */
#fxc { position: fixed; inset: 0; z-index: 400; pointer-events: none; }

body.fx-idle #space *, body.fx-idle .anim { animation-play-state: paused !important; }
body.fx-off  #space .stars, body.fx-off #space .scan { animation: none; }
body.fx-off  #space .neb { animation: none; opacity: .6; }

/* ---------------------------------------------------------- 面板：四角支架 + 顶边光 */

.panel {
  --brk: linear-gradient(var(--line-hot), var(--line-hot));
  backdrop-filter: blur(3px);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.panel::before {
  content: ""; position: absolute; inset: -1px; pointer-events: none; z-index: 1;
  border: 0; width: auto; height: auto; opacity: .85;
  background-image: var(--brk), var(--brk), var(--brk), var(--brk),
                    var(--brk), var(--brk), var(--brk), var(--brk);
  background-repeat: no-repeat;
  background-size: 14px 1px, 1px 14px, 14px 1px, 1px 14px,
                   14px 1px, 1px 14px, 14px 1px, 1px 14px;
  background-position: 0 0, 0 0, 100% 0, 100% 0,
                       0 100%, 0 100%, 100% 100%, 100% 100%;
}
.panel::after {
  content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px;
  bottom: auto; width: auto; border: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--s1-hi), transparent);
  opacity: .5; animation: edgepulse 4.5s ease-in-out infinite;
}
@keyframes edgepulse { 0%,100% { opacity: .22; } 50% { opacity: .75; } }

.panel-title::before { animation: pulse 2.6s ease-in-out infinite; }

/* ---------------------------------------------------------- 入场：错峰浮起 */

@keyframes rise {
  from { opacity: 0; transform: translate3d(0,14px,0); }
  to   { opacity: 1; transform: none; }
}
.rise { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }

/* ---------------------------------------------------------- 反应堆核心 */

.core { position: relative; width: 100%; aspect-ratio: 1; max-width: 190px; margin: 0 auto; }
.core svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.core .r-out  { animation: spin 26s linear infinite; transform-origin: 50% 50%; }
.core .r-mid  { animation: spin 15s linear infinite reverse; transform-origin: 50% 50%; }
.core .r-glow { animation: breathe 3.4s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes breathe { 0%,100% { opacity: .45; transform: scale(.97); } 50% { opacity: 1; transform: scale(1.03); } }

.core .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.core .num b {
  font-family: var(--mono); font-size: clamp(30px, 7vw, 46px); font-weight: 700;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.core .num span { font-family: var(--mono); font-size: 10px; letter-spacing: 2.4px; color: var(--ink-2); margin-top: 7px; }

/* ---------------------------------------------------------- 等级与经验 */

.rank { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rank .lv {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1.4px;
  padding: 3px 8px; border-radius: 2px; color: #04121a;
  background: linear-gradient(135deg, var(--gold), #e0a020);
  box-shadow: 0 0 14px rgba(255,201,74,.45);
}
.rank .cn { font-size: 14px; font-weight: 700; }
.rank .en { font-family: var(--mono); font-size: 9.5px; letter-spacing: 2px; color: var(--ink-3); }
.rank .star { color: var(--gold); font-size: 12px; letter-spacing: 1px; text-shadow: 0 0 8px rgba(255,201,74,.7); }

.xpbar {
  position: relative; height: 9px; border-radius: 99px; overflow: hidden;
  background: rgba(5,8,15,.75); border: 1px solid var(--line); margin-top: 9px;
}
.xpbar i {
  position: absolute; inset: 0 auto 0 0; display: block; border-radius: 99px;
  background: linear-gradient(90deg, var(--s1), var(--xp));
  box-shadow: 0 0 14px rgba(70,205,230,.6);
  width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1);
}
.xpbar i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: xpshine 2.4s linear infinite;
}
@keyframes xpshine { from { transform: translateX(-100%); } to { transform: translateX(220%); } }
.xpnote { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 6px; letter-spacing: .8px; }

/* ---------------------------------------------------------- 连击火焰 */

.combo { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); }
.combo .fl { font-size: 15px; filter: drop-shadow(0 0 7px var(--flame)); animation: flick 1.1s ease-in-out infinite; }
.combo b { color: var(--flame); font-size: 17px; text-shadow: 0 0 12px rgba(255,138,61,.6); }
@keyframes flick {
  0%,100% { transform: scale(1) rotate(-3deg); }
  50%     { transform: scale(1.14) rotate(4deg); }
}

/* ---------------------------------------------------------- 成就徽章 */

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.bdg {
  position: relative; text-align: center; padding: 12px 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(5,8,15,.5); transition: .18s; cursor: default;
}
.bdg .ic { font-size: 25px; line-height: 1; display: block; margin-bottom: 7px; }
.bdg .nm { font-size: 11px; font-weight: 600; }
.bdg .en { font-family: var(--mono); font-size: 8px; letter-spacing: 1.2px; color: var(--ink-3); margin-top: 3px; }
.bdg.got {
  border-color: rgba(255,201,74,.42);
  background: radial-gradient(circle at 50% 22%, rgba(255,201,74,.16), rgba(5,8,15,.5) 68%);
  box-shadow: 0 0 18px rgba(255,201,74,.12) inset;
}
.bdg.got .ic { animation: bob 3.6s ease-in-out infinite; }
.bdg.got:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(255,201,74,.22); }
.bdg.no { opacity: .32; filter: grayscale(1); }
.bdg.no .ic { filter: blur(1.2px); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---------------------------------------------------------- 飞船卡（大屏） */

.ship { position: relative; overflow: hidden; }
.ship::before { z-index: 2; }
/* 卡内缓慢下扫的高光带 */
.ship .beam {
  position: absolute; left: 0; right: 0; height: 120px; top: -120px; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(95,220,242,.07), transparent);
  animation: beam 9s linear infinite;
}
@keyframes beam { to { transform: translateY(calc(100% + 900px)); } }
.ship:hover { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(0,0,0,.45); }

/* 雷达扫掠（放在有 data-radar 的角上） */
.radar { position: absolute; width: 74px; height: 74px; right: 12px; top: 12px; opacity: .5; pointer-events: none; }
.radar .sweep-l { animation: spin 3.6s linear infinite; transform-origin: 50% 50%; }

/* ---------------------------------------------------------- 按钮：蓄能与点击涟漪 */

button, .btn { position: relative; overflow: hidden; }
button::after, .btn::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--rx,50%) var(--ry,50%),
              rgba(95,220,242,.42), transparent 62%);
  opacity: 0; transition: opacity .35s;
}
button:active::after, .btn:active::after { opacity: 1; transition: none; }
button.primary { position: relative; }
button.primary::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent);
  transform: translateX(-100%);
}
button.primary:hover::before { animation: xpshine 1.1s linear; }

/* 大号打卡按钮 */
.bigpunch {
  width: 100%; padding: 20px 14px; font-size: 15px; letter-spacing: 2px;
  border-radius: 4px; position: relative;
}
.bigpunch .k { display: block; font-size: 10px; letter-spacing: 2px; color: var(--ink-3); margin-bottom: 6px; }
.bigpunch:not(:disabled):hover { box-shadow: 0 0 26px rgba(30,158,184,.4); border-color: var(--line-hot); }
.bigpunch.done { border-color: rgba(25,169,116,.5); background: rgba(25,169,116,.09); }

/* 倒计时最后关头：环和数字一起急促搏动，比单纯变红更有紧迫感 */
@keyframes urgent {
  0%,100% { opacity: 1;   filter: drop-shadow(0 0 8px currentColor); }
  50%     { opacity: .55; filter: drop-shadow(0 0 22px currentColor); }
}
.urgent .ring-fg, .urgent .big { animation: urgent .9s ease-in-out infinite; }
.urgent .big { color: var(--bad) !important; }

/* ---------------------------------------------------------- 飘字与庆祝 */

.floatnum {
  position: fixed; z-index: 401; pointer-events: none;
  font-family: var(--mono); font-weight: 700; font-size: 30px;
  text-shadow: 0 0 20px currentColor;
  animation: floatup 1.5s cubic-bezier(.15,.75,.3,1) forwards;
}
@keyframes floatup {
  0%   { opacity: 0; transform: translate(-50%,0) scale(.6); }
  18%  { opacity: 1; transform: translate(-50%,-16px) scale(1.22); }
  40%  { transform: translate(-50%,-30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-96px) scale(.94); }
}

#flash {
  position: fixed; inset: 0; z-index: 399; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(95,220,242,.20), transparent 62%);
}
#flash.go { animation: flashout .62s ease-out; }
@keyframes flashout { 0% { opacity: 1; } 100% { opacity: 0; } }

/* 数字跳动 */
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }
.bump { animation: bump .42s cubic-bezier(.3,1.4,.5,1); }

/* 升级横幅 */
#levelup {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%);
  z-index: 402; pointer-events: none; text-align: center; opacity: 0;
  padding: 22px 40px; border: 1px solid rgba(255,201,74,.6); border-radius: 4px;
  background: linear-gradient(180deg, rgba(20,16,6,.95), rgba(8,10,16,.95));
  box-shadow: 0 0 60px rgba(255,201,74,.35);
}
#levelup.go { animation: lvup 3.2s cubic-bezier(.2,.8,.3,1); }
#levelup .t { font-family: var(--mono); font-size: 11px; letter-spacing: 5px; color: var(--gold); }
#levelup .n { font-size: 30px; font-weight: 700; margin-top: 9px; }
@keyframes lvup {
  0%   { opacity: 0; transform: translateX(-50%) scale(.82); }
  12%  { opacity: 1; transform: translateX(-50%) scale(1.04); }
  20%  { transform: translateX(-50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(.97); }
}

/* 崩溃提示条：出问题时必须一眼看见，所以放最顶上、盖住一切 */
#crashbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; font-size: 13px;
  background: linear-gradient(180deg, #3a1414, #241012);
  border-bottom: 1px solid rgba(224,82,82,.6); color: #ffd9d9;
  box-shadow: 0 6px 30px rgba(0,0,0,.5);
}
#crashbar b { color: #ff9a9a; }
#crashbar button { flex: 0 0 auto; }

/* ---------------------------------------------------------- 动效开关 */

#fx-btn { margin-left: 8px; padding: 7px 10px; font-size: 13px; line-height: 1; }
body.fx-off #fx-btn { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
  #space .stars, #space .scan, #space .neb { animation: none !important; }
}

/* ============================================================
   移动端 —— 页头重排、去掉定宽、加大点击区
   ============================================================ */

@media (max-width: 760px) {

  /* 页头：两行。第一行品牌+时钟+登录，第二行横向可滑的标签条 */
  header.top {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px) * 0);
  }
  .brand { min-width: 0; }
  .brand .mark { font-size: 15px; letter-spacing: 2px; }
  .brand .sub { display: none; }              /* 竖排单字的元凶 */

  .clock { margin-left: auto; padding-left: 0; border-left: 0; font-size: 11px; white-space: nowrap; }
  .clock .c-date, .clock .c-sec { display: none; }

  #auth-btn { margin-left: 0 !important; padding: 7px 11px; font-size: 11px; white-space: nowrap; }
  #auth-btn .b-long { display: none; }

  nav.tabs {
    order: 3; width: 100%; margin-left: 0;
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 2px;
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a { flex: 0 0 auto; padding: 8px 12px; font-size: 12px; }
  nav.tabs a .t-en { display: none; }         /* 窄屏只留中文，够认 */
  nav.tabs a .t-cn { margin-left: 0; color: inherit; }

  /* 版心 */
  .wrap { padding: 0 12px 48px; }
  .panel { padding: 15px 14px; }
  .grid { gap: 12px; }

  /* 控件：定宽全部改成可伸缩，点击区加大到 44px */
  button, .btn { padding: 12px 15px; min-height: 44px; }
  button.sm { padding: 9px 12px; min-height: 38px; }
  .seg button { min-height: 40px; }
  input, select, textarea { font-size: 16px; padding: 11px; }  /* 16px 防 iOS 聚焦时自动放大 */
  input[type=date], input[type=time] { width: 100%; }

  /* 行内表单：一律占满一行，别再挤 */
  .row > input, .row > select { flex: 1 1 100%; width: 100% !important; min-width: 0 !important; }
  .row > button { flex: 1 1 auto; }

  /* 表格：横向滑动，别把页面撑开 */
  .scroll-x { -webkit-overflow-scrolling: touch; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 8px 7px; }

  #toast { left: 12px; right: 12px; transform: translateY(16px); max-width: none; }
  #toast.show { transform: translateY(0); }

  .modal { width: 100%; }

  .core { max-width: 150px; }
  .badges { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
  .bdg .ic { font-size: 22px; }
  .bigpunch { padding: 17px 12px; font-size: 14px; }
  .floatnum { font-size: 25px; }
  #space .neb { filter: blur(50px); }        /* 手机上 blur 很贵，收一点 */
  #fx-btn { display: none; }                 /* 页头已经很挤了 */
}

/* 极窄屏（iPhone SE 一类） */
@media (max-width: 380px) {
  .brand .mark { font-size: 14px; letter-spacing: 1.5px; }
  nav.tabs a { padding: 8px 10px; }
  .panel { padding: 13px 12px; }
}
