/* Tutorial-specific styles */

/* Dim non-interactive elements during forced moves - ONLY player's elements */
.tutorial-forced #player-hand .card:not(.tutorial-allowed) {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
}

.tutorial-forced #player-board .card:not(.tutorial-allowed) {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
}

.tutorial-forced #end-turn-btn:not(.tutorial-allowed) {
    opacity: 0.4;
    pointer-events: none;
}

.tutorial-forced #undo-btn {
    opacity: 0.4;
    pointer-events: none;
}

/* Dim other potential attack targets during forced attack step */
.tutorial-attack-portrait #player-portrait {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
}

.tutorial-attack-portrait #opponent-board .card {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
}

.tutorial-attack-portrait #player-deck,
.tutorial-attack-portrait #opponent-deck,
.tutorial-attack-portrait #player-deck-wrapper,
.tutorial-attack-portrait #opponent-deck-wrapper,
.tutorial-attack-portrait #opponent-hand .card {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
}

/* Also dim hitboxes during attack step */
.tutorial-attack-portrait .portrait-hitbox {
    pointer-events: none !important;
}

/* Re-enable only the opponent portrait hitbox */
.tutorial-attack-portrait #opponent-portrait-hitbox {
    pointer-events: auto !important;
}

/* Ensure the highlighted target stays visible */
.tutorial-attack-portrait #opponent-portrait.tutorial-highlight {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* Highlight for elements being referenced in tutorial tips */
.tutorial-highlight {
    animation: tutorial-highlight-pulse 1.5s ease-in-out infinite;
    position: relative;
    z-index: 100;
}

.tutorial-highlight::after {
    content: '';
    position: absolute;
    inset: -0.5vmin;
    border: 2px solid #ffd700;
    border-radius: inherit;
    pointer-events: none;
    animation: tutorial-highlight-border 1.5s ease-in-out infinite;
}

/* Don't show highlight border on container elements */
#player-hand.tutorial-highlight::after,
#opponent-hand.tutorial-highlight::after,
#player-board.tutorial-highlight::after,
#opponent-board.tutorial-highlight::after {
    display: none;
}

@keyframes tutorial-highlight-pulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

@keyframes tutorial-highlight-border {

    0%,
    100% {
        box-shadow: 0 0 1vmin 0.3vmin rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 2vmin 0.6vmin rgba(255, 215, 0, 0.7);
    }
}

/* Special stronger highlight for opponent portrait (attack target) */
#opponent-portrait.tutorial-highlight {
    animation: tutorial-attack-target-pulse 1s ease-in-out infinite;
}

#opponent-portrait.tutorial-highlight::after {
    border: 3px solid #ff6b6b;
    border-radius: 50%;
    inset: -1vmin;
    animation: tutorial-attack-target-border 1s ease-in-out infinite;
}

@keyframes tutorial-attack-target-pulse {

    0%,
    100% {
        filter: brightness(1) drop-shadow(0 0 1vmin rgba(255, 100, 100, 0.5));
    }

    50% {
        filter: brightness(1.4) drop-shadow(0 0 2vmin rgba(255, 100, 100, 0.8));
    }
}

@keyframes tutorial-attack-target-border {

    0%,
    100% {
        box-shadow: 0 0 1.5vmin 0.5vmin rgba(255, 100, 100, 0.5);
    }

    50% {
        box-shadow: 0 0 3vmin 1vmin rgba(255, 100, 100, 0.9);
    }
}

/* Tutorial tip tooltip */
.tutorial-tip {
    position: fixed;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(238, 219, 241, 0.5);
    border-radius: 1vmin;
    padding: 1.8vmin 2.2vmin;
    max-width: 40vmin;
    color: #eedbf1;
    font-size: 1.8vmin;
    line-height: 1.5;
    z-index: 10000;
    box-shadow: 0 0.5vmin 2vmin rgba(0, 0, 0, 0.5);
    animation: tutorial-tip-appear 0.3s ease-out;
}

.tutorial-tip::before {
    content: '💡';
    margin-right: 0.8vmin;
}

.tutorial-tip strong {
    color: #a8e6cf;
}

.tutorial-tip-dismiss {
    display: block;
    margin-top: 1.2vmin;
    padding: 0.6vmin 1.2vmin;
    background: rgba(238, 219, 241, 0.15);
    border: 1px solid rgba(238, 219, 241, 0.3);
    border-radius: 0.5vmin;
    color: rgba(238, 219, 241, 0.9);
    font-size: 1.4vmin;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.tutorial-tip-dismiss:hover {
    background: rgba(238, 219, 241, 0.25);
}

@keyframes tutorial-tip-appear {
    from {
        opacity: 0;
        transform: translateY(1vmin);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tutorial tip positioning helpers - JS calculates exact positions */
.tutorial-tip.position-above {
    transform-origin: bottom center;
}

.tutorial-tip.position-left {
    transform-origin: right center;
}

.tutorial-tip.position-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Skip tutorial button */
#skip-tutorial-btn {
    position: fixed;
    top: 1.5vmin;
    right: 1.5vmin;
    padding: 0.8vmin 1.5vmin;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(238, 219, 241, 0.4);
    border-radius: 0.5vmin;
    color: rgba(238, 219, 241, 0.8);
    font-size: 1.4vmin;
    cursor: pointer;
    z-index: 9999;
    transition: background 0.2s, border-color 0.2s;
}

#skip-tutorial-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(238, 219, 241, 0.6);
}

/* Panel subtitle for lobby */
.panel-subtitle {
    font-size: 1.4vmin;
    color: rgba(238, 219, 241, 0.6);
    margin: 0.5vmin 0 1.5vmin;
    font-weight: normal;
}

/* Highlight pulse for allowed elements during forced moves */
.tutorial-allowed {
    animation: tutorial-pulse 2s ease-in-out infinite;
}

@keyframes tutorial-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(168, 230, 207, 0.4);
    }

    50% {
        box-shadow: 0 0 1.5vmin 0.5vmin rgba(168, 230, 207, 0.6);
    }
}

/* Arrow indicator for drag hints */
.tutorial-arrow {
    position: fixed;
    width: 4vmin;
    height: 4vmin;
    pointer-events: none;
    z-index: 9998;
    animation: tutorial-arrow-bounce 1s ease-in-out infinite;
}

@keyframes tutorial-arrow-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-1vmin);
    }
}