/*
 * Onboarding: spotlight tours and the lobby's room pointer (modules/onboardingPointer.js)
 * and the room's tutorial guide card + tutorial lines (modules/tutorialGuide.js,
 * modules/messageRenderer.js). Loaded by lobby.html and test.html.
 */

/* ---------------------------------------------------------------- lobby pointer */

.rp-scrim {
    position: fixed;
    inset: 0;
    z-index: 10010;           /* above the banner (10002), below the dropdown (20000) */
    background: transparent;  /* the ring's shadow does the dimming */
}

.rp-ring {
    position: fixed;
    z-index: 10011;
    border-radius: var(--r-lg);
    box-shadow: 0 0 0 9999px rgba(20, 12, 48, 0.66);
    outline: 3px solid var(--brand-cyan);
    outline-offset: 0;
    pointer-events: none;
    animation: rpRing 1.6s ease-in-out infinite;
}

.rp-hit {
    position: fixed;
    z-index: 10012;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.rp-bubble {
    position: fixed;
    z-index: 10012;
    box-sizing: border-box;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: var(--cta-bg);
    color: var(--cta-ink);
    font-family: var(--font-body);
    box-shadow: 0 10px 30px rgba(var(--shadow-tint), 0.45);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rp-bubble.rp-tappable { cursor: pointer; }

.rp-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.rp-foot small {
    margin-right: auto;
    font-weight: 700;
    opacity: 0.7;
}

.rp-skip,
.rp-next {
    border: 0;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.rp-skip {
    background: transparent;
    color: inherit;
    opacity: 0.75;
    padding: 6px 2px;
}

.rp-next {
    padding: 8px 18px;
    border-radius: var(--r-pill);
    background: var(--ink);
    color: #fff;
}

.rp-bubble strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.2;
}

.rp-bubble span {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* The arrow points up at the card, or down when the bubble sits above it */
.rp-bubble::before {
    content: '';
    position: absolute;
    left: var(--rp-arrow-x, 50%);
    top: -8px;
    width: 16px;
    height: 16px;
    background: var(--brand-yellow);
    transform: translateX(-50%) rotate(45deg);
    border-radius: 3px;
}

.rp-bubble.rp-above::before {
    top: auto;
    bottom: -8px;
    background: var(--brand-orange);
}

/* Over the foot of the screen, beside an element too tall to sit above or below */
.rp-bubble.rp-pinned::before { display: none; }

.rp-scrim, .rp-ring, .rp-bubble {
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.rp-on .rp-scrim,
body.rp-on .rp-ring,
body.rp-on .rp-bubble {
    opacity: 1;
}

@keyframes rpRing {
    0%, 100% { outline-color: var(--brand-cyan); }
    50% { outline-color: rgba(79, 209, 255, 0.35); }
}

/* ---------------------------------------------------------------- room guide */

.tg-card {
    position: fixed;
    z-index: 101;             /* above the floating input bar (100) */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;     /* only the chips catch taps, not the strip between them */
}

.tg-card.tg-open {
    opacity: 1;
    transform: none;
}

.tg-card > * { pointer-events: auto; }

.tg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    border: 1.5px solid var(--brand-orange);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(var(--shadow-tint), 0.22);
    cursor: pointer;
}

.tg-chip .icon { width: 16px; height: 16px; }
.tg-chip:hover { border-color: var(--accent); }

.tg-close {
    display: inline-flex;
    margin-left: auto;
    padding: 6px;
    border: 0;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    opacity: 0.7;
    cursor: pointer;
}

.tg-close:hover { opacity: 1; }
.tg-close .icon { width: 14px; height: 14px; }

/* Point at the input box until it has been used once */
#inputForm.tg-pulse {
    animation: tgPulse 1.6s ease-in-out infinite;
}

@keyframes tgPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 209, 255, 0.0), 0 4px 24px rgba(0, 0, 0, 0.18); }
    50% { box-shadow: 0 0 0 4px rgba(79, 209, 255, 0.75), 0 4px 24px rgba(0, 0, 0, 0.18); }
}

/* Room for the card at the foot of the chat (set by tutorialGuide.js) */
body.solo-tutorial-active #messages {
    padding-bottom: var(--tg-space, 0px);
}

/* ---------------------------------------------------------------- tutorial lines */

/* The player's own question stands apart from the room's, which keeps going */
#messages p.solo-tutorial {
    border-left: 6px solid var(--brand-orange);
    background: linear-gradient(90deg, rgba(255, 165, 58, 0.16), rgba(255, 165, 58, 0.04) 70%);
}

#messages p.Question.solo-tutorial {
    background: linear-gradient(90deg, rgba(255, 204, 77, 0.38), rgba(255, 204, 77, 0.12) 75%);
    box-shadow: inset 0 0 0 2px rgba(255, 165, 58, 0.55);
}

.solo-tag {
    display: inline-block;
    margin: 0 6px;
    padding: 1px 8px;
    border-radius: var(--r-pill);
    background: var(--brand-orange);
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    vertical-align: 1px;
}

/* ---------------------------------------------------------------- night */

:root[data-night]:not([data-theme]) .tg-chip,
:root[data-night]:not([data-theme]) .tg-close {
    background: var(--n-surface-2);
    color: var(--n-ink);
    border-color: var(--n-line);
}


:root[data-night]:not([data-theme]) #messages p.Question.solo-tutorial {
    background: linear-gradient(90deg, rgba(255, 204, 77, 0.22), rgba(255, 204, 77, 0.06) 75%);
}
