.tool-shell {
    max-width: 1100px;
    margin: 0 auto;
    border-radius: 18px;
    padding-bottom: 14px;
    position: relative;
    isolation: isolate;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", sans-serif;
    color: #f6f0e6;
    background: radial-gradient(140% 120% at 10% -10%, rgba(140, 110, 70, 0.2), transparent 55%),
        radial-gradient(120% 120% at 90% 0%, rgba(100, 80, 50, 0.16), transparent 60%),
        rgba(12, 10, 8, 0.45);
    border: 1px solid rgba(120, 95, 70, 0.4);

    --tool-accent: #d4a168;
    --tool-border: rgba(120, 95, 70, 0.65);
    --tool-border-strong: rgba(212, 161, 104, 0.9);
    --tool-surface: rgba(24, 20, 16, 0.96);
    --tool-surface-2: rgba(12, 10, 8, 0.8);
    --tool-shadow: rgba(0, 0, 0, 0.45);
    --tool-title-font: "Ma Shan Zheng", "Caveat", "KaiTi", "STKaiti", ui-serif, "Songti SC", serif;
}

.tool-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='%23fff' fill-opacity='0.055'%3E%3Ccircle cx='7' cy='12' r='1'/%3E%3Ccircle cx='22' cy='18' r='1'/%3E%3Ccircle cx='41' cy='9' r='1'/%3E%3Ccircle cx='63' cy='14' r='1'/%3E%3Ccircle cx='80' cy='7' r='1'/%3E%3Ccircle cx='92' cy='20' r='1'/%3E%3Ccircle cx='14' cy='33' r='1'/%3E%3Ccircle cx='36' cy='28' r='1'/%3E%3Ccircle cx='55' cy='36' r='1'/%3E%3Ccircle cx='76' cy='32' r='1'/%3E%3Ccircle cx='88' cy='41' r='1'/%3E%3Ccircle cx='9' cy='52' r='1'/%3E%3Ccircle cx='27' cy='58' r='1'/%3E%3Ccircle cx='47' cy='49' r='1'/%3E%3Ccircle cx='69' cy='55' r='1'/%3E%3Ccircle cx='85' cy='63' r='1'/%3E%3Ccircle cx='4' cy='74' r='1'/%3E%3Ccircle cx='21' cy='82' r='1'/%3E%3Ccircle cx='44' cy='78' r='1'/%3E%3Ccircle cx='64' cy='86' r='1'/%3E%3Ccircle cx='82' cy='78' r='1'/%3E%3Ccircle cx='93' cy='90' r='1'/%3E%3C/g%3E%3Cg fill='%23000' fill-opacity='0.05'%3E%3Ccircle cx='12' cy='6' r='1'/%3E%3Ccircle cx='31' cy='14' r='1'/%3E%3Ccircle cx='52' cy='20' r='1'/%3E%3Ccircle cx='71' cy='10' r='1'/%3E%3Ccircle cx='90' cy='29' r='1'/%3E%3Ccircle cx='6' cy='40' r='1'/%3E%3Ccircle cx='25' cy='44' r='1'/%3E%3Ccircle cx='46' cy='39' r='1'/%3E%3Ccircle cx='66' cy='44' r='1'/%3E%3Ccircle cx='83' cy='46' r='1'/%3E%3Ccircle cx='18' cy='66' r='1'/%3E%3Ccircle cx='38' cy='62' r='1'/%3E%3Ccircle cx='58' cy='70' r='1'/%3E%3Ccircle cx='78' cy='68' r='1'/%3E%3Ccircle cx='92' cy='72' r='1'/%3E%3Ccircle cx='10' cy='92' r='1'/%3E%3Ccircle cx='33' cy='88' r='1'/%3E%3Ccircle cx='56' cy='92' r='1'/%3E%3Ccircle cx='74' cy='90' r='1'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 160px 160px;
    opacity: 0.12;
    mix-blend-mode: soft-light;
    filter: blur(0.1px);
}

.tool-hero {
    padding: 34px 16px 14px;
    border-bottom: 1px solid rgba(85, 85, 85, 0.55);
}

