/* css/battle.css — זירת הקרב, משותפת לקרב פראי/מאמן (battle.html) ול-PvP (pvp.html) */
.battle-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 18px 16px 40px; }

.battle-scene {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    /* בלי min-height: יחד עם aspect-ratio הוא מרחיב את הזירה מעבר למסך בטלפון */
    aspect-ratio: 16 / 9;
    min-width: 0;
    /* רקע השטח הנוכחי (terrainBg ב-ui.js) — כמו כרטיס הקרב של הבוט */
    background:
        linear-gradient(180deg, rgba(0,0,0,.05) 40%, rgba(0,0,0,.35)),
        var(--scene-bg, none) center / cover no-repeat,
        var(--bg-secondary);
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
    margin-bottom: 16px;
}
/* "במה" אליפטית מתחת לכל פוקימון, כמו במשחקים */
.pad {
    position: absolute; z-index: 1; border-radius: 50%;
    background: radial-gradient(ellipse at center,
        rgba(255,255,255,.28) 0, rgba(255,255,255,.12) 45%, rgba(0,0,0,.28) 62%, transparent 72%);
    display: none;
}
.pad.wild   { top: 40%;    right: 7%;   width: 30%; max-width: 265px; aspect-ratio: 4 / 1; }
.pad.player { bottom: 3%;  left: 6%; width: 34%; max-width: 305px; aspect-ratio: 4 / 1; }

.loading-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    background: rgba(10,10,15,.72);
    z-index: 5;
    font-weight: 600;
}

.status-box {
    position: absolute;
    background: rgba(15,15,25,.82);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    min-width: 190px;
    z-index: 3;
}
.status-box.wild   { top: 18px; left: 18px; }
.status-box.player { bottom: 18px; right: 18px; }

.status-name {
    display: flex; justify-content: space-between;
    align-items: center; gap: 10px; margin-bottom: 6px;
}
.status-name .nm { font-weight: 700; font-size: .98rem; }

/* מה פעיל על הפוקימון (בלבול, זרעים...) ושינויי סטטים — battleFlagsHtml ב-ui.js */
.bflags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 240px; }
.bflags:empty { display: none; }
.bflag, .bstage { font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
    background: rgba(255,255,255,.12); color: #fff; cursor: default; }
.bstage.up   { background: rgba(72,187,120,.3);  color: #c6f6d5; }
.bstage.down { background: rgba(245,101,101,.3); color: #fed7d7; }
.status-name .lv { color: var(--text-secondary); font-size: .82rem; }

.sprite {
    position: absolute;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
    transition: transform .25s ease;
    z-index: 2;
}
.sprite.wild   { top: 12%;  right: 9%;   width: 26%; max-width: 230px; aspect-ratio: 1; height: auto; }
.sprite.player { bottom: -2%; left: 8%; width: 30%; max-width: 270px; aspect-ratio: 1; height: auto; }

.sprite.hit    { animation: hitShake .32s ease; }
.sprite.attack { animation: lunge .3s ease; }
.sprite.faint  { animation: faintDrop .6s ease forwards; }

@keyframes hitShake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-9px); opacity:.6; }
    75% { transform: translateX(9px); }
}
@keyframes lunge {
    0%,100% { transform: translate(0,0); }
    50% { transform: translate(18px,-10px) scale(1.06); }
}
@keyframes faintDrop {
    to { transform: translateY(42px) rotate(-14deg); opacity: 0; }
}

