/* ============================================================
   components.css — 完整设计稿「标准件 kit」（照搬 design/css/components.css）
   ------------------------------------------------------------
   铁律#1：照搬设计稿。本文件 = design 的 components.css 逐条搬入，
   仅两处适配：
     (a) 删 @font-face —— 本地 FusionPixel 已由 pixel-fonts.css 提供；
     (b) .scrim 由设计稿的 position:absolute 改为 position:fixed —— 覆盖层
         挂在 document.body（Fit Stage 的 transform 之外），fixed 才能正确
         铺满视口、不被 #app 的 scale 缩放错位。
   加载顺序：theme.css → base.css → 本文件（在 base 之后，令设计 kit 的
     .btn/.glass/.modal 等覆盖 base.css 的同名通用规则，取得设计权威）。
   取色全走 theme.css 的设计令牌桥接（--panel、--line、--gold、--r-x、--sh-x 等）。
   省热铁律：仿玻璃 = 半透明实色 + 内高光，绝不写 backdrop-filter/blur。
   ============================================================ */

/* ---------------- glass panel ---------------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2), inset 0 1px 0 var(--panel-hi);
}
.glass-deep { background: var(--panel-2); }

/* ---------------- buttons ---------------- */
.btn {
  --btn-bg: var(--panel);
  --btn-fg: var(--t1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .5px;
  line-height: 1;
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255,255,255,.14);
  transition: transform .12s, filter .15s, box-shadow .15s;
  white-space: nowrap;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn:not(:disabled):hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }

