:root {
    --primary-color: #ffcb05;
    --secondary-color: #3b4cca;
    --accent-color: #ff5050;
    --text-color: #333;
    --card-bg: #fff;
    --card-back: #3b4cca;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'ZCOOL KuaiLe', 'Comic Sans MS', cursive, sans-serif;
    background-color: #f0f8ff;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Screen Management */
.screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen.hidden {
    display: none;
}

/* Mode Selector */
.mode-selector-container {
    width: 95vw;
    max-width: 1200px;
    height: 95vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 5px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6vh;
    padding: 4vh 4vw;
}

.mode-title {
    color: var(--secondary-color);
    font-size: 8vh;
    text-shadow: 3px 3px 0 var(--primary-color);
}

.mode-buttons {
    display: flex;
    gap: 3vw;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    width: 26vw;
    max-width: 350px;
    height: 28vh;
    border: 5px solid;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2vh;
    transition: transform 0.15s, box-shadow 0.15s;
}

.mode-btn:active {
    transform: scale(0.95);
}

.mode-icon {
    font-size: 10vh;
}

.mode-label {
    font-size: 3.5vh;
    font-weight: bold;
}

.mode-btn-memory {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    border-color: #1B5E20;
    color: white;
    box-shadow: 0 8px 0 #1B5E20;
}

.mode-btn-memory:active {
    box-shadow: 0 2px 0 #1B5E20;
    transform: translateY(6px) scale(0.98);
}

.mode-btn-battle {
    background: linear-gradient(135deg, #ff5050, #cc0000);
    border-color: #990000;
    color: white;
    box-shadow: 0 8px 0 #990000;
}

.mode-btn-battle:active {
    box-shadow: 0 2px 0 #990000;
    transform: translateY(6px) scale(0.98);
}

.mode-btn-collection {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    border-color: #E65100;
    color: white;
    box-shadow: 0 8px 0 #E65100;
}

.mode-btn-collection:active {
    box-shadow: 0 2px 0 #E65100;
    transform: translateY(6px) scale(0.98);
}

/* Game Container (shared) */
.game-container {
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 1vh 2vw;
    border: 5px solid var(--primary-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 10vh;
    margin-bottom: 1vh;
    padding: 0 1vw;
}

h1 {
    color: var(--secondary-color);
    font-size: 5vh;
    text-shadow: 2px 2px 0 var(--primary-color);
}

.stats-bar {
    display: flex;
    gap: 20px;
    align-items: center;
}

#score {
    font-size: 4vh;
    color: var(--text-color);
    font-weight: bold;
}

#restart-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 1vh 2vw;
    font-size: 3vh;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 0 #cc0000;
    transition: transform 0.1s;
}

#restart-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #cc0000;
}

/* Game Board - Grid Layout */
.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 0.8vh;
    width: 100%;
    height: 82vh;
    padding: 0.5vh;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 10px;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card:active:not(.flipped):not(.matched) {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.card.matched {
    animation: matchCelebrate 0.5s ease;
}

.card.matched .card-face.card-front {
    box-shadow: 0 0 15px 5px rgba(255, 203, 5, 0.6);
    border-color: var(--primary-color);
    transition: box-shadow 0.3s, border-color 0.3s;
}

.card.wrong {
    animation: shake 0.4s ease;
}

.card.wrong .card-face.card-front {
    box-shadow: 0 0 10px 3px rgba(255, 80, 80, 0.5);
    border-color: var(--accent-color);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid #eee;
    background: white;
}

.card-front {
    background-color: var(--card-bg);
    transform: rotateY(180deg);
}

.card-back {
    background-color: var(--card-back);
    background-image:
        radial-gradient(#fff 20%, transparent 20%),
        radial-gradient(#fff 20%, transparent 20%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-back::after {
    content: '';
    width: 40%;
    height: 40%;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 4px solid #222;
    box-shadow: inset 0 0 0 3px white;
}

.card-content {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.card.dealing {
    animation: dealIn 0.35s ease backwards;
}

/* Victory Modal */
#victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

#victory-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    padding: 5vh 5vw;
    border-radius: 20px;
    text-align: center;
    border: 5px solid var(--primary-color);
    box-shadow: 0 0 50px var(--primary-color);
    animation: bounceIn 0.5s;
    max-width: 80vw;
}

.modal-content h2 {
    font-size: 6vh;
    color: var(--secondary-color);
    margin-bottom: 2vh;
}

.stars {
    font-size: 8vh;
    color: var(--primary-color);
    margin-bottom: 3vh;
    letter-spacing: 2vw;
}

#play-again-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 2vh 5vw;
    font-size: 4vh;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 0 #2E7D32;
}

#play-again-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #2E7D32;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* =========================
   BATTLE SHARED STYLES
   ========================= */

.battle-nav-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8vh 2vw;
    font-size: 2.5vh;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 3px 0 #1a237e;
    transition: transform 0.1s;
}

.battle-nav-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 #1a237e;
}

