/* ===================== S5 介面 v3：選角、任務、轉蛋、原版美術字數字（2026-10-04） ===================== */

/* ---- 畫面暗角（增加景深，Talesweaver M 的畫面邊緣較暗） ---- */
body::after { content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(4,4,20,.45) 100%); }

/* ---- 原版美術字傷害數字 ---- */
#fx .dmg.art { -webkit-text-stroke: 0; background: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
#fx .dmg.art span { display: flex; align-items: flex-end; }
#fx .dmg.art span img { height: 24px; margin-left: -3px; }
#fx .dmg.art.crit span img { height: 32px; }
#fx .dmg.art.hurt span img { height: 20px; }
#fx .dmg.art.crit::before { content: none; }
#fx .dmg.art .burst { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -62%); height: 64px; opacity: .95; z-index: -1; }
#fx .dmg.art.miss img { height: 22px; }
/* 連擊數：金色美術字＋「Combo hit」 */
#hud #combo b { display: flex; background: none; -webkit-text-stroke: 0; color: inherit; }
#hud #combo b img { height: 34px; margin-left: -4px; }
#hud #combo span { font-size: 0; width: 64px; height: 30px; margin-left: 2px; background: url(assets/s5/ui/dmg/304_0.png) no-repeat left bottom / contain; display: inline-block; }
#hud #combo { display: flex; align-items: flex-end; }

/* ---- 星石膠囊 ---- */
#hud #topbar .gem svg { width: 15px; height: 15px; }

