/* ==========================================================================
   POKE EVO - HD GRAPHICS, 20-NODE TRACK & GEN 1 MANAGEMENT CSS
   ========================================================================== */

:root {
    --bg-dark: #0f141d;
    --bg-panel: #18202f;
    --bg-card: #1f293d;
    --border-color: #2f3e59;
    --poke-red: #ef4444;
    --poke-yellow: #facc15;
    --poke-blue: #3b82f6;
    --poke-green: #22c55e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 12px 16px;
}

.hidden {
    display: none !important;
}

.game-wrapper {
    width: 100%;
    max-width: 1240px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==========================================================================
   1. TOP 20-NODE ROUTE PROGRESS BAR (MATCHES SCREENSHOT 100%)
   ========================================================================== */
.top-route-bar {
    background: #161b24;
    border: 1px solid #2b3548;
    border-radius: 10px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.route-bar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #94a3b8;
    white-space: nowrap;
}

.route-bar-counter {
    font-size: 0.95rem;
    font-weight: 800;
    color: #facc15;
    white-space: nowrap;
}

.route-nodes-track {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow-x: auto;
    padding: 4px 0;
}

.route-node-item {
    position: relative;
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 0.95rem;
    transition: transform 0.15s;
}

.route-node-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    width: 6px;
    height: 2px;
    background: #334155;
    transform: translateY(-50%);
    pointer-events: none;
}

.route-node-item:hover {
    transform: scale(1.18);
}

.route-node-item.locked {
    opacity: 0.45;
}

/* Khung ngoặc vuông [🌿] cho nút hiện tại giống hệt ảnh mẫu */
.route-node-item.active-bracket {
    font-weight: 900;
}

.route-node-item.active-bracket::before {
    content: '[';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-54%);
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 400;
}

.route-node-item.active-bracket::after {
    content: ']';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-54%);
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 400;
    background: transparent;
    width: auto;
    height: auto;
}

.node-dot-start {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.node-dot-trainer {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

.node-icon-event {
    font-weight: 900;
    color: #f8fafc;
    font-size: 0.95rem;
}

/* Phiên 117: ô địa hình tự vẽ (pixel 12×12) + chuyển động: cây lá đung đưa, nước nhấp nhô, băng lấp lánh, lửa bập bùng */
.node-icon-grass.terrain { display: inline-flex; line-height: 0; }
.node-icon-grass.terrain .terrain-px { display: block; image-rendering: pixelated; }
.route-node-item.dense .node-icon-grass.terrain .terrain-px,
#route-nodes-track.dense .node-icon-grass.terrain .terrain-px { width: 17px; height: 17px; }
.node-icon-grass.sway, .node-icon-grass.fx-sway {
    display: inline-block;
    transform-origin: 50% 90%;
    animation: grassSway 2.6s ease-in-out infinite;
    animation-delay: calc(var(--sw, 0) * -0.52s);
}
.node-icon-grass.terrain.fx-sway { display: inline-flex; }
@keyframes grassSway {
    0%, 100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg) translateX(0.5px); }
}
.node-icon-grass.fx-wave { animation: terrainWave 2.2s ease-in-out infinite; animation-delay: calc(var(--sw, 0) * -0.44s); }
@keyframes terrainWave { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-1.5px); } }
.node-icon-grass.fx-ice { animation: terrainIce 3s ease-in-out infinite; animation-delay: calc(var(--sw, 0) * -0.6s); }
@keyframes terrainIce { 0%, 100% { filter: brightness(1) drop-shadow(0 0 0 transparent); } 50% { filter: brightness(1.25) drop-shadow(0 0 3px rgba(186, 230, 253, 0.9)); } }
.node-icon-grass.fx-fire { animation: terrainFire 1.4s steps(4) infinite; animation-delay: calc(var(--sw, 0) * -0.28s); }
@keyframes terrainFire { 0%, 100% { filter: brightness(1) drop-shadow(0 0 1px rgba(251, 146, 60, 0.6)); } 50% { filter: brightness(1.2) drop-shadow(0 0 4px rgba(239, 68, 68, 0.9)); } }
@media (prefers-reduced-motion: reduce) { .node-icon-grass.sway, .node-icon-grass.fx-sway, .node-icon-grass.fx-wave, .node-icon-grass.fx-ice, .node-icon-grass.fx-fire { animation: none; } }

/* Phiên 116: ô "?" cốt truyện (vàng, viền sáng) và ô "?" đặc biệt Master Ball (tím, phát sáng nhấp nháy) */
.node-icon-event.ev-story {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%;
    font-size: 0.78rem; color: #422006;
    background: radial-gradient(circle at 35% 30%, #fef08a, #f59e0b 70%);
    box-shadow: 0 0 0 1.5px #fde68a, 0 0 7px rgba(245, 158, 11, 0.75);
}
.node-icon-event.ev-master {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    font-size: 0.8rem; color: #fff;
    background: radial-gradient(circle at 35% 30%, #f0abfc, #a21caf 55%, #4c1d95);
    box-shadow: 0 0 0 1.5px #f5d0fe, 0 0 10px rgba(217, 70, 239, 0.9);
    text-shadow: 0 0 4px #fff;
    animation: evMasterGlow 1.6s ease-in-out infinite;
}
@keyframes evMasterGlow {
    0%, 100% { box-shadow: 0 0 0 1.5px #f5d0fe, 0 0 6px rgba(217, 70, 239, 0.7); transform: scale(1); }
    50% { box-shadow: 0 0 0 2px #fff, 0 0 16px rgba(217, 70, 239, 1), 0 0 26px rgba(250, 204, 21, 0.55); transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .node-icon-event.ev-master { animation: none; } }

.route-node-item.gym-final-node {
    width: 32px;
    height: 30px;
    border: 1.5px solid #a16207;
    border-radius: 6px;
    background: rgba(250, 204, 21, 0.08);
}

/* ==========================================================================
   2. HD VECTOR SCENE STAGE (MIDDLE WINDOW)
   ========================================================================== */
.pixel-scene-stage {
    position: relative;
    width: 100%;
    height: 490px;
    border-radius: 14px;
    border: 2px solid #28354a;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.hd-landscape-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: filter 0.45s ease;
}

.pixel-scene-stage.night-sky .hd-landscape-svg {
    filter: brightness(0.62) hue-rotate(-18deg) saturate(1.15);
}

/* TOP-LEFT CLOCK & WEATHER PILL */
.top-left-pills {
    position: absolute;
    top: 16px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.weather-clock-pill {
    background: rgba(22, 32, 56, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.86rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s, border-color 0.15s;
}

.weather-clock-pill:hover {
    border-color: #facc15;
    transform: translateY(-1px);
}

.pill-divider {
    color: rgba(255, 255, 255, 0.25);
}

.gym-countdown-pill {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border: 1px solid #fca5a5;
    color: #fff;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.5);
}

/* LEFT VERTICAL PARTY SLOTS (CHARMANDER LV.5 YELLOW BOX) */
.left-party-column {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-55%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.party-hud-slot {
    width: 68px;
    background: rgba(20, 28, 44, 0.78);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    padding: 5px 5px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.party-hud-slot:hover {
    transform: scale(1.06);
}

.party-hud-slot.active-lead {
    border-color: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
}

.party-hud-slot img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
}

.slot-lv {
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1px 3px #000;
    margin: 1px 0 3px;
}

.slot-hp-bar {
    width: 100%;
    height: 5px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}

.slot-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #f43f5e, #fb7185);
    transition: width 0.2s ease;
}

/* ==========================================================================
   ACTORS ON THE DIRT ROAD (TRAINER + LEAD POKEMON vs ENEMY / POKEBALL)
   ========================================================================== */
.road-actors-stage {
    position: absolute;
    left: 135px;
    right: 90px;
    bottom: 78px;
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
    z-index: 6;
}

.player-road-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.stage-trainer-holder {
    width: 130px;
    height: 185px;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s;
}

.stage-trainer-holder:hover {
    transform: scale(1.04);
}

.hd-trainer-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.lead-pokemon-unit,
.enemy-pokemon-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.overhead-hp-pill {
    width: 56px;
    height: 11px;
    background: #1e293b;
    border: 2px solid #0f172a;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

.overhead-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #e11d48, #fb7185);
    transition: width 0.15s ease;
}

.stage-pokemon-sprite {
    width: 96px;
    height: 96px;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.45));
    transition: transform 0.15s ease;
}

/* Lật nhẹ Pokémon của người chơi hướng sang phải đối diện mục tiêu */
.stage-pokemon-sprite.player-facing {
    transform: scaleX(-1);
}

.stage-pokemon-sprite.player-facing.lead-lunge {
    animation: playerLungeRight 0.32s ease-out;
}

@keyframes playerLungeRight {
    0% { transform: scaleX(-1) translateX(0); }
    50% { transform: scaleX(-1) translateX(-32px) scale(1.12); filter: brightness(1.25) drop-shadow(0 10px 12px rgba(250,204,21,0.5)); }
    100% { transform: scaleX(-1) translateX(0); }
}

.enemy-hit-flash {
    animation: enemyHitAnim 0.25s ease-in-out;
}

@keyframes enemyHitAnim {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(10px) scale(0.93); filter: brightness(1.75); }
    70% { transform: translateX(-8px) scale(0.95); }
}

.underfoot-lv-tag {
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 900;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.72);
    padding: 1px 8px;
    border-radius: 6px;
    text-shadow: 0 1px 2px #000;
}

.enemy-trainer-badge {
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #facc15;
    color: #fef08a;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 5px;
    white-space: nowrap;
}

/* HD POKEBALL ON THE DIRT ROAD (RIGHT SIDE OF STAGE) */
.stage-right-actor {
    min-width: 150px;
    min-height: 130px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.road-pokeball-wrap {
    margin-bottom: 22px;
    animation: roadBallBounce 0.55s infinite ease-in-out;
    filter: drop-shadow(0 8px 8px rgba(0,0,0,0.45));
}

@keyframes roadBallBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-10px) rotate(-18deg); }
    65% { transform: translateY(0) rotate(18deg); }
}

/* FLOATING DAMAGE */
.floating-dmg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 12;
}

.floating-dmg {
    position: absolute;
    color: #ffffff;
    font-weight: 900;
    font-size: 1.2rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9);
    animation: floatUpDmg 0.75s ease-out forwards;
}

.floating-dmg.skill-dmg {
    color: #fde047;
    font-size: 1.38rem;
}

@keyframes floatUpDmg {
    0% { opacity: 1; transform: translate(-50%, 0) scale(0.95); }
    100% { opacity: 0; transform: translate(-50%, -50px) scale(1.12); }
}

/* ==========================================================================
   3. BOTTOM WHITE DIALOGUE BOX & SPEED BUTTONS (x1 | x2 | x3)
   ========================================================================== */
.bottom-hud-row {
    position: absolute;
    left: 110px;
    right: 24px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 15;
}

.white-dialogue-box {
    flex: 1;
    background: #ffffff;
    color: #1e293b;
    border: 3px solid #64748b;
    border-radius: 10px;
    padding: 13px 20px;
    font-size: 0.96rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.speed-control-pill {
    background: #141b26;
    border: 1.5px solid #2d384c;
    border-radius: 10px;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.speed-btn {
    background: transparent;
    color: #e2e8f0;
    border: none;
    padding: 7px 13px;
    border-radius: 7px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.speed-btn.active {
    background: #e11d48;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.5);
}

/* ==========================================================================
   4. PLAYER MANAGEMENT & GEN 1 TRAINING DASHBOARD
   ========================================================================== */
.control-dashboard {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.dashboard-top-strip {
    padding: 10px 16px;
    background: #111724;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-inline {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.86rem;
}

.stats-inline strong {
    color: var(--poke-yellow);
}

.pokeball-quick-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.quick-ball-btn {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    cursor: pointer;
}

.quick-ball-btn.selected {
    border-color: var(--poke-yellow);
    background: rgba(250, 204, 21, 0.14);
}

.quick-actions-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-dash {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-dash.active-mode {
    border-color: #22c55e;
    color: #86efac;
}

.btn-dash.dex {
    background: #dc2626;
    border-color: #f87171;
}

.dash-select {
    background: var(--bg-card);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
}

.dashboard-tabs {
    display: flex;
    background: #141c2b;
    border-bottom: 1px solid var(--border-color);
}

.dtab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.dtab-btn.active {
    color: var(--poke-yellow);
    border-bottom-color: var(--poke-yellow);
    background: rgba(250, 204, 21, 0.05);
}

.dashboard-panel {
    padding: 14px;
    max-height: 360px;
    overflow-y: auto;
}

/* GEN 1 POKÉMON MANAGEMENT & TRAINING CARDS */
.poke-manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 12px;
}

.poke-manage-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.poke-manage-card.in-party {
    border-left: 4px solid #22c55e;
}

.poke-manage-card.is-lead {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.06);
}

.pmc-hd-art {
    width: 78px;
    height: 78px;
    object-fit: contain;
    background: #111724;
    border-radius: 10px;
    padding: 6px;
    flex-shrink: 0;
}

.pmc-info {
    flex: 1;
    min-width: 0;
}

.pmc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.mini-type {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    margin-left: 4px;
}

.pmc-lv {
    color: var(--poke-yellow);
    font-size: 0.8rem;
    font-weight: 700;
}

.gen1-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0;
    padding: 5px 8px;
    background: #111724;
    border-radius: 6px;
    font-size: 0.72rem;
    color: #cbd5e1;
}

.gen1-stats-row strong {
    color: #fff;
}

.pmc-skills {
    font-size: 0.74rem;
    color: #93c5fd;
    margin-bottom: 5px;
}

.exp-bar-wrap {
    height: 4px;
    background: #0f172a;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 7px;
}

.exp-bar-fill {
    height: 100%;
    background: #38bdf8;
}

.train-vitamins-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 7px;
}

.btn-train-stat {
    background: #131c2e;
    color: #e2e8f0;
    border: 1px solid #334155;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-train-stat:hover {
    border-color: #facc15;
    color: #fef08a;
}

.pmc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.btn-mini {
    background: #111724;
    color: #e2e8f0;
    border: 1px solid var(--border-color);
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-mini.primary {
    background: var(--poke-blue);
    border-color: #60a5fa;
    color: #fff;
}

.btn-evo-action {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #000;
    border: none;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.evo-req-pill,
.lead-active-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 5px;
    background: #111724;
    color: #fde047;
}

/* ROUTES & DAY/NIGHT SPAWN TABLES */
.routes-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.route-select-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
}

.route-select-card.active {
    border-color: var(--poke-yellow);
    background: rgba(250, 204, 21, 0.1);
}

.route-select-card.locked {
    opacity: 0.45;
}

.rsc-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.rsc-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.spawns-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 860px) {
    .spawns-dual-grid {
        grid-template-columns: 1fr;
    }
}

.spawn-time-box {
    background: #131b29;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 10px;
}

.spawn-time-box.active-time {
    border-color: #38bdf8;
}

