/**
 * tutorial.css
 */

.tutorial-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    z-index: 12000;
    pointer-events: none;
    display: none;
    overflow: hidden;
}

/* Centered Speech Bubble Styles */
.tutorial-bubble {
    position: absolute;
    left: 50%;
    top: 50% !important; /* Forced to middle */
    transform: translate(-50%, -50%);
    background: var(--panel-bg);
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 20px; /* Equal padding on all sides */
    width: 80%; /* ~25% reduction */
    max-width: 350px; /* ~25% reduction */
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
    z-index: 10002;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Universal middle alignment override */
.bubble-middle, .bubble-low, .bubble-high {
    top: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
}

/* Downward pointing arrow */
.tutorial-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 10px 0 10px;
    border-color: #FFD700 transparent transparent transparent;
}

/* Bias arrow towards Rae's side */
.bubble-left::after {
    left: 20%;
    transform: translateX(-50%);
}

.bubble-right::after {
    left: 80%;
    transform: translateX(-50%);
}

.tutorial-text {
    font-size: 1.0em; /* ~25% reduction */
    color: white;
    line-height: 1.4;
    margin-bottom: 0; /* Managed by parent gap or action margin */
    text-align: center;
    font-weight: 500;
    white-space: pre-wrap; /* Ensure \n results in a line break */
}

.tutorial-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Add the uniform gap if there's a button present */
.tutorial-actions:has(.tutorial-btn) {
    margin-top: 20px;
}

.tutorial-btn {
    padding: 8px 16px;
    background: var(--tutorial-action);
    color: black;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

/**
 * Global Variable Flipping
 * ONLY catch --primary-btn to ensure HUD buttons are deprioritized.
 * --primary (UI elements like text, borders, labels) stays blue.
 */
body.tutorial-active {
    --primary-btn: var(--primary-deprioritize) !important;
    --primary-glow: transparent !important;
}

.tutorial-target-click, .tutorial-target, .tutorial-target-silver {
    --primary-btn: var(--primary-blue) !important;
}

/**
 * Trainer Rae Styles
 */
.trainer-container {
    position: absolute;
    bottom: 0 !important; /* Pin to baseline */
    z-index: 10001;
    pointer-events: none;
    height: 50dvh; /* Character height scale */
    width: 50vw;  /* Wide enough for mobile portrait corners */
}

.trainer-left {
    left: 0;
}

.trainer-right {
    right: 0;
}

.trainer-container.flipped {
    transform: scaleX(-1);
}

.trainer-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom left; /* Pinned to outer corner */
}

@keyframes tutorial-pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

@keyframes tutorial-pulse-silver {
    0% { box-shadow: 0 0 0 0 rgba(200, 200, 200, 0.8); }
    70% { box-shadow: 0 0 0 20px rgba(200, 200, 200, 0); }
    100% { box-shadow: 0 0 0 0 rgba(200, 200, 200, 0); }
}

@keyframes tutorial-pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(68, 187, 255, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(68, 187, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(68, 187, 255, 0); }
}

/* BLUE AURA */
.tutorial-target {
    animation: tutorial-pulse-blue 1.5s infinite;
    border-radius: 6px;
    cursor: default !important;
}

/* SILVER AURA */
.tutorial-target-silver {
    animation: tutorial-pulse-silver 1.5s infinite;
    border-radius: 6px;
    cursor: default !important;
}

/* GOLD AURA */
.tutorial-target-click {
    animation: tutorial-pulse-gold 1.5s infinite;
    border-radius: 6px;
    cursor: pointer !important;
}