/* ---- 任務追蹤欄 ---- */
#hud #quest { left: calc(env(safe-area-inset-left) + 6px); top: calc(12px + 104px * var(--s) + 96px * var(--s)); width: 168px; pointer-events: auto; cursor: pointer;
  background: linear-gradient(90deg, rgba(10,12,34,.82), rgba(10,12,34,.35)); border-left: 3px solid var(--gold, #f0d58a); border-radius: 0 8px 8px 0; padding: 4px 8px 6px; }
#quest .qh { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
#hud #quest .qh b { position: static; color: #ffe8a8; font: bold 12px "Microsoft JhengHei", sans-serif; }
#quest .qh small { color: #8f8ac8; font-size: 9px; }
#quest .qr { position: relative; padding: 3px 0; border-top: 1px solid rgba(207,216,242,.15); }
#hud #quest .qr b { position: static; display: block; color: #fff; font: bold 11px "Microsoft JhengHei", sans-serif; text-shadow: 0 0 3px #000; }
#quest .qr span { display: block; color: #c8c4f0; font-size: 10px; text-shadow: 0 0 2px #000; }
#quest .qr em { position: absolute; right: 0; top: 4px; font: bold 10px Arial; font-style: normal; color: #9fd8ff; }
#quest .qr.done em { color: #ffe36a; animation: qPulse .8s ease-in-out infinite alternate; }
#quest .qr .qu { display: inline-block; margin-top: 1px; padding: 0 5px; border-radius: 6px; font: bold 9px/13px "Microsoft JhengHei"; font-style: normal; color: #2a1a00; background: linear-gradient(#ffe8a8, #e0a83a); }
@keyframes qPulse { to { color: #fff; text-shadow: 0 0 6px #ffd23c; } }

/* ---- 轉蛋視窗 ---- */
#dlg .gc { display: grid; gap: 10px; padding: 4px 2px; }
#dlg .gc-top { display: flex; justify-content: space-between; align-items: center; }
#dlg .gc-top b { position: static; color: #fff; font-size: 16px; } #dlg .gc-top small { display: block; color: #a9a3d8; }
#dlg .gc-gem { font: bold 18px Arial; color: #9fe0ff; text-shadow: 0 0 8px #2a8aff; }
#dlg .gc-rate { color: #c8c4f0; font-size: 11px; line-height: 1.6; background: rgba(0,0,0,.25); border-radius: 6px; padding: 6px 8px; }
#dlg .gc-pity { display: flex; align-items: center; gap: 8px; color: #ffe8a8; font-size: 11px; }
#dlg .gc-pity i { flex: 1; height: 8px; border-radius: 4px; background: rgba(0,0,0,.45); box-shadow: 0 0 0 1px rgba(240,213,138,.5); overflow: hidden; }
#dlg .gc-pity em { display: block; height: 100%; background: linear-gradient(90deg, #a87a2a, #ffe36a); }
#dlg .gc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#dlg .gc-btns button { padding: 10px 6px; font: bold 14px "Microsoft JhengHei", sans-serif; color: #fff; border-radius: 10px; border: 0; cursor: pointer;
  background: linear-gradient(#5a64d0, #2a2f80); box-shadow: 0 0 0 2px #cfd8f2, 0 0 0 3.5px #22264e, inset 0 2px 0 rgba(255,255,255,.3), 0 4px 10px rgba(0,0,0,.5); }
#dlg .gc-btns button.ten { background: linear-gradient(#ffcf6a, #c0761a); color: #3a1a00; box-shadow: 0 0 0 2px #fff2c0, 0 0 0 3.5px #7a4a10, inset 0 2px 0 rgba(255,255,255,.5), 0 4px 12px rgba(255,180,60,.4); }
#dlg .gc-btns button small { display: block; font: bold 11px Arial; opacity: .85; }
#dlg .gc-btns button:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }

/* ---- 抽卡揭曉 ---- */
#reveal { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; gap: 18px; justify-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(60,50,140,.55), rgba(4,4,18,.94) 70%); }
#reveal.hide { display: none; }
.rv-cards { display: grid; grid-template-columns: repeat(5, 92px); gap: 12px; }
#reveal.one .rv-cards { grid-template-columns: 120px; }
.rv-card { position: relative; height: 128px; border-radius: 10px; display: grid; justify-items: center; align-content: center; gap: 4px; padding: 6px; text-align: center;
  background: linear-gradient(#2a3070, #10123a); box-shadow: 0 0 0 2px #8a90c8, 0 0 0 3.5px #22264e, 0 6px 14px rgba(0,0,0,.6);
  animation: rvIn .5s cubic-bezier(.2,1.4,.4,1) both; transform-style: preserve-3d; }
@keyframes rvIn { from { opacity: 0; transform: rotateY(90deg) scale(.6); } }
.rv-card b { color: #fff; font: bold 12px "Microsoft JhengHei", sans-serif; }
.rv-card small { color: #c8c4f0; font: bold 11px Arial; }
.rv-card img { width: 60px; height: 70px; object-fit: cover; border-radius: 6px; }
.rv-card img.it { width: 44px; height: 44px; object-fit: contain; }
.rv-ic.seed { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 900 22px Arial; color: #6a3a00; background: radial-gradient(circle at 35% 30%, #fff6c0, #e0a020 60%, #7a4a00); }
.rv-card.char { background: linear-gradient(#5a4ab0, #1c1650); box-shadow: 0 0 0 2px #f6e6b0, 0 0 0 3.5px #8a6420, 0 0 22px rgba(255,214,90,.55); }
.rv-card.char.new::before { content: "NEW"; position: absolute; top: -8px; right: -8px; padding: 1px 6px; border-radius: 8px; font: italic 900 11px Arial; color: #3a1a00; background: linear-gradient(#fff3a0, #ffb020); box-shadow: 0 0 10px #ffd23c; }
.rv-card.char.new { animation: rvIn .5s cubic-bezier(.2,1.4,.4,1) both, rvGlow 1.2s ease-in-out infinite alternate; }
@keyframes rvGlow { to { box-shadow: 0 0 0 2px #fff6c8, 0 0 0 3.5px #8a6420, 0 0 34px rgba(255,214,90,.9); } }
.rv-ok { padding: 8px 40px; font: bold 14px "Microsoft JhengHei", sans-serif; color: #fff; border: 0; border-radius: 8px; cursor: pointer; background: linear-gradient(#5560c8, #2e3590); box-shadow: 0 0 0 2px #cfd8f2, 0 0 0 3.5px #22264e; }
@media (max-height: 420px) { .rv-cards { grid-template-columns: repeat(5, 74px); gap: 8px; } .rv-card { height: 104px; } .rv-card img { width: 48px; height: 56px; } }

/* ---- 新角色解鎖 ---- */
#unlock { position: fixed; inset: 0; z-index: 41; display: grid; place-items: center; background: rgba(4,4,18,.8); }
#unlock.hide { display: none; }
.ul-card { position: relative; width: 240px; padding: 18px 16px 14px; border-radius: 14px; text-align: center; overflow: hidden;
  background: linear-gradient(#3a3290, #12103a); box-shadow: 0 0 0 2px #f6e6b0, 0 0 0 4px #8a6420, 0 0 40px rgba(255,214,90,.5); animation: rvIn .6s cubic-bezier(.2,1.4,.4,1) both; }
.ul-ray { position: absolute; inset: -60%; background: conic-gradient(from 0deg, transparent 0 10%, rgba(255,230,140,.18) 12% 14%, transparent 16% 35%, rgba(255,230,140,.18) 37% 39%, transparent 41% 60%, rgba(255,230,140,.18) 62% 64%, transparent 66% 85%, rgba(255,230,140,.18) 87% 89%, transparent 91%); animation: autoRing 8s linear infinite; }
.ul-card img { position: relative; width: 96px; height: 112px; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 2px #f6e6b0, 0 4px 12px rgba(0,0,0,.6); }
.ul-card small { position: relative; display: block; margin-top: 8px; font: italic 900 11px Arial; letter-spacing: 2px; color: #ffe36a; }
.ul-card b { position: relative; display: block; font: bold 20px "Microsoft JhengHei", sans-serif; color: #fff; text-shadow: 0 0 10px #8a7aff; }
.ul-card span { position: relative; display: block; margin: 6px 0 10px; font-size: 11px; color: #c8c4f0; line-height: 1.5; }
.ul-card button { position: relative; padding: 7px 26px; font: bold 13px "Microsoft JhengHei", sans-serif; color: #3a1a00; border: 0; border-radius: 8px; cursor: pointer; background: linear-gradient(#fff3a0, #e0a020); }

/* ---- 選角畫面 ---- */
#select { position: fixed; inset: 0; z-index: 70; overflow: hidden; color: #fff; font-family: "Microsoft JhengHei", "PingFang TC", sans-serif; transition: opacity .35s; }
#select.out { opacity: 0; }
.sel-bg { position: absolute; inset: -40px; background: url(assets/s5/map/100864/2_1.webp) center / cover; filter: blur(6px) brightness(.45) saturate(1.2); }
#select::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(40,30,110,.25), rgba(4,4,18,.85) 80%); }
.sel-wrap { position: relative; height: 100%; display: grid; grid-template-rows: auto 1fr; padding: 14px 20px; box-sizing: border-box; gap: 10px; }
.sel-title { text-align: center; }
.sel-title small { display: block; font: italic 900 11px Arial; letter-spacing: 4px; color: #ffe36a; }
.sel-title b { display: block; font-size: 22px; text-shadow: 0 0 12px #6d63c4; }
.sel-title span { font-size: 11px; color: #b8b0ff; }
.sel-main { display: grid; grid-template-columns: 1fr 250px; gap: 18px; align-items: center; min-height: 0; }
.sel-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 110px)); gap: 12px; justify-content: center; }
.sel-card { position: relative; border-radius: 10px; padding: 6px 6px 8px; text-align: center; cursor: pointer;
  background: linear-gradient(#2a3070, #10123a); box-shadow: 0 0 0 2px #6a64b0, 0 0 0 3.5px #1a1a4a, 0 6px 14px rgba(0,0,0,.6); transition: transform .15s, box-shadow .15s; }
.sel-card img { width: 100%; aspect-ratio: 83 / 98; object-fit: cover; border-radius: 6px; display: block; }
.sel-card b { display: block; margin-top: 4px; font-size: 13px; }
.sel-card small { color: #b8b0ff; font-size: 10px; }
.sel-card:hover { transform: translateY(-3px); }
.sel-card.on { transform: translateY(-4px); background: linear-gradient(#5a4ab0, #1c1650); box-shadow: 0 0 0 2px #f6e6b0, 0 0 0 4px #8a6420, 0 0 24px rgba(255,214,90,.55); }
.sel-info { display: grid; justify-items: center; text-align: center; padding: 10px 12px 14px; border-radius: 12px;
  background: linear-gradient(rgba(26,30,72,.85), rgba(10,12,34,.9)); box-shadow: 0 0 0 2px #f6e6b0, 0 0 0 4px #6b4f1c, 0 10px 30px rgba(0,0,0,.6); }
.sel-info canvas { width: 170px; height: 170px; }
.sel-name { font-size: 22px; font-weight: bold; text-shadow: 0 0 10px #8a7aff; }
.sel-role { display: inline-block; margin: 2px 0 4px; padding: 1px 10px; border-radius: 8px; font-size: 11px; color: #3a1a00; background: linear-gradient(#ffe8a8, #e0a83a); }
.sel-desc { margin: 4px 0 10px; font-size: 12px; color: #d8d2ff; line-height: 1.5; min-height: 36px; }
.sel-go { padding: 10px 18px; font: bold 14px "Microsoft JhengHei", sans-serif; color: #3a1a00; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(#fff3a0, #e0a020); box-shadow: 0 0 0 2px #fff6c8, 0 0 0 3.5px #8a6420, 0 4px 14px rgba(255,180,60,.45); animation: goGlow 1.4s ease-in-out infinite alternate; }
@keyframes goGlow { to { box-shadow: 0 0 0 2px #fff6c8, 0 0 0 3.5px #8a6420, 0 4px 24px rgba(255,200,80,.8); } }
@media (max-height: 430px) {
  .sel-title b { font-size: 18px; } .sel-wrap { padding: 8px 14px; gap: 6px; }
  .sel-cards { grid-template-columns: repeat(6, minmax(0, 84px)); gap: 8px; } .sel-main { grid-template-columns: 1fr 210px; gap: 12px; }
  .sel-info canvas { width: 120px; height: 120px; } .sel-desc { font-size: 11px; margin: 2px 0 6px; }
}
@media (orientation: portrait) { .sel-main { grid-template-columns: 1fr; } }