/* VS Badge */
.vs-badge {
    font-size: 5vh;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 2px 2px 0 var(--primary-color);
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.battle-action-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 1.5vh 4vw;
    font-size: 3vh;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 5px 0 #2E7D32;
    transition: transform 0.1s;
}

.battle-action-btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #2E7D32;
}

.battle-action-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.battle-menu-action {
    background-color: var(--secondary-color);
    box-shadow: 0 5px 0 #1a237e;
}

.battle-menu-action:active {
    box-shadow: 0 1px 0 #1a237e;
}

.type-badge {
    font-size: 1.6vh;
    padding: 0.3vh 1.2vw;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

.type-fire { background: #f08030; }
.type-water { background: #6890f0; }
.type-grass { background: #78c850; }
.type-normal { background: #a8a878; }

/* Battle Result Modal */
.battle-result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.battle-result-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.battle-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
}

.battle-modal-buttons {
    display: flex;
    gap: 3vw;
    margin-top: 2vh;
}

/* =========================
   TEAM PICKER STYLES
   ========================= */

.team-picker-container {
    padding: 1.5vh 2vw;
}

.team-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 7vh;
    margin-bottom: 1vh;
    padding: 0 1vw;
}

.team-picker-title {
    font-size: 4.5vh;
    color: var(--secondary-color);
    text-shadow: 2px 2px 0 var(--primary-color);
}

.team-counter {
    font-size: 3.5vh;
    font-weight: bold;
    color: var(--accent-color);
    background: #fff3e0;
    padding: 0.5vh 2vw;
    border-radius: 15px;
    border: 3px solid var(--accent-color);
}

.team-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5vh 1.5vw;
    width: 100%;
    flex: 1;
    padding: 0.5vh;
    overflow-y: auto;
}

.team-card {
    border-radius: 12px;
    border: 3px solid #ccc;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5vh;
    padding: 1vh 0.5vw;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 16vh;
}

.team-card:active:not(.locked) {
    transform: scale(0.95);
}

.team-card.selected {
    border-color: var(--primary-color) !important;
    border-width: 4px;
    box-shadow: 0 0 15px rgba(255, 203, 5, 0.6);
    background: #fffde7;
}

.team-card.locked {
    background: #e0e0e0;
    border-color: #bdbdbd;
    cursor: default;
}

.locked-icon {
    font-size: 6vh;
    color: #9e9e9e;
    font-weight: bold;
}

.team-card-sprite {
    width: 65%;
    height: auto;
    max-height: 9vh;
    object-fit: contain;
}

.team-card-name {
    font-size: 2vh;
    font-weight: bold;
    color: var(--text-color);
}

.team-card-info {
    display: flex;
    gap: 0.8vw;
    align-items: center;
}

.team-card-hp {
    font-size: 1.8vh;
    font-weight: bold;
    color: var(--accent-color);
}

.team-card-check {
    position: absolute;
    top: 0.5vh;
    right: 0.5vw;
    width: 3.5vh;
    height: 3.5vh;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2vh;
    font-weight: bold;
    color: white;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.team-picker-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1.5vh 0;
}

.start-battle-btn {
    font-size: 4vh !important;
    padding: 2vh 8vw !important;
}

/* =========================
   HP BATTLE SCREEN STYLES
   ========================= */

.hp-battle-container {
    padding: 1vh 2vw;
    justify-content: space-between;
}

.hp-battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 5vh;
    padding: 0 1vw;
}

.team-dots-area {
    display: flex;
    gap: 3vw;
    align-items: center;
}

.team-dots {
    display: flex;
    gap: 0.8vw;
}

.team-dot {
    width: 2vh;
    height: 2vh;
    border-radius: 50%;
    background: #4CAF50;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: background 0.3s;
}

.team-dot.fainted {
    background: #bdbdbd;
    opacity: 0.5;
}

.cpu-dots .team-dot {
    background: #f44336;
}

.cpu-dots .team-dot.fainted {
    background: #bdbdbd;
}

/* HP Pokemon Display */
.hp-pokemon-display {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5vh;
    padding: 0.5vh 2vw;
}

.hp-pokemon-display.cpu-side {
    flex-direction: column;
}

.hp-pokemon-display.player-side {
    flex-direction: column;
}

.hp-pokemon-info {
    display: flex;
    align-items: center;
    gap: 1.5vw;
}

.hp-pokemon-name {
    font-size: 3vh;
    font-weight: bold;
    color: var(--text-color);
}

.hp-bar-container {
    width: 60%;
    max-width: 400px;
    height: 2.5vh;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #bdbdbd;
}

.hp-bar-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 15px;
    transition: width 0.6s ease, background 0.3s;
}