.btn-gold   { --btn-bg: linear-gradient(135deg, var(--gold), var(--gold-d)); --btn-fg: #2a1a00; border-color: rgba(255,210,80,.5); box-shadow: 0 3px 12px rgba(255,200,40,.3), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-play   { --btn-bg: linear-gradient(135deg, var(--blue), var(--blue-d)); --btn-fg: #fff; border-color: rgba(90,160,230,.5); }
.btn-green  { --btn-bg: linear-gradient(135deg, var(--green), #1f8a59); --btn-fg: #07150e; border-color: rgba(60,200,140,.5); }
.btn-red    { --btn-bg: linear-gradient(135deg, var(--red), var(--red-d)); --btn-fg: #fff; border-color: rgba(255,100,140,.5); }
.btn-discard{ --btn-bg: linear-gradient(135deg, #cc6a33, #a04420); --btn-fg: #fff; border-color: rgba(220,130,70,.5); }
.btn-ghost  { --btn-bg: rgba(255,255,255,.06); --btn-fg: var(--t2); border-color: var(--line); box-shadow: none; }
/* 旧屏沿用的 .btn-secondary 别名（视觉 = ghost），过渡期保留 */
.btn-secondary { --btn-bg: rgba(255,255,255,.06); --btn-fg: var(--t2); border-color: var(--line); box-shadow: none; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }

/* small round tool button (gears, help, audio) */
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line-2);
  color: var(--t2);
  font-size: 16px; font-weight: 800;
  transition: background .15s, color .15s, transform .1s;
  touch-action: manipulation;
}
.icon-btn:hover { background: rgba(255,255,255,.16); color: var(--gold); }
.icon-btn:active { transform: scale(.92); }

/* ---------------- standardized header bar ---------------- */
.hdr {
  display: flex; align-items: center; gap: 12px;
  flex: none;
}
.hdr-title { font-size: 19px; font-weight: 900; color: var(--gold); letter-spacing: 1px; }
.hdr-sub { font-size: 12px; color: var(--t2); }
.hdr-tools { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.hdr-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 12px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); border: 1px solid var(--line);
}
.hdr-stat .k { font-size: 9px; color: var(--t3); font-weight: 700; letter-spacing: .5px; }
.hdr-stat .v { font-size: 16px; font-weight: 900; color: var(--t1); line-height: 1.1; }
.hdr-stat .v.gold { color: var(--gold); }

/* ---------------- HP bar (you / opp) ---------------- */
.hp {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
}
.hp + .hp { margin-top: 5px; }
.hp-name { font-size: 11px; font-weight: 800; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.hp.me .hp-name { color: #8fe0c0; }
.hp.opp .hp-name { color: #ff9bb2; }
.hp-track {
  position: relative; height: 13px; border-radius: 7px;
  background: rgba(0,0,0,.45); overflow: hidden;
  border: 1px solid rgba(0,0,0,.5); box-shadow: inset 0 1px 2px rgba(0,0,0,.5);
}
.hp-fill { position: absolute; inset: 0 auto 0 0; border-radius: 7px; transition: width .4s cubic-bezier(.3,1,.4,1); }
.hp.me .hp-fill { background: linear-gradient(90deg, #1f8a59, #2ee08a); }
.hp.opp .hp-fill { background: linear-gradient(90deg, #c0285a, #ff5277); }
.hp-num { font-size: 11px; font-weight: 900; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- badges / chips ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.08); border: 1px solid var(--line-2); color: var(--t2);
}
.badge-gold { background: rgba(255,200,40,.14); border-color: rgba(255,200,40,.4); color: var(--gold); }
.badge-green{ background: rgba(46,194,126,.14); border-color: rgba(46,194,126,.4); color: #6fe0aa; }
.badge-red  { background: rgba(255,82,119,.14); border-color: rgba(255,82,119,.42); color: #ff8fa6; }
.badge-violet{ background: rgba(176,123,255,.16); border-color: rgba(176,123,255,.45); color: #cdb0ff; }

/* pill row (economy hints etc) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(0,0,0,.28); border: 1px solid var(--line); color: var(--t2);
  white-space: nowrap;
}
.pill b { color: var(--gold); }

/* section label */
.sec-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 900; color: var(--t1);
  letter-spacing: .5px; margin-bottom: 7px; white-space: nowrap;
}
.sec-title .hint { font-size: 10px; font-weight: 600; color: var(--t3); letter-spacing: 0; }

/* coin token glyph */
.coin { color: var(--gold); font-weight: 900; }

/* ---------------- TOKEN — the blue battle-board chip (matches .chip-icon) ---------------- */
.token {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #1f4f87);
  border: 2.5px solid #5599dd;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.3), 0 1px 3px rgba(0,0,0,.4);
}
.token i { border-radius: 50%; background: rgba(255,255,255,.5); }
.token-sm { width: 18px; height: 18px; border-width: 1.5px; }
.token-sm i { width: 4px; height: 4px; }
.token-md { width: 26px; height: 26px; border-width: 2px; }
.token-md i { width: 6px; height: 6px; }
.token-lg { width: 32px; height: 32px; border-width: 2.5px; }
.token-lg i { width: 7px; height: 7px; }
.token-xl { width: 44px; height: 44px; border-width: 3px; }
.token-xl i { width: 10px; height: 10px; }

/* overlay scrim + modal —— .scrim 适配为 fixed（挂 body、在 stage transform 外） */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 7, 5, 0.74);
  display: flex; align-items: center; justify-content: center;
  /* 挂 body、在 .stage-viewport 之外 → 不吃 viewport 的 safe-area padding。
     横屏刘海/灵动岛在左右、home 条在底 → 这里显式吃 env(safe-area)，把弹窗(及右上 ✕、
     左上标签页)推离遮挡带；无凹口设备 sa=0 → 退化回 24px，桌面零影响。 */
  padding:
    max(24px, var(--sa-top, 0px))
    max(24px, var(--sa-right, 0px))
    max(24px, var(--sa-bottom, 0px))
    max(24px, var(--sa-left, 0px));
}
.modal {
  width: min(560px, 92%); max-height: 92%;
  display: flex; flex-direction: column;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: 0 18px 60px rgba(0,0,0,.6), inset 0 1px 0 var(--panel-hi);
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; flex: none; }
.modal-head .t { font-size: 17px; font-weight: 900; color: var(--gold); }
.modal-body { padding: 4px 18px 18px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; gap: 10px; padding: 12px 18px 16px; flex: none; }
.modal-x { margin-left: auto; }

/* waiting pulse */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.pulse { animation: pulse 1.5s ease-in-out infinite; }
