/* Battle screen. Everything scoped under #scr-battle. */
#scr-battle { overflow: hidden; --cw: 78px; --ch: 112px; }
#scr-battle .bt-abs { position: absolute; pointer-events: none; }
#scr-battle .bt-hit { pointer-events: auto; }
#scr-battle img { pointer-events: none; -webkit-user-drag: none; }

/* boss bar */
#scr-battle .bt-top { left: 64px; right: 64px; top: 8px; height: 50px; display: flex; align-items: center; gap: 6px; }
#scr-battle .bt-boss-ico { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: #3b2a45 center/cover; flex: none; box-shadow: 0 3px 0 rgba(43,29,26,.5); }
#scr-battle .bt-boss-mid { flex: 1; min-width: 0; }
#scr-battle .bt-boss-name { font-size: 14px; font-weight: 700; line-height: 16px; white-space: nowrap; overflow: hidden; }
#scr-battle .bt-bar { position: relative; height: 22px; border-radius: 12px; background: #2b1d1a; border: 3px solid var(--ink); overflow: hidden; box-shadow: 0 3px 0 rgba(43,29,26,.5); }
#scr-battle .bt-bar-fill { position: absolute; inset: 0; width: 100%; background: linear-gradient(#b266d9, #6a3a99); transition: width .3s ease; border-radius: 9px; }
#scr-battle .bt-bar-num { position: absolute; inset: 0; text-align: center; font-size: 15px; line-height: 16px; font-weight: 700; }
#scr-battle .bt-turn { flex: none; min-width: 44px; padding: 4px 8px; text-align: center; border-radius: 12px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); font-weight: 700; font-size: 14px; white-space: nowrap; }

/* toggles */
#scr-battle .bt-toggles { right: 8px; top: 64px; display: flex; gap: 8px; }
#scr-battle .bt-pill { min-width: 70px; height: 44px; padding: 0 10px; border-radius: 22px; border: 3px solid var(--ink); background: #5b4a46; color: #d9ccc0; font: 700 15px var(--font-ui); cursor: pointer; transition: transform .12s, background .2s; box-shadow: 0 3px 0 rgba(43,29,26,.55); }
#scr-battle .bt-pill.on { background: linear-gradient(#6fd1b3, #3a9a80); color: #fff; }
#scr-battle .bt-pill:active { transform: scale(.92); }
#scr-battle .bt-pill.focus { box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); }

/* unit labels */
#scr-battle .bt-label { position: absolute; left: 0; top: 0; width: 76px; margin-left: -38px; display: flex; flex-direction: column; align-items: center; gap: 1px; pointer-events: none; will-change: transform; z-index: 3; }
#scr-battle .bt-label.hit { pointer-events: auto; }
#scr-battle .bt-label.hidden { display: none; }
#scr-battle .bt-stars { color: var(--gold); font-size: 15px; line-height: 15px; letter-spacing: -1px; text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink); }
#scr-battle .bt-chips { display: flex; gap: 4px; }
#scr-battle .bt-c { min-width: 26px; height: 26px; padding: 0 3px; border-radius: 13px; border: 2.5px solid var(--ink); font: 700 16px/21px var(--font-ui); color: #fff; text-align: center; text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
#scr-battle .bt-c.atk { background: #f0603a; }
#scr-battle .bt-c.hp { background: #3fae8f; }
#scr-battle .bt-c.heart { background: #e8587a; min-width: 52px; }
#scr-battle .bt-label.enemy .bt-c.atk { background: #c14a8c; }
#scr-battle .bt-label.enemy .bt-c.hp { background: #6a56b8; }
#scr-battle .bt-label.hero { display: none; }

/* matchup stamp */
#scr-battle .bt-badge { position: absolute; left: 0; top: 0; margin: -20px 0 0 -20px; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); display: none; align-items: center; justify-content: center; font: 700 15px var(--font-title); color: #fff; z-index: 4; pointer-events: none; transform-origin: center; }
#scr-battle .bt-badge.good { display: flex; background: var(--seal); animation: bt-stamp .3s cubic-bezier(.3,1.6,.5,1) both; }
#scr-battle .bt-badge.bad { display: flex; background: #8a8580; }

