.truth-table-widget {
    margin: 1.2rem 0;
    padding: 1.2rem;
    border-radius: 22px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

.truth-widget-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.truth-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 700;
    color: #1e3a8a;
}

.truth-control-group select {
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    border: 1px solid #93c5fd;
    background: white;
    font-weight: 700;
    color: #0f172a;
}

.truth-control-buttons {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.truth-control-buttons button {
    border: 0;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    background: #2563eb;
    color: white;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.truth-control-buttons button:hover {
    transform: translateY(-1px);
}

.truth-lab-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.9fr);
    gap: 1rem;
    align-items: stretch;
}

.truth-table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    background: white;
    padding: 0.8rem;
    border: 1px solid #dbeafe;
}

.truth-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: center;
    overflow: hidden;
    border-radius: 14px;
}

.truth-table th {
    background: #1d4ed8;
    color: white;
    padding: 0.7rem;
}

.truth-table td {
    border-bottom: 1px solid #dbeafe;
    padding: 0.7rem;
    background: #ffffff;
    font-weight: 700;
}

.truth-table tr.active-row td {
    background: #dbeafe;
    outline: 2px solid #60a5fa;
    outline-offset: -2px;
}

.truth-output-one {
    color: #166534;
}

.truth-output-zero {
    color: #991b1b;
}

.truth-explanation-card {
    background: white;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.truth-explanation-card h3 {
    margin: 0;
    color: #1e3a8a;
}

.truth-explanation-card p {
    margin: 0;
}

.truth-row-status {
    padding: 0.9rem;
    border-radius: 16px;
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
}

.truth-mini-table {
    max-width: 420px;
}

@media (max-width: 760px) {
    .truth-lab-grid {
        grid-template-columns: 1fr;
    }

    .truth-widget-top {
        align-items: stretch;
    }

    .truth-control-buttons button {
        flex: 1 1 auto;
    }
}
