/* ========================================
   Disclaimer Modal — 免责声明弹窗
   ======================================== */

/* Overlay (backdrop) */
.disclaimer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;

    /* Entry animation */
    animation: disclaimerFadeIn 300ms ease-out both;
}

/* Modal container */
.disclaimer-modal {
    background: var(--panel-bg, #161b22);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(88, 166, 255, 0.06),
        0 8px 40px rgba(0, 0, 0, 0.55),
        0 2px 12px rgba(0, 0, 0, 0.35);

    /* Entry animation */
    animation: disclaimerSlideUp 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Header ── */
.disclaimer-header {
    padding: 24px 28px 16px;
    text-align: center;
    flex-shrink: 0;
}

.disclaimer-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(210, 153, 34, 0.12);
    margin-bottom: 12px;
}

.disclaimer-header-icon svg {
    width: 26px;
    height: 26px;
    color: var(--warning-color, #d29922);
}

.disclaimer-title {
    font-size: var(--text-xl, 1.5rem);
    font-weight: 700;
    color: var(--warning-color, #d29922);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.disclaimer-subtitle {
    font-size: var(--text-sm, 0.8125rem);
    color: var(--text-secondary, #8b949e);
    line-height: var(--leading-normal, 1.5);
}

/* ── Body (scrollable) ── */
.disclaimer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 28px 20px;
    max-height: 50vh;
    position: relative;
}

/* Custom scrollbar for body */
.disclaimer-body::-webkit-scrollbar {
    width: 6px;
}

.disclaimer-body::-webkit-scrollbar-track {
    background: transparent;
}

.disclaimer-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #30363d);
    border-radius: 3px;
}

.disclaimer-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #8b949e);
}

/* Firefox scrollbar */
.disclaimer-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #30363d) transparent;
}

/* Clause item */
.disclaimer-clause {
    margin-bottom: 18px;
}

.disclaimer-clause:last-child {
    margin-bottom: 0;
}

.disclaimer-clause-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-color, #58a6ff);
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    margin-right: 8px;
    flex-shrink: 0;
    vertical-align: middle;
}

.disclaimer-clause-title {
    font-size: var(--text-base, 0.9375rem);
    font-weight: 600;
    color: var(--accent-color, #58a6ff);
    display: inline;
    vertical-align: middle;
}

.disclaimer-clause-text {
    margin-top: 8px;
    font-size: var(--text-sm, 0.8125rem);
    color: var(--text-primary, #c9d1d9);
    line-height: var(--leading-relaxed, 1.65);
}

/* ── Footer (fixed action area) ── */
.disclaimer-footer {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--border-color, #30363d);
    flex-shrink: 0;
    text-align: center;
}

/* Scroll hint */
.disclaimer-scroll-hint {
    font-size: var(--text-xs, 0.75rem);
    color: var(--warning-color, #d29922);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.disclaimer-scroll-hint svg {
    width: 14px;
    height: 14px;
    animation: scrollBounce 1.5s ease-in-out infinite;
}

.disclaimer-scroll-hint.hidden {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
}

/* Confirm button */
.disclaimer-confirm-btn {
    width: 100%;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: var(--text-base, 0.9375rem);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.01em;
}

/* Disabled state (before scroll) */
.disclaimer-confirm-btn:disabled {
    background: rgba(88, 166, 255, 0.15);
    color: rgba(88, 166, 255, 0.4);
    cursor: not-allowed;
}

/* Enabled state (after scroll to bottom) */
.disclaimer-confirm-btn:not(:disabled) {
    background: var(--accent-color, #58a6ff);
    color: #fff;
    box-shadow: 0 2px 12px rgba(88, 166, 255, 0.25);
}

.disclaimer-confirm-btn:not(:disabled):hover {
    background: #4a8fd9;
    box-shadow: 0 4px 20px rgba(88, 166, 255, 0.35);
    transform: translateY(-1px);
}

.disclaimer-confirm-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(88, 166, 255, 0.2);
}

.disclaimer-footer-note {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-secondary, #8b949e);
    margin-top: 10px;
}

/* ── Exit animation ── */
.disclaimer-overlay.exiting {
    animation: disclaimerFadeOut 300ms ease-in forwards;
}

.disclaimer-overlay.exiting .disclaimer-modal {
    animation: disclaimerSlideDown 300ms ease-in forwards;
}

/* ── Keyframes ── */
@keyframes disclaimerFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes disclaimerFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes disclaimerSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes disclaimerSlideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(3px); }
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
    .disclaimer-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .disclaimer-modal {
        max-height: 88vh;
        border-radius: 12px 12px 0 0;
        max-width: 100%;
    }

    .disclaimer-header {
        padding: 20px 20px 12px;
    }

    .disclaimer-header-icon {
        width: 40px;
        height: 40px;
    }

    .disclaimer-header-icon svg {
        width: 22px;
        height: 22px;
    }

    .disclaimer-title {
        font-size: var(--text-lg, 1.25rem);
    }

    .disclaimer-body {
        padding: 0 20px 16px;
        max-height: 55vh;
    }

    .disclaimer-footer {
        padding: 14px 20px 16px;
        /* Safe area for bottom-edge phones */
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ── Accessibility: reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .disclaimer-overlay,
    .disclaimer-modal,
    .disclaimer-overlay.exiting,
    .disclaimer-overlay.exiting .disclaimer-modal {
        animation-duration: 0.01ms !important;
    }

    .disclaimer-scroll-hint svg {
        animation: none;
    }
}
