/* ChatBase — first-run consent gate */

#consentGate {
    position: fixed;
    inset: 0;
    z-index: 99997;               /* above the welcome screen (99990) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(4, 5, 14, 0.9);
    -webkit-backdrop-filter: blur(40px) saturate(170%);
    backdrop-filter: blur(40px) saturate(170%);
    animation: wc-in 0.5s var(--lg-ease) forwards;
}

#consentGate.closing { animation: wc-out 0.5s var(--lg-ease) forwards; }

.cg-box {
    width: min(96vw, 780px);
    height: min(92vh, 860px);
    display: flex;
    flex-direction: column;
    border-radius: var(--lg-r-xl);
    background: rgba(13, 16, 38, 0.94);
    -webkit-backdrop-filter: var(--lg-blur-deep);
    backdrop-filter: var(--lg-blur-deep);
    border: 1px solid var(--lg-rim);
    box-shadow: var(--lg-specular), var(--lg-lift-3);
    overflow: hidden;
    animation: lg-sheet-in 0.5s var(--lg-spring) both;
}

.cg-head {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--lg-rim-soft);
    flex-shrink: 0;
}

.cg-steps { display: flex; gap: 10px; margin-bottom: 15px; }

.cg-step {
    padding: 5px 14px;
    border-radius: var(--lg-r-pill);
    border: 1px solid var(--lg-rim-soft);
    background: var(--lg-glass-1);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(233, 237, 255, 0.4);
    transition: all 0.3s var(--lg-ease);
}

.cg-step.active {
    background: linear-gradient(120deg, var(--lg-violet), var(--lg-indigo));
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
    box-shadow: var(--lg-glow-violet);
}

.cg-step.done {
    background: rgba(52, 232, 176, 0.18);
    border-color: rgba(52, 232, 176, 0.45);
    color: var(--lg-mint);
}

.cg-title {
    margin: 0 0 5px;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.035em;
    background: linear-gradient(120deg, #fff 25%, var(--lg-violet) 75%, var(--lg-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cg-blurb { margin: 0; font-size: 13.5px; color: var(--text-secondary); }

/* The document itself — this is the pane that must be scrolled. */
.cg-doc {
    flex: 1;
    overflow-y: auto;
    padding: 22px 28px;
    font-size: 14.5px;
    line-height: 1.68;
    color: rgba(244, 246, 255, 0.88);
    scroll-behavior: smooth;
}

.cg-doc h1 { display: none; }          /* the gate has its own title */
.cg-doc .legal-date { margin-bottom: 20px; }

.cg-doc h2 {
    margin: 28px 0 10px;
    font-size: 18px;
    font-weight: 720;
    letter-spacing: -0.025em;
    color: #fff;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--lg-rim-soft);
}

.cg-doc h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 660; color: #fff; }
.cg-doc p { margin: 0 0 12px; }
.cg-doc ul { margin: 0 0 14px; padding-left: 20px; }
.cg-doc li { margin-bottom: 6px; }
.cg-doc strong { color: #fff; font-weight: 650; }
.cg-doc a { color: var(--lg-cyan); }

.cg-doc .legal-lead,
.cg-doc .legal-callout {
    padding: 14px 18px;
    margin: 0 0 18px;
    border-radius: var(--lg-r-md);
    background: rgba(160, 107, 255, 0.1);
    border: 1px solid rgba(160, 107, 255, 0.28);
}

.cg-doc .legal-callout { border-left: 3px solid var(--lg-violet); margin: 16px 0; }

.cg-doc .legal-todo {
    padding: 12px 16px;
    border-radius: var(--lg-r-sm);
    background: rgba(255, 180, 67, 0.1);
    border: 1px dashed rgba(255, 180, 67, 0.5);
}

.cg-doc .legal-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0 18px; }
.cg-doc .legal-table th, .cg-doc .legal-table td {
    padding: 9px 12px; text-align: left; vertical-align: top;
    border-bottom: 1px solid var(--lg-rim-soft);
}
.cg-doc .legal-table th {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
    color: rgba(233, 237, 255, 0.45);
}

.cg-loading, .cg-fallback { padding: 30px 0; text-align: center; color: var(--text-secondary); }

.cg-scroll-hint {
    flex-shrink: 0;
    padding: 9px;
    text-align: center;
    font-size: 12px;
    font-weight: 620;
    letter-spacing: 0.03em;
    color: var(--lg-cyan);
    background: rgba(34, 211, 238, 0.09);
    border-top: 1px solid rgba(34, 211, 238, 0.22);
    animation: cg-bob 1.7s ease-in-out infinite;
}

.cg-scroll-hint[hidden] { display: none; }

@keyframes cg-bob {
    0%, 100% { transform: translateY(0); opacity: 0.75; }
    50%      { transform: translateY(3px); opacity: 1; }
}

.cg-foot {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 28px;
    border-top: 1px solid var(--lg-rim-soft);
    background: rgba(255, 255, 255, 0.03);
}

.cg-agree { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.cg-agree input {
    width: 20px;
    height: 20px;
    accent-color: var(--lg-violet);
    cursor: pointer;
}

.cg-agree input:disabled { cursor: not-allowed; opacity: 0.4; }
.cg-agree input:disabled + .cg-agree-text { opacity: 0.4; }

.cg-agree-text { font-size: 14px; font-weight: 620; color: #fff; }

.cg-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.cg-decline {
    padding: 9px 16px;
    border-radius: var(--lg-r-pill);
    border: 1px solid var(--lg-rim-soft);
    background: transparent;
    color: rgba(233, 237, 255, 0.5);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.24s var(--lg-ease);
}

.cg-decline:hover { color: #ff9db0; border-color: rgba(255, 77, 109, 0.45); }

.cg-next {
    padding: 11px 26px;
    border-radius: var(--lg-r-pill);
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: linear-gradient(120deg, var(--lg-violet), var(--lg-indigo));
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 680;
    cursor: pointer;
    box-shadow: var(--lg-specular), var(--lg-glow-violet);
    transition: transform 0.3s var(--lg-spring), opacity 0.24s var(--lg-ease);
}

.cg-next:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); }

.cg-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
    background: var(--lg-glass-3);
}

.cg-done {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 40px;
}

.cg-done-mark {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: #06231a;
    background: linear-gradient(135deg, var(--lg-mint), var(--lg-cyan));
    box-shadow: 0 0 44px rgba(52, 232, 176, 0.6);
    animation: wc-rise 0.7s var(--lg-spring) both;
}

.cg-done h2 { margin: 0; font-size: 25px; font-weight: 780; letter-spacing: -0.03em; color: #fff; }
.cg-done p { margin: 0; font-size: 14px; color: var(--text-secondary); max-width: 380px; }

@media (max-width: 600px) {
    #consentGate { padding: 0; }
    .cg-box { width: 100vw; height: 100vh; border-radius: 0; }
    .cg-head, .cg-doc, .cg-foot { padding-left: 18px; padding-right: 18px; }
    .cg-actions { width: 100%; }
    .cg-next { flex: 1; }
}
