/* =====================
   layout（两栏结构）
===================== */

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* 左侧主内容 */
.detail-main {
    min-width: 0;
}

/* 右侧栏 */
.detail-sidebar {
    position: sticky;
    top: 20px;
    width: 320px;
    height: fit-content;

    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =====================
   tool container
===================== */

.tool-page {
    padding: 20px 0;
}

/* =====================
   标题
===================== */

.page-header h1 {
    font-size: 30px;
    margin-bottom: 15px;
    color: #111;
}

/* =====================
   card 统一样式
===================== */

.card {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 20px;
}

/* =====================
   description
===================== */

.tool-desc {
    color: #555;
    line-height: 1.6;
}

/* =====================
   input 区
===================== */

#inputBox {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#inputBox > div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
}

#inputBox input,
#inputBox select {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

/* =====================
   actions
===================== */

.tool-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: stretch;
}

/* swap button */
.swap-btn {
    flex: 0 0 auto;
    background: #f3f4f6;
    border: 1px solid #d9d9d9;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
}

/* run button（修复：匹配 HTML id） */
#runBtn {
    flex: 1;
    background: #1677ff;
    color: #fff;
    border: none;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
}

/* =====================
   result
===================== */

.tool-result .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#resultBox {
    min-height: 40px;
    background: #fafafa;
    border-radius: 6px;
    padding: 10px;
}

/* =====================
   formula / content
===================== */

.tool-formula {
    line-height: 1.6;
}

.tool-content {
    line-height: 1.6;
}

/* =====================
   related tools
===================== */

.related-tools {
    display: none;
}

/* =====================
   sidebar modules（兼容 feedback / relations）
===================== */

.page-feedback {
    text-align: center;
}

/* relations 样式（通用兼容 case/video/tool） */
.rel-block {
    margin-bottom: 12px;
}

.rel-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.rel-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rel-list li {
    padding: 6px 0;
}

.rel-list a {
    color: #1677ff;
    text-decoration: none;
}

.rel-list a:hover {
    text-decoration: underline;
}

/* =====================
   mobile
===================== */

@media (max-width: 1024px) {

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-sidebar {
        position: static;
        width: 100%;
    }
}

@media (max-width: 768px) {

    #inputBox > div {
        grid-template-columns: 1fr;
    }

    .tool-actions {
        flex-direction: column;
    }

    .swap-btn,
    #runBtn {
        width: 100%;
    }
}