.tool-hero h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
    font-family: var(--tool-title-font);
    font-weight: 700;
}

.tool-subtitle {
    margin: 8px 0 0;
    opacity: 0.95;
    line-height: 1.45;
}

.tool-layout {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 980px) {
    .tool-layout {
        grid-template-columns: 420px 1fr;
        align-items: start;
    }
}

.tool-card {
    position: relative;
    border-radius: 10px;
    border: 2px solid rgba(95, 75, 52, 0.9);
    background: var(--tool-surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 12px;
    overflow: hidden;
}

.tool-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0.55;
    transform: translate(0.6px, -0.4px);
}

.tool-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.01em;
    font-family: var(--tool-title-font);
}

.tool-card-title::after {
    content: "";
    height: 1px;
    flex: 1 1 auto;
    background: rgba(212, 161, 104, 0.18);
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-row label {
    font-weight: 600;
    opacity: 0.96;
}

.tool-row input[type="number"],
.tool-row input[type="search"],
.tool-row select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(120, 95, 70, 0.75);
    background: rgba(8, 6, 5, 0.85);
    color: inherit;
    min-height: 40px;
}

.tool-row input:focus,
.tool-row select:focus {
    outline: none;
    border-color: var(--tool-border-strong);
    box-shadow: 0 0 0 2px rgba(212, 161, 104, 0.18);
}

.tool-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.tool-check {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(120, 95, 70, 0.75);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(8, 6, 5, 0.7);
    transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
}

.tool-check:hover {
    border-color: var(--tool-border-strong);
    background: rgba(51, 51, 51, 0.55);
    transform: translateY(-1px) rotate(-0.4deg);
}

.tool-check input {
    transform: translateY(0.5px);
}

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

.tool-actions .btn-secondary {
    flex: 0 0 auto;
}

.btn-secondary {
    padding: 10px 12px;
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(120, 95, 70, 0.75);
    background: rgba(8, 6, 5, 0.85);
    color: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: var(--tool-border-strong);
    background: rgba(51, 51, 51, 0.55);
    transform: translateY(-1px) rotate(0.4deg);
}

.btn-secondary[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(120, 95, 70, 0.75);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(8, 6, 5, 0.8);
    color: inherit;
    text-decoration: none;
    font-size: 13px;
}

.tool-chip:hover {
    border-color: var(--tool-border-strong);
    background: rgba(51, 51, 51, 0.55);
}

.tool-chip-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(61, 61, 61, 0.9);
    background: #1a1a1a;
    object-fit: cover;
    flex: 0 0 auto;
}

.tool-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tool-badge {
    border: 1px solid rgba(120, 95, 70, 0.6);
    background: rgba(8, 6, 5, 0.7);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    opacity: 0.9;
}

.tool-badge--good {
    border-color: rgba(124, 214, 167, 0.35);
    color: rgba(124, 214, 167, 0.95);
    background: rgba(6, 16, 10, 0.38);
}

.tool-badge--warn {
    border-color: rgba(220, 90, 90, 0.38);
    color: rgba(236, 118, 118, 0.98);
    background: rgba(20, 6, 6, 0.38);
}

.tool-badge--info {
    border-color: rgba(140, 170, 210, 0.32);
    color: rgba(170, 205, 246, 0.96);
    background: rgba(6, 10, 18, 0.38);
}

.tool-output {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-output-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(120, 95, 70, 0.7);
    background: rgba(10, 8, 6, 0.8);
}

.tool-output-key {
    opacity: 0.85;
    font-weight: 600;
}

.tool-output-val {
    font-variant-numeric: tabular-nums;
}

.tool-note {
    opacity: 0.92;
    font-size: 13px;
    line-height: 1.45;
}

.tool-error {
    border: 1px solid rgba(220, 90, 90, 0.5);
    background: rgba(20, 6, 6, 0.38);
    color: rgba(236, 118, 118, 0.98);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.tool-success-pop {
    animation: tool-pop 420ms ease;
}

@keyframes tool-pop {
    0% {
        transform: scale(1) rotate(0deg);
    }
    70% {
        transform: scale(1.12) rotate(-8deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}
