.tool-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
    color: var(--main_text_color);
}

.tool-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: var(--item_bg_color);
    backdrop-filter: blur(var(--card_filter));
}

.tool-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    color: var(--item_left_title_color);
}

.tool-header p {
    margin-top: 6px;
    color: var(--item_left_text_color);
    font-size: 14px;
}

.tool-back,
.tool-theme {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    color: #1f2937;
    font-size: 20px;
    cursor: pointer;
}

html[data-theme="Dark"] .tool-back,
html[data-theme="Dark"] .tool-theme {
    background: rgba(30, 41, 59, 0.86);
    color: #f8fafc;
}

.tool-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.tool-tabs {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: start;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: var(--item_bg_color);
    backdrop-filter: blur(var(--card_filter));
}

.tool-tab,
.tool-actions button,
.box-head button {
    min-height: 38px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: #1f2937;
    font: inherit;
    cursor: pointer;
}

.tool-tab {
    text-align: left;
    padding: 0 12px;
}

.tool-tab.is-active,
.tool-actions button:hover,
.box-head button:hover {
    border-color: rgba(15, 118, 110, 0.55);
    background: rgba(240, 253, 250, 0.92);
    color: #0f766e;
}

html[data-theme="Dark"] .tool-tab,
html[data-theme="Dark"] .tool-actions button,
html[data-theme="Dark"] .box-head button {
    background: rgba(30, 41, 59, 0.88);
    color: #e5e7eb;
}

html[data-theme="Dark"] .tool-tab.is-active,
html[data-theme="Dark"] .tool-actions button:hover,
html[data-theme="Dark"] .box-head button:hover {
    background: rgba(20, 184, 166, 0.16);
    color: #5eead4;
}

.tool-panel {
    display: none;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: var(--item_bg_color);
    backdrop-filter: blur(var(--card_filter));
}

.tool-panel.is-active {
    display: block;
}

.tool-note {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    background: rgba(240, 253, 250, 0.76);
    color: #334155;
    font-size: 14px;
    line-height: 1.65;
}

html[data-theme="Dark"] .tool-note {
    background: rgba(20, 184, 166, 0.12);
    color: #d1d5db;
}

.tool-grid {
    display: grid;
    gap: 16px;
}

.tool-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field span,
.box-head h2 {
    color: var(--item_left_title_color);
    font-weight: 700;
}

.field textarea,
.field input,
.result {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: #111827;
    font: 14px/1.55 Consolas, "Microsoft YaHei", monospace;
}

.field textarea {
    min-height: 260px;
    padding: 14px;
    resize: vertical;
    user-select: text;
}

.field input {
    height: 44px;
    padding: 0 12px;
    user-select: text;
}

html[data-theme="Dark"] .field textarea,
html[data-theme="Dark"] .field input,
html[data-theme="Dark"] .result {
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.tool-actions button {
    padding: 0 16px;
}

.tool-actions.compact {
    margin-top: 12px;
}

.converter-box {
    min-width: 0;
}

.box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.box-head h2 {
    margin: 0;
    font-size: 18px;
}

.box-head button {
    padding: 0 12px;
}

.result {
    min-height: 220px;
    margin-top: 12px;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
    user-select: text;
}

@media (max-width: 860px) {
    .tool-shell {
        width: min(100% - 20px, 720px);
        margin: 18px auto;
    }

    .tool-layout,
    .tool-grid.two {
        grid-template-columns: 1fr;
    }

    .tool-tabs {
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }

    .tool-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 520px) {
    .tool-header {
        grid-template-columns: 38px 1fr 38px;
        gap: 10px;
        padding: 14px;
    }

    .tool-header h1 {
        font-size: 22px;
    }

    .tool-header p {
        font-size: 12px;
    }

    .tool-back,
    .tool-theme {
        width: 38px;
        height: 38px;
    }

    .tool-panel {
        padding: 14px;
    }

    .field textarea {
        min-height: 220px;
    }
}
