/* ===== 弹窗 ===== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

/* ---- 弹窗外框（不滚动） ---- */
.modal-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- 关闭按钮：固定在右上角，不随内容滚动 ---- */
.modal-box .close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 20;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 27, 34, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid #30363d;
    border-radius: 50%;
    color: #8b949e;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1;
    padding: 0;
}

.modal-box .close-btn:hover {
    color: #e6edf3;
    background: #30363d;
    border-color: #484f58;
}

/* ---- 滚动容器：真正滚动的是这一层 ---- */
.modal-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px 24px;
    min-height: 0;
}

/* 自定义滚动条 */
.modal-scroll::-webkit-scrollbar {
    width: 5px;
}
.modal-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.modal-scroll::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 10px;
}
.modal-scroll::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* ---- 弹窗内的内容 ---- */
.modal-box .modal-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.modal-box .modal-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
    padding-right: 44px; /* 给右上角关闭按钮留出安全距离 */
}

.modal-box .modal-desc {
    font-size: 15px;
    color: #b1bac4;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ---- Tab 切换 ---- */
.modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #30363d;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.modal-tabs .tab-btn {
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 16px 10px 16px;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    border-radius: 0;
}

.modal-tabs .tab-btn:hover {
    color: #e6edf3;
}

.modal-tabs .tab-btn.active {
    color: #58a6ff;
    border-bottom-color: #58a6ff;
}

.tab-panel {
    animation: fadeIn 0.25s ease;
}

.tab-panel.active-panel {
    display: block !important;
}

@keyframes fadeIn {
    from { opacity: 0.5; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 区块 ---- */
.modal-box .modal-section {
    margin-bottom: 14px;
}

.modal-box .modal-section h4 {
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 4px;
    font-weight: 500;
}

.modal-box .modal-section h4 .h4-sub {
    color: #5a5f68;
    font-weight: 400;
    font-size: 13px;
    margin-left: 6px;
}

.modal-box .modal-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-box .modal-section ul li {
    font-size: 14px;
    color: #e6edf3;
    padding: 2px 0 2px 18px;
    position: relative;
    line-height: 1.6;
}

.modal-box .modal-section ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #58a6ff;
}

.modal-box .modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.modal-box .modal-tech span {
    font-size: 12px;
    background: #21262d;
    color: #8b949e;
    padding: 2px 12px;
    border-radius: 12px;
    border: 1px solid #30363d;
}

.modal-box .modal-link {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #21262d;
}

.modal-box .modal-link a {
    color: #58a6ff;
    text-decoration: none;
    font-size: 14px;
}

.modal-box .modal-link a:hover {
    text-decoration: underline;
}

/* ---- 设计手记 ---- */
.modal-box .story-text {
    color: #b1bac4;
    font-size: 14px;
    line-height: 1.7;
    margin: 0 0 4px 0;
}

.story-block-hidden {
    display: none !important;
}

/* ---- 移动端 ---- */
@media (max-width: 500px) {
    .modal-scroll {
        padding: 24px 20px 20px;
    }
    .modal-box .modal-title {
        font-size: 19px;
    }
    .modal-tabs .tab-btn {
        font-size: 13px;
        padding: 4px 10px 8px 10px;
    }
    .modal-box .close-btn {
        top: 12px;
        right: 14px;
        width: 32px;
        height: 32px;
    }
}

/* 弹窗本身获得焦点时不显示 outline */
.modal-box:focus {
    outline: none;
}