/* Crownfall 局外界面：王冠币 / 皮肤商店 / 结算奖励 / 复活询问 / 广告演示（ads-stub）。
   复用 style.css 的变量；只求干净可用，美术之后会重做（类名统一 cfm- 前缀）。 */

/* ---------- 浮层 ---------- */
.cfm-overlay, .cfm-ad { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; overscroll-behavior: contain; padding: 16px 12px; background: rgba(8,12,24,.86); backdrop-filter: blur(3px); animation: cfmFade .18s ease-out; }
.cfm-revive { z-index: 45; align-items: center; }
.cfm-ad { z-index: 60; align-items: center; background: #05070d; outline: none; }
.cfm-panel { position: relative; width: 100%; max-width: 760px; margin: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); color: var(--text); outline: none; }
.cfm-modal { max-width: 420px; text-align: center; animation: cfmPop .25s ease-out; }
.cfm-head { display: flex; align-items: center; gap: 10px; }
.cfm-title { margin: 0; flex: 1; font: 26px var(--title-font); }
.cfm-sub { margin: 6px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.cfm-close { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--panel2); font-size: 18px; }

/* ---------- 按钮（触控目标 ≥ 44px） ---------- */
.cfm-btn { min-height: 44px; padding: 8px 14px; border-radius: 12px; background: var(--panel2); color: var(--text); font-size: 15px; font-weight: bold; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(0,0,0,.35); touch-action: manipulation; transition: transform .08s, filter .2s; }
.cfm-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.cfm-btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.cfm-btn[hidden] { display: none; }
.cfm-btn small { font-size: 12px; font-weight: normal; opacity: .85; }
.cfm-btn-gold { background: linear-gradient(#ffd75e, #e9a80f); color: #2b1d00; }
.cfm-btn-blue { background: linear-gradient(#3d8bff, #2a62d1); color: #fff; }
.cfm-btn-ghost { background: transparent; box-shadow: none; color: var(--muted); font-weight: normal; }
.cfm-btn.is-confirm { background: linear-gradient(#ff7a3d, #e5512b); color: #fff; animation: cfmPulse .8s infinite; }
.cfm-big { min-height: 52px; font-size: 19px; }
.cfm-btn:focus-visible, .cfm-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- 王冠币徽章 ---------- */
.cfm-coin { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: rgba(255,204,51,.12); border: 1px solid rgba(255,204,51,.35); color: var(--gold); font-weight: bold; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cfm-coin.cfm-bump { animation: cfmBump .4s; }

/* ---------- 皮肤商店 ---------- */
.cfm-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cfm-skin { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 10px; text-align: center; background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; }
.cfm-rarity { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 11px; background: rgba(255,255,255,.08); color: var(--muted); }
.cfm-r-rare .cfm-rarity { background: rgba(61,139,255,.22); color: #8ec1ff; }
.cfm-r-epic .cfm-rarity { background: rgba(170,120,255,.22); color: #d6b8ff; }
.cfm-r-legendary .cfm-rarity { background: rgba(255,204,51,.2); color: var(--gold); }
.cfm-skin-icon { font-size: 44px; line-height: 1.15; width: 78px; height: 88px; display: grid; place-items: center; }
.cfm-skin-art { width: 74px; height: 84px; overflow: visible; display: block; }
.cfm-skin-name { font: 18px var(--title-font); }
.cfm-skin-desc { flex: 1; font-size: 11px; line-height: 1.45; color: var(--muted); }
.cfm-skin-price { font-size: 13px; font-weight: bold; color: var(--gold); }
.cfm-skin .cfm-btn { width: 100%; margin-top: 4px; }
.cfm-skin.is-owned .cfm-skin-price { color: var(--muted); }
.cfm-skin.is-equipped { border-color: var(--green); }
.cfm-skin.is-equipped .cfm-skin-price { color: var(--green); }
.cfm-skin.is-locked .cfm-skin-icon { filter: grayscale(.85); opacity: .6; }
.cfm-skin.is-equipped .cfm-skin-art { filter: drop-shadow(0 0 7px rgba(61,220,132,.45)); }
.cfm-skin.is-new { animation: cfmNew .6s; }

/* ---------- 结算奖励 ---------- */
.cfm-rewards { margin: 12px 0; padding: 10px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; }
.cfm-rewards-title { margin: 0 0 4px; font: 17px var(--title-font); color: var(--gold); }
.cfm-reward-list { list-style: none; margin: 0; padding: 0; }
.cfm-reward { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 14px; border-bottom: 1px dashed var(--line); animation: cfmIn .3s both; animation-delay: calc(var(--i, 0) * 80ms); }
.cfm-reward b { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfm-reward.is-ad b { color: var(--green); }
.cfm-reward-short { margin: 4px 0; font-size: 13px; color: var(--muted); }
.cfm-reward-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; font-weight: bold; }
.cfm-reward-total b { font: 30px var(--title-font); color: var(--gold); font-variant-numeric: tabular-nums; }
.cfm-btn-ad { width: 100%; margin-top: 8px; }
.cfm-reward-msg { min-height: 18px; margin: 6px 0 0; font-size: 13px; text-align: center; color: var(--muted); }
.cfm-reward-msg.is-ok { color: var(--green); }
.cfm-reward-balance { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--muted); }

/* ---------- 复活询问 ---------- */
.cfm-revive .cfm-title { color: #ff7a87; font-size: 32px; }
.cfm-text { margin: 10px 0 14px; font-size: 15px; line-height: 1.6; color: #c6cfeb; }
.cfm-timer { height: 6px; margin-bottom: 14px; background: #0b1020; border-radius: 3px; overflow: hidden; }
.cfm-timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transform-origin: left; transition: transform .1s linear; }
.cfm-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 广告演示（ads-stub.js） ---------- */
.cfm-ad-box { width: 100%; max-width: 420px; margin: auto; text-align: center; color: var(--text); }
.cfm-ad-tag { display: inline-block; padding: 2px 10px; border: 1px solid var(--muted); border-radius: 6px; font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.cfm-ad-art { margin: 18px 0 4px; font-size: 72px; animation: cfmBob 1.2s ease-in-out infinite; }
.cfm-ad-text { margin: 0 0 10px; line-height: 1.6; color: #c6cfeb; }
.cfm-ad-text b { color: var(--gold); }
.cfm-ad-count { font: 44px/1.1 var(--title-font); color: var(--gold); }
.cfm-ad-bar { height: 6px; margin: 10px 0 18px; background: #1b2238; border-radius: 3px; overflow: hidden; }
.cfm-ad-bar i { display: block; width: 0; height: 100%; background: var(--gold); transition: width .1s linear; }
.cfm-ad .cfm-btn { min-width: 200px; }

@keyframes cfmFade { from { opacity: 0; } }
@keyframes cfmPop { from { opacity: 0; transform: scale(.92); } }
@keyframes cfmIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes cfmBump { 50% { transform: scale(1.2); } }
@keyframes cfmPulse { 50% { filter: brightness(1.25); } }
@keyframes cfmNew { 50% { transform: scale(1.06); border-color: var(--gold); } }
@keyframes cfmBob { 50% { transform: translateY(-6px); } }

/* ---------- 手机 ---------- */
@media (max-width: 480px) {
  .cfm-overlay, .cfm-ad { padding: 12px 10px; }
  .cfm-panel { padding: 12px; border-radius: 14px; }
  .cfm-title { font-size: 22px; }
  .cfm-skins { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cfm-skin-icon { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfm-overlay, .cfm-ad, .cfm-modal, .cfm-reward, .cfm-coin, .cfm-skin, .cfm-ad-art, .cfm-btn { animation: none !important; }
}