/* slot buttons */
#scr-battle .bt-slot { position: absolute; left: 0; top: 0; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; border: 3px dashed transparent; background: transparent; cursor: pointer; z-index: 5; pointer-events: auto; }
#scr-battle .bt-slot.active { border-color: rgba(255,243,176,.9); background: rgba(255,243,176,.16); animation: pulse 1s infinite; }
#scr-battle .bt-slot.focus { border-color: #fff3b0; box-shadow: 0 0 14px 4px rgba(255,220,120,.85); }
#scr-battle .bt-slot-hint { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 4px; padding: 2px 10px; border-radius: 12px; background: var(--seal); color: #fff; border: 2.5px solid var(--ink); font: 700 15px var(--font-title); white-space: nowrap; display: none; pointer-events: none; }
#scr-battle .bt-slot.hint .bt-slot-hint { display: block; }

/* floating texts */
#scr-battle .bt-float { position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; font: 700 26px var(--font-title); color: #fff; opacity: 0; white-space: nowrap; text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 3px 0 rgba(43,29,26,.6); }
#scr-battle .bt-float.dmg { color: #ff6a4a; }
#scr-battle .bt-float.heal { color: #6fe0b8; }
#scr-battle .bt-float.stamp { color: #fff; background: var(--seal); border: 3px solid var(--ink); border-radius: 10px; padding: 0 8px; font-size: 22px; }
#scr-battle .bt-float.go { animation: bt-float var(--d, .9s) ease-out both; }
@keyframes bt-float { 0% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 6px)) scale(.5); } 15% { opacity: 1; transform: translate(var(--x), var(--y)) scale(1.25); } 30% { transform: translate(var(--x), calc(var(--y) - 10px)) scale(1); } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) - 50px)) scale(1); } }
@keyframes bt-stamp { 0% { transform: scale(2.2) rotate(-20deg); opacity: 0; } 100% { transform: scale(1) rotate(-8deg); opacity: 1; } }
#scr-battle .bt-flash { inset: 0; box-shadow: inset 0 0 60px 14px rgba(220,30,30,.85); opacity: 0; z-index: 9; }
#scr-battle .bt-flash.go { animation: bt-flash .45s ease-out; }
@keyframes bt-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* bottom */
#scr-battle .bt-sub { left: 8%; right: 8%; top: 118px; text-align: center; z-index: 6; }
#scr-battle .bt-sub span { display: inline-block; padding: 6px 12px; border-radius: 12px; background: rgba(43,29,26,.8); color: #fff6e6; font-size: 15px; font-weight: 700; line-height: 20px; animation: slide-up .2s both; }
#scr-battle .bt-status { left: 6px; right: 6px; bottom: 150px; height: 62px; display: flex; align-items: center; gap: 6px; z-index: 6; }
#scr-battle .bt-status > * { pointer-events: auto; }
#scr-battle .bt-hpchip { flex: none; display: flex; align-items: center; gap: 3px; height: 34px; padding: 0 8px; border-radius: 17px; background: #e8587a; border: 3px solid var(--ink); font: 700 16px var(--font-ui); white-space: nowrap; box-shadow: 0 3px 0 rgba(43,29,26,.5); }
#scr-battle .bt-pool { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; pointer-events: none; }
#scr-battle .bt-drops { display: flex; gap: 2px; flex-wrap: nowrap; }
#scr-battle .bt-drop { width: 11px; height: 15px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; border: 2px solid var(--ink); background: #4a3a38; transition: background .2s, transform .2s; }
#scr-battle .bt-drop.full { background: radial-gradient(circle at 35% 30%, #7a6a9a, #1d1530 70%); box-shadow: 0 0 0 1px #b9a3e8; }
#scr-battle .bt-pool-num { font: 700 16px var(--font-ui); text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink); }
#scr-battle .bt-skill { flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; }
#scr-battle .bt-skill-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper) center/80% no-repeat; cursor: pointer; padding: 0; transition: transform .12s, filter .2s; box-shadow: 0 3px 0 rgba(43,29,26,.5); }
#scr-battle .bt-skill-btn:active { transform: scale(.9); }
#scr-battle .bt-skill-btn.off { filter: grayscale(1) brightness(.8); }
#scr-battle .bt-skill-btn.mode { box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.9); animation: pulse 1s infinite; }
#scr-battle .bt-skill-btn.focus { box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); }
#scr-battle .bt-skill-cost { position: absolute; right: -8px; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: #2b1d4a; color: #fff; border: 2px solid var(--ink); font: 700 13px/16px var(--font-ui); text-align: center; }
#scr-battle .bt-skill-lbl { font-size: 12px; font-weight: 700; line-height: 13px; white-space: nowrap; text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
#scr-battle .bt-end { flex: none; min-width: 92px; max-width: 120px; padding: 0 6px; font-size: 16px; }
#scr-battle .bt-end.off { filter: grayscale(.8) brightness(.85); }

