/* Shared hint trigger, tooltip, and pulse treatments. */

.game-hud-hint-wrap.hidden {
    display: none;
}

.game-hud-hint-wrap {
    /* Shared hint trigger shell used in the game HUD, composer, and examples. */
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: help;
    user-select: none;
    white-space: normal;
}

.game-hud-hint-wrap:focus {
    outline: 1px solid #8fa8f0;
    outline-offset: 1px;
}

.game-hud-hint-icon {
    /* The visible hint circle lives on the icon element itself so pulse/glow
       can be shared and parameterized without affecting surrounding layout. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 1px solid var(--color-text);
    border-radius: 999px;
    background: transparent;
    box-sizing: border-box;
    line-height: 1;
}

.game-hud-hint-tooltip {
    /* Base desktop popup styling. Mobile viewport-fit behavior is applied by
       `game_hint_toggle.js`. */
    position: absolute;
    left: 0.45rem;
    top: calc(100% + 0.4rem);
    transform: none;
    width: min(420px, 78vw);
    padding: 0.5rem 0.6rem;
    border: 1px solid #d3d3d3;
    border-radius: 6px;
    background: var(--color-box-bg);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.45;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 130;
    white-space: normal;
    box-sizing: border-box;
}

.game-hud-hint-overlay {
    position: fixed;
    left: 0;
    top: 0;
    display: none;
    z-index: 1400;
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    box-sizing: border-box;
}

.game-hud-hint-overlay.is-visible {
    display: block;
}

.game-hud-hint-divider {
    display: block;
    height: 1px;
    background: #e0e0e0;
    margin: 0.5rem 0 0.4rem;
}

.game-hud-hint-tip-label {
    display: block;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.game-hud-hint-categories {
    display: block;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
}

.game-hud-hint-list {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    color: var(--color-text);
    font-family: inherit;
}

.game-hud-hint-list li {
    margin: 0.15rem 0 0;
}

.game-hud-hint-nav-link {
    font-family: inherit;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.14em;
    cursor: default;
}

@media (max-width: 900px) {
    .game-hud-hint-tooltip,
    .game-hud-hint-categories,
    .game-hud-hint-nav-link {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .game-hud-hint-list {
        padding-left: 1rem;
    }
}

.game-hud-hint-wrap.is-open .game-hud-hint-tooltip,
.game-hud-hint-wrap.is-peeking .game-hud-hint-tooltip {
    opacity: 1;
    visibility: visible;
}

.game-hud-hint-wrap:hover,
.game-hud-hint-wrap:focus,
.game-hud-hint-wrap:focus-within {
    z-index: 1101;
}

.composer-hint-pulse .game-hud-hint-icon,
.daily-hint-pulse .game-hud-hint-icon {
    /* Shared pulse implementation: keep palette/shape shared and tune only
       count/intensity variables per use case. */
    --hint-pulse-color: var(--color-hint-pulse);
    --hint-pulse-shadow-rgb: var(--color-hint-pulse-rgb);
    --hint-pulse-border-color: #8c8c8c;
    --hint-pulse-background: transparent;
    --hint-pulse-ring-shadow: 0 0 0 0 rgba(var(--hint-pulse-shadow-rgb), 0);
    animation-name: hint-icon-pulse;
    animation-duration: var(
        --hint-pulse-duration,
        var(--pulse-cycle-duration, 1.25s)
    );
    animation-timing-function: ease-out;
    animation-iteration-count: var(--hint-pulse-count, 1);
}

.composer-hint-pulse .game-hud-hint-icon {
    --hint-pulse-duration: var(--pulse-cycle-duration, 1.25s);
    --hint-pulse-count: 1;
    --hint-pulse-border-color: var(--color-hint-pulse-border);
    --hint-pulse-background: rgba(var(--hint-pulse-shadow-rgb), 0.08);
    --hint-pulse-ring-shadow:
        0 0 0 2px rgba(var(--hint-pulse-shadow-rgb), 0.22),
        0 0 14px 4px rgba(var(--hint-pulse-shadow-rgb), 0.3);
    --hint-pulse-drop-shadow: 0 0 2px rgba(var(--hint-pulse-shadow-rgb), 0.55);
    --hint-pulse-text-shadow:
        0 0 6px rgba(var(--hint-pulse-shadow-rgb), 0.78),
        0 0 14px rgba(var(--hint-pulse-shadow-rgb), 0.62),
        0 0 26px rgba(var(--hint-pulse-shadow-rgb), 0.48);
}

.daily-hint-pulse .game-hud-hint-icon {
    --hint-pulse-duration: var(--pulse-cycle-duration, 1.25s);
    --hint-pulse-count: 3;
    --hint-pulse-border-color: var(--color-hint-pulse-border);
    --hint-pulse-background: rgba(var(--hint-pulse-shadow-rgb), 0.14);
    --hint-pulse-ring-shadow:
        0 0 0 3px rgba(var(--hint-pulse-shadow-rgb), 0.34),
        0 0 22px 8px rgba(var(--hint-pulse-shadow-rgb), 0.42);
    --hint-pulse-drop-shadow: 0 0 18px rgba(var(--hint-pulse-shadow-rgb), 1);
    --hint-pulse-text-shadow:
        0 0 22px rgba(var(--hint-pulse-shadow-rgb), 1),
        0 0 52px rgba(var(--hint-pulse-shadow-rgb), 0.92),
        0 0 78px rgba(var(--hint-pulse-shadow-rgb), 0.74);
}

@keyframes hint-icon-pulse {
    0% {
        color: #5a5a5a;
        border-color: #8c8c8c;
        background: transparent;
        box-shadow: none;
        filter: none;
        text-shadow: none;
    }
    38% {
        color: var(--hint-pulse-color, #123fcd);
        border-color: var(--hint-pulse-border-color, #2e62f3);
        background: var(--hint-pulse-background, transparent);
        box-shadow: var(--hint-pulse-ring-shadow, none);
        filter: drop-shadow(
            var(--hint-pulse-drop-shadow, 0 0 2px rgba(40, 102, 255, 0.55))
        );
        text-shadow: var(
            --hint-pulse-text-shadow,
            0 0 6px rgba(40, 102, 255, 0.78),
            0 0 14px rgba(40, 102, 255, 0.62),
            0 0 26px rgba(40, 102, 255, 0.48)
        );
    }
    100% {
        color: #5a5a5a;
        border-color: #8c8c8c;
        background: transparent;
        box-shadow: none;
        filter: none;
        text-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .composer-hint-pulse .game-hud-hint-icon,
    .daily-hint-pulse .game-hud-hint-icon {
        animation: none;
    }
}