/* קרב מאמן: פס עם שם המאמן ופוכדורים — כמה פוקימונים נשארו לו */
.trainer-bar {
    display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
    padding: 10px 14px; border-radius: var(--radius-md);
    background: var(--bg-secondary); border: 1px solid var(--glass-border);
    border-inline-start: 5px solid var(--accent-primary);
}
.trainer-bar[hidden] { display: none; }
.tb-emoji { font-size: 1.8rem; line-height: 1; }
.tb-text { flex: 1; min-width: 0; }
.tb-kicker { font-size: .78rem; color: var(--text-secondary); }
.tb-name { font-weight: 800; font-size: 1.08rem; }
.tb-team { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.tb-ball {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #1b1b24; position: relative;
    background: linear-gradient(180deg, #e3350d 0 46%, #1b1b24 46% 54%, #f4f4f4 54%);
}
.tb-ball::after {
    content: ''; position: absolute; inset: 0; margin: auto; width: 6px; height: 6px;
    border-radius: 50%; background: #f4f4f4; border: 1.5px solid #1b1b24;
}
.tb-ball.out { filter: grayscale(1) brightness(.55); opacity: .55; }
.tb-ball.now { box-shadow: 0 0 0 2px var(--highlight); }
.sprite.enter { animation: enterPop .45s ease; }
@keyframes enterPop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.badge-won { text-align: center; }
.badge-won-emoji { font-size: 4.5rem; line-height: 1.2; animation: enterPop .6s ease; }
.badge-won-name { font-size: 1.3rem; font-weight: 800; color: var(--highlight); }
.log-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    height: 132px;
    overflow-y: auto;
    font-size: .92rem;
    line-height: 1.65;
    margin-bottom: 14px;
}
.log-panel div { margin-bottom: 4px; }
.log-wrap { position: relative; }
.log-history-btn {
    position: absolute; top: 8px; left: 10px; z-index: 1;
    padding: 4px 10px; font-size: .8rem; font-family: var(--font-main);
    border-radius: var(--radius-sm, 8px); border: 1px solid var(--glass-border);
    background: var(--bg-tertiary); color: var(--text-primary); cursor: pointer;
}
.log-history-btn:hover { border-color: var(--accent-primary); }
.replay-scene { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.replay-sprite { width: 96px; height: 96px; image-rendering: pixelated; flex-shrink: 0; }
.replay-bars { flex: 1; min-width: 0; }
.replay-side { font-size: .78rem; color: var(--text-secondary); margin-top: 6px; }
.replay-mon-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.replay-mon-head .lv { margin-inline-start: auto; color: var(--text-secondary); font-size: .85rem; }
.replay-log-title { font-weight: 700; margin: 6px 0; }
.replay-log {
    background: var(--bg-secondary); border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); padding: 10px 12px; max-height: 220px; overflow-y: auto;
    font-size: .9rem; line-height: 1.6;
}
.replay-log strong { color: var(--highlight); }
.replay-foot { text-align: center; color: var(--text-secondary); font-size: .85rem; margin: 10px 0 8px; }
.replay-nav { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 8px; }
.replay-nav .btn { white-space: nowrap; padding: 10px 12px; min-width: 0; }
.log-panel strong { color: var(--highlight); }

.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.controls.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* כפתורי קרב: צבע מלא וקצה תחתון כהה, כמו כפתורים במשחק */
.battle-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 14px 12px; min-height: 58px;
    border-radius: 14px; border: 0; border-bottom: 4px solid rgba(0,0,0,.3);
    background: var(--bg-tertiary);
    color: #fff;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .12s ease, filter .15s ease;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.battle-btn .lbl { display: inline-flex; align-items: center; gap: 8px; }
.battle-btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); }
.battle-btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1px; }
.battle-btn:disabled { opacity: .4; cursor: not-allowed; }
.battle-btn .sub {
    display: block;
    font-size: .74rem;
    font-weight: 600;
    color: rgba(255,255,255,.78);
    margin-top: 3px;
}
.btn-fight { background: var(--accent-primary); border-bottom-color: var(--accent-dark); }
.btn-bag   { background: #e38a0c; border-bottom-color: #9a5a05; }
.btn-team  { background: var(--accent-blue); border-bottom-color: #1f5fc4; }
.btn-run   { background: #3a4868; border-bottom-color: #232d45; }
.btn-move  { background: color-mix(in srgb, var(--tc) 78%, #0d1426); border-bottom-color: color-mix(in srgb, var(--tc) 55%, #000); }
.btn-back  { background: transparent; box-shadow: inset 0 0 0 1px var(--glass-border); border-bottom-color: transparent; color: var(--text-secondary); font-size: .95rem; }

.shiny-tag {
    background: linear-gradient(135deg,#ffd700,#ffb300);
    color:#000; font-weight:800; font-size:.68rem;
    padding:1px 7px; border-radius: var(--radius-full);
}
@media (max-width: 640px) {
    .battle-scene { aspect-ratio: 4 / 3.4; }
    .status-box { min-width: 150px; padding: 8px 10px; }
    .status-box.wild   { top: 10px; left: 10px; }
    .status-box.player { bottom: 10px; right: 10px; }
    .sprite.wild   { top: 18%; width: 36%; }
    .sprite.player { width: 42%; }
    .pad.wild   { top: 46%; width: 42%; }
    .pad.player { width: 46%; }
}

/* מד EXP בתיבת הפוקימון של השחקן — מתמלא באנימציה בסוף הקרב */
.exp-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.exp-row span { font-family: var(--font-num); font-size: .66rem; font-weight: 800; color: #7cc4ff; }
.exp-track { flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.exp-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #3b9dff, #7cc4ff); transition: width .9s ease-out; }
.exp-fill.instant { transition: none; }
.exp-fill.full { box-shadow: 0 0 8px #7cc4ff; }
.exp-pop {
    position: absolute; top: -26px; inset-inline-end: 10px; font-family: var(--font-num); font-weight: 900;
    color: #7cc4ff; text-shadow: 0 2px 0 rgba(0,0,0,.5); opacity: 0; pointer-events: none; white-space: nowrap;
}
.exp-pop.show { animation: expPop 1.6s ease-out forwards; }
.exp-pop.lvl { color: var(--highlight); font-size: 1.1rem; }
@keyframes expPop { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.status-box.player.lvl-up { animation: lvlFlash .7s ease 2; }
@keyframes lvlFlash { 50% { box-shadow: 0 0 0 3px var(--highlight), 0 0 18px var(--highlight); } }

/* PP על כפתור המהלך */
.battle-btn .pp { font-family: var(--font-num); font-weight: 800; }
.battle-btn .pp.low { color: #ffd166; }
.battle-btn .pp.none { color: #ff8a8a; }

/* החלפת פוקימון: חזרה לכדור (הבהוב אדום והתכווצות) וכניסה לזירה */
.sprite.recall { animation: recallOut .38s ease-in forwards; }
@keyframes recallOut {
  0%   { transform: scale(1); filter: drop-shadow(0 6px 14px rgba(0,0,0,.55)); }
  40%  { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(6); }
  100% { transform: scale(.05) translateY(40px); opacity: 0; }
}
.sprite.player.enter { animation: playerEnter .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes playerEnter {
  0%   { transform: scale(.1); opacity: 0; filter: brightness(3); }
  60%  { opacity: 1; filter: brightness(1.6); }
  100% { transform: scale(1); filter: none; }
}

/* פוכדור קטן ליד שם פוקימון שכבר נתפס */
/* כבר נתפס / עוד לא (battle.js → dexChip) */
.dex-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px;
            font-size: .72rem; font-weight: 800; white-space: nowrap; vertical-align: middle; }
.dex-chip.caught { background: #15803d; color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.dex-chip.new { background: var(--accent-secondary); color: #2b1f00; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }

/* שייני: פיצוץ כוכבים והילה */
.shiny-burst { position: absolute; z-index: 4; width: 0; height: 0; pointer-events: none; }
.shiny-burst i {
  position: absolute; left: -10px; top: -10px; font-style: normal; font-size: 22px; color: #fff6b0;
  text-shadow: 0 0 8px #ffe066, 0 0 16px #ffd000; opacity: 0;
  animation: shinyStar 1.4s ease-out var(--d) forwards;
}
@keyframes shinyStar {
  0% { transform: rotate(var(--a)) translateY(0) scale(.3); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(-90px) scale(1.2); opacity: 0; }
}
.sprite.shiny-glow { animation: shinyGlow 1.8s ease-in-out 3; }
@keyframes shinyGlow { 50% { filter: drop-shadow(0 0 14px #ffe066) drop-shadow(0 0 28px #ffd000) brightness(1.25); } }

/* ── מפגש מיוחד (js/battle.js → encounterFx): שייני / אגדי / מיתי / Ultra Beast / Paradox ── */
.battle-scene { --fx: #ffd84d; --fx2: #fff3b0; }
.enc-rays.legendary, .shiny-burst.legendary, .enc-flash.legendary, .enc-banner.legendary { --fx: #f59e0b; --fx2: #fde68a; }
.enc-rays.mythical, .shiny-burst.mythical, .enc-flash.mythical, .enc-banner.mythical { --fx: #ec4899; --fx2: #fbcfe8; }
.enc-rays.ultra_beast, .shiny-burst.ultra_beast, .enc-flash.ultra_beast, .enc-banner.ultra_beast { --fx: #6366f1; --fx2: #67e8f9; }
.enc-rays.paradox, .shiny-burst.paradox, .enc-flash.paradox, .enc-banner.paradox { --fx: #94a3b8; --fx2: #e2e8f0; }
.shiny-burst i { color: var(--fx2, #fff6b0); text-shadow: 0 0 8px var(--fx, #ffe066), 0 0 16px var(--fx, #ffd000); }

.enc-flash { position: absolute; inset: 0; z-index: 5; pointer-events: none;
    background: radial-gradient(circle at 70% 35%, var(--fx2), var(--fx) 45%, transparent 80%);
    animation: encFlash .9s ease-out forwards; }
@keyframes encFlash { 0% { opacity: 0; } 15% { opacity: .85; } 100% { opacity: 0; } }
.battle-scene.enc-shake { animation: encShake .5s ease-in-out; }
@keyframes encShake { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -2px); }
    60% { transform: translate(-3px, 1px); } 80% { transform: translate(3px, 0); } }

.enc-rays { position: absolute; z-index: 1; width: 260px; height: 260px; margin: -130px 0 0 -130px;
    pointer-events: none; border-radius: 50%; opacity: 0;
    background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--fx) 55%, transparent) 0 9deg, transparent 9deg 24deg);
    -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
    animation: encRays 2.6s ease-out forwards; }
@keyframes encRays { 0% { opacity: 0; transform: scale(.4) rotate(0); } 20% { opacity: 1; }
    75% { opacity: .8; } 100% { opacity: 0; transform: scale(1.15) rotate(70deg); } }
.shiny-burst i { animation-name: encStar; }
@keyframes encStar {
  0% { transform: rotate(var(--a)) translateY(0) scale(.3); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(calc(var(--r, 90px) * -1)) scale(1.2); opacity: 0; }
}

.enc-banner { position: absolute; z-index: 7; top: 12px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 14px; max-width: calc(100% - 24px);
    border-radius: 999px; color: #fff; white-space: nowrap; pointer-events: none;
    background: linear-gradient(90deg, color-mix(in srgb, var(--fx) 88%, #000), color-mix(in srgb, var(--fx) 60%, #000));
    border: 1px solid var(--fx2); box-shadow: 0 6px 22px rgba(0,0,0,.45), 0 0 18px color-mix(in srgb, var(--fx) 60%, transparent);
    animation: encBannerIn .55s cubic-bezier(.34, 1.56, .64, 1); }
.enc-banner strong { display: block; font-size: 1.05rem; letter-spacing: .3px; }
.enc-banner small { display: block; opacity: .85; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.enc-banner .enc-icon { font-size: 1.6rem; filter: drop-shadow(0 0 6px var(--fx2)); }
.enc-banner.out { transition: opacity .45s, transform .45s; opacity: 0; transform: translate(-50%, -14px); }
@keyframes encBannerIn { from { opacity: 0; transform: translate(-50%, -24px) scale(.8); } }

.sprite.legend-glow { animation: legendGlow 1.6s ease-in-out 3; }
@keyframes legendGlow { 50% { filter: drop-shadow(0 0 16px var(--aura, #f59e0b)) drop-shadow(0 0 32px var(--aura, #f59e0b)) brightness(1.2); } }
.sprite[data-aura] { filter: drop-shadow(0 0 7px var(--aura)); }
.sprite[data-aura="legendary"] { --aura: #f59e0b; }
.sprite[data-aura="mythical"] { --aura: #ec4899; }
.sprite[data-aura="ultra_beast"] { --aura: #6366f1; }
.sprite[data-aura="paradox"] { --aura: #94a3b8; }

.log-special { display: inline-block; padding: 1px 8px; border-radius: 6px; font-weight: 700;
    background: color-mix(in srgb, var(--fx) 22%, transparent); border-inline-start: 3px solid var(--fx); }
.log-special.legendary { --fx: #f59e0b; } .log-special.mythical { --fx: #ec4899; }
.log-special.ultra_beast { --fx: #6366f1; } .log-special.paradox { --fx: #94a3b8; } .log-special.shiny { --fx: #ffd84d; }
@media (max-width: 640px) { .enc-rays { width: 190px; height: 190px; margin: -95px 0 0 -95px; } }

/* ── אירועים אקראיים (js/battle.js → showEvent): איש זקן / צוות רוקט במקום הפוקימון הפראי ── */
.event-layer {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 12px;
    background: rgba(8, 12, 24, .5);
}
.event-card {
    width: min(420px, 100%); max-height: 100%; overflow: auto; text-align: center;
    padding: 14px 18px 16px; border-radius: var(--radius-md); background: var(--surface);
    border: 1px solid var(--glass-border); border-top: 5px solid var(--ev, var(--highlight));
    box-shadow: 0 14px 34px rgba(3, 7, 18, .55);
    animation: evIn .4s cubic-bezier(.34, 1.56, .64, 1);
}
.event-card.ev-oldman { --ev: var(--highlight); }
.event-card.ev-rocket { --ev: #e3350d; }
.ev-art { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 64px; margin-bottom: 4px; }
.ev-art .item-icon:nth-child(2) { transform: translateY(-8px); }
.ev-art img:not(.item-icon) { height: 68px; width: 68px; object-fit: contain;
                              filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }
/* ה-R של צוות רוקט */
.ev-r {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; align-self: center;
    background: #fff; color: #e3350d; font: 900 2.1rem/1 var(--font-num); border: 3px solid #e3350d;
}
.ev-kicker { font-size: .74rem; font-weight: 800; color: var(--ev); letter-spacing: .02em; }
.ev-title { font-size: 1.25rem; font-weight: 900; margin: 2px 0 6px; }
.ev-text { margin: 0; line-height: 1.55; color: var(--text-primary); }
.ev-text .item-icon { vertical-align: middle; }
/* הזמן שנשאר לבחור (60 שנ', כמו הכפתורים בבוט) */
.ev-timer { height: 5px; margin-top: 12px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.ev-timer i { display: block; height: 100%; background: var(--ev); transform-origin: right; animation: evTime linear forwards; }
@keyframes evTime { to { transform: scaleX(0); } }
@keyframes evIn { from { transform: translateY(18px) scale(.92); opacity: 0; } }

/* מאמן אקראי: "!" מעל הראש, כמו במשחקים כשמאמן מבחין בך */
.spotted {
    position: absolute; z-index: 6; top: 6%; right: 16%; padding: 0 14px 2px; border-radius: 12px;
    background: #fff; color: #e3350d; font: 900 3rem/1.1 var(--font-num); border: 3px solid #1b1b24;
    animation: spotted 1.4s ease forwards;
}
@keyframes spotted {
    0% { transform: translateY(12px) scale(.3); opacity: 0; }
    18% { transform: translateY(0) scale(1.15); opacity: 1; }
    30%, 80% { transform: scale(1); opacity: 1; }
    100% { transform: translateY(-10px); opacity: 0; }
}
@media (max-width: 640px) {
    .event-card { padding: 10px 12px 12px; }
    .ev-art { height: 50px; }
    .ev-art .item-icon { width: 40px; height: 40px; }
    .ev-art img:not(.item-icon) { width: 50px; height: 50px; }
    .ev-r { width: 42px; height: 42px; font-size: 1.7rem; }
    .ev-title { font-size: 1.05rem; margin-bottom: 4px; }
    .ev-text { font-size: .88rem; }
}

/* ── תפיסה (js/battle.js → showCatch / playThrow) ── */
.btn-catch { background: #16a34a; border-bottom-color: #0f6b31; }
.controls-note {
    grid-column: 1 / -1; padding: 9px 13px; border-radius: 12px; font-size: .88rem; line-height: 1.6;
    background: var(--bg-secondary); border: 1px solid var(--glass-border);
}
.controls-note .muted, .log-panel .muted, .catch-line .muted { color: var(--text-secondary); }
.odds.good { color: #4ade80; }
.odds.mid  { color: var(--highlight); }
.odds.low  { color: #fca5a5; }
.battle-btn .sub .odds { font-weight: 800; }
.catch-line { margin-top: 6px; font-size: .78rem; }
.catch-line .odds { font-family: var(--font-num); }

.throw-ball { position: absolute; top: 0; left: 0; z-index: 4; pointer-events: none;
              filter: drop-shadow(0 4px 5px rgba(0,0,0,.45)); }
.throw-ball .item-icon, .throw-ball .item-emoji { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.throw-ball.burst { animation: ballBurst .3s ease-out forwards; }
.throw-ball.clicked::after {       /* כוכבים סביב הכדור — "קליק", נתפס */
    content: '✦ ✦ ✦'; position: absolute; left: 50%; top: -60%; transform: translateX(-50%);
    color: var(--highlight); font-size: .9rem; letter-spacing: 3px; white-space: nowrap;
    animation: clickStars .7s ease-out forwards;
}
@keyframes ballBurst { to { opacity: 0; scale: 1.8; } }
@keyframes clickStars { from { opacity: 0; top: 0; } 40% { opacity: 1; } to { opacity: 1; top: -70%; } }
.sprite.absorbed { animation: absorb .28s ease-in forwards; }
@keyframes absorb {
    0% { filter: drop-shadow(0 6px 14px rgba(0,0,0,.55)); }
    40% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(6); transform: scale(.8); }
    100% { transform: scale(0); opacity: 0; }
}
.event-card.ev-caught { --ev: #4ade80; position: relative; overflow: visible; }

/* ── חגיגת "נתפס!" (battle.js → caughtCard) ── */
.caught-layer { background: radial-gradient(circle at 50% 45%, rgba(255,216,77,.22), rgba(8,12,24,.6) 65%);
                animation: celebFade .3s ease; }
.confetti { position: absolute; left: 50%; top: 42%; width: 0; height: 0; z-index: 1; pointer-events: none; }
.confetti i {
    position: absolute; left: -4px; top: -6px; width: 8px; height: 12px; border-radius: 2px;
    background: var(--c); opacity: 0; animation: confetti 1.5s cubic-bezier(.15,.7,.3,1) var(--d) forwards;
}
.confetti i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
.confetti i:nth-child(4n) { width: 5px; height: 14px; }
@keyframes confetti {
    0% { transform: translate(0, 0) rotate(0) scale(.5); opacity: 1; }
    65% { opacity: 1; }
    100% { transform: translate(var(--x), calc(var(--y) + 70px)) rotate(var(--r)) scale(1); opacity: 0; }
}
.caught-layer .event-card { animation: evIn .45s cubic-bezier(.34, 1.56, .64, 1) both; z-index: 2; }
.caught-art { position: relative; width: 104px; height: 104px; margin: -4px auto 2px; }
.caught-art img { position: relative; width: 100%; height: 100%; object-fit: contain;
                  filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); animation: caughtPop .75s cubic-bezier(.34,1.56,.64,1) .1s both; }
.caught-art .rays {
    position: absolute; inset: -34px; border-radius: 50%;
    background: repeating-conic-gradient(rgba(255,216,77,.38) 0 9deg, transparent 9deg 22deg);
    -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%);
    animation: raysSpin 7s linear infinite, celebFade .6s ease both;
}
.caught-layer.shiny .caught-art .rays { background: repeating-conic-gradient(rgba(255,216,77,.7) 0 9deg, rgba(255,246,201,.15) 9deg 22deg); }
.ev-caught .ev-kicker { font-size: .92rem; letter-spacing: .04em; animation: caughtPop .5s cubic-bezier(.34,1.56,.64,1) .25s both; }
.new-dex {
    display: inline-block; margin: 2px 0 4px; padding: 3px 12px; border-radius: 99px; font-weight: 900; font-size: .85rem;
    color: #1b1b24; background: linear-gradient(100deg, #ffd84d 30%, #fff6c9 50%, #ffd84d 70%) 0 0 / 220% 100%;
    box-shadow: 0 3px 0 #b8860b; animation: caughtPop .6s cubic-bezier(.34,1.56,.64,1) .45s both, shine 1.8s linear 1s infinite;
}
@keyframes caughtPop { 0% { transform: scale(0) rotate(-14deg); opacity: 0; } 60% { transform: scale(1.18) rotate(4deg); opacity: 1; }
                       100% { transform: none; opacity: 1; } }
@keyframes raysSpin { to { transform: rotate(360deg); } }
@keyframes shine { to { background-position: -220% 0; } }
@keyframes celebFade { from { opacity: 0; } }
@media (max-width: 640px) { .caught-art { width: 68px; height: 68px; } .caught-art .rays { inset: -22px; } }
@media (prefers-reduced-motion: reduce) {
    .confetti { display: none; }
    .caught-art .rays, .new-dex { animation: none; }
    .enc-rays, .enc-flash, .shiny-burst { display: none; }
    .battle-scene.enc-shake { animation: none; }
}

/* ── חלון ריחוף למהלך (ui.js → bindTip / moveTipHtml) — בקרב וב-PvP ── */
.battle-btn { position: relative; }
.tip-info {
    position: absolute; top: 6px; left: 7px; width: 19px; height: 19px; border-radius: 50%;
    display: grid; place-items: center; font: 800 .72rem/1 var(--font-num); font-style: italic;
    background: rgba(255,255,255,.2); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
    cursor: help; transition: background .15s ease, transform .15s ease;
}
.tip-info:hover { background: rgba(255,255,255,.4); transform: scale(1.12); }
.battle-btn .sub .eff { font-weight: 900; padding: 0 5px; border-radius: 6px; }
.eff.good { background: #16a34a; color: #fff; }
.eff.bad  { background: rgba(0,0,0,.35); color: #fca5a5; }
.eff.none { background: rgba(0,0,0,.45); color: #cbd5e1; }

.move-tip {
    position: fixed; z-index: 1000; width: min(290px, calc(100vw - 16px)); pointer-events: none;
    border-radius: 16px; overflow: hidden; color: var(--text-primary); text-align: right;
    background: var(--surface); border: 1px solid var(--glass-border);
    box-shadow: 0 18px 40px rgba(3, 7, 18, .6), 0 0 0 1px rgba(255,255,255,.04);
    opacity: 0; transform: translateY(6px) scale(.96); transform-origin: var(--arrow-x, 50%) 100%;
    transition: opacity .16s ease, transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
.move-tip.below { transform: translateY(-6px) scale(.96); transform-origin: var(--arrow-x, 50%) 0; }
.move-tip.show { opacity: 1; transform: none; }
/* החץ שמצביע על הכפתור */
.move-tip::after {
    content: ''; position: absolute; bottom: -7px; left: calc(var(--arrow-x, 50%) - 7px); width: 14px; height: 14px;
    background: var(--surface); border-right: 1px solid var(--glass-border); border-bottom: 1px solid var(--glass-border);
    transform: rotate(45deg);
}
.move-tip.below::after { bottom: auto; top: -7px; transform: rotate(225deg); background: var(--tc); border-color: transparent; }
.mt-head {
    padding: 11px 14px 10px; color: #fff;
    background: linear-gradient(120deg, color-mix(in srgb, var(--tc) 85%, #000), color-mix(in srgb, var(--tc) 45%, #0d1426));
}
.mt-name { font-weight: 900; font-size: 1.12rem; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.mt-tags { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.mt-tags .type-badge { box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
.mt-cat { font-size: .74rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.28); }
.mt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 12px 2px; }
.mt-stats div { text-align: center; padding: 6px 4px; border-radius: 10px; background: var(--bg-secondary); }
.mt-stats span { display: block; font-size: .68rem; color: var(--text-secondary); }
.mt-stats b { font-family: var(--font-num); font-size: 1rem; }
.mt-desc { list-style: none; margin: 8px 12px 4px; padding: 0; font-size: .86rem; line-height: 1.5; }
.mt-desc li { position: relative; padding-inline-start: 16px; margin-bottom: 3px; }
.mt-desc li::before {
    content: ''; position: absolute; right: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%;
    background: var(--tc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 30%, transparent);
}
.mt-eff { margin: 6px 12px 0; padding: 6px 10px; border-radius: 10px; font-size: .83rem; background: var(--bg-secondary); }
.mt-eff.good { background: color-mix(in srgb, #16a34a 22%, var(--bg-secondary)); color: #bbf7d0; }
.mt-eff.bad  { background: color-mix(in srgb, #ef4444 16%, var(--bg-secondary)); color: #fecaca; }
.mt-eff.none { background: color-mix(in srgb, #64748b 30%, var(--bg-secondary)); color: #e2e8f0; }
.mt-eff.stab { background: color-mix(in srgb, var(--highlight) 16%, var(--bg-secondary)); color: #fde68a; }
.mt-foot { margin: 8px 12px 11px; font-size: .72rem; color: var(--text-secondary); }
@media (hover: hover) { .tip-info { opacity: .75; } }