/* hand */
#scr-battle .bt-hand { left: 0; right: 0; bottom: 0; height: 146px; z-index: 6; }
#scr-battle .bt-card { position: absolute; bottom: 8px; width: var(--cw); height: var(--ch); border-radius: 10px; background: #fff6e6; border: 3px solid var(--fc, var(--ink)); box-shadow: 0 4px 0 rgba(43,29,26,.5); cursor: pointer; pointer-events: auto; touch-action: none; transition: left .22s ease, transform .18s cubic-bezier(.3,1.5,.5,1), filter .2s; overflow: hidden; color: var(--ink); }
#scr-battle .bt-card.grad::before { content: ""; position: absolute; inset: -3px; z-index: -1; }
#scr-battle .bt-card .art { position: absolute; left: 4px; right: 4px; top: 20px; bottom: 34px; background: center/contain no-repeat; }
#scr-battle .bt-card .cost { position: absolute; left: 2px; top: 2px; width: 22px; height: 26px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(circle at 35% 30%, #6a5a8a, #1d1530 75%); border: 2px solid var(--ink); color: #fff; font: 700 15px/22px var(--font-ui); text-align: center; z-index: 2; }
#scr-battle .bt-card .fam { position: absolute; right: 3px; top: 3px; display: flex; gap: 1px; z-index: 2; }
#scr-battle .bt-card .fam img { width: 22px; height: 22px; }
#scr-battle .bt-card .nm { position: absolute; left: 2px; right: 2px; bottom: 21px; text-align: center; font-weight: 700; white-space: nowrap; line-height: 14px; }
#scr-battle .bt-card .st { position: absolute; bottom: 2px; height: 20px; min-width: 24px; padding: 0 5px; border-radius: 10px; border: 2px solid var(--ink); color: #fff; font: 700 14px/16px var(--font-ui); text-align: center; text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
#scr-battle .bt-card .st.atk { left: 3px; background: #f0603a; }
#scr-battle .bt-card .st.hp { right: 3px; background: #3fae8f; }
#scr-battle .bt-card.dim { filter: grayscale(.6) brightness(.8); }
#scr-battle .bt-card.locked { filter: brightness(.85); }
#scr-battle .bt-card.sel { transform: translateY(-16px) scale(1.06); box-shadow: 0 0 0 3px #ffd36b, 0 0 18px 6px rgba(255,211,107,.9); z-index: 20 !important; }
#scr-battle .bt-card.focus { box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); transform: translateY(-8px); }
#scr-battle .bt-card.new { animation: bt-draw .35s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes bt-draw { 0% { transform: translate(120px, 60px) scale(.5) rotate(12deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
#scr-battle .bt-ghost { position: fixed; width: var(--cw); height: var(--ch); margin: -56px 0 0 -39px; z-index: 60; pointer-events: none; opacity: .92; transform: scale(1.1) rotate(4deg); }
#scr-battle .bt-ghost .bt-card { position: absolute; left: 0; bottom: 0; transition: none; }

