/* 在线工具箱（左上角扳手图标打开）
   背景与「敬请期待」遮罩一致：全屏 rgba(0,0,0,.9) 深色底，
   内容面板不再铺白底，改用半透明浅色面 + 白色文字。 */

/* 左上角扳手入口：与 .news-links / .search-btn 同一组图标规格 */
.header-tools-btn {
    float: left;
    width: 20px;
    height: 29px;
    margin-left: 2.4%;
    position: relative;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.header-tools-btn svg {
    width: 19px;
    height: 19px;
    display: block;
    fill: #fff;
    opacity: .85;
    transition: opacity .28s, transform .28s;
}

.header-tools-btn:hover svg {
    opacity: 1;
    transform: rotate(-18deg);
}

.header-tools-btn:focus-visible {
    outline: 1px dotted rgba(255, 255, 255, .8);
    outline-offset: 3px;
}

.tools-lib {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* reset.css 给 body 定了 color:#333，面板换深底后必须在这里改基准色，
       否则没有显式配色的文字（生成的表格、预览内容等）会继承成深灰看不见 */
    color: rgba(255, 255, 255, .85);
    overflow: hidden;
    box-sizing: border-box;
    text-align: left;
}

/* 顶栏：标题 + 搜索 */
.tools-head {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 68px;
    padding: 0 32px;
    border-bottom: 1px solid rgba(255, 255, 255, .13);
    background: rgba(255, 255, 255, .03);
    box-sizing: border-box;
}

.tools-tit {
    flex: 0 0 auto;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.tools-tit span {
    margin-left: 10px;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, .4);
    letter-spacing: 0;
}

.tools-search {
    flex: 0 1 320px;
    position: relative;
}

.tools-search input {
    width: 100%;
    height: 36px;
    padding: 0 34px 0 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    background: rgba(255, 255, 255, .07);
    font-size: 13px;
    color: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s, background .2s;
}

.tools-search input::placeholder { color: rgba(255, 255, 255, .34); }

.tools-search input:focus {
    border-color: #7ba0e8;
    background: rgba(255, 255, 255, .11);
}

/* 搜索框右侧的清空按钮 */
.tools-search em {
    display: none;
    position: absolute;
    top: 50%;
    right: 12px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    cursor: pointer;
    opacity: .55;
}

.tools-search em:before,
.tools-search em:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1.5px;
    background: #fff;
}

.tools-search em:before { transform: translate(-50%, -50%) rotate(45deg); }
.tools-search em:after { transform: translate(-50%, -50%) rotate(-45deg); }
.tools-search.has-val em { display: block; }

.tools-close {
    flex: 0 0 auto;
    margin-left: auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s;
}

.tools-close:hover { background: rgba(255, 255, 255, .12); }

.tools-close:before,
.tools-close:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 1.6px;
    background: rgba(255, 255, 255, .75);
}

.tools-close { position: relative; }
.tools-close:before { transform: translate(-50%, -50%) rotate(45deg); }
.tools-close:after { transform: translate(-50%, -50%) rotate(-45deg); }

/* 主体：左侧分类 + 右侧内容 */
.tools-body {
    display: flex;
    height: calc(100% - 68px);
}

.tools-cats {
    flex: 0 0 168px;
    overflow-y: auto;
    padding: 12px 0;
    border-right: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .03);
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.tools-cats::-webkit-scrollbar,
.tools-main::-webkit-scrollbar { width: 8px; height: 8px; }

.tools-cats::-webkit-scrollbar-track,
.tools-main::-webkit-scrollbar-track { background: transparent; }

.tools-cats::-webkit-scrollbar-thumb,
.tools-main::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .2);
    border-radius: 4px;
}

.tools-cats::-webkit-scrollbar-thumb:hover,
.tools-main::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .34); }

.tools-cats a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, .68);
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .18s, color .18s;
}

.tools-cats a:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.tools-cats a.on {
    background: rgba(76, 116, 197, .3);
    border-left-color: #7ba0e8;
    color: #fff;
    font-weight: 500;
}

.tools-cats a em {
    float: right;
    font-style: normal;
    font-size: 12px;
    color: rgba(255, 255, 255, .34);
}

.tools-main {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 28px 40px;
    box-sizing: border-box;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

/* 工具网格 */
.tools-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tools-grid li {
    flex: 0 0 auto;
    width: calc(25% - 8px);
    box-sizing: border-box;
}

.tools-grid a {
    display: block;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 6px;
    background: rgba(255, 255, 255, .045);
    font-size: 13px;
    color: rgba(255, 255, 255, .8);
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, color .2s, background .2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tools-grid a:hover {
    border-color: #7ba0e8;
    background: rgba(76, 116, 197, .22);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .4);
}

.tools-empty {
    padding: 60px 0;
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, .4);
}

