/* ======= 补码计算器 twos-complement-calculator ======= */

.tool-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-light);
}

.tool-title-wrapper i {
    font-size: 2rem;
    color: var(--primary-color);
}

.tool-title-wrapper .tool-title {
    margin-bottom: 0;
    border-bottom: none;
}

.tc-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 1.15rem;
    align-items: start;
    margin-top: 1rem;
}

.tc-panel {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.05rem 1.1rem;
}

.tc-panel-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.tc-panel-title i {
    color: var(--primary-color);
}

.tc-seg {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.3rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.22rem;
    margin-bottom: 0.9rem;
}

.tc-seg button {
    border: none;
    background: transparent;
    padding: 0.44rem 0.2rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.tc-seg button:hover {
    color: var(--primary-color);
}

.tc-seg button.active {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.tc-field {
    margin-bottom: 0.7rem;
}

.tc-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.28rem;
}

.tc-input {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    padding: 0.48rem 0.6rem;
}

.tc-pane.is-hidden {
    display: none;
}

.tc-row2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
}

.tc-hint {
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.tc-hint b {
    color: var(--text-secondary);
}

.tc-error {
    display: none;
    font-size: 0.79rem;
    line-height: 1.55;
    color: var(--danger-color);
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    margin-top: 0.55rem;
}

.tc-error.show {
    display: block;
}

.tc-main {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.tc-hero {
    background: linear-gradient(135deg, #2d8cf0 0%, #1c6fd0 100%);
    border-radius: var(--radius-lg);
    padding: 0.95rem 1.05rem 1.05rem;
    color: #fff;
}

.tc-hero-label {
    font-size: 0.76rem;
    opacity: 0.86;
    margin-bottom: 0.28rem;
}

.tc-hero-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.22rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.tc-hero-sub {
    font-size: 0.76rem;
    opacity: 0.85;
    margin-top: 0.34rem;
    line-height: 1.5;
}

.tc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.79rem;
}

.tc-table th,
.tc-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.tc-table th {
    width: 32%;
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}

.tc-table tbody tr:last-child th,
.tc-table tbody tr:last-child td {
    border-bottom: none;
}

.tc-table td {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text-primary);
    word-break: break-all;
}

.tc-wrap {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tc-note {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 0.62rem 0.8rem;
    font-size: 0.79rem;
    line-height: 1.65;
    color: var(--text-primary);
}

.tc-note.warn {
    border-left-color: #fa8c16;
    background: #fffbe6;
    border-color: #ffe58f;
    color: #874d00;
}

.tc-note.is-hidden {
    display: none;
}

.tc-bits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.18rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
}

.tc-bits span {
    display: inline-block;
    min-width: 1.2rem;
    text-align: center;
    padding: 0.1rem 0.12rem;
    border-radius: 3px;
}

.tc-bits span.sign {
    background: #fff1f0;
    color: #cf1322;
    font-weight: 700;
}

.tc-bits span.body {
    background: #f0f5ff;
    color: #1d39c4;
}

.tc-bits span.gap {
    min-width: 0.35rem;
    background: transparent;
}

@media (max-width: 900px) {
    .tc-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .tc-row2 {
        grid-template-columns: 1fr;
    }

    .tc-hero-value {
        font-size: 1.05rem;
    }
}
