#readProgress {
    position: fixed;
    top: 0;
    right: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary, #6c3ef4), #3b82f6);
    z-index: 9999;
    transition: width .1s linear;
    border-radius: 0 0 4px 4px;
}

body { background-color: #f8fafc; }

.terms-hero {
    background: linear-gradient(135deg, var(--primary, #6c3ef4) 0%, #1e3a8a 100%);
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 40px 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}
.terms-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(255,255,255,.15) 0%, transparent 65%);
    pointer-events: none;
}
.terms-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 50px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 20px;
}
.terms-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    color: #fff;
    margin: 0 0 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.terms-hero p {
    color: rgba(255,255,255,.9);
    font-size: 1.1rem;
    max-width: 760px;
    margin: 0 auto 28px;
    line-height: 1.8;
}
.terms-meta {
    display: inline-flex;
    gap: 28px;
    flex-wrap: wrap;
    justify-content: center;
}
.terms-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.8);
    font-size: .85rem;
}
.terms-meta-item i { color: rgba(255,255,255,.9); }

.terms-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: -40px auto 48px;
    padding: 0 20px 80px;
    align-items: start;
    position: relative;
    z-index: 10;
}
@media(max-width:900px) {
    .terms-layout { grid-template-columns: 1fr; margin-top: 0; }
    .terms-toc { display: none; }
}

.terms-toc {
    position: sticky;
    top: 100px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 30px 25px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #6c3ef4) transparent;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
}
.terms-toc::-webkit-scrollbar { width: 4px; }
.terms-toc::-webkit-scrollbar-thumb { background: var(--primary, #6c3ef4); border-radius: 4px; }
.toc-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 4px; }
.toc-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 12px;
    color: #475569;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all .3s ease;
    line-height: 1.6;
    margin-bottom: 8px;
    font-weight: 600;
}
.toc-list a .toc-num {
    min-width: 24px;
    height: 24px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .3s ease;
}
.toc-list a:hover {
    background: #f1f5f9;
    color: var(--primary, #6c3ef4);
    transform: translateX(-5px);
}
.toc-list a.active {
    background: var(--primary, #6c3ef4);
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 62, 244, 0.3);
}
.toc-list a.active .toc-num {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.terms-content {
    min-width: 0;
    direction: rtl;
}

.terms-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .6s ease, transform .6s ease, box-shadow .3s ease, border-color .3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.terms-section.visible {
    opacity: 1;
    transform: translateY(0);
}
.terms-section:hover {
    border-color: rgba(108,62,244,.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
@media(max-width:600px) {
    .terms-section { padding: 24px 20px; }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    cursor: pointer;
    user-select: none;
}
.section-icon {
    width: 46px;
    height: 46px;
    background: rgba(108,62,244,.1);
    border: 1px solid rgba(108,62,244,.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary, #6c3ef4);
    flex-shrink: 0;
}
.section-title-wrap { flex: 1; }
.section-num {
    font-size: .7rem;
    font-weight: 700;
    color: var(--primary, #6c3ef4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}
.section-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all .25s;
    flex-shrink: 0;
}
.section-toggle i { transition: transform .25s; }
.terms-section.collapsed .section-toggle i { transform: rotate(-90deg); }
.terms-section.collapsed .section-body { display: none; }

.section-body p {
    color: #475569;
    line-height: 2;
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 14px;
}
.section-body p:last-child { margin-bottom: 0; }

.info-box {
    background: #eff6ff;
    border-right: 4px solid #3b82f6;
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
    color: #1e3a8a;
    line-height: 1.85;
    font-weight: 600;
}
.warning-box {
    background: #fffbeb;
    border-right: 4px solid #f59e0b;
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
    color: #92400e;
    line-height: 1.85;
    font-weight: 600;
}
.warning-box i, .info-box i { margin-left: 8px; }

.terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.terms-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.8;
}
.terms-list li:last-child { border-bottom: none; }
.terms-list li::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary, #6c3ef4);
    font-size: .8rem;
    margin-top: 4px;
    flex-shrink: 0;
}
.terms-list.warn li::before {
    content: '\f071';
    color: #f59e0b;
}

.payment-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.pay-badge {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: .85rem;
    font-weight: 600;
}
.pay-badge i { color: var(--primary, #6c3ef4); }

#backToTop {
    position: fixed;
    bottom: 32px;
    left: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary, #6c3ef4);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(108,62,244,.4);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .3s, transform .3s;
    z-index: 999;
}
#backToTop.show { opacity: 1; transform: translateY(0); }
#backToTop:hover { background: #5a2fd3; }

.mobile-toc-btn {
    display: none;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--primary, #6c3ef4);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
}
@media(max-width:900px) { .mobile-toc-btn { display: flex; } }
.mobile-toc-panel {
    display: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
}
.mobile-toc-panel.open { display: block; }
