/* =====================================================================
   MY5 · 新人加油包（Token Package）前端组件
   build: pc3-20261023-tp1
   类名前缀 tp-（顶栏温度条）/ gift-（右侧额度卡），不与现有样式冲突
   颜色一律用站上现有 CSS 变量，深色模式自动跟随；填充色由 JS 按剩余量算
   ===================================================================== */

/* ============ 顶栏 Token 温度条（药丸 A：图标 + 填充进度 + 百分比） ============ */
.tp-bar{
  position:relative;display:inline-flex;align-items:center;gap:7px;height:27px;
  padding:0 12px 0 10px;border-radius:99px;overflow:hidden;cursor:default;
  background:var(--paper);border:1px solid var(--line-strong);
  box-shadow:inset 0 1px 2px rgba(16,24,40,.07),0 1px 0 rgba(255,255,255,.6);
  transition:transform .18s cubic-bezier(.22,.8,.3,1),box-shadow .18s;
  -webkit-tap-highlight-color:transparent;
}
html[data-theme="dark"] .tp-bar{
  background:var(--paper-2);border-color:var(--line-strong);
  box-shadow:inset 0 1px 3px rgba(0,0,0,.5),0 1px 0 rgba(255,255,255,.03);
}
.tp-bar:hover{transform:translateY(-1px);box-shadow:inset 0 1px 2px rgba(16,24,40,.07),0 3px 9px rgba(16,24,40,.1)}
.tp-bar:focus-visible{outline:3px solid var(--focus-ring,#0b63ce);outline-offset:2px}

/* 填充：左浓右淡的渐变，宽度 = 剩余百分比 */
.tp-bar .tp-fill{
  position:absolute;left:0;top:0;bottom:0;
  transition:width .45s cubic-bezier(.22,.8,.3,1),background .45s ease;
  pointer-events:none;
}
.tp-bar .tp-ico{position:relative;z-index:1;width:13px;height:13px;flex:0 0 13px}
.tp-bar .tp-pct{position:relative;z-index:1;font-size:11.5px;font-weight:700;font-variant-numeric:tabular-nums;
  letter-spacing:-.1px;line-height:1}

/* 低于 30%：外圈轻微呼吸（不是闪烁），reduced-motion 下自动关闭 */
.tp-bar.low{animation:tpBreathe 2.6s ease-in-out infinite}
@keyframes tpBreathe{
  0%,100%{box-shadow:inset 0 1px 2px rgba(16,24,40,.07),0 0 0 0 rgba(196,60,60,.26)}
  50%{box-shadow:inset 0 1px 2px rgba(16,24,40,.07),0 0 0 4px rgba(196,60,60,0)}
}

/* ============ 悬停提示 ============ */
.tp-tip{
  position:fixed;z-index:1000;background:var(--ink);color:var(--paper);
  border-radius:8px;padding:9px 12px;box-shadow:var(--shadow-pop,0 18px 48px rgba(16,24,40,.18));
  font-size:11.5px;line-height:1.6;opacity:0;visibility:hidden;transform:translate(-50%,-4px);
  transition:opacity .16s ease,transform .16s ease,visibility .16s;
  pointer-events:none;white-space:nowrap;max-width:92vw;
}
html[data-theme="dark"] .tp-tip{background:var(--paper-2);color:var(--ink);border:1px solid var(--line-strong)}
.tp-tip.show{opacity:1;visibility:visible;transform:translate(-50%,0)}
.tp-tip b{font-weight:650}
.tp-tip .tt-2{opacity:.68;font-size:10.5px;margin-top:2px}
.tp-tip::before{content:"";position:absolute;top:-5px;left:50%;margin-left:-5px;width:10px;height:10px;
  background:inherit;transform:rotate(45deg);border-radius:2px}
.tp-tip.flip::before{top:auto;bottom:-5px}

/* ============ 右侧额度卡（方案 1） ============ */
.gift-layer{position:fixed;inset:0;pointer-events:none;z-index:5}
.gift-card{
  position:absolute;right:24px;bottom:28px;width:252px;
  background:var(--paper);border:1px solid var(--line);border-radius:var(--radius,10px);
  box-shadow:0 2px 6px rgba(16,24,40,.05),0 14px 34px rgba(16,24,40,.1);
  padding:14px 15px 13px;pointer-events:auto;
  transition:box-shadow .2s ease,transform .2s ease,opacity .18s ease;
  transform-origin:bottom right;
}
.gift-card:hover{box-shadow:0 4px 10px rgba(16,24,40,.07),0 20px 46px rgba(16,24,40,.14)}
.gift-card.hidden{opacity:0;transform:scale(.94) translateY(6px);pointer-events:none}
.gift-card .gc-head{display:flex;align-items:flex-start;gap:9px}
.gift-card .gc-ico{width:28px;height:28px;flex:0 0 28px;border-radius:8px;background:var(--blue-light);
  color:var(--blue);display:grid;place-items:center;margin-top:1px}
.gift-card .gc-ico svg{width:15px;height:15px}
.gift-card .gc-titles{flex:1;min-width:0}
.gift-card .gc-titles b{display:block;font-size:12.5px;font-weight:600;letter-spacing:-.1px;line-height:1.35}
.gift-card .gc-status{display:inline-flex;align-items:center;gap:4px;font-size:10px;color:var(--green);margin-top:1px}
.gift-card .gc-status i{width:5px;height:5px;border-radius:50%;background:currentColor;display:block}
.gift-card .gc-status.gift-warn{color:var(--amber)}
.gift-card .gc-status.gift-dead{color:var(--muted)}
.gift-card .gc-min{width:20px;height:20px;border:0;background:transparent;color:var(--soft);border-radius:5px;
  display:grid;place-items:center;flex:0 0 20px;transition:.15s;cursor:pointer}
.gift-card .gc-min:hover{background:var(--paper-3);color:var(--ink-2)}
.gift-card .gc-min svg{width:11px;height:11px}
.gift-card .gc-amount{display:flex;align-items:baseline;gap:4px;margin-top:11px}
.gift-card .gc-amount b{font-size:21px;font-weight:700;letter-spacing:-.9px;font-variant-numeric:tabular-nums}
.gift-card .gc-amount span{font-size:10.5px;color:var(--muted)}
.gift-card .gc-bar{height:5px;border-radius:99px;background:var(--paper-3);margin-top:8px;overflow:hidden;
  box-shadow:inset 0 0 0 1px var(--line)}
.gift-card .gc-bar i{display:block;height:100%;border-radius:99px;transition:width .4s ease,background .4s ease}
.gift-card .gc-sub{display:flex;align-items:center;justify-content:space-between;margin-top:6px;
  font-size:10px;color:var(--soft)}
.gift-card .gc-sub em{font-style:normal;color:var(--ink-2);font-weight:600;font-variant-numeric:tabular-nums}
.gift-card .gc-more{max-height:0;overflow:hidden;opacity:0;
  transition:max-height .3s cubic-bezier(.22,.8,.3,1),opacity .2s ease,margin .3s ease;margin-top:0}
.gift-card.open .gc-more{max-height:240px;opacity:1;margin-top:11px}
.gift-card .gc-detail{border-top:1px solid var(--line);padding-top:10px}
.gift-card .gc-detail dl{display:flex;flex-direction:column;gap:8px;margin:0}
.gift-card .gc-detail dl > div{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.gift-card .gc-detail dt{font-size:10.5px;color:var(--muted);flex:0 0 auto}
.gift-card .gc-detail dd{font-size:11px;color:var(--ink-2);text-align:right;font-weight:500;margin:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gift-card .gc-detail dd.gift-hi{color:var(--blue);font-weight:600}
/* 模型名可能很长（"DeepSeek V4.1 Flash 等 2 个"），右对齐 + nowrap 会把开头裁掉，
   这一行单独允许换行，最多两行 */
.gift-card .gc-detail dd.gift-wrap{white-space:normal;overflow:visible;text-overflow:clip;
  line-height:1.45;word-break:break-word}
.gift-card .gc-note{margin-top:9px;font-size:10px;line-height:1.55;color:var(--soft);
  background:var(--paper-2);border-radius:6px;padding:7px 8px}
.gift-card .gc-note b{color:var(--ink-2);font-weight:600}


/* ============ 未登录引导卡 ============ */
.gift-promo{padding:14px 15px 15px}
.gift-promo .gp-kicker{display:inline-block;font-size:10px;color:var(--blue);font-weight:600;
  background:var(--blue-light);border-radius:4px;padding:0 5px;margin-top:2px;line-height:1.6}
.gift-promo .gp-title{margin:11px 0 0;font-size:15px;font-weight:650;letter-spacing:-.3px;line-height:1.45}
.gift-promo .gp-title b{color:var(--blue);font-weight:700}
.gift-promo .gp-desc{margin:6px 0 0;font-size:10.5px;color:var(--muted);line-height:1.6}
.gift-promo .gp-cta{margin-top:12px;display:flex;align-items:center;justify-content:center;gap:4px;
  height:34px;border-radius:8px;background:var(--blue);color:#fff;font-size:12.5px;font-weight:600;
  text-decoration:none;transition:background .15s,transform .15s}
.gift-promo .gp-cta:hover{background:var(--blue-hover)}
.gift-promo .gp-cta:active{transform:scale(.985)}
.gift-promo .gp-cta svg{width:12px;height:12px}
html[data-theme="dark"] .gift-promo .gp-cta{color:#fff}

/* 最小化后的方块 */
.gift-mini{
  position:absolute;right:24px;bottom:28px;width:48px;height:48px;border-radius:12px;
  background:var(--paper);border:1px solid var(--line);
  box-shadow:0 2px 6px rgba(16,24,40,.06),0 10px 24px rgba(16,24,40,.1);
  display:grid;place-items:center;pointer-events:auto;opacity:0;transform:scale(.9);
  transition:opacity .18s ease,transform .2s ease,box-shadow .2s;cursor:pointer;
}
.gift-mini.show{opacity:1;transform:scale(1)}
.gift-mini:hover{box-shadow:0 4px 12px rgba(16,24,40,.1),0 14px 30px rgba(16,24,40,.14)}
.gift-mini svg.gm-ico{width:19px;height:19px;color:var(--blue)}
.gift-mini .gm-pct{position:absolute;right:5px;bottom:3px;font-size:8.5px;font-weight:700;
  color:var(--ink-2);font-variant-numeric:tabular-nums;background:var(--paper);padding:0 2px;
  border-radius:3px;line-height:1.3}


/* ============ 窄屏保护 ============ */
/* 线上 topbar 在 <1024px 已是 padding:0 27px + gap:13px，且 catalog-health 会隐藏。
   这里再给温度条自身加一层收缩：极端窄屏（<420px）只保留图标，把百分比也收起来，
   避免把「8 款有报价」「主题」「账号」挤出可视区。 */
@media (max-width:419px){
  .tp-bar{padding:0 8px;gap:5px;min-width:0}
  .tp-bar .tp-pct{display:none}
  .tp-bar .tp-ico{width:14px;height:14px;flex:0 0 14px}
}

/* ============ 适配 ============ */
@media (prefers-reduced-motion:reduce){
  .tp-bar,.tp-fill,.gift-card,.gift-mini,.gc-more,.gc-bar i,.tp-tip{transition:none!important}
  .tp-bar.low{animation:none!important}
}
/* 窄屏：「8 款有报价」本身会隐藏，温度条只留图标 + 百分比 */
@media (max-width:1023px){
  .tp-bar{padding:0 10px 0 9px}
}
/* 移动端：礼物卡贴右下、收窄；温度条已在窄屏规则里收过 */
@media (max-width:767px){
  .gift-card{right:14px;bottom:14px;width:calc(100vw - 28px);max-width:260px}
  .gift-mini{right:14px;bottom:14px;width:46px;height:46px}
  .tp-bar{height:26px}
  .tp-bar .tp-ico{width:12px;height:12px;flex:0 0 12px}
  .tp-bar .tp-pct{font-size:11px}
}
