/* ═══════════════════════════════════════════════════════════════════════════
   help-overlay.css  —  Help! request overlay system
   z-index: 1500  (above countdown:500, below popups/modals:2000)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header-positioned Help! button group ───────────────────────────────────── */
.char-creation-panel .char-input-header,
.char-edit-panel .char-input-header {
    display: flex;
    align-items: center;
    position: relative;
}
.char-creation-panel .char-input-header h3,
.char-edit-panel .char-input-header h3 {
    flex: 1;
    text-align: center;
}
/* Button group sits at left of header via absolute position */
.help-btn-group {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Help! button ────────────────────────────────────────────────────────────── */
.help-request-btn {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(234, 179, 8, 0.5);
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}
.help-request-btn:hover {
    background: rgba(234, 179, 8, 0.22);
    transform: scale(1.03);
}
.help-request-btn.help-btn-active {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}
.help-request-btn.help-btn-active:hover { background: rgba(239, 68, 68, 0.25); }

/* Compact size when in the header */
.help-btn-header {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.75rem !important;
    border-radius: 8px !important;
    flex-shrink: 0;
}

/* ── Update button ────────────────────────────────────────────────────────────── */
.help-update-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.help-update-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.03);
}
.help-update-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ── DM: hide Help! and Update buttons ──────────────────────────────────────── */
body.is-dm .help-request-btn,
body.is-dm .help-update-btn { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Outer container ────────────────────────────────────────────────────────── */
#help-request-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}
#help-request-overlay.hidden { display: none !important; }

/* ── Backdrop ───────────────────────────────────────────────────────────────── */
.help-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

/* ── Main card ──────────────────────────────────────────────────────────────── */
.help-card {
    position: relative;
    width: 100%;
    /* Match the requesting player's panel width (~960px) on desktop;
       fit within screen on mobile/tablet via the 95vw cap. */
    max-width: min(95vw, 980px);
    /* Allow card to grow to most of viewport height — canvas scrolls internally */
    max-height: 96vh;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 30px rgba(234,179,8,0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(234, 179, 8, 0.08);
    border-bottom: 1px solid rgba(234, 179, 8, 0.2);
    gap: 12px;
    flex-shrink: 0;
}
.help-requester {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.help-req-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(234, 179, 8, 0.5);
    flex-shrink: 0;
}
.help-req-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
    font-weight: 700;
    font-size: 1rem;
}
.help-req-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.help-req-text strong {
    color: #f1f5f9;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.help-req-text span { color: #94a3b8; font-size: 0.75rem; }

.help-badge {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #eab308;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.help-close {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.help-close:hover { background: rgba(239,68,68,0.35); transform: scale(1.1); }

/* ── Screenshot canvas ───────────────────────────────────────────────────────
   • flex: 1          — takes all remaining height in the card column
   • overflow-y: auto — scrolls tall sheets (DnD Beyond imports etc.)
   • position is NOT set here — set on .help-screenshot-wrapper instead
   ──────────────────────────────────────────────────────────────────────────── */
.help-canvas {
    width: 100%;
    flex: 1 1 0;          /* grow to fill card, shrink if needed   */
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(234,179,8,0.3) transparent;
}
.help-canvas::-webkit-scrollbar { width: 6px; }
.help-canvas::-webkit-scrollbar-thumb {
    background: rgba(234,179,8,0.3);
    border-radius: 3px;
}

/* ── Screenshot wrapper ──────────────────────────────────────────────────────
   This is the ping coordinate reference element.
   position: relative + natural (auto) height = it stretches to the full
   image height so the absolutely-positioned ping layer covers the whole image.
   ──────────────────────────────────────────────────────────────────────────── */
.help-screenshot-wrapper {
    position: relative;
    width: 100%;
    /* height is auto — grows to match the screenshot image */
}

/* ── Screenshot image ────────────────────────────────────────────────────────
   width: 100% — fills the card width.
   height: auto — preserves aspect ratio; tall sheets simply extend downward
                  and the canvas scrolls to reveal them.
   display: block — removes inline baseline gap.
   ──────────────────────────────────────────────────────────────────────────── */
.help-screenshot {
    display: block;
    width: 100%;
    height: auto;
    border: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Loading state while screenshot is uploading */
.help-screenshot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: #94a3b8;
    font-size: 0.9rem;
}
.help-loading-spin {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(234,179,8,0.2);
    border-top-color: #eab308;
    border-radius: 50%;
    animation: help-spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes help-spin { to { transform: rotate(360deg); } }

/* ── Ping layer ──────────────────────────────────────────────────────────────
   Sits inside .help-screenshot-wrapper (position: relative).
   inset: 0 means it covers the FULL wrapper height = the full image height.
   Pings at yPct=80% land 80% down the image regardless of scroll position.
   ──────────────────────────────────────────────────────────────────────────── */
.help-ping-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.help-ping {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}
.help-ping-ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid #eab308;
    box-shadow: 0 0 12px rgba(234,179,8,0.7);
    animation: help-ping-fade 4s ease-out forwards;
}
.help-ping-name {
    color: #eab308;
    font-size: 0.65rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    white-space: nowrap;
    animation: help-ping-fade 4s ease-out forwards;
}
@keyframes help-ping-fade {
    0%   { opacity: 1;   transform: scale(1); }
    60%  { opacity: 0.8; transform: scale(1.15); }
    100% { opacity: 0;   transform: scale(0.9); }
}

/* ── Queue section ───────────────────────────────────────────────────────────── */
.help-queue {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 10px 16px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}
.help-queue-label {
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.help-queue-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Mini-card for queued requests */
.help-mini-card {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 10px;
}
.help-mini-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(234,179,8,0.3);
    flex-shrink: 0;
}
.help-mini-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(234,179,8,0.15);
    color: #eab308;
    font-weight: 700;
    font-size: 0.7rem;
}
.help-mini-info { display: flex; flex-direction: column; gap: 1px; }
.help-mini-name {
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.help-mini-char { color: #64748b; font-size: 0.65rem; white-space: nowrap; }