/* 工具详情 */
.tools-detail { display: none; }
.tools-detail.on { display: block; }

.tools-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 18px;
    padding: 6px 14px 6px 11px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
    cursor: pointer;
    user-select: none;
    transition: border-color .2s, color .2s, background .2s;
}

.tools-back:hover {
    border-color: #7ba0e8;
    background: rgba(76, 116, 197, .2);
    color: #fff;
}

.tools-back i {
    width: 7px;
    height: 7px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.tools-detail h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.tools-desc {
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.8;
    color: rgba(255, 255, 255, .45);
}

/* 工具内容里的链接（Markdown 预览、正则替换结果等），
   reset.css 的 #08c 在深底上偏暗 */
.tools-detail a { color: #7ba0e8; }
.tools-detail a:hover { color: #a8c2f0; }

/* 工具表单通用样式 */
.tf-row { margin-bottom: 14px; }

.tf-row > label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
}

.tf-input,
.tf-area,
.tf-select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 5px;
    background: rgba(255, 255, 255, .06);
    padding: 9px 11px;
    font-size: 13px;
    color: #fff;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color .2s, background .2s;
}

.tf-input::placeholder,
.tf-area::placeholder { color: rgba(255, 255, 255, .3); }

.tf-input:focus,
.tf-area:focus,
.tf-select:focus {
    border-color: #7ba0e8;
    background: rgba(255, 255, 255, .1);
}

/* 原生下拉的弹出层不跟随面板底色，这里显式指定，否则白底白字 */
.tf-select option {
    background: #1c1f24;
    color: #fff;
}

.tf-area {
    min-height: 130px;
    line-height: 1.7;
    resize: vertical;
    font-family: Consolas, Monaco, "Courier New", monospace;
}

.tf-input[readonly] {
    background: rgba(255, 255, 255, .03);
    color: rgba(255, 255, 255, .6);
}

.tf-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tf-btn {
    height: 34px;
    padding: 0 18px;
    border: 1px solid #4c74c5;
    border-radius: 5px;
    background: #4c74c5;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.tf-btn:hover { background: #5d86d6; border-color: #5d86d6; }

.tf-btn.ghost {
    background: transparent;
    border-color: rgba(157, 184, 238, .55);
    color: #9db8ee;
}

.tf-btn.ghost:hover {
    background: rgba(76, 116, 197, .24);
    border-color: #9db8ee;
    color: #fff;
}

.tf-hint {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.7;
    color: rgba(255, 255, 255, .42);
}

.tf-err { color: #ff8a80; }

/* 结果区：等宽字体便于核对 */
.tf-out {
    font-family: Consolas, Monaco, "Courier New", monospace;
}

/* 两列布局，用于换算器这类「输入-输出」并排的工具 */
.tf-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.tf-cols > * { flex: 1 1 240px; min-width: 0; }

/* 对照表 */
.tf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tf-table th,
.tf-table td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    text-align: left;
    vertical-align: top;
}

.tf-table th {
    background: rgba(255, 255, 255, .07);
    font-weight: 500;
    color: rgba(255, 255, 255, .85);
    white-space: nowrap;
}

.tf-table td {
    color: rgba(255, 255, 255, .72);
    font-family: Consolas, Monaco, "Courier New", monospace;
    word-break: break-all;
}

.tf-table tr:hover td { background: rgba(255, 255, 255, .05); }

@media screen and (max-width: 1100px) {
    .tools-grid li { width: calc(33.3333% - 7px); }
}

@media screen and (max-width: 820px) {
    .tools-head { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
    .tools-tit { font-size: 16px; }
    .tools-search { flex: 1 1 100%; order: 3; }
    .tools-body { height: calc(100% - 118px); flex-direction: column; }
    .tools-cats {
        flex: 0 0 auto;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .1);
    }
    .tools-cats a {
        flex: 0 0 auto;
        border-left: 0;
        border-bottom: 3px solid transparent;
        padding: 11px 14px;
        white-space: nowrap;
    }
    .tools-cats a.on { border-left: 0; border-bottom-color: #7ba0e8; }
    .tools-cats a em { display: none; }
    .tools-main { padding: 14px 16px 30px; }
    .tools-grid li { width: calc(50% - 5px); }
    .header-tools-btn { margin-left: 2.4%; }
}

@media screen and (max-width: 480px) {
    .tools-grid li { width: 100%; }
    /* 左侧四个入口（VIP + 菜单、搜索、工具箱）在窄屏要一起降到 24px
       并统一 8% 间距，否则高低不齐。VIP 的对应规则在 zll_mobile.css。 */
    .header-tools-btn { height: 24px; margin-left: 2.5%; }
}

/* 遮罩容器：与 .header-mini-nav 同规格（全屏、深色底、同层级） */
.tools-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .9);
    z-index: 4;
    display: none;
}