.hp-text {
    font-size: 2vh;
    color: var(--text-color);
    font-weight: bold;
}

.hp-sprite-area {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hp-pokemon-sprite {
    width: 18vh;
    height: 18vh;
    object-fit: contain;
    transition: transform 0.3s;
    animation: idleBounce 3s ease-in-out infinite;
}

.hp-vs-badge {
    font-size: 3.5vh;
    margin: 0;
    padding: 0;
}

/* Sprite Animations */
.sprite-attack {
    animation: spriteAttackForward 0.3s ease forwards;
}

.sprite-hit {
    animation: spriteHit 0.4s ease;
}

.sprite-faint {
    animation: spriteFaint 0.5s ease forwards;
}

.sprite-switch-in {
    animation: spriteSwitchIn 0.4s ease;
}

/* Damage Callout */
.damage-callout {
    position: absolute;
    font-size: 3.5vh;
    font-weight: bold;
    animation: calloutPop 0.6s ease forwards;
    z-index: 10;
    pointer-events: none;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.damage-callout.hidden {
    display: none;
}

.damage-callout.super-effective {
    color: #4CAF50;
    font-size: 4.5vh;
}

.damage-callout.not-effective {
    color: #f44336;
    font-size: 2.5vh;
}

.damage-callout.neutral-hit {
    color: white;
}

/* Screen Shake */
.screen-shake {
    animation: screenShake 0.4s ease;
}

/* Type Triangle Helper */
.type-triangle-helper {
    font-size: 2.5vh;
    text-align: center;
    padding: 0.5vh 2vw;
    background: #f5f5f5;
    border-radius: 10px;
    color: var(--text-color);
    font-weight: bold;
    letter-spacing: 0.3vw;
}

.tri-fire { color: #f08030; }
.tri-water { color: #6890f0; }
.tri-grass { color: #78c850; }

/* =========================
   COLLECTION SCREEN STYLES
   ========================= */

.collection-container {
    padding: 1.5vh 2vw;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 7vh;
    margin-bottom: 1vh;
    padding: 0 1vw;
}

.collection-title {
    font-size: 4.5vh;
    color: var(--secondary-color);
    text-shadow: 2px 2px 0 var(--primary-color);
}

.win-streak-display {
    font-size: 3vh;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5vh 1.5vw;
    width: 100%;
    flex: 1;
    padding: 0.5vh;
    overflow-y: auto;
}

.collection-card {
    border-radius: 12px;
    border: 3px solid #ccc;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5vh;
    padding: 1vh 0.5vw;
    position: relative;
    min-height: 16vh;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.collection-card.collection-locked {
    background: #e0e0e0;
    border-color: #bdbdbd;
}

.collection-card.collection-sticker {
    box-shadow: 0 0 12px rgba(255, 203, 5, 0.5);
}

.collection-silhouette {
    font-size: 6vh;
    color: #9e9e9e;
    font-weight: bold;
}

.collection-card-sprite {
    width: 65%;
    height: auto;
    max-height: 9vh;
    object-fit: contain;
}

.collection-card-name {
    font-size: 2vh;
    font-weight: bold;
    color: var(--text-color);
}

.collection-card-info {
    display: flex;
    gap: 0.8vw;
    align-items: center;
}

.collection-card-hp {
    font-size: 1.8vh;
    font-weight: bold;
    color: var(--accent-color);
}

.sticker-badge {
    position: absolute;
    top: 0.5vh;
    right: 0.5vw;
    font-size: 2.5vh;
}

/* Battle Sticker in result modal */
.battle-sticker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
    animation: stickerReveal 0.6s ease;
}

.battle-sticker.hidden {
    display: none;
}

.sticker-sprite {
    width: 15vh;
    height: 15vh;
    object-fit: contain;
}

.sticker-text {
    font-size: 3vh;
    color: var(--primary-color);
    font-weight: bold;
}

.battle-streak {
    font-size: 3vh;
    color: var(--primary-color);
    font-weight: bold;
}

/* Unlock Notification */
.unlock-notification {
    position: fixed;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 4px solid var(--primary-color);
    border-radius: 15px;
    padding: 2vh 3vw;
    display: flex;
    align-items: center;
    gap: 2vw;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 10002;
    animation: slideUpIn 0.5s ease;
}

.unlock-notification.unlock-notif-fade {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
}

.unlock-notif-sprite {
    width: 8vh;
    height: 8vh;
    object-fit: contain;
}

.unlock-notif-text {
    font-size: 2.5vh;
    color: var(--text-color);
    font-weight: bold;
}

/* =========================
   BATTLE LOBBY STYLES
   ========================= */

.lobby-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4vh;
    width: 100%;
}

.lobby-panel.hidden {
    display: none;
}

.lobby-back-btn {
    margin-top: 2vh;
    font-size: 3vh !important;
    padding: 1.5vh 4vw !important;
}

/* Room code display */
.lobby-room-code {
    font-size: 14vh;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--secondary-color);
    letter-spacing: 3vw;
    text-shadow: 3px 3px 0 var(--primary-color);
    background: #f0f8ff;
    padding: 2vh 6vw;
    border-radius: 20px;
    border: 4px solid var(--primary-color);
}

.lobby-status-text {
    font-size: 4vh;
    color: var(--text-color);
    font-weight: bold;
}

/* Waiting animation */
.lobby-waiting {
    font-size: 3.5vh;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 1.5vw;
    animation: lobbyPulse 2s ease-in-out infinite;
}

.lobby-waiting-dot {
    width: 2vh;
    height: 2vh;
    border-radius: 50%;
    background: #4CAF50;
    animation: lobbyDotPulse 1.5s ease-in-out infinite;
}

@keyframes lobbyPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes lobbyDotPulse {
    0%, 100% { transform: scale(1); background: #4CAF50; }
    50% { transform: scale(1.3); background: #66BB6A; }
}

/* Join room input */
.lobby-code-input {
    font-size: 10vh;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
    width: 40vw;
    max-width: 400px;
    padding: 2vh 3vw;
    border: 4px solid var(--secondary-color);
    border-radius: 20px;
    color: var(--secondary-color);
    letter-spacing: 2vw;
    outline: none;
    background: #f0f8ff;
}

.lobby-code-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 203, 5, 0.4);
}

.lobby-connect-btn {
    font-size: 3.5vh !important;
    padding: 2vh 6vw !important;
}

.lobby-join-status {
    font-size: 2.5vh;
    color: var(--accent-color);
    min-height: 3vh;
    font-weight: bold;
}

/* =========================
   ANIMATIONS
   ========================= */

@keyframes dealIn {
    0% {
        opacity: 0;
        transform: scale(0) rotateZ(180deg);
    }
    80% {
        transform: scale(1.05) rotateZ(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateZ(0deg);
    }
}

@keyframes matchCelebrate {
    0% { transform: rotateY(180deg) scale(1); }
    30% { transform: rotateY(180deg) scale(1.15); }
    60% { transform: rotateY(180deg) scale(0.95); }
    100% { transform: rotateY(180deg) scale(1); }
}

@keyframes shake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    20%, 60% { transform: rotateY(180deg) translateX(-8px); }
    40%, 80% { transform: rotateY(180deg) translateX(8px); }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* HP Battle Sprite Animations */
@keyframes idleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes spriteAttackForward {
    0% { transform: translateY(0); }
    40% { transform: translateY(-15px) scale(1.1); }
    100% { transform: translateY(0); }
}

@keyframes spriteHit {
    0% { opacity: 1; filter: brightness(1); }
    15% { opacity: 0.3; filter: brightness(3); }
    30% { opacity: 1; filter: brightness(1); }
    45% { opacity: 0.3; filter: brightness(3); }
    60% { opacity: 1; filter: brightness(1); }
    100% { opacity: 1; filter: brightness(1); }
}

@keyframes spriteFaint {
    0% { transform: translateY(0); opacity: 1; }
    30% { transform: translateY(-10px); opacity: 0.8; }
    100% { transform: translateY(30px) scale(0.5); opacity: 0; }
}

@keyframes spriteSwitchIn {
    0% { transform: scale(0) translateY(20px); opacity: 0; }
    60% { transform: scale(1.15) translateY(-5px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes calloutPop {
    0% { transform: scale(0.5) translateY(0); opacity: 0; }
    30% { transform: scale(1.3) translateY(-10px); opacity: 1; }
    100% { transform: scale(1) translateY(-20px); opacity: 0.8; }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-6px); }
    20% { transform: translateX(6px); }
    30% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    50% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    70% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

@keyframes stickerReveal {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(-10deg); opacity: 1; }
    70% { transform: scale(0.95) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes slideUpIn {
    0% { transform: translateX(-50%) translateY(50px); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* =========================
   ONLINE WAITING OVERLAY
   ========================= */

/* =========================
   SWITCH POKEMON OVERLAY
   ========================= */

.switch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.switch-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.switch-overlay-content {
    background: white;
    border-radius: 20px;
    padding: 3vh 4vw;
    border: 5px solid var(--primary-color);
    box-shadow: 0 0 40px var(--primary-color);
    max-width: 80vw;
    text-align: center;
}

.switch-overlay-title {
    font-size: 5vh;
    color: var(--secondary-color);
    text-shadow: 2px 2px 0 var(--primary-color);
    margin-bottom: 2vh;
}

.switch-pokemon-list {
    display: flex;
    gap: 3vw;
    justify-content: center;
    flex-wrap: wrap;
}

.switch-card {
    border-radius: 12px;
    border: 3px solid #ccc;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5vh;
    padding: 1.5vh 2vw;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    min-width: 18vw;
    min-height: 18vh;
}

.switch-card:active {
    transform: scale(0.95);
}

.switch-card:hover {
    box-shadow: 0 0 15px rgba(255, 203, 5, 0.5);
    border-color: var(--primary-color);
}

.switch-card-sprite {
    width: 10vh;
    height: 10vh;
    object-fit: contain;
}

.switch-card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3vh;
}

.switch-card-name {
    font-size: 2.2vh;
    font-weight: bold;
    color: var(--text-color);
}

.switch-card-hp {
    font-size: 1.8vh;
    font-weight: bold;
    color: var(--accent-color);
}

/* =========================
   ONLINE WAITING OVERLAY
   ========================= */

.online-waiting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.online-waiting-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.online-waiting-content {
    text-align: center;
    color: white;
    font-size: 4vh;
    font-weight: bold;
}