.stb-header {
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.now-tag {
    background: #0284c7;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.stb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 8px;
}

.spawn-poke-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spawn-poke-card.caught {
    border-color: rgba(34, 197, 94, 0.45);
}

.spawn-poke-card img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.spc-name { font-size: 0.78rem; font-weight: 700; }
.spc-rate, .spc-catch { font-size: 0.68rem; color: var(--text-muted); }
.spc-rate strong, .spc-catch strong { color: #fde047; }

/* GYMS & SHOP GRIDS */
.gyms-grid, .shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.gym-card-box, .shop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gym-card-box.earned {
    border-color: #22c55e;
}

.gym-leader-avatar {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.gcb-info { flex: 1; }
.gcb-title, .sc-title { font-size: 0.84rem; font-weight: 800; }
.gcb-sub, .sc-desc { font-size: 0.71rem; color: var(--text-muted); margin-top: 2px; }
.gcb-reward { font-size: 0.72rem; color: #fde047; margin-top: 3px; }
.sc-btns { display: flex; flex-direction: column; gap: 4px; }

/* MODALS */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-card {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    max-width: 960px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-card.small { max-width: 540px; }

.modal-header {
    padding: 14px 18px;
    background: #0f172a;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title { font-size: 1rem; font-weight: 800; color: var(--poke-yellow); }
.btn-close-modal { background: transparent; color: var(--text-muted); border: none; font-size: 1.2rem; cursor: pointer; }

.pokedex-toolbar {
    padding: 10px 18px;
    background: #111827;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.dex-search-input {
    flex: 1;
    background: var(--bg-card);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 7px 12px;
    border-radius: 7px;
}

.dex-filter-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
}

.dex-filter-btn.active {
    background: var(--poke-red);
    color: #fff;
}

.pokedex-grid {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 10px;
}

.dex-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.dex-entry.owned { border-color: rgba(34, 197, 94, 0.55); }
.dex-entry.unknown .dex-sprite { filter: brightness(0) opacity(0.4); }
.dex-entry.seen:not(.owned) .dex-sprite { filter: grayscale(100%) opacity(0.65); }
.dex-num { font-size: 0.7rem; color: var(--text-muted); }
.dex-sprite { width: 68px; height: 68px; object-fit: contain; margin: 4px 0; }
.dex-name { font-size: 0.8rem; font-weight: 700; }

.starter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 18px;
}

.starter-option {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.starter-option:hover {
    border-color: var(--poke-yellow);
    transform: translateY(-3px);
}

.starter-option img { width: 88px; height: 88px; object-fit: contain; }

.offline-rewards-box {
    background: #0f172a;
    border: 1px solid var(--poke-yellow);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast-container {
    position: fixed;
    bottom: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}

.toast-msg {
    background: rgba(15, 23, 42, 0.95);
    border-left: 4px solid var(--poke-blue);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}

.toast-msg.success { border-left-color: var(--poke-green); }
.toast-msg.warning { border-left-color: #f97316; }
.toast-msg.evo { border-left-color: var(--poke-yellow); }

/* ==========================================================================
   5. PC - POKEMON STORAGE (CHUẨN BỐ CỤC ẢNH MẪU 1)
   ========================================================================== */
.pc-storage-window {
    background: #232529;
    border: 2px solid #484b52;
    border-radius: 6px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75);
    color: #e2e8f0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.modal-pc-window {
    max-width: 920px;
    width: 100%;
}

.pc-window-titlebar {
    background: linear-gradient(180deg, #32353b 0%, #24262b 100%);
    border-bottom: 2px solid #16181b;
    padding: 8px 14px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #7c828d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-shadow: 0 1px 2px #000;
}

.pc-titlebar-hint {
    font-size: 0.76rem;
    font-weight: 600;
    color: #94a3b8;
}

.pc-titlebar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-filter-pill {
    background: #1c1e22;
    color: #94a3b8;
    border: 1px solid #3f434a;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.pc-filter-pill.active {
    background: #334155;
    color: #facc15;
    border-color: #facc15;
}

.pc-close-btn {
    background: #2c3038;
    color: #cbd5e1;
    border: 1px solid #4b5563;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-weight: 900;
}

.pc-storage-body {
    display: grid;
    grid-template-columns: 195px 1fr;
    background: #202226;
    padding: 8px;
    gap: 10px;
}

@media (max-width: 780px) {
    .pc-storage-body {
        grid-template-columns: 1fr;
    }
}

/* CỘT TRÁI KHO PC */
.pc-left-sidebar {
    background: #282b30;
    border: 2px solid #141619;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pc-search-wrap {
    display: flex;
    align-items: center;
    background: #1c2026;
    border: 2px solid #0f1114;
    border-radius: 4px;
    overflow: hidden;
}

.pc-search-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #38bdf8;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-weight: 700;
    outline: none;
}

.pc-search-input::placeholder {
    color: #2b8ab8;
}

.pc-search-clear {
    background: #2d3138;
    color: #cbd5e1;
    border: none;
    border-left: 2px solid #0f1114;
    padding: 5px 8px;
    font-weight: 800;
    cursor: pointer;
}

.pc-sort-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pc-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.pc-checkbox {
    width: 26px;
    height: 26px;
    background: radial-gradient(circle, #30343b 0%, #1c1e22 100%);
    border: 2px solid #7c828d;
    border-radius: 5px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
    display: inline-block;
    position: relative;
}

.pc-checkbox.checked {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.pc-check-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: #e2e8f0;
    text-shadow: 0 1px 2px #000;
}

.pc-mode-mini-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.pc-mini-tab {
    background: #1b1d21;
    color: #94a3b8;
    border: 1px solid #3a3e47;
    padding: 5px 4px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.pc-mini-tab.active {
    background: #323741;
    color: #fde047;
    border-color: #fde047;
}

/* Ô ĐỎ RELEASE GÓC DƯỚI BÊN TRÁI */
.pc-release-box {
    margin-top: auto;
    min-height: 155px;
    background: radial-gradient(circle, #5c1515 0%, #2f0909 100%);
    border: 2px solid #4a1212;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.7);
}

.pc-release-box:hover,
.pc-release-box.active-release {
    background: radial-gradient(circle, #7f1d1d 0%, #450a0a 100%);
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.pc-release-text {
    font-size: 0.98rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #991b1b;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.pc-release-box.active-release .pc-release-text {
    color: #fca5a5;
}

/* LƯỚI 3 CỘT x 5 HÀNG BÊN PHẢI */
.pc-right-main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #1c1e22;
    border: 2px solid #121316;
    border-radius: 4px;
    padding: 8px;
}

.pc-grid-3x5 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, 62px);
    gap: 7px;
}

@media (max-width: 680px) {
    .pc-grid-3x5 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }
}

.pc-slot-card {
    background: linear-gradient(180deg, #3c4047 0%, #2b2e33 100%);
    border: 2px solid #141619;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.12s;
    min-height: 62px;
}

.pc-slot-card:hover {
    border-color: #eab308;
    transform: translateY(-1px);
}

.pc-slot-card.in-party-slot {
    border-color: #ca8a04;
}

.pc-slot-card.unowned {
    opacity: 0.42;
    filter: grayscale(85%);
}

.pc-slot-card.empty-slot {
    background: #23262b;
    opacity: 0.35;
    cursor: default;
}

.pc-slot-card.release-cursor:hover {
    border-color: #ef4444;
    background: linear-gradient(180deg, #581c1c 0%, #381111 100%);
}

.pc-slot-icon-box {
    width: 46px;
    height: 46px;
    background: #1d1f23;
    border: 2px solid #121417;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pc-slot-icon-box img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.pc-slot-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.pc-slot-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-s-prefix {
    color: #facc15;
    font-weight: 900;
    font-size: 0.92rem;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.pc-poke-name {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 0.88rem;
    text-shadow: 0 1px 2px #000;
}

.pc-slot-lvl {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 2px #000;
    margin-top: 1px;
}

/* NHÃN HỆ 1 CHỮ CÁI Ở GÓC DƯỚI PHẢI THẺ (P G, W, F B, F N...) */
.pc-slot-types {
    position: absolute;
    right: 5px;
    bottom: 4px;
    display: flex;
    gap: 3px;
}

.pc-type-letter {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 0.66rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 1px #000;
}

.pc-party-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: #facc15;
    border: 1px solid #000;
    border-radius: 2px;
}

.pc-party-dot.lead {
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    font-size: 0.7rem;
    top: 2px;
    right: 5px;
}

/* THANH PHÂN TRANG SỐ 1..11 Ở ĐÁY KHO PC */
.pc-pagination-bar {
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid #2d3139;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pc-page-gap { color: #64748b; font-weight: 800; padding: 0 2px; align-self: center; }
.pc-page-numbers {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pc-page-num,
.pc-page-arrow {
    min-width: 28px;
    height: 26px;
    background: linear-gradient(180deg, #383b42 0%, #24262b 100%);
    color: #e2e8f0;
    border: 1.5px solid #111316;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.pc-page-num.active {
    border-color: #d97706;
    color: #fbbf24;
    background: linear-gradient(180deg, #473823 0%, #292014 100%);
}

/* ==========================================================================
   6. POKÉMON SUMMARY WINDOW (CHUẨN BỐ CỤC ẢNH MẪU 2: ABILITY, NATURE, OT, MOVES, IV/EV)
   ========================================================================== */
.poke-summary-window {
    background: #23212c;
    border: 2px solid #4a4759;
    border-radius: 6px;
    max-width: 680px;
    width: 100%;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85);
    overflow: hidden;
    color: #e2e8f0;
}

.sum-topbar {
    background: linear-gradient(180deg, #4b4954 0%, #34323c 100%);
    border-bottom: 2px solid #19181f;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sum-topbar-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.sum-pokeball-watermark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid #6b6878;
    background: linear-gradient(180deg, #6b6878 46%, transparent 46%, transparent 54%, #6b6878 54%);
    display: inline-block;
    align-self: center;
}

.sum-title-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #cbd5e1;
    text-shadow: 0 2px 2px #000;
}

.sum-gender {
    font-size: 1rem;
    font-weight: 900;
    text-shadow: 0 1px 2px #000;
}

.sum-gender.male-cyan { color: #38bdf8; }
.sum-gender.female-pink { color: #f472b6; }

.sum-title-lv,
.sum-title-region,
.sum-title-id {
    font-size: 0.92rem;
    font-weight: 700;
    color: #e2e8f0;
    text-shadow: 0 1px 2px #000;
}

.sum-close-x {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
}

/* Phiên 147: nút quay lại Kho PC trong bảng Info */
.sum-back-pc { margin-left: auto; margin-right: 6px; padding: 5px 12px; border: 1px solid #60a5fa; border-radius: 8px; background: #1e3a8a; color: #e0f2fe; font-weight: 800; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.sum-back-pc:hover { background: #1d4ed8; }
.pbd-head .sum-back-pc { margin-left: auto; }

.sum-body-grid {
    display: grid;
    grid-template-columns: 1.18fr 0.95fr 1.12fr;
    gap: 14px;
    padding: 14px;
    background: #23212c;
}

@media (max-width: 680px) {
    .sum-body-grid {
        grid-template-columns: 1fr;
    }
}

/* CỘT TRÁI: HAPPINESS + HP BAR + EXP + MOVES */
.sum-hp-happy-block {
    margin-bottom: 12px;
}

.sum-happy-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.sum-smiley {
    font-size: 0.95rem;
}

.sum-happy-bar-track {
    flex: 1;
    height: 8px;
    background: #17161d;
    border: 1px solid #0d0c11;
    border-radius: 4px;
    overflow: hidden;
}

.sum-happy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.sum-hp-numbers {
    font-size: 0.9rem;
    font-weight: 700;
    color: #cbd5e1;
    text-shadow: 0 1px 2px #000;
}

.hp-green-num {
    color: #22c55e;
}

.sum-green-hp-track {
    height: 9px;
    background: #14131a;
    border: 1.5px solid #09090d;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 3px 0 #14131a;
}

.sum-green-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22c55e);
}

/* BANNER ĐEN VÁT CHÉO (EXP, MOVES, ABILITY, NATURE, OT) */
.sum-section-banner {
    background: linear-gradient(90deg, #14131a 0%, #191820 82%, transparent 100%);
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 800;
    padding: 3px 10px;
    margin: 8px 0 6px;
    border-left: 3px solid #3f3c4f;
    text-shadow: 0 1px 2px #000;
}

.sum-exp-lines {
    padding: 2px 6px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.86rem;
}

.sum-exp-row {
    display: flex;
    justify-content: space-between;
    color: #cbd5e1;
    text-shadow: 0 1px 2px #000;
}

.xp-tag {
    color: #0ea5e9;
    font-weight: 800;
}

.sum-moves-box {
    background: #1b1922;
    border: 2px solid #2f2c3b;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sum-move-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: #cbd5e1;
    text-shadow: 0 1px 2px #000;
}

.sum-move-pp {
    color: #cbd5e1;
    font-weight: 700;
}

/* CỘT GIỮA: ABILITY, NATURE, OT, ACTIONS */
.sum-mid-val {
    padding: 2px 8px 6px;
    font-size: 0.9rem;
    color: #cbd5e1;
    text-shadow: 0 1px 2px #000;
}

.sum-nature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sum-nature-reroll {
    background: #2f2c3d;
    color: #fde047;
    border: 1px solid #4c4763;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.sum-trainer-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 2px;
}

.sum-action-btn {
    background: #2d2a3a;
    color: #e2e8f0;
    border: 1px solid #48435c;
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.sum-action-btn.primary {
    background: #1d4ed8;
    border-color: #60a5fa;
    color: #fff;
}

.sum-action-btn.candy {
    background: #3b2d4a;
    border-color: #a855f7;
    color: #f3e8ff;
}

.sum-action-btn.evo-ready {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #000;
    border: none;
    font-weight: 800;
}

.sum-lead-badge,
.sum-evo-hint {
    font-size: 0.74rem;
    color: #fde047;
    padding: 2px 4px;
}

/* CỘT PHẢI: Ô VẬT PHẨM, ĐÀI ĐỨNG CYAN + POKÉMON HD + BẢNG 6 CHỈ SỐ IV/EV */
.sum-col-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.sum-held-item-slot {
    align-self: flex-end;
    width: 38px;
    height: 38px;
    background: #2b2936;
    border: 2px solid #14131a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.sum-pedestal-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: -10px;
}

.sum-pokemon-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sum-hd-artwork {
    width: 92px;
    height: 92px;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
}

.sum-cyan-pedestal {
    width: 118px;
    height: 22px;
    margin-top: -12px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, #e0f2fe 0%, #7dd3fc 55%, #1e293b 100%);
    border-bottom: 4px solid #1e1b4b;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.sum-type-pills {
    display: flex;
    gap: 6px;
    margin: 8px 0 10px;
}

.sum-type-badge {
    padding: 2px 9px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 1px #000;
}

/* BẢNG 6 CHỈ SỐ: ATK, DEF, SPD, SPATK, SPDEF, HP VỚI CỘT TỔNG | IV (CAM) | EV (XANH CYAN) */
.sum-stats-box {
    width: 100%;
    background: #1b1922;
    border: 2px solid #2f2c3b;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sum-stat-row {
    display: grid;
    grid-template-columns: 60px 1fr 26px 32px 42px;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 2px #000;
}

.sum-stat-label {
    color: #cbd5e1;
}

.sum-stat-label.stat-up-green {
    color: #22c55e;
}

.sum-stat-label.stat-down-orange {
    color: #d97706;
}

.sum-stat-val {
    text-align: right;
    padding-right: 8px;
    color: #e2e8f0;
}

.sum-stat-iv {
    text-align: right;
    color: #f97316; /* Chỉ số IV 01-31 màu cam chuẩn ảnh mẫu 2 */
}

.sum-stat-ev {
    text-align: right;
    color: #0ea5e9; /* Chỉ số EV 000-252 màu xanh cyan chuẩn ảnh mẫu 2 */
}

.sum-ev-btn-pair {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    margin-left: 4px;
}

.sum-ev-plus-btn {
    width: 17px;
    height: 17px;
    background: #2b2938;
    color: #38bdf8;
    border: 1px solid #475569;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sum-ev-plus-btn.minus {
    color: #94a3b8;
}

.sum-ev-plus-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

.sum-ev-footer {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid #2f2c3b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    color: #94a3b8;
}

.sum-ev-reset-btn {
    background: #2b2938;
    color: #cbd5e1;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.sum-ev-reset-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* ==========================================================================
   7. HIỆU ỨNG KỸ NĂNG CHIẾN ĐẤU 3D (SKILL VFX: CẦU LỬA, SẤM SÉT, TIA NƯỚC, BÃO LÁ, NỔ VA CHẠM)
   ========================================================================== */
.skill-vfx-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 14;
    overflow: hidden;
}

/* NHÃN HÔ CHIÊU THỨC TRÊN ĐẦU POKÉMON */
.skill-cast-banner {
    position: absolute;
    bottom: 205px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    border: 2px solid #facc15;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.78rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 1px 2px #000;
    animation: castBannerPop 0.65s ease-out forwards;
}

.skill-cast-banner.from-player {
    left: 22%;
}

.skill-cast-banner.from-enemy {
    right: 17%;
}

.scb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@keyframes castBannerPop {
    0% { opacity: 0; transform: translateY(12px) scale(0.8); }
    20% { opacity: 1; transform: translateY(0) scale(1.05); }
    80% { opacity: 1; transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-14px) scale(0.95); }
}

/* HIỆU ỨNG MOVE FX TỪ KHO POKÉMON SHOWDOWN (https://play.pokemonshowdown.com/fx/) */
.ps-fx-stream-particle {
    position: absolute;
    width: 58px;
    height: 58px;
    object-fit: contain;
    z-index: 15;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.75));
}

.ps-fx-stream-particle.fly-right {
    left: 27%;
    animation: psStreamRight 0.35s cubic-bezier(0.2, 0.85, 0.35, 1) forwards;
}

.ps-fx-stream-particle.fly-left {
    left: 72%;
    animation: psStreamLeft 0.35s cubic-bezier(0.2, 0.85, 0.35, 1) forwards;
}

@keyframes psStreamRight {
    0%   { left: 27%; transform: scale(0.6) rotate(0deg); opacity: 0.85; }
    80%  { left: 72%; transform: scale(1.25) rotate(180deg); opacity: 1; }
    100% { left: 75%; transform: scale(1.45) rotate(240deg); opacity: 0; }
}

@keyframes psStreamLeft {
    0%   { left: 72%; transform: scale(0.6) scaleX(-1) rotate(0deg); opacity: 0.85; }
    80%  { left: 27%; transform: scale(1.25) scaleX(-1) rotate(180deg); opacity: 1; }
    100% { left: 24%; transform: scale(1.45) scaleX(-1) rotate(240deg); opacity: 0; }
}

/* SẤM SÉT TỪ KHO SHOWDOWN FX (lightning.png + electroball.png) */
.ps-fx-lightning {
    position: absolute;
    bottom: 90px;
    width: 110px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    z-index: 15;
}

.ps-fx-lightning.target-enemy { left: 69%; }
.ps-fx-lightning.target-player { left: 22%; }

.ps-fx-bolt-img {
    width: 96px;
    height: 220px;
    object-fit: fill;
    filter: drop-shadow(0 0 18px #fde047) drop-shadow(0 0 28px #38bdf8);
    animation: lightningStrikeFlash 0.44s ease-out forwards;
}

.ps-fx-electro-img {
    position: absolute;
    bottom: 10px;
    width: 68px;
    height: 68px;
    object-fit: contain;
    animation: impactSparkPop 0.44s ease-out forwards;
}

@keyframes lightningStrikeFlash {
    0%   { opacity: 0; transform: translateY(-45px) scaleY(0.4); }
    25%  { opacity: 1; transform: translateY(0) scaleY(1.08); }
    50%  { opacity: 0.35; }
    75%  { opacity: 1; transform: scaleX(1.22); }
    100% { opacity: 0; transform: scale(0.85); }
}

/* ĐÁ TẢNG RƠI TỪ KHO SHOWDOWN FX (rock1.png, rock2.png, rocks.png) */
.ps-fx-rock-drop {
    position: absolute;
    bottom: 105px;
    width: 64px;
    height: 64px;
    object-fit: contain;
    z-index: 15;
    animation: psRockFall 0.4s ease-in forwards;
}

.ps-fx-rock-drop.target-enemy { left: 72%; }
.ps-fx-rock-drop.target-player { left: 25%; }

@keyframes psRockFall {
    0%   { transform: translateY(-130px) rotate(-35deg) scale(0.8); opacity: 0.9; }
    75%  { transform: translateY(0) rotate(15deg) scale(1.2); opacity: 1; }
    100% { transform: translateY(12px) rotate(40deg) scale(0.9); opacity: 0; }
}

/* VỤ NỔ VA CHẠM TẠI ĐIỂM TRÚNG ĐÒN (impact.png + hitmarker.png + elemental hit) */
.skill-impact-burst {
    position: absolute;
    bottom: 92px;
    width: 108px;
    height: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 16;
}

.skill-impact-burst.at-enemy {
    left: 69%;
}

.skill-impact-burst.at-player {
    left: 22%;
}

.impact-ring {
    position: absolute;
    inset: 10px;
    border: 4px solid var(--skill-color, #facc15);
    border-radius: 50%;
    box-shadow: 0 0 24px var(--skill-color, #facc15), inset 0 0 18px var(--skill-color, #facc15);
    animation: impactRingExpand 0.44s ease-out forwards;
}

.skill-impact-burst.crit-burst .impact-ring {
    border-color: #fde047;
    box-shadow: 0 0 38px #ef4444, inset 0 0 24px #fde047;
}

.ps-fx-impact-base {
    position: absolute;
    width: 96px;
    height: 96px;
    object-fit: contain;
    animation: impactSparkPop 0.42s ease-out forwards;
}

.ps-fx-impact-elem {
    position: absolute;
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 0 14px var(--skill-color, #ffffff));
    animation: impactSparkPop 0.44s ease-out forwards;
}

.ps-fx-hitmarker {
    position: absolute;
    width: 56px;
    height: 56px;
    object-fit: contain;
    animation: impactRingExpand 0.38s ease-out forwards;
}

.super-eff-tag {
    position: absolute;
    top: -18px;
    background: #dc2626;
    color: #fef08a;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid #fde047;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

@keyframes impactRingExpand {
    0%   { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(1.65); opacity: 0; }
}

@keyframes impactSparkPop {
    0%   { transform: scale(0.45) rotate(-15deg); opacity: 1; }
    50%  { transform: scale(1.32) rotate(12deg); opacity: 1; }
    100% { transform: scale(1.6) rotate(25deg); opacity: 0; }
}

.floating-dmg.enemy-atk-dmg {
    color: #fb7185;
    font-size: 1.05rem;
}

/* ==========================================================================
   8. HÌNH ẢNH TRAINER & GYM LEADER TRÊN SÂN ĐẤU (PHONG CÁCH RED & BLUE)
   ========================================================================== */
.enemy-stage-group {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    position: relative;
}

.enemy-trainer-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    margin-bottom: 6px;
    z-index: 4;
}

.enemy-trainer-figure img {
    width: 86px;
    height: 86px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
}

.enemy-trainer-figure.gym-leader-figure img {
    width: 98px;
    height: 98px;
    filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.55)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
}

.trainer-figure-shadow {
    width: 58px;
    height: 11px;
    background: rgba(0, 0, 0, 0.36);
    border-radius: 50%;
    margin-top: -6px;
}

/* ==========================================================================
   9. GIAO DIỆN PHIÊU LƯU & NHÀ THI ĐẤU (CHUẨN BỐ CỤC 2 ẢNH MẪU CỦA BẠN)
   ========================================================================== */
.adventure-master-window {
    background: #141923;
    border: 2px solid #16a34a;
    border-radius: 10px;
    overflow: hidden;
    color: #e2e8f0;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

/* 1. Thanh xanh lá trên cùng: "🗺️ Phiêu lưu ?" | "Vùng đất 1/9" */
.adv-green-header {
    background: linear-gradient(90deg, #16a34a 0%, #15803d 100%);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font-weight: 800;
}

.agh-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.agh-help {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: help;
}

.agh-right {
    font-size: 0.86rem;
    color: #dcfce7;
}

/* 2. Dải 9 Vùng Đất ngang (Kanto, Johto, Hoenn, Sinnoh...) */
.adv-regions-strip {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    overflow-x: auto;
    background: #111620;
    border-bottom: 1px solid #222b3a;
}

.adv-region-card {
    min-width: 148px;
    background: #181f2c;
    border: 1.5px solid #293447;
    border-radius: 8px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.14s, border-color 0.14s;
    flex-shrink: 0;
}

.adv-region-card:hover {
    transform: translateY(-1px);
}

.adv-region-card.kanto-card {
    background: linear-gradient(135deg, #3b1929 0%, #261523 100%);
    border-color: #be123c;
}

.adv-region-card.johto-card {
    background: linear-gradient(135deg, #2d2618 0%, #1d1a14 100%);
    border-color: #d97706;
}

.adv-region-card.active-kanto {
    box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.35);
}

.arc-title-row {
    font-size: 0.88rem;
    color: #f8fafc;
}

.arc-caught-row {
    font-size: 0.75rem;
    color: #cbd5e1;
}

.arc-badges-row {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.adv-mini-badge {
    font-size: 0.72rem;
    filter: drop-shadow(0 1px 2px #000);
}

.adv-mini-badge.dim {
    opacity: 0.25;
    filter: grayscale(100%);
}

.arc-new-tag {
    font-size: 0.75rem;
    color: #e2e8f0;
    font-weight: 700;
}

.arc-setoff {
    font-size: 0.73rem;
    color: #fbbf24;
    font-weight: 800;
}

.adv-region-card.locked-region {
    opacity: 0.62;
    cursor: default;
}

.arc-lock-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* 3. Bố cục 2 cột dưới: Trái (NHÀ THI ĐẤU) | Phải (THÔNG TIN) */
.adv-two-col-body {
    display: grid;
    grid-template-columns: 335px 1fr;
    gap: 14px;
    padding: 12px 14px 16px;
}

@media (max-width: 960px) {
    .adv-two-col-body {
        grid-template-columns: 1fr;
    }
}

.adv-col-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ach-label {
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.ach-filter-btn {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.ach-sub-playing {
    font-size: 0.76rem;
    color: #cbd5e1;
}

.adv-chapters-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 690px;
    overflow-y: auto;
    padding-right: 4px;
}

.adv-league-section-label {
    font-size: 0.76rem;
    font-weight: 900;
    color: #94a3b8;
    margin: 8px 0 2px;
    letter-spacing: 0.05em;
}

/* Thẻ từng Chương / Nhà Thi Đấu bên cột trái */
/* Phiên 105: chương chưa tới bị làm ẩn (theo Poke'Catch) */
.adv-chapter-card.chapter-not-reached { opacity: .55; }
.adv-chapter-card.chapter-not-reached .acc-leader-img,
.adv-chapter-card.chapter-not-reached .acc-mini-badge-dot { filter: brightness(0) opacity(.5); }
.adv-chap-lock-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(15, 23, 42, .7); border: 1px solid #475569; color: #94a3b8; font-size: .7rem; font-weight: 800; }

.adv-chapter-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid #2b3648;
    background-color: #1c2433;
    background-image: linear-gradient(90deg, rgba(17, 23, 34, 0.92) 0%, rgba(25, 33, 48, 0.72) 55%, rgba(17, 23, 34, 0.85) 100%), var(--chap-bg);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.12s;
}

.adv-chapter-card:hover {
    border-color: #64748b;
}

.adv-chapter-card.selected-chapter {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.35);
}

.adv-chapter-card.legendary-chapter {
    border-color: #f59e0b;
}

.acc-code-col {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.acc-code-num {
    font-size: 0.74rem;
    font-weight: 900;
    color: #94a3b8;
}

.acc-avatar-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.acc-leader-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.75));
}

.acc-leader-img.legend-img {
    width: 52px;
    height: 52px;
    image-rendering: auto;
}

.acc-mini-badge-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.75rem;
    filter: drop-shadow(0 1px 2px #000);
}

.acc-info-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.acc-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.acc-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: #f8fafc;
    text-shadow: 0 1px 3px #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-done-tick {
    color: #4ade80;
    font-size: 0.78rem;
    font-weight: 900;
}

.acc-pills-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.adv-chap-lv-pill {
    background: rgba(20, 83, 45, 0.88);
    border: 1px solid #22c55e;
    color: #4ade80;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
}

.adv-chap-caught-pill {
    background: rgba(20, 83, 45, 0.92);
    border: 1px solid #22c55e;
    color: #86efac;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
}

.adv-chap-weather-pill {
    background: rgba(30, 58, 138, 0.88);
    border: 1px solid #3b82f6;
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
}

.acc-replay-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.85);
    color: #cbd5e1;
    font-size: 0.82rem;
    cursor: pointer;
    flex-shrink: 0;
}

.acc-replay-btn.playing-now {
    background: #16a34a;
    border-color: #4ade80;
    color: #ffffff;
}

/* CỘT PHẢI (THÔNG TIN & BANNER GYM RED/BLUE) */
.adv-detail-card {
    background: #181f2c;
    border: 1.5px solid #263144;
    border-radius: 10px;
    overflow: hidden;
}

/* Banner nội thất Nhà Thi Đấu kiểu Red & Blue với Tượng Đá & Gym Leader đứng bên phải */
.adv-gym-stage-banner {
    position: relative;
    height: 175px;
    background-color: #231942;
    background-image:
        linear-gradient(180deg, rgba(15, 23, 42, 0.25) 0%, rgba(15, 23, 42, 0.72) 100%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 28px, transparent 28px, transparent 96px),
        var(--gym-banner-bg);
    background-size: cover;
    background-position: center;
    border-bottom: 3px solid #2e3b52;
    overflow: hidden;
}

.adv-gym-stage-banner.theme-psychic {
    background-color: #2e1065;
    box-shadow: inset 0 0 60px rgba(168, 85, 247, 0.45);
}
.adv-gym-stage-banner.theme-rock {
    background-color: #44403c;
    box-shadow: inset 0 0 60px rgba(217, 119, 6, 0.35);
}
.adv-gym-stage-banner.theme-water {
    background-color: #0c4a6e;
    box-shadow: inset 0 0 60px rgba(56, 189, 248, 0.45);
}
.adv-gym-stage-banner.theme-electric {
    background-color: #422006;
    box-shadow: inset 0 0 60px rgba(250, 204, 21, 0.4);
}
.adv-gym-stage-banner.theme-grass {
    background-color: #14532d;
    box-shadow: inset 0 0 60px rgba(74, 222, 128, 0.4);
}
.adv-gym-stage-banner.theme-fire {
    background-color: #7f1d1d;
    box-shadow: inset 0 0 60px rgba(249, 115, 22, 0.45);
}

.agsb-architectural-pillars {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 68%, rgba(15, 23, 42, 0.82) 68%),
        repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.14) 0px, rgba(148, 163, 184, 0.14) 36px, transparent 36px, transparent 150px);
    pointer-events: none;
}

.agsb-gym-statues {
    position: absolute;
    bottom: 20px;
    left: 38%;
    transform: translateX(-50%);
    display: flex;
    gap: 110px;
    font-size: 2rem;
    opacity: 0.72;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.8));
    pointer-events: none;
}

.agsb-completed-pill {
    position: absolute;
    top: 12px;
    left: 14px;
    background: #22c55e;
    color: #052e16;
    font-size: 0.76rem;
    font-weight: 900;
    padding: 4px 12px;
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.agsb-completed-pill.pending {
    background: rgba(30, 41, 59, 0.88);
    color: #cbd5e1;
    border: 1px solid #475569;
}

.agsb-leader-stand {
    position: absolute;
    right: 28px;
    bottom: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.agsb-leader-sprite {
    width: 118px;
    height: 118px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.85));
}

.adv-detail-body {
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.adb-header-block {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.adb-badge-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #263147;
    border: 2px solid #eab308;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.adb-leader-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.adb-leader-name {
    font-size: 0.78rem;
    color: #cbd5e1;
    font-weight: 700;
}

.adb-type-pill {
    font-size: 0.66rem;
    font-weight: 900;
    color: #fff;
    padding: 1px 8px;
    border-radius: 8px;
    text-shadow: 0 1px 1px #000;
}

.adb-chapter-title {
    font-size: 1.32rem;
    font-weight: 900;
    color: #f8fafc;
    margin: 2px 0 0;
}

.adb-meta-pills-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.adb-meta-pill {
    font-size: 0.76rem;
    padding: 4px 11px;
    border-radius: 14px;
    font-weight: 700;
}

.adb-meta-pill.level-pill {
    background: rgba(20, 83, 45, 0.75);
    border: 1px solid #22c55e;
    color: #86efac;
}

.adb-meta-pill.reward-pill {
    background: #1f293b;
    border: 1px solid #334155;
    color: #e2e8f0;
}

.adb-meta-pill.weather-pill {
    background: #1e293b;
    border: 1px solid #3b82f6;
    color: #93c5fd;
}

.adb-section-block {
    border-top: 1px solid #253044;
    padding-top: 10px;
}

.adb-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.73rem;
    font-weight: 900;
    color: #94a3b8;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}

.adb-sec-count {
    font-weight: 600;
    color: #64748b;
}

.adb-now-badge {
    background: #eab308;
    color: #0f172a;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 8px;
}

.adb-items-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.adv-drop-item {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #111722;
    border: 1px solid #283449;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.adv-drop-item.found-item {
    border-color: #22c55e;
}

.adi-check {
    position: absolute;
    bottom: -3px;
    left: -3px;
    background: #22c55e;
    color: #052e16;
    font-size: 0.55rem;
    font-weight: 900;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.adb-poke-row {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.adv-poke-square {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #111722;
    border: 1.5px solid #283449;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
}

.adv-poke-square:hover {
    transform: translateY(-2px);
    border-color: #60a5fa;
}

.adv-poke-square.caught {
    border-color: #334155;
}

.adv-poke-square img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.adv-poke-square.unseen-silhouette img {
    filter: brightness(0.18) contrast(1.2);
    opacity: 0.75;
}

.aps-caught-ball {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.56rem;
}

.adv-big-red-start-btn {
    margin-top: 6px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
    transition: filter 0.15s, transform 0.1s;
}

.adv-big-red-start-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* ==========================================================================
   10. BẢNG BASE STATS (TOTAL + MIN/MAX LV.100) & TYPE DEFENSES CHUẨN POKEMONDB
   ========================================================================== */
.poke-summary-window {
    max-width: 780px !important;
    max-height: 92vh;
    overflow-y: auto;
}

.sum-pokemondb-footer {
    border-top: 2px solid #353242;
    padding: 12px 14px 14px;
    background: #1b1922;
}

.pdb-dual-inspector {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 14px;
}

@media (max-width: 820px) {
    .pdb-dual-inspector {
        grid-template-columns: 1fr;
    }
}

.pdb-base-stats-card,
.pdb-type-defenses-card {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.pdb-section-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pdb-src-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 6px;
}

.pdb-vitals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.pdb-vitals-table tr {
    border-top: 1px solid #e2e8f0;
}

.pdb-vitals-table th,
.pdb-vitals-table td {
    padding: 5px 6px;
}

.pdb-stat-th {
    text-align: right;
    color: #64748b;
    font-weight: 600;
    width: 68px;
    white-space: nowrap;
}

.pdb-stat-base {
    text-align: right;
    font-weight: 800;
    color: #0f172a;
    width: 36px;
}

.pdb-stat-total {
    text-align: right;
    font-size: 0.95rem;
    color: #0f172a;
}

.pdb-stat-bar-cell {
    width: 100%;
    padding: 0 10px !important;
}

.pdb-bar-track {
    width: 100%;
    height: 12px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.pdb-bar-fill {
    height: 100%;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.pdb-stat-minmax {
    text-align: right;
    color: #475569;
    font-variant-numeric: tabular-nums;
    width: 36px;
}

.pdb-minmax-head {
    text-align: right;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
}

.pdb-footnote {
    margin: 8px 0 0;
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.35;
}

.pdb-def-subtitle {
    font-size: 0.78rem;
    color: #475569;
    margin: 0 0 8px;
}

.pdb-def-tables-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdb-type-def-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.pdb-type-def-table th {
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 2px;
    text-align: center;
    border: 1px solid #cbd5e1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
}

.pdb-fx-cell {
    height: 26px;
    text-align: center;
    font-size: 0.76rem;
    font-weight: 800;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
}

/* MÀU HỆ SỐ KHẮC HỆ CHUẨN POKEMONDB (0, ¼, ½, 2, 4) */
.pdb-fx-cell.fx-0,
.pdb-fx-inline.fx-0 {
    background: #2e3436;
    color: #ffdd57;
}

.pdb-fx-cell.fx-25,
.pdb-fx-inline.fx-25 {
    background: #7c0000;
    color: #ffffff;
}

.pdb-fx-cell.fx-50,
.pdb-fx-inline.fx-50 {
    background: #a40000;
    color: #ffffff;
}

.pdb-fx-cell.fx-200,
.pdb-fx-inline.fx-200 {
    background: #4e9a06;
    color: #ffffff;
}

.pdb-fx-cell.fx-400,
.pdb-fx-inline.fx-400 {
    background: #73d216;
    color: #ffffff;
}

.pdb-def-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.7rem;
    color: #475569;
}

.pdb-fx-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 0.68rem;
    margin-right: 3px;
}

/* TAB POKEMONDB & MA TRẬN 18x18 */
.pdb-master-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdb-top-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pdb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pdb-search {
    width: 250px;
}

.pdb-selected-pill {
    font-size: 0.82rem;
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pdb-species-selector-strip {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 6px 2px 10px;
}

.pdb-species-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    background: #1e293b;
    border: 1.5px solid #334155;
    color: #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
}

.pdb-species-chip.active-sp {
    border-color: #38bdf8;
    background: #0f172a;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.pdb-species-chip img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.psc-name {
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.psc-bst {
    font-size: 0.68rem;
    color: #94a3b8;
    text-align: left;
}

.pdb-full-matrix-wrap {
    background: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #cbd5e1;
}

.pdb-matrix-header {
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #0f172a;
}

.pdb-matrix-scroll {
    overflow-x: auto;
}

.pdb-18x18-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.pdb-18x18-table th {
    color: #ffffff;
    font-size: 0.66rem;
    font-weight: 800;
    padding: 4px 3px;
    border: 1px solid #cbd5e1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
}

.pdb-corner-th {
    background: #334155 !important;
    width: 68px;
}

.pdb-atk-row-th {
    text-align: center;
}

/* ==========================================================================
   11. SPRITE TRAINER & HOẠT ẢNH TUNG BÓNG POKÉBALL TRÍCH XUẤT TỪ TRONG GAME
   ========================================================================== */
.game-trainer-sprite-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
}

.game-trainer-img {
    width: 108px;
    height: 108px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
    transition: transform 0.15s ease;
}

.game-trainer-sprite-wrap:hover .game-trainer-img {
    transform: translateY(-3px) scale(1.04);
}

.game-trainer-ground-shadow {
    width: 68px;
    height: 12px;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 50%;
    margin-top: -8px;
}

/* Động tác Trainer vung tay ném Pokéball như trong game */
.trainer-throw-swing {
    animation: trainerThrowSwingAnim 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes trainerThrowSwingAnim {
    0%   { transform: rotate(0deg) translateX(0); }
    28%  { transform: rotate(-16deg) translateX(-12px) scale(1.05); }
    62%  { transform: rotate(18deg) translateX(18px) translateY(-6px) scale(1.08); }
    100% { transform: rotate(0deg) translateX(0) scale(1); }
}

.game-pokeball-sprite {
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

/* Chuỗi hoạt ảnh tung bóng bắt Pokémon hoang dã trên đường đất */
.game-catch-sequence-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.game-ball-flight-arc {
    position: absolute;
    bottom: 28px;
    width: 42px;
    height: 42px;
    object-fit: contain;
    image-rendering: pixelated;
    z-index: 20;
    animation: gameBallArcThrow 0.36s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes gameBallArcThrow {
    0%   { transform: translate(-440px, -25px) rotate(0deg) scale(0.85); opacity: 1; }
    50%  { transform: translate(-210px, -135px) rotate(360deg) scale(1.15); opacity: 1; }
    92%  { transform: translate(0, -35px) rotate(720deg) scale(1.1); opacity: 1; }
    100% { transform: translate(0, 0) rotate(760deg) scale(0.2); opacity: 0; }
}

.game-ball-open-flash {
    position: absolute;
    bottom: 22px;
    width: 96px;
    height: 96px;
    object-fit: contain;
    z-index: 19;
    opacity: 0;
    filter: drop-shadow(0 0 18px #f43f5e) drop-shadow(0 0 28px #ffffff);
    animation: gameBallOpenBurst 0.35s ease-out 0.28s forwards;
}

@keyframes gameBallOpenBurst {
    0%   { transform: scale(0.2); opacity: 0; }
    45%  { transform: scale(1.35); opacity: 1; }
    100% { transform: scale(1.75); opacity: 0; }
}

.game-ball-wobble {
    opacity: 0;
    animation: gameBallDropAndWobble 0.85s ease-in-out 0.34s forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-ball-ground-shadow {
    width: 36px;
    height: 8px;
    background: rgba(0, 0, 0, 0.42);
    border-radius: 50%;
    margin-top: -4px;
}

@keyframes gameBallDropAndWobble {
    0%   { opacity: 1; transform: translateY(-42px) rotate(0deg); }
    18%  { opacity: 1; transform: translateY(0) rotate(0deg); }
    26%  { opacity: 1; transform: translateY(-14px) rotate(8deg); }
    35%  { opacity: 1; transform: translateY(0) rotate(0deg); }
    52%  { opacity: 1; transform: rotate(-22deg) translateX(-5px); }
    68%  { opacity: 1; transform: rotate(22deg) translateX(5px); }
    84%  { opacity: 1; transform: rotate(-16deg) translateX(-3px); }
    100% { opacity: 1; transform: rotate(0deg) translateX(0); }
}

/* Hoạt ảnh tung bóng triệu hồi Pokémon đồng hành (Lead Send-Out) */
.lead-sendout-fx-wrap {
    position: absolute;
    left: 25%;
    bottom: 92px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 18;
}

.sendout-ball-img {
    position: absolute;
    width: 38px;
    height: 38px;
    image-rendering: pixelated;
    animation: sendoutBallToss 0.28s ease-out forwards;
}

@keyframes sendoutBallToss {
    0%   { transform: translate(-85px, -15px) rotate(0deg) scale(0.9); opacity: 1; }
    80%  { transform: translate(0, 0) rotate(360deg) scale(1.1); opacity: 1; }
    100% { transform: scale(0.2); opacity: 0; }
}

.sendout-flash-img {
    position: absolute;
    width: 96px;
    height: 96px;
    opacity: 0;
    filter: drop-shadow(0 0 18px #38bdf8) drop-shadow(0 0 28px #ffffff);
    animation: gameBallOpenBurst 0.34s ease-out 0.2s forwards;
}

.lead-sendout-pop {
    animation: leadMaterializePop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes leadMaterializePop {
    0%   { transform: scale(0.15); filter: brightness(4) drop-shadow(0 0 22px #38bdf8); opacity: 0.2; }
    55%  { transform: scale(1.15); filter: brightness(2) drop-shadow(0 0 16px #38bdf8); opacity: 1; }
    100% { transform: scale(1); filter: none; opacity: 1; }
}

/* ==========================================================================
   12. HOẠT ẢNH BỤI CÂY HOANG DÃ, NPC/GYM NÉM POKÉBALL & THU POKÉMON VỀ CHUYỂN TIẾP
   ========================================================================== */

/* Nhãn & Bụi cỏ hoang dã bên phải sân đấu */
.enemy-bush-badge {
    background: rgba(21, 128, 61, 0.88);
    color: #dcfce7;
    font-size: 0.66rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #4ade80;
    margin-bottom: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

.wild-grass-bush-prop {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 4px;
    margin-left: -10px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
    z-index: 2;
}

.bush-rustle-shake {
    animation: wildBushRustle 0.44s ease-in-out;
}

@keyframes wildBushRustle {
    0%   { transform: translateX(0) rotate(0deg) scale(1); }
    20%  { transform: translateX(-7px) rotate(-10deg) scale(1.08); }
    45%  { transform: translateX(7px) rotate(10deg) scale(1.1); }
    70%  { transform: translateX(-5px) rotate(-6deg) scale(1.04); }
    100% { transform: translateX(0) rotate(0deg) scale(1); }
}

.wild-bush-leaf-burst {
    position: absolute;
    left: 72%;
    bottom: 92px;
    width: 90px;
    height: 90px;
    pointer-events: none;
    z-index: 18;
}

.bush-leaf-p {
    position: absolute;
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.bush-leaf-p.lf-1 { animation: bushLeafFly1 0.48s ease-out forwards; }
.bush-leaf-p.lf-2 { animation: bushLeafFly2 0.48s ease-out forwards; }
.bush-leaf-p.lf-3 { animation: bushLeafFly3 0.48s ease-out forwards; }

@keyframes bushLeafFly1 {
    0%   { transform: translate(15px, 20px) scale(0.5) rotate(0deg); opacity: 1; }
    100% { transform: translate(-38px, -34px) scale(1.15) rotate(-140deg); opacity: 0; }
}
@keyframes bushLeafFly2 {
    0%   { transform: translate(20px, 20px) scale(0.5) rotate(0deg); opacity: 1; }
    100% { transform: translate(12px, -48px) scale(1.2) rotate(120deg); opacity: 0; }
}
@keyframes bushLeafFly3 {
    0%   { transform: translate(25px, 20px) scale(0.5) rotate(0deg); opacity: 1; }
    100% { transform: translate(46px, -28px) scale(1.1) rotate(200deg); opacity: 0; }
}

.enemy-bush-leap {
    animation: wildEnemyBushLeap 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wildEnemyBushLeap {
    0%   { transform: translate(36px, 18px) scale(0.25); filter: brightness(2.2); opacity: 0; }
    60%  { transform: translate(-8px, -18px) scale(1.12); filter: brightness(1.2); opacity: 1; }
    100% { transform: translate(0, 0) scale(1); filter: none; opacity: 1; }
}

/* Hoạt ảnh NPC Trainer / Gym Leader xuất hiện bên phải & vung tay ném Pokéball */
.enemy-trainer-enter {
    animation: enemyTrainerSlideIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes enemyTrainerSlideIn {
    0%   { transform: translateX(65px); opacity: 0; }
    65%  { transform: translateX(-6px) rotate(-6deg); opacity: 1; }
    100% { transform: translateX(0) rotate(0deg); opacity: 1; }
}

.enemy-trainer-throw {
    animation: enemyTrainerThrowMotion 0.38s ease-out;
}

@keyframes enemyTrainerThrowMotion {
    0%   { transform: translateX(0) rotate(0deg) scale(1); }
    35%  { transform: translateX(12px) rotate(12deg) scale(1.05); }
    70%  { transform: translateX(-14px) rotate(-14deg) scale(1.08); }
    100% { transform: translateX(0) rotate(0deg) scale(1); }
}

.enemy-trainer-exit {
    animation: enemyTrainerSlideOut 0.45s ease-in forwards;
}

@keyframes enemyTrainerSlideOut {
    0%   { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(70px); opacity: 0; }
}

/* Quả Pokéball từ tay NPC Trainer / Gym Leader ném ra triệu hồi Pokémon địch */
.enemy-sendout-fx-wrap {
    position: absolute;
    left: 69%;
    bottom: 92px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 18;
}

.enemy-sendout-ball-img {
    position: absolute;
    width: 38px;
    height: 38px;
    image-rendering: pixelated;
    animation: enemySendoutBallToss 0.28s ease-out forwards;
}

@keyframes enemySendoutBallToss {
    0%   { transform: translate(85px, -18px) rotate(0deg) scale(0.9); opacity: 1; }
    80%  { transform: translate(0, 0) rotate(-360deg) scale(1.1); opacity: 1; }
    100% { transform: scale(0.2); opacity: 0; }
}

.enemy-sendout-flash-img {
    position: absolute;
    width: 96px;
    height: 96px;
    opacity: 0;
    filter: drop-shadow(0 0 18px #f59e0b) drop-shadow(0 0 28px #ffffff);
    animation: gameBallOpenBurst 0.34s ease-out 0.2s forwards;
}

.enemy-sendout-pop {
    animation: enemyMaterializePop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes enemyMaterializePop {
    0%   { transform: scale(0.15); filter: brightness(4) drop-shadow(0 0 22px #f59e0b); opacity: 0.2; }
    55%  { transform: scale(1.15); filter: brightness(2) drop-shadow(0 0 16px #f59e0b); opacity: 1; }
    100% { transform: scale(1); filter: none; opacity: 1; }
}

/* Hoạt ảnh Thu Pokémon về lại Pokéball bằng tia laser đỏ (Recall Effect) */
.trainer-recall-pose {
    animation: trainerRecallRaise 0.42s ease-in-out;
}

@keyframes trainerRecallRaise {
    0%   { transform: translateY(0) scale(1); }
    40%  { transform: translateY(-5px) scale(1.06); filter: drop-shadow(0 0 12px #ef4444); }
    100% { transform: translateY(0) scale(1); }
}

.lead-recall-shrink {
    animation: pokemonRecallRedShrink 0.42s ease-in forwards !important;
}

.enemy-recall-shrink {
    animation: pokemonRecallRedShrink 0.4s ease-in forwards !important;
}

@keyframes pokemonRecallRedShrink {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1);
        opacity: 1;
    }
    35% {
        transform: scale(1.08) translateY(-6px);
        filter: sepia(1) saturate(8) hue-rotate(-50deg) brightness(1.8) drop-shadow(0 0 20px #ef4444);
        opacity: 1;
    }
    100% {
        transform: scale(0.08) translateY(-18px);
        filter: sepia(1) saturate(10) hue-rotate(-50deg) brightness(3) drop-shadow(0 0 26px #ef4444);
        opacity: 0;
    }
}

.lead-recall-fx-wrap,
.enemy-recall-fx-wrap {
    position: absolute;
    bottom: 96px;
    width: 140px;
    height: 90px;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lead-recall-fx-wrap {
    left: 18%;
}

.enemy-recall-fx-wrap {
    left: 68%;
}

.recall-red-laser {
    position: absolute;
    height: 5px;
    background: linear-gradient(90deg, #ffffff, #ef4444, #f43f5e, #ffffff);
    border-radius: 999px;
    box-shadow: 0 0 14px #ef4444, 0 0 24px #f43f5e;
}

.recall-red-laser.player-laser {
    width: 95px;
    transform-origin: left center;
    animation: recallLaserBeam 0.36s ease-out forwards;
}

.recall-red-laser.enemy-laser {
    width: 90px;
    transform-origin: right center;
    animation: recallLaserBeam 0.36s ease-out forwards;
}

@keyframes recallLaserBeam {
    0%   { transform: scaleX(0.1); opacity: 0.9; }
    45%  { transform: scaleX(1.05); opacity: 1; }
    100% { transform: scaleX(0.05); opacity: 0; }
}

.recall-return-ball {
    position: absolute;
    width: 34px;
    height: 34px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 12px #ef4444);
}

.recall-return-ball.player-return-ball {
    animation: returnBallToPlayer 0.42s ease-in forwards;
}

.recall-return-ball.enemy-return-ball {
    animation: returnBallToEnemy 0.4s ease-in forwards;
}

@keyframes returnBallToPlayer {
    0%   { transform: translate(34px, -4px) scale(0.9) rotate(0deg); opacity: 1; }
    40%  { transform: translate(22px, -22px) scale(1.15) rotate(-180deg); opacity: 1; }
    100% { transform: translate(-48px, 6px) scale(0.55) rotate(-360deg); opacity: 0; }
}

@keyframes returnBallToEnemy {
    0%   { transform: translate(-28px, -4px) scale(0.9) rotate(0deg); opacity: 1; }
    40%  { transform: translate(-14px, -22px) scale(1.15) rotate(180deg); opacity: 1; }
    100% { transform: translate(52px, 6px) scale(0.55) rotate(360deg); opacity: 0; }
}

/* Hiệu ứng Bước đi chuyển tiếp sang Bụi Cây tiếp theo trên đường đất */
.stage-walking-transition .stage-svg-bg {
    animation: stageRoadWalkPan 0.48s ease-in-out;
}

.stage-walking-transition #stage-trainer-holder {
    animation: trainerWalkStepBob 0.48s ease-in-out;
}

@keyframes stageRoadWalkPan {
    0%   { transform: translateX(0) scale(1); }
    50%  { transform: translateX(-14px) scale(1.015); }
    100% { transform: translateX(0) scale(1); }
}

@keyframes trainerWalkStepBob {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(6px, -6px) rotate(3deg); }
    50%  { transform: translate(12px, 0) rotate(-2deg); }
    75%  { transform: translate(6px, -5px) rotate(2deg); }
    100% { transform: translate(0, 0); }
}

/* ============================================================================
   HỆ THỐNG TIẾN HÓA (EVOLUTION BADGES, STAGE BURST & EVOLUTION CHAIN TREE)
   ============================================================================ */
.party-hud-slot.evo-glow-slot {
    border-color: #facc15 !important;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.7);
}

.slot-evo-pill {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #fde047, #eab308);
    color: #0f172a;
    border: 1px solid #ffffff;
    border-radius: 999px;
    padding: 1px 5px;
    font-size: 0.58rem;
    font-weight: 900;
    cursor: pointer;
    z-index: 6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    animation: evoPillPulse 1.2s infinite ease-in-out;
}

.pc-slot-card.pc-evo-ready-card {
    border-color: #eab308 !important;
    box-shadow: inset 0 0 10px rgba(250, 204, 21, 0.22);
}

.pc-card-evo-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    background: linear-gradient(135deg, #fde047, #ca8a04);
    color: #0f172a;
    border: 1px solid #fff;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.62rem;
    font-weight: 900;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    animation: evoPillPulse 1.2s infinite ease-in-out;
}

.pc-card-evo-btn:hover,
.slot-evo-pill:hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}

@keyframes evoPillPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}

.stage-evo-burst-wrap {
    position: absolute;
    left: 24%;
    bottom: 84px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stage-evo-banner {
    background: linear-gradient(90deg, #ca8a04, #fde047, #ca8a04);
    color: #0f172a;
    font-weight: 900;
    font-size: 0.82rem;
    padding: 4px 14px;
    border-radius: 999px;
    border: 2px solid #fff;
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.9);
    white-space: nowrap;
    margin-bottom: 6px;
    animation: evoBannerFloat 1.3s ease-out forwards;
}

.stage-evo-shine-fx {
    width: 130px;
    height: 130px;
    filter: drop-shadow(0 0 18px #fde047) drop-shadow(0 0 28px #38bdf8);
    animation: evoShineSpin 1.25s ease-out forwards;
}

@keyframes evoBannerFloat {
    0%   { transform: translateY(12px) scale(0.8); opacity: 0; }
    20%  { transform: translateY(0) scale(1.05); opacity: 1; }
    80%  { transform: translateY(-8px) scale(1); opacity: 1; }
    100% { transform: translateY(-18px) scale(0.95); opacity: 0; }
}

@keyframes evoShineSpin {
    0%   { transform: scale(0.3) rotate(0deg); opacity: 0.95; }
    50%  { transform: scale(1.25) rotate(120deg); opacity: 1; }
    100% { transform: scale(1.6) rotate(240deg); opacity: 0; }
}

/* Sơ đồ Chuỗi Tiến Hóa (Evolution Chain) trong bảng Summary */
.pdb-evo-chain-card {
    background: #17161e;
    border: 1px solid #322f42;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.evo-chain-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 6px;
}

.evo-chain-stage-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.evo-chain-arrow {
    color: #fde047;
    font-size: 1.25rem;
    font-weight: 900;
    padding: 0 4px;
}

.evo-chain-node {
    background: #22202c;
    border: 1px solid #3b374c;
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 128px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.evo-chain-node:hover {
    transform: translateY(-2px);
    border-color: #60a5fa;
}

.evo-chain-node.current-node {
    border: 2px solid #fde047;
    background: #2b2838;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.25);
}

.evo-chain-node.owned-node {
    border-color: #22c55e;
}

.evo-chain-req-pill {
    background: #334155;
    color: #fde047;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 999px;
}

.evo-chain-req-pill.base {
    color: #94a3b8;
}

.evo-chain-sprite {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.evo-chain-name {
    font-size: 0.74rem;
    font-weight: 800;
    color: #f8fafc;
}

.evo-chain-act-btn {
    margin-top: 2px;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.66rem;
    font-weight: 800;
    cursor: pointer;
}

.evo-chain-act-btn.ready {
    background: linear-gradient(135deg, #fde047, #eab308);
    color: #0f172a;
}

.evo-chain-act-btn.buy {
    background: #3b2d4a;
    border: 1px solid #a855f7;
    color: #f3e8ff;
}

/* =========================================================================
   HỆ THỐNG MOVE SKILL, HIDDEN ABILITY [HA], STATUS, GENDER, CATCH RATE & PVP
   ========================================================================= */
.ha-mini-pill {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #0f172a;
    font-size: 0.62rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #fef08a;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.normal-ab-pill {
    display: inline-block;
    background: #334155;
    color: #cbd5e1;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

.status-mini-pill {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    color: #fff;
    vertical-align: middle;
}
.status-brn { background: #ef4444; }
.status-par { background: #eab308; color: #0f172a; }
.status-psn { background: #a855f7; }
.status-frz { background: #38bdf8; color: #0f172a; }
.status-slp { background: #64748b; }

.sum-move-card {
    background: #23202d;
    border: 1px solid #353144;
    border-radius: 6px;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sum-move-type-dot {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 4px;
    text-transform: uppercase;
}

.sum-move-right-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sum-move-cycle-btn {
    background: #334155;
    border: 1px solid #475569;
    color: #fde047;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 6px;
    cursor: pointer;
}
.sum-move-cycle-btn:hover {
    background: #475569;
}

.sum-move-meta-sub {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #94a3b8;
}

.sum-ability-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.sum-ability-desc {
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.3;
    margin-bottom: 4px;
}

.sum-ability-pool-line {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-bottom: 5px;
}

.sum-ability-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ha-patch-btn {
    background: linear-gradient(135deg, #ca8a04, #eab308) !important;
    color: #0f172a !important;
    border-color: #fef08a !important;
    font-weight: 800 !important;
}

.sum-bio-box {
    font-size: 0.76rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #1b1922;
    border: 1px solid #2f2c3b;
    border-radius: 6px;
    padding: 6px 8px;
}

.sum-catch-sim {
    color: #94a3b8;
    font-size: 0.72rem;
}

/* ĐẤU TRƯỜNG PVP (RANKED ARENA) */
.pvp-arena-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px;
}

.pvp-arena-header {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1.6fr;
    gap: 10px;
    background: #161922;
    border: 1px solid #2e3446;
    border-radius: 8px;
    padding: 10px 12px;
}

@media (max-width: 900px) {
    .pvp-arena-header {
        grid-template-columns: 1fr;
    }
}

.pvp-rank-tier {
    font-size: 0.95rem;
    font-weight: 900;
}

.pvp-elo-big {
    font-size: 0.88rem;
    color: #f8fafc;
}

.pvp-wl-sub {
    font-size: 0.74rem;
    color: #94a3b8;
}

.pvp-rules-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    font-size: 0.8rem;
}

.pvp-bp-balance strong {
    color: #fde047;
    font-size: 0.92rem;
}

.pvp-rule-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pvp-bp-shop-strip {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.pvp-shop-label {
    font-size: 0.76rem;
    font-weight: 800;
    color: #cbd5e1;
}

.pvp-shop-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pvp-battle-arena-box {
    background: linear-gradient(180deg, #1b2234 0%, #121722 100%);
    border: 2px solid #3b82f6;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pvp-battle-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.84rem;
    border-bottom: 1px solid #2e3a52;
    padding-bottom: 6px;
}

.pvp-weather-pill {
    background: #1e293b;
    border: 1px solid #475569;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    color: #fde047;
}

.pvp-fighters-stage {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.pvp-fighter-card {
    background: #161c28;
    border: 1px solid #2e3a52;
    border-radius: 8px;
    padding: 8px 12px;
    position: relative;
}

.pvp-party-balls {
    display: flex;
    gap: 4px;
    font-size: 0.72rem;
    margin-bottom: 4px;
}

.pvp-f-header {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 0.9rem;
}

.pvp-f-ability {
    font-size: 0.74rem;
    color: #94a3b8;
    margin: 2px 0 5px;
}

.pvp-hp-track {
    height: 9px;
    background: #0f172a;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #334155;
}

.pvp-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    transition: width 0.25s ease;
}

.pvp-hp-fill.enemy {
    background: linear-gradient(90deg, #dc2626, #f97316);
}

.pvp-hp-text {
    font-size: 0.72rem;
    color: #cbd5e1;
    margin-top: 3px;
}

.pvp-f-sprite {
    width: 68px;
    height: 68px;
    object-fit: contain;
    display: block;
    margin: 4px auto 0;
}

.pvp-vs-center {
    font-size: 1.3rem;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
}

.pvp-controls-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 10px;
}

@media (max-width: 820px) {
    .pvp-controls-grid {
        grid-template-columns: 1fr;
    }
}

.pvp-sub-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fde047;
    margin-bottom: 6px;
}

.pvp-moves-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.pvp-move-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 6px 8px;
    color: #f8fafc;
    text-align: left;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.15s;
}
.pvp-move-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #60a5fa;
    background: #263449;
}
.pvp-move-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pvp-mv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.pvp-mv-type {
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 3px;
    color: #fff;
}

.pvp-mv-sub {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.68rem;
    color: #cbd5e1;
}

.move-prio-pill {
    background: #0284c7;
    color: #fff;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 800;
}

.pvp-switch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.pvp-switch-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 4px 6px;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-align: left;
}
.pvp-switch-btn img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}
.pvp-switch-btn.active-slot {
    border-color: #fde047;
    background: #292524;
}
.pvp-switch-btn.dead-slot {
    opacity: 0.4;
}

.pvp-sw-name {
    font-size: 0.72rem;
    font-weight: 800;
}
.pvp-sw-hp {
    font-size: 0.64rem;
    color: #94a3b8;
}

.pvp-battle-log {
    background: #0b0f19;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 6px 10px;
    max-height: 110px;
    overflow-y: auto;
    font-size: 0.74rem;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pvp-ladder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 8px;
}

.pvp-trainer-card {
    background: #161922;
    border: 1px solid #2b3040;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pvp-tr-avatar {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.pvp-tr-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pvp-tr-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.pvp-tr-tier {
    font-size: 0.68rem;
    color: #94a3b8;
}

.pvp-tr-elo {
    font-size: 0.7rem;
    color: #fde047;
    font-weight: 800;
}

.pvp-tr-desc {
    font-size: 0.7rem;
    color: #94a3b8;
}

.pvp-tr-team-row {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.pvp-tr-poke {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #1e2433;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 0.68rem;
}
.pvp-tr-poke img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.pvp-tr-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.pvp-tr-reward {
    font-size: 0.68rem;
    color: #4ade80;
    font-weight: 800;
}

/* ==========================================================================
   GIAO DIỆN 3 CỘT CHUẨN ẢNH MẪU (TOPBAR + SIDEBAR TRÁI + HANG ĐÁ GIỮA + TÚI ĐỒ/SPAWNS PHẢI)
   ========================================================================== */
body {
    background-color: #131620;
    background-image: radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.025) 6px, transparent 7px);
    background-size: 48px 48px;
    padding: 8px 12px;
    display: block;
}

.app-shell {
    width: 100%;
    max-width: 1460px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 1. THANH TOP NAVBAR TRÊN CÙNG */
.app-top-navbar {
    background: #171a26;
    border: 1px solid #262b3d;
    border-radius: 10px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-left-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding-right: 12px;
    border-right: 1px solid #262b3d;
}

.nav-avatar-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #232838;
    border: 2px solid #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.nav-avatar-wrap img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 50%;
}

.nav-new-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #facc15;
    color: #0f172a;
    font-size: 0.52rem;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid #0f172a;
}

.nav-profile-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 135px;
}

.nav-trainer-name {
    font-size: 0.86rem;
    font-weight: 800;
    color: #f8fafc;
}

.nav-tag {
    color: #64748b;
    font-weight: 600;
    font-size: 0.78rem;
}

.nav-pokedex-sub {
    font-size: 0.68rem;
    color: #94a3b8;
}

.nav-pokedex-sub strong {
    color: #e2e8f0;
}

.nav-dex-bar-track {
    width: 100%;
    height: 4px;
    background: #252a3a;
    border-radius: 99px;
    overflow: hidden;
}

.nav-dex-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.nav-currency-pills {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-curr-pill {
    background: #1f2433;
    border: 1px solid #2d3448;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.82rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-curr-pill.ticket-pill {
    cursor: pointer;
}

.nav-curr-pill.hidden-stat-pill {
    font-size: 0.74rem;
    color: #94a3b8;
}

.nav-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-online-pill {
    background: #1c2130;
    border: 1px solid #2b3246;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.nav-icon-btn {
    background: #1f2433;
    border: 1px solid #2e364b;
    color: #facc15;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-donate-btn {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    border: 1px solid #fb7185;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.nav-save-btn {
    position: relative;
    background: #252b3d;
    border: 1px solid #38415a;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.save-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
}

/* Phiên 90: bảng Cài đặt */
.settings-window { width: min(760px, 100%); max-height: 90vh; overflow-y: auto; background: #171a26; border: 2px solid #38bdf8; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 900; color: #e2e8f0; background: linear-gradient(90deg, #0c4a6e, #1e3a8a); border-radius: 12px 12px 0 0; }
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th { width: 170px; text-align: left; vertical-align: top; padding: 14px 16px; color: #7dd3fc; font-size: .9rem; border-bottom: 1px solid #2b3246; white-space: nowrap; }
.settings-table td { padding: 12px 16px; border-bottom: 1px solid #2b3246; }
.settings-table td > * { margin: 0 6px 6px 0; }
.settings-table tr:last-child th, .settings-table tr:last-child td { border-bottom: none; }
.settings-sub { color: #94a3b8; font-size: .78rem; display: block; }
.settings-lv-row { display: flex; align-items: center; gap: 6px; color: #e2e8f0; font-size: .85rem; flex-wrap: wrap; }
.settings-lv-in { width: 64px; background: #0b1020; border: 1px solid #334155; color: #e2e8f0; border-radius: 8px; padding: 6px 8px; }
.settings-table .pokeball-quick-bar { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .settings-table th, .settings-table td { display: block; width: auto; } .settings-table th { border-bottom: none; padding-bottom: 4px; } }

.settings-drawer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 2. BỐ CỤC 3 CỘT CHÍNH (LEFT SIDEBAR | CENTER STAGE | RIGHT SIDEBAR) */
.app-main-grid {
    display: grid;
    grid-template-columns: 215px minmax(0, 1fr) 285px;
    gap: 10px;
    align-items: start;
}

@media (max-width: 1180px) {
    .app-main-grid {
        grid-template-columns: 200px minmax(0, 1fr);
    }
    .app-right-sidebar {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (max-width: 820px) {
    .app-main-grid {
        grid-template-columns: 1fr;
    }
    .app-right-sidebar {
        grid-template-columns: 1fr;
    }
}

/* CỘT 1: LEFT SIDEBAR */
.app-left-sidebar {
    background: #171a26;
    border: 1px solid #252a3a;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
}

.sidebar-route-card {
    background: linear-gradient(180deg, #2a1820 0%, #1f141b 100%);
    border: 1.5px solid #7f1d1d;
    border-radius: 9px;
    padding: 9px 10px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.12s;
}
.sidebar-route-card:hover {
    border-color: #ef4444;
    transform: translateY(-1px);
}

.src-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.src-avatar {
    width: 34px;
    height: 34px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
}

.src-titles {
    overflow: hidden;
}

.src-chap {
    font-size: 0.66rem;
    color: #fca5a5;
}

.src-name {
    font-size: 0.84rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.src-progress-track {
    width: 100%;
    height: 5px;
    background: #140d12;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px;
}

.src-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.src-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.66rem;
    color: #cbd5e1;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.snav-item,
.snav-subitem {
    width: 100%;
    background: #1e2333;
    border: 1px solid #282f44;
    border-radius: 8px;
    padding: 8px 10px;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.snav-item:hover,
.snav-subitem:hover {
    background: #262d42;
    color: #fff;
    border-color: #3b4664;
}

.snav-item.active,
.snav-subitem.active {
    background: #252f48;
    border-color: #60a5fa;
    color: #ffffff;
}

.snav-ico {
    font-size: 0.92rem;
    width: 18px;
    text-align: center;
}

.snav-group {
    background: #141722;
    border: 1px solid #222738;
    border-radius: 8px;
    padding: 4px;
}

.snav-group-header {
    width: 100%;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 0.76rem;
    font-weight: 800;
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.snav-group-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.snav-group-body.collapsed {
    display: none;
}

.snav-subitem {
    background: #1b202e;
    padding: 7px 9px;
    font-size: 0.74rem;
}

.snav-subitem.locked-row {
    opacity: 0.55;
}

.snav-lock {
    margin-left: auto;
    font-size: 0.68rem;
}

.snav-divider {
    height: 1px;
    background: #252a3a;
    margin: 3px 0;
}

/* CỘT 2: CENTER STAGE & BOTTOM CONSOLE */
.app-center-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* Hang đá Victory Road mặc định như ảnh mẫu */
.cave-landscape-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

.pixel-scene-stage.cave-theme .cave-landscape-svg {
    display: block;
}

.pixel-scene-stage.cave-theme .hd-landscape-svg {
    display: none;
}

/* Đồng hồ góc trên trái sân khấu + nút Home nhỏ giống ảnh mẫu */
.weather-clock-pill {
    padding: 4px 11px;
    font-size: 0.76rem;
    border-radius: 8px;
    background: rgba(18, 22, 34, 0.88);
}

.stage-home-pill {
    background: rgba(18, 22, 34, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    padding: 4px 7px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
}

/* Cột 6 Ô Đội hình bên trái + Nhãn +EXP bay màu vàng bên phải ô */
.left-party-column {
    left: 14px;
    top: 50%;
    transform: translateY(-54%);
    gap: 6px;
}

.party-slot-row-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.party-hud-slot {
    width: 54px;
    padding: 3px 4px 4px;
    border-radius: 7px;
    background: rgba(17, 21, 32, 0.88);
    border: 1.5px solid #334155;
    position: relative;
}

.party-hud-slot img {
    width: 34px;
    height: 34px;
}

.slot-corner-tag {
    position: absolute;
    top: 2px;
    left: 3px;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.44rem;
    font-weight: 900;
    padding: 0 3px;
    border-radius: 2px;
}
.slot-corner-tag.ha {
    background: #eab308;
    color: #0f172a;
}

.slot-exp-bar {
    width: 100%;
    height: 3px;
    background: #0f172a;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.slot-exp-fill {
    height: 100%;
    background: #38bdf8;
}

.slot-lv {
    font-size: 0.62rem;
    margin: 2px 0 0;
}

.party-exp-float {
    font-size: 0.68rem;
    font-weight: 900;
    color: #fde047;
    text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.party-exp-float.show-exp-pop {
    animation: partyExpFade 1.55s ease-out forwards;
}

@keyframes partyExpFade {
    0%   { opacity: 0; transform: translateX(-4px); }
    15%  { opacity: 1; transform: translateX(0); }
    80%  { opacity: 1; transform: translateX(2px); }
    100% { opacity: 0; transform: translateX(6px); }
}

/* Sân khấu chiến đấu giữa: Tăng kích thước Sprite Pokémon chủ lực & Hiệu ứng chớp trắng Silhouette khi đối thủ trúng đòn */
/* Nhân vật Trainer: ẩn ngoài mép trái, chỉ trượt vào sân khi tung bóng (send-out / bắt Pokémon) — xem mục PHIÊN 4 cuối file */
.stage-trainer-holder {
    display: block;
    position: absolute;
    left: -86px;
    bottom: 2px;
    width: 120px;
    height: 150px;
    z-index: 4;
    opacity: 0;
    transform: translateX(-80px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
    pointer-events: none;
}

.stage-trainer-holder.trainer-on-stage {
    opacity: 1;
    transform: translateX(0);
}

.road-actors-stage {
    left: 165px;
    right: 135px;
    bottom: 92px;
}

#stage-lead-sprite {
    width: 155px;
    height: 155px;
}

.mega-mini-pill {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: #fff;
    font-size: 0.56rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 99px;
    vertical-align: middle;
}

/* Hiệu ứng đối thủ chớp trắng Silhouette viền đỏ khi nhận sát thương giống hệt Machop trong ảnh mẫu */
.enemy-hit-flash {
    animation: enemyWhiteSilhouette 0.34s ease-out;
}

@keyframes enemyWhiteSilhouette {
    0%, 100% {
        transform: translateX(0);
        filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.45));
    }
    35%, 70% {
        transform: translateX(8px) scale(0.95);
        filter: brightness(0) invert(1) drop-shadow(0 0 3px #ef4444) drop-shadow(0 0 8px #ef4444);
    }
}

/* Khung Console & Quản lý phía dưới sân khấu */
.center-bottom-console {
    background: #131621;
    border: 1px solid #24293b;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.console-mini-tabs {
    background: #181c29;
    border-bottom: 1px solid #24293b;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;   /* Phiên 138: ẩn thanh trượt ngang (vẫn vuốt / lăn chuột được) */
}
.console-mini-tabs::-webkit-scrollbar { display: none; }

.c-tab-btn {
    background: #1f2536;
    border: 1px solid #2c344b;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.c-tab-btn:hover {
    color: #f8fafc;
}

.c-tab-btn.active {
    background: #28324c;
    border-color: #60a5fa;
    color: #fff;
}

.console-log-panel {
    min-height: 115px;
    max-height: 145px;
    overflow-y: auto;
    padding: 10px 14px;
    background: #11141e;
}

.console-log-history {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.clog-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: #94a3b8;
}

.clog-row.clog-gold .clog-msg {
    color: #facc15;
    font-weight: 700;
}

.clog-time {
    color: #64748b;
    font-size: 0.7rem;
}

.live-bottom-ticker {
    background: #151925;
    border-top: 1px solid #222738;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
}

.ticker-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-gold-text {
    color: #eab308;
    font-weight: 700;
}

.ticker-time {
    color: #64748b;
    font-size: 0.7rem;
}

/* CỘT 3: RIGHT SIDEBAR ("Vật phẩm tiêu hao" & "Xuất hiện tại đây") */
.app-right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.right-sidebar-card {
    background: #171a26;
    border: 1px solid #252a3a;
    border-radius: 10px;
    padding: 12px;
}

.rsc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rsc-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rsc-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #f8fafc;
}

.rsc-help-circle {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #252b3d;
    color: #94a3b8;
    font-size: 0.66rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.rsc-bag-btn {
    background: #232839;
    border: 1px solid #333b52;
    color: #e2e8f0;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.rsc-bag-btn:hover {
    border-color: #60a5fa;
}

.right-consumables-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.rc-item-slot {
    position: relative;
    height: 44px;
    background: #1e2333;
    border: 1px solid #2b3247;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
}

.rc-item-slot:hover {
    transform: translateY(-1px);
    border-color: #60a5fa;
}

.rc-item-slot.selected-slot {
    border-color: #facc15;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.3);
}

.rc-item-slot img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.rc-item-emoji {
    font-size: 1.15rem;
}

.rc-item-qty {
    position: absolute;
    right: 3px;
    bottom: 2px;
    font-size: 0.58rem;
    font-weight: 800;
    color: #f8fafc;
    text-shadow: 0 1px 2px #000;
}

.rsc-route-caught {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
}

.caught-green {
    color: #22c55e;
}

.right-spawns-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.rc-spawn-tile {
    background: #16222c;
    border: 1.5px solid #244052;
    border-radius: 7px;
    padding: 4px 2px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
}

.rc-spawn-tile:hover {
    transform: translateY(-2px);
    border-color: #38bdf8;
}

.rc-spawn-tile.uncaught img {
    filter: brightness(0.68) contrast(1.1);
}

.rc-spawn-tile img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.rc-spawn-pct {
    font-size: 0.6rem;
    font-weight: 800;
    color: #e2e8f0;
}

/* ============================================================================
   PHIÊN 4 — NHÂN VẬT NÉM BÓNG, CHUỖI BẮT POKÉMON, KHUNG RUN AWAY, HUẤN LUYỆN,
   POKÉDEX ĐÃ GẶP / ĐÃ BẮT, BẢNG CHIÊU THỨC & ẢNH POKÉMON LỚN HƠN
   ============================================================================ */

/* 1. ẢNH POKÉMON LỚN HƠN & SẮC NÉT KIỂU PIXEL GAME */
.stage-pokemon-sprite {
    image-rendering: pixelated;
}

#stage-enemy-sprite {
    width: 140px;
    height: 140px;
}

.sprite-hd-fallback {
    image-rendering: auto !important;
}

.party-hud-slot img {
    width: 40px;
    height: 40px;
}

.pc-slot-icon-box {
    position: relative;
    width: 52px;
    height: 52px;
}

.pc-slot-icon-box img {
    width: 48px;
    height: 48px;
}

.rc-spawn-tile {
    position: relative;
    height: 62px;
}

.rc-spawn-tile img {
    width: 38px;
    height: 38px;
}

.evo-chain-node {
    position: relative;
}

.evo-chain-sprite {
    width: 68px;
    height: 68px;
    image-rendering: pixelated;
}

.sum-hd-artwork {
    width: 150px;
    height: 150px;
    image-rendering: pixelated;
}

.sum-cyan-pedestal {
    width: 150px;
    margin-top: -20px;
}

/* 2. THANH HP ĐỔI MÀU CHUẨN GAME (XANH > 50% • VÀNG 20-50% • ĐỎ < 20%) */
.overhead-hp-pill {
    width: 96px;
    height: 10px;
}

.overhead-hp-pill .overhead-hp-fill.hp-green {
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
}

.overhead-hp-pill .overhead-hp-fill.hp-yellow {
    background: linear-gradient(180deg, #fde047 0%, #eab308 100%);
}

.overhead-hp-pill .overhead-hp-fill.hp-red {
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
    animation: hpRedBlink 0.9s ease-in-out infinite;
}

@keyframes hpRedBlink {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.45); }
}

/* 3. NHÂN VẬT TRAINER TRƯỢT VÀO NÉM BÓNG — POKÉMON DẪN ĐẦU LÙI SANG NHƯỜNG CHỖ */
.player-road-group {
    position: relative;
}

.lead-pokemon-unit {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lead-pokemon-unit.lead-step-aside {
    transform: translateX(42px) scale(0.94);
}

.stage-trainer-holder .game-trainer-img {
    width: 120px;
    height: 120px;
}

.stage-trainer-holder .game-trainer-ground-shadow {
    width: 74px;
    margin-top: -10px;
}

/* Ẩn HP / nhãn của đối thủ trong lúc bị hút vào bóng */
.enemy-stage-group .overhead-hp-pill,
.enemy-stage-group .enemy-bush-badge,
.enemy-stage-group .enemy-trainer-badge,
.enemy-stage-group .underfoot-lv-tag {
    transition: opacity 0.25s ease;
}

.enemy-stage-group.catch-in-progress .overhead-hp-pill,
.enemy-stage-group.catch-in-progress .enemy-bush-badge,
.enemy-stage-group.catch-in-progress .enemy-trainer-badge,
.enemy-stage-group.catch-in-progress .underfoot-lv-tag {
    opacity: 0;
}

/* 4. QUẢ BÓNG BAY / NẢY / LẮC (điều khiển bằng Web Animations trong playCatchSequence) */
.catch-rig {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    z-index: 22;
}

.catch-ball-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
    transform-origin: 50% 78%;
    opacity: 0;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
    will-change: transform;
}

.catch-ball-img.catch-ball-open {
    animation: catchBallOpenGlow 0.45s ease-out;
}

@keyframes catchBallOpenGlow {
    0%   { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55)); }
    40%  { filter: brightness(2) drop-shadow(0 0 10px #ffffff) drop-shadow(0 0 18px #ef4444); }
    100% { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55)); }
}

.catch-ball-shadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 34px;
    height: 9px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.catch-ball-shadow.show {
    opacity: 1;
}

.catch-flash {
    position: absolute;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 21;
}

.catch-flash-open {
    background: radial-gradient(circle, #ffffff 0%, #fecaca 34%, rgba(239, 68, 68, 0.55) 58%, transparent 72%);
    animation: catchFlashOpen 0.5s ease-out forwards;
}

.catch-flash-break {
    background: radial-gradient(circle, #ffffff 0%, #fef9c3 30%, rgba(250, 204, 21, 0.5) 56%, transparent 72%);
    box-shadow: 0 0 18px 6px rgba(255, 255, 255, 0.6);
    animation: catchFlashBreak 0.55s ease-out forwards;
}

@keyframes catchFlashOpen {
    0%   { transform: scale(0.3); opacity: 1; }
    60%  { transform: scale(5); opacity: 0.9; }
    100% { transform: scale(6.5); opacity: 0; }
}

@keyframes catchFlashBreak {
    0%   { transform: scale(0.4); opacity: 1; }
    50%  { transform: scale(6); opacity: 1; }
    100% { transform: scale(8.5); opacity: 0; }
}

/* Sao vàng "Click!" khi bắt thành công */
.catch-stars-burst {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 23;
}

.catch-star {
    position: absolute;
    left: -9px;
    top: -14px;
    font-size: 1.3rem;
    color: #fde047;
    text-shadow: 0 0 6px #f59e0b, 0 1px 2px #000;
    opacity: 0;
    animation: catchStarPop 1.1s ease-out forwards;
}

@keyframes catchStarPop {
    0%   { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 0; }
    20%  { opacity: 1; }
    60%  { transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(160deg); opacity: 1; }
    100% { transform: translate(var(--dx), calc(var(--dy) - 10px)) scale(0.9) rotate(220deg); opacity: 0; }
}

/* Bụi tung phía sau khi Pokémon bỏ chạy */
.flee-dust-trail {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 13;
}

.flee-dust-puff {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 16px;
    margin: -8px 0 0 -12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #f5f5f4 0%, #a8a29e 72%);
    opacity: 0;
    animation: fleeDustPuff 0.72s ease-out forwards;
    animation-delay: calc(var(--i) * 150ms);
}

@keyframes fleeDustPuff {
    0%   { transform: translate(calc(var(--i) * 54px), 0) scale(0.3); opacity: 0; }
    25%  { opacity: 0.85; }
    100% { transform: translate(calc(var(--i) * 54px - 28px), -16px) scale(1.6); opacity: 0; }
}

/* 5. KHUNG THÔNG BÁO TRẬN ĐẤU (GOTCHA / ÔI KHÔNG! / RUN AWAY) */
.battle-msg-frame {
    position: absolute;
    left: 50%;
    top: 86px;
    z-index: 30;
    min-width: 300px;
    max-width: 72%;
    padding: 10px 22px 12px;
    text-align: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.9), 0 14px 32px rgba(0, 0, 0, 0.6);
    color: #f8fafc;
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.92);
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.battle-msg-frame.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    pointer-events: auto;
    cursor: pointer;
}

.bmf-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    padding: 2px 12px;
    border-radius: 999px;
    margin-bottom: 5px;
    color: #0f172a;
    background: #e2e8f0;
}

.bmf-text {
    font-size: 1.08rem;
    font-weight: 700;
    text-shadow: 0 1px 2px #000;
}

.bmf-text strong {
    color: #fde047;
}

.bmf-sub {
    margin-top: 3px;
    font-size: 0.74rem;
    color: #94a3b8;
}

.battle-msg-frame.tone-catch { border-color: #4ade80; }
.battle-msg-frame.tone-catch .bmf-tag { background: #22c55e; color: #052e16; }

.battle-msg-frame.tone-escape { border-color: #fbbf24; }
.battle-msg-frame.tone-escape .bmf-tag { background: #f59e0b; color: #1f1300; }

.battle-msg-frame.tone-flee { border-color: #f87171; }
.battle-msg-frame.tone-flee .bmf-tag {
    background: #ef4444;
    color: #ffffff;
    animation: bmfTagPulse 0.8s ease-in-out infinite;
}

@keyframes bmfTagPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* 6. HIỆU ỨNG HUẤN LUYỆN: MŨI TÊN TĂNG CHỈ SỐ & BẢNG LÊN CẤP */
.sum-pokemon-figure {
    position: relative;
}

.train-fx-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.train-fx-stage-anchor {
    position: absolute;
    width: 130px;
    height: 130px;
    margin: -65px 0 0 -65px;
    z-index: 16;
    pointer-events: none;
}

.train-fx-arrow {
    position: absolute;
    bottom: 12%;
    left: calc(10% + var(--i) * 17%);
    font-size: 1.05rem;
    color: #38bdf8;
    text-shadow: 0 0 8px #0ea5e9, 0 1px 2px #000;
    opacity: 0;
    animation: trainArrowRise 1.1s ease-out forwards;
    animation-delay: calc(var(--i) * 90ms);
}

.train-fx-layer.lvl .train-fx-arrow {
    color: #fde047;
    text-shadow: 0 0 8px #f59e0b, 0 1px 2px #000;
}

@keyframes trainArrowRise {
    0%   { transform: translateY(10px) scale(0.6); opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateY(-74px) scale(1.1); opacity: 0; }
}

.train-fx-label {
    position: absolute;
    left: 50%;
    top: 0;
    white-space: nowrap;
    font-weight: 900;
    font-size: 0.82rem;
    color: #ffffff;
    background: rgba(14, 165, 233, 0.94);
    padding: 2px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    animation: trainLabelPop 1.4s ease-out forwards;
}

.train-fx-layer.lvl .train-fx-label {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #1f1300;
}

@keyframes trainLabelPop {
    0%   { transform: translate(-50%, 8px) scale(0.6); opacity: 0; }
    18%  { transform: translate(-50%, 0) scale(1.08); opacity: 1; }
    75%  { opacity: 1; }
    100% { transform: translate(-50%, -14px); opacity: 0; }
}

.sum-stat-row.stat-row-boost {
    animation: statRowBoost 1.1s ease-out;
    border-radius: 4px;
}

@keyframes statRowBoost {
    0%   { background: rgba(56, 189, 248, 0.5); box-shadow: 0 0 10px rgba(56, 189, 248, 0.5); }
    100% { background: transparent; box-shadow: none; }
}

.lead-train-glow {
    animation: leadTrainGlow 1s ease-out;
}

@keyframes leadTrainGlow {
    0%, 100% { filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.45)); }
    40% { filter: brightness(1.5) drop-shadow(0 0 16px #38bdf8); }
}

/* Bảng "Lên cấp!" nền trắng viền đậm như cửa sổ chỉ số trong game */
.levelup-stat-panel {
    position: absolute;
    top: 214px;
    right: 6px;
    width: 172px;
    z-index: 6;
    background: #f8fafc;
    color: #0f172a;
    border: 3px solid #334155;
    border-radius: 8px;
    box-shadow: 0 0 0 2px #f8fafc, 0 10px 24px rgba(0, 0, 0, 0.55);
    padding: 6px 10px;
    cursor: pointer;
    animation: lvpIn 0.25s ease-out;
}

@keyframes lvpIn {
    from { transform: translateY(-6px) scale(0.95); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.lvp-title {
    font-weight: 900;
    font-size: 0.84rem;
    color: #b45309;
    margin-bottom: 3px;
}

.lvp-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 1px 0;
    border-bottom: 1px dashed #cbd5e1;
}

.lvp-row:last-child {
    border-bottom: none;
}

.lvp-gain {
    color: #94a3b8;
}

.lvp-gain.up {
    color: #16a34a;
}

.lvp-val {
    min-width: 32px;
    text-align: right;
}

/* 7. BẢNG INFO: MOVES BẤM ĐƯỢC, ABILITY THU GỌN, NƠI BẮT */
.sum-banner-hint {
    font-size: 0.66rem;
    font-weight: 600;
    color: #94a3b8;
    margin-left: 6px;
}

.sum-move-card.sum-move-clickable {
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.sum-move-card.sum-move-clickable:hover {
    border-color: #60a5fa;
    background: #2a2638;
    transform: translateX(2px);
}

.sum-move-pp {
    white-space: nowrap;
}

.sum-move-edit-hint {
    color: #60a5fa;
    font-weight: 900;
    font-size: 0.85rem;
}

.sum-ability-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: #2a2735;
    border: 1px solid #423d57;
    border-radius: 6px;
    padding: 5px 8px;
    color: #f8fafc;
    font: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
}

.sum-ability-toggle:hover {
    border-color: #fde047;
}

.sum-ability-caret {
    margin-left: auto;
    color: #94a3b8;
    transition: transform 0.2s;
}

.sum-ability-block.open .sum-ability-caret {
    transform: rotate(180deg);
}

.sum-ability-details {
    display: none;
    padding: 6px 2px 0;
}

.sum-ability-block.open .sum-ability-details {
    display: block;
    animation: abilityDetailsIn 0.2s ease-out;
}

@keyframes abilityDetailsIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.sum-met-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
}

.sum-met-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.35;
}

.sum-met-ico {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
}

.sum-met-ico img {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    vertical-align: middle;
}

/* 8. TRANG POKÉDEX CỦA LOÀI ĐÃ GẶP / ĐÃ ĐĂNG KÝ */
.dex-status-chip {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 999px;
    align-self: center;
}

.dex-status-chip.seen {
    background: #1e3a5f;
    color: #7dd3fc;
    border: 1px solid #38bdf8;
}

.dex-status-chip.registered {
    background: #14532d;
    color: #86efac;
    border: 1px solid #22c55e;
}

.dex-entry-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 16px;
    padding: 14px;
    background: #23212c;
}

@media (max-width: 680px) {
    .dex-entry-grid {
        grid-template-columns: 1fr;
    }
}

.dex-entry-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 10px;
    background: radial-gradient(ellipse at 50% 40%, #2f3b55 0%, #1b1922 72%);
    border: 1px solid #353242;
}

.dex-artwork {
    width: 170px;
    height: 170px;
}

.dex-entry-note {
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
}

.dex-ability-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 4px 4px;
}

.dex-habitat-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 4px 4px;
    max-height: 132px;
    overflow-y: auto;
}

.dex-habitat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
    font-size: 0.76rem;
    padding: 3px 7px;
    background: #1b1922;
    border-radius: 4px;
}

.dex-habitat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dex-habitat-lv {
    color: #fde047;
    font-weight: 700;
}

.dex-habitat-rate {
    color: #4ade80;
    font-weight: 800;
    min-width: 34px;
    text-align: right;
}

.dex-habitat-empty {
    font-size: 0.76rem;
    color: #94a3b8;
    padding: 2px 6px;
}

.dex-move-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 4px;
}

.dex-move-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1b1922;
    border: 1px solid #36324a;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
}

.dex-move-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dex-move-chip b {
    color: #94a3b8;
    font-weight: 700;
}

/* 9. POKÉDEX: QUẢ CẦU CHO LOÀI ĐANG CÓ • ĐÃ GẶP • BÓNG ĐEN CHO LOÀI CHƯA GẶP */
.dex-silhouette {
    filter: brightness(0) drop-shadow(0 0 1px rgba(148, 163, 184, 0.7)) !important;
    opacity: 0.75;
}

.pc-slot-card.dex-seen .pc-slot-lvl {
    color: #7dd3fc;
}

.pc-slot-card.dex-unseen {
    opacity: 0.6;
}

.pc-slot-card.dex-unseen .pc-poke-name {
    color: #64748b;
    letter-spacing: 2px;
}

.pc-slot-icon-box img.pc-dex-ball {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.pc-slot-icon-box img.pc-dex-ball.dim {
    filter: grayscale(1) opacity(0.6);
}

.pc-dex-progress {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.74rem;
    color: #cbd5e1;
    background: #1d1f23;
    border: 1px solid #121417;
    border-radius: 6px;
    padding: 6px 8px;
}

.pc-dex-progress img {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    image-rendering: pixelated;
}

.rc-spawn-tile img.rc-spawn-ball {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.rc-spawn-tile.unseen {
    border-color: #273244;
    background: #141a22;
}

.evo-chain-ball {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.evo-chain-node.unseen-node .evo-chain-name {
    color: #64748b;
    letter-spacing: 1px;
}

/* 10. BẢNG CHIÊU THỨC (MOVE PICKER) */
.move-picker-backdrop {
    z-index: 130;
}

.move-picker-window {
    width: 100%;
    max-width: 780px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #23212c;
    border: 2px solid #4a4759;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85);
    color: #e2e8f0;
    overflow: hidden;
}

.mp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #4b4954 0%, #34323c 100%);
    border-bottom: 2px solid #19181f;
}

.mp-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mp-title img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.mp-title-main {
    font-weight: 800;
    font-size: 1.05rem;
    text-shadow: 0 1px 2px #000;
}

.mp-title-main span {
    color: #94a3b8;
    font-size: 0.85rem;
}

.mp-title-sub {
    font-size: 0.76rem;
    color: #cbd5e1;
}

.mp-slot-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px;
    background: #1b1922;
    border-bottom: 1px solid #353242;
}

.mp-slot-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    background: #2a2735;
    border: 1px solid #423d57;
    color: #cbd5e1;
    border-radius: 6px;
    padding: 5px 7px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-slot-tab i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mp-slot-tab.active {
    border-color: #fde047;
    background: #3a3420;
    color: #ffffff;
}

.mp-slot-num {
    background: #14131a;
    border-radius: 3px;
    padding: 0 5px;
    color: #fde047;
    flex-shrink: 0;
}

.mp-table {
    overflow-y: auto;
    padding: 6px 10px 8px;
}

.mp-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 44px 50px 36px 220px;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin-bottom: 3px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: #1b1922;
}

.mp-row.mp-head {
    position: sticky;
    top: -6px;
    z-index: 1;
    background: #23212c;
    font-size: 0.66rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mp-row.mp-learnable {
    cursor: pointer;
}

.mp-row.mp-learnable:hover {
    border-color: #60a5fa;
    background: #222034;
}

.mp-row.mp-current {
    border-color: #fde047;
    background: #2c2818;
}

.mp-row.mp-locked .mp-col-name,
.mp-row.mp-locked .mp-col-num,
.mp-row.mp-locked .mp-col-cat {
    opacity: 0.6;
}

.mp-col-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mp-col-name > div {
    min-width: 0;
}

.mp-type-pill {
    width: 62px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 900;
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    text-shadow: 0 1px 1px #000;
}

.mp-move-name {
    font-weight: 800;
    font-size: 0.86rem;
}

.mp-move-desc {
    font-size: 0.68rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-prio {
    font-size: 0.62rem;
    color: #38bdf8;
}

.mp-col-num,
.mp-col-cat {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.mp-col-state {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.mp-state {
    font-size: 0.7rem;
    font-weight: 800;
}

.mp-state.current { color: #fde047; }
.mp-state.equipped { color: #93c5fd; }
.mp-state.free { color: #4ade80; }
.mp-state.special { color: #f87171; }
.mp-state.cd {
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.mp-cd-track {
    display: inline-block;
    width: 46px;
    height: 5px;
    background: #14131a;
    border-radius: 3px;
    overflow: hidden;
}

.mp-cd-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fde047);
}

.mp-btn {
    border: 1px solid;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.mp-btn:hover {
    filter: brightness(1.12);
}

.mp-btn.learn {
    background: #1d4ed8;
    border-color: #60a5fa;
    color: #ffffff;
}

.mp-btn.cd {
    background: #3b2f12;
    border-color: #f59e0b;
    color: #fde68a;
}

.mp-btn.gold {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    border-color: #fde047;
    color: #1f1300;
}

.mp-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 7px 12px;
    font-size: 0.7rem;
    color: #94a3b8;
    border-top: 1px solid #353242;
    background: #1b1922;
}

.mp-legend b.free { color: #4ade80; }
.mp-legend b.cd { color: #fbbf24; }
.mp-legend b.special { color: #f87171; }

@media (max-width: 640px) {
    .mp-slot-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .mp-row {
        grid-template-columns: minmax(0, 1fr) 34px 40px;
    }
    .mp-row > .mp-col-num:nth-child(4),
    .mp-row > .mp-col-num:nth-child(5) {
        display: none;
    }
    .mp-col-state {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}


/* ============================================================================
   PHIÊN 5 — HOẠT ẢNH TRAINER KIỂU RED/BLUE (GẶP MẶT "!", VS, NÉM BÓNG, LÙI VỀ,
   THU BÓNG KHI GỤC NGÃ), HOẠT ẢNH CHIÊU THỨC KIỂU SHOWDOWN, POKÉDEX MỚI
   ============================================================================ */

/* 1. POKÉMON ĐANG NẰM TRONG BÓNG (CHƯA THẢ RA SÂN) / ĐÃ BỊ THU VỀ BÓNG */
.lead-pokemon-unit.in-ball #stage-lead-sprite,
.lead-pokemon-unit.in-ball .overhead-hp-pill,
.lead-pokemon-unit.in-ball .underfoot-lv-tag,
.lead-pokemon-unit.unit-fainted .overhead-hp-pill,
.lead-pokemon-unit.unit-fainted .underfoot-lv-tag {
    opacity: 0;
}

.lead-pokemon-unit .overhead-hp-pill,
.lead-pokemon-unit .underfoot-lv-tag,
.enemy-stage-group .enemy-pokemon-unit > :not(img) {
    transition: opacity 0.25s ease;
}

.enemy-stage-group.enemy-in-ball .enemy-pokemon-unit > *,
.enemy-pokemon-unit.unit-fainted > :not(img) {
    opacity: 0;
}

.seq-fainted {
    opacity: 0 !important;
}

/* 2. TRAINER ĐỐI THỦ: TO HƠN, LÙI VỀ SAU KHI NÉM BÓNG, BƯỚC LÊN KHI THUA */
.enemy-trainer-figure {
    transition: translate 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.enemy-trainer-figure img {
    width: 120px;
    height: 120px;
}

.enemy-trainer-figure.gym-leader-figure img {
    width: 132px;
    height: 132px;
}

.enemy-trainer-figure .trainer-figure-shadow {
    width: 70px;
    margin-top: -10px;
}

.enemy-trainer-figure.trainer-retreated {
    translate: 190px 0;
    opacity: 0;
}

.enemy-trainer-figure.trainer-step-forward {
    translate: -42px 0;
}

/* Dấu "!" khi Trainer dọc đường phát hiện bạn */
.trainer-exclaim {
    position: absolute;
    left: 50%;
    top: -14px;
    width: 30px;
    height: 34px;
    margin-left: -15px;
    background: #ffffff;
    border: 3px solid #0f172a;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 900 1.45rem/1 'Tiny5', 'Arial Black', sans-serif;
    color: #ef4444;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
    z-index: 6;
}

.trainer-exclaim::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -10px;
    margin-left: -7px;
    border: 7px solid transparent;
    border-top-color: #0f172a;
    border-bottom: 0;
}

/* Bong bóng lời thoại của Trainer */
.trainer-speech-bubble {
    position: absolute;
    z-index: 37;
    max-width: 270px;
    padding: 9px 14px;
    background: #ffffff;
    color: #0f172a;
    border: 3px solid #0f172a;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(6px) scale(0.92);
    transform-origin: 85% 100%;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.trainer-speech-bubble.show {
    opacity: 1;
    transform: none;
}

.trainer-speech-bubble::after {
    content: '';
    position: absolute;
    right: 24px;
    bottom: -13px;
    border: 10px solid transparent;
    border-top-color: #0f172a;
    border-bottom: 0;
}

.trainer-speech-bubble::before {
    content: '';
    position: absolute;
    right: 27px;
    bottom: -7px;
    border: 7px solid transparent;
    border-top-color: #ffffff;
    border-bottom: 0;
    z-index: 1;
}

/* Dãy bóng đội hình đối thủ cạnh tên Trainer (bóng xám = đã gục) */
.enemy-trainer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.enemy-party-tray {
    display: inline-flex;
    gap: 1px;
    margin-left: 2px;
}

.ept-ball {
    width: 13px;
    height: 13px;
    image-rendering: pixelated;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.ept-ball.fainted {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.55;
}

.ept-ball.active {
    transform: scale(1.2);
    filter: drop-shadow(0 0 3px #facc15);
}

/* Biểu tượng Trainer trên thanh 20 bước */
.node-icon-trainer {
    display: block;
    position: relative;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, #7f1d1d, #3b0a0a);
    border: 1.5px solid #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.node-icon-trainer img {
    position: absolute;
    width: 46px;
    height: 46px;
    left: 50%;
    top: -4px;
    margin-left: -23px;
    image-rendering: pixelated;
}

/* 3. NÉM BÓNG / BÓNG MỞ / TIA ĐỎ THU BÓNG */
.seq-ball {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 22;
    image-rendering: pixelated;
    pointer-events: none;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.45));
}

.catch-flash-send {
    background: radial-gradient(circle, #ffffff 0%, #e0f2fe 32%, rgba(56, 189, 248, 0.55) 58%, transparent 72%);
    animation: catchFlashOpen 0.5s ease-out forwards;
}

.catch-flash-send-enemy {
    background: radial-gradient(circle, #ffffff 0%, #ffedd5 32%, rgba(251, 146, 60, 0.55) 58%, transparent 72%);
    animation: catchFlashOpen 0.5s ease-out forwards;
}

.sendout-sparkle-burst {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 22;
    pointer-events: none;
}

.sendout-sparkle-burst span {
    position: absolute;
    left: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    background: #ffffff;
    box-shadow: 0 0 8px #7dd3fc;
    animation: sendoutSpark 0.55s ease-out forwards;
}

.sendout-sparkle-burst.tone-enemy span {
    box-shadow: 0 0 8px #fb923c;
}

@keyframes sendoutSpark {
    0%   { transform: rotate(var(--a)) translateY(-6px) rotate(45deg) scale(1); opacity: 1; }
    100% { transform: rotate(var(--a)) translateY(-52px) rotate(45deg) scale(0.3); opacity: 0; }
}

.seq-recall-beam {
    position: absolute;
    height: 6px;
    margin-top: -3px;
    transform-origin: 0 50%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffffff, #ef4444 25%, #f43f5e 75%, #ffffff);
    box-shadow: 0 0 12px #ef4444, 0 0 22px rgba(244, 63, 94, 0.7);
    z-index: 21;
    pointer-events: none;
}

/* 4. CHUYỂN CẢNH VÀO TRẬN (CHỚP TRẮNG + THANH ĐEN QUÉT NGANG) */
.battle-wipe {
    position: absolute;
    inset: 0;
    z-index: 34;
    pointer-events: none;
    overflow: hidden;
}

.bw-bar {
    position: absolute;
    left: 0;
    width: 100%;
    background: #05070d;
    transform: scaleX(0);
}

.wipe-gym .bw-bar {
    background: linear-gradient(90deg, #0b1220, #1e293b);
    box-shadow: inset 0 -2px 0 rgba(250, 204, 21, 0.55);
}

.wipe-boss .bw-bar {
    background: linear-gradient(90deg, #12051f, #3b0764);
    box-shadow: inset 0 -2px 0 rgba(192, 132, 252, 0.55);
}

.bw-flash {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    z-index: 2;
}

/* 5. MÀN GẶP MẶT VS (KHUNG CHÂN DUNG 2 TRAINER + CHỮ VS) */
.vs-intro {
    position: absolute;
    inset: 0 0 86px 0;
    z-index: 33;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(2, 6, 23, 0) 30%, rgba(2, 6, 23, 0.55) 100%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.35), rgba(2, 6, 23, 0) 60%);
    font-family: 'Tiny5', 'Segoe UI', sans-serif;
}

.vs-card {
    position: absolute;
    top: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 150px;
}

.vs-left {
    left: 86px;
}

.vs-right {
    right: 26px;
}

.vs-portrait {
    position: relative;
    width: 128px;
    height: 118px;
    border-radius: 16px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 46%, rgba(148, 163, 184, 0.12) 0 34%, transparent 35% 38%, rgba(148, 163, 184, 0.1) 39% 40%, transparent 41%),
        linear-gradient(180deg, rgba(51, 65, 85, 0.92), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.85), 0 10px 22px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.vs-portrait img {
    position: absolute;
    width: 330px;
    height: 330px;
    left: 50%;
    top: -46px;
    margin-left: -165px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.vs-right .vs-portrait img {
    transform: scaleX(-1);
}

.tone-gym .vs-right .vs-portrait {
    border-color: rgba(250, 204, 21, 0.75);
    box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.85), 0 0 22px rgba(250, 204, 21, 0.35), 0 10px 22px rgba(0, 0, 0, 0.55);
}

.vs-name {
    max-width: 170px;
    font-size: 1.12rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    text-shadow: 2px 0 0 #0f172a, -2px 0 0 #0f172a, 0 2px 0 #0f172a, 0 -2px 0 #0f172a, 2px 2px 0 #0f172a, -2px 2px 0 #0f172a;
}

.vs-sub {
    margin-top: -3px;
    font-size: 0.78rem;
    color: #fde68a;
    white-space: nowrap;
    text-shadow: 1px 1px 0 #0f172a, -1px -1px 0 #0f172a, 1px -1px 0 #0f172a, -1px 1px 0 #0f172a;
}

.vs-tray {
    display: flex;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.vs-tray-slot {
    width: 14px;
    height: 14px;
    image-rendering: pixelated;
}

.vs-tray-slot.empty {
    display: inline-block;
    border-radius: 50%;
    border: 1.5px dashed rgba(148, 163, 184, 0.45);
    box-sizing: border-box;
}

.vs-tray-slot.fainted {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.6;
}

.vs-mid {
    position: absolute;
    left: 50%;
    top: 44%;
    translate: -50% -50%;
}

.vs-text {
    display: inline-block;
    font-family: 'Tiny5', 'Arial Black', sans-serif;
    font-size: 4.4rem;
    line-height: 1;
    color: #fde047;
    background: linear-gradient(180deg, #fef08a 0%, #facc15 45%, #f97316 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(3px 0 0 #b91c1c) drop-shadow(-3px 0 0 #b91c1c) drop-shadow(0 3px 0 #7f1d1d) drop-shadow(0 -2px 0 #b91c1c) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55));
}

.vs-sparks i {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--c, #ffffff);
    box-shadow: 0 0 6px var(--c, #ffffff);
    opacity: 0;
    animation: vsSparkFloat 1.4s ease-in-out infinite;
}

@keyframes vsSparkFloat {
    0%   { opacity: 0; transform: translateY(8px); }
    40%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-26px); }
}

.stage-vs-shake {
    animation: stageShakeSmall 0.3s ease-in-out;
}

.stage-boss-quake {
    animation: stageShakeBig 0.7s ease-in-out;
}

.stage-hit-shake {
    animation: stageShakeSmall 0.26s ease-in-out;
}

.stage-quake-strong {
    animation: stageShakeBig 0.5s ease-in-out;
}

@keyframes stageShakeSmall {
    0%, 100% { translate: 0 0; }
    25% { translate: -4px 1px; }
    50% { translate: 4px -1px; }
    75% { translate: -2px 1px; }
}

@keyframes stageShakeBig {
    0%, 100% { translate: 0 0; }
    12% { translate: -7px 2px; }
    25% { translate: 6px -3px; }
    38% { translate: -5px 3px; }
    52% { translate: 5px -2px; }
    66% { translate: -3px 2px; }
    80% { translate: 2px -1px; }
}

/* Khung thông báo: thách đấu / Gym / chiến thắng / huy hiệu / huyền thoại */
.battle-msg-frame.tone-victory { border-color: #facc15; }
.battle-msg-frame.tone-victory .bmf-tag { background: linear-gradient(90deg, #f59e0b, #facc15); color: #1f1300; }

.battle-msg-frame.tone-badge {
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.9), 0 0 26px rgba(250, 204, 21, 0.45), 0 14px 32px rgba(0, 0, 0, 0.6);
}
.battle-msg-frame.tone-badge .bmf-tag {
    background: linear-gradient(90deg, #facc15, #fde68a, #facc15);
    color: #1f1300;
    animation: bmfTagPulse 0.8s ease-in-out infinite;
}

.battle-msg-frame.tone-legend { border-color: #c084fc; }
.battle-msg-frame.tone-legend .bmf-tag { background: #7c3aed; color: #ffffff; }

/* 6. HOẠT ẢNH CHIÊU THỨC KIỂU SHOWDOWN */
.mv-fx {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 16;
    object-fit: contain;
}

.mv-bolt {
    object-fit: fill;
    transform-origin: 50% 0;
    filter: drop-shadow(0 0 10px #fde047);
}

.mv-ring {
    position: absolute;
    left: 0;
    top: 0;
    border: 4px solid #f0abfc;
    border-radius: 50%;
    pointer-events: none;
    z-index: 16;
}

.mv-beam-core {
    position: absolute;
    height: 10px;
    margin-top: -5px;
    transform-origin: 0 50%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), var(--core, #fde68a) 30%, var(--core, #fde68a) 80%, rgba(255, 255, 255, 0.9));
    box-shadow: 0 0 14px var(--core, #fde68a), 0 0 30px var(--core, #fde68a);
    pointer-events: none;
    z-index: 15;
}

.mv-flash {
    position: absolute;
    inset: 0;
    background: #fffbe6;
    pointer-events: none;
    z-index: 15;
}

.mv-banner {
    position: absolute;
    z-index: 18;
    transform: translate(-50%, -100%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px 3px 4px;
    border-radius: 999px;
    border: 2px solid var(--mv-color, #facc15);
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 900;
    white-space: nowrap;
    text-shadow: 0 1px 2px #000;
    box-shadow: 0 0 12px color-mix(in srgb, var(--mv-color, #facc15) 50%, transparent);
    pointer-events: none;
    animation: mvBannerPop 0.85s ease-out forwards;
}

.mv-banner-type {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.62rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #0f172a;
    text-shadow: none;
}

@keyframes mvBannerPop {
    0%   { opacity: 0; transform: translate(-50%, -85%) scale(0.85); }
    15%  { opacity: 1; transform: translate(-50%, -100%) scale(1.04); }
    25%  { transform: translate(-50%, -100%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -112%); }
}

.mv-eff-tag {
    position: absolute;
    z-index: 19;
    transform: translate(-50%, -100%);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 900;
    white-space: nowrap;
    pointer-events: none;
    animation: mvEffPop 0.95s ease-out forwards;
}

.mv-eff-tag.crit { background: #f59e0b; color: #1f1300; }
.mv-eff-tag.super { background: #dc2626; color: #ffffff; }
.mv-eff-tag.weak { background: rgba(71, 85, 105, 0.95); color: #e2e8f0; }

@keyframes mvEffPop {
    0%   { opacity: 0; transform: translate(-50%, -60%) scale(0.7); }
    18%  { opacity: 1; transform: translate(-50%, -100%) scale(1.12); }
    30%  { transform: translate(-50%, -100%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -150%); }
}

.floating-dmg.enemy-atk-dmg {
    color: #fb7185;
}

.floating-dmg.crit-dmg {
    font-size: 1.6rem;
    color: #fb923c;
}

.overhead-hp-fill {
    transition: width 0.4s ease;
}


/* 7. TRANG TỪ ĐIỂN POKÉDEX (BỐ CỤC THEO ẢNH MẪU) */
.dex-page-backdrop {
    padding: 14px;
}

.dex-page {
    width: min(1580px, 97vw);
    height: 94vh;
    overflow-y: auto;
    border-radius: 14px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.035) 1px, transparent 0) 0 0 / 14px 14px,
        #151925;
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    font-family: 'Tiny5', 'Segoe UI', sans-serif;
    color: #e5e7eb;
    scrollbar-width: thin;
    scrollbar-color: #7f1d1d #151925;
}

.dex-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    background:
        radial-gradient(circle at 92% 50%, rgba(255, 255, 255, 0.06) 0 22px, transparent 23px),
        linear-gradient(90deg, #b91c1c 0%, #9f1239 55%, #7f1d1d 100%);
    border-bottom: 2px solid #450a0a;
    border-radius: 12px 12px 0 0;
}

.dex-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.7rem;
    color: #ffffff;
    text-shadow: 2px 2px 0 #450a0a;
}

.dex-book {
    font-size: 1.4rem;
    filter: drop-shadow(2px 2px 0 #450a0a);
}

.dex-help {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.85rem;
    text-shadow: none;
    border: 2px solid rgba(255, 255, 255, 0.35);
    cursor: help;
}

.dex-head-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
    color: #fee2e2;
    text-shadow: 1px 1px 0 #450a0a;
    flex-wrap: wrap;
}

.dex-head-stats b {
    color: #ffffff;
    font-weight: 400;
}

.dex-head-shiny i,
.drh-chip.shiny i,
.dex-shiny-toggle i {
    font-style: normal;
    color: #facc15;
    text-shadow: 0 0 6px rgba(250, 204, 21, 0.7);
}

.dex-rank-btn {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 7px;
    border: 2px solid #78350f;
    background: linear-gradient(180deg, #fde047 0%, #facc15 55%, #f59e0b 100%);
    color: #1f1300;
    box-shadow: 0 3px 0 #78350f;
    cursor: pointer;
    text-shadow: none;
}

.dex-rank-btn:hover {
    filter: brightness(1.08);
}

.dex-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
}

/* Khối tổng quan: vòng % + thanh từng vùng + bắt gần đây */
.dex-summary {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 18px 22px 16px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0) 0 0 / 12px 12px,
        linear-gradient(180deg, #2a1420 0%, #1d1520 100%);
    border-bottom: 2px solid rgba(239, 68, 68, 0.55);
}

.dex-ring {
    flex: 0 0 auto;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: conic-gradient(from 270deg, #f59e0b 0deg, #ef4444 var(--deg, 0deg), #2b3142 var(--deg, 0deg) 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px #1a1220, 0 0 18px rgba(239, 68, 68, 0.25);
}

.dex-ring-inner {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #1b2130;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.dex-ring-inner b {
    font-weight: 400;
    font-size: 1.45rem;
    color: #ffffff;
}

.dex-ring-inner small {
    font-size: 0.72rem;
    color: #9ca3af;
}

.dex-summary-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dex-region-rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.dex-region-row {
    display: grid;
    grid-template-columns: 82px 1fr 72px;
    align-items: center;
    gap: 14px;
    font-size: 0.95rem;
}

.dex-region-row .drr-name {
    color: #f3f4f6;
}

.dex-region-row.locked .drr-name {
    color: #6b7280;
}

.drr-bar {
    height: 6px;
    border-radius: 999px;
    background: #2b3142;
    overflow: hidden;
}

.drr-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.drr-count {
    text-align: right;
    font-size: 0.82rem;
    color: #d1d5db;
}

.drr-lock {
    filter: grayscale(0.2);
    cursor: help;
}

.dex-recent {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dex-recent-label {
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: #cbd5e1;
    white-space: nowrap;
}

.dex-recent-list {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.dex-recent-sprite {
    height: 44px;
    max-width: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.dex-recent-sprite:hover {
    transform: translateY(-3px) scale(1.1);
}

.dex-recent-empty {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Thanh tìm kiếm & bộ lọc */
.dex-filters {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(21, 25, 37, 0.96);
    backdrop-filter: blur(4px);
}

.dex-search {
    flex: 1 1 auto;
    min-width: 160px;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1.5px solid #2c3446;
    background: #1c2130;
    color: #e5e7eb;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}

.dex-search::placeholder {
    color: #6b7280;
}

.dex-search:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.dex-select-wrap {
    position: relative;
    flex: 0 0 auto;
}

.dex-select-wrap::after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    color: #ffffff;
    pointer-events: none;
}

.dex-select,
.dex-shiny-toggle {
    height: 40px;
    padding: 0 30px 0 14px;
    border-radius: 7px;
    border: 1.5px solid #343c52;
    background: linear-gradient(180deg, #2a3042 0%, #222737 100%);
    box-shadow: 0 3px 0 #10131c;
    color: #f3f4f6;
    font-family: inherit;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.dex-select option {
    text-transform: none;
    background: #1c2130;
    color: #e5e7eb;
}

.dex-shiny-toggle {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dex-shiny-toggle.on {
    border-color: #facc15;
    background: linear-gradient(180deg, #4a3a10 0%, #2f250a 100%);
    box-shadow: 0 3px 0 #10131c, 0 0 12px rgba(250, 204, 21, 0.35);
}

/* Khối từng vùng đất */
.dex-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 2px 16px 22px;
}

.dex-region {
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid rgba(239, 68, 68, 0.45);
    background: rgba(17, 20, 31, 0.6);
}

.dex-region.locked {
    opacity: 0.7;
}

.dex-region-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(90deg, #b91c1c 0%, #9f1239 60%, #881337 100%);
    cursor: pointer;
    user-select: none;
}

.dex-region.locked .dex-region-head {
    background: linear-gradient(90deg, #3f1d24 0%, #2d1a22 100%);
}

.drh-name {
    font-size: 1.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 0 #450a0a;
}

.drh-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    white-space: nowrap;
}

.drh-chip.shiny {
    background: rgba(15, 23, 42, 0.75);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.drh-chip.info {
    background: rgba(124, 45, 18, 0.5);
    color: #fed7aa;
    border: 1px solid #fb923c;
}

.drh-chip.lock {
    background: rgba(15, 23, 42, 0.6);
    color: #fde68a;
    border: 1px solid rgba(250, 204, 21, 0.4);
}

.drh-spacer {
    flex: 1 1 auto;
}

.drh-count {
    font-size: 0.95rem;
    color: #ffffff;
    text-shadow: 1px 1px 0 #450a0a;
    white-space: nowrap;
}

.drh-bar {
    width: 160px;
    height: 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    overflow: hidden;
}

.drh-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f87171, #ef4444);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.8);
}

.drh-caret {
    font-size: 0.8rem;
    color: #fecaca;
    transition: transform 0.2s ease;
}

.drh-caret.closed {
    transform: rotate(-90deg);
}

.dex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 12px;
    padding: 14px;
}

.dex-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px 10px;
    border-radius: 11px;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 2px, transparent 2px 4px),
        linear-gradient(180deg, #232839 0%, #1c2030 100%);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dex-card:hover {
    transform: translateY(-3px);
    border-color: rgba(248, 113, 113, 0.85);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35), 0 8px 18px rgba(0, 0, 0, 0.45);
}

.dex-card.unseen {
    cursor: not-allowed;
    border-color: rgba(100, 116, 139, 0.28);
}

.dc-ball {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 15px;
    height: 15px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.6));
}

.dc-ball.grey {
    filter: grayscale(1) brightness(0.55);
    opacity: 0.85;
}

.dc-shiny {
    position: absolute;
    top: 5px;
    left: 8px;
    font-size: 0.85rem;
    color: #facc15;
    text-shadow: 0 0 6px rgba(250, 204, 21, 0.8);
}

.dc-sprite-wrap {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dc-sprite {
    width: 84px;
    height: 84px;
    object-fit: contain;
    image-rendering: pixelated;
}

.dc-sprite.silhouette {
    filter: brightness(0);
    opacity: 0.42;
}

.dex-card.unseen .dc-sprite.silhouette {
    opacity: 0.22;
}

.dc-no {
    margin-top: 6px;
    font-size: 0.72rem;
    color: #9ca3af;
}

.dc-name {
    margin-top: 2px;
    max-width: 100%;
    font-size: 0.9rem;
    color: #f3f4f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 0 #0b0e16;
}

.dex-card.unseen .dc-name {
    color: #6b7280;
}

.dex-empty {
    padding: 22px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .dex-head { flex-direction: column; align-items: flex-start; }
    .dex-summary { flex-direction: column; align-items: flex-start; }
    .dex-filters { flex-wrap: wrap; }
    .dex-search { flex-basis: 100%; }
    .drh-bar { display: none; }
    .dex-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

/* ============================================================================
   PHIÊN 6 — THẾ GIỚI KANTO THEO RED/BLUE: LỘ TRÌNH VÙNG ĐẤT, BẢNG TÊN ĐỊA DANH,
   CẢNH SÂN THEO VÙNG, TRAINER TO & NÉT HƠN (PHÓNG ĐÚNG 2 LẦN ẢNH 80×80)
   ============================================================================ */

/* 1. Trainer phóng đúng bội số nguyên (80px -> 160px) để điểm ảnh sắc nét */
.stage-trainer-holder {
    left: -128px;
    width: 160px;
    height: 190px;
}

.stage-trainer-holder .game-trainer-img {
    width: 160px;
    height: 160px;
    image-rendering: pixelated;
}

.stage-trainer-holder .game-trainer-ground-shadow {
    width: 92px;
    margin-top: -18px;
}

.enemy-trainer-figure img,
.enemy-trainer-figure.gym-leader-figure img {
    width: 160px;
    height: 160px;
    image-rendering: pixelated;
}

.enemy-trainer-figure .trainer-figure-shadow {
    width: 92px;
    margin-top: -18px;
}

.vs-portrait img {
    width: 320px;
    height: 320px;
    top: -44px;
    margin-left: -160px;
}

/* 2. Thanh lộ trình theo vùng đất */
.route-nodes-track {
    justify-content: safe center;
}

.route-node-item {
    width: var(--node-w, 30px);
    flex: 0 0 auto;
}

.route-node-item.in-current-area {
    background: rgba(250, 204, 21, 0.09);
    border-radius: 6px;
}

.route-leg-sep {
    flex: 0 0 auto;
    width: 2px;
    height: 20px;
    margin: 0 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, transparent, rgba(148, 163, 184, 0.55), transparent);
}

.route-bar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    max-width: 210px;
}

.rbt-chapter {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rbt-area {
    font-size: 0.92rem;
    color: #e2e8f0;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-route-area {
    display: block;
    margin-top: 1px;
    font-size: 0.72rem;
    color: #fde68a;
    font-weight: 700;
}

/* 3. Bảng tên địa danh khi bước vào vùng đất mới */
.area-name-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 28;
    min-width: 230px;
    padding: 8px 24px 9px;
    text-align: center;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: #0f172a;
    border: 3px solid #334155;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.8), 0 10px 24px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -150%);
    animation: anbIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
}

.area-name-banner.hide {
    animation: anbOut 0.45s ease-in forwards;
}

.anb-name {
    font-family: 'Tiny5', 'Segoe UI', sans-serif;
    font-size: 1.4rem;
    line-height: 1.1;
}

.anb-sub {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
}

.area-name-banner.kind-route { border-color: #15803d; }
.area-name-banner.kind-forest { border-color: #166534; background: linear-gradient(180deg, #f0fdf4, #dcfce7); }
.area-name-banner.kind-cave { border-color: #57534e; background: linear-gradient(180deg, #f5f5f4, #e7e5e4); }
.area-name-banner.kind-sea { border-color: #0369a1; background: linear-gradient(180deg, #f0f9ff, #e0f2fe); }
.area-name-banner.kind-city { border-color: #b45309; background: linear-gradient(180deg, #fffbeb, #fef3c7); }
.area-name-banner.kind-gym { border-color: #a16207; background: linear-gradient(180deg, #fefce8, #fef08a); }
.area-name-banner.kind-building { border-color: #6b21a8; background: linear-gradient(180deg, #faf5ff, #ede9fe); }

@keyframes anbIn {
    from { transform: translate(-50%, -150%); }
    to { transform: translate(-50%, 0); }
}

@keyframes anbOut {
    from { transform: translate(-50%, 0); opacity: 1; }
    to { transform: translate(-50%, -150%); opacity: 0; }
}

/* 4. Màu cảnh sân theo loại vùng đất */
.pixel-scene-stage.area-kind-forest .hd-landscape-svg {
    filter: saturate(1.3) brightness(0.8) hue-rotate(-10deg);
}

.pixel-scene-stage.area-kind-sea .hd-landscape-svg {
    filter: hue-rotate(95deg) saturate(1.15) brightness(0.95);
}

.pixel-scene-stage.area-kind-building .cave-landscape-svg {
    filter: hue-rotate(230deg) saturate(0.75) brightness(0.85);
}

.pixel-scene-stage.area-kind-gym .cave-landscape-svg {
    filter: sepia(0.35) saturate(1.1) brightness(1.05);
}

/* 5. Cột "Xuất hiện tại đây" theo vùng đất */
.rc-spawn-tile {
    position: relative;
}

.rc-spawn-tile.water-spawn {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(56, 189, 248, 0.45);
}

.rc-spawn-water {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 0.62rem;
    z-index: 1;
}

.rc-spawn-empty {
    grid-column: 1 / -1;
    padding: 16px 10px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* 6. Lộ trình vùng đất trong bảng Bản đồ & Gym */
.adb-path-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.adb-path-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid #334155;
    font-size: 0.74rem;
    color: #e2e8f0;
    white-space: nowrap;
}

.adb-path-chip small {
    color: #94a3b8;
    font-size: 0.66rem;
}

.adb-path-chip.kind-gym {
    border-color: #a16207;
}

.adb-path-chip.current {
    border-color: #facc15;
    color: #fde68a;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

.adb-path-arrow {
    color: #64748b;
    font-weight: 900;
}

/* Thanh lộ trình nhiều bước (21-25): ô nhỏ gọn để hiện đủ tới Gym */
.route-nodes-track {
    scrollbar-width: none;
}

.route-nodes-track::-webkit-scrollbar {
    display: none;
}

.route-nodes-track.dense {
    gap: 1px;
}

.route-nodes-track.dense .route-node-item {
    font-size: 0.78rem;
}

.route-nodes-track.dense .route-leg-sep {
    margin: 0 2px;
}

.route-nodes-track.dense .node-icon-trainer {
    width: 19px;
    height: 19px;
}

.route-nodes-track.dense .node-icon-trainer img {
    width: 38px;
    height: 38px;
    margin-left: -19px;
    top: -3px;
}

.route-nodes-track.dense .route-node-item.gym-final-node {
    width: 28px;
    height: 26px;
}

.route-nodes-track.dense .route-node-item.active-bracket::before,
.route-nodes-track.dense .route-node-item.active-bracket::after {
    font-size: 1.1rem;
}


/* ============================================================================
   PHIÊN 7 — ẢNH POKÉMON HD (POKÉMON HOME 512px), TRAINER TO HƠN (×3 = 240px),
   HIỆU ỨNG CHIÊU THỨC BẰNG CANVAS, KHO PC CHO POKÉMON BẮT TRÙNG
   ============================================================================ */

/* 1. Ảnh HD: thu nhỏ mượt (không dùng chế độ pixel cho ảnh 3D) */
.hd-poke,
.stage-pokemon-sprite.hd-poke,
.sum-hd-artwork.hd-poke,
.evo-chain-sprite.hd-poke {
    image-rendering: auto !important;
}

.sprite-gif-fallback {
    image-rendering: pixelated !important;
}

#stage-lead-sprite,
#stage-enemy-sprite {
    width: 150px;
    height: 150px;
    object-fit: contain;
    object-position: 50% 100%;
    transform-origin: 50% 100%;
}

/* Nhịp thở cho ảnh 2D (độ ưu tiên 0 để không đè các hoạt ảnh theo class như nhảy ra khỏi bụi cỏ) */
:where(img#stage-lead-sprite, img#stage-enemy-sprite) {
    animation: pokeIdleBreath 2.6s ease-in-out infinite;
}

:where(img#stage-enemy-sprite) {
    animation-delay: -1.3s;
}

@keyframes pokeIdleBreath {
    0%, 100% { scale: 1 1; }
    50% { scale: 1.022 0.978; }
}

/* 2. Trainer người chơi & đối thủ phóng đúng 3 lần ảnh 80×80 -> 240px (vẫn sắc nét) */
.road-actors-stage {
    left: 215px;
}

.stage-trainer-holder {
    left: -186px;
    width: 240px;
    height: 262px;
}

.stage-trainer-holder .game-trainer-img {
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
}

.stage-trainer-holder .game-trainer-ground-shadow {
    width: 120px;
    height: 16px;
    margin-top: -30px;
}

.enemy-trainer-figure img,
.enemy-trainer-figure.gym-leader-figure img {
    width: 240px;
    height: 240px;
    margin: 0 -54px;
    image-rendering: pixelated;
}

.enemy-trainer-figure .trainer-figure-shadow {
    width: 120px;
    height: 16px;
    margin-top: -30px;
}

.enemy-trainer-figure.trainer-retreated {
    translate: 260px 0;
}

.enemy-trainer-figure.trainer-step-forward {
    translate: -48px 0;
}

.trainer-exclaim {
    top: 0;
}

/* 3. Lớp canvas vẽ hiệu ứng chiêu thức */
.stage-vfx-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* 4. Kho PC: thẻ cá thể trong kho, huy hiệu số con trùng, sức chứa */
.pc-slot-card.in-pc-box {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border-style: dashed;
}

.pc-box-tag {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 0.72rem;
    z-index: 2;
}

.pc-dup-badge {
    position: absolute;
    bottom: 3px;
    right: 4px;
    z-index: 2;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 900;
    color: #fde68a;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(250, 204, 21, 0.5);
}

.pc-box-capacity {
    margin: 8px 0;
    padding: 8px 9px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid #334155;
    font-size: 0.74rem;
    color: #cbd5e1;
}

.pbc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pbc-row strong {
    color: #fde68a;
}

.pbc-bar {
    height: 5px;
    margin: 6px 0 7px;
    border-radius: 999px;
    background: #1e293b;
    overflow: hidden;
}

.pbc-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #facc15);
}

.pbc-release-btn {
    width: 100%;
    padding: 5px 6px;
    border-radius: 6px;
    border: 1px solid #7f1d1d;
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.pbc-release-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 5. Bảng chi tiết cá thể trong Kho PC */
.pcbox-detail {
    width: min(760px, 94vw);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #172033 0%, #0f172a 100%);
    border: 1.5px solid #334155;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    color: #e2e8f0;
}

.pbd-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(90deg, #1e3a8a, #1e293b);
    border-bottom: 1px solid #334155;
}

.pbd-box-pill {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 900;
    background: #facc15;
    color: #1f1300;
}

.pbd-ball {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
}

.pbd-name {
    font-size: 1.15rem;
    font-weight: 900;
}

.pbd-lv {
    font-weight: 800;
    color: #93c5fd;
}

.pbd-close {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #475569;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    cursor: pointer;
}

.pbd-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    padding: 14px 16px;
}

.pbd-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: radial-gradient(circle at 50% 70%, rgba(56, 189, 248, 0.18), transparent 65%), rgba(15, 23, 42, 0.6);
}

.pbd-sprite {
    width: 190px;
    height: 190px;
    object-fit: contain;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.5));
}

.pbd-types,
.pbd-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.pbd-type {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

.pbd-tag {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    background: #1e293b;
    border: 1px solid #334155;
}

.pbd-tag.shiny { color: #fde047; border-color: #a16207; }
.pbd-tag.ha { color: #fbbf24; border-color: #b45309; }

.pbd-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.82rem;
}

.pbd-kv {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.6);
}

.pbd-kv span {
    color: #94a3b8;
}

.pbd-kv strong {
    text-align: right;
}

.pbd-section-title {
    margin-top: 6px;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #94a3b8;
    text-transform: uppercase;
}

.pbd-section-title small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.pbd-stat-row {
    display: grid;
    grid-template-columns: 54px 44px 1fr 44px 40px;
    align-items: center;
    gap: 8px;
}

.pbd-stat-label {
    font-weight: 800;
    color: #cbd5e1;
}

.pbd-stat-val {
    font-weight: 900;
    text-align: right;
}

.pbd-iv-bar {
    height: 6px;
    border-radius: 999px;
    background: #1e293b;
    overflow: hidden;
}

.pbd-iv-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f97316, #facc15);
}

.pbd-iv {
    font-size: 0.7rem;
    color: #fdba74;
}

.pbd-up { color: #4ade80; font-weight: 900; font-size: 0.72rem; }
.pbd-down { color: #f87171; font-weight: 900; font-size: 0.72rem; }
.pbd-eq { color: #64748b; font-size: 0.72rem; }

.pbd-moves {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pbd-move {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 800;
    background: rgba(30, 41, 59, 0.85);
    border-left: 4px solid var(--mc, #64748b);
}

.pbd-compare {
    margin: 0 16px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #cbd5e1;
    background: rgba(30, 58, 138, 0.25);
    border: 1px solid rgba(96, 165, 250, 0.35);
}

.pbd-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px 16px;
}

.pbd-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 9px;
    font-weight: 900;
    font-size: 0.86rem;
    cursor: pointer;
    border: 1.5px solid transparent;
}

.pbd-btn.primary {
    background: linear-gradient(180deg, #22c55e, #15803d);
    border-color: #14532d;
    color: #fff;
}

.pbd-btn.danger {
    flex: 0 0 auto;
    background: rgba(127, 29, 29, 0.45);
    border-color: #991b1b;
    color: #fecaca;
}

@media (max-width: 700px) {
    .pbd-body { grid-template-columns: 1fr; }
    .pbd-actions { flex-direction: column; }
}

/* Bảng chi tiết Kho PC dùng chung modal: bỏ khung ngoài của bảng Info */
.poke-summary-window.pcbox-mode {
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible;
}


/* ============================================================================
   PHIÊN 8 — POKÉMON 3D (MÔ HÌNH .GLB + HOẠT ẢNH) TRÊN SÂN ĐẤU & BẢNG INFO
   ============================================================================ */
.poke3d-canvas {
    display: block;
}

#stage-lead-sprite.poke3d-canvas,
#stage-enemy-sprite.poke3d-canvas {
    width: 170px;
    height: 170px;
}

.sum-3d-canvas {
    cursor: grab;
    touch-action: none;
}

.sum-3d-canvas:active {
    cursor: grabbing;
}

.poke3d-toggle-pill {
    width: auto !important;
    padding: 0 10px !important;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.poke3d-toggle-pill.active {
    border-color: #38bdf8 !important;
    color: #e0f2fe;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

/* ==========================================================================
   PHIÊN 10 — GIÃN KHOẢNG CÁCH 2 POKÉMON & POKÉMON HIẾM (~1%)
   ========================================================================== */
/* 1. Đặt 2 Pokémon theo % bề ngang sân (của bạn ~30%, đối thủ ~76%) thay vì dồn về 2 mép
      -> màn hình hẹp (1280-1366px) không còn dính sát nhau; Trainer 2 bên đứng sau lưng, không chiếm chỗ */
.road-actors-stage {
    left: 0;
    right: 0;
    display: block;
}

.road-actors-stage > .player-road-group {
    position: absolute;
    bottom: 0;
    left: 30%;
    transform: translateX(-50%);
}

.road-actors-stage > .stage-right-actor {
    position: absolute;
    bottom: 0;
    left: 76%;
    transform: translateX(-50%);
}

.player-road-group .stage-trainer-holder {
    left: -125px;
}

.enemy-stage-group > .enemy-trainer-figure {
    position: absolute;
    left: calc(100% - 96px);
    bottom: 0;
}

.enemy-stage-group > .wild-grass-bush-prop {
    position: absolute;
    left: calc(100% - 22px);
    bottom: 0;
    margin-left: 0;
}

/* 2. Pokémon hiếm (theo Let's Go Pikachu / Eevee) */
.rc-spawn-tile.rare-spawn {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.18);
}

.rc-spawn-rare {
    position: absolute;
    top: 1px;
    right: 3px;
    font-size: 0.62rem;
    z-index: 1;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.8));
}

.time-label-rare {
    color: #fbbf24;
    font-weight: 900;
}

.rare-mini-pill {
    display: inline-block;
    background: linear-gradient(135deg, #f97316, #facc15);
    color: #1c1917;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #fef3c7;
    vertical-align: middle;
    letter-spacing: 0.3px;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.55);
}

/* ==========================================================================
   PHIÊN 11 — ẢNH ĐỘNG 2D (GIF) TRÊN SÂN: phóng bội số nguyên, giữ nét pixel
   ========================================================================== */
#stage-lead-sprite.anim-poke,
#stage-enemy-sprite.anim-poke {
    width: auto;
    height: auto;
    max-width: 210px;
    max-height: 210px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.35));
}

#stage-lead-sprite.anim-poke.sprite-hd-fallback,
#stage-enemy-sprite.anim-poke.sprite-hd-fallback {
    width: 150px;
    height: 150px;
    image-rendering: auto;
}

/* GIF đã tự chuyển động -> bỏ nhịp "thở" co giãn (làm méo pixel) */
:where(img#stage-lead-sprite.anim-poke, img#stage-enemy-sprite.anim-poke) {
    animation: none;
}

/* ==========================================================================
   PHIÊN 13 — CỬA SỔ ĐỘI HÌNH: hàng 6 Pokémon đang chọn phía trên danh sách đã bắt
   ========================================================================== */
.pc-modal-party {
    padding: 10px 14px 4px;
}

.pmp-title {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #fde047;
    margin-bottom: 6px;
}

.pmp-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.pmp-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    min-height: 104px;
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid #334155;
    border-radius: 10px;
    cursor: pointer;
}

.pmp-slot:hover { border-color: #38bdf8; }
.pmp-slot.lead { border-color: #facc15; }
/* Phiên 86: chỉ kéo hình Pokémon; ô đang được thả vào sáng lên */
img.poke-drag { cursor: grab; -webkit-user-drag: element; }
img.poke-drag:active { cursor: grabbing; }
.pmp-slot.drag-over { border-color: #4ade80; border-style: solid; box-shadow: 0 0 12px rgba(74, 222, 128, .5); background: rgba(20, 83, 45, .55); }

.pmp-slot.empty {
    justify-content: center;
    cursor: default;
    border-style: dashed;
    color: #64748b;
    font-size: 0.72rem;
}

.pmp-slot img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: pixelated;
}

.pmp-lead { position: absolute; top: 2px; left: 5px; font-size: 0.7rem; }
.pmp-name { font-size: 0.72rem; font-weight: 800; color: #f1f5f9; }
.pmp-lv { font-size: 0.66rem; color: #94a3b8; }

.pmp-hp {
    width: 80%;
    height: 5px;
    margin-top: 3px;
    background: #0f172a;
    border-radius: 3px;
    overflow: hidden;
}

.pmp-hp i { display: block; height: 100%; background: #22c55e; }

.map-modal-window {
    position: relative;
    width: min(1180px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 10px;
}

.map-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 5;
}

.map-modal-window .adv-green-header {
    padding-right: 54px;
}


/* ==========================================================================
   PHIÊN 15 — BẢNG TỰ ĐỘNG THẢ TRONG PC + KÉO THẢ VÀO ĐỘI HÌNH
   ========================================================================== */
.pmp-title small { color: #94a3b8; font-weight: 600; letter-spacing: 0; }

.pc-auto-open-btn {
    width: 100%;
    margin: 8px 0;
    padding: 7px 8px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}

.pc-auto-open-btn.on { border-color: #22c55e; color: #bbf7d0; }

.pc-auto-panel {
    padding: 14px 16px;
    background: #111827;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    min-height: 420px;
}

.pca-head { display: flex; justify-content: space-between; align-items: center; font-weight: 900; color: #fde047; font-size: 0.86rem; }
.pca-note { margin: 8px 0 12px; font-size: 0.76rem; color: #94a3b8; line-height: 1.45; }
.pca-row { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid #1f2937; font-size: 0.8rem; }
.pca-row-top { align-items: start; }
.pca-row label { font-weight: 800; }
.pca-row small { color: #94a3b8; font-weight: 500; }
.pca-select, .pca-input { background: #0f172a; color: #e2e8f0; border: 1px solid #475569; border-radius: 6px; padding: 6px 8px; font-size: 0.8rem; max-width: 260px; }
.pca-toggle { justify-self: start; padding: 6px 14px; border-radius: 999px; border: 1px solid #475569; background: #1e293b; color: #cbd5e1; font-weight: 900; font-size: 0.74rem; cursor: pointer; }
.pca-toggle.on { background: #166534; border-color: #22c55e; color: #fff; }
.pca-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pca-chip { padding: 4px 9px; border-radius: 999px; border: 1px solid #475569; background: #1e293b; color: #cbd5e1; font-size: 0.72rem; cursor: pointer; }
.pca-chip.on { background: #1d4ed8; border-color: #60a5fa; color: #fff; }
.pca-clear { margin-top: 4px; background: none; border: none; color: #f87171; font-size: 0.7rem; cursor: pointer; padding: 0; }


/* ==========================================================================
   PHIÊN 16 — CHỌN VÙNG ĐỂ AUTO TRONG CHƯƠNG ĐÃ HOÀN THÀNH
   ========================================================================== */
.adb-path-chip.farmable { cursor: pointer; border-color: #22c55e; }
.adb-path-chip.farmable:hover { background: rgba(34, 197, 94, 0.18); }
.adb-path-chip.farming { background: #166534; border-color: #4ade80; color: #fff; box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.adb-farm-hint { margin-top: 6px; font-size: 0.72rem; color: #94a3b8; }
.adb-farm-hint.on { color: #86efac; }
.adb-farm-stop { margin-left: 8px; padding: 2px 10px; border-radius: 999px; border: 1px solid #f87171; background: #7f1d1d; color: #fff; font-size: 0.7rem; font-weight: 800; cursor: pointer; }


/* ==========================================================================
   PHIÊN 19 — HÌNH VẬT PHẨM KIỂU GAME
   ========================================================================== */
.game-item-sprite {
    image-rendering: pixelated;
    object-fit: contain;
    vertical-align: middle;
}

.rc-item-slot .game-item-sprite { width: 34px; height: 34px; }


/* ==========================================================================
   PHIÊN 20 — CỬA SỔ CÀI ĐẶT BẮT POKÉMON
   ========================================================================== */
.catch-settings-window {
    width: min(620px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
    background: #111827;
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 14px 16px;
    color: #e2e8f0;
}

.cs-head { display: flex; justify-content: space-between; align-items: center; font-weight: 900; color: #fde047; }
.cs-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid #1f2937; }
.cs-title { font-weight: 900; font-size: 0.84rem; margin-bottom: 8px; }
.cs-title small, .cs-ball-name small { color: #94a3b8; font-weight: 500; }
.cs-note { font-size: 0.74rem; color: #94a3b8; margin: 6px 0; line-height: 1.4; }
.cs-row { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items: center; padding: 5px 0; font-size: 0.8rem; }
.cs-row label { font-weight: 700; }
.cs-ball-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin-bottom: 4px; background: #1e293b; border: 1px solid #334155; border-radius: 8px; opacity: 0.6; }
.cs-ball-row.on { opacity: 1; border-color: #38bdf8; }
.cs-rank { width: 18px; text-align: center; font-weight: 900; color: #fde047; }
.cs-ball-name { flex: 1; font-size: 0.8rem; font-weight: 700; }
.cs-arrow { width: 26px; height: 24px; background: #0f172a; border: 1px solid #475569; border-radius: 5px; color: #e2e8f0; cursor: pointer; }
.cs-arrow:disabled { opacity: 0.3; cursor: default; }
.cs-toggle { justify-self: start; min-width: 96px; padding: 5px 10px; border-radius: 999px; border: 1px solid #475569; background: #0f172a; color: #cbd5e1; font-weight: 900; font-size: 0.7rem; cursor: pointer; }
.cs-toggle.on { background: #166534; border-color: #22c55e; color: #fff; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.cs-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid #475569; background: #1e293b; color: #cbd5e1; font-size: 0.74rem; cursor: pointer; }
.cs-chip.on { background: #1d4ed8; border-color: #60a5fa; color: #fff; }
.cs-sub { font-size: 0.76rem; font-weight: 700; margin-top: 8px; }
.cs-pokes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cs-poke { display: flex; flex-direction: column; align-items: center; width: 76px; padding: 4px 2px; background: #1e293b; border: 2px solid #334155; border-radius: 8px; color: #cbd5e1; font-size: 0.66rem; cursor: pointer; }
.cs-poke img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.cs-poke.on { border-color: #22c55e; background: rgba(34, 197, 94, 0.16); color: #fff; }
.cs-dim { opacity: 0.45; }

/* ==========================================================================
   PHIÊN 22 — LƯỚI KHO PC 5 HÀNG GIÃN ĐỀU CHO KHÍT CHIỀU CAO KHUNG (không còn khoảng trống phía dưới)
   ========================================================================== */
@media (min-width: 681px) {
    .pc-grid-3x5 {
        flex: 1;
        grid-template-rows: repeat(5, minmax(62px, 1fr));
    }
}


/* ==========================================================================
   PHIÊN 23 — HIỆU ỨNG HỒI MÁU 6 POKÉMON Ở POKÉMON CENTER (khi cả đội kiệt sức)
   ========================================================================== */
.party-heal-fx {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.party-heal-fx.hide { opacity: 0; }

.phf-machine {
    padding: 14px 22px 12px;
    background: linear-gradient(180deg, #fef2f2, #fecaca);
    border: 4px solid #b91c1c;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.phf-title { font-weight: 900; color: #991b1b; letter-spacing: 1px; font-size: 0.9rem; margin-bottom: 8px; }

.phf-tray {
    display: grid;
    grid-template-columns: repeat(6, 44px);
    gap: 8px;
    padding: 8px 10px;
    background: #1e293b;
    border-radius: 10px;
    border: 2px solid #0f172a;
}

.phf-ball {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.15);
    opacity: 0.25;
    animation: phfBallHeal 0.6s ease-out forwards;
}

.phf-ball.empty { animation: none; }

@keyframes phfBallHeal {
    0% { opacity: 0.25; transform: scale(0.8); box-shadow: none; }
    45% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 18px 6px rgba(74, 222, 128, 0.95); background: rgba(74, 222, 128, 0.5); }
    100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px 2px rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.22); }
}

.phf-done {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #166534;
    opacity: 0;
    animation: phfDone 0.4s ease-out forwards;
}

@keyframes phfDone { to { opacity: 1; } }

.party-hud-slot.heal-flash {
    animation: partyHealFlash 0.7s ease-out;
}

@keyframes partyHealFlash {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); filter: brightness(1); }
    35% { box-shadow: 0 0 16px 5px rgba(74, 222, 128, 0.95); filter: brightness(1.6); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); filter: brightness(1); }
}


/* ==========================================================================
   PHIÊN 24 — BERRY TĂNG CƯỜNG Ở Ô VẬT PHẨM TIÊU HAO
   ========================================================================== */
.rc-item-slot.buff-active { border-color: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, 0.55); }
.rc-buff-time { position: absolute; top: 1px; left: 3px; font-size: 0.58rem; font-weight: 900; color: #86efac; }


/* ==========================================================================
   PHIÊN 25 — VỊ TRÍ THEO GAME GỐC (POKÉDEX) & NÚT KHÓA POKÉMON TRONG PC
   ========================================================================== */
.dex-gameloc-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 6px;
    font-size: 0.76rem;
}

.dex-gameloc-games { font-weight: 800; color: #fde047; }
.dex-gameloc-text { color: #e2e8f0; }

.pc-lock-btn {
    position: absolute;
    left: 3px;
    bottom: 3px;
    z-index: 3;
    padding: 0 2px;
    background: none;
    border: none;
    font-size: 0.74rem;
    cursor: pointer;
    opacity: 0.35;
}

.pc-lock-btn:hover { opacity: 1; }
.pc-lock-btn.locked { opacity: 1; filter: drop-shadow(0 0 3px rgba(250, 204, 21, 0.9)); }


/* ==========================================================================
   PHIÊN 27 — NHÃN ĐỘ HIẾM (Common / Uncommon / Rare / Bán-Huyền thoại / Huyền thoại / Thần thoại)
   ========================================================================== */
.rarity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--rc, #94a3b8);
    background: color-mix(in srgb, var(--rc, #94a3b8) 22%, transparent);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.3px;
    white-space: nowrap;
    vertical-align: middle;
}


/* ==========================================================================
   PHIÊN 29 — ĐOẠN MỞ ĐẦU CỦA GS. OAK
   ========================================================================== */
.oak-intro {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: radial-gradient(circle at 50% 40%, #1e293b 0%, #020617 75%);
    opacity: 0;
    transition: opacity 0.35s ease;
    cursor: pointer;
}

.oak-intro.show { opacity: 1; }
.oak-intro.hide { opacity: 0; pointer-events: none; }

.oak-skip {
    position: absolute;
    top: 18px;
    right: 22px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #cbd5e1;
    font-weight: 800;
    font-size: 0.76rem;
    cursor: pointer;
}

.oak-stage { position: relative; width: 320px; height: 300px; display: flex; align-items: flex-end; justify-content: center; }

.oak-figure {
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.6));
    animation: oakEnter 0.7s ease-out both;
    transition: transform 0.4s ease;
}

@keyframes oakEnter {
    from { opacity: 0; filter: brightness(0) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.6)); transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.oak-intro.show-ball .oak-figure { transform: translateX(-56px); }

.oak-ball {
    position: absolute;
    right: 46px;
    bottom: 18px;
    opacity: 0;
    transform: translateY(-60px) rotate(-90deg);
    transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.oak-intro.show-ball .oak-ball { opacity: 1; transform: none; }

.oak-poke {
    position: absolute;
    right: 30px;
    bottom: 58px;
    width: 84px;
    height: 84px;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0;
    transform: scale(0.2);
    transition: opacity 0.3s ease 0.35s, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s;
}

.oak-intro.show-poke .oak-poke { opacity: 1; transform: none; }

.oak-textbox {
    position: relative;
    width: min(640px, 90vw);
    min-height: 92px;
    padding: 18px 22px 20px;
    background: #f8fafc;
    border: 4px solid #334155;
    border-radius: 12px;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.oak-name {
    position: absolute;
    top: -13px;
    left: 16px;
    padding: 2px 10px;
    background: #b91c1c;
    color: #fff;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.oak-next { position: absolute; right: 14px; bottom: 6px; color: #b91c1c; animation: oakNextBlink 0.9s infinite; }
@keyframes oakNextBlink { 50% { opacity: 0.15; transform: translateY(3px); } }

/* ==========================================================================
   PHIÊN 30 — CÁ THỂ TRONG KHO PC DÙNG BẢNG INFO CŨ (chỉ xem) + THANH THAO TÁC CỦA KHO
   ========================================================================== */
.box-info-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1e293b;
    border-bottom: 2px solid #38bdf8;
    font-size: 0.76rem;
    color: #e2e8f0;
}

.box-info-bar span { flex: 1; min-width: 220px; }

.box-act {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #e2e8f0;
    font-weight: 800;
    font-size: 0.74rem;
    cursor: pointer;
}

.box-act.primary { background: #1d4ed8; border-color: #60a5fa; }
.box-act.danger { background: #7f1d1d; border-color: #f87171; }

/* Các nút thao tác của bảng Info (huấn luyện, đổi chiêu, đổi Ability / Nature...) không dùng được với cá thể trong Kho */
.box-readonly button:not(.box-act):not(.sum-close-x):not(.sum-ability-toggle):not(.sum-ev-plus-btn):not(.sum-back-pc),
.box-readonly select,
.box-readonly .sum-move-clickable {
    pointer-events: none;
    opacity: 0.45;
}


/* ==========================================================================
   PHIÊN 33 — THẢ HÀNG LOẠT TRONG PC (chọn nhiều thẻ / cả trang)
   ========================================================================== */
.pc-select-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: #1e293b;
    border: 1px solid #f87171;
    border-radius: 8px;
    font-size: 0.76rem;
    color: #e2e8f0;
}

.pc-select-bar span { flex: 1; min-width: 160px; }

.psb-btn {
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #e2e8f0;
    font-weight: 800;
    font-size: 0.72rem;
    cursor: pointer;
}

.psb-btn.danger { background: #7f1d1d; border-color: #f87171; }
.psb-btn:disabled { opacity: 0.4; cursor: default; }

.pc-select-mode .pc-slot-card:not(.empty-slot)::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 14px;
    height: 14px;
    border: 2px solid #cbd5e1;
    border-radius: 3px;
    background: #0f172a;
    z-index: 4;
}

.pc-select-mode .pc-slot-card.pc-selected { border-color: #f87171; box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.55) inset; }
.pc-select-mode .pc-slot-card.pc-selected::before { content: '✓'; background: #dc2626; border-color: #fecaca; color: #fff; font-size: 0.66rem; font-weight: 900; line-height: 12px; text-align: center; }


/* ==========================================================================
   PHIÊN 34 — HÌNH HUY HIỆU, ẢNH NỀN SÂN ĐẤU, TÔNG MÀU THEO BUỔI & HIỆU ỨNG THỜI TIẾT
   ========================================================================== */
.gym-badge-sprite { image-rendering: pixelated; object-fit: contain; vertical-align: middle; }

.weather-clock-pill .weather-part { margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(148, 163, 184, 0.5); font-size: 0.78em; font-weight: 700; }
.weather-clock-pill .weather-part.indoor { opacity: 0.45; }

/* Ảnh nền sân đấu */
.stage-photo-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease, filter 0.8s ease;
}

.pixel-scene-stage.has-photo-bg .stage-photo-bg { opacity: 1; }
.pixel-scene-stage.has-photo-bg .hd-landscape-svg,
.pixel-scene-stage.has-photo-bg .cave-landscape-svg { visibility: hidden !important; }

/* Tông màu theo buổi (chỉ ngoài trời) */
.pixel-scene-stage.phase-morning:not(.env-indoor) .stage-photo-bg { filter: brightness(1.03) sepia(0.22) saturate(1.15); }
.pixel-scene-stage.phase-night:not(.env-indoor) .stage-photo-bg { filter: brightness(0.42) saturate(0.75) hue-rotate(18deg); }
.pixel-scene-stage.w-rain:not(.env-indoor):not(.phase-night) .stage-photo-bg,
.pixel-scene-stage.w-thunderstorm:not(.env-indoor):not(.phase-night) .stage-photo-bg { filter: brightness(0.72) saturate(0.8); }
.pixel-scene-stage.w-sunny:not(.env-indoor) .stage-photo-bg { filter: brightness(1.12) saturate(1.25); }

/* Lớp hiệu ứng thời tiết */
.stage-weather-fx {
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    overflow: hidden;
}

.pixel-scene-stage.w-rain .stage-weather-fx,
.pixel-scene-stage.w-thunderstorm .stage-weather-fx {
    background-image:
        repeating-linear-gradient(105deg, rgba(190, 220, 255, 0) 0 14px, rgba(190, 220, 255, 0.5) 14px 15px, rgba(190, 220, 255, 0) 15px 31px),
        repeating-linear-gradient(105deg, rgba(190, 220, 255, 0) 0 23px, rgba(190, 220, 255, 0.32) 23px 24px, rgba(190, 220, 255, 0) 24px 47px);
    background-size: 200% 200%, 200% 200%;
    animation: stageRainFall 0.55s linear infinite;
}

@keyframes stageRainFall {
    from { background-position: 0 0, 30px 0; }
    to { background-position: -60px 220px, -40px 300px; }
}

.pixel-scene-stage.w-thunderstorm .stage-weather-fx::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    animation: stageLightning 7s linear infinite;
}

@keyframes stageLightning {
    0%, 91%, 100% { opacity: 0; }
    92% { opacity: 0.55; }
    93% { opacity: 0.05; }
    94% { opacity: 0.4; }
    96% { opacity: 0; }
}

.pixel-scene-stage.w-sunny .stage-weather-fx {
    background: radial-gradient(circle at 88% 6%, rgba(255, 244, 190, 0.75) 0, rgba(255, 220, 120, 0.28) 16%, rgba(255, 220, 120, 0) 42%);
    animation: stageSunPulse 4s ease-in-out infinite;
}

@keyframes stageSunPulse { 50% { opacity: 0.72; } }

.pixel-scene-stage.w-fog .stage-weather-fx {
    background:
        linear-gradient(90deg, rgba(226, 232, 240, 0) 0%, rgba(226, 232, 240, 0.3) 30%, rgba(226, 232, 240, 0.12) 60%, rgba(226, 232, 240, 0.32) 100%),
        linear-gradient(180deg, rgba(226, 232, 240, 0.2), rgba(226, 232, 240, 0.05));
    background-size: 220% 100%, 100% 100%;
    animation: stageFogDrift 18s linear infinite alternate;
}

@keyframes stageFogDrift { from { background-position: 0 0, 0 0; } to { background-position: 100% 0, 0 0; } }

.pixel-scene-stage.env-indoor .stage-weather-fx { display: none; }


/* ==========================================================================
   PHIÊN 36 — MÀN PHIÊU LƯU: DANH SÁCH CHƯƠNG GỌN (hiện hết không phải cuộn), HUY HIỆU, ẢNH HANG HUYỀN THOẠI
   ========================================================================== */
.map-modal-window .adv-chapters-scroll {
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.map-modal-window .adv-chapter-card {
    min-height: 0;
    height: clamp(30px, calc((92vh - 250px) / 15), 40px);
    padding: 1px 8px;
    margin: 0;
    gap: 8px;
    align-items: center;
}

.map-modal-window .acc-code-col { width: 22px; min-width: 22px; }
.map-modal-window .acc-avatar-wrap { width: 34px; height: 32px; min-width: 34px; }
.map-modal-window .acc-leader-img { width: 32px; height: 32px; }
.map-modal-window .acc-info-col { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.map-modal-window .acc-title-line { flex: 1; min-width: 0; margin: 0; }
.map-modal-window .acc-name { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-modal-window .acc-pills-row { margin: 0; flex-shrink: 0; }
.map-modal-window .adv-chap-lv-pill,
.map-modal-window .adv-chap-caught-pill { font-size: 0.6rem; padding: 1px 6px; white-space: nowrap; }
.map-modal-window .acc-replay-btn { width: 26px; height: 26px; min-width: 26px; }
.map-modal-window .adv-league-section-label { margin: 2px 0; font-size: 0.66rem; }
.map-modal-window .adv-col-header-row { margin-bottom: 6px; }
.map-modal-window .adv-regions-strip { padding-top: 8px; padding-bottom: 8px; }
.map-modal-window .adv-region-card { padding-top: 6px; padding-bottom: 6px; min-height: 0; }

/* Huy hiệu ở thẻ vùng */
.adv-mini-badge.dim .gym-badge-sprite { filter: grayscale(1) brightness(0.45); }
.adv-mini-badge .gym-badge-sprite { width: 16px; height: 16px; }

/* Chương huyền thoại: ảnh nơi ở của Pokémon huyền thoại, không có cột / tượng Gym */
.legend-lair-banner .agsb-architectural-pillars,
.legend-lair-banner .agsb-gym-statues { display: none; }


/* ==========================================================================
   PHIÊN 37 — Ô GIỜ / NGÀY ĐÊM / THỜI TIẾT TRÊN THANH TRÊN CÙNG + HIỆU ỨNG BÃO CÁT, MƯA ĐÁ
   ========================================================================== */
.nav-env-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: #1c2130;
    border: 1px solid #2b3246;
    border-radius: 999px;
    color: #e2e8f0;
    font-size: 0.76rem;
    cursor: pointer;
    white-space: nowrap;
}

.nav-env-pill .weather-part { padding-left: 8px; border-left: 1px solid rgba(148, 163, 184, 0.45); font-weight: 700; }

.pixel-scene-stage.w-sandstorm .stage-weather-fx {
    background-image:
        repeating-linear-gradient(170deg, rgba(214, 180, 120, 0) 0 9px, rgba(214, 180, 120, 0.42) 9px 11px, rgba(214, 180, 120, 0) 11px 26px),
        linear-gradient(180deg, rgba(194, 160, 100, 0.28), rgba(194, 160, 100, 0.18));
    background-size: 240% 240%, 100% 100%;
    animation: stageSandBlow 0.9s linear infinite;
}

@keyframes stageSandBlow { from { background-position: 0 0, 0 0; } to { background-position: -260px 40px, 0 0; } }

.pixel-scene-stage.w-hail .stage-weather-fx {
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 2px, rgba(255, 255, 255, 0) 3px),
        radial-gradient(circle, rgba(226, 240, 255, 0.85) 0 3px, rgba(226, 240, 255, 0) 4px);
    background-size: 46px 46px, 78px 78px;
    animation: stageHailFall 0.8s linear infinite;
}

@keyframes stageHailFall { from { background-position: 0 0, 20px 10px; } to { background-position: -18px 92px, 2px 166px; } }

.pixel-scene-stage.w-sandstorm:not(.env-indoor) .stage-photo-bg { filter: brightness(0.9) sepia(0.45); }
.pixel-scene-stage.w-hail:not(.env-indoor):not(.phase-night) .stage-photo-bg { filter: brightness(0.9) saturate(0.7); }


/* ==========================================================================
   PHIÊN 38 — POKÉDEX: GỢI Ý ABILITY & NATURE
   ========================================================================== */
.dex-tips-box { display: flex; flex-direction: column; gap: 5px; padding: 6px 8px; background: rgba(15, 23, 42, 0.55); border-radius: 6px; }
.tip-nature-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: start; font-size: 0.74rem; }
.tip-nature-label { font-weight: 800; color: #fde047; padding-top: 2px; }
.tip-nature-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tip-chip { padding: 1px 7px; border-radius: 999px; border: 1px solid #475569; background: #1e293b; color: #cbd5e1; font-size: 0.7rem; }
.tip-chip.best { border-color: #facc15; color: #fff; font-weight: 800; background: rgba(250, 204, 21, 0.16); }
.tip-chip.other-form { opacity: 0.55; }


/* ==========================================================================
   PHIÊN 39 — HIỂN THỊ TRẠNG THÁI TRONG TRẬN
   ========================================================================== */
.battle-status-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 200px; margin-top: 3px; min-height: 0; }
.bst-pill { padding: 0 5px; border-radius: 4px; font-size: 0.6rem; font-weight: 900; line-height: 15px; color: #fff; border: 1px solid rgba(0, 0, 0, 0.55); white-space: nowrap; }
.bst-psn { background: #a855f7; } .bst-tox { background: #7e22ce; } .bst-brn { background: #ef4444; }
.bst-par { background: #eab308; color: #1c1917; } .bst-slp { background: #64748b; } .bst-frz { background: #38bdf8; color: #082f49; }
.bst-vol { background: #be185d; } .bst-buff { background: #0369a1; } .bst-up { background: #15803d; } .bst-down { background: #b91c1c; }

.slot-status { position: absolute; left: 2px; bottom: 2px; padding: 0 3px; border-radius: 3px; font-size: 0.5rem; font-weight: 900; line-height: 11px; color: #fff; z-index: 3; }

/* Tông màu trên hình Pokémon theo trạng thái */
.stage-pokemon-sprite.bfx-psn, .stage-pokemon-sprite.bfx-tox { filter: drop-shadow(0 0 6px #a855f7) hue-rotate(250deg) saturate(1.4) !important; }
.stage-pokemon-sprite.bfx-brn { filter: drop-shadow(0 0 7px #ef4444) sepia(0.55) saturate(2.4) hue-rotate(-18deg) !important; }
.stage-pokemon-sprite.bfx-par { filter: drop-shadow(0 0 7px #facc15) brightness(1.15) saturate(1.3) !important; animation: bfxParJitter 0.45s steps(2) infinite !important; }
.stage-pokemon-sprite.bfx-slp { filter: grayscale(0.55) brightness(0.72) !important; }
.stage-pokemon-sprite.bfx-frz { filter: drop-shadow(0 0 8px #7dd3fc) hue-rotate(160deg) saturate(0.7) brightness(1.2) !important; }
@keyframes bfxParJitter { 0% { translate: -2px 0; } 50% { translate: 2px 0; } 100% { translate: -2px 0; } }

.status-pop {
    position: absolute;
    left: 50%;
    top: 18%;
    transform: translateX(-50%);
    padding: 2px 10px;
    border-radius: 999px;
    border: 2px solid #0f172a;
    font-size: 0.78rem;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
    z-index: 12;
    pointer-events: none;
    animation: statusPopUp 1.3s ease-out forwards;
}

@keyframes statusPopUp {
    0% { opacity: 0; margin-top: 14px; scale: 0.7; }
    18% { opacity: 1; margin-top: 0; scale: 1.12; }
    70% { opacity: 1; margin-top: -14px; scale: 1; }
    100% { opacity: 0; margin-top: -30px; }
}


/* PHIÊN 41 — thời tiết do Ability / chiêu tạo ra hiện cả khi đang ở trong hang / nhà */
.pixel-scene-stage.env-indoor.env-field-weather .stage-weather-fx { display: block; }


/* ==========================================================================
   PHIÊN 42 — CẢNH ĐỐI THỦ CHẾ GIỄU KHI THẮNG + NHÃN THỜI TIẾT TRONG TRẬN
   ========================================================================== */
.nav-env-pill .field-weather-part { color: #fde047; }

.rival-taunt-fx {
    position: absolute;
    inset: 0;
    z-index: 42;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(2, 6, 23, 0.62);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.rival-taunt-fx.show { opacity: 1; }

.rtf-bubble {
    max-width: 46%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 3px solid #0f172a;
    border-radius: 14px;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    transform: translateX(-30px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rival-taunt-fx.show .rtf-bubble { transform: none; }

.rtf-figure { position: relative; }

.rtf-figure img {
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6));
    animation: rtfLaugh 0.32s ease-in-out infinite;
    transform-origin: 50% 100%;
}

@keyframes rtfLaugh { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }

.rtf-laugh { position: absolute; font-weight: 900; color: #fde047; text-shadow: 0 2px 0 #0f172a; opacity: 0; animation: rtfHa 1s ease-out infinite; }
.rtf-laugh.l1 { top: 4px; left: -6px; font-size: 1.1rem; }
.rtf-laugh.l2 { top: -14px; left: 96px; font-size: 1.4rem; animation-delay: 0.33s; }
.rtf-laugh.l3 { top: 10px; right: -10px; font-size: 1.1rem; animation-delay: 0.66s; }
@keyframes rtfHa { 0% { opacity: 0; transform: translateY(10px) scale(0.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px) scale(1.15); } }


/* ==========================================================================
   PHIÊN 45 — ĐỘI HÌNH GYM Ở MÀN PHIÊU LƯU
   ========================================================================== */
.agt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.agt-cell {
    flex: 1 1 86px;
    max-width: 112px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px 7px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
}
.agt-cell img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.agt-name { font-size: 0.72rem; font-weight: 700; color: #f1f5f9; text-align: center; line-height: 1.1; }
.agt-lv { font-size: 0.68rem; font-weight: 800; color: #fde047; }
.agt-types { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.agt-types i { font-style: normal; font-size: 0.56rem; font-weight: 800; color: #fff; padding: 1px 5px; border-radius: 6px; text-transform: uppercase; }


/* ==========================================================================
   PHIÊN 46 — CỬA SỔ CHỌN POKÉMON KHỞI ĐẦU JOHTO
   ========================================================================== */
.johto-starter-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 6, 23, 0.82); }
.jsm-box { width: min(560px, 100%); padding: 22px; background: #0f172a; border: 2px solid #38bdf8; border-radius: 16px; color: #e2e8f0; text-align: center; }
.jsm-box h3 { margin: 0 0 6px; font-size: 1.25rem; color: #fde047; }
.jsm-box p { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.45; }
.jsm-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.jsm-card { flex: 1 1 130px; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; background: #1e293b; border: 2px solid #334155; border-radius: 12px; color: #f8fafc; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; }
.jsm-card:hover { transform: translateY(-4px); border-color: #fde047; }
.jsm-card img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; }
.jsm-card span { font-size: 0.68rem; font-weight: 800; color: #fff; padding: 2px 8px; border-radius: 8px; text-transform: uppercase; }
.jsm-warn { color: #fca5a5; font-size: 0.82rem !important; }
.jsm-cancel { padding: 8px 18px; background: #334155; border: 0; border-radius: 10px; color: #e2e8f0; font-weight: 700; cursor: pointer; }


/* PHIÊN 47 — dòng độ thân thiết trong Info */
.sum-friend-hint { color: #f9a8d4; }
.sum-friend-hint strong { color: #fff; }

/* ============================================================================
   PHIÊN 48 — GIAO DIỆN ĐIỆN THOẠI (<= 760px)
   Thứ tự trên màn hình: thanh trên gọn -> lộ trình -> sân đấu -> nhật ký / bảng -> vật phẩm.
   Menu trái thành ngăn kéo; thanh điều hướng cố định ở đáy; cửa sổ mở toàn màn hình.
   ============================================================================ */
.stage-fit { display: contents; }
.mobile-tabbar, .mobile-drawer-backdrop { display: none; }

@media (max-width: 760px), (max-width: 960px) and (max-height: 540px) {
    html { -webkit-text-size-adjust: 100%; }
    html, body { overflow-x: hidden; max-width: 100%; }
    body {
        padding: 6px 6px calc(70px + env(safe-area-inset-bottom, 0px));
        touch-action: manipulation;              /* bỏ trễ / phóng to khi chạm 2 lần */
        -webkit-tap-highlight-color: transparent;
    }
    .app-shell { gap: 6px; }

    /* ---- Thanh trên: gọn lại */
    .app-top-navbar { padding: 6px 8px; gap: 6px; flex-wrap: wrap; }
    .nav-left-group { gap: 6px; flex-wrap: wrap; width: 100%; min-width: 0; }
    .nav-profile-card { flex: 1 1 100%; min-width: 0; }
    .nav-trainer-name { font-size: 0.86rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
    .nav-pokedex-sub { font-size: 0.7rem; }
    .nav-acct-actions button { min-height: 28px; padding: 2px 8px; }
    .nav-currency-pills { flex: 1 1 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border: 0; padding: 0; margin: 0; }
    .nav-currency-pills::-webkit-scrollbar { display: none; }
    .nav-curr-pill { flex: 0 0 auto; padding: 4px 10px; font-size: 0.8rem; white-space: nowrap; }
    .nav-right-group { width: 100%; gap: 6px; flex-wrap: nowrap; min-width: 0; }
    .nav-env-pill { flex: 1 1 auto; min-width: 0; min-height: 38px; font-size: 0.74rem; padding: 4px 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .nav-donate-btn { display: none; }
    .nav-save-btn { flex: 0 0 auto; min-height: 38px; padding: 4px 10px; font-size: 0.72rem; white-space: nowrap; }
    .nav-icon-btn { flex: 0 0 auto; width: 38px; height: 38px; }
    .top-settings-drawer .settings-drawer-inner,
    .settings-controls-right { flex-direction: column; align-items: stretch; gap: 6px; }
    .settings-controls-right .btn-dash, .settings-controls-right .dash-select { width: 100%; min-height: 40px; }
    .pokeball-quick-bar { overflow-x: auto; }

    /* ---- Bố cục 1 cột: sân đấu lên đầu */
    .app-main-grid { display: flex; flex-direction: column; gap: 6px; }
    .app-center-column { order: 1; min-width: 0; width: 100%; gap: 6px; }
    .app-right-sidebar { order: 2; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: none; }
    .right-sidebar-card { width: 100%; max-width: none; }
    .right-consumables-grid, .right-spawns-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }

    /* ---- Menu trái -> ngăn kéo trượt từ trái */
    .app-left-sidebar {
        position: fixed; z-index: 150; top: 0; left: 0; bottom: 0;
        width: min(84vw, 320px); max-height: none; height: auto;
        border-radius: 0 14px 14px 0; overflow-y: auto; overscroll-behavior: contain;
        padding: 10px 10px calc(76px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-104%); transition: transform 0.22s ease;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
    }
    body.mobile-drawer-open .app-left-sidebar { transform: none; }
    body.mobile-drawer-open { overflow: hidden; }
    .mobile-drawer-backdrop { position: fixed; inset: 0; z-index: 140; background: rgba(3, 7, 18, 0.66); }
    body.mobile-drawer-open .mobile-drawer-backdrop { display: block; }
    .snav-item, .snav-subitem, .snav-group-header { min-height: 44px; }

    /* ---- Thanh lộ trình */
    .top-route-bar { padding: 6px 10px; gap: 2px 8px; flex-wrap: wrap; }
    .route-bar-title { order: 1; flex: 1 1 0; min-width: 0; max-width: none; width: auto; display: flex; align-items: baseline; gap: 8px; overflow: hidden; white-space: nowrap; }
    .route-bar-title > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    .route-bar-counter { order: 2; flex: 0 0 auto; font-size: 0.82rem; }
    .route-nodes-track { order: 3; flex: 1 1 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
    .route-nodes-track::-webkit-scrollbar { display: none; }

    /* ---- Sân đấu: vẽ ở khung ảo 540x460 rồi thu nhỏ vừa bề ngang */
    .stage-fit {
        display: block; position: relative; width: 100%; overflow: hidden;
        height: calc(460px * var(--stage-k, 0.7));
        max-width: 100%;
        border-radius: 12px;
    }
    .stage-fit > .pixel-scene-stage {
        position: absolute; top: 0; left: 0;
        width: var(--stage-w, 540px); height: 460px;
        transform: scale(var(--stage-k, 0.7)); transform-origin: 0 0;
        box-shadow: none;
    }
    /* chữ và nút trong sân đấu to lên để sau khi thu nhỏ vẫn đọc / bấm được */
    .stage-fit .white-dialogue-box { font-size: 1.12rem; line-height: 1.3; padding: 10px 14px; }
    .stage-fit .speed-control-pill .speed-btn { min-width: 52px; min-height: 48px; font-size: 1.1rem; }
    .stage-fit .top-left-pills .stage-home-pill { min-height: 44px; min-width: 48px; font-size: 1.05rem; padding: 6px 12px; }
    .stage-fit .gym-countdown-pill { font-size: 1.05rem; }

    /* ---- Nhật ký / bảng chức năng */
    .console-mini-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .console-mini-tabs::-webkit-scrollbar { display: none; }
    .console-mini-tabs .c-tab-btn { flex: 0 0 auto; min-height: 38px; white-space: nowrap; }
    .center-bottom-console { scroll-margin-top: 6px; }
    .center-bottom-console .dashboard-panel { padding: 10px; }
    .center-bottom-console .dashboard-panel:not(.console-log-panel) { max-height: none; overflow: visible; }
    .live-bottom-ticker { font-size: 0.72rem; }
    .ticker-left { min-width: 0; }
    .ticker-gold-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* ---- Cửa sổ: toàn màn hình, cuộn bên trong */
    .modal-backdrop { padding: 0; align-items: stretch; justify-content: stretch; }
    .modal-backdrop > * {
        width: 100% !important; max-width: none !important;
        height: 100dvh; max-height: 100dvh !important;
        border-radius: 0 !important; overflow-y: auto; overscroll-behavior: contain;
        padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    }
    #starter-modal, #catch-settings-modal { padding: 10px; align-items: center; }
    #starter-modal > *, #catch-settings-modal > * { height: auto; max-height: 92dvh !important; border-radius: 14px !important; padding-bottom: 12px; }
    .starter-grid { grid-template-columns: 1fr 1fr; }
    .pc-close-btn { min-width: 40px; min-height: 40px; }
    /* Phiên 147: bảng Info Pokémon — thanh tiêu đề dính trên cùng, nút ✕ / ← PC to dễ bấm */
    .sum-topbar, .pbd-head { position: sticky; top: 0; z-index: 6; }
    .sum-close-x, .pbd-close { min-width: 42px; min-height: 42px; font-size: 1.5rem; flex: none; }
    .sum-back-pc { min-height: 40px; font-size: .95rem; flex: none; }
    .pc-window-titlebar { position: sticky; top: 0; z-index: 6; flex-wrap: wrap; gap: 6px; }
    .map-modal-close { position: fixed; top: 6px; right: 6px; z-index: 120; }
    .map-modal-window .adv-green-header { padding-right: 56px; }

    /* ---- Kho PC: tìm kiếm + sắp xếp ở trên, danh sách Pokémon ngay dưới, công cụ thả xuống cuối */
    .pmp-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .pmp-slot { min-height: 88px; }
    .pmp-title small { display: none; }
    .pmp-title::after { content: ' — chạm 1 Pokémon để xem Info, đưa vào / ra khỏi đội'; font-weight: 500; color: #94a3b8; letter-spacing: 0; }
    .pc-storage-body { display: flex; flex-direction: column; gap: 8px; }
    .pc-left-sidebar { display: contents; }
    .pc-left-sidebar > * { order: 5; }
    .pc-left-sidebar > .pc-search-wrap { order: 1; }
    .pc-left-sidebar > .pc-sort-group { order: 2; flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
    .pc-left-sidebar > .pc-mode-mini-switch { order: 3; }
    .pc-storage-body > .pc-right-main { order: 4; }
    .pc-search-input { min-height: 40px; font-size: 16px; }   /* 16px: iOS không tự phóng to khi gõ */
    .pc-check-row { min-height: 34px; }

    /* ---- Pokédex */
    .dex-summary { padding: 12px; gap: 12px; }
    .dex-ring { width: 96px; height: 96px; }
    .dex-ring-inner { width: 72px; height: 72px; }
    input, select, textarea { font-size: 16px; }

    /* ---- Thông báo nổi: phía trên thanh đáy, không che nút */
    .toast-container { left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); align-items: stretch; pointer-events: none; }
    .toast-msg { font-size: 0.78rem; }

    /* ---- Thanh điều hướng đáy */
    .mobile-tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 160;
        background: rgba(17, 20, 31, 0.97); border-top: 1px solid #2b3147;
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    }
    .mobile-tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
        min-height: 52px; background: none; border: 0; border-radius: 10px;
        color: #94a3b8; font: 700 0.66rem 'Segoe UI', sans-serif; cursor: pointer;
    }
    .mobile-tabbar .mt-ico { font-size: 1.25rem; line-height: 1.1; }
    .mobile-tabbar button.on { color: #fde047; background: rgba(250, 204, 21, 0.1); }
    .mobile-tabbar button:active { background: rgba(148, 163, 184, 0.16); }
}

/* PHIÊN 49 — chữ MISS khi chiêu trượt */
.mv-eff-tag.miss { background: #e2e8f0; color: #0f172a; letter-spacing: 1px; font-weight: 900; }


/* PHIÊN 51 — Nhà trẻ & ấp trứng */
.dc-wrap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.dc-head .sc-desc { margin-top: 2px; }
.dc-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dc-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: #182032; border: 1px solid #2c3852; border-radius: 10px; }
.dc-slot img { width: 56px; height: 56px; image-rendering: pixelated; }
.dc-slot-info { display: flex; flex-direction: column; flex: 1 1 110px; min-width: 0; font-size: .8rem; }
.dc-slot-info em { color: #4ade80; font-style: normal; font-weight: 800; }
.dc-slot-info small { color: #94a3b8; }
.dc-slot.empty { flex-direction: column; justify-content: center; min-height: 74px; border-style: dashed; color: #64748b; font-weight: 700; font-size: .82rem; }
.dc-slot.empty small { font-weight: 500; }
.dc-talk { padding: 8px 12px; background: #f8fafc; color: #0f172a; border-radius: 10px; font-size: .84rem; font-weight: 600; }
.dc-talk.no { background: #e2e8f0; color: #475569; }
.dc-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-pick select { flex: 1 1 220px; min-width: 0; min-height: 34px; background: #0b1020; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 4px 8px; }
.dc-sub { font-weight: 800; font-size: .84rem; color: #fde68a; }
.dc-sub small { font-weight: 500; color: #94a3b8; }
.dc-waiting { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: #fde68a; }
.dc-eggs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.dc-egg { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #182032; border: 1px solid #2c3852; border-radius: 10px; font-size: .74rem; color: #cbd5e1; }
.dc-egg img { width: 40px; height: 40px; image-rendering: pixelated; flex: 0 0 auto; }
.dc-empty { font-size: .8rem; color: #64748b; }
@media (max-width: 760px) { .dc-slots { grid-template-columns: 1fr; } }


/* PHIÊN 52 — Trang Nhà trẻ (Ấp trứng) theo bố cục ảnh mẫu */
.daycare-backdrop { padding: 14px; }
.daycare-page { width: min(1600px, 97vw); max-height: 94vh; overflow-y: auto; padding: 4px; color: #e5e7eb; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; scrollbar-width: thin; }   /* Phiên 142: cùng font với màn hình walkthrough */
.dcp-frame { background: #2a1a2e; border: 2px solid #d9468f; border-radius: 16px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.dcp-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: linear-gradient(90deg, #c73d84, #e0589c); }
.dcp-title { font-size: 1.35rem; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.dcp-help { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #1f2937; color: #e5e7eb; font-size: .8rem; cursor: help; }
.dcp-status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: #fde68a; }
.dcp-status img { width: 30px; height: 30px; image-rendering: pixelated; }
.dcp-status.ok { color: #fef08a; }
.dcp-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: rgba(0,0,0,.25); color: #fff; font-size: 1rem; cursor: pointer; }
.dcp-body { display: grid; grid-template-columns: 290px minmax(0, 1fr) 260px; gap: 14px; padding: 14px; }
.dcp-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dcp-col-head { display: flex; justify-content: space-between; font-size: .72rem; letter-spacing: 1px; color: #cbd5e1; }
.dcp-slots, .dcp-incs { display: flex; flex-direction: column; gap: 8px; }
.dcp-slot, .dcp-inc { display: flex; align-items: center; gap: 10px; min-height: 80px; padding: 8px 12px; background: #1d1424; border: 2px solid #3b2a45; border-radius: 12px; color: #e5e7eb; text-align: left; font: inherit; }
.dcp-slot.filled { cursor: pointer; }
.dcp-slot.filled:hover { border-color: #f472b6; }
/* Phiên 141: 4 nút berry Nhà trẻ */
.dcp-berries { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dcp-berry { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 8px; background: #1d1424; border: 2px solid #3b2a45; border-radius: 10px; color: #e5e7eb; text-align: left; font: inherit; cursor: pointer; }
.dcp-berry:hover:not([disabled]) { border-color: #f472b6; }
.dcp-berry[disabled] { opacity: .45; cursor: not-allowed; }
.dcp-berry.on { border-color: #4ade80; background: #142a1d; }
.dcp-berry img { width: 28px; height: 28px; flex: none; image-rendering: pixelated; }
.dcp-berry-txt { display: flex; flex-direction: column; min-width: 0; }
.dcp-berry-txt strong { font-size: .72rem; line-height: 1.25; }
.dcp-berry-txt em { font-style: normal; color: #fbbf24; }
.dcp-berry-txt small { font-size: .62rem; color: #cbd5e1; line-height: 1.25; }
.dcp-berry.on small { color: #86efac; }
.dcp-slot img { width: 56px; height: 56px; image-rendering: pixelated; flex: 0 0 auto; }
.dcp-slot-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: .82rem; }
.dcp-slot-text em { color: #4ade80; font-style: normal; }
.dcp-slot-text small, .dcp-slot small { color: #94a3b8; font-size: .66rem; }
.dcp-slot.empty, .dcp-inc.empty { flex-direction: column; justify-content: center; gap: 6px; border-style: dashed; border-color: #5b4566; font-size: .82rem; }
.dcp-inc.empty { min-height: 54px; }
.dcp-slot.locked { flex-direction: column; justify-content: center; gap: 8px; font-size: .82rem; }
.dcp-unlock { padding: 7px 12px; border: 0; border-radius: 8px; background: #facc15; color: #1f1300; font: inherit; font-size: .72rem; cursor: pointer; box-shadow: 0 3px 0 #a16207; }
.dcp-inc.filled { gap: 8px; font-size: .68rem; color: #e2e8f0; min-height: 54px; }
.dcp-inc img { width: 40px; height: 40px; image-rendering: pixelated; flex: 0 0 auto; }
.dcp-yard { position: relative; aspect-ratio: 710 / 400; border-radius: 14px; overflow: hidden; background-size: cover; background-position: center bottom; image-rendering: auto; border: 2px solid #4a3556; }   /* Phiên 89: đúng tỉ lệ ảnh 710x400, vẽ mượt (ảnh vẽ thường, không phải pixel) */
.dcp-yard img, .dcp-yard canvas { image-rendering: pixelated; }   /* Pokémon / trứng trong sân vẫn nét kiểu pixel */
.dcp-pill { position: absolute; left: 14px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(15,23,42,.82); color: #fff; font-size: .74rem; }
#dcp-clock { top: 12px; }
.dcp-pill.talk { top: 44px; max-width: calc(100% - 28px); color: #fde68a; font-family: 'Segoe UI', sans-serif; font-weight: 700; }
.dcp-walkers { position: absolute; inset: 0; pointer-events: none; }
.dcp-walker { position: absolute; top: var(--y); left: 0; width: 64px; animation: dcp-walk var(--d) linear infinite alternate; animation-delay: var(--delay); }
.dcp-walker img { width: 64px; height: 64px; image-rendering: pixelated; animation: dcp-hop .6s ease-in-out infinite, dcp-face calc(var(--d) * 2) steps(1) infinite; animation-delay: 0s, var(--delay); filter: drop-shadow(0 4px 2px rgba(0,0,0,.35)); }
@keyframes dcp-walk { from { left: 6%; } to { left: calc(94% - 64px); } }
@keyframes dcp-hop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes dcp-face { 0% { scale: -1 1; } 50% { scale: 1 1; } }
.dcp-chips { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.dcp-chip { padding: 6px 10px; border-radius: 10px; background: rgba(15,23,42,.85); border: 1px solid #334155; color: #fff; font-size: .72rem; white-space: nowrap; }
.dcp-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.dcp-search { flex: 1 1 280px; min-width: 0; min-height: 38px; padding: 6px 12px; background: #1b2232; border: 1px solid #2b3550; border-radius: 10px; color: #e5e7eb; font: inherit; font-size: .8rem; }
.dcp-sel, .dcp-tog { min-height: 38px; padding: 6px 12px; background: #1b2232; border: 1px solid #2b3550; border-radius: 10px; color: #e5e7eb; font: inherit; font-size: .74rem; cursor: pointer; }
.dcp-tog.on { border-color: #facc15; color: #fde047; background: #2a2a1a; }
.dcp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; padding: 12px; background: #161b28; border: 1px solid #262f45; border-radius: 14px; }
.dcp-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 108px; padding: 6px; background: #1d2335; border: 2px solid #2b3550; border-radius: 12px; color: #fff; font: inherit; cursor: pointer; }
.dcp-card:hover { border-color: #f472b6; }
.dcp-card img { width: 72px; height: 72px; image-rendering: pixelated; }
.dcp-lv { font-size: .72rem; }
.dcp-lv b { color: #facc15; margin-right: 3px; }
.dcp-card.blocked { opacity: .45; cursor: not-allowed; }
.dcp-badge { position: absolute; top: 5px; left: 5px; padding: 1px 6px; border-radius: 999px; background: #7c3aed; font-size: .58rem; }
.dcp-none { grid-column: 1 / -1; padding: 20px; text-align: center; color: #64748b; }
@media (max-width: 1100px) { .dcp-body { grid-template-columns: 1fr 1fr; } .dcp-yard { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px), (max-width: 960px) and (max-height: 540px) {
    .daycare-backdrop { padding: 0; }
    .dcp-body { grid-template-columns: 1fr; padding: 10px; }
    .dcp-yard { min-height: 0; }
    .dcp-walker, .dcp-walker img { width: 48px; height: 48px; }
    .dcp-head { flex-wrap: wrap; padding: 8px 10px; }
    .dcp-title { font-size: 1.05rem; }
    .dcp-status { order: 3; width: 100%; margin-left: 0; }
    .dcp-close { margin-left: auto; }
    .dcp-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; padding: 8px; }
    .dcp-card { min-height: 90px; }
    .dcp-card img { width: 56px; height: 56px; }
}

/* PHIÊN 55 — nhãn cách học chiêu trong bảng chọn chiêu */
.mp-learn-tag { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #334155; color: #e2e8f0; font-size: .64rem; font-weight: 700; vertical-align: middle; }

/* PHIÊN 56 — điều khiển âm thanh trong ngăn cài đặt */
.sound-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sound-vol { display: inline-flex; align-items: center; gap: 6px; color: #cbd5e1; font-size: .8rem; }
.sound-vol input { width: 110px; accent-color: #facc15; }

/* Phiên 65: bộ lọc vùng trong Kho PC */
.pc-region-filter { display: flex; gap: 4px; margin: 2px 0 4px; }
.pc-region-btn { flex: 1; padding: 4px 6px; border-radius: 6px; border: 1px solid #475569; background: #1e293b; color: #cbd5e1; font-weight: 700; font-size: .72rem; cursor: pointer; }
.pc-region-btn.on { background: #2563eb; border-color: #93c5fd; color: #fff; }

/* Phiên 69: biểu tượng kẹo Rare Candy trong bảng Info */
.sum-candy-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 12px;
    border: 2px solid #a855f7; background: radial-gradient(circle at 50% 40%, #3b2a5c, #1e1533); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.sum-candy-icon:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 0 12px rgba(168, 85, 247, .6); }
.sum-candy-icon:active { transform: scale(.95); }
.sum-candy-icon img { width: 34px; height: 34px; image-rendering: pixelated; }
.sum-candy-icon.empty { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.sum-candy-count { position: absolute; right: -4px; bottom: -6px; min-width: 22px; padding: 0 4px; border-radius: 8px; background: #0f172a; border: 1px solid #a855f7; color: #f5d0fe; font-size: .68rem; font-weight: 800; line-height: 16px; text-align: center; }

/* Phiên 76: Pokémon bị khóa theo vùng (VD Pokémon Kanto khi đang ở Johto) — tối đen + dấu khóa */
.pc-slot-card.pc-region-locked { position: relative; }
.pc-slot-card.pc-region-locked .pc-slot-icon-box img:not(.pc-dex-ball) { filter: brightness(0) opacity(.55); }
.pc-slot-card.pc-region-locked { opacity: .7; }
.pc-slot-card.pc-region-locked .pc-slot-icon-box { position: relative; }
.pc-slot-card.pc-region-locked .pc-slot-icon-box::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.2rem; pointer-events: none; filter: drop-shadow(0 1px 2px #000); }

/* Phiên 81: cửa sổ Đội hình / Kho PC cao hơn màn hình thì cuộn được (trước bị cắt mất phần trên) */
#pokedex-modal .pc-storage-window { max-height: calc(100vh - 16px); overflow-y: auto; }