/* banners & tips */
#scr-battle .bt-banner { left: 0; right: 0; top: 34%; text-align: center; z-index: 30; font: 700 34px var(--font-title); color: var(--gold); }
#scr-battle .bt-banner > div { display: inline-block; padding: 4px 20px; animation: bt-slam .5s cubic-bezier(.2,1.6,.4,1) both; max-width: 94%; }
#scr-battle .bt-banner.out > div { animation: bt-out .25s ease-in both; }
#scr-battle .bt-banner img { display: block; margin: 0 auto 4px; width: 110px; height: 110px; object-fit: contain; animation: pop-in .4s cubic-bezier(.3,1.6,.5,1) both; }
#scr-battle .bt-banner.small { font-size: 26px; color: #fff; top: 40%; }
@keyframes bt-slam { 0% { transform: scale(2.6); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bt-out { to { transform: translateY(-20px) scale(.9); opacity: 0; } }
#scr-battle .bt-tip { left: 8px; right: 8px; bottom: 218px; z-index: 12; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 16px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); font-size: 15px; font-weight: 700; line-height: 20px; box-shadow: 0 4px 0 rgba(43,29,26,.5); cursor: pointer; pointer-events: auto; animation: pop-in .28s cubic-bezier(.3,1.6,.5,1) both; }
#scr-battle .bt-tip img { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; flex: none; background: #ffd9c0; }
#scr-battle .bt-tip.hidden { display: none; }

/* modals: info + result + revive */
#scr-battle .modal { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(20,12,10,.55); pointer-events: auto; animation: fadein .2s both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#scr-battle .modal.hidden { display: none; }
#scr-battle .modal .panel { width: min(92%, 380px); max-height: 92%; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 6px; font-weight: 700; }
#scr-battle .bt-info { width: min(86%, 330px); }
#scr-battle .bt-info .art { width: 120px; height: 120px; background: center/contain no-repeat; }
#scr-battle .bt-info h3 { margin: 0; font: 700 24px var(--font-title); }
#scr-battle .bt-info .row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 15px; }
#scr-battle .bt-info .row img { width: 24px; height: 24px; }
#scr-battle .bt-info p { margin: 0; font-size: 14px; line-height: 19px; font-weight: 600; }
#scr-battle .bt-title { font: 700 40px var(--font-title); color: var(--gold); animation: bt-slam .5s cubic-bezier(.2,1.6,.4,1) both; }
#scr-battle .bt-title.bad { color: #c9b8d9; }
#scr-battle .bt-stars3 { display: flex; gap: 6px; justify-content: center; }
#scr-battle .bt-star { font-size: 48px; line-height: 50px; color: #cdbfae; text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink); opacity: .55; }
#scr-battle .bt-star.on { color: var(--gold); opacity: 1; animation: bt-slam .45s cubic-bezier(.2,1.6,.4,1) both; }
#scr-battle .bt-goals { display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-align: left; }
#scr-battle .bt-goal { opacity: .5; }
#scr-battle .bt-goal.on { opacity: 1; }
#scr-battle .bt-goal.on::before { content: "★ "; color: #d9992b; }
#scr-battle .bt-goal:not(.on)::before { content: "☆ "; }
#scr-battle .bt-gold { display: flex; align-items: center; gap: 6px; font: 700 26px var(--font-ui); color: #7a4a10; }
#scr-battle .bt-gold img { width: 34px; height: 34px; object-fit: contain; }
#scr-battle .bt-newcards { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; font-size: 13px; }
#scr-battle .bt-newcards > div { width: 64px; animation: pop-in .35s cubic-bezier(.3,1.6,.5,1) both; }
#scr-battle .bt-newcards .art { width: 58px; height: 58px; margin: 0 auto; background: center/contain no-repeat; }
#scr-battle .bt-btns { display: flex; flex-direction: column; gap: 8px; align-items: stretch; width: 100%; padding: 0 10px; }
#scr-battle .bt-btns .btn { width: 100%; }
#scr-battle .bt-btns.row { flex-direction: row; justify-content: center; flex-wrap: wrap; }
#scr-battle .bt-btns.row .btn { width: auto; flex: 1; min-width: 96px; }
#scr-battle .bt-bellrow { display: flex; align-items: center; gap: 8px; font: 700 18px var(--font-ui); }
#scr-battle .bt-bellrow img { width: 44px; height: 44px; object-fit: contain; }
#scr-battle .btn .cur { width: 22px; height: 22px; }

@media (max-height: 640px) {
  #scr-battle .bt-hand { height: 130px; }
  #scr-battle .bt-status { bottom: 132px; height: 56px; }
  #scr-battle .bt-tip { bottom: 192px; padding: 4px 10px; font-size: 14px; line-height: 17px; border-width: 2px; }
  #scr-battle .bt-tip img { display: none; }
  #scr-battle { --cw: 70px; --ch: 100px; }
}
