/*
 * Rampage — botão "?" do cabeçalho e janela "Como funciona"
 * Carregado sempre (visual novo e clássico).
 */

:root {
    --rp-help-ink: #1c1f24;
    --rp-help-muted: #5b6472;
    --rp-help-line: #e3e0da;
    --rp-help-surface: #ffffff;
    --rp-help-surface-2: #f6f5f2;
    --rp-help-accent: #245edc;
    --rp-help-accent-soft: rgba(36, 94, 220, .09);
    --rp-help-care: #b42318;
    --rp-help-care-soft: rgba(180, 35, 24, .06);
}

html.dark {
    --rp-help-ink: #e8ebf0;
    --rp-help-muted: #9aa4b2;
    --rp-help-line: #2a313c;
    --rp-help-surface: #161b22;
    --rp-help-surface-2: #1d232c;
    --rp-help-accent: #8fb3e8;
    --rp-help-accent-soft: rgba(143, 179, 232, .12);
    --rp-help-care: #f28b82;
    --rp-help-care-soft: rgba(242, 139, 130, .08);
}

/* ---------- botão ? ---------- */

.rp-help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--rp-help-line);
    border-radius: 10px;
    background: transparent;
    color: var(--rp-help-accent);
    font: 800 16px/1 Figtree, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.rp-help-button:hover {
    background: var(--rp-help-accent-soft);
}

.rp-help-button:active {
    transform: scale(.96);
}

.rp-help-button:focus-visible {
    outline: 2px solid var(--rp-help-accent);
    outline-offset: 2px;
}

/* ---------- janela ---------- */

.rp-help-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
    background: rgba(10, 14, 22, .55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.rp-help-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 44rem;
    max-height: min(88vh, 52rem);
    overflow: hidden;
    border: 1px solid var(--rp-help-line);
    border-radius: 20px;
    background: var(--rp-help-surface);
    color: var(--rp-help-ink);
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .55);
}

.rp-help-enter { transition: opacity .25s cubic-bezier(.22, .8, .24, 1), transform .3s cubic-bezier(.22, .8, .24, 1); }
.rp-help-enter-start { opacity: 0; transform: translateY(10px) scale(.98); }
.rp-help-enter-end { opacity: 1; transform: none; }

.rp-help-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.5rem 1.1rem;
    border-bottom: 1px solid var(--rp-help-line);
}

.rp-help-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--rp-help-ink);
}

.rp-help-intro {
    margin: .35rem 0 0;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--rp-help-muted);
}

.rp-help-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--rp-help-line);
    border-radius: 12px;
    background: transparent;
    color: var(--rp-help-muted);
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.rp-help-close svg { width: 1.1rem; height: 1.1rem; }

.rp-help-close:hover {
    background: var(--rp-help-surface-2);
    color: var(--rp-help-ink);
}

.rp-help-close:focus-visible {
    outline: 2px solid var(--rp-help-accent);
    outline-offset: 2px;
}

.rp-help-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: .75rem;
    padding: 1.1rem 1.5rem 1.3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.rp-help-section {
    padding: .9rem 1rem 1rem;
    border: 1px solid var(--rp-help-line);
    border-radius: 14px;
    background: var(--rp-help-surface-2);
}

.rp-help-section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0 0 .55rem;
    font-size: .92rem;
    font-weight: 700;
    color: var(--rp-help-ink);
}

.rp-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 9px;
    background: var(--rp-help-accent-soft);
    color: var(--rp-help-accent);
}

.rp-help-icon svg { width: 1.05rem; height: 1.05rem; }

.rp-help-list {
    display: grid;
    gap: .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-help-list li {
    position: relative;
    padding-left: .95rem;
    font-size: .84rem;
    line-height: 1.5;
    color: var(--rp-help-muted);
}

.rp-help-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: .62em;
    width: .34rem;
    height: .34rem;
    border-radius: 2px;
    background: var(--rp-help-accent);
    opacity: .6;
}

.rp-help-section-care {
    background: var(--rp-help-care-soft);
    border-color: color-mix(in srgb, var(--rp-help-care) 25%, transparent);
}

.rp-help-section-care .rp-help-icon {
    background: color-mix(in srgb, var(--rp-help-care) 12%, transparent);
    color: var(--rp-help-care);
}

.rp-help-section-care .rp-help-list li::before {
    background: var(--rp-help-care);
}

.rp-help-foot {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .85rem 1.5rem;
    border-top: 1px solid var(--rp-help-line);
    font-size: .8rem;
    color: var(--rp-help-muted);
}

.rp-help-foot svg {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    color: var(--rp-help-accent);
}

/* textos: o app.css pinta todo span/li/p no escuro, então fixamos aqui */
html.dark .rp-help-dialog p,
html.dark .rp-help-dialog li,
html.dark .rp-help-dialog span {
    color: inherit;
}

html.dark .rp-help-intro,
html.dark .rp-help-list li,
html.dark .rp-help-foot span {
    color: var(--rp-help-muted);
}

html.dark .rp-help-title,
html.dark .rp-help-section-title {
    color: var(--rp-help-ink);
}

@media (max-width: 640px) {
    .rp-help-head,
    .rp-help-body,
    .rp-help-foot {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .rp-help-body {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rp-help-enter { transition: none; }
    .rp-help-button { transition: none; }
}